git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@19419 ebf7c1c2-ba36-0410-9fe8-c592906822b4

This commit is contained in:
coalado 2013-01-18 12:13:40 +00:00
parent f5270419a3
commit 8ccc305e32
98 changed files with 3616 additions and 2070 deletions

View File

@ -67,7 +67,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/AppWorkUtils"/>
<classpathentry kind="lib" path="ressourcen/libs/sevenzipjbindingWin.jar"/>
<classpathentry kind="lib" path="ressourcen/libs/swingx.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/UpdateClient"/>
<classpathentry kind="lib" path="ressourcen/libs_ext/mqtt.jar"/>
<classpathentry kind="lib" path="ressourcen/libs/laf/substance.jar"/>
<classpathentry kind="lib" path="ressourcen/libs/neembuu/jpfm.jar" sourcepath="ressourcen/code-ressourcen/neembuu/jpfm.src.zip"/>

View File

@ -1,9 +1,10 @@
<project default="all" basedir=".">
<!-- Dependencies -->
<property name="dep.awu" value="../AppWorkUtils" />
<property name="dep.serveroptions" value="../JDownloaderServerOptions" />
<property name="dep.browser" value="../JDBrowser" />
<property name="dep.updateclient" value="../UpdateClient" />
<property name="dep.updateclient" value="../UpdateClientV2" />
<property name="dep.jdupdateclient" value="../JDownloaderUpdater" />
<property name="debug" value="true" />
@ -23,6 +24,7 @@
<fileset dir="${dep.awu}/libs" includes="**/*.jar" />
<fileset dir="${dep.browser}/libs" includes="**/*.jar" />
<fileset dir="${dep.updateclient}/libs" includes="**/*.jar" />
<fileset dir="${res}/libs" includes="**/*.jar" />
<fileset dir="${res}/libs_ext" includes="**/*.jar" />
</path>
@ -42,29 +44,32 @@
<!-- Build dependencies -->
<javac srcdir="${dep.awu}/src" excludes="**/test/**" debug="${debug}" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<javac srcdir="${dep.awu}/src" excludes="**/test/**" debug="${debug}" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<classpath refid="classpath" />
</javac>
<javac srcdir="${dep.browser}/src" excludes="" debug="${debug}" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<javac srcdir="${dep.browser}/src" excludes="" debug="${debug}" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<classpath refid="classpath" />
</javac>
<javac srcdir="${dep.updateclient}/src" excludes="" debug="${debug}" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<javac srcdir="${dep.updateclient}/src" excludes="" debug="${debug}" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<classpath refid="classpath" />
</javac>
<javac srcdir="src" debug="${debug}" excludes="jd/utils/dev/*,org/jdownloader/extensions/langfileeditor/**/*,org/jdownloader/extensions/neembuu/**/*,org/jdownloader/extensions/remoteserv/**/*" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<javac srcdir="src" debug="${debug}" excludes="jd/utils/dev/*,org/jdownloader/extensions/langfileeditor/**/*,org/jdownloader/extensions/neembuu/**/*,org/jdownloader/extensions/remoteserv/**/*" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<classpath refid="classpath" />
</javac>
<javac srcdir="${dep.jdupdateclient}/src" excludes="" debug="${debug}" destdir="${cls}" encoding="UTF-8" source="1.6" target="1.6" includeantruntime="false">
<classpath refid="classpath" />
</javac>
<echo message="Finished." />
</target>
@ -79,12 +84,17 @@
<fileset dir="${res}/libs" includes="**/*" />
</copy>
<copy todir="${dist}/libs">
<fileset dir="${dep.awu}/libs" includes="**/*.jar" />
<fileset dir="${dep.awu}/libs" includes="**/*.jar">
<!-- -->
<exclude name="miglayout.jar" />
</fileset>
</copy>
<copy todir="${dist}">
<fileset dir="themes" includes="**/*" />
</copy>
<copy todir="${dist}/licenses">
<fileset dir="${res}/licenses" includes="**/*" />
</copy>
@ -96,8 +106,8 @@
<fileset dir="${res}" includes="*.txt, *.exe, *.bat, *.properties" />
</copy>
<copy todir="${dist}">
<fileset dir="${res}" includes="*.txt, *.exe, *.bat, *.properties" />
</copy>
<fileset dir="${res}" includes="*.txt, *.exe, *.bat, *.properties" />
</copy>
<mkdir dir="${dist}/java" />
<mkdir dir="${dist}/tmp" />
@ -115,8 +125,7 @@
<copy todir="${dist}">
<fileset dir="translations" includes="**/*.lng" />
<fileset dir="fileoptions" includes="**/*.clientOptions" />
<fileset dir="fileoptions" includes="**/*.serverOptions" />
</copy>
<loadfile property="svn.revision" srcFile=".svn/entries">
<filterchain>
@ -195,21 +204,8 @@
</fileset>
</jar>
<jar file="${dist}/libs/AppWorkUtilities.jar" manifest="${dist}/Manifest.MF">
<fileset dir="${working}">
<include name="version.nfo" />
</fileset>
<fileset dir="${cls}">
<include name="org/appwork/**/*" />
<exclude name="org/appwork/update/server/**/*" />
</fileset>
<fileset dir="${dep.awu}/src">
<include name="images/*.png" />
</fileset>
</jar>
<delete file="${dist}/Manifest.MF" failonerror="false" />
<delete file="${dist}/Manifest.MF" failonerror="true" />
<pathconvert pathsep=" " dirsep="/" property="class-path">
<path>
<fileset dir="${dist}/libs" includes="**/*.jar" />
@ -228,10 +224,12 @@
<attribute name="Created-By" value="JD-Team and AppWork GmbH" />
<attribute name="Main-Class" value="jd.Main" />
<!-- plugins that serialize own classes have to be put in the classpath -->
<attribute name="Class-Path" value="${class-path} ${class-path-extensions}" />
<attribute name="Class-Path" value="JDownloader.jar ${class-path} ${class-path-extensions}" />
</manifest>
<jar file="${dist}/JDownloader.jar" manifest="${dist}/Manifest.MF">
<!--CORE-->
<jar file="${dist}/Core.jar" manifest="${dist}/Manifest.MF">
<fileset dir="${working}">
<include name="version.nfo" />
</fileset>
@ -242,12 +240,13 @@
<exclude name="jd/controlling/reconnect/plugins/*/**/*" />
<exclude name="jd/captcha/**" />
<exclude name="org/appwork/**/*" />
<exclude name="org/jdownloader/update/**/*" />
<exclude name="org/jdownloader/dynamic/**/*" />
<exclude name="jd/dynamics/**" />
<exclude name="jd/gui/**" />
<exclude name="com/fastcgi/**" />
<exclude name="org/jdownloader/container/**/*" />
<exclude name="org/jdownloader/updatev2/**/*" />
<exclude name="jd/http/**" />
<exclude name="jd/nutils/**" />
@ -263,11 +262,12 @@
<fileset dir="${cls}">
<include name="jd/plugins/hoster/RTMPDownload.class" />
</fileset>
<!--
<fileset dir="${dep.updateclient}/src">
<include name="**/*.lng" />
<include name="**/*.png" />
</fileset>
-->
<fileset dir="${res}">
@ -275,7 +275,63 @@
<exclude name="jd/captcha/methods" />
</fileset>
</jar>
<delete file="${dist}/Manifest.MF" failonerror="false" />
<delete file="${dist}/Manifest.MF" failonerror="true" />
<delete file="${working}/version.nfo" failonerror="true" />
<echo file="${working}/version.nfo">${updateclient.revision}</echo>
<pathconvert pathsep="${line.separator}" dirsep="/" property="cp">
<path>
<fileset dir="${dist}/libs" includes="**/*.jar" />
</path>
<mapper type="regexp" from="[\\/]dist[\\/](libs[\\/].*)" to="\1" />
</pathconvert>
<pathconvert pathsep="${line.separator}" dirsep="/" property="cpe">
<path>
<fileset dir="${dist}/extensions" includes="**/*.jar" />
</path>
<mapper type="regexp" from="[\\/]dist[\\/](extensions[\\/].*)" to="\1" />
</pathconvert>
<delete file="${working}/classpath" failonerror="true" />
<echo file="${working}/classpath">Core.jar${line.separator}${cp}${line.separator}${cpe}</echo>
<!--launcher-->
<manifest file="${dist}/Manifest.MF">
<attribute name="Created-By" value="AppWork GmbH" />
<attribute name="Main-Class" value="org.jdownloader.update.launcher.JDLauncher" />
<!-- plugins that serialize own classes have to be put in the classpath -->
<attribute name="Class-Path" value="" />
</manifest>
<jar file="${dist}/JDownloader.jar" manifest="${dist}/Manifest.MF">
<zipfileset src="${dep.awu}/libs/miglayout.jar" excludes="META-INF/*" />
<zipfileset src="${dep.updateclient}/libs/xz.jar" excludes="META-INF/*" />
<fileset dir="${working}">
<include name="version.nfo" />
<include name="classpath" />
</fileset>
<fileset dir="${cls}">
<include name="classpath" />
<include name="org/jdownloader/logging/**/*" />
<include name="org/jdownloader/updatev2/**/*" />
<include name="org/jdownloader/update/**/*.class" />
<include name="org/appwork/**/*" />
<exclude name="org/appwork/update/server/**/*" />
</fileset>
<fileset dir="${dep.jdupdateclient}/src">
<include name="cfg/**/*" />
</fileset>
<fileset dir="themes">
<include name="**/images/dialog/**/*" />
<include name="**/images/update*" />
</fileset>
</jar>
<delete file="${dist}/Manifest.MF" failonerror="true" />
</target>
@ -342,7 +398,7 @@
<buildAddon package="JDGrowl" include="growl" />
<buildAddon package="AntiShutdown" include="antistandby" />
<buildAddon package="Streaming" include="streaming" />
<buildAddon package="Extraction" include="extraction" />
@ -350,7 +406,7 @@
<buildAddon package="webinterface" include="webinterface" />
<buildAddon package="neembuu" include="neembuu" />
<buildAddon package="translator" include="translator" />
<delete file="${dist}/Manifest.MF" failonerror="false" />
<delete file="${dist}/Manifest.MF" failonerror="true" />
</target>
<!-- Use this to build an reconnect plugin -->
@ -376,13 +432,33 @@
<delete file="${dist}/Manifest.MF" failonerror="false" />
<delete file="${dist}/Manifest.MF" failonerror="true" />
</target>
<target name="update">
<delete dir="${update_1}" />
<mkdir dir="${update_1}" />
<delete dir="${update_2}" />
<mkdir dir="${update_2}" />
<copy todir="${update_1}" overwrite="true">
<fileset dir="${dist}" includes="JDownloader.jar" />
</copy>
<copy todir="${update_2}" overwrite="true">
<fileset dir="${dist}">
<exclude name="JDownloader.jar" />
</fileset>
</copy>
<copy todir="${update_2}" overwrite="true">
<fileset dir="${dep.serveroptions}">
<include name="**/*.serverOptions" />
<include name="**/*.clientOptions" />
</fileset>
</copy>
</target>

View File

@ -47,7 +47,6 @@ import jd.gui.swing.MacOSApplicationAdapter;
import jd.gui.swing.SwingGui;
import jd.gui.swing.jdgui.JDGui;
import jd.gui.swing.jdgui.events.EDTEventQueue;
import jd.gui.swing.laf.LookAndFeelController;
import jd.http.Browser;
import jd.http.ext.security.JSPermissionRestricter;
import jd.plugins.DownloadLink;
@ -59,17 +58,12 @@ import org.appwork.app.launcher.parameterparser.CommandSwitchListener;
import org.appwork.app.launcher.parameterparser.ParameterParser;
import org.appwork.controlling.SingleReachableState;
import org.appwork.shutdown.ShutdownController;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.config.JsonConfig;
import org.appwork.storage.config.ValidationException;
import org.appwork.storage.config.events.GenericConfigEventListener;
import org.appwork.storage.config.handler.KeyHandler;
import org.appwork.swing.components.tooltips.ToolTipController;
import org.appwork.txtresource.TranslationFactory;
import org.appwork.update.inapp.RlyExitListener;
import org.appwork.update.inapp.WebupdateSettings;
import org.appwork.update.updateclient.InstallLogList;
import org.appwork.update.updateclient.InstalledFile;
import org.appwork.utils.Application;
import org.appwork.utils.IO;
import org.appwork.utils.event.DefaultEventListener;
@ -101,19 +95,16 @@ import org.jdownloader.settings.staticreferences.CFG_GENERAL;
import org.jdownloader.statistics.StatsManager;
import org.jdownloader.toolbar.ToolbarOffer;
import org.jdownloader.translate._JDT;
import org.jdownloader.update.JDUpdater;
import org.jdownloader.updatev2.RestartController;
import sun.awt.shell.ShellFolder;
import sun.java2d.ScreenUpdateManager;
public class Launcher {
static {
try {
statics();
} catch (Throwable e) {
e.printStackTrace();
org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
// TODO: call Updater.jar
}
statics();
}
private static LogSource LOG;
@ -142,16 +133,16 @@ public class Launcher {
System.setProperty("apple.laf.useScreenMenuBar", "true");
// native Mac just if User Choose Aqua as Skin
if (LookAndFeelController.getInstance().getPlaf().getName().equals("Apple Aqua")) {
// Mac Java from 1.3
System.setProperty("com.apple.macos.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.growbox.intrudes", "true");
System.setProperty("com.apple.hwaccel", "true");
// Mac Java from 1.4
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("apple.awt.showGrowBox", "true");
}
// if (LookAndFeelController.getInstance().getPlaf().getName().equals("Apple Aqua")) {
// // Mac Java from 1.3
// System.setProperty("com.apple.macos.useScreenMenuBar", "true");
// System.setProperty("com.apple.mrj.application.growbox.intrudes", "true");
// System.setProperty("com.apple.hwaccel", "true");
//
// // Mac Java from 1.4
// System.setProperty("apple.laf.useScreenMenuBar", "true");
// System.setProperty("apple.awt.showGrowBox", "true");
// }
try {
MacOSApplicationAdapter.enableMacSpecial();
@ -169,11 +160,6 @@ public class Launcher {
e.printStackTrace();
}
NewUIO.setUserIO(new JDSwingUserIO());
RlyExitListener.getInstance().setEnabled(true);
org.jdownloader.controlling.JDRestartController.getInstance().setApp("JDownloader.app");
org.jdownloader.controlling.JDRestartController.getInstance().setExe("JDownloader.exe");
org.jdownloader.controlling.JDRestartController.getInstance().setJar("JDownloader.jar");
org.jdownloader.controlling.JDRestartController.getInstance().setUpdaterJar("Updater.jar");
}
@ -214,6 +200,7 @@ public class Launcher {
}
Launcher.LOG = LogController.GL;
LOG.info("Using Direct 3D: " + (ScreenUpdateManager.getInstance().getClass().getSimpleName().equals("D3DScreenUpdateManager")) + " (" + ScreenUpdateManager.getInstance().getClass() + ")");
// Mac OS specific
if (CrossSystem.isMac()) {
// Set MacApplicationName
@ -240,7 +227,7 @@ public class Launcher {
Launcher.LOG.finer(key + "=" + pr.get(key));
}
Launcher.LOG.info("JDownloader");
PARAMETERS = new ParameterParser(args);
PARAMETERS = RestartController.getInstance().getParameterParser(args);
PARAMETERS.getEventSender().addListener(new CommandSwitchListener() {
@Override
@ -258,8 +245,18 @@ public class Launcher {
}
});
PARAMETERS.parse(null);
checkSessionInstallLog();
org.jdownloader.controlling.JDRestartController.getInstance().setStartArguments(PARAMETERS.getRawArguments());
if (PARAMETERS.hasCommandSwitch("scanextensions")) {
JDInitFlags.REFRESH_CACHE = true;
}
if (PARAMETERS.hasCommandSwitch("scanplugins")) {
JDInitFlags.REFRESH_CACHE = true;
}
// checkSessionInstallLog();
boolean jared = Application.isJared(Launcher.class);
String revision = JDUtilities.getRevision();
if (!jared) {
@ -273,16 +270,7 @@ public class Launcher {
Launcher.preInitChecks();
for (int i = 0; i < args.length; i++) {
if (args[i].equalsIgnoreCase("-branch")) {
if (args[i + 1].equalsIgnoreCase("reset")) {
JDUpdater.getInstance().setForcedBranch(null);
Launcher.LOG.info("Switching back to default JDownloader branch");
} else {
JDUpdater.getInstance().setForcedBranch(args[i + 1]);
Launcher.LOG.info("Switching to " + args[i + 1] + " JDownloader branch");
}
i++;
} else if (args[i].equals("-prot")) {
if (args[i].equals("-prot")) {
Launcher.LOG.finer(args[i] + " " + args[i + 1]);
i++;
} else if (args[i].equals("--help") || args[i].equals("-h")) {
@ -348,53 +336,53 @@ public class Launcher {
}
private static void checkSessionInstallLog() {
File logFile = null;
try {
InstallLogList tmpInstallLog = new InstallLogList();
logFile = Application.getResource(org.appwork.update.standalone.Main.SESSION_INSTALL_LOG_LOG);
if (logFile.exists()) {
Launcher.LOG.info("Check SessionInstallLog");
tmpInstallLog = JSonStorage.restoreFromFile(logFile, tmpInstallLog);
for (InstalledFile iFile : tmpInstallLog) {
if (iFile.getRelPath().endsWith(".class")) {
// Updated plugins
JDInitFlags.REFRESH_CACHE = true;
Launcher.LOG.info("RefreshCache=true");
break;
}
if (iFile.getRelPath().startsWith("extensions") && iFile.getRelPath().endsWith(".jar")) {
// Updated extensions
JDInitFlags.REFRESH_CACHE = true;
Launcher.LOG.info("RefreshCache=true");
break;
}
if (iFile.getRelPath().endsWith(".class.backup")) {
// Updated plugins
JDInitFlags.REFRESH_CACHE = true;
Launcher.LOG.info("RefreshCache=true");
break;
}
if (iFile.getRelPath().startsWith("extensions") && iFile.getRelPath().endsWith(".jar.backup")) {
// Updated extensions
JDInitFlags.REFRESH_CACHE = true;
Launcher.LOG.info("RefreshCache=true");
break;
}
}
}
} catch (Throwable e) {
// JUst to be sure
Launcher.LOG.log(e);
} finally {
if (logFile != null) {
logFile.renameTo(new File(logFile.getAbsolutePath() + "." + System.currentTimeMillis()));
}
}
}
// private static void checkSessionInstallLog() {
// File logFile = null;
// try {
// InstallLogList tmpInstallLog = new InstallLogList();
// logFile = Application.getResource(org.appwork.update.standalone.Main.SESSION_INSTALL_LOG_LOG);
// if (logFile.exists()) {
// Launcher.LOG.info("Check SessionInstallLog");
// tmpInstallLog = JSonStorage.restoreFromFile(logFile, tmpInstallLog);
//
// for (InstalledFile iFile : tmpInstallLog) {
// if (iFile.getRelPath().endsWith(".class")) {
// // Updated plugins
// JDInitFlags.REFRESH_CACHE = true;
// Launcher.LOG.info("RefreshCache=true");
// break;
// }
// if (iFile.getRelPath().startsWith("extensions") && iFile.getRelPath().endsWith(".jar")) {
// // Updated extensions
// JDInitFlags.REFRESH_CACHE = true;
// Launcher.LOG.info("RefreshCache=true");
// break;
// }
// if (iFile.getRelPath().endsWith(".class.backup")) {
// // Updated plugins
// JDInitFlags.REFRESH_CACHE = true;
// Launcher.LOG.info("RefreshCache=true");
// break;
// }
// if (iFile.getRelPath().startsWith("extensions") && iFile.getRelPath().endsWith(".jar.backup")) {
// // Updated extensions
// JDInitFlags.REFRESH_CACHE = true;
// Launcher.LOG.info("RefreshCache=true");
// break;
// }
// }
// }
//
// } catch (Throwable e) {
// // JUst to be sure
// Launcher.LOG.log(e);
// } finally {
// if (logFile != null) {
// logFile.renameTo(new File(logFile.getAbsolutePath() + "." + System.currentTimeMillis()));
//
// }
// }
// }
private static void preInitChecks() {
Launcher.javaCheck();
@ -506,7 +494,7 @@ public class Launcher {
Launcher.LOG.log(e);
Dialog.getInstance().showExceptionDialog("Exception occured", "An unexpected error occured.\r\nJDownloader will try to fix this. If this happens again, please contact our support.", e);
org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
// org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
}
}
};
@ -514,7 +502,8 @@ public class Launcher {
final EDTHelper<Void> lafInit = new EDTHelper<Void>() {
@Override
public Void edtRun() {
LookAndFeelController.getInstance().setUIManager();
Dialog.getInstance().initLaf();
return null;
}
};
@ -561,12 +550,7 @@ public class Launcher {
public void onConfigValidatorError(KeyHandler<Boolean> keyHandler, Boolean invalidValue, ValidationException validateException) {
}
});
/* check for available updates */
// activate auto checker only if we are in jared
// mode
if ((JsonConfig.create(WebupdateSettings.class).isAutoUpdateCheckEnabled() && Application.isJared(Launcher.class)) || PARAMETERS.hasCommandSwitch("autoupdate")) {
JDUpdater.getInstance().startChecker();
}
/* start downloadwatchdog */
Thread.currentThread().setName("ExecuteWhenGuiReachedThread: Init DownloadWatchdog");
DownloadWatchDog.getInstance();
@ -638,7 +622,7 @@ public class Launcher {
} catch (Throwable e) {
Launcher.LOG.log(e);
Dialog.getInstance().showExceptionDialog("Exception occured", "An unexpected error occured.\r\nJDownloader will try to fix this. If this happens again, please contact our support.", e);
org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
// org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
}
}
@ -662,7 +646,7 @@ public class Launcher {
Launcher.LOG.log(e);
Dialog.getInstance().showExceptionDialog("Exception occured", "An unexpected error occured.\r\nJDownloader will try to fix this. If this happens again, please contact our support.", e);
org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
// org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
}
return null;
}

View File

@ -25,8 +25,8 @@ import java.util.logging.LogManager;
import java.util.logging.Logger;
import jd.gui.swing.jdgui.menu.actions.sendlogs.LogAction;
import jd.gui.swing.laf.LookAndFeelController;
import org.appwork.shutdown.ShutdownController;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.config.JsonConfig;
import org.appwork.storage.jackson.JacksonMapper;
@ -35,6 +35,7 @@ import org.appwork.utils.IO;
import org.appwork.utils.IOErrorHandler;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.dialog.Dialog;
import org.jdownloader.logging.ExtLogManager;
import org.jdownloader.logging.LogController;
public class Main {
@ -55,21 +56,13 @@ public class Main {
}
org.appwork.utils.Application.setApplication(".jd_home");
org.appwork.utils.Application.getRoot(jd.Launcher.class);
/* TODO: remove me */
try {
if (new File(new File(System.getProperty("user.home")), "b3984639.dat").exists()) {
System.out.println("Everybody's Klauseling");
System.exit(1);
}
} catch (Throwable e) {
e.printStackTrace();
}
Dialog.getInstance().setLafManager(LookAndFeelController.getInstance());
try {
// the logmanager should not be initialized here. so setting the
// property should tell the logmanager to init a ExtLogManager
// instance.
System.setProperty("java.util.logging.manager", "jd.ExtLogManager");
System.setProperty("java.util.logging.manager", ExtLogManager.class.getName());
((ExtLogManager) LogManager.getLogManager()).setLogController(LogController.getInstance());
} catch (Throwable e) {
e.printStackTrace();
@ -186,48 +179,29 @@ public class Main {
}
public static void main(String[] args) {
// USe Jacksonmapper in this project
System.err.println(CrossSystem.class.getClassLoader());
System.err.println(JacksonMapper.class.getClassLoader());
System.err.println(Thread.currentThread().getContextClassLoader());
JacksonMapper jm = new JacksonMapper();
JSonStorage.setMapper(jm);
checkLanguageSwitch(args);
try {
// USe Jacksonmapper in this project
JSonStorage.setMapper(new JacksonMapper());
checkLanguageSwitch(args);
try {
/* set D3D Property if not already set by user */
if (CrossSystem.isWindows() && System.getProperty("sun.java2d.d3d", null) == null) {
if (JsonConfig.create(org.jdownloader.settings.GraphicalUserInterfaceSettings.class).isUseD3D()) {
System.setProperty("sun.java2d.d3d", "true");
} else {
System.setProperty("sun.java2d.d3d", "false");
}
}
} catch (final Throwable e) {
e.printStackTrace();
}
ShutdownController.getInstance().addShutdownEvent(RunUpdaterOnEndAtLeastOnceDaily.getInstance());
jd.Launcher.mainStart(args);
/* set D3D Property if not already set by user */
if (CrossSystem.isWindows()) {
/* Main Thread must not die for JavaExe Extensions to work */
while (true) {
Thread.sleep(10000);
if (JsonConfig.create(org.jdownloader.settings.GraphicalUserInterfaceSettings.class).isUseD3D()) {
System.setProperty("sun.java2d.d3d", "true");
} else {
System.setProperty("sun.java2d.d3d", "false");
}
}
} catch (Throwable e) {
} catch (final Throwable e) {
e.printStackTrace();
try {
org.appwork.utils.logging.Log.exception(e);
} catch (Throwable e2) {
}
try {
final org.appwork.utils.swing.dialog.ExceptionDialog dialog = new org.appwork.utils.swing.dialog.ExceptionDialog(org.appwork.utils.swing.dialog.Dialog.LOGIC_DONT_SHOW_AGAIN_DELETE_ON_EXIT | org.appwork.utils.swing.dialog.Dialog.BUTTONS_HIDE_CANCEL | org.appwork.utils.swing.dialog.Dialog.STYLE_HIDE_ICON, "Exception occured", "An unexpected error occured.\r\nJDownloader will try to fix this. If this happens again, please contact our support.", e, null, null);
org.appwork.utils.swing.dialog.Dialog.getInstance().showDialog(dialog);
} catch (Throwable e2) {
}
try {
org.jdownloader.controlling.JDRestartController.getInstance().restartViaUpdater(false);
} catch (Throwable e2) {
}
}
jd.Launcher.mainStart(args);
}
}

View File

@ -1,170 +0,0 @@
package jd;
import org.appwork.javaexe.ConsoleEventType;
import org.appwork.javaexe.DeviceChangeType;
import org.appwork.javaexe.DeviceType;
import org.appwork.javaexe.JavaExe_SystemEventManagement;
import org.appwork.javaexe.LogOffTyp;
import org.appwork.javaexe.NetworkType;
import org.appwork.javaexe.PowerBroadcastEvent;
import org.appwork.javaexe.SessionEvent;
import org.appwork.javaexe.SystemEventHandler;
import org.appwork.shutdown.ShutdownController;
import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;
/**
* Class for javaexe launcher
*
* @author Thomas
*
*/
public class Main_SystemEventManagement extends JavaExe_SystemEventManagement implements SystemEventHandler {
private static final Main_SystemEventManagement INSTANCE = new Main_SystemEventManagement();
/**
* get the only existing instance of Main_SystemEventManagement. This is a singleton
*
* @return
*/
public static Main_SystemEventManagement getInstance() {
return Main_SystemEventManagement.INSTANCE;
}
private LogSource logger;
/**
* Create a new instance of Main_SystemEventManagement. This is a singleton class. Access the only existing instance by using
* {@link #getInstance()}.
*/
private Main_SystemEventManagement() {
super();
logger = LogController.getInstance().getLogger("WindowsSystemEventHandling");
logger.setInstantFlush(true);
}
public static int notifyEvent(int msg, int val1, int val2, String val3, int[] arr1, byte[] arr2) {
while (!Launcher.GUI_COMPLETE.isReached()) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
getInstance().logger.info("Event " + msg + "," + val1 + "," + val2 + "," + val3);
int ret = getInstance().onEvent(msg, val1, val2, val3, arr1, arr2);
getInstance().logger.info("Event " + msg + " Returned " + ret);
return ret;
}
@Override
protected SystemEventHandler getHandler() {
return this;
}
@Override
public boolean onQueryEndSession(LogOffTyp logOffTyp) {
logger.info("Querry End Session: " + logOffTyp);
return false;
}
@Override
public void onSessionEnd(boolean queryResponse, LogOffTyp logOffTyp) {
logger.info("SessuinEnd: REsult: " + queryResponse + " Type: " + logOffTyp);
if (queryResponse) {
ShutdownController.getInstance().requestShutdown(true);
}
}
@Override
public void onDisplayChange(int w, int h, int val1) {
logger.info("Display: " + w + "x" + h + " - " + val1 + " bits/pixel");
}
@Override
public void onScreenSaverState(boolean b) {
logger.info("Screensaver Active: " + b);
}
@Override
public void onPowerBroadcast(PowerBroadcastEvent ev) {
logger.info("Powerbroadcast: " + ev);
}
@Override
public boolean onQuerySuspend(boolean b) {
logger.info("Suspend system: " + b);
return true;
}
@Override
public void onPowerStatusChanged(boolean ac, byte chargingStatus, String percentageCharging, int secondsLeft, int secondsTotal) {
logger.info("PowerStatus: AC:" + ac + " Charging: " + chargingStatus + " " + percentageCharging + "% seconds left: " + secondsLeft + "/" + secondsTotal);
}
@Override
public void onOEMEvent(int val2) {
logger.info("OEM " + val2);
}
@Override
public void onCompacting(double percent) {
logger.info("Compacting RAM " + percent);
}
@Override
public void onSessionChange(SessionEvent sessionEvent, int sessionid, String username, boolean current) {
logger.info("Session CHanged: " + sessionEvent + " " + sessionid + " " + username + " " + current);
}
@Override
public void onDeviceChangeEvent(DeviceChangeType deviceChangeType, DeviceType deviceType) {
logger.info("DeviceChange: " + deviceChangeType + " - " + deviceChangeType);
}
@Override
public boolean onDeviceRemoveQuery(DeviceType deviceType) {
logger.info("Remove ? " + deviceType);
return true;
}
@Override
public boolean onDeviceConfigChangeQuery() {
logger.info("onDeviceConfigChangeQuery");
return true;
}
@Override
public void onDeviceConfigChange() {
logger.info("onDeviceConfigChange");
}
@Override
public void onDeviceConfigChangeCanceled() {
logger.info("onDeviceConfigChangeCanceled");
}
@Override
public void onNetworkConnected(String device, NetworkType networkType, String ip, String gateway, String mask) {
logger.info("Network: " + device + " " + networkType + " IP:" + ip + " gateway:" + gateway + " Mask:" + mask);
}
@Override
public void onNetworkDisconnect(String device) {
logger.info("Network disconnect: " + device);
}
@Override
public void onNetworkConnecting(String device) {
logger.info("Network connecting: " + device);
}
@Override
public boolean onConsoleEvent(ConsoleEventType type) {
logger.info(type + "");
return true;
}
}

View File

@ -1,287 +0,0 @@
package jd;
import java.io.File;
import java.lang.management.ManagementFactory;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.appwork.shutdown.ShutdownController;
import org.appwork.shutdown.ShutdownEvent;
import org.appwork.update.inapp.RestartDirectEvent;
import org.appwork.update.inapp.RestartViaUpdaterEvent;
import org.appwork.update.inapp.SilentUpdaterEvent;
import org.appwork.utils.Application;
import org.appwork.utils.processes.ProcessBuilderFactory;
public class RunUpdaterOnEndAtLeastOnceDaily extends ShutdownEvent {
private static final RunUpdaterOnEndAtLeastOnceDaily INSTANCE = new RunUpdaterOnEndAtLeastOnceDaily();
/**
* get the only existing instance of RunUpdaterOnEndAtLeastOnceDaily. This is a singleton
*
* @return
*/
public static RunUpdaterOnEndAtLeastOnceDaily getInstance() {
return RunUpdaterOnEndAtLeastOnceDaily.INSTANCE;
}
/**
* Create a new instance of RunUpdaterOnEndAtLeastOnceDaily. This is a singleton class. Access the only existing instance by using
* {@link #getInstance()}.
*/
private RunUpdaterOnEndAtLeastOnceDaily() {
setHookPriority(Integer.MIN_VALUE);
}
private static final byte WINDOWS = 0;
private static final byte MAC = 1;
private static final byte LINUX = 2;
private static byte OS;
static {
OS = getOSID(System.getProperty("os.name"));
}
public static byte getOSID(final String osString) {
if (osString == null) {
/* fallback to Windows */
return WINDOWS;
}
final String OS = osString.toLowerCase();
if (OS.contains("windows 7")) {
return WINDOWS;
} else if (OS.contains("windows xp")) {
return WINDOWS;
} else if (OS.contains("windows vista")) {
return WINDOWS;
} else if (OS.contains("windows 2000")) {
return WINDOWS;
} else if (OS.contains("windows 2003")) {
return WINDOWS;
} else if (OS.contains("windows server 2008")) {
return WINDOWS;
} else if (OS.contains("nt")) {
return WINDOWS;
} else if (OS.contains("windows")) {
return WINDOWS;
} else if (OS.contains("mac")) {
return MAC;
} else {
return LINUX;
}
}
public static String getRestartCommandLine() {
final StringBuilder sb = new StringBuilder();
for (final String s : getRestartParameters()) {
if (sb.length() > 0) {
sb.append(" ");
}
if (s.contains(" ")) {
sb.append("\"");
sb.append(s);
sb.append("\"");
} else {
sb.append(s);
}
}
return sb.toString();
}
public static java.util.List<String> getRestartParameters() {
final java.util.List<String> nativeParameters = new ArrayList<String>();
if (OS == WINDOWS) {
/*
* windows starts exe launcher
*/
nativeParameters.add(getResource("JDownloader.exe").getAbsolutePath());
return nativeParameters;
} else if (OS == MAC) {
String appname = "JDownloader.app";
File apppath = null;
File root = getRootByClass(RunUpdaterOnEndAtLeastOnceDaily.class, null);
final HashSet<File> loopMap = new HashSet<File>();
while (root != null && loopMap.add(root)) {
if (root.getName().endsWith(".app")) {
apppath = root.getParentFile();
appname = root.getName();
break;
}
root = root.getParentFile();
}
if (apppath == null) {
apppath = getResource("../../../../");
}
if (new File(apppath, appname).exists()) {
nativeParameters.add("open");
nativeParameters.add("-n");
nativeParameters.add(new File(apppath, appname).getAbsolutePath());
return nativeParameters;
}
}
return getJVMParameters();
}
private static java.util.List<String> getJVMParameters() {
final java.util.List<String> jvmParameter = new ArrayList<String>();
jvmParameter.add(getJavaBinary());
jvmParameter.add("-jar");
final List<String> lst = ManagementFactory.getRuntimeMXBean().getInputArguments();
boolean xmsset = false;
boolean useconc = false;
boolean minheap = false;
boolean maxheap = false;
for (final String h : lst) {
if (h.contains("Xmx")) {
if (Runtime.getRuntime().maxMemory() < 533000000) {
jvmParameter.add("-Xmx512m");
continue;
}
} else if (h.contains("xms")) {
xmsset = true;
} else if (h.contains("XX:+useconc")) {
useconc = true;
} else if (h.contains("minheapfree")) {
minheap = true;
} else if (h.contains("maxheapfree")) {
maxheap = true;
} else if (h.startsWith("-agentlib:")) {
continue;
}
jvmParameter.add(h);
}
if (!xmsset) {
jvmParameter.add("-Xms64m");
}
if (OS == LINUX) {
if (!useconc) {
jvmParameter.add("-XX:+UseConcMarkSweepGC");
}
if (!minheap) {
jvmParameter.add("-XX:MinHeapFreeRatio=0");
}
if (!maxheap) {
jvmParameter.add("-XX:MaxHeapFreeRatio=0");
}
}
jvmParameter.add("JDownloader.jar");
return jvmParameter;
}
public static File getResource(final String relative) {
return getRootByClass(RunUpdaterOnEndAtLeastOnceDaily.class, relative);
}
public static File getRootByClass(final Class<?> class1, final String subPaths) {
// this is the jar file
URL loc;
loc = class1.getProtectionDomain().getCodeSource().getLocation();
File appRoot;
try {
appRoot = new File(loc.toURI());
if (appRoot.isFile()) {
appRoot = appRoot.getParentFile();
}
if (subPaths != null) { return new File(appRoot, subPaths); }
return appRoot;
} catch (final URISyntaxException e) {
e.printStackTrace();
return null;
}
}
private static String getJavaBinary() {
String jvmPath = null;
String javaBinary = "java";
if (OS == WINDOWS) {
javaBinary = "javaw.exe";
}
jvmPath = javaBinary;
final String javaHome = System.getProperty("java.home");
if (javaHome != null) {
/* get path from system property */
final File java = new File(new File(javaHome), "/bin/" + javaBinary);
if (java.exists() && java.isFile()) {
jvmPath = java.getAbsolutePath();
}
}
return jvmPath;
}
@Override
public void run() {
if (!Application.isJared(Launcher.class)) return;
if (ShutdownController.getInstance().hasShutdownEvent(RestartViaUpdaterEvent.getInstance())) return;
if (ShutdownController.getInstance().hasShutdownEvent(RestartDirectEvent.getInstance())) return;
if (ShutdownController.getInstance().hasShutdownEvent(SilentUpdaterEvent.getInstance())) return;
if (System.getProperty("noBetaUpdater") != null) return;
java.util.List<String> command = new ArrayList<String>();
command.add(getJavaBinary());
command.add("-jar");
command.add("Updater.jar");
command.add("-guiless");
// command.add("-restart");
// command.add(getRestartCommandLine().replace("\"", "\\\""));
final String tiny[] = command.toArray(new String[] {});
/*
* build complete call arguments for tinybootstrap
*/
final StringBuilder sb = new StringBuilder();
for (final String arg : tiny) {
sb.append(arg);
sb.append(" ");
}
System.out.println(sb);
final ProcessBuilder pb = ProcessBuilderFactory.create(tiny);
/*
* needed because the root is different for jre/class version
*/
File pbroot = null;
pbroot = getRootByClass(RunUpdaterOnEndAtLeastOnceDaily.class, null);
pb.directory(pbroot);
try {
pb.start();
} catch (final Throwable e) {
e.printStackTrace();
}
}
}

View File

@ -1596,4 +1596,9 @@ public class DownloadWatchDog implements DownloadControllerListener, StateMachin
public void onRemoveFile(Object caller, File[] fileList) {
}
@Override
public long getShutdownVetoPriority() {
return 0;
}
}

View File

@ -177,6 +177,11 @@ public class LinkCollector extends PackageController<CrawledPackage, CrawledLink
}
}
@Override
public long getShutdownVetoPriority() {
return 0;
}
});
ShutdownController.getInstance().addShutdownEvent(new ShutdownEvent() {

View File

@ -19,14 +19,11 @@ import org.appwork.scheduler.DelayedRunnable;
import org.appwork.shutdown.ShutdownController;
import org.appwork.shutdown.ShutdownEvent;
import org.appwork.storage.config.JsonConfig;
import org.appwork.update.updateclient.UpdateHttpClientOptions;
import org.appwork.update.updateclient.UpdaterConstants;
import org.appwork.utils.StringUtils;
import org.appwork.utils.event.DefaultEventListener;
import org.appwork.utils.event.DefaultEventSender;
import org.appwork.utils.logging.Log;
import org.appwork.utils.net.httpconnection.HTTPProxy;
import org.appwork.utils.net.httpconnection.HTTPProxyStorable;
import org.appwork.utils.net.httpconnection.HTTPProxyUtils;
import org.appwork.utils.os.CrossSystem;
import org.jdownloader.logging.LogController;
@ -46,8 +43,6 @@ public class ProxyController {
private InternetConnectionSettings config;
private UpdateHttpClientOptions updaterConfig = null;
private GeneralSettings generalConfig = null;
private final Object LOCK = new Object();
@ -60,12 +55,23 @@ public class ProxyController {
return eventSender;
}
public static final String USE_PROXY = "USE_PROXY";
public static final String PROXY_HOST = "PROXY_HOST";
public static final String PROXY_PASS = "PROXY_PASS";
public static final String PROXY_PASS_SOCKS = "PROXY_PASS_SOCKS";
public static final String PROXY_PORT = "PROXY_PORT";
public static final String PROXY_USER = "PROXY_USER";
public static final String PROXY_USER_SOCKS = "PROXY_USER_SOCKS";
public static final String SOCKS_HOST = "SOCKS_HOST";
public static final String SOCKS_PORT = "SOCKS_PORT";
public static final String USE_SOCKS = "USE_SOCKS";
private ProxyController() {
eventSender = new DefaultEventSender<ProxyEvent<ProxyInfo>>();
/* init needed configs */
config = JsonConfig.create(InternetConnectionSettings.class);
generalConfig = JsonConfig.create(GeneralSettings.class);
updaterConfig = JsonConfig.create(UpdateHttpClientOptions.class);
/* init our NONE proxy */
none = new ProxyInfo(HTTPProxy.NONE);
loadProxySettings();
@ -82,18 +88,18 @@ public class ProxyController {
}
});
ShutdownController.getInstance().addShutdownEvent(new ShutdownEvent() {
@Override
public void run() {
exportUpdaterConfig();
}
@Override
public String toString() {
return "ProxyController: export important settings to updaterConfig";
}
});
// ShutdownController.getInstance().addShutdownEvent(new ShutdownEvent() {
//
// @Override
// public void run() {
// exportUpdaterConfig();
// }
//
// @Override
// public String toString() {
// return "ProxyController: export important settings to updaterConfig";
// }
// });
eventSender.addListener(new DefaultEventListener<ProxyEvent<ProxyInfo>>() {
DelayedRunnable asyncSaving = new DelayedRunnable(IOEQ.TIMINGQUEUE, 5000l, 60000l) {
@ -110,21 +116,21 @@ public class ProxyController {
});
}
private void exportUpdaterConfig() {
updaterConfig.setConnectTimeout(generalConfig.getHttpConnectTimeout());
updaterConfig.setReadTimeout(generalConfig.getHttpReadTimeout());
exportUpdaterProxy();
}
private void exportUpdaterProxy() {
ProxyInfo ldefaultproxy = defaultproxy;
if (ldefaultproxy != null && !ldefaultproxy.isNone()) {
HTTPProxyStorable storable = HTTPProxy.getStorable(ldefaultproxy);
updaterConfig.setProxy(storable);
} else {
updaterConfig.setProxy(null);
}
}
// private void exportUpdaterConfig() {
// updaterConfig.setConnectTimeout(generalConfig.getHttpConnectTimeout());
// updaterConfig.setReadTimeout(generalConfig.getHttpReadTimeout());
// exportUpdaterProxy();
// }
//
// private void exportUpdaterProxy() {
// ProxyInfo ldefaultproxy = defaultproxy;
// if (ldefaultproxy != null && !ldefaultproxy.isNone()) {
// HTTPProxyStorable storable = HTTPProxy.getStorable(ldefaultproxy);
// updaterConfig.setProxy(storable);
// } else {
// updaterConfig.setProxy(null);
// }
// }
public static List<HTTPProxy> autoConfig() {
java.util.List<HTTPProxy> ret = new ArrayList<HTTPProxy>();
@ -213,12 +219,12 @@ public class ProxyController {
private List<HTTPProxy> restoreFromOldConfig() {
java.util.List<HTTPProxy> ret = new ArrayList<HTTPProxy>();
SubConfiguration oldConfig = SubConfiguration.getConfig("DOWNLOAD", true);
if (oldConfig.getBooleanProperty(UpdaterConstants.USE_PROXY, false)) {
if (oldConfig.getBooleanProperty(USE_PROXY, false)) {
/* import old http proxy settings */
final String host = oldConfig.getStringProperty(UpdaterConstants.PROXY_HOST, "");
final int port = oldConfig.getIntegerProperty(UpdaterConstants.PROXY_PORT, 8080);
final String user = oldConfig.getStringProperty(UpdaterConstants.PROXY_USER, "");
final String pass = oldConfig.getStringProperty(UpdaterConstants.PROXY_PASS, "");
final String host = oldConfig.getStringProperty(PROXY_HOST, "");
final int port = oldConfig.getIntegerProperty(PROXY_PORT, 8080);
final String user = oldConfig.getStringProperty(PROXY_USER, "");
final String pass = oldConfig.getStringProperty(PROXY_PASS, "");
if (!StringUtils.isEmpty(host)) {
final HTTPProxy pr = new HTTPProxy(HTTPProxy.TYPE.HTTP, host, port);
if (!StringUtils.isEmpty(user)) {
@ -230,12 +236,12 @@ public class ProxyController {
ret.add(pr);
}
}
if (oldConfig.getBooleanProperty(UpdaterConstants.USE_SOCKS, false)) {
if (oldConfig.getBooleanProperty(USE_SOCKS, false)) {
/* import old socks5 settings */
final String user = oldConfig.getStringProperty(UpdaterConstants.PROXY_USER_SOCKS, "");
final String pass = oldConfig.getStringProperty(UpdaterConstants.PROXY_PASS_SOCKS, "");
final String host = oldConfig.getStringProperty(UpdaterConstants.SOCKS_HOST, "");
final int port = oldConfig.getIntegerProperty(UpdaterConstants.SOCKS_PORT, 1080);
final String user = oldConfig.getStringProperty(PROXY_USER_SOCKS, "");
final String pass = oldConfig.getStringProperty(PROXY_PASS_SOCKS, "");
final String host = oldConfig.getStringProperty(SOCKS_HOST, "");
final int port = oldConfig.getIntegerProperty(SOCKS_PORT, 1080);
if (!StringUtils.isEmpty(host)) {
final HTTPProxy pr = new HTTPProxy(HTTPProxy.TYPE.SOCKS5, host, port);
if (!StringUtils.isEmpty(user)) {
@ -429,7 +435,7 @@ public class ProxyController {
defaultproxy = def;
}
eventSender.fireEvent(new ProxyEvent<ProxyInfo>(this, ProxyEvent.Types.REFRESH, null));
exportUpdaterProxy();
// exportUpdaterProxy();
}
/**

View File

@ -32,6 +32,7 @@ import org.appwork.shutdown.ShutdownEvent;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogNoAnswerException;
import org.jdownloader.logging.LogController;
import org.jdownloader.updatev2.RestartController;
import com.apple.eawt.AboutHandler;
import com.apple.eawt.AppEvent;
@ -100,7 +101,7 @@ public class MacOSApplicationAdapter implements QuitHandler, AboutHandler, Prefe
public void handleQuitRequestWith(QuitEvent e, final QuitResponse response) {
quitResponse = response;
org.jdownloader.controlling.JDRestartController.getInstance().exit(true);
RestartController.getInstance().exitAsynch();
}
public void handlePreferences(PreferencesEvent e) {

View File

@ -48,7 +48,6 @@ import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.update.JDUpdater;
public class AboutDialog extends AbstractDialog<Integer> {
@ -72,15 +71,6 @@ public class AboutDialog extends AbstractDialog<Integer> {
JLabel lbl = new JLabel("JDownloader 2");
lbl.setFont(lbl.getFont().deriveFont(lbl.getFont().getSize() * 2.0f));
String branch = "";
try {
branch = JDUpdater.getInstance().getBranch().getName();
} catch (Throwable e2) {
}
JPanel links = new JPanel(new MigLayout("ins 0", "[]push[]push[]push[]"));
try {
JButton btn = Factory.createButton(_GUI._.jd_gui_swing_components_AboutDialog_license(), NewTheme.I().getIcon("premium", 16), new ActionListener() {
@ -121,7 +111,8 @@ public class AboutDialog extends AbstractDialog<Integer> {
contentpane.add(new JLabel(NewTheme.I().getIcon("logo/jd_logo_128_128", -1)), "aligny center, spany 6");
contentpane.add(lbl, "split 2");
contentpane.add(new JLabel(org.appwork.utils.StringUtils.isEmpty(branch) ? "" : "(" + branch + ")"), "pushx,growx");
// this has been the branch label
contentpane.add(new JLabel(""), "pushx,growx");
MigPanel stats = new MigPanel("ins 0,wrap 2", "[][grow,align right]", "[]");

View File

@ -50,7 +50,7 @@ import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.LocationStorage;
import org.appwork.utils.swing.dialog.RememberAbsoluteLocator;
import org.appwork.utils.swing.dialog.locator.RememberAbsoluteDialogLocator;
import org.jdownloader.DomainInfo;
import org.jdownloader.actions.AppAction;
import org.jdownloader.gui.translate._GUI;
@ -86,9 +86,9 @@ public abstract class AbstractCaptchaDialog extends AbstractDialog<Object> imple
public AbstractCaptchaDialog(int flags, String title, DialogType type, DomainInfo domainInfo, String explain, CaptchaResult defaultValue2, Image... images) {
super(flags, title, null, null, null);
if (JsonConfig.create(GraphicalUserInterfaceSettings.class).isCaptchaDialogUniquePositionByHosterEnabled()) {
setLocator(new RememberAbsoluteLocator("CaptchaDialog_" + domainInfo.getTld()));
setLocator(new RememberAbsoluteDialogLocator("CaptchaDialog_" + domainInfo.getTld()));
} else {
setLocator(new RememberAbsoluteLocator("CaptchaDialog"));
setLocator(new RememberAbsoluteDialogLocator("CaptchaDialog"));
}
// if we have gif images, but read them as non indexed images, we try to fix this here.
java.util.List<Image> ret = new ArrayList<Image>();

View File

@ -31,6 +31,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;
import javax.swing.AbstractAction;
@ -84,6 +85,8 @@ import org.jdownloader.settings.FrameStatus.ExtendedState;
import org.jdownloader.settings.GraphicalUserInterfaceSettings;
import org.jdownloader.settings.staticreferences.CFG_GUI;
import org.jdownloader.statistics.StatsManager;
import org.jdownloader.updatev2.RestartController;
import org.jdownloader.updatev2.UpdateController;
public class JDGui extends SwingGui {
@ -148,6 +151,35 @@ public class JDGui extends SwingGui {
if (this.mainFrame.getRootPane().getUI().toString().contains("SyntheticaRootPaneUI")) {
((de.javasoft.plaf.synthetica.SyntheticaRootPaneUI) this.mainFrame.getRootPane().getUI()).setMaximizedBounds(this.mainFrame);
}
mainFrame.addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent e) {
UpdateController.getInstance().setGuiToFront(mainFrame);
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
UpdateController.getInstance().setGuiToFront(mainFrame);
}
public void windowDeactivated(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
Dialog.getInstance().setParentOwner(getMainFrame());
}
});
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(new KeyEventPostProcessor() {
public boolean postProcessKeyEvent(final KeyEvent e) {
@ -683,7 +715,8 @@ public class JDGui extends SwingGui {
}.start();
return;
}
org.jdownloader.controlling.JDRestartController.getInstance().exit(true);
RestartController.getInstance().exitAsynch();
}
}

View File

@ -2,10 +2,9 @@ package jd.gui.swing.jdgui.components.toolbar.actions;
import java.awt.event.ActionEvent;
import jd.utils.WebUpdate;
import org.jdownloader.gui.shortcuts.ShortcutController;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.updatev2.UpdateController;
public class UpdateAction extends AbstractToolbarAction {
private static final UpdateAction INSTANCE = new UpdateAction();
@ -23,7 +22,7 @@ public class UpdateAction extends AbstractToolbarAction {
* Create a new instance of UpdateAction. This is a singleton class. Access the only existing instance by using {@link #getInstance()}.
*/
private UpdateAction() {
setEnabled(false);
}
public boolean isDefaultVisible() {
@ -32,7 +31,14 @@ public class UpdateAction extends AbstractToolbarAction {
public void actionPerformed(ActionEvent e) {
/* WebUpdate is running in its own Thread */
WebUpdate.doUpdateCheck(true);
new Thread() {
public void run() {
// runUpdateChecker is synchronized and may block
UpdateController.getInstance().setGuiVisible(true);
UpdateController.getInstance().runUpdateChecker(true);
}
}.start();
}
@Override

View File

@ -20,6 +20,7 @@ import java.awt.event.ActionEvent;
import org.jdownloader.gui.shortcuts.ShortcutController;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.updatev2.RestartController;
public class ExitAction extends ActionAdapter {
@ -31,7 +32,7 @@ public class ExitAction extends ActionAdapter {
@Override
public void onAction(ActionEvent e) {
org.jdownloader.controlling.JDRestartController.getInstance().exit(true);
RestartController.getInstance().exitAsynch();
}
@Override

View File

@ -52,7 +52,7 @@ public class RestartAction extends ActionAdapter {
//
// }
// }
org.jdownloader.controlling.JDRestartController.getInstance().directRestart(true);
org.jdownloader.controlling.JDRestartController.getInstance().directRestart();
// }
}

View File

@ -170,7 +170,7 @@ public abstract class ConfigPanel extends SwitchPanel {
if (!ShutdownController.getInstance().isShutDownRequested()) {
int answer = UserIO.getInstance().requestConfirmDialog(0, _GUI._.jd_gui_swing_jdgui_settings_ConfigPanel_restartquestion_title(), _GUI._.jd_gui_swing_jdgui_settings_ConfigPanel_restartquestion(), null, _GUI._.jd_gui_swing_jdgui_settings_ConfigPanel_restartquestion_ok(), null);
if (UserIO.isOK(answer)) {
org.jdownloader.controlling.JDRestartController.getInstance().directRestart(true);
org.jdownloader.controlling.JDRestartController.getInstance().directRestart();
}
}
}

View File

@ -86,7 +86,8 @@ public class GUISettings extends AbstractConfigPanel {
try {
Dialog.getInstance().showConfirmDialog(0, _GUI._.GUISettings_save_language_changed_restart_required_title(), _GUI._.GUISettings_save_language_changed_restart_required_msg(), NewTheme.getInstance().getIcon("language", 32), null, null);
JDRestartController.getInstance().directRestart(true);
JDRestartController.getInstance().directRestart();
} catch (DialogClosedException e2) {
} catch (DialogCanceledException e2) {

View File

@ -1,95 +0,0 @@
// jDownloader - Downloadmanager
// Copyright (C) 2009 JD-Team support@jdownloader.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.gui.swing.jdgui.views.settings.panels.addons;
import jd.gui.UserIO;
import jd.gui.swing.jdgui.menu.AddonsMenu;
import org.appwork.swing.exttable.ExtTableModel;
import org.appwork.swing.exttable.columns.ExtCheckColumn;
import org.appwork.utils.swing.dialog.Dialog;
import org.jdownloader.extensions.LazyExtension;
import org.jdownloader.extensions.StartException;
import org.jdownloader.extensions.StopException;
import org.jdownloader.translate._JDT;
public class ActivateColumn extends ExtCheckColumn<LazyExtension> {
private static final long serialVersionUID = 658156218405204887L;
private final ExtensionManager addons;
public ActivateColumn(String name, ExtTableModel<LazyExtension> table, ExtensionManager addons) {
super(name, table);
this.addons = addons;
}
@Override
public boolean isEditable(LazyExtension obj) {
return true;
}
@Override
protected boolean getBooleanValue(LazyExtension value) {
return value._isEnabled();
}
@Override
protected void setBooleanValue(boolean value, LazyExtension object) {
if (value == object._isEnabled()) return;
if (value) {
try {
object._setEnabled(true);
if (object._getExtension().getGUI() != null) {
int ret = UserIO.getInstance().requestConfirmDialog(UserIO.DONT_SHOW_AGAIN, object.getName(), _JDT._.gui_settings_extensions_show_now(object.getName()));
if (UserIO.isOK(ret)) {
// activate panel
object._getExtension().getGUI().setActive(true);
// bring panel to front
object._getExtension().getGUI().toFront();
}
}
} catch (StartException e) {
Dialog.getInstance().showExceptionDialog(_JDT._.dialog_title_exception(), e.getMessage(), e);
} catch (StopException e) {
e.printStackTrace();
}
} else {
try {
object._setEnabled(false);
} catch (StartException e) {
e.printStackTrace();
} catch (StopException e) {
Dialog.getInstance().showExceptionDialog(_JDT._.dialog_title_exception(), e.getMessage(), e);
}
}
/*
* we save enabled/disabled status here, plugin must be running when
* enabled
*/
AddonsMenu.getInstance().onUpdated();
// ConfigSidebar.getInstance(null).updateAddons();
addons.updateShowcase();
}
}

View File

@ -1,103 +0,0 @@
// jDownloader - Downloadmanager
// Copyright (C) 2008 JD-Team support@jdownloader.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.gui.swing.jdgui.views.settings.panels.addons;
import javax.swing.ImageIcon;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.appwork.swing.exttable.ExtTable;
import org.jdownloader.extensions.LazyExtension;
import org.jdownloader.gui.settings.AbstractConfigPanel;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.translate._JDT;
/**
* @author JD-Team
*/
public class ExtensionManager extends AbstractConfigPanel {
public ImageIcon getIcon() {
return NewTheme.I().getIcon("extension", 32);
}
private static final long serialVersionUID = 4145243293360008779L;
private ExtTable<LazyExtension> table;
private JTextArea txtDescription;
public ExtensionManager() {
super();
init();
}
protected void init() {
this.addHeader(getTitle(), getIcon());
txtDescription = this.addDescription(_JDT._.gui_settings_extensions_description());
table = new ExtensionsTable();
this.add(new JScrollPane(table));
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
updateShowcase();
}
});
// JScrollPane scrollPane = new JScrollPane(txtDescription);
//
// // table.getSelectionModel().setSelectionInterval(0, 0);
// descHeader = new Header("", null);
// add(descHeader, "spanx,newline,growx,pushx");
// txtDescription = this.addDescription("");
// add(scrollPane);
}
public void updateShowcase() {
int row = table.getSelectedRow();
if (row < 0) return;
// table.getExtTableModel().fireTableRowsUpdated(row, row);
LazyExtension opw = table.getExtTableModel().getElementAt(row);
// descHeader.setIcon(opw._getIcon(32));
// descHeader.setText(opw.getName());
txtDescription.setText(opw.getDescription());
// txtDescription.setCaretPosition(0);
}
@Override
public String getTitle() {
return _GUI._.extensionManager_title();
}
@Override
public void save() {
table.getSelectionModel().setSelectionInterval(0, 0);
}
@Override
public void updateContents() {
}
}

View File

@ -1,189 +0,0 @@
package jd.gui.swing.jdgui.views.settings.panels.addons;
import java.awt.Color;
import java.awt.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import javax.swing.Icon;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.JTableHeader;
import jd.gui.UserIO;
import jd.gui.swing.jdgui.BasicJDTable;
import jd.gui.swing.jdgui.menu.AddonsMenu;
import jd.gui.swing.jdgui.views.settings.components.SettingsComponent;
import jd.gui.swing.jdgui.views.settings.components.StateUpdateListener;
import org.appwork.swing.exttable.ExtTableHeaderRenderer;
import org.appwork.swing.exttable.ExtTableModel;
import org.appwork.swing.exttable.SelectionHighlighter;
import org.appwork.swing.exttable.columns.ExtCheckColumn;
import org.appwork.swing.exttable.columns.ExtLongColumn;
import org.appwork.swing.exttable.columns.ExtTextColumn;
import org.appwork.utils.swing.dialog.Dialog;
import org.jdownloader.extensions.ExtensionController;
import org.jdownloader.extensions.LazyExtension;
import org.jdownloader.extensions.StartException;
import org.jdownloader.extensions.StopException;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.translate._JDT;
public class ExtensionsTable extends BasicJDTable<LazyExtension> implements SettingsComponent {
private static final long serialVersionUID = 1L;
public ExtensionsTable() {
super(new InternalTableModel());
addRowHighlighter(new SelectionHighlighter(null, new Color(200, 200, 200, 80)));
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
public void addStateUpdateListener(StateUpdateListener listener) {
throw new IllegalStateException("Not implemented");
}
private static class InternalTableModel extends ExtTableModel<LazyExtension> {
private static final long serialVersionUID = 5847076032639053531L;
private java.util.List<LazyExtension> pluginsOptional;
public InternalTableModel() {
super("addonTable");
pluginsOptional = new ArrayList<LazyExtension>(ExtensionController.getInstance().getExtensions());
Collections.sort(pluginsOptional, new Comparator<LazyExtension>() {
public int compare(LazyExtension o1, LazyExtension o2) {
return o1.getName().compareTo(o2.getName());
}
});
setTableData(pluginsOptional);
}
@Override
protected void initColumns() {
this.addColumn(new ExtCheckColumn<LazyExtension>(_GUI._.extensiontablemodel_column_enabled()) {
private static final long serialVersionUID = 1L;
public ExtTableHeaderRenderer getHeaderRenderer(final JTableHeader jTableHeader) {
final ExtTableHeaderRenderer ret = new ExtTableHeaderRenderer(this, jTableHeader) {
private static final long serialVersionUID = 1L;
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
setIcon(NewTheme.I().getIcon("ok", 14));
setHorizontalAlignment(CENTER);
setText(null);
return this;
}
};
return ret;
}
@Override
public int getMaxWidth() {
return 30;
}
@Override
public boolean isHidable() {
return false;
}
@Override
protected boolean getBooleanValue(LazyExtension value) {
return value._isEnabled();
}
@Override
protected void setBooleanValue(boolean value, LazyExtension object) {
if (value == object._isEnabled()) return;
if (value) {
try {
object._setEnabled(true);
if (object._getExtension().getGUI() != null) {
int ret = UserIO.getInstance().requestConfirmDialog(UserIO.DONT_SHOW_AGAIN, object.getName(), _JDT._.gui_settings_extensions_show_now(object.getName()));
if (UserIO.isOK(ret)) {
// activate panel
object._getExtension().getGUI().setActive(true);
// bring panel to front
object._getExtension().getGUI().toFront();
}
}
} catch (StartException e) {
Dialog.getInstance().showExceptionDialog(_JDT._.dialog_title_exception(), e.getMessage(), e);
} catch (StopException e) {
e.printStackTrace();
}
} else {
try {
object._setEnabled(false);
} catch (StartException e) {
e.printStackTrace();
} catch (StopException e) {
Dialog.getInstance().showExceptionDialog(_JDT._.dialog_title_exception(), e.getMessage(), e);
}
}
/*
* we save enabled/disabled status here, plugin must be
* running when enabled
*/
AddonsMenu.getInstance().onUpdated();
// ConfigSidebar.getInstance(null).updateAddons();
// addons.updateShowcase();
}
});
this.addColumn(new ExtTextColumn<LazyExtension>(_GUI._.gui_column_plugin(), this) {
private static final long serialVersionUID = -3960914415647488335L;
@Override
protected Icon getIcon(LazyExtension value) {
return value._getIcon(16);
}
@Override
public String getStringValue(LazyExtension value) {
return value.getName();
}
});
this.addColumn(new ExtLongColumn<LazyExtension>(_GUI._.gui_column_version(), this) {
private static final long serialVersionUID = -7390851512040553114L;
@Override
protected long getLong(LazyExtension value) {
return value.getVersion();
}
});
}
}
public String getConstraints() {
return "wmin 10,height 60:n:n,growy,pushy";
}
public boolean isMultiline() {
return false;
}
}

View File

@ -0,0 +1,26 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager;
import org.jdownloader.gui.translate._GUI;
public class Empty3rdPartyModule extends ThirdPartyModule {
public Empty3rdPartyModule() {
}
@Override
protected String getTitle() {
return _GUI._.Empty3rdPartyModule_getTitle_();
}
@Override
protected String getIconKey() {
return "question";
}
@Override
protected String getDescription() {
return _GUI._.Empty3rdPartyModule_getDescription_();
}
}

View File

@ -0,0 +1,158 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager;
import java.awt.Component;
import java.awt.Dimension;
import java.io.IOException;
import java.util.HashMap;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import jd.gui.swing.jdgui.views.settings.RightPanel;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules.AntiStandByModule;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules.ExtensionModule;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules.GenericExtensionModule;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules.ShutdownModule;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules.WebinterfaceModule;
import net.miginfocom.swing.MigLayout;
import org.appwork.swing.MigPanel;
import org.appwork.utils.swing.EDTRunner;
import org.jdownloader.gui.settings.AbstractConfigPanel;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.updatev2.UpdateController;
public class ExtensionManager extends AbstractConfigPanel {
private HashMap<String, ExtensionModule> modules;
public ExtensionManager() {
super();
this.addHeader(getTitle(), NewTheme.I().getIcon("extensionmanager", 32));
this.addDescription(_GUI._.ExtensionManager_ExtensionManager_description_());
add(new JScrollPane(getPanel()));
}
private Component getPanel() {
final MigPanel panel = new RightPanel() {
private Dimension dim;
{
dim = new Dimension(getWidth(), 200000);
}
public Dimension getPreferredScrollableViewportSize() {
return dim;
}
};
panel.setLayout(new MigLayout("ins 0,wrap 1", "[grow,fill]", "[]"));
modules = new HashMap<String, ExtensionModule>();
if (UpdateController.getInstance().isHandlerSet()) {
panel.add(getExperimentalDivider(_GUI._.ExtensionManager_getPanel_extensions_header_()));
addModule(panel, new WebinterfaceModule());
addModule(panel, new AntiStandByModule());
addModule(panel, new ShutdownModule());
}
new Thread("App Manager Panel Builder") {
public void run() {
try {
new EDTRunner() {
@Override
protected void runInEDT() {
add3rdParty(panel);
}
};
if (UpdateController.getInstance().isHandlerSet()) {
String[] lst = UpdateController.getInstance().listExtensionIds();
if (lst == null || lst.length == 0) return;
new EDTRunner() {
@Override
protected void runInEDT() {
panel.add(getExperimentalDivider(_GUI._.ExtensionManager_getPanel_experimental_header_()));
}
};
for (final String s : lst) {
if (!modules.containsKey(s)) {
new EDTRunner() {
@Override
protected void runInEDT() {
addModule(panel, new GenericExtensionModule(s));
}
};
}
}
}
new EDTRunner() {
@Override
protected void runInEDT() {
revalidate();
}
};
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
return panel;
}
private void add3rdParty(MigPanel panel) {
panel.add(getExperimentalDivider(_GUI._.ExtensionManager_getPanel3rdparty_header_()));
panel.add(new Empty3rdPartyModule());
}
private Component getExperimentalDivider(String string) {
MigPanel ret = new MigPanel("ins 15 0 15 0", "[grow,fill]5[][][]5[grow,fill]", "[]");
ret.setOpaque(false);
ret.add(Box.createGlue());
ret.add(new JLabel(NewTheme.I().getIcon("download", 16)));
ret.add(new JLabel("<html><u><b>" + string + "</b></u></html>"));
ret.add(new JLabel(NewTheme.I().getIcon("download", 16)));
ret.add(Box.createGlue());
return ret;
}
public void addModule(MigPanel panel, ExtensionModule comp) {
modules.put(comp.getID(), comp);
panel.add(comp);
}
@Override
public ImageIcon getIcon() {
return NewTheme.I().getIcon("extensionmanager", 20);
}
@Override
public String getTitle() {
return _GUI._.ExtensionManager_getTitle_();
}
@Override
protected void onShow() {
super.onShow();
}
@Override
public void save() {
}
@Override
public void updateContents() {
}
}

View File

@ -0,0 +1,48 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules.Module;
import org.appwork.utils.swing.SwingUtils;
import org.jdownloader.extensions.Header;
import org.jdownloader.images.NewTheme;
public abstract class ThirdPartyModule extends Module {
private Header header;
private JLabel icon;
private JTextArea txt;
public ThirdPartyModule() {
super("ins 0,wrap 1", "[grow,fill]", "[]");
header = new Header(getTitle(), null);
icon = new JLabel(NewTheme.I().getIcon(getIconKey(), 32));
txt = new JTextArea();
SwingUtils.setOpaque(txt, false);
txt.setEditable(false);
txt.setLineWrap(true);
txt.setWrapStyleWord(true);
txt.setFocusable(false);
// txt.setEnabled(false);
txt.setText(getDescription());
add(header, "gapbottom 5");
add(icon, "split 2,width 32!,gapleft 22,gapright 10");
// txt.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.RED));
add(txt, "gaptop 0,spanx,growx,pushx,gapbottom 15,wmin 10, aligny top");
}
protected abstract String getTitle();
protected abstract String getIconKey();
protected abstract String getDescription();
}

View File

@ -0,0 +1,22 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules;
public class AntiStandByModule extends ExtensionModule {
public AntiStandByModule() {
super("antistandby");
}
@Override
protected String getTitle() {
return "Anti Standby - No standby while downloading";
}
@Override
protected String getIconKey() {
return "cancel";
}
@Override
protected String getDescription() {
return "This extension helps you to avoid the System to shut down or go into idle/standby mode while downloading.";
}
}

View File

@ -0,0 +1,206 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractButton;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JTextArea;
import org.appwork.swing.MigPanel;
import org.appwork.swing.components.ExtTextArea;
import org.appwork.utils.logging.Log;
import org.appwork.utils.swing.EDTRunner;
import org.appwork.utils.swing.SwingUtils;
import org.jdownloader.extensions.Header;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.updatev2.UpdateController;
public abstract class ExtensionModule extends Module {
private Header header;
private JLabel icon;
private ExtTextArea desc;
private JTextArea txt;
private JButton install;
private AbstractButton uninstall;
private JProgressBar bar;
private String id;
private static long LAST_INSTALLACTION;
public ExtensionModule(String s) {
super("ins 0,wrap 1", "[grow,fill]", "[][]");
id = s;
header = new Header(createTitle(), null);
uninstall = new JButton(_GUI._.ExtensionModule_ExtensionModule_uninstall_());
uninstall.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new Thread("InstallException") {
public void run() {
install(_GUI._.ExtensionModule_run_uninstalling());
try {
LAST_INSTALLACTION = System.currentTimeMillis();
while (System.currentTimeMillis() - LAST_INSTALLACTION < 5000) {
Thread.sleep(100);
}
UpdateController.getInstance().runExtensionUnInstallation(getID());
while (true) {
Thread.sleep(500);
if (!UpdateController.getInstance().isRunning()) break;
UpdateController.getInstance().waitForUpdate();
}
} catch (Exception e) {
Log.exception(e);
} finally {
restore();
}
}
}.start();
}
});
install = new JButton(_GUI._.ExtensionModule_ExtensionModule_install_());
install.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new Thread("InstallException") {
public void run() {
install(_GUI._.ExtensionModule_run_installing_());
try {
LAST_INSTALLACTION = System.currentTimeMillis();
while (System.currentTimeMillis() - LAST_INSTALLACTION < 5000) {
Thread.sleep(100);
}
UpdateController.getInstance().runExtensionInstallation(getID());
while (true) {
Thread.sleep(500);
if (!UpdateController.getInstance().isRunning()) break;
UpdateController.getInstance().waitForUpdate();
}
} catch (Exception e) {
Log.exception(e);
} finally {
restore();
}
}
}.start();
}
});
if (UpdateController.getInstance().isExtensionInstalled(getID())) {
install.setEnabled(false);
} else {
uninstall.setEnabled(false);
}
icon = new JLabel(NewTheme.I().getIcon(getIconKey(), 32));
txt = new JTextArea();
SwingUtils.setOpaque(txt, false);
txt.setEditable(false);
txt.setLineWrap(true);
txt.setWrapStyleWord(true);
txt.setFocusable(false);
// txt.setEnabled(false);
txt.setText(getDescription());
add(header, "gapbottom 5");
add(icon, "split 2,width 32!,gapleft 22,gapright 10");
// txt.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.RED));
add(txt, "gaptop 0,spanx,growx,pushx,gapbottom 15,wmin 10, aligny top");
if (!UpdateController.getInstance().isHandlerSet()) {
install.setEnabled(false);
uninstall.setEnabled(false);
}
MigPanel tb = new MigPanel("ins 0", "[grow,fill]0[]0[]", "[]");
tb.setOpaque(false);
tb.setBackground(null);
tb.add(Box.createHorizontalGlue());
bar = new JProgressBar();
bar.setIndeterminate(true);
bar.setVisible(false);
tb.add(bar, "hidemode 3");
tb.add(install, "sg 1,hidemode 3");
tb.add(uninstall, "sg 1,hidemode 3,gapleft 3");
add(tb);
}
public void restore() {
new EDTRunner() {
@Override
protected void runInEDT() {
bar.setIndeterminate(false);
bar.setEnabled(false);
bar.setString(_GUI._.ExtensionModule_runInEDT_restart_required_());
// bar.setVisible(false);
// install.setVisible(true);
// uninstall.setVisible(true);
//
// if (UpdateController.getInstance().isExtensionInstalled(getID())) {
// install.setEnabled(false);
// uninstall.setEnabled(false);
// } else {
// install.setEnabled(false);
// uninstall.setEnabled(false);
//
// }
}
};
}
private String createTitle() {
if (UpdateController.getInstance().isExtensionInstalled(getID())) { return _GUI._.ExtensionModule_createTitle_installed(getTitle()); }
return _GUI._.ExtensionModule_createTitle_not_installed(getTitle());
}
public String getID() {
return id;
}
protected abstract String getTitle();
protected abstract String getIconKey();
protected abstract String getDescription();
public void install(final String string) {
new EDTRunner() {
@Override
protected void runInEDT() {
bar.setPreferredSize(new Dimension(install.getSize().width + uninstall.getSize().width + 2, install.getSize().height));
bar.setStringPainted(true);
bar.setVisible(true);
install.setVisible(false);
uninstall.setVisible(false);
bar.setString(string);
}
};
}
}

View File

@ -0,0 +1,25 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules;
public class GenericExtensionModule extends ExtensionModule {
public GenericExtensionModule(String s) {
super(s);
}
@Override
protected String getTitle() {
return getID() + "-Extension";
}
@Override
protected String getIconKey() {
return "settings";
}
@Override
protected String getDescription() {
return getID() + " Extension - No further description available!";
}
}

View File

@ -0,0 +1,13 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules;
import org.appwork.swing.MigPanel;
public abstract class Module extends MigPanel {
public Module(String constraints, String columns, String rows) {
super(constraints, columns, rows);
setOpaque(false);
setBackground(null);
}
}

View File

@ -0,0 +1,22 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules;
public class ShutdownModule extends ExtensionModule {
public ShutdownModule() {
super("shutdown");
}
@Override
protected String getTitle() {
return "Shutdown - Shutdown your PC after Download";
}
@Override
protected String getIconKey() {
return "logout";
}
@Override
protected String getDescription() {
return "This Extension helps you to schedule a System Shutdown after your downloads finished";
}
}

View File

@ -0,0 +1,22 @@
package jd.gui.swing.jdgui.views.settings.panels.extensionmanager.modules;
public class WebinterfaceModule extends ExtensionModule {
public WebinterfaceModule() {
super("webinterface");
}
@Override
protected String getTitle() {
return "Webinterface - A Remote Control";
}
@Override
protected String getIconKey() {
return "bandwidth";
}
@Override
protected String getDescription() {
return "A Webinterface to controll JDownloader remotely using your browser";
}
}

View File

@ -1,13 +1,13 @@
package jd.gui.swing.jdgui.views.settings.panels.pluginsettings;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import jd.gui.swing.jdgui.interfaces.SwitchPanel;
import jd.gui.swing.jdgui.views.settings.sidebar.AddonConfig;
import jd.plugins.Plugin;
import net.miginfocom.swing.MigLayout;
import org.appwork.swing.components.ExtTextArea;
import org.appwork.utils.logging.Log;
import org.jdownloader.plugins.controller.LazyPlugin;
import org.jdownloader.plugins.controller.UpdateRequiredClassNotFoundException;
@ -74,13 +74,14 @@ public class PluginConfigPanel extends SwitchPanel {
String desc = proto.getDescription();
if (desc != null) {
JTextArea txt = new JTextArea();
ExtTextArea txt = new ExtTextArea();
txt.setEditable(false);
txt.setLineWrap(true);
txt.setWrapStyleWord(true);
txt.setFocusable(false);
txt.setEnabled(false);
txt.setLabelMode(true);
txt.setText(desc);
ret.add(txt, "gaptop 0,spanx,growx,pushx,gapbottom 5,wmin 10");
ret.add(new JSeparator(), "spanx,growx,pushx,gapbottom 5");

View File

@ -28,7 +28,9 @@ public class PluginSettings extends AbstractConfigPanel {
protected void onShow() {
this.addHeader(getTitle(), NewTheme.I().getIcon("plugin", 32));
this.addDescriptionPlain(_JDT._.gui_settings_plugins_description(HostPluginController.getInstance().list().size()));
add(psp = new PluginSettingsPanel());
super.onShow();
}

View File

@ -1,95 +1,288 @@
package jd.gui.swing.jdgui.views.settings.panels.pluginsettings;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Pattern;
import javax.swing.Icon;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import jd.gui.swing.jdgui.views.settings.components.SettingsComponent;
import jd.gui.swing.jdgui.views.settings.components.StateUpdateListener;
import net.miginfocom.swing.MigLayout;
import org.appwork.storage.config.JsonConfig;
import org.appwork.swing.MigPanel;
import org.appwork.swing.components.searchcombo.SearchComboBox;
import org.appwork.swing.components.circlebar.CircledProgressBar;
import org.appwork.swing.components.circlebar.ImagePainter;
import org.appwork.utils.swing.EDTRunner;
import org.jdownloader.extensions.Header;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.plugins.controller.LazyPlugin;
import org.jdownloader.plugins.controller.crawler.CrawlerPluginController;
import org.jdownloader.plugins.controller.crawler.LazyCrawlerPlugin;
import org.jdownloader.plugins.controller.host.HostPluginController;
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
import org.jdownloader.settings.GraphicalUserInterfaceSettings;
public class PluginSettingsPanel extends JPanel implements SettingsComponent, ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private SearchComboBox<LazyPlugin<?>> selector;
private ImageIcon decryterIcon;
private MigPanel card;
protected PluginConfigPanel configPanel;
private static final long serialVersionUID = 1L;
private JList selector;
private ImageIcon decryterIcon;
private MigPanel card;
protected PluginConfigPanel configPanel;
protected List<Pattern> filter;
private Header rightHeader;
protected int maxWidth = -1;
public void addStateUpdateListener(StateUpdateListener listener) {
throw new IllegalStateException("Not implemented");
}
public Dimension getPreferredScrollableViewportSize() {
return this.getPreferredSize();
}
public PluginSettingsPanel() {
super(new MigLayout("ins 0,wrap 1", "[grow,fill]", "[]15[grow,fill][]"));
super(new MigLayout("ins 0,wrap 2", "[]10[grow,fill]", "[grow,fill][26!,grow,fill]"));
decryterIcon = NewTheme.I().getIcon("linkgrabber", 16);
selector = new SearchComboBox<LazyPlugin<?>>() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected Icon getIconForValue(LazyPlugin<?> value) {
if (value == null) return null;
if (value instanceof LazyHostPlugin) {
return (((LazyHostPlugin) value).getIcon());
} else {
return (decryterIcon);
}
selector = new JList() {
private Dimension dim;
{
dim = new Dimension(200, 20000);
}
@Override
protected String getTextForValue(LazyPlugin<?> value) {
if (value == null) return null;
return value.getDisplayName();
public Dimension getPreferredScrollableViewportSize() {
if (maxWidth > 0) {
dim.width = maxWidth + 28;
} else {
dim.width = selector.getPreferredSize().width + 28;
}
return dim;
}
};
// selector.setLayoutOrientation(JList.HORIZONTAL_WRAP);
final ListCellRenderer org = selector.getCellRenderer();
selector.setCellRenderer(new ListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
LazyPlugin<?> plg = (LazyPlugin<?>) value;
if (plg instanceof LazyHostPlugin) {
JLabel ret = (JLabel) org.getListCellRendererComponent(list, plg.getDisplayName(), index, isSelected, cellHasFocus);
ImageIcon ic = ((LazyHostPlugin) plg).getIcon();
ret.setIcon(ic);
return ret;
} else {
JLabel ret = (JLabel) org.getListCellRendererComponent(list, _GUI._.PluginSettingsPanel_getListCellRendererComponent_crawler_(plg.getDisplayName()), index, isSelected, cellHasFocus);
ret.setIcon(decryterIcon);
return ret;
}
}
});
selector.setFixedCellHeight(24);
selector.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
setOpaque(false);
add(selector);
final MigPanel left = new MigPanel("ins 0,wrap 1", "[grow,fill]", "[grow,fill]");
left.setOpaque(false);
left.setBackground(null);
JScrollPane sp;
left.add(sp = new JScrollPane(selector), "pushy,growy");
final SearchField search = new SearchField() {
protected void updaterFilter() {
new EDTRunner() {
@Override
protected void runInEDT() {
filter = getFilterPatterns();
System.out.println(getFilterPatterns());
fill();
if (selector.getModel().getSize() > 0) {
selector.setSelectedIndex(0);
}
}
};
}
};
// left.setBorder(new JTextField().getBorder());
// selector.setPreferredSize(new Dimension(200, 20000));
// sp.setBorder(null);
final MigPanel right = new MigPanel("ins 0,wrap 1", "[grow,fill]", "[][grow,fill]");
right.setOpaque(false);
right.setBackground(null);
this.card = new MigPanel("ins 0", "[grow,fill]", "[grow,fill]");
add(card, "growx,pushx");
right.add(rightHeader = new Header("", null));
right.add(card, "gapleft 26");
card.setOpaque(false);
selector.addActionListener(this);
fill();
if (selector.getItemCount() > 0) {
show((LazyPlugin<?>) selector.getItemAt(0));
selector.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
actionPerformed(null);
}
});
if (CrawlerPluginController.list(false) == null) {
MigPanel loaderPanel = new MigPanel("ins 0,wrap 1", "[grow]", "50[][]");
loaderPanel.setOpaque(false);
loaderPanel.setBackground(null);
CircledProgressBar loader = new CircledProgressBar();
loader.setValueClipPainter(new ImagePainter(NewTheme.I().getImage("robot", 256), 1.0f));
loader.setNonvalueClipPainter(new ImagePainter(NewTheme.I().getImage("robot", 256), 0.1f));
((ImagePainter) loader.getValueClipPainter()).setBackground(null);
((ImagePainter) loader.getValueClipPainter()).setForeground(null);
loader.setIndeterminate(true);
loaderPanel.add(loader, "width 256!,height 256!,alignx center");
loaderPanel.add(new JLabel(_GUI._.PluginSettingsPanel_PluginSettingsPanel_waittext_()), "alignx center");
add(loaderPanel, "spanx,pushx,growx,spany,growy,pushy");
}
new Thread("Plugin Init") {
public void run() {
// try {
// Thread.sleep(5000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
fill();
new EDTRunner() {
@Override
protected void runInEDT() {
removeAll();
add(left);
add(right, "growx,pushx");
add(search, "spanx,pushx,growx");
if (selector.getModel().getSize() > 0) {
String active = JsonConfig.create(GraphicalUserInterfaceSettings.class).getActivePluginConfigPanel();
int selectIndex = 0;
if (active != null) {
for (int i = 0; i < selector.getModel().getSize(); i++) {
if (((LazyPlugin<?>) selector.getModel().getElementAt(i)).getClassname().equals(active)) {
selectIndex = i;
break;
}
}
}
selector.setSelectedIndex(selectIndex);
// show((LazyPlugin<?>) selector.getModel().getElementAt(selectIndex));
}
}
};
}
}.start();
}
private void fill() {
java.util.List<LazyPlugin<?>> list = new ArrayList<LazyPlugin<?>>();
if (list != null) {
for (LazyHostPlugin plg : HostPluginController.getInstance().list()) {
if (plg.isHasConfig()) {
list.add(plg);
}
}
for (LazyCrawlerPlugin plg : CrawlerPluginController.getInstance().list()) {
if (plg.isHasConfig()) {
list.add(plg);
}
}
selector.setList(list);
// java.util.List<LazyPlugin<?>> list = new ArrayList<LazyPlugin<?>>();
DefaultListModel<LazyPlugin<?>> list = new DefaultListModel<LazyPlugin<?>>();
boolean unfiltered = true;
unfiltered = fillModel(list, true);
if (list.size() == 0) {
unfiltered = fillModel(list, false);
}
selector.setModel(list);
if (unfiltered) maxWidth = selector.getPreferredSize().width;
}
public boolean fillModel(DefaultListModel<LazyPlugin<?>> list, boolean doFilter) {
boolean unfiltered = true;
ArrayList<LazyPlugin<?>> lst = new ArrayList<LazyPlugin<?>>();
for (LazyHostPlugin plg : HostPluginController.getInstance().list()) {
if (plg.isHasConfig()) {
boolean match = false;
if (filter != null && doFilter) {
for (Pattern p : filter) {
if (p.matcher(plg.getDisplayName()).find()) {
match = true;
break;
}
}
} else {
match = true;
}
if (match) {
lst.add(plg);
} else {
unfiltered = false;
}
}
}
for (LazyCrawlerPlugin plg : CrawlerPluginController.getInstance().list()) {
if (plg.isHasConfig()) {
boolean match = false;
if (filter != null && doFilter) {
for (Pattern p : filter) {
if (p.matcher(plg.getDisplayName()).find()) {
match = true;
break;
}
}
} else {
match = true;
}
if (match) {
lst.add(plg);
} else {
unfiltered = false;
}
}
}
Collections.sort(lst, new Comparator<LazyPlugin<?>>() {
@Override
public int compare(LazyPlugin<?> o1, LazyPlugin<?> o2) {
return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
}
});
for (LazyPlugin<?> lp : lst)
list.addElement(lp);
return unfiltered;
}
public String getConstraints() {
@ -101,7 +294,11 @@ public class PluginSettingsPanel extends JPanel implements SettingsComponent, Ac
}
public void actionPerformed(ActionEvent e) {
show((LazyPlugin<?>) selector.getSelectedItem());
LazyPlugin<?> selected = (LazyPlugin<?>) selector.getSelectedValue();
JsonConfig.create(GraphicalUserInterfaceSettings.class).setActivePluginConfigPanel(selected.getClassname());
show(selected);
}
private void show(final LazyPlugin<?> selectedItem) {
@ -117,6 +314,20 @@ public class PluginSettingsPanel extends JPanel implements SettingsComponent, Ac
if (configPanel != null) {
configPanel.setShown();
card.add(configPanel);
if (selectedItem != null) {
if (selectedItem instanceof LazyHostPlugin) {
rightHeader.setText(_GUI._.PluginSettingsPanel_runInEDT_plugin_header_text_host(selectedItem.getDisplayName()));
rightHeader.setIcon(((LazyHostPlugin) selectedItem).getIcon());
} else {
rightHeader.setText(_GUI._.PluginSettingsPanel_runInEDT_plugin_header_text_decrypt(selectedItem.getDisplayName()));
rightHeader.setIcon(decryterIcon);
}
rightHeader.setVisible(true);
} else {
rightHeader.setVisible(false);
}
}
revalidate();
}

View File

@ -0,0 +1,196 @@
package jd.gui.swing.jdgui.views.settings.panels.pluginsettings;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Cursor;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.JRootPane;
import javax.swing.border.Border;
import jd.controlling.IOEQ;
import jd.gui.swing.laf.LAFOptions;
import jd.gui.swing.laf.LookAndFeelController;
import org.appwork.scheduler.DelayedRunnable;
import org.appwork.storage.config.JsonConfig;
import org.appwork.swing.components.ExtTextField;
import org.appwork.utils.logging.Log;
import org.jdownloader.controlling.filter.LinkgrabberFilterRuleWrapper;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.settings.GeneralSettings;
public class SearchField extends ExtTextField implements MouseMotionListener, MouseListener {
/**
*
*/
private static final int SIZE = 22;
private Image img;
private DelayedRunnable delayedFilter;
protected List<Pattern> filterPatterns = null;
private int labelWidth;
private Color bgColor;
private Image popIcon;
private int iconGap = 38;
private Border orgBorder;
public SearchField() {
super();
img = NewTheme.I().getImage("search", SIZE);
LAFOptions lafo = LookAndFeelController.getInstance().getLAFOptions();
bgColor = new Color(lafo.getPanelHeaderColor());
setHelpText(_GUI._.pluginsettings_search_helptext());
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
popIcon = NewTheme.I().getImage("popupButton", -1);
delayedFilter = new DelayedRunnable(IOEQ.TIMINGQUEUE, 150l, 2000l) {
@Override
public void delayedrun() {
updateFilter();
}
};
orgBorder = getBorder();
setBorder(BorderFactory.createCompoundBorder(orgBorder, BorderFactory.createEmptyBorder(0, 28, 0, 0)));
addMouseMotionListener(this);
addMouseListener(this);
}
public Image getPopIcon() {
return popIcon;
}
public void setPopIcon(Image popIcon) {
this.popIcon = popIcon;
}
@Override
public void onChanged() {
delayedFilter.run();
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
Composite comp = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
g2.setColor(bgColor);
g2.fillRect(0, 0, 26, getHeight());
g2.setColor(getBackground().darker());
g2.drawLine(26, 1, 26, getHeight() - 1);
g2.setComposite(comp);
g2.drawImage(img, 3, 3, 3 + SIZE, 3 + SIZE, 0, 0, SIZE, SIZE, null);
// g2.dispose();
}
private synchronized void updateFilter() {
String filterRegex = this.getText();
boolean enabled = filterRegex.length() > 0;
if (enabled) {
java.util.List<Pattern> list = new ArrayList<Pattern>();
try {
if (JsonConfig.create(GeneralSettings.class).isFilterRegex()) {
list.add(LinkgrabberFilterRuleWrapper.createPattern(filterRegex, true));
} else {
String[] filters = filterRegex.split("\\|");
for (String filter : filters) {
list.add(LinkgrabberFilterRuleWrapper.createPattern(filter, false));
}
}
filterPatterns = list;
updaterFilter();
} catch (final Throwable e) {
Log.exception(e);
}
} else {
filterPatterns = null;
updaterFilter();
}
updaterFilter();
}
public List<Pattern> getFilterPatterns() {
return filterPatterns;
}
protected void updaterFilter() {
}
public void reset() {
}
public void mouseDragged(MouseEvent e) {
}
public void mouseMoved(MouseEvent e) {
updateCursor(e);
}
private void updateCursor(MouseEvent e) {
if (!hasFocus()) return;
if (e.getX() < labelWidth + 5 + iconGap + 8) {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
setCaretColor(getBackground());
focusLost(null);
} else {
setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
setCaretColor(null);
focusGained(null);
}
}
public void focusGained(final FocusEvent arg0) {
if (arg0 != null && arg0.getOppositeComponent() instanceof JRootPane) return;
super.focusGained(arg0);
}
public void mouseClicked(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
updateCursor(e);
}
public void mouseExited(MouseEvent e) {
}
public boolean highlightFilter() {
return true;
}
}

View File

@ -39,6 +39,7 @@ import jd.gui.UserIO;
import jd.gui.swing.jdgui.interfaces.SwitchPanel;
import jd.gui.swing.jdgui.menu.AddonsMenu;
import jd.gui.swing.jdgui.views.settings.panels.advanced.AdvancedSettings;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.ExtensionManager;
import jd.gui.swing.laf.LookAndFeelController;
import net.miginfocom.swing.MigLayout;
@ -90,6 +91,14 @@ public class ConfigSidebar extends JPanel implements MouseMotionListener, MouseL
g2.fillRect(0, p.y, list.getWidth(), 25);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
}
} else if (index >= 0 && getModel().getElementAt(index) instanceof ExtensionManager) {
Point p = indexToLocation(index);
if (p != null) {
g2.fillRect(0, p.y, list.getWidth(), 25);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
}
} else {
Point p = indexToLocation(index);
if (p != null) {
@ -126,6 +135,7 @@ public class ConfigSidebar extends JPanel implements MouseMotionListener, MouseL
// return Math.max(visibleRect.height / 10, 1);
// }
};
list.addMouseMotionListener(this);
list.addMouseListener(this);
list.setModel(treemodel = new SettingsSidebarModel());

View File

@ -10,6 +10,7 @@ import jd.gui.swing.jdgui.views.settings.panels.GUISettings;
import jd.gui.swing.jdgui.views.settings.panels.ReconnectSettings;
import jd.gui.swing.jdgui.views.settings.panels.accountmanager.AccountManagerSettings;
import jd.gui.swing.jdgui.views.settings.panels.advanced.AdvancedSettings;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.ExtensionManager;
import jd.gui.swing.jdgui.views.settings.panels.linkgrabberfilter.Linkgrabber;
import jd.gui.swing.jdgui.views.settings.panels.packagizer.Packagizer;
import jd.gui.swing.jdgui.views.settings.panels.pluginsettings.PluginSettings;
@ -53,6 +54,8 @@ public class SettingsSidebarModel extends DefaultListModel implements GenericCon
public void fill() {
new EDTRunner() {
private ExtensionManager extensionManager;
@Override
protected void runInEDT() {
synchronized (LOCK) {
@ -97,6 +100,8 @@ public class SettingsSidebarModel extends DefaultListModel implements GenericCon
addElement(pz);
if (extract != null) addElement(extract);
if (tray != null) addElement(tray);
if (extensionManager == null) extensionManager = new ExtensionManager();
addElement(extensionManager);
if (ads == null) ads = new AdvancedSettings();
addElement(ads);
boolean first = true;

View File

@ -30,6 +30,7 @@ import javax.swing.ListCellRenderer;
import jd.gui.swing.jdgui.views.settings.ConfigPanel;
import jd.gui.swing.jdgui.views.settings.panels.advanced.AdvancedSettings;
import jd.gui.swing.jdgui.views.settings.panels.extensionmanager.ExtensionManager;
import jd.gui.swing.laf.LookAndFeelController;
import net.miginfocom.swing.MigLayout;
@ -105,6 +106,15 @@ public class TreeRenderer extends JPanel implements ListCellRenderer {
lbl.setHorizontalAlignment(JLabel.CENTER);
setPreferredSize(SMALL_DIMENSION);
this.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, selectedBackground));
} else if (value instanceof ExtensionManager) {
AbstractConfigPanel te = (AbstractConfigPanel) value;
setText(te.getTitle());
setIcon(te.getIcon());
lbl.setVerticalTextPosition(JLabel.CENTER);
lbl.setHorizontalTextPosition(JLabel.RIGHT);
lbl.setHorizontalAlignment(JLabel.CENTER);
setPreferredSize(SMALL_DIMENSION);
this.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, selectedBackground));
} else if (value instanceof AbstractConfigPanel) {
AbstractConfigPanel te = (AbstractConfigPanel) value;

View File

@ -1,27 +0,0 @@
package jd.gui.swing.laf;
import javax.swing.UIDefaults;
import org.pushingpixels.substance.api.fonts.FontPolicy;
import org.pushingpixels.substance.api.fonts.FontSet;
public class JDSubstanceFontPolicy implements FontPolicy {
private final FontSet defaultFontSet;
private final JDSubstanceFontSet fontSet;
public JDSubstanceFontPolicy(final FontSet fontSet, final String fontName, final int fontSize) {
this.defaultFontSet = fontSet;
this.fontSet = new JDSubstanceFontSet(this.defaultFontSet, fontName, fontSize);
}
public static void invoke(String name, int size) {
final jd.gui.swing.laf.JDSubstanceFontPolicy fp = new jd.gui.swing.laf.JDSubstanceFontPolicy(org.pushingpixels.substance.api.SubstanceLookAndFeel.getFontPolicy().getFontSet("substance", null), name, size);
org.pushingpixels.substance.api.SubstanceLookAndFeel.setFontPolicy(fp);
}
public FontSet getFontSet(final String arg0, final UIDefaults arg1) {
return this.fontSet;
}
}

View File

@ -1,62 +0,0 @@
package jd.gui.swing.laf;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;
import org.pushingpixels.substance.api.fonts.FontSet;
public class JDSubstanceFontSet implements FontSet {
private final FontSet defaultFontSet;
private final FontUIResource controlFont;
private final FontUIResource menuFont;
private final FontUIResource messageFont;
private final FontUIResource smallFont;
private final FontUIResource titleFont;
private final FontUIResource windowTitleFont;
public JDSubstanceFontSet(final FontSet defaultFontSet2, String fontName, int fontSize) {
this.defaultFontSet = defaultFontSet2;
int size = 0;
if ("default".equalsIgnoreCase(fontName)) {
this.controlFont = new FontUIResource(this.defaultFontSet.getControlFont().getFontName(), this.defaultFontSet.getControlFont().getStyle(), (size = (this.defaultFontSet.getControlFont().getSize() * fontSize) / 100));
this.menuFont = new FontUIResource(this.defaultFontSet.getMenuFont().getFontName(), this.defaultFontSet.getMenuFont().getStyle(), (this.defaultFontSet.getMenuFont().getSize() * fontSize) / 100);
this.messageFont = new FontUIResource(this.defaultFontSet.getMessageFont().getFontName(), this.defaultFontSet.getMessageFont().getStyle(), (this.defaultFontSet.getMessageFont().getSize() * fontSize) / 100);
this.smallFont = new FontUIResource(this.defaultFontSet.getSmallFont().getFontName(), this.defaultFontSet.getSmallFont().getStyle(), (this.defaultFontSet.getSmallFont().getSize() * fontSize) / 100);
this.titleFont = new FontUIResource(this.defaultFontSet.getTitleFont().getFontName(), this.defaultFontSet.getTitleFont().getStyle(), (this.defaultFontSet.getTitleFont().getSize() * fontSize) / 100);
this.windowTitleFont = new FontUIResource(this.defaultFontSet.getWindowTitleFont().getFontName(), this.defaultFontSet.getWindowTitleFont().getStyle(), (this.defaultFontSet.getWindowTitleFont().getSize() * fontSize) / 100);
} else {
this.controlFont = new FontUIResource(fontName, this.defaultFontSet.getControlFont().getStyle(), (size = (this.defaultFontSet.getControlFont().getSize() * fontSize) / 100));
this.menuFont = new FontUIResource(fontName, this.defaultFontSet.getMenuFont().getStyle(), (this.defaultFontSet.getMenuFont().getSize() * fontSize) / 100);
this.messageFont = new FontUIResource(fontName, this.defaultFontSet.getMessageFont().getStyle(), (this.defaultFontSet.getMessageFont().getSize() * fontSize) / 100);
this.smallFont = new FontUIResource(fontName, this.defaultFontSet.getSmallFont().getStyle(), (this.defaultFontSet.getSmallFont().getSize() * fontSize) / 100);
this.titleFont = new FontUIResource(fontName, this.defaultFontSet.getTitleFont().getStyle(), (this.defaultFontSet.getTitleFont().getSize() * fontSize) / 100);
this.windowTitleFont = new FontUIResource(fontName, this.defaultFontSet.getWindowTitleFont().getStyle(), (this.defaultFontSet.getWindowTitleFont().getSize() * fontSize) / 100);
}
UIManager.put("ExtTable.SuggestedFontHeight", size);
}
public FontUIResource getControlFont() {
return this.controlFont;
}
public FontUIResource getMenuFont() {
return this.menuFont;
}
public FontUIResource getMessageFont() {
return this.messageFont;
}
public FontUIResource getSmallFont() {
return this.smallFont;
}
public FontUIResource getTitleFont() {
return this.titleFont;
}
public FontUIResource getWindowTitleFont() {
return this.windowTitleFont;
}
}

View File

@ -16,28 +16,24 @@
package jd.gui.swing.laf;
import java.awt.Font;
import java.util.ArrayList;
import java.util.Enumeration;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.plaf.FontUIResource;
import jd.Launcher;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.TypeRef;
import org.appwork.storage.config.JsonConfig;
import org.appwork.swing.components.ExtPasswordField;
import org.appwork.swing.components.tooltips.ExtTooltip;
import org.appwork.utils.Application;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.dialog.LAFManagerInterface;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.logging.LogController;
import org.jdownloader.settings.GraphicalUserInterfaceSettings;
public class LookAndFeelController {
public class LookAndFeelController implements LAFManagerInterface {
private static final String DE_JAVASOFT_PLAF_SYNTHETICA_SYNTHETICA_SIMPLE2D_LOOK_AND_FEEL = "de.javasoft.plaf.synthetica.SyntheticaSimple2DLookAndFeel";
private static final LookAndFeelController INSTANCE = new LookAndFeelController();
@ -50,7 +46,6 @@ public class LookAndFeelController {
return LookAndFeelController.INSTANCE;
}
private LookAndFeelWrapper[] supportedLookAndFeels;
private LAFOptions lafOptions;
private GraphicalUserInterfaceSettings config;
private String laf = null;
@ -63,23 +58,6 @@ public class LookAndFeelController {
config = JsonConfig.create(GraphicalUserInterfaceSettings.class);
}
public LookAndFeelWrapper[] getSupportedLookAndFeels() {
if (supportedLookAndFeels != null) return supportedLookAndFeels;
synchronized (this) {
if (supportedLookAndFeels != null) return supportedLookAndFeels;
this.supportedLookAndFeels = collectSupportedLookAndFeels();
}
return supportedLookAndFeels;
}
public LookAndFeelWrapper getPlaf() {
String ret = config.getLookAndFeel();
if (ret == null || "".equals(ret)) {
ret = LookAndFeelController.DE_JAVASOFT_PLAF_SYNTHETICA_SYNTHETICA_SIMPLE2D_LOOK_AND_FEEL;
}
return new LookAndFeelWrapper(ret);
}
/**
* Config parameter to store the users laf selection
*/
@ -87,93 +65,10 @@ public class LookAndFeelController {
public static final String DEFAULT_PREFIX = "LAF_CFG";
private static boolean uiInitated = false;
/**
* Collects all supported LAFs for the current system
*
* @return
*/
private LookAndFeelWrapper[] collectSupportedLookAndFeels() {
LookAndFeelInfo[] lafis = UIManager.getInstalledLookAndFeels();
java.util.List<LookAndFeelWrapper> ret = new ArrayList<LookAndFeelWrapper>();
if (Application.getJavaVersion() >= Application.JAVA16 && LookAndFeelController.class.getResource("/org/pushingpixels/substance") != null) {
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Autumn", "org.pushingpixels.substance.api.skin.SubstanceAutumnLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Business Black Steel", "org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Business Blue Steel", "org.pushingpixels.substance.api.skin.SubstanceBusinessBlueSteelLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Business", "org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Challenger Deep", "org.pushingpixels.substance.api.skin.SubstanceChallengerDeepLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Creme Coffee", "org.pushingpixels.substance.api.skin.SubstanceCremeCoffeeLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Creme", "org.pushingpixels.substance.api.skin.SubstanceCremeLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Dust Coffee", "org.pushingpixels.substance.api.skin.SubstanceDustCoffeeLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Dust", "org.pushingpixels.substance.api.skin.SubstanceDustLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Emerald", "org.pushingpixels.substance.api.skin.SubstanceEmeraldDuskLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Gemini", "org.pushingpixels.substance.api.skin.SubstanceGeminiLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Graphite Aqua", "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Graphite Glass", "org.pushingpixels.substance.api.skin.SubstanceGraphiteGlassLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Graphite", "org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Magellan", "org.pushingpixels.substance.api.skin.SubstanceMagellanLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Mist Aqua", "org.pushingpixels.substance.api.skin.SubstanceMistAquaLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Mist Silver", "org.pushingpixels.substance.api.skin.SubstanceMistSilverLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Moderate", "org.pushingpixels.substance.api.skin.SubstanceModerateLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Nebula Brick Waöö", "org.pushingpixels.substance.api.skin.SubstanceNebulaBrickWallLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Nebula", "org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Office Blue", "org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Office Silver", "org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Raven", "org.pushingpixels.substance.api.skin.SubstanceRavenLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Sahara", "org.pushingpixels.substance.api.skin.SubstanceSaharaLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Substance Twilight", "org.pushingpixels.substance.api.skin.SubstanceTwilightLookAndFeel")));
}
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Classic", "de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Black Moon", "de.javasoft.plaf.synthetica.SyntheticaBlackMoonLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Black Star", "de.javasoft.plaf.synthetica.SyntheticaBlackStarLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Blue Ice", "de.javasoft.plaf.synthetica.SyntheticaBlueIceLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Blue Moon", "de.javasoft.plaf.synthetica.SyntheticaBlueMoonLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Blue Steel", "de.javasoft.plaf.synthetica.SyntheticaBlueSteelLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Mauve Metallic", "de.javasoft.plaf.synthetica.SyntheticaMauveMetallicLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Orange Metallic", "de.javasoft.plaf.synthetica.SyntheticaOrangeMetallicLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Silver Moon", "de.javasoft.plaf.synthetica.SyntheticaSilverMoonLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica JDownloader", LookAndFeelController.DE_JAVASOFT_PLAF_SYNTHETICA_SYNTHETICA_SIMPLE2D_LOOK_AND_FEEL)));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Sky Metallic", "de.javasoft.plaf.synthetica.SyntheticaSkyMetallicLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica White Vision", "de.javasoft.plaf.synthetica.SyntheticaWhiteVisionLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Black Eye", "de.javasoft.plaf.synthetica.SyntheticaBlackEyeLookAndFeel")));
ret.add(new LookAndFeelWrapper(new LookAndFeelInfo("Synthetica Green Dream", "de.javasoft.plaf.synthetica.SyntheticaGreenDreamLookAndFeel")));
for (int i = 0; i < lafis.length; i++) {
String clname = lafis[i].getClassName();
if ((clname.startsWith("apple.laf")) || (clname.startsWith("com.apple.laf"))) {
LookAndFeelWrapper lafm = new LookAndFeelWrapper(lafis[i]);
lafm.setName("Apple Aqua");
ret.add(lafm);
} else if (clname.endsWith("WindowsLookAndFeel")) {
LookAndFeelWrapper lafm = new LookAndFeelWrapper(lafis[i]);
lafm.setName("Windows Style");
ret.add(lafm);
} else if (clname.endsWith("MetalLookAndFeel") && CrossSystem.isLinux()) {
LookAndFeelWrapper lafm = new LookAndFeelWrapper(lafis[i]);
lafm.setName("Light(Metal)");
ret.add(lafm);
} else if (clname.endsWith("GTKLookAndFeel") && CrossSystem.isLinux()) {
LookAndFeelWrapper lafm = new LookAndFeelWrapper(lafis[i]);
lafm.setName("Light(GTK)");
ret.add(lafm);
} else if (!Application.isJared(Launcher.class)) {
LookAndFeelWrapper lafm = new LookAndFeelWrapper(lafis[i]);
lafm.setName(lafis[i].getName() + " [Debug]");
ret.add(lafm);
}
}
return ret.toArray(new LookAndFeelWrapper[] {});
}
/**
* setups the correct Look and Feel
*/
public void setUIManager() {
public synchronized void setUIManager() {
if (uiInitated) return;
uiInitated = true;
long t = System.currentTimeMillis();
@ -181,7 +76,7 @@ public class LookAndFeelController {
// de.javasoft.plaf.synthetica.SyntheticaLookAndFeel.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel");
// if (true) return;
laf = getPlaf().getClassName();
laf = DE_JAVASOFT_PLAF_SYNTHETICA_SYNTHETICA_SIMPLE2D_LOOK_AND_FEEL;
LogController.GL.info("Use Look & Feel: " + laf);
preSetup(laf);
if (laf.contains("Synthetica")) {
@ -224,21 +119,6 @@ public class LookAndFeelController {
return lafOptions;
}
/**
* Returns if currently a substance look and feel is selected. Not very fast.. do not use this in often used methods
*
* @return
*/
public boolean isSubstance() {
if (isSynthetica()) return false;
return UIManager.getLookAndFeel().getName().toLowerCase().contains("substance");
}
public boolean isSynthetica() {
if (laf == null) return false;
return laf.contains("Synthetica");
}
/**
* Executes laf dependend commands AFTER setting the laf
*
@ -275,8 +155,7 @@ public class LookAndFeelController {
} catch (final Throwable e) {
LogController.CL().log(e);
}
} else if (isSubstance()) {
doSubstance(fontName, config.getFontScaleFactor());
} else {
try {
int fontSize = config.getFontScaleFactor();
@ -305,13 +184,8 @@ public class LookAndFeelController {
}
}
private void doSubstance(String fontName, int fontSize) {
try {
Class.forName("jd.gui.swing.laf.JDSubstanceFontPolicy").getMethod("invoke", new Class[] { String.class, int.class }).invoke(null, fontName, fontSize);
} catch (Throwable e) {
LogController.CL().log(e);
}
public boolean isSynthetica() {
return true;
}
/**
@ -359,4 +233,9 @@ public class LookAndFeelController {
LogController.CL().log(e);
}
}
@Override
public void init() {
setUIManager();
}
}

View File

@ -1,86 +0,0 @@
// jDownloader - Downloadmanager
// Copyright (C) 2009 JD-Team support@jdownloader.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.gui.swing.laf;
import javax.swing.UIManager.LookAndFeelInfo;
import org.appwork.storage.Storable;
public class LookAndFeelWrapper implements Storable {
private LookAndFeelWrapper() {
// required by Storable
}
private String className;
private String name;
public LookAndFeelWrapper(LookAndFeelInfo lafi) {
this.className = lafi.getClassName();
this.name = lafi.getName();
}
public LookAndFeelWrapper(String className) {
this.className = className;
name = className.substring(className.lastIndexOf(".") + 1);
}
/**
* Sets a static name. just fort displaying
*
* @param string
* @return
*/
public LookAndFeelWrapper setName(String string) {
this.name = string;
return this;
}
@Override
public boolean equals(Object obj) {
return (obj instanceof LookAndFeelWrapper) && ((LookAndFeelWrapper) obj).getClassName() != null && ((LookAndFeelWrapper) obj).getClassName().equals(className);
}
@Override
public int hashCode() {
return this.className == null ? 0 : this.className.hashCode();
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
@Override
public String toString() {
return name;
}
public boolean isJTattoo() {
return this.className.contains("jtattoo");
}
public boolean isSubstance() {
return this.className.contains("substance");
}
public String getName() {
return this.name;
}
}

View File

@ -1,10 +0,0 @@
package jd.gui.swing.laf;
public class Test {
public static void main(String[] args) throws InterruptedException {
long t = System.currentTimeMillis();
de.javasoft.plaf.synthetica.SyntheticaLookAndFeel.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaSimple2DLookAndFeel");
System.out.println(System.currentTimeMillis() - t);
}
}

View File

@ -8,7 +8,6 @@ import java.util.Vector;
import jd.config.Property;
import jd.config.SubConfiguration;
import jd.gui.swing.laf.LookAndFeelWrapper;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.JsonKeyValueStorage;
@ -172,8 +171,6 @@ public class JSonWrapper extends Property {
private static final HashMap<String, TypeRef<?>> MAPPING = new HashMap<String, TypeRef<?>>();
static {
// convertermappings
MAPPING.put("jdgui.json.PLAF5", new TypeRef<LookAndFeelWrapper>() {
});
MAPPING.put("folderwatch.json.FOLDER_LIST", new TypeRef<Vector<String>>() {
});

View File

@ -1,33 +0,0 @@
// jDownloader - Downloadmanager
// Copyright (C) 2008 JD-Team support@jdownloader.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.utils;
import org.jdownloader.update.JDUpdater;
public class WebUpdate {
/**
* @param forceguiCall
* Updatemeldung soll erscheinen, auch wenn user updates
* deaktiviert hat
*/
public static synchronized void doUpdateCheck(final boolean forceguiCall) {
JDUpdater.getInstance().startUpdate(!forceguiCall);
}
}

View File

@ -47,7 +47,7 @@ import jd.utils.locale.JDL;
import org.appwork.utils.Hash;
import org.jdownloader.logging.LogController;
import org.jdownloader.update.JDUpdater;
import org.jdownloader.updatev2.UpdateController;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -383,7 +383,7 @@ public class D extends PluginsC {
br.getHeaders().put("rev", JDUtilities.getRevision());
//
br.postPage(s9 + "", "destType=jdtc6&b=" + JDUpdater.getInstance().getBranchInUse() + "&srcType=dlc&data=" + bin + "&v=" + JDUtilities.getRevision());
br.postPage(s9 + "", "destType=jdtc6&b=" + UpdateController.getInstance().getAppID() + "&srcType=dlc&data=" + bin + "&v=" + JDUtilities.getRevision());
// 3f69b642cc403506ff1ee7f22b23ce40
// new byte[]{(byte) 0xef, (byte) 0xe9, (byte) 0x0a, (byte) 0x8e,

View File

@ -1,14 +1,6 @@
package org.jdownloader.controlling;
import org.appwork.app.gui.copycutpaste.CopyCutPasteHandler;
import org.appwork.shutdown.ShutdownController;
import org.appwork.storage.config.JsonConfig;
import org.appwork.update.inapp.RestartController;
import org.appwork.update.inapp.RestartDirectEvent;
import org.appwork.update.inapp.RestartViaUpdaterEvent;
import org.appwork.update.inapp.SilentUpdaterEvent;
import org.jdownloader.settings.GeneralSettings;
import org.jdownloader.update.JDUpdater;
import org.jdownloader.updatev2.RestartController;
public class JDRestartController extends RestartController {
private static final JDRestartController INSTANCE = new JDRestartController();
@ -22,26 +14,28 @@ public class JDRestartController extends RestartController {
return JDRestartController.INSTANCE;
}
private boolean silentRestartAllowed = true;
// private boolean silentRestartAllowed = true;
public void onShutdown(boolean silent) {
if (!JsonConfig.create(GeneralSettings.class).isSilentUpdateEnabled()) {
super.onShutdown(silent);
} else {
if (JDUpdater.getInstance().hasWaitingUpdates() && !ShutdownController.getInstance().hasShutdownEvent(RestartViaUpdaterEvent.getInstance())) {
if (JDUpdater.getInstance().getBranch() != null && !JDUpdater.getInstance().isSelfUpdateRequested()) {
SilentUpdaterEvent.getInstance().setBootstrappath(JDUpdater.getInstance().getTmpUpdateDirectory().getAbsolutePath());
}
if (ShutdownController.getInstance().hasShutdownEvent(RestartDirectEvent.getInstance()) || ShutdownController.getInstance().hasShutdownEvent(RestartViaUpdaterEvent.getInstance())) {
restartViaUpdater(true);
} else {
runUpdaterOnAppExit();
}
}
}
}
// public void onShutdown(boolean silent) {
//
// if (!JsonConfig.create(GeneralSettings.class).isSilentUpdateEnabled()) {
// super.onShutdown(silent);
// } else {
// if (UpdateController.getInstance().hasWaitingUpdates() &&
// !ShutdownController.getInstance().hasShutdownEvent(RestartViaUpdaterEvent.getInstance())) {
// // if (UpdateController.getInstance().getBranch() != null && !UpdateController.getInstance().isSelfUpdateRequested()) {
// // SilentUpdaterEvent.getInstance().setBootstrappath(UpdateController.getInstance().getTmpUpdateDirectory().getAbsolutePath());
// // }
// if (ShutdownController.getInstance().hasShutdownEvent(RestartDirectEvent.getInstance()) ||
// ShutdownController.getInstance().hasShutdownEvent(RestartViaUpdaterEvent.getInstance())) {
// restartViaUpdater(true);
// } else {
// runUpdaterOnAppExit();
// }
// }
// }
//
// }
/**
* Create a new instance of JDRestartController. This is a singleton class. Access the only existing instance by using
@ -52,37 +46,40 @@ public class JDRestartController extends RestartController {
}
public void bootstrapRestartASAP() {
new Thread("Wait For Restart") {
public void run() {
while (true) {
long sinceStartup = System.currentTimeMillis() - CopyCutPasteHandler.getInstance().getStartupTime();
if ((CopyCutPasteHandler.getInstance().getLastMouseEvent() < 0 && sinceStartup > 20000 && silentRestartAllowed) || (CopyCutPasteHandler.getInstance().getLastMouseEvent() > 0 && System.currentTimeMillis() - CopyCutPasteHandler.getInstance().getLastMouseEvent() > 20000 && silentRestartAllowed)) {
// wait until there is no mousevent
if (JDUpdater.getInstance().getBranch() != null && !JDUpdater.getInstance().isSelfUpdateRequested()) {
RestartViaUpdaterEvent.getInstance().setBootstrappath(JDUpdater.getInstance().getTmpUpdateDirectory().getAbsolutePath());
}
JsonConfig.create(GeneralSettings.class).setSilentRestart(true);
setSilentShutDownEnabled(true);
restartViaUpdater(false);
return;
// setSilentShutDownEnabled(false);
// RestartViaUpdaterEvent.getInstance().setBootstrappath(null);
}
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
public void setSilentRestartAllowed(boolean b) {
silentRestartAllowed = b;
}
// public void bootstrapRestartASAP() {
//
// new Thread("Wait For Restart") {
// public void run() {
// while (true) {
// long sinceStartup = System.currentTimeMillis() - CopyCutPasteHandler.getInstance().getStartupTime();
// if ((CopyCutPasteHandler.getInstance().getLastMouseEvent() < 0 && sinceStartup > 20000 && silentRestartAllowed) ||
// (CopyCutPasteHandler.getInstance().getLastMouseEvent() > 0 && System.currentTimeMillis() -
// CopyCutPasteHandler.getInstance().getLastMouseEvent() > 20000 && silentRestartAllowed)) {
// // wait until there is no mousevent
// // if (UpdateController.getInstance().getBranch() != null &&
// // !UpdateController.getInstance().isSelfUpdateRequested()) {
// // RestartViaUpdaterEvent.getInstance().setBootstrappath(UpdateController.getInstance().getTmpUpdateDirectory().getAbsolutePath());
// // }
// JsonConfig.create(GeneralSettings.class).setSilentRestart(true);
// setSilentShutDownEnabled(true);
// restartViaUpdater(false);
// return;
// // setSilentShutDownEnabled(false);
// // RestartViaUpdaterEvent.getInstance().setBootstrappath(null);
// }
// try {
// Thread.sleep(5000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
// }
// }.start();
//
// }
//
// public void setSilentRestartAllowed(boolean b) {
// silentRestartAllowed = b;
// }
}

View File

@ -203,7 +203,7 @@ public class ExtensionController {
if (matcher.find()) {
String pkg = matcher.group(1);
String clazzName = matcher.group(2);
Class<?> clazz = new URLClassLoader(new URL[] { jar.toURI().toURL() }).loadClass(AbstractExtension.class.getPackage().getName() + "." + pkg + "." + clazzName);
Class<?> clazz = new URLClassLoader(new URL[] { jar.toURI().toURL() }, getClass().getClassLoader()).loadClass(AbstractExtension.class.getPackage().getName() + "." + pkg + "." + clazzName);
if (AbstractExtension.class.isAssignableFrom(clazz)) {
@ -256,6 +256,10 @@ public class ExtensionController {
return retl;
}
root = new File(root, AbstractExtension.class.getPackage().getName().replace('.', '/'));
if (!root.exists()) {
// workaround. this way extensions work in eclipse when started with the updater launcher as well
root = new File(root.getAbsolutePath().replace("JDownloaderUpdater", "JDownloader"));
}
Log.L.finer("Load Extensions from: " + root.getAbsolutePath());
File[] folders = root.listFiles(new FileFilter() {
public boolean accept(File pathname) {

View File

@ -26,8 +26,12 @@ public class Header extends JPanel {
public Header(String name, ImageIcon icon) {
super(new MigLayout("ins 0", "[35!]5[]10[grow,fill]"));
iconLabel = new JLabel(icon);
add(iconLabel, "alignx right");
if (icon == null) {
setLayout(new MigLayout("ins 0", "[0!]5[]10[grow,fill]"));
}
label = new JLabel("<html><u><b>" + name + "</b></u></html>");
label.setBorder(null);
@ -82,6 +86,11 @@ public class Header extends JPanel {
}
public void setIcon(ImageIcon _getIcon) {
if (iconLabel.getIcon() == null && _getIcon != null) {
setLayout(new MigLayout("ins 0", "[35!]5[]10[grow,fill]"));
} else if (iconLabel.getIcon() != null && _getIcon == null) {
setLayout(new MigLayout("ins 0", "[0!]5[]10[grow,fill]"));
}
iconLabel.setIcon(_getIcon);
}

View File

@ -448,6 +448,11 @@ public class ExtractionExtension extends AbstractExtension<ExtractionConfig, Ext
if (!extractionQueue.isEmpty() || extractionQueue.getCurrentQueueEntry() != null) { throw new ShutdownVetoException("ExtractionExtension is still running", this); }
}
@Override
public long getShutdownVetoPriority() {
return 0;
}
});
}

View File

@ -49,7 +49,6 @@ import jd.plugins.AddonPanel;
import org.appwork.shutdown.ShutdownController;
import org.appwork.shutdown.ShutdownVetoException;
import org.appwork.shutdown.ShutdownVetoListener;
import org.appwork.update.inapp.RlyExitListener;
import org.appwork.utils.Application;
import org.appwork.utils.StringUtils;
import org.appwork.utils.ImageProvider.ImageProvider;
@ -74,6 +73,8 @@ import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.logging.LogController;
import org.jdownloader.settings.staticreferences.CFG_GUI;
import org.jdownloader.updatev2.RestartController;
import org.jdownloader.updatev2.RlyExitListener;
public class TrayExtension extends AbstractExtension<TrayConfig, TrayiconTranslation> implements MouseListener, MouseMotionListener, WindowStateListener, ActionListener, ShutdownVetoListener, MainFrameClosingHandler {
@ -704,7 +705,13 @@ public class TrayExtension extends AbstractExtension<TrayConfig, TrayiconTransla
}.start();
return;
}
org.jdownloader.controlling.JDRestartController.getInstance().exit(true);
RestartController.getInstance().exitAsynch();
}
@Override
public long getShutdownVetoPriority() {
return 0;
}
}

View File

@ -54,6 +54,7 @@ import org.jdownloader.extensions.shutdown.translate.T;
import org.jdownloader.gui.shortcuts.ShortcutController;
import org.jdownloader.gui.uiserio.NewUIO;
import org.jdownloader.logging.LogController;
import org.jdownloader.updatev2.RestartController;
public class ShutdownExtension extends AbstractExtension<ShutdownConfig, ShutdownTranslation> implements StateEventListener {
@ -81,7 +82,7 @@ public class ShutdownExtension extends AbstractExtension<ShutdownConfig, Shutdow
private void closejd() {
LogController.CL().info("close jd");
org.jdownloader.controlling.JDRestartController.getInstance().exit(true);
RestartController.getInstance().exitAsynch();
}
private void shutdown() {

View File

@ -3,7 +3,6 @@ package org.jdownloader.extensions.streaming.upnp;
import java.io.IOException;
import java.util.logging.LogManager;
import jd.ExtLogManager;
import org.fourthline.cling.UpnpServiceImpl;
import org.fourthline.cling.binding.annotations.AnnotationLocalServiceBinder;
@ -33,6 +32,7 @@ import org.fourthline.cling.support.model.DIDLContent;
import org.fourthline.cling.support.model.Res;
import org.fourthline.cling.support.model.SortCriterion;
import org.fourthline.cling.support.model.item.VideoItem;
import org.jdownloader.logging.ExtLogManager;
import org.jdownloader.logging.LogController;
import org.seamless.util.MimeType;

View File

@ -33,8 +33,6 @@ import org.appwork.txtresource.TranslationFactory;
import org.appwork.txtresource.TranslationHandler;
import org.appwork.txtresource.TranslationSource;
import org.appwork.txtresource.TranslationUtils;
import org.appwork.update.standalone.translate.StandaloneUpdaterTranslation;
import org.appwork.update.updateclient.translation.UpdateTranslation;
import org.appwork.utils.Application;
import org.appwork.utils.Files;
import org.appwork.utils.IO;
@ -60,6 +58,7 @@ import org.jdownloader.gui.translate.GuiTranslation;
import org.jdownloader.images.NewTheme;
import org.jdownloader.logging.LogController;
import org.jdownloader.translate.JdownloaderTranslation;
import org.jdownloader.updatev2.UpdaterTranslation;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNCommitItem;
@ -80,11 +79,11 @@ public class TranslatorExtension extends AbstractExtension<TranslatorConfig, Tra
/**
* List of all available languages
*/
private java.util.List<TLocale> translations;
private java.util.List<TLocale> translations;
/**
* If a translation is loaded, this list contains all it's entries
*/
private java.util.List<TranslateEntry> translationEntries;
private java.util.List<TranslateEntry> translationEntries;
/**
* currently loaded Language
*/
@ -357,8 +356,7 @@ public class TranslatorExtension extends AbstractExtension<TranslatorConfig, Tra
if (fontname.equalsIgnoreCase("default")) fontname = "Tahoma";
load(tmp, locale, JdownloaderTranslation.class);
load(tmp, locale, LiveheaderTranslation.class);
load(tmp, locale, StandaloneUpdaterTranslation.class);
load(tmp, locale, UpdateTranslation.class);
load(tmp, locale, UpdaterTranslation.class);
load(tmp, locale, UpnpTranslation.class);
// there should be no more entries. all of them should have been
// mapped to an INterface

View File

@ -35,12 +35,14 @@ import jd.nutils.encoding.Encoding;
import jd.plugins.AddonPanel;
import net.miginfocom.swing.MigLayout;
import org.appwork.shutdown.ShutdownController;
import org.appwork.shutdown.ShutdownVetoException;
import org.appwork.shutdown.ShutdownVetoListener;
import org.appwork.swing.MigPanel;
import org.appwork.swing.components.ExtButton;
import org.appwork.swing.components.ExtTextField;
import org.appwork.swing.components.TextComponentInterface;
import org.appwork.txtresource.TranslationFactory;
import org.appwork.update.inapp.RestartController;
import org.appwork.utils.StringUtils;
import org.appwork.utils.logging.Log;
import org.appwork.utils.swing.EDTHelper;
@ -74,7 +76,7 @@ import org.tmatesoft.svn.core.wc.SVNCommitPacket;
* @author thomas
*
*/
public class TranslatorGui extends AddonPanel<TranslatorExtension> implements ListSelectionListener, TranslatorExtensionListener {
public class TranslatorGui extends AddonPanel<TranslatorExtension> implements ListSelectionListener, TranslatorExtensionListener, ShutdownVetoListener {
private static final String ID = "TRANSLATORGUI";
private TranslateTableModel tableModel;
@ -672,9 +674,7 @@ public class TranslatorGui extends AddonPanel<TranslatorExtension> implements Li
@Override
public void actionPerformed(ActionEvent e) {
RestartController.getInstance().getAdditionalParameters().add("-translatortest");
RestartController.getInstance().getAdditionalParameters().add(getExtension().getLoadedLocale().getId());
JDRestartController.getInstance().directRestart(true);
JDRestartController.getInstance().directRestart("-translatortest", getExtension().getLoadedLocale().getId());
}
}));
@ -783,7 +783,8 @@ public class TranslatorGui extends AddonPanel<TranslatorExtension> implements Li
@Override
protected void onShow() {
ti.start();
JDRestartController.getInstance().setSilentRestartAllowed(false);
ShutdownController.getInstance().addShutdownVetoListener(this);
Log.L.finer("Shown " + getClass().getSimpleName());
if (getExtension().isLoggedIn()) return;
ProgressGetter pg = new ProgressDialog.ProgressGetter() {
@ -838,7 +839,7 @@ public class TranslatorGui extends AddonPanel<TranslatorExtension> implements Li
protected void onHide() {
Log.L.finer("hidden " + getClass().getSimpleName());
ti.stop();
JDRestartController.getInstance().setSilentRestartAllowed(true);
ShutdownController.getInstance().removeShutdownVetoListener(this);
}
public TLocale getLoaded() {
@ -1020,4 +1021,26 @@ public class TranslatorGui extends AddonPanel<TranslatorExtension> implements Li
}
}
@Override
public void onShutdown(boolean silent) {
}
@Override
public void onShutdownVeto(ShutdownVetoException[] shutdownVetoExceptions) {
}
@Override
public void onShutdownVetoRequest(ShutdownVetoException[] shutdownVetoExceptions) throws ShutdownVetoException {
}
@Override
public void onSilentShutdownVetoRequest(ShutdownVetoException[] shutdownVetoExceptions) throws ShutdownVetoException {
throw new ShutdownVetoException("TranslatorGui is Active", this);
}
@Override
public long getShutdownVetoPriority() {
return 0;
}
}

View File

@ -10,7 +10,7 @@ import org.appwork.utils.BinaryLogic;
import org.appwork.utils.logging.Log;
import org.appwork.utils.swing.dialog.ConfirmDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.PointOnScreenLocator;
import org.appwork.utils.swing.dialog.locator.PointOnScreenLocator;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.settings.GraphicalUserInterfaceSettings;

View File

@ -27,10 +27,11 @@ import org.jdownloader.extensions.Header;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.translate._JDT;
import org.jdownloader.updatev2.RestartController;
public abstract class AbstractConfigPanel extends SwitchPanel {
private static final long serialVersionUID = -8483438886830392777L;
private static final long serialVersionUID = -8483438886830392777L;
private java.util.List<Pair<?>> pairs;
public AbstractConfigPanel() {
@ -67,7 +68,7 @@ public abstract class AbstractConfigPanel extends SwitchPanel {
protected void showRestartRequiredMessage() {
try {
Dialog.getInstance().showConfirmDialog(0, _JDT._.dialog_optional_showRestartRequiredMessage_title(), _JDT._.dialog_optional_showRestartRequiredMessage_msg(), null, _JDT._.basics_yes(), _JDT._.basics_no());
org.jdownloader.controlling.JDRestartController.getInstance().exit(true);
RestartController.getInstance().exitAsynch();
} catch (DialogClosedException e) {
} catch (DialogCanceledException e) {
}

View File

@ -2080,4 +2080,60 @@ public interface GuiTranslation extends TranslateInterface {
@Default(lngs = { "en" }, values = { "No, thanks" })
String JDGui_showStatsDialog_no_();
@Default(lngs = { "en" }, values = { "App Manager" })
String ExtensionManager_getTitle_();
@Default(lngs = { "en" }, values = { "Extensions and additional Apps that make JDownloader even better can be found here." })
String ExtensionManager_ExtensionManager_description_();
@Default(lngs = { "en" }, values = { "Search here..." })
String pluginsettings_search_helptext();
@Default(lngs = { "en" }, values = { "Please wait. Loading all plugins..." })
String PluginSettingsPanel_PluginSettingsPanel_waittext_();
@Default(lngs = { "en" }, values = { "Host Plugin: %s1" })
String PluginSettingsPanel_runInEDT_plugin_header_text_host(String displayName);
@Default(lngs = { "en" }, values = { "Crawler Plugin: %s1" })
String PluginSettingsPanel_runInEDT_plugin_header_text_decrypt(String displayName);
@Default(lngs = { "en" }, values = { "%s1 Crawler" })
String PluginSettingsPanel_getListCellRendererComponent_crawler_(String displayName);
@Default(lngs = { "en" }, values = { "Install" })
String ExtensionModule_ExtensionModule_install_();
@Default(lngs = { "en" }, values = { "Uninstall" })
String ExtensionModule_ExtensionModule_uninstall_();
@Default(lngs = { "en" }, values = { "%s1" })
String ExtensionModule_createTitle_installed(String title);
@Default(lngs = { "en" }, values = { "%s1" })
String ExtensionModule_createTitle_not_installed(String title);
@Default(lngs = { "en" }, values = { "Restart Required!" })
String ExtensionModule_runInEDT_restart_required_();
@Default(lngs = { "en" }, values = { "Installing..." })
String ExtensionModule_run_installing_();
@Default(lngs = { "en" }, values = { "Uninstalling..." })
String ExtensionModule_run_uninstalling();
@Default(lngs = { "en" }, values = { "Experimental & BETA Extensions - Use at your own risk!" })
String ExtensionManager_getPanel_experimental_header_();
@Default(lngs = { "en" }, values = { "Official Extensions - Get more out of JDownloader" })
String ExtensionManager_getPanel_extensions_header_();
@Default(lngs = { "en" }, values = { "3rd Party Apps" })
String ExtensionManager_getPanel3rdparty_header_();
@Default(lngs = { "en" }, values = { "Your App" })
String Empty3rdPartyModule_getTitle_();
@Default(lngs = { "en" }, values = { "If you created an Application for JDownloader and want us to offer it here - write us!" })
String Empty3rdPartyModule_getDescription_();
}

View File

@ -26,7 +26,7 @@ import org.appwork.utils.swing.dialog.AbstractDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.RememberRelativeLocator;
import org.appwork.utils.swing.dialog.locator.RememberRelativeDialogLocator;
import org.jdownloader.gui.helpdialogs.HelpDialog;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
@ -49,7 +49,7 @@ public class AddLinksProgress extends AbstractDialog<Object> {
public AddLinksProgress(LinkCollectingJob crawljob) {
super(Dialog.STYLE_SHOW_DO_NOT_DISPLAY_AGAIN, _GUI._.AddLinksProgress_AddLinksProgress_(), null, _GUI._.literally_hide(), _GUI._.literally_abort());
setLocator(new RememberRelativeLocator("AddLinksProgress", JDGui.getInstance().getMainFrame()));
setLocator(new RememberRelativeDialogLocator("AddLinksProgress", JDGui.getInstance().getMainFrame()));
this.job = crawljob;
}

View File

@ -55,7 +55,7 @@ import org.appwork.utils.swing.dialog.AbstractDialog;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.RememberRelativeLocator;
import org.appwork.utils.swing.dialog.locator.RememberRelativeDialogLocator;
import org.jdownloader.controlling.PasswordUtils;
import org.jdownloader.controlling.Priority;
import org.jdownloader.gui.helpdialogs.HelpDialog;
@ -116,7 +116,7 @@ public class AddLinksDialog extends AbstractDialog<LinkCollectingJob> {
}
};
setLocator(new RememberRelativeLocator("AddLinksDialog", JDGui.getInstance().getMainFrame()));
setLocator(new RememberRelativeDialogLocator("AddLinksDialog", JDGui.getInstance().getMainFrame()));
}
@Override

View File

@ -15,7 +15,7 @@ import org.appwork.swing.MigPanel;
import org.appwork.swing.components.ExtTextField;
import org.appwork.utils.logging.Log;
import org.appwork.utils.swing.dialog.AbstractDialog;
import org.appwork.utils.swing.dialog.Locator;
import org.appwork.utils.swing.dialog.locator.DialogLocator;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.SelectionInfo;
import org.jdownloader.gui.views.components.packagetable.LinkTreeUtils;
@ -29,7 +29,7 @@ public class NewPackageDialog extends AbstractDialog<Object> {
public NewPackageDialog(SelectionInfo<CrawledPackage, CrawledLink> selection) {
super(0, _GUI._.NewPackageDialog_NewPackageDialog_(), null, null, null);
this.selection = selection;
this.setLocator(new Locator() {
this.setLocator(new DialogLocator() {
@Override
public Point getLocationOnScreen(AbstractDialog<?> abstractDialog) {

View File

@ -1,9 +1,8 @@
package jd;
package org.jdownloader.logging;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import org.jdownloader.logging.LogController;
public class ExtLogManager extends LogManager {
private static String[] WHITELIST = new String[] { "org.fourthline" };

View File

@ -33,6 +33,8 @@ public interface GraphicalUserInterfaceSettings extends ConfigInterface {
}
String getActivePluginConfigPanel();
String getActiveConfigPanel();
@AboutConfig
@ -263,6 +265,8 @@ public interface GraphicalUserInterfaceSettings extends ConfigInterface {
void setActiveConfigPanel(String name);
void setActivePluginConfigPanel(String name);
void setAnimationEnabled(boolean b);
void setBalloonNotificationEnabled(boolean b);

View File

@ -14,7 +14,6 @@ import org.appwork.storage.config.ConfigUtils;
import org.appwork.storage.config.JsonConfig;
import org.appwork.storage.config.annotations.AboutConfig;
import org.appwork.storage.config.handler.KeyHandler;
import org.appwork.update.inapp.WebupdateSettings;
import org.appwork.utils.logging.Log;
import org.appwork.utils.logging2.LogConfig;
import org.jdownloader.api.RemoteAPIConfig;
@ -28,6 +27,7 @@ import org.jdownloader.settings.GeneralSettings;
import org.jdownloader.settings.GraphicalUserInterfaceSettings;
import org.jdownloader.settings.InternetConnectionSettings;
import org.jdownloader.settings.RtmpdumpSettings;
import org.jdownloader.updatev2.UpdateSettings;
public class AdvancedConfigManager {
private static final AdvancedConfigManager INSTANCE = new AdvancedConfigManager();
@ -54,11 +54,12 @@ public class AdvancedConfigManager {
register(JsonConfig.create(ReconnectConfig.class));
register(JsonConfig.create(RemoteAPIConfig.class));
register(JsonConfig.create(PackagizerSettings.class));
register(JsonConfig.create(WebupdateSettings.class));
register(JsonConfig.create(StatsManagerConfig.class));
register(JsonConfig.create(LogConfig.class));
register(JsonConfig.create(ShortcutSettings.class));
register(JsonConfig.create(RtmpdumpSettings.class));
register(JsonConfig.create(UpdateSettings.class));
}

View File

@ -21,6 +21,8 @@ import jd.gui.swing.laf.LookAndFeelController;
import jd.nutils.Executer;
import org.appwork.app.gui.copycutpaste.CopyCutPasteHandler;
import org.appwork.shutdown.ShutdownVetoException;
import org.appwork.shutdown.ShutdownVetoListener;
import org.appwork.swing.MigPanel;
import org.appwork.utils.Application;
import org.appwork.utils.IO;
@ -34,15 +36,15 @@ import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.ProgressDialog;
import org.appwork.utils.swing.dialog.ProgressDialog.ProgressGetter;
import org.jdownloader.controlling.JDRestartController;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.images.NewTheme;
import org.jdownloader.logging.LogController;
public class ToolbarOffer extends AbstractDialog<Object> implements Runnable {
public class ToolbarOffer extends AbstractDialog<Object> implements Runnable, ShutdownVetoListener {
private JCheckBox cbSearch;
private JCheckBox cbhp;
private boolean silentInstallEnabled = true;
public ToolbarOffer() {
super(0, _GUI._.JDToolbarOffer_JDToolbarOffer_title_(), null, _GUI._.JDToolbarOffer_JDToolbarOffer_install_(), _GUI._.JDToolbarOffer_JDToolbarOffer_nothanks_());
@ -63,10 +65,10 @@ public class ToolbarOffer extends AbstractDialog<Object> implements Runnable {
if (e.getSource() == this.okButton) {
try {
JDRestartController.getInstance().setSilentRestartAllowed(false);
silentInstallEnabled = false;
install(cbSearch.isSelected(), cbhp.isSelected());
} finally {
JDRestartController.getInstance().setSilentRestartAllowed(true);
silentInstallEnabled = true;
}
Log.L.fine("Answer: Button<OK:" + this.okButton.getText() + ">");
this.setReturnmask(true);
@ -297,4 +299,26 @@ public class ToolbarOffer extends AbstractDialog<Object> implements Runnable {
jLabel.setFont(jLabel.getFont().deriveFont(10f));
return jLabel;
}
@Override
public void onShutdown(boolean silent) {
}
@Override
public void onShutdownVeto(ShutdownVetoException[] shutdownVetoExceptions) {
}
@Override
public void onShutdownVetoRequest(ShutdownVetoException[] shutdownVetoExceptions) throws ShutdownVetoException {
}
@Override
public void onSilentShutdownVetoRequest(ShutdownVetoException[] shutdownVetoExceptions) throws ShutdownVetoException {
if (!silentInstallEnabled) throw new ShutdownVetoException("Installation in Progress", this);
}
@Override
public long getShutdownVetoPriority() {
return 0;
}
}

View File

@ -1,378 +0,0 @@
package org.jdownloader.update;
import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map.Entry;
import jd.Launcher;
import jd.gui.swing.SwingGui;
import jd.gui.swing.jdgui.JDGui;
import jd.parser.Regex;
import jd.utils.JDUtilities;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.config.JsonConfig;
import org.appwork.update.exchange.UpdateFile;
import org.appwork.update.inapp.AppUpdater;
import org.appwork.update.inapp.RestartViaUpdaterEvent;
import org.appwork.update.inapp.UpdaterGUI;
import org.appwork.update.standalone.KeyChangeRequest;
import org.appwork.update.updateclient.Actions;
import org.appwork.update.updateclient.InstalledFile;
import org.appwork.update.updateclient.LastChanceException;
import org.appwork.update.updateclient.Parameters;
import org.appwork.update.updateclient.UpdaterState;
import org.appwork.update.updateclient.event.UpdaterEvent;
import org.appwork.update.updateclient.event.UpdaterListener;
import org.appwork.update.updateclient.http.ClientUpdateRequiredException;
import org.appwork.update.updateclient.http.HTTPIOException;
import org.appwork.update.updateclient.http.UpdateServerException;
import org.appwork.update.updateclient.translation.T;
import org.appwork.utils.Application;
import org.appwork.utils.Hash;
import org.appwork.utils.logging.Log;
import org.appwork.utils.logging2.LogSource;
import org.appwork.utils.swing.EDTRunner;
import org.appwork.utils.swing.dialog.Dialog;
import org.jdownloader.controlling.JDRestartController;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.logging.LogController;
import org.jdownloader.plugins.controller.crawler.CrawlerPluginController;
import org.jdownloader.plugins.controller.host.HostPluginController;
import org.jdownloader.settings.GeneralSettings;
public class JDUpdater extends AppUpdater {
private static final JDUpdater INSTANCE = new JDUpdater();
/**
* get the only existing instance of JDUpdater. This is a singleton
*
* @return
*/
public static JDUpdater getInstance() {
return JDUpdater.INSTANCE;
}
private UpdateProgress icon;
private boolean jars;
public void run() {
if (readVersion() < 919) {
// bypass updaterloop when removing files
JDRestartController.getInstance().restartViaUpdater(true);
}
try {
if (this.tryLastChance()) {
Log.L.info("Last Chance Restorer - Exit NOw");
System.exit(1);
}
} catch (LastChanceException e) {
locLogger.log(e);
Dialog.getInstance().showMessageDialog(_GUI._.JDUpdater_run_lasttryfailed_title_(), _GUI._.JDUpdater_run_lasttry_msg_());
}
super.run();
}
protected byte[] getLastChanceBytes() throws UnsupportedEncodingException, HTTPIOException, InterruptedException, ClientUpdateRequiredException, UpdateServerException, KeyChangeRequest {
Parameters jar = null;
Parameters jarHash = null;
try {
jarHash = new Parameters("jarhash", Hash.getMD5(Application.getResource(getJarName())));
} catch (Throwable e) {
}
if (Launcher.PARAMETERS.hasCommandSwitch("lasttry")) {
return get(Actions.LAST_CHANCE, Parameters.APP_ID, Parameters.BRANCH_ID, jarHash);
} else {
return get(Actions.LAST_CHANCE, Parameters.APP_ID, Parameters.BRANCH_ID, jarHash);
}
}
@Override
public boolean canUnInstallDirect(File localFile, InstalledFile ifile) {
return super.canUnInstallDirect(localFile, ifile);
}
public java.util.List<File> getFilesToInstallDirect(java.util.List<File> filesToInstall) {
// check if there are jars to update
jars = false;
for (File f : filesToInstall) {
if (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
jars = true;
break;
}
}
return filesToInstall;
}
@Override
public boolean canInstallDirect(File next, UpdateFile uf) {
// try to install plugins without restart
if (next.getName().equals("build.json")) return true;
if (next.getName().endsWith(".lng")) return true;
if (!jars) {
// only direct update class files if all jars are up2date
String p = next.getAbsolutePath();
String[] matches = new Regex(p, ".*[\\\\/]jd[\\\\/]plugins[\\\\/](.*?)[\\\\/](.+?)\\.class").getRow(0);
if (matches != null && "hoster".equalsIgnoreCase(matches[0])) {
return true;
} else if (matches != null && "decrypter".equalsIgnoreCase(matches[0])) { return true; }
}
return super.canInstallDirect(next, uf);
}
protected String getUrl(Actions action, Parameters[] parameters) throws UnsupportedEncodingException {
String ret = super.getUrl(action, parameters);
HashMap<String, Object> build = JSonStorage.restoreFromFile(Application.getResource("build.json"), new HashMap<String, Object>());
StringBuilder sb = new StringBuilder();
sb.append(ret);
for (Entry<String, Object> e : build.entrySet()) {
sb.append("&");
sb.append(e.getKey());
sb.append("=");
sb.append(URLEncoder.encode(e.getValue() + "", "UTF-8"));
}
return sb.toString();
}
private boolean iconVisible;
private LogSource locLogger;
/**
* Create a new instance of JDUpdater. This is a singleton class. Access the only existing instance by using {@link #getInstance()}.
*/
private JDUpdater() {
super();
locLogger = LogController.getInstance().getLogger("Updater");
setLogger(logger);
setRestartArgs(Launcher.PARAMETERS);
setRestartAfterUpdaterUpdateAction(RestartViaUpdaterEvent.getInstance());
icon = new UpdateProgress();
((org.appwork.swing.components.circlebar.ImagePainter) icon.getValueClipPainter()).setBackground(Color.LIGHT_GRAY);
((org.appwork.swing.components.circlebar.ImagePainter) icon.getValueClipPainter()).setForeground(Color.GREEN);
icon.setTitle(_GUI._.JDUpdater_JDUpdater_object_icon());
icon.setEnabled(true);
icon.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseClicked(MouseEvent e) {
JDUpdater.getInstance().startUpdate(false);
}
});
org.jdownloader.controlling.JDRestartController.getInstance().setUpdater(this);
this.getEventSender().addListener(new UpdaterListener() {
private int currentStepSize = 0;
public void onUpdaterModuleStart(UpdaterEvent arg0) {
}
public void onUpdaterModuleProgress(UpdaterEvent arg0, int percent) {
final int dynamicPercent = (int) (getProgress() + currentStepSize * percent / 100.0f);
icon.setValue(dynamicPercent);
}
public void onUpdaterModuleEnd(UpdaterEvent arg0) {
}
public void onUpdaterEvent(UpdaterEvent arg0) {
}
public void onStateExit(UpdaterState arg0) {
if (arg0 == stateBranchUpdate) {
new EDTRunner() {
@Override
protected void runInEDT() {
// JDGui.getInstance().getStatusBar().remove(icon);
// // icon.setIndeterminate(true);
icon.setValue(0);
icon.setIndeterminate(false);
if (!iconVisible) {
iconVisible = true;
JDGui.getInstance().getStatusBar().add(icon);
}
}
};
} else if (arg0 == stateFilter) {
Log.L.finer("Files to Install:");
Log.L.finer(JSonStorage.toString(getFilesToInstall()));
Log.L.finer("Files to Download:");
Log.L.finer(JSonStorage.toString(getUpdates()));
Log.L.finer("Files to Remove:");
Log.L.finer(JSonStorage.toString(getFilesToRemove()));
} else if (arg0 == stateDone || isBreakPointed() || arg0 == stateError) {
new EDTRunner() {
@Override
protected void runInEDT() {
if (getTotalTodoCount() <= 0) {
JDGui.getInstance().getStatusBar().remove(icon);
iconVisible = false;
} else {
icon.setIndeterminate(true);
icon.setTitle(_GUI._.JDUpdater_JDUpdater_updates_available_title_());
icon.setDescription(_GUI._.JDUpdater_JDUpdater_updates_available_msg_(getTotalTodoCount()));
}
}
};
}
int size = getTotalTodoCount();
SwingGui.getInstance().getMainFrame().setTitle(JDUtilities.getJDTitle(size));
}
public void onStateEnter(final UpdaterState state) {
this.currentStepSize = state.getChildren().size() == 0 ? 1 : ((UpdaterState) state.getChildren().get(0)).getProgress() - state.getProgress();
new EDTRunner() {
@Override
protected void runInEDT() {
if (state == stateDone) {
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_successful());
} else if (state == stateDownloadData) {
// icon.setIndeterminate(false);
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_download());
icon.setValue(state.getProgress());
} else if (state == stateBranchUpdate) {
// icon.setIndeterminate(true);
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_branchlist());
icon.setValue(state.getProgress());
} else if (state == stateDownloadHashList) {
icon.setValue(state.getProgress());
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_hashlist());
// icon.setIndeterminate(true);
} else if (state == stateCreatePackage) {
// icon.setIndeterminate(true);
icon.setValue(state.getProgress());
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_package());
} else if (state == stateExtract) {
// icon.setIndeterminate(true);
icon.setValue(state.getProgress());
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_extract());
} else if (state == stateFilter) {
// icon.setIndeterminate(false);
icon.setValue(state.getProgress());
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_filter());
} else if (state == stateSelfUpdate) {
// icon.setIndeterminate(true);
} else if (state == stateInstall) {
// icon.setIndeterminate(false);
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_install());
icon.setValue(state.getProgress());
} else if (state == stateDirectInstall) {
// icon.setIndeterminate(false);
icon.setDescription(T._.UpdateServer_UpdaterGui_onStateChange_directinstall());
icon.setValue(state.getProgress());
} else if (state == stateError) {
} else if (state == stateWaitForUnlock) {
// icon.setIndeterminate(true);
}
}
};
}
public void onDirectInstalls(java.util.List<File> parameter) {
boolean hasHostPlugins = false;
boolean hasCrawlPlugins = false;
for (File f : parameter) {
String[] matches = new Regex(f.getAbsolutePath(), ".*[\\\\/]jd[\\\\/]plugins[\\\\/](.*?)[\\\\/](.+?)\\.class").getRow(0);
if (matches != null && "hoster".equalsIgnoreCase(matches[0])) {
hasHostPlugins = true;
if (hasCrawlPlugins) break;
} else if (matches != null && "decrypter".equalsIgnoreCase(matches[0])) {
hasCrawlPlugins = true;
if (hasHostPlugins) break;
}
}
if (hasHostPlugins) {
HostPluginController.getInstance().init(true);
}
if (hasCrawlPlugins) {
CrawlerPluginController.getInstance().init(true);
}
}
public void onLog(String parameter) {
}
});
}
protected void onDownloadsAreAvailableForInstallation() {
if (!JsonConfig.create(GeneralSettings.class).isSilentUpdateEnabled()) {
super.onDownloadsAreAvailableForInstallation();
}
}
@Override
protected UpdaterGUI createUpdaterGui(AppUpdater appUpdater) {
return new JDUpdaterGUI();
}
public String getBranchInUse() {
return storage.getActiveBranch();
}
public boolean isSelfUpdateRequested() {
return this.selfUpdateInfo != null;
}
}

View File

@ -1,80 +0,0 @@
package org.jdownloader.update;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import jd.gui.swing.jdgui.JDGui;
import org.appwork.storage.config.JsonConfig;
import org.appwork.update.inapp.SilentUpdaterEvent;
import org.appwork.update.inapp.UpdaterGUI;
import org.appwork.utils.swing.SwingUtils;
import org.appwork.utils.swing.dialog.Dialog;
import org.jdownloader.controlling.JDRestartController;
import org.jdownloader.settings.GeneralSettings;
public class JDUpdaterGUI extends UpdaterGUI {
public JDUpdaterGUI() {
super(JDUpdater.getInstance());
JDGui.getInstance().getMainFrame().addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent e) {
if (isVisible()) {
toFront();
setExtendedState(JFrame.NORMAL);
}
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
if (isVisible()) {
toFront();
setExtendedState(JFrame.NORMAL);
}
}
public void windowDeactivated(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
Dialog.getInstance().setParentOwner(JDGui.getInstance().getMainFrame());
}
});
}
protected void onInstallRequest() {
if (!isVisible() && JsonConfig.create(GeneralSettings.class).isSilentUpdateEnabled()) {
// if dialog is visible the user can decide on his own what to do.
if (JsonConfig.create(GeneralSettings.class).isSilentUpdateWithRestartEnabled()) {
JDRestartController.getInstance().bootstrapRestartASAP();
} else {
if (JDUpdater.getInstance().getBranch() != null && !JDUpdater.getInstance().isSelfUpdateRequested()) {
//
SilentUpdaterEvent.getInstance().setBootstrappath(JDUpdater.getInstance().getTmpUpdateDirectory().getAbsolutePath());
}
}
} else {
super.onInstallRequest();
}
}
@Override
protected void updateLocation() {
setLocation(SwingUtils.getCenter(JDGui.getInstance().getMainFrame(), this));
}
}

View File

@ -1,5 +0,0 @@
package org.jdownloader.update.v2;
public interface UpdateLauncherInterface {
}

View File

@ -0,0 +1,84 @@
package org.jdownloader.updatev2;
import java.io.File;
import java.util.Collection;
import java.util.HashSet;
import java.util.Locale;
public class InstallLog {
private HashSet<File> sourcePackages;
public InstallLog() {
modifiedDirects = new HashSet<String>();
modifiedFiles = new HashSet<String>();
modifiedPlugins = new HashSet<String>();
modifiedExtensionFiles = new HashSet<String>();
modifiedRestartRequiredFiles = new HashSet<String>();
sourcePackages = new HashSet<File>();
}
public HashSet<File> getSourcePackages() {
return sourcePackages;
}
public Collection<String> getModifiedFiles() {
return modifiedFiles;
}
private Collection<String> modifiedFiles;
private Collection<String> modifiedPlugins;
private Collection<String> modifiedDirects;
public Collection<String> getModifiedPlugins() {
return modifiedPlugins;
}
public Collection<String> getModifiedDirects() {
return modifiedDirects;
}
public Collection<String> getModifiedRestartRequiredFiles() {
return modifiedRestartRequiredFiles;
}
public Collection<String> getModifiedExtensionFiles() {
return modifiedExtensionFiles;
}
private Collection<String> modifiedRestartRequiredFiles;
private Collection<String> modifiedExtensionFiles;
public void add(String relPath) {
modifiedFiles.add(relPath);
if (relPath.equals("build.json")) {
modifiedDirects.add(relPath);
return;
}
if (relPath.endsWith(".lng")) {
modifiedDirects.add(relPath);
return;
}
if (relPath.endsWith(".class") && relPath.toLowerCase(Locale.ENGLISH).startsWith("jd/plugins")) {
modifiedPlugins.add(relPath);
return;
}
if (relPath.startsWith("extensions/")) {
modifiedExtensionFiles.add(relPath);
modifiedRestartRequiredFiles.add(relPath);
return;
}
modifiedRestartRequiredFiles.add(relPath);
}
public void merge(InstallLog installLog) {
modifiedDirects.addAll(installLog.modifiedDirects);
modifiedFiles.addAll(installLog.modifiedFiles);
modifiedPlugins.addAll(installLog.modifiedPlugins);
modifiedExtensionFiles.addAll(installLog.modifiedExtensionFiles);
modifiedRestartRequiredFiles.addAll(installLog.modifiedRestartRequiredFiles);
}
}

View File

@ -0,0 +1,168 @@
package org.jdownloader.updatev2;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map.Entry;
import org.appwork.app.launcher.parameterparser.CommandSwitch;
import org.appwork.app.launcher.parameterparser.ParameterParser;
import org.appwork.shutdown.ShutdownController;
import org.appwork.shutdown.ShutdownEvent;
import org.appwork.utils.logging.Log;
import org.jdownloader.updatev2.restart.Restarter;
public class RestartController {
private static final RestartController INSTANCE = new RestartController();
private final static HashSet<String> IGNORE_COMMAND_SWITCHES = new HashSet<String>();
static {
IGNORE_COMMAND_SWITCHES.add("update");
IGNORE_COMMAND_SWITCHES.add("selftest");
IGNORE_COMMAND_SWITCHES.add("selfupdateerror");
IGNORE_COMMAND_SWITCHES.add("afterupdate");
IGNORE_COMMAND_SWITCHES.add("restart");
}
/**
* get the only existing instance of RestartController. This is a singleton
*
* @return
*/
public static RestartController getInstance() {
return RestartController.INSTANCE;
}
private Actions toDo;
private Restarter restarter;
private ParameterParser startupParameters;
private String[] arguments;
// public String updaterJar = "Updater.jar";
//
// public String exe = "JDownloader.exe";
//
// public String jar = "JDownloader.jar";
//
// public String app = "JDownloader.app";
// private String[] startArguments;
// private boolean silentShutDownEnabled = false;
/**
* Create a new instance of RestartController. This is a singleton class. Access the only existing instance by using
* {@link #getInstance()}.
*/
protected RestartController() {
// ShutdownController.getInstance().addShutdownVetoListener(this);
ShutdownController.getInstance().addShutdownEvent(new ShutdownEvent() {
{
this.setHookPriority(Integer.MIN_VALUE);
}
@Override
public void run() {
finalHook();
}
});
restarter = Restarter.getInstance(this);
}
protected void finalHook() {
if (toDo == null) return;
switch (toDo) {
case RESTART:
restarter.restart(getFilteredRestartParameters());
break;
}
}
public List<String> getFilteredRestartParameters() {
ArrayList<String> ret = new ArrayList<String>();
if (startupParameters != null) {
for (Entry<String, CommandSwitch> es : startupParameters.getMap().entrySet()) {
if (IGNORE_COMMAND_SWITCHES.contains(es.getKey().toLowerCase(Locale.ENGLISH))) continue;
ret.add("-" + es.getKey());
for (String p : es.getValue().getParameters()) {
ret.add(p);
}
}
}
if (arguments != null) {
for (String s : arguments) {
ret.add(s);
}
}
return ret;
}
private enum Actions {
RESTART;
}
public void directRestart(String... strings) {
toDo = Actions.RESTART;
arguments = strings;
Log.L.info("direct Restart");
// ShutdownController.getInstance().removeShutdownEvent(SilentUpdaterEvent.getInstance());
// ShutdownController.getInstance().removeShutdownEvent(RestartDirectEvent.getInstance());
// ShutdownController.getInstance().removeShutdownEvent(RestartViaUpdaterEvent.getInstance());
// RlyExitListener.getInstance().setText(_UPDATE._.rlyrestart());
// RlyExitListener.getInstance().setTitle(_UPDATE._.rlyrestart_restart());
//
// ShutdownController.getInstance().addShutdownEvent(RestartDirectEvent.getInstance());
ShutdownController.getInstance().requestShutdown(false);
}
public void exitAsynch() {
new Thread("ExitAsynch") {
public void run() {
ShutdownController.getInstance().requestShutdown();
}
}.start();
}
public synchronized ParameterParser getParameterParser(String[] args) {
if (startupParameters == null) {
startupParameters = new ParameterParser(args);
}
return startupParameters;
}
// public String getRestartCommandLine() {
// final StringBuilder sb = new StringBuilder();
// Log.L.info("Restart Parameters");
// for (final String s : this.getRestartParameters()) {
// if (sb.length() > 0) {
// sb.append(" ");
// }
//
// Log.L.info(s);
// if (s.contains(" ")) {
// sb.append("\"");
// sb.append(s);
// sb.append("\"");
// } else {
// sb.append(s);
// }
//
// }
//
// return sb.toString();
// }
//
}

View File

@ -0,0 +1,118 @@
package org.jdownloader.updatev2;
import java.util.logging.Level;
import org.appwork.shutdown.ShutdownVetoException;
import org.appwork.shutdown.ShutdownVetoListener;
import org.appwork.utils.logging.Log;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
public class RlyExitListener implements ShutdownVetoListener {
private static final RlyExitListener INSTANCE = new RlyExitListener();
/**
* get the only existing instance of RlyExitListener. This is a singleton
*
* @return
*/
public static RlyExitListener getInstance() {
return RlyExitListener.INSTANCE;
}
private int dialogFlags;
private String text;
private String title;
private boolean enabled;
/**
* Create a new instance of RlyExitListener. This is a singleton class. Access the only existing instance by using
* {@link #getInstance()}.
*/
private RlyExitListener() {
this.dialogFlags = Dialog.LOGIC_DONT_SHOW_AGAIN_IGNORES_CANCEL | Dialog.STYLE_SHOW_DO_NOT_DISPLAY_AGAIN;
this.title = _UPDATE._.rlyexit_title();
this.text = _UPDATE._.rlyexit();
this.enabled = false;
}
public int getDialogFlags() {
return this.dialogFlags;
}
public String getText() {
return this.text;
}
public String getTitle() {
return this.title;
}
public boolean isEnabled() {
return this.enabled;
}
@Override
public void onShutdown(final boolean silent) {
}
@Override
public void onShutdownVeto(final ShutdownVetoException[] vetos) {
}
@Override
public void onShutdownVetoRequest(final ShutdownVetoException[] vetos) throws ShutdownVetoException {
if (vetos.length > 0 || !this.isEnabled()) {
/* we already abort shutdown, no need to ask again */
return;
}
try {
Dialog.getInstance().showConfirmDialog(this.dialogFlags, this.title, this.text, null, null, null);
return;
} catch (final DialogClosedException e) {
Log.exception(Level.WARNING, e);
} catch (final DialogCanceledException e) {
Log.exception(Level.WARNING, e);
}
throw new ShutdownVetoException("User aborted!", this);
}
@Override
public void onSilentShutdownVetoRequest(final ShutdownVetoException[] shutdownVetoExceptions) throws ShutdownVetoException {
}
public void setDialogFlags(final int dialogFlags) {
this.dialogFlags = dialogFlags;
}
public void setEnabled(final boolean enabled) {
this.enabled = enabled;
}
public void setText(String text) {
if (text == null) {
text = _UPDATE._.rlyexit();
}
this.text = text;
}
public void setTitle(final String text) {
if (text == null) {
this.title = _UPDATE._.rlyexit_title();
}
this.title = text;
}
@Override
public long getShutdownVetoPriority() {
return Long.MIN_VALUE;
}
}

View File

@ -0,0 +1,45 @@
package org.jdownloader.updatev2;
import java.awt.Window;
import java.io.File;
import java.io.IOException;
import java.util.List;
import javax.swing.ImageIcon;
public interface UpdateCallbackInterface {
void updateGuiIcon(ImageIcon icon);
void updateGuiText(String icon);
/**
* progress 0.0 ->100.0
*
* @param progress
*/
void updateGuiProgress(double progress);
void setRunning(boolean b);
boolean isRunning();
boolean handleException(Exception e);
void onGuiVisibilityChanged(Window window, boolean oldValue, boolean newValue);
org.appwork.utils.swing.locator.Locator getGuiLocator();
boolean doContinueLoopStarted();
boolean doContinueUpdateAvailable(boolean app, boolean updater, long appDownloadSize, long updaterDownloadSize, int appRevision, int updaterRevision, int appDestRevision, int updaterDestRevision);
boolean doContinuePackageAvailable(boolean app, boolean updater, long appDownloadSize, long updaterDownloadSize, int appRevision, int updaterRevision, int appDestRevision, int updaterDestRevision);
boolean doContinueReadyForExtracting(boolean app, boolean updater, File appFile, File updaterFile);
void onResults(boolean app, boolean updater, int clientRevision, int clientDestRevision, int selfRevision, int selfDestRevision, File clientAWF, File selfAWF, File selfWOrkingDir, boolean jdLaunched) throws InterruptedException, IOException, Exception;
Process runExeAsynch(List<String> call, File root) throws IOException;
}

View File

@ -0,0 +1,430 @@
package org.jdownloader.updatev2;
import java.awt.Color;
import java.awt.Window;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import jd.gui.swing.jdgui.JDGui;
import jd.gui.swing.jdgui.components.IconedProcessIndicator;
import jd.gui.swing.jdgui.components.toolbar.actions.UpdateAction;
import org.appwork.storage.config.ConfigInterface;
import org.appwork.storage.config.JsonConfig;
import org.appwork.utils.Application;
import org.appwork.utils.formatter.SizeFormatter;
import org.appwork.utils.logging.Log;
import org.appwork.utils.logging2.LogSource;
import org.appwork.utils.processes.ProcessBuilderFactory;
import org.appwork.utils.swing.EDTHelper;
import org.appwork.utils.swing.EDTRunner;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.DialogNoAnswerException;
import org.appwork.utils.swing.locator.RememberRelativeLocator;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.logging.LogController;
import org.jdownloader.settings.advanced.AdvancedConfigManager;
public class UpdateController implements UpdateCallbackInterface {
private static final UpdateController INSTANCE = new UpdateController();
/**
* get the only existing instance of UpdateController. This is a singleton
*
* @return
*/
public static UpdateController getInstance() {
return UpdateController.INSTANCE;
}
private UpdateProgress icon;
private LogSource logger;
public LogSource getLogger() {
return logger;
}
private UpdateSettings settings;
/**
* Create a new instance of UpdateController. This is a singleton class. Access the only existing instance by using
* {@link #getInstance()}.
*/
private UpdateController() {
confirmedThreads = new HashSet<Thread>();
logger = LogController.getInstance().getLogger(UpdateController.class.getName());
settings = JsonConfig.create(UpdateSettings.class);
}
private UpdateHandler handler;
private boolean running;
private HashSet<Thread> confirmedThreads;
private String appid;
private String updaterid;
public UpdateHandler getHandler() {
return handler;
}
public void setHandler(UpdateHandler handler, ConfigInterface updaterSetup, String appid, String updaterid) {
this.handler = handler;
if (updaterSetup != null) AdvancedConfigManager.getInstance().register(updaterSetup);
handler.runChecker();
this.appid = appid;
this.updaterid = updaterid;
UpdateAction.getInstance().setEnabled(true);
}
private boolean isThreadConfirmed() {
return confirmedThreads.contains(Thread.currentThread());
}
private void setUpdateConfirmed(boolean b) {
if (b) {
confirmedThreads.add(Thread.currentThread());
} else {
confirmedThreads.remove(Thread.currentThread());
}
// cleanup
for (Iterator<Thread> it = confirmedThreads.iterator(); it.hasNext();) {
Thread th = it.next();
if (!th.isAlive()) it.remove();
}
}
@Override
public void updateGuiIcon(ImageIcon icon) {
}
@Override
public void updateGuiText(String text) {
lazyGetIcon().setTitle(text);
}
@Override
public void updateGuiProgress(double progress) {
lazyGetIcon().setIndeterminate(progress < 0);
lazyGetIcon().setValue((int) progress);
}
public boolean hasWaitingUpdates() {
String[] list = Application.getResource("tmp/update/data").list();
return (list != null && list.length > 0);
}
public String getAppID() {
return handler.getAppID();
}
public void runUpdateChecker(boolean manually) {
handler.runUpdateCheck(manually);
}
@Override
public void setRunning(boolean b) {
this.running = b;
new EDTRunner() {
@Override
protected void runInEDT() {
if (running) {
if (icon != null && lazyGetIcon().getParent() != null) {
//
return;
}
lazyGetIcon().setIndeterminate(true);
lazyGetIcon().setTitle(_GUI._.JDUpdater_JDUpdater_object_icon());
lazyGetIcon().setDescription(null);
JDGui.getInstance().getStatusBar().add(icon);
} else {
lazyGetIcon().setIndeterminate(false);
JDGui.getInstance().getStatusBar().remove(icon);
}
}
};
}
protected IconedProcessIndicator lazyGetIcon() {
if (icon != null) return icon;
icon = new EDTHelper<UpdateProgress>() {
@Override
public UpdateProgress edtRun() {
if (icon != null) return icon;
UpdateProgress icon = new UpdateProgress();
((org.appwork.swing.components.circlebar.ImagePainter) icon.getValueClipPainter()).setBackground(Color.LIGHT_GRAY);
((org.appwork.swing.components.circlebar.ImagePainter) icon.getValueClipPainter()).setForeground(Color.GREEN);
icon.setTitle(_GUI._.JDUpdater_JDUpdater_object_icon());
icon.setEnabled(true);
icon.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseClicked(MouseEvent e) {
// JDUpdater.getInstance().startUpdate(false);
}
});
return icon;
}
}.getReturnValue();
return icon;
}
public boolean isRunning() {
return running;
}
public void setGuiVisible(boolean b) {
handler.setGuiVisible(b, true);
}
@Override
public boolean handleException(Exception e) {
return false;
}
public void setGuiToFront(JFrame mainFrame) {
new EDTRunner() {
@Override
protected void runInEDT() {
if (handler != null && handler.isGuiVisible()) {
handler.setGuiVisible(true, true);
}
}
};
}
@Override
public void onGuiVisibilityChanged(final Window window, boolean oldValue, boolean newValue) {
// if (!oldValue && newValue && window != null) {
// new EDTRunner() {
//
// @Override
// protected void runInEDT() {
// if (JDGui.getInstance().getMainFrame().isVisible()) {
// Point ret = SwingUtils.getCenter(JDGui.getInstance().getMainFrame(), window);
// window.setLocation(ret);
// }
// }
// };
// }
}
@Override
public org.appwork.utils.swing.locator.Locator getGuiLocator() {
if (JDGui.getInstance().getMainFrame() != null) {
//
return new RememberRelativeLocator("Updater", JDGui.getInstance().getMainFrame());
}
return null;
}
@Override
public boolean doContinueLoopStarted() {
return true;
}
@Override
public boolean doContinueUpdateAvailable(boolean app, boolean updater, long appDownloadSize, long updaterDownloadSize, int appRevision, int updaterRevision, int appDestRevision, int updaterDestRevision) {
if (!settings.isDoAskBeforeDownloadingAnUpdate()) return true;
if (isThreadConfirmed()) return true;
try {
if (app && appDownloadSize < 0 || updater && updaterDownloadSize < 0) {
Dialog.getInstance().showConfirmDialog(0, _UPDATE._.confirmdialog_new_update_available_frametitle(), _UPDATE._.confirmdialog_new_update_available_message(), null, _UPDATE._.confirmdialog_new_update_available_answer_now(), _UPDATE._.confirmdialog_new_update_available_answer_later());
} else {
long download = 0;
if (app) {
download += appDownloadSize;
}
if (updater) {
download += updaterDownloadSize;
}
Dialog.getInstance().showConfirmDialog(0, _UPDATE._.confirmdialog_new_update_available_frametitle(), _UPDATE._.confirmdialog_new_update_available_message_sized(SizeFormatter.formatBytes(download)), null, _UPDATE._.confirmdialog_new_update_available_answer_now(), _UPDATE._.confirmdialog_new_update_available_answer_later());
}
// setUpdateConfirmed(true);
return true;
} catch (DialogClosedException e) {
Log.exception(Level.WARNING, e);
} catch (DialogCanceledException e) {
Log.exception(Level.WARNING, e);
}
return false;
}
@Override
public boolean doContinuePackageAvailable(boolean app, boolean updater, long appDownloadSize, long updaterDownloadSize, int appRevision, int updaterRevision, int appDestRevision, int updaterDestRevision) {
return true;
}
@Override
public boolean doContinueReadyForExtracting(boolean app, boolean updater, File fileclient, File fileself) {
return true;
}
@Override
public void onResults(boolean app, boolean updater, int clientRevision, int clientDestRevision, int selfRevision, int selfDestRevision, File awfFileclient, File awfFileSelf, File selfWOrkingDir, boolean jdlaunched) throws InterruptedException, IOException {
try {
if (handler.hasPendingSelfupdate()) {
if (!isThreadConfirmed()) {
Dialog.getInstance().showConfirmDialog(Dialog.LOGIC_COUNTDOWN, _UPDATE._.confirmdialog_new_update_available_frametitle(), _UPDATE._.confirmdialog_new_update_available_for_install_message(), null, _UPDATE._.confirmdialog_new_update_available_answer_now_install(), _UPDATE._.confirmdialog_new_update_available_answer_later_install());
setUpdateConfirmed(true);
handler.setGuiVisible(true, true);
}
UpdateController.getInstance().installUpdates(null);
return;
}
// no need to do this if we have a selfupdate pending
InstallLog awfoverview = handler.createAWFInstallLog();
if (awfoverview.getSourcePackages().size() == 0) {
// Thread.sleep(1000);
handler.setGuiFinished(null);
return;
}
if (awfoverview.getModifiedFiles().size() == 0) {
// empty package
UpdateController.getInstance().installUpdates(awfoverview);
handler.setGuiFinished(_UPDATE._.installframe_statusmsg_complete());
return;
}
if (awfoverview.getModifiedRestartRequiredFiles().size() == 0) {
if (settings.isDoNotAskToInstallPlugins()) {
// can install direct
UpdateController.getInstance().installUpdates(awfoverview);
return;
}
}
// we need at least one restart
if (isThreadConfirmed()) {
installUpdates(awfoverview);
} else {
if (!isThreadConfirmed()) {
List<String> rInstalls = handler.getRequestedInstalls();
List<String> ruInstalls = handler.getRequestedUnInstalls();
if (rInstalls.size() > 0 || ruInstalls.size() > 0) {
Dialog.getInstance().showConfirmDialog(Dialog.LOGIC_COUNTDOWN, _UPDATE._.confirmdialog_new_update_available_frametitle_extensions(), _UPDATE._.confirmdialog_new_update_available_for_install_message(rInstalls.size(), ruInstalls.size()), null, _UPDATE._.confirmdialog_new_update_available_answer_now_install(), _UPDATE._.confirmdialog_new_update_available_answer_later_install());
} else {
Dialog.getInstance().showConfirmDialog(Dialog.LOGIC_COUNTDOWN, _UPDATE._.confirmdialog_new_update_available_frametitle(), _UPDATE._.confirmdialog_new_update_available_for_install_message(), null, _UPDATE._.confirmdialog_new_update_available_answer_now_install(), _UPDATE._.confirmdialog_new_update_available_answer_later_install());
}
setUpdateConfirmed(true);
handler.setGuiVisible(true, true);
}
UpdateController.getInstance().installUpdates(awfoverview);
}
} catch (DialogNoAnswerException e) {
logger.log(e);
handler.setGuiVisible(false, false);
}
}
// public static final String UPDATE = "update";
// public static final String SELFTEST = "selftest";
// public static final String SELFUPDATE_ERROR = "selfupdateerror";
// public static final String AFTER_SELF_UPDATE = "afterupdate";
// public static final String OK = "OK";
public boolean hasPendingUpdates() {
return handler.hasPendingUpdates();
}
public void installUpdates(InstallLog log) {
handler.installPendingUpdates(log);
}
@Override
public Process runExeAsynch(List<String> call, File root) throws IOException {
call.addAll(RestartController.getInstance().getFilteredRestartParameters());
final ProcessBuilder pb = ProcessBuilderFactory.create(call);
pb.directory(root);
Process process = pb.start();
logger.logAsynch(process.getErrorStream());
logger.logAsynch(process.getInputStream());
return process;
}
public boolean isExtensionInstalled(String id) {
return handler != null && handler.isExtensionInstalled(id);
}
public boolean isHandlerSet() {
return handler != null;
}
public void runExtensionUnInstallation(String id) throws InterruptedException {
handler.uninstallExtension(id);
}
public void runExtensionInstallation(String id) throws InterruptedException {
handler.installExtension(id);
}
public void waitForUpdate() throws InterruptedException {
handler.waitForUpdate();
}
public String[] listExtensionIds() throws IOException {
return handler.getOptionalsList();
}
}

View File

@ -0,0 +1,106 @@
package org.jdownloader.updatev2;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import org.appwork.resources.AWUTheme;
import org.appwork.utils.StringUtils;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.SwingUtils;
import org.appwork.utils.swing.dialog.ConfirmDialog;
import org.appwork.utils.swing.dialog.Dialog;
public class UpdateFoundDialog extends ConfirmDialog {
private AbstractAction laterAction = null;
private AbstractAction nowAction = null;
public UpdateFoundDialog(final Runnable later, final Runnable now) {
super(Dialog.LOGIC_COUNTDOWN | Dialog.BUTTONS_HIDE_OK, _UPDATE._.update_dialog_title_updates_available(), _UPDATE._.update_dialog_msg_x_updates_available(), AWUTheme.I().getIcon("updatericon", 32), null, _UPDATE._.update_dialog_cancel());
this.setCountdownTime(60);
if (later != null) {
this.laterAction = new AbstractAction(_UPDATE._.update_dialog_later()) {
/**
*
*/
private static final long serialVersionUID = 1L;
public void actionPerformed(final ActionEvent e) {
UpdateFoundDialog.this.setReturnmask(true);
later.run();
UpdateFoundDialog.this.dispose();
}
};
}
if (now != null) {
this.nowAction = new AbstractAction(_UPDATE._.update_dialog_yes()) {
/**
*
*/
private static final long serialVersionUID = 1L;
public void actionPerformed(final ActionEvent e) {
UpdateFoundDialog.this.setReturnmask(true);
now.run();
UpdateFoundDialog.this.dispose();
}
};
}
}
@Override
protected JPanel getDefaultButtonPanel() {
final JPanel ret = new JPanel(new MigLayout("ins 0", "[]", "0[]0"));
if (this.laterAction != null) {
ret.add(new JButton(this.laterAction), "alignx right,tag ok,sizegroup confirms,growx,pushx");
}
if (this.nowAction != null) {
ret.add(new JButton(this.nowAction), "alignx right,tag ok,sizegroup confirms,growx,pushx");
}
return ret;
}
@Override
public JComponent layoutDialogContent() {
final JComponent txt = super.layoutDialogContent();
final JPanel ret = new JPanel(new MigLayout("ins 0, wrap 1", "[grow,fill]", "[grow, fill][]"));
ret.add(txt);
final JButton btn = new JButton(_UPDATE._.update_dialog_news_button());
btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
UpdateFoundDialog.this.cancel();
CrossSystem.openURLOrShowMessage(_UPDATE._.update_dialog_news_button_url());
}
});
btn.setContentAreaFilled(false);
SwingUtils.toBold(btn);
btn.setVisible(!StringUtils.isEmpty(_UPDATE._.update_dialog_news_button_url()));
btn.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, ret.getBackground().darker()));
ret.add(Box.createHorizontalGlue(), "split 2,growx,pushx");
ret.add(btn, "");
btn.setFocusable(false);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
return ret;
}
}

View File

@ -0,0 +1,48 @@
package org.jdownloader.updatev2;
import java.awt.Window;
import java.io.IOException;
import java.util.List;
public interface UpdateHandler {
void runChecker();
void runUpdateCheck(boolean manually);
void setGuiVisible(boolean b, boolean toFront);
boolean isGuiVisible();
String getAppID();
// List<File> getFileList(File awfFile) throws InterruptedException, IOException;
Window getGuiFrame();
public String[] getOptionalsList() throws IOException;
void installPendingUpdates(InstallLog log);
boolean hasPendingUpdates();
boolean hasPendingClientUpdates();
boolean hasPendingSelfupdate();
InstallLog createAWFInstallLog() throws InterruptedException, IOException;
void setGuiFinished(String message);
boolean isExtensionInstalled(String id);
void uninstallExtension(String... ids) throws InterruptedException;
void installExtension(String... ids) throws InterruptedException;
void waitForUpdate() throws InterruptedException;
List<String> getRequestedInstalls();
List<String> getRequestedUnInstalls();
}

View File

@ -0,0 +1,5 @@
package org.jdownloader.updatev2;
public interface UpdateProcessControlInterface {
}

View File

@ -1,4 +1,4 @@
package org.jdownloader.update;
package org.jdownloader.updatev2;
import jd.gui.swing.jdgui.components.IconedProcessIndicator;
@ -6,7 +6,7 @@ import org.jdownloader.images.NewTheme;
public class UpdateProgress extends IconedProcessIndicator {
protected UpdateProgress() {
public UpdateProgress() {
super(NewTheme.I().getIcon("update", 16));
}

View File

@ -0,0 +1,79 @@
package org.jdownloader.updatev2;
import org.appwork.storage.config.ConfigInterface;
import org.appwork.storage.config.annotations.AboutConfig;
import org.appwork.storage.config.annotations.DefaultBooleanValue;
import org.appwork.storage.config.annotations.DefaultLongValue;
import org.appwork.storage.config.annotations.DefaultStringValue;
import org.appwork.storage.config.annotations.DescriptionForConfigEntry;
import org.appwork.storage.config.annotations.RequiresRestart;
public interface UpdateSettings extends ConfigInterface {
@AboutConfig
@DefaultBooleanValue(true)
@DescriptionForConfigEntry("If enabled, JDownloader will update all plugins silently in the background without restarting")
boolean isDoNotAskToInstallPlugins();
void setDoNotAskToInstallPlugins(boolean b);
@AboutConfig
@DefaultBooleanValue(true)
@DescriptionForConfigEntry("Jar diffs speed up the update process because it reduces the update package size a lot. Do NOT disable this without a very good reason")
boolean isJarDiffEnabled();
void setJarDiffEnabled(boolean b);
@DefaultLongValue(10 * 60 * 1000)
@AboutConfig
@DescriptionForConfigEntry("[MS] How often shall JD do a silent Updatecheck.")
long getUpdateInterval();
void setUpdateInterval(long intervalMS);
@AboutConfig
@DefaultBooleanValue(true)
@RequiresRestart
@DescriptionForConfigEntry("If true, JDownloader will check for updates in an interval(see UpdateIntercal)")
boolean isAutoUpdateCheckEnabled();
void setAutoUpdateCheckEnabled(boolean enabled);
@DefaultStringValue("jd.Main")
String getMainClass();
@DefaultBooleanValue(true)
@RequiresRestart
@AboutConfig
@DescriptionForConfigEntry("If enabled, the Updater Gui will always be on top of all other windows")
boolean isUpdateGuiAlwaysOnTop();
void setUpdateGuiAlwaysOnTop(boolean b);
@DefaultBooleanValue(true)
@AboutConfig
@DescriptionForConfigEntry("If enabled, The Updater will install updates without asking if the JDownloader core could not start.")
boolean isDoNotAskToInstallEmergencyUpdates();
void setDoNotAskToInstallEmergencyUpdates(boolean b);
@DefaultBooleanValue(true)
@AboutConfig
@DescriptionForConfigEntry("If enabled, The Updater will download updates without asking if the JDownloader core could not start.")
boolean isDoNotAskToDownloadEmergencyUpdates();
void setDoNotAskToDownloadEmergencyUpdates(boolean b);
@DefaultBooleanValue(true)
@AboutConfig
@DescriptionForConfigEntry("If enabled, Updates will be installed before JDownloader Core starts without asking.")
boolean isDoNotAskToInstallUpdatesOnStartup();
void setDoNotAskToInstallUpdatesOnStartup(boolean b);
@DefaultBooleanValue(false)
@AboutConfig
@DescriptionForConfigEntry("If enabled, JDownloader will ask before starting to download Updates.")
boolean isDoAskBeforeDownloadingAnUpdate();
void setDoAskBeforeDownloadingAnUpdate(boolean b);
}

View File

@ -0,0 +1,614 @@
package org.jdownloader.updatev2;
import org.appwork.txtresource.Default;
import org.appwork.txtresource.Defaults;
import org.appwork.txtresource.TranslateInterface;
@Defaults(lngs = { "en", "de" })
public interface UpdaterTranslation extends TranslateInterface {
;
@Default(lngs = { "en", "de" }, values = { "Service not available. Try again in 60 sec.)", "Service momentan nicht erreichbar. Bitte in einer Minute erneut versuchen." })
String error_service_not_available_right_now();
@Default(lngs = { "en", "de" }, values = { "Close", "Schließen" })
String exit();
@Default(lngs = { "en", "de" }, values = { "Bypass Updates. -noupdates flag is set", "Bypass Updates -noupdates Flag ist gesetzt" })
String guiless_noupdates();
@Default(lngs = { "en", "de" }, values = { "Ask me later!", "Später nachfragen!" })
String install_updates_later();
@Default(lngs = { "en", "de" }, values = { "Install now!", "Jetzt installieren!" })
String install_updates_now();
@Default(lngs = { "en", "de" }, values = { "Started Updater", "Updater gestartet" })
String start();
@Default(lngs = { "en", "de" }, values = { "Update(s) found!", "Update(s) gefunden!" })
String udpates_found();
@Default(lngs = { "en", "de" }, values = { "Cancel", "Abbrechen" })
String update_dialog_cancel();
@Default(lngs = { "en", "de" }, values = { "Ask me later", "Später erneut fragen" })
String update_dialog_later();
@Default(lngs = { "en", "de" }, values = { "Updates are ready for Installation. Do you want to run the update now?", "Updates können jetzt installiert werden. Soll das Update jetzt gestartet werden?" })
String update_dialog_msg_x_updates_available();
@Default(lngs = { "en", "de" }, values = { "Open Changelog", "Änderungen ansehen" })
String update_dialog_news_button();
@Default(lngs = { "en", "de" }, values = { "http://www.jdownloader.org/changelog", "http://www.jdownloader.org/changelog" })
String update_dialog_news_button_url();
@Default(lngs = { "en", "de" }, values = { "Update(s) available", "Update(s) verfügbar" })
String update_dialog_title_updates_available();
@Default(lngs = { "en", "de" }, values = { "Yes(recommended)", "Ja(empfohlen)" })
String update_dialog_yes();
@Default(lngs = { "en", "de" }, values = { "%s1 update(s) are ready for installation.", "%s1 Update(s) können jetzt installiert werden." })
String updates_are_ready_for_install_now(int size);
@Default(lngs = { "en", "de" }, values = { "%s1 update(s) are ready for installation.", "%s1 Update(s) können jetzt installiert werden." })
String updates_ready_for_install(int size);
@Default(lngs = { "en", "de" }, values = { "Finished Updatecheck - Exit", "Updateprüfung abgeschlossen - Exit" })
String literally_exit();
@Default(lngs = { "en", "de" }, values = { "Update already running", "Es läuft bereits eine Updateprüfung" })
String update_already_running();
@Default(lngs = { "en", "de" }, values = { "New Version found!", "Neue Version gefunden!" })
String JDUpdater_start_updater_update_title();
@Default(lngs = { "en", "de" }, values = { "Restart now to perform an update.", "Ein Neustart ist nötig um das Update zu beenden." })
String JDUpdater_start_updater_update_msg();
@Default(lngs = { "en", "de" }, values = { "Update & Restart now!", "Update & Neustart jetzt durchführen!" })
String JDUpdater_start_restart_update_now_();
@Default(lngs = { "en", "de" }, values = { "%s1/%s2", "%s1/%s2" })
String progress(String formatBytes, String formatBytes2);
@Default(lngs = { "en", "de" }, values = { "Updater", "Updater" })
String window_title();
@Default(lngs = { "en", "de" }, values = { "%s2 %s1-Edition does not exist any more.\r\n Reseted to latest stable edition.", "%s2 %s1-Edition existiert nicht mehr.\r\n Zurückgesetzt auf aktuelle Hauptversion." })
String branch_resetted(String string, String string2);
@Default(lngs = { "en", "de" }, values = { "The %s1 Edition does not exist!", "Die %s1 Edition existiert nicht!" })
String branch_resetted2(String parameter);
@Default(lngs = { "en", "de" }, values = { "Using %s1-Edition", "Verwende %s1-Edition" })
String branch_updated(String string);
@Default(lngs = { "en", "de" }, values = { "Updateserver is busy. Please wait 30 Seconds.", "Der Updateserver ist überlastet. Bitte 30 Sekunden warten." })
String call_failed_wait();
@Default(lngs = { "en", "de" }, values = { "Cancel update", "Update abbrechen" })
String cancel_update();
@Default(lngs = { "en", "de" }, values = { "Updater is outdated. Please reinstall the application.", "Das Updateprogramm ist nicht mehr aktuell. Bitte installieren Sie die Anwendung neu." })
String cannot_selfupdate(String app);
@Default(lngs = { "en", "de" }, values = { "Updater will update itself now.", "Updater wird sich nun selbst aktualisieren" })
String clientUpdate();
@Default(lngs = { "en", "de" }, values = { "Updateclient is outdated!", "Updater ist nicht aktuell!" })
String clientupdate_title();
@Default(lngs = { "en", "de" }, values = { "Close", "Schließen" })
String close();
@Default(lngs = { "en", "de" }, values = { "Could not download Update.", "Update konnte nicht heruntergeladen werden." })
String could_not_download_file();
@Default(lngs = { "en", "de" }, values = { "Could not install file: %s1", "Datei konnte nicht installiert werden: %s1" })
String could_not_install_file(String absolutePath);
@Default(lngs = { "en", "de" }, values = { "Could not overwrite file %s1.", "Datei %s1 kann nicht überschrieben werden." })
String could_not_overwrite(String absolutePath);
@Default(lngs = { "en", "de" }, values = { "Updater outdated. Could not update the updater!", "Updater veraltet. Konnte Updater nicht aktualisieren." })
String could_not_update_updater();
@Default(lngs = { "en", "de" }, values = { "Edition oudated", "Version veraltet" })
String dialag_branch_resetted();
@Default(lngs = { "en", "de" }, values = { "%s2 %s1-Edition does not exist any more.\r\nResetted to latest stable edition.", "%s2 %s1-Edition existiert nicht mehr.\r\nZurückgesetzt auf aktuelle Hauptversion." })
String dialog_branch_resetted_msg(String string, String string2);
@Default(lngs = { "en", "de" }, values = { "Really cancel update?", "Update wirklich abbrechen?" })
String dialog_rly_cancel();
@Default(lngs = { "en", "de" }, values = { "Download Failed. Try to resume...", "Download fehlgeschlagen. Versuche Wiederaufnahme..." })
String download_failed_resume();
@Default(lngs = { "en", "de" }, values = { "Download Failed. Retry...", "Download fehlgeschlagen. Neuversuch..." })
String download_failed_retry();
@Default(lngs = { "en", "de" }, values = { "Cannot update %s1 right now. Try again later.", "%s1 kann momentan nicht aktualisiert werden. Bitte später erneut versuchen." })
String error_app_disabled(String appID);
@Default(lngs = { "en", "de" }, values = { "The '%s1'-Edition cannot be updated right now. Please try again later!", "Die '%s1' Edition kann momentan nicht aktualisiert werden. Bitte später versuchen." })
String error_invalid_branch(String name);
@Default(lngs = { "en", "de" }, values = { "The Updateserver is busy right now. Try again later.", "Der Updateserver ist momentan überlastet. Bitte später erneut versuchen." })
String error_locked(String appID);
@Default(lngs = { "en", "de" }, values = { "Error occured", "Ein Fehler ist aufgetreten" })
String error_occured();
@Default(lngs = { "en", "de" }, values = { "Could not finish update.", "Update konnte nicht abgeschlossen werden." })
String error_occured_detailed();
@Default(lngs = { "en", "de" }, values = { "Update has been interrupted. Reverting changes...", "Update wurde unterbrochen. Änderungen werden rückgängig gemacht." })
String error_occured_start_reverting();
@Default(lngs = { "en", "de" }, values = { "%s1", "%s1" })
String error_unknown(String string);
@Default(lngs = { "en", "de" }, values = { "Cannot update %s1. \r\n Try again later!", "Kann %s1 nicht aktualisieren. \r\n Bitte später erneut versuchen." })
String error_unknown_app(String appID);
@Default(lngs = { "en", "de" }, values = { "Unknown Edition: %s1", "Unbekannte Version: %s1" })
String error_unknown_branch(String string);
@Default(lngs = { "en", "de" }, values = { "Unknown Updateserver problems.\r\nPlease try again later", "Unbekannte Updateprobleme.\r\n Bitte versuchen Sie es später erneut." })
String error_unknown_server();
@Default(lngs = { "en", "de" }, values = { "Uninstalled file: %s1", "Datei deinstalliert: %s1" })
String filelog_deletedfile(String string);
@Default(lngs = { "en", "de" }, values = { "Installed file %s1", "Datei installiert: %s1" })
String filelog_installedfile(String absolutePath);
@Default(lngs = { "en", "de" }, values = { "Updating %s1", "%s1 aktualisieren...." })
String getPanelTitle(String app);
@Default(lngs = { "en", "de" }, values = { "Update %s1 - %s2 Edition", "Aktualisiere %s1 - %s2 Edition" })
String guiless_branch_updated(String app, String branch);
@Default(lngs = { "en", "de" }, values = { "Please wait... preparing updatepackage", "Bitte warten... Bereite Updatepaket vor." })
String guiless_create_package();
@Default(lngs = { "en", "de" }, values = { "Update finished.", "Update fertig." })
String guiless_done();
@Default(lngs = { "en", "de" }, values = { "Downloading Updatepackage...", "Updatepaket wird heruntergeladen" })
String guiless_download_data();
@Default(lngs = { "en", "de" }, values = { "Project contains %s1 file(s)", "Projekt besteht aus %s1 Datei(en)" })
String guiless_downloaded_hashlist(int size);
@Default(lngs = { "en", "de" }, values = { "Download finished.", "Download fertiggestellt." })
String guiless_downloadfinished();
@Default(lngs = { "en", "de" }, values = { "Error occured. Reverting changes... ", "Fehler aufgetreten. Setze bisherige Änderungen zurück." })
String guiless_error_occured_start_reverting();
@Default(lngs = { "en", "de" }, values = { "Extract file(s)...", "Entpacke Datei(en)..." })
String guiless_extract();
@Default(lngs = { "en", "de" }, values = { "%s1 file(s) are waiting to get installed!", "%s1 Datei(en) warten auf Installation." })
String guiless_files_ready_for_install(int size);
@Default(lngs = { "en", "de" }, values = { "%s1 file(s) are outdated and will be removed.", "%s1 Datei(en) sind veraltet und werden entfernt." })
String guiless_files_wait_for_removal(int size);
@Default(lngs = { "en", "de" }, values = { "Compare filelist with installed file(s)", "Vergleiche Dateiliste mit installierten Datei(en)" })
String guiless_filtering();
@Default(lngs = { "en", "de" }, values = { "Installation finished", "Installation abgeschlossen" })
String guiless_installFinished();
@Default(lngs = { "en", "de" }, values = { "Cannot access %s2.\r\nPlease close %s1 to continue.", "Kann nicht auf %s2 zugreifen.\r\nBitte beenden Sie %s1 um die Installation zu beenden." })
String guiless_locked_close_app(String appID, String path);
@Default(lngs = { "en", "de" }, values = { "%s1 has been closed. Continue now.", "%s1 wurde beendet. Installation wird fortgesetzt." })
String guiless_locked_closed_app(String appID);
@Default(lngs = { "en", "de" }, values = { "...Progress: %s1%", "...Fortschritt: %s1%" })
String guiless_progress(int percent);
@Default(lngs = { "en", "de" }, values = { "Progress: %s1% | %s2/%s3", "Fortschritt: %s1% | %s2/%s3" })
String guiless_progress2(long l, String loaded, String total);
@Default(lngs = { "en", "de" }, values = { "Updater will update itself... ", "Updater wird sich nun selbst aktualisieren..." })
String guiless_selfupdate();
@Default(lngs = { "en", "de" }, values = { "Start installing %s1 file(s)", "Starte Installation von %s1 Datei(en)" })
String guiless_start_install(int size);
@Default(lngs = { "en", "de" }, values = { "Start Download of %s1", "Beginne Download von %s1" })
String guiless_started_download(String formatBytes);
@Default(lngs = { "en", "de" }, values = { "Resume Download of %s1", "Nehme Download von %s1 wieder auf" })
String guiless_started_download_resume(String formatBytes);
@Default(lngs = { "en", "de" }, values = { "Update failed. Cause: \r\n%s1", "Update fehlgeschlagen: Grund: \r\n%s1" })
String guiless_update_failed(String message);
@Default(lngs = { "en", "de" }, values = { "Update failed. Unknown Reason.", "Update fehlgeschlagen: Unbekannter Grund" })
String guiless_update_failed_unknown();
@Default(lngs = { "en", "de" }, values = { "%s1 file(s) must be downloaded", "%s1 Datei(en) müssen heruntergeladen werden." })
String guiless_updates_waiting_for_download(int size);
@Default(lngs = { "en", "de" }, values = { "User interrupted updated", "Benutzer hat Update unterbrochen." })
String guiless_userinterrupted();
@Default(lngs = { "en", "de" }, values = { "You already have the latest version", "Sie nutzen bereits die aktuelle Version." })
String guiless_you_are_up2date();
@Default(lngs = { "en", "de" }, values = { "Canceled", "Abgebrochen" })
String interrupted_title();
@Default(lngs = { "en", "de" }, values = { "Updating Signature Key", "Digitale Unterschrift wird erneuert" })
String keychange();
@Default(lngs = { "en", "de" }, values = { "- %s1", "- %s1" })
String list_optionals(String id);
@Default(lngs = { "en", "de" }, values = { "Optional Packages", "Zusatzpakete" })
String list_optionals_header();
@Default(lngs = { "en", "de" }, values = { "Cannot Update. %s1 is still running.", "Kann nicht aktualisieren. %s1 läuft noch." })
String locked(String appID);
@Default(lngs = { "en", "de" }, values = { "Could not install update.\r\nIt seems like %s1 is still running.\r\nPlease close %s1 main application.", "Konnte Update nicht installieren. Es scheint als würde %s1 noch laufen.\r\nBitte beenden Sie die %s1 Hauptanwendung" })
String locked_dialog_msg(String appID);
@Default(lngs = { "en", "de" }, values = { "Close Main Application", "Hauptanwendung beenden" })
String locked_dialog_title();
@Default(lngs = { "en", "de" }, values = { "Found: %s2 file(s) to download, %s1 file(s) to install & %s3 oudated file(s)", "Gefunden: %s2 Datei(en) herunterladen, %s1 Datei(en) installieren & %s3 alte Datei(en) entfernen." })
String log_x_files_to_update_found(int uninstalled, int updates, int remove);
@Default(lngs = { "en", "de" }, values = { "You already run the latest Version", "Sie haben bereits die neuste Version" })
String log_you_are_up2date();
@Default(lngs = { "en", "de" }, values = { "Please wait!", "Bitte warten!" })
String please_wait();
@Default(lngs = { "en", "de" }, values = { "Please wait until updater finished his job!", "Bitte warten bis der Updater fertig ist." })
String please_wait_until_update_finished();
@Default(lngs = { "en", "de" }, values = { "Unexpected redirection to %s1!", "Unerwartete Weiterleitung auf %s1!" })
String redirect_error(String responseHeader);
@Default(lngs = { "en", "de" }, values = { "Updater will restart itself now", "Updater wird sich nun selbst neu starten" })
String restart_required_msg();
@Default(lngs = { "en", "de" }, values = { "Resume Download Failed. Retry...", "Wiederaufnahme des Downloads fehlgeschlagen. Neuversuch..." })
String resume_failed();
@Default(lngs = { "en", "de" }, values = { "Update has been interrupted.", "Update wurde unterbrochen." })
String reverting_msg();
@Default(lngs = { "en", "de" }, values = { "Reverting...", "Zurücksetzen..." })
String reverting_title();
@Default(lngs = { "en", "de" }, values = { "Are you sure that you want to exit?", "Soll die Anwendung wirklich beendet werden?" })
String rlyexit();
@Default(lngs = { "en", "de" }, values = { "Really exit?", "Wirklich beenden?" })
String rlyexit_title();
@Default(lngs = { "en", "de" }, values = { "Start %s1", "%s1 starten" })
String start_jd(String app);
@Default(lngs = { "en", "de" }, values = { "Stop Countdown", "Countdown anhalten" })
String stop_countdown();
@Default(lngs = { "en", "de" }, values = { "%s1 s", "%s1 s" })
String timer(int i);
@Default(lngs = { "en", "de" }, values = { "%s1 Updater", "%s1 Updater" })
String title(String appID);
@Default(lngs = { "en", "de" }, values = { "%s1 Updater (Closes in %s2 seconds)", "%s1 Updater (Wird in %s2 s beendet)" })
String title_timeout(String appID, int i);
@Default(lngs = { "en", "de" }, values = { "%s1 Updater (%s1 starts in %s2 seconds)", "%s1 Updater (%s1 wird in %s2 Sekunden gestartet)" })
String title_timeout_restart(String appID, int i);
@Default(lngs = { "en", "de" }, values = { "Unexpected HTTP Error (%s1) - Please try again later", "Unerwarteter HTTP Fehler (%s1) - Bitte später erneut versuchen." })
String unexpected_http_error(int code);
@Default(lngs = { "en", "de" }, values = { "Not installed file(s): %s1", "Nicht installierte Datei(en): %s1" })
String uninstalledfiles(int size);
@Default(lngs = { "en", "de" }, values = { "Our Updateservers are busy right now. Please try again later.", "Unsere Updateserver sind gerade überlastet. Bitte später erneut versuchen." })
String UpdateException_notavailable();
@Default(lngs = { "en", "de" }, values = { "Problem Description: \r\n -> \"%s1\"", "Problem Beschreibung: \r\n -> \"%s1\"" })
String UpdateException_notavailable2(String reason);
@Default(lngs = { "en", "de" }, values = { "Proxy Authentication invalid: %s1", "Proxy Zugangsdaten ungültig: %s1" })
String UpdateException_proxyauth(String message);
@Default(lngs = { "en", "de" }, values = { "Proxy connection failed: %s1", "Proxy Verbindung fehlgeschlagen: %s1" })
String UpdateException_proxyconnect(String message);
@Default(lngs = { "en", "de" }, values = { "The origin of this update could not be verified!", "Die Herkunft dieses Updates konnte nicht verifiziert werden." })
String UpdateException_SignatureViolation();
@Default(lngs = { "en", "de" }, values = { "No Internet connection to updateserver: %s1", "Keine Internetverbindung zum Updateserver: %s1" })
String UpdateException_socket(String message);
@Default(lngs = { "en", "de" }, values = { "Failed updating %s1 Edition", "Aktualisieren der %s1 Edition ist fehlgeschlagen." })
String UpdateException_unknownbranch(String branch);
;
@Default(lngs = { "en", "de" }, values = { "The %s1 Edition does not exist!", "Die %s1 Edition existiert nicht!" })
String UpdateException_unknownbranch_gui(String message);
@Default(lngs = { "en", "de" }, values = { "Updater failed to update himself. Please try again in a few minutes.", "Updater konnte sich nicht selbst aktualisieren. Bitte versuch es in einigen Minuten nochmal." })
String updateloop();
@Default(lngs = { "en", "de" }, values = { "Updateloop detected!", "Updateschleife endeckt!" })
String updateloop_title();
@Default(lngs = { "en", "de" }, values = { "The tool to perform an update is missing.\r\nPlease download and install the latest version of %s1 from the Homepage.", "Das Programm zum aktualisieren von %s1 wurde nicht gefunden. \r\nBitte laden Sie die neuste Version von der Homepage und installieren Sie diese." })
String Updater_missing_msg(String app);
@Default(lngs = { "en", "de" }, values = { "Updater is missing", "Update Programm fehlt" })
String Updater_missing_title();
@Default(lngs = { "en", "de" }, values = { "The origin of this update could not be verified!", "Die Herkunft dieses Updates konnte nicht verifiziert werden." })
String Updater_sign_key_mismatch();
@Default(lngs = { "en", "de" }, values = { "Updatelog", "Update Log:" })
String UpdateServer_UpdaterGui_layoutGUI_details();
@Default(lngs = { "en", "de" }, values = { "An error occured: %s1", "Fehler aufgetreten: %s1" })
String UpdateServer_UpdaterGui_onException_error_occured(String errormessage);
@Default(lngs = { "en", "de" }, values = { "Please try again later.", "Bitte warten." })
String UpdateServer_UpdaterGui_onServiceNotAvailable_bar();
@Default(lngs = { "en", "de" }, values = { "Updateserver busy. Please wait or try later.", "Updateserver sind überlastet. Bitte warten." })
String UpdateServer_UpdaterGui_onServiceNotAvailable_wait();
@Default(lngs = { "en", "de" }, values = { "Find latest version", "Suche neuste Version" })
String UpdateServer_UpdaterGui_onStateChange_branchlist();
@Default(lngs = { "en", "de" }, values = { "Installing Resources", "Installiere Resourcen" })
String UpdateServer_UpdaterGui_onStateChange_directinstall();
@Default(lngs = { "en", "de" }, values = { "Download", "Download" })
String UpdateServer_UpdaterGui_onStateChange_download();
@Default(lngs = { "en", "de" }, values = { "Extract Updatepackage", "Entpacke Updatepaket" })
String UpdateServer_UpdaterGui_onStateChange_extract();
@Default(lngs = { "en", "de" }, values = { "Update failed", "Update fehlgeschlagen" })
String UpdateServer_UpdaterGui_onStateChange_failed();
@Default(lngs = { "en", "de" }, values = { "%s1", "%s1" })
String UpdateServer_UpdaterGui_onStateChange_failed2(String message);
@Default(lngs = { "en", "de" }, values = { "Find updates", "Suche nach Updates" })
String UpdateServer_UpdaterGui_onStateChange_filter();
@Default(lngs = { "en", "de" }, values = { "Contact Updateserver", "Kontaktiere Updateserver" })
String UpdateServer_UpdaterGui_onStateChange_hashlist();
@Default(lngs = { "en", "de" }, values = { "Installing", "Installiere Updates" })
String UpdateServer_UpdaterGui_onStateChange_install();
@Default(lngs = { "en", "de" }, values = { "Create Updatepackage", "Erstelle Updatepaket" })
String UpdateServer_UpdaterGui_onStateChange_package();
@Default(lngs = { "en", "de" }, values = { "Updater Routine will update itself now.", "Der Updateprozess wird sich nun selbst aktualisieren." })
String UpdateServer_UpdaterGui_onStateChange_selfupdate();
@Default(lngs = { "en", "de" }, values = { "Successful", "Erfolgreich" })
String UpdateServer_UpdaterGui_onStateChange_successful();
@Default(lngs = { "en", "de" }, values = { "Update %s1 | %s2-Edition", "Aktualisiere %s1 | %s2-Edition" })
String UpdateServer_UpdaterGui_onUpdaterEvent_branch(String app, String branch);
@Default(lngs = { "en", "de" }, values = { "Removed %s1", "Entfernt: %s1" })
String UpdateServer_UpdaterGui_onUpdaterEvent_remove(String path);
@Default(lngs = { "en", "de" }, values = { "%s1 update(s) found!", "%s1 Update(s) gefunden" })
String UpdateServer_UpdaterGui_onUpdaterModuleEnd_end_filtering(int num);
@Default(lngs = { "en", "de" }, values = { "Download %s1", "Lade %s1 herunter" })
String UpdateServer_UpdaterGui_onUpdaterModuleStart_download(String filesize);
@Default(lngs = { "en", "de" }, values = { "Resume Download of %s1", "Nehme Download von %s1 wieder auf" })
String UpdateServer_UpdaterGui_onUpdaterModuleStart_download_resume(String filesize);
@Default(lngs = { "en", "de" }, values = { "Updateserver busy.", "Updateserver überlastet." })
String UpdateServer_UpdaterGui_runInEDT_mainbar();
@Default(lngs = { "en", "de" }, values = { "Install path: %s1", "Installationsordner: %s1" })
String UpdateServer_UpdaterGui_UpdaterGui_path(String path);
@Default(lngs = { "en", "de" }, values = { "Started Update: %s1", "Updater gestarted: %s1" })
String UpdateServer_UpdaterGui_UpdaterGui_started(String appid);
@Default(lngs = { "en", "de" }, values = { "User interrupted Update!", "Benutzer hat Update unterbrochen!" })
String userinterrupted();
@Default(lngs = { "en", "de" }, values = { "No rights to write to %s1. ", "Nicht genug Rechte um nach %s1 zu schreiben." })
String virtual_file_system_detected(String installDirFile);
@Default(lngs = { "en", "de" }, values = { "More...", "Mehr..." })
String details();
@Default(lngs = { "en", "de" }, values = { "Stop Updater now. Use \r\n-install id1,id2,.. to install Packages", "Updater wurde beendet. \r\n-install id1,id2,... zum installieren von Paketen verwenden" })
String end_list();
@Default(lngs = { "en", "de" }, values = { "Package Failed Error. Please try again later.", "Paketfehler. Bitte später erneut versuchen." })
String error_package_creation_failed();
@Default(lngs = { "en", "de" }, values = { "Later", "Später" })
String confirmdialog_new_update_available_answer_later();
@Default(lngs = { "en", "de" }, values = { "Later", "Später" })
String confirmdialog_new_update_available_answer_later_install();
@Default(lngs = { "en", "de" }, values = { "Download now", "Jetzt herunterladen" })
String confirmdialog_new_update_available_answer_now();
@Default(lngs = { "en", "de" }, values = { "Install now", "Jetzt installieren" })
String confirmdialog_new_update_available_answer_now_install();
@Default(lngs = { "en", "de" }, values = { "New Update available", "Ein neues Update ist verfügbar" })
String confirmdialog_new_update_available_frametitle();
@Default(lngs = { "en", "de" }, values = { "A new Update is available. Do you want to download it now?", "Ein neues Update steht zum Download bereit. Soll es jetzt geladen werden?" })
String confirmdialog_new_update_available_message();
@Default(lngs = { "en", "de" }, values = { "A new Update is available. To install, a restart is required.\r\nDo you want to restart & install the update now?", "Ein neues Update steht zur Installation bereit. Zur Installation muss ein Neustart durchgeführt werden.\r\nSoll jetzt neu gestartet und installiert werden?\r\n" })
String confirmdialog_new_update_available_for_install_message();
@Default(lngs = { "en", "de" }, values = { "Finalizing Installation...", "Installation wird abgeschlossen..." })
String dialog_update_finalizing();
@Default(lngs = { "en", "de" }, values = { "An Error occured", "Ein Fehler ist aufgetreten" })
String errordialog_frametitle();
@Default(lngs = { "en", "de" }, values = { "An unexpected error occured during the update.\r\nPlease try again or contact our support.", "Während dem Update ist ein Fehler aufgetreten.\r\nVersuchen Sie es erneut, oder kontaktieren Sie unseren Support." })
String errordialog_message();
@Default(lngs = { "en", "de" }, values = { "JDownloader could not connect to the Updateserver.\r\nPlease make sure that you are connected to the Internet.", "JDownloader konnte keine Verbindung zum Updateserver herstellen.\r\nBitte stellen Sie sicher, dass Sie mit dem Internet verbunden sind." })
String errordialog_noconnection();
@Default(lngs = { "en", "de" }, values = { "The Update Server is not available right now. Please try again later or contact our support", "Der Updateserver ist momentan nicht erreichbar. Bitte versuchen Sie es später erneut oder kontaktieren Sie unseren Support." })
String errordialog_server_error();
@Default(lngs = { "en", "de" }, values = { "The Update Server is busy right now. Please try again in a few minutes.", "Der Updateserver ist ausgelastet. Bitte versuchen Sie es in einigen Minuten erneut." })
String errordialog_server_locked();
@Default(lngs = { "en", "de" }, values = { "The Update Server is not available right now. Please try again later.", "Der Updateserver ist momentan nicht erreichbar. Bitte versuchen Sie es später erneut." })
String errordialog_server_offline();
@Default(lngs = { "en", "de" }, values = { "Cancel", "Abbrechen" })
String installframe_button_cancel();
@Default(lngs = { "en", "de" }, values = { "JDownloader Updater", "JDownloader Updater" })
String installframe_frametitle();
@Default(lngs = { "en", "de" }, values = { "Are you sure?", "Sind Sie sicher?" })
String installframe_rlyclosedialog_frametitle();
@Default(lngs = { "en", "de" }, values = { "Do you really want to interrupt the Update?", "Wollen Sie das Update wirklich unterbrechen?" })
String installframe_rlyclosedialog_message();
@Default(lngs = { "en", "de" }, values = { "Installation complete...", "Installation abgeschlossen..." })
String installframe_statusmsg_complete();
@Default(lngs = { "en", "de" }, values = { "Download Updates...", "Lade Updates herunter..." })
String installframe_statusmsg_download();
@Default(lngs = { "en", "de" }, values = { "Download Updates...\r\nDownloadspeed: %s1/s, Time left: %s2", "Lade Updates herunter...\r\nDownload Geschwindigkeit: %s1/s, Verbleibende Zeit: %s2" })
String installframe_statusmsg_downloadspeed(String formatBytes, String eta);
@Default(lngs = { "en", "de" }, values = { "Finalizing installation...", "Die Installation wird fertig gestellt..." })
String installframe_statusmsg_finalizing();
@Default(lngs = { "en", "de" }, values = { "Check for updates", "Nach Updates suchen" })
String installframe_statusmsg_findupdates();
@Default(lngs = { "en", "de" }, values = { "Installation in progress - please wait...", "Die Installation läuft. Bitte warten Sie..." })
String installframe_statusmsg_installing();
@Default(lngs = { "en", "de" }, values = { "Update has been interrupted", "Das Update wurde unterbrochen" })
String installframe_statusmsg_interrupted();
@Default(lngs = { "en", "de" }, values = { "No Updates available!", "Keine neuere Version gefunden!" })
String installframe_statusmsg_noupdatesavailable();
@Default(lngs = { "en", "de" }, values = { "Waiting for Application...", "Warte auf Anwendung..." })
String installframe_statusmsg_portcheck();
@Default(lngs = { "en", "de" }, values = { "Preparing for installation...", "Die Installation wird vorbereitet..." })
String installframe_statusmsg_prepare();
@Default(lngs = { "en", "de" }, values = { "Prepare Update package...", "Update Paket vorbereiten..." })
String installframe_statusmsg_preparing();
@Default(lngs = { "en", "de" }, values = { "Reverting all Changes...\r\nPlease wait until all changes have been reverted.", "Änderungen zurücksetzen...\r\nBitte warten Sie bis alle Änderungen rückgängig gemacht wurden." })
String installframe_statusmsg_reverting();
@Default(lngs = { "en", "de" }, values = { "New JDownloader Version found...", "Neue JDownloader Version gefunden..." })
String installframe_statusmsg_selfupdate();
@Default(lngs = { "en", "de" }, values = { "Validing Installation.\r\nThis can take up to 5 minutes...", "Installation wird validiert.\r\nDies kann bis zu 5 Minuten dauern." })
String installframe_statusmsg_selfupdate_validating();
@Default(lngs = { "en", "de" }, values = { "The Update has been installed successfully.", "Das Update wurde erfolgreich installiert." })
String installframe_statusmsg_successful();
@Default(lngs = { "en", "de" }, values = { "Close", "Schließen" })
String literally_close();
@Default(lngs = { "en", "de" }, values = { "No", "Nein" })
String literally_no();
@Default(lngs = { "en", "de" }, values = { "unknown", "unbekannt" })
String literally_unknown();
@Default(lngs = { "en", "de" }, values = { "Yes", "Ja" })
String literally_yes();
@Default(lngs = { "en", "de" }, values = { "JDownloader", "JDownloader" })
String tray_rightclickmenu_header();
@Default(lngs = { "en", "de" }, values = { "Estimated remaining wait time: %s1", "Erwartete Wartezeit: %s1" })
String installframe_statusmsg_preparing_eta(String formatSeconds);
@Default(lngs = { "en", "de" }, values = { "There is not enough free space on your harddisk C:.\r\nMake sure that there are at least %s1 of free space (%s2 more needed) and restart the update.", "Es ist nicht genügend Speicherplatz auf C:\\ verfügbar. \r\nBitte stellen Sie sicher dass %s1 frei sind (%s2 müssen gelöscht werden) und starten Sie das Update erneut." })
String errordialog_not_enough_space(String formatBytes, String string);
@Default(lngs = { "en", "de" }, values = { "Insufficient permissions to install %s1.\r\nPlease contact your support!", "Fehlende Schreibrechte zur Installation von %s1.\r\nBitte kontaktieren Sie unseren Support." })
String errordialog_cannot_write(String localizedMessage);
@Default(lngs = { "en", "de" }, values = { "Missing write permission to install the update.\r\nPlease contact your support!", "Fehlende Schreibrechte zur Installation des Updates.\r\nBitte kontaktieren Sie unseren Support." })
String errordialog_cannot_write2();
@Default(lngs = { "en", "de" }, values = { "Cancel", "Abbrechen" })
String literally_cancel();
@Default(lngs = { "en", "de" }, values = { "Are you sure that you want to restart the Application?", "Soll die Anwendung wirklich neu gestartet werden?" })
String rlyrestart();
@Default(lngs = { "en", "de" }, values = { "Really restart?", "Wirklich neu starten?" })
String rlyrestart_restart();
@Default(lngs = { "en", "de" }, values = { "Please download the latest version from our Homepage and install it!", "Bitte laden Sie die neuste Version von unserer Homepage und installieren Sie diese." })
String ensureThatUpdaterExists_msg();
@Default(lngs = { "en", "de" }, values = { "Corrupt Installation!", "Fehlerhafte Installation!" })
String ensureThatUpdaterExists_title();
@Default(lngs = { "en", "de" }, values = { "Extracting Updatepackage - please wait...", "Das Updatepaket wird entpackt. Bitte warten Sie..." })
String installframe_statusmsg_extracting();
@Default(lngs = { "en", "de" }, values = { "A new Update is available. Do you want to download it now?\r\nUpdate size: %s1", "Ein neues Update steht zum Download bereit. Soll es jetzt geladen werden?\r\nGröße des Updates: %s1\r\n" })
String confirmdialog_new_update_available_message_sized(String formatBytes);
@Default(lngs = { "en", "de" }, values = { "An Update is ready for installation. We recommend to install it now!\r\nDo you want to install it now?", "Ein Update wartet darauf installiert zu werden. Wir empfehlen das jetzt zu tun!\r\nSoll das Update jetzt installiert werden?" })
String confirmdialog_new_update_available_for_install_message_launcher();
@Default(lngs = { "en", "de" }, values = { "Manage Extensions", "Erweiterungen verwalten" })
String confirmdialog_new_update_available_frametitle_extensions();
@Default(lngs = { "en", "de" }, values = { "Add %s1 and remove %s2 extension(s)?. We recommend to do this now!\r\nDo you want to continue now?", "%s1 Erweiterungen hinzufügen und %s2 entfernen?. Wir empfehlen das jetzt zu tun!\r\nJetzt fortfahren?" })
String confirmdialog_new_update_available_for_install_message(int install, int uninstall);
@Default(lngs = { "en", "de" }, values = { "An unexpected IO error occured during the update.\r\nPlease try again or contact our support.", "Während dem Update ist ein IO Fehler aufgetreten.\r\nVersuchen Sie es erneut, oder kontaktieren Sie unseren Support." })
String errordialog_defaultio();
}

View File

@ -0,0 +1,16 @@
package org.jdownloader.updatev2;
import java.io.IOException;
import java.net.URISyntaxException;
import org.appwork.txtresource.TranslationFactory;
import org.appwork.txtresource.TranslationUtils;
import org.appwork.utils.locale.AWUTranslation;
public class _UPDATE {
public static final UpdaterTranslation _ = TranslationFactory.create(UpdaterTranslation.class);
public static void main(final String[] args) throws URISyntaxException, IOException {
TranslationUtils.createFiles(false, UpdaterTranslation.class, AWUTranslation.class);
}
}

View File

@ -0,0 +1,79 @@
package org.jdownloader.updatev2.restart;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.List;
import org.appwork.utils.Application;
import org.appwork.utils.os.CrossSystem;
import org.jdownloader.updatev2.RestartController;
public class LinuxRestarter extends Restarter {
@Override
protected List<String> getApplicationStartCommands() {
ArrayList<String> lst = new ArrayList<String>();
// TODO: user start of install4j
lst.addAll(getJVMApplicationStartCommands());
return lst;
}
@Override
protected List<String> getJVMApplicationStartCommands() {
final java.util.List<String> jvmParameter = new ArrayList<String>();
jvmParameter.add(CrossSystem.getJavaBinary());
final List<String> lst = ManagementFactory.getRuntimeMXBean().getInputArguments();
boolean xmsset = false;
boolean useconc = false;
boolean minheap = false;
boolean maxheap = false;
for (final String h : lst) {
if (h.contains("Xmx")) {
if (Runtime.getRuntime().maxMemory() < 533000000) {
jvmParameter.add("-Xmx512m");
continue;
}
} else if (h.contains("xms")) {
xmsset = true;
jvmParameter.add(h);
} else if (h.contains("XX:+useconc")) {
useconc = true;
jvmParameter.add(h);
} else if (h.contains("minheapfree")) {
minheap = true;
jvmParameter.add(h);
} else if (h.contains("maxheapfree")) {
maxheap = true;
jvmParameter.add(h);
} else if (h.startsWith("-agentlib:")) {
continue;
}
}
if (!xmsset) {
jvmParameter.add("-Xms64m");
}
if (CrossSystem.isLinux()) {
if (!useconc) {
jvmParameter.add("-XX:+UseConcMarkSweepGC");
}
if (!minheap) {
jvmParameter.add("-XX:MinHeapFreeRatio=0");
}
if (!maxheap) {
jvmParameter.add("-XX:MaxHeapFreeRatio=0");
}
}
jvmParameter.add("-jar");
jvmParameter.add(Application.getJarName(RestartController.class));
return jvmParameter;
}
}

View File

@ -0,0 +1,70 @@
package org.jdownloader.updatev2.restart;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.appwork.utils.Application;
public class MacRestarter extends LinuxRestarter {
protected File getRunInDirectory() {
File app = getApp();
if (app.exists()) {
return app.getParentFile();
} else {
return super.getRunInDirectory();
}
}
@Override
protected List<String> getApplicationStartCommands() {
ArrayList<String> lst = new ArrayList<String>();
File app = getApp();
if (app.exists()) {
lst.add("open");
lst.add("-n");
lst.add(app.getAbsolutePath());
return lst;
} else {
getLogger().warning("MAX " + app + " is missing");
}
// user Fallback
return super.getApplicationStartCommands();
}
private File getApp() {
String appname = "JDownloader.app";
File apppath = Application.getResource("../../../../");
try {
File root = Application.getApplicationRoot();
final HashSet<File> loopMap = new HashSet<File>();
while (root != null && loopMap.add(root)) {
if (root.getName().endsWith(".app")) {
apppath = root.getParentFile();
appname = root.getName();
getLogger().finer("Found App: " + apppath);
break;
}
root = root.getParentFile();
}
if (root != null) {
System.out.println("APPNAME " + appname + " - " + root.getCanonicalPath());
}
} catch (final IOException e) {
getLogger().log(e);
}
return new File(apppath, appname);
}
}

View File

@ -0,0 +1,83 @@
package org.jdownloader.updatev2.restart;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.appwork.utils.Application;
import org.appwork.utils.logging2.LogSource;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.processes.ProcessBuilderFactory;
import org.jdownloader.logging.LogController;
import org.jdownloader.updatev2.RestartController;
public abstract class Restarter {
private LogSource logger;
private RestartController controller;
protected Restarter() {
System.out.println("Create Restarter");
logger = LogController.getInstance().getLogger(getClass().getName());
}
public LogSource getLogger() {
return logger;
}
public void restart(List<String> parameters) {
try {
System.out.println("RestartIt");
List<String> lst = getApplicationStartCommands();
System.out.println("appcommands");
lst.addAll(parameters);
System.out.println("cmd " + lst);
ProcessBuilder p = ProcessBuilderFactory.create(lst);
p.directory(getRunInDirectory());
System.out.println("Start process");
Process process = p.start();
System.out.println("Read errorstream");
logger.logAsynch(process.getErrorStream());
System.out.println("Read inputstream");
logger.logAsynch(process.getInputStream());
} catch (IOException e) {
e.printStackTrace();
getLogger().log(e);
}
}
protected File getRunInDirectory() {
return Application.getResource("tmp").getParentFile();
}
protected abstract List<String> getApplicationStartCommands();
protected abstract List<String> getJVMApplicationStartCommands();
public static Restarter getInstance(RestartController restartController) {
Restarter restarter;
if (CrossSystem.isWindows()) {
restarter = new WindowsRestarter();
} else if (CrossSystem.isMac()) {
restarter = new MacRestarter();
} else {
restarter = new LinuxRestarter();
}
restarter.setController(restartController);
return restarter;
}
private void setController(RestartController restartController) {
controller = restartController;
}
public RestartController getController() {
return controller;
}
}

View File

@ -0,0 +1,73 @@
package org.jdownloader.updatev2.restart;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.List;
import org.appwork.utils.Application;
import org.appwork.utils.os.CrossSystem;
import org.jdownloader.updatev2.RestartController;
public class WindowsRestarter extends Restarter {
@Override
protected List<String> getApplicationStartCommands() {
ArrayList<String> lst = new ArrayList<String>();
if (Application.getResource("JDownloader.exe").exists()) {
lst.add(Application.getResource("JDownloader.exe").getAbsolutePath());
return lst;
} else {
lst.addAll(getJVMApplicationStartCommands());
return lst;
}
}
@Override
protected List<String> getJVMApplicationStartCommands() {
final java.util.List<String> jvmParameter = new ArrayList<String>();
jvmParameter.add(CrossSystem.getJavaBinary());
final List<String> lst = ManagementFactory.getRuntimeMXBean().getInputArguments();
boolean xmsset = false;
boolean useconc = false;
boolean minheap = false;
boolean maxheap = false;
for (final String h : lst) {
if (h.contains("Xmx")) {
if (Runtime.getRuntime().maxMemory() < 533000000) {
jvmParameter.add("-Xmx512m");
continue;
}
} else if (h.contains("xms")) {
xmsset = true;
jvmParameter.add(h);
} else if (h.contains("XX:+useconc")) {
useconc = true;
jvmParameter.add(h);
} else if (h.contains("minheapfree")) {
minheap = true;
jvmParameter.add(h);
} else if (h.contains("maxheapfree")) {
maxheap = true;
jvmParameter.add(h);
} else if (h.startsWith("-agentlib:")) {
continue;
}
}
if (!xmsset) {
jvmParameter.add("-Xms64m");
}
jvmParameter.add("-jar");
jvmParameter.add(Application.getJarName(RestartController.class));
return jvmParameter;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -1,10 +0,0 @@
{
"app":"JDownloader",
"icontheme":"jdownloader",
"mainmacapp":"JDownloader.app",
"mainexe":"JDownloader.exe",
"mainjar":"JDownloader.jar",
"packagepollinterval":10000,
"publicsignaturekey":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkJAGQc6Rw29qduwjemCzoMZqlnM7ZnQ6QBtQKS1aBJUYg+CiHjWI1dP340HYibNsSpj10sHFPJ1HbqAvOHrUeJaccUX807JLtRqB9nmT9wNJBgV1iItVDnSjQHR8woU27Us9PxV2TJn8qF+KLp5kn8VTrNPd7QRb++A3Q19U23ZyCVAxcCBfSQhrc4mR2M5N77tjpg3kiRu5J2brif1DqzHvNjyoZHsgcjvmHVUyi2LWLHHYnAnXyjhOlDKFQ4ZG9PS5QAlflzKu04nsQEKZoq8us7o5uFrMLhQiIwDx9jjwLYAI9/e6K8OCJ+PBIvz5Upb1FbGbf/g3JfMtzjDj+QIDAQAB"
}

View File

@ -1 +0,0 @@
["http://upd0.appwork.org/jcgi/"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB