Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application manager #296

Merged
merged 1 commit into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
package com.openwebstart.app.ui;

import net.adoptopenjdk.icedteaweb.client.controlpanel.panels.provider.ControlPanelProvider;
import net.adoptopenjdk.icedteaweb.i18n.Translator;
import net.sourceforge.jnlp.config.DeploymentConfiguration;

import javax.swing.JComponent;

public class ApplicationManagerPanelProvider implements ControlPanelProvider {

@Override
public String getTitle() {
return Translator.getInstance().translate("appManager.name");
}

@Override
public String getName() {
return "ApplicationManagerPanel";
}

@Override
public int getOrder() {
return 1;
}

@Override
public boolean isActive(final DeploymentConfiguration config) {
return false;
}

@Override
public JComponent createPanel(final DeploymentConfiguration config) {
return new ApplicationManagerPanel(config);
}
}
package com.openwebstart.app.ui;

import net.adoptopenjdk.icedteaweb.client.controlpanel.panels.provider.ControlPanelProvider;
import net.adoptopenjdk.icedteaweb.i18n.Translator;
import net.sourceforge.jnlp.config.DeploymentConfiguration;

import javax.swing.JComponent;

import static com.openwebstart.config.OwsDefaultsProvider.APPLICATION_MANAGER_ACTIVE;

public class ApplicationManagerPanelProvider implements ControlPanelProvider {

@Override
public String getTitle() {
return Translator.getInstance().translate("appManager.name");
}

@Override
public String getName() {
return "ApplicationManagerPanel";
}

@Override
public int getOrder() {
return 1;
}

@Override
public boolean isActive(final DeploymentConfiguration config) {
return Boolean.parseBoolean(config.getProperty(APPLICATION_MANAGER_ACTIVE));
}

@Override
public JComponent createPanel(final DeploymentConfiguration config) {
return new ApplicationManagerPanel(config);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,37 @@

import com.openwebstart.app.Application;
import com.openwebstart.jvm.ui.dialogs.DialogFactory;
import com.openwebstart.os.ScriptFactory;
import com.openwebstart.launcher.PhaseTwoWebStartLauncher;
import com.openwebstart.ui.BasicAction;
import net.adoptopenjdk.icedteaweb.i18n.Translator;
import net.adoptopenjdk.icedteaweb.logging.Logger;
import net.adoptopenjdk.icedteaweb.logging.LoggerFactory;

import java.net.URL;
import java.util.concurrent.Executors;

public class StartApplicationAction extends BasicAction<Application> {

private static final Logger LOG = LoggerFactory.getLogger(StartApplicationAction.class);


public StartApplicationAction() {
super(Translator.getInstance().translate("appManager.action.startApplication.text"), Translator.getInstance().translate("appManager.action.startApplication.description"));
}

@Override
public void call(final Application item) {
try {
final Process startProcess = ScriptFactory.createStartProcess(item.getJnlpFile());
startProcess.waitFor();
} catch (final Exception e) {
DialogFactory.showErrorDialog("Can not remove app", e);
}
final URL fileLocation = item.getJnlpFile().getFileLocation();

Executors.newSingleThreadExecutor().submit(() -> {
Thread.currentThread().setName("Starter Thread for '" + item.getName() + "'");
LOG.info("Starting '{}'", item.getName());
try {
PhaseTwoWebStartLauncher.main(fileLocation.toString());
} catch (final Exception e) {
DialogFactory.showErrorDialog("Error in executing application '" + item.getName() + "'", e);
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public class OwsDefaultsProvider implements DefaultsProvider {

public static final String PROXY_PAC_CACHE = "deployment.proxy.pac.cache";

public static final String APPLICATION_MANAGER_ACTIVE = "ows.experimental.applicationManager.active";


public static final RuntimeUpdateStrategy DEFAULT_UPDATE_STRATEGY = RuntimeUpdateStrategy.ASK_FOR_UPDATE_ON_LOCAL_MATCH;

@Override
Expand All @@ -49,6 +52,11 @@ public List<Setting> getDefaults() {
Boolean.FALSE.toString(),
ValidatorFactory.createBooleanValidator()
),
Setting.createDefault(
APPLICATION_MANAGER_ACTIVE,
Boolean.FALSE.toString(),
ValidatorFactory.createBooleanValidator()
),
Setting.createDefault(
REMOTE_DEBUG,
Boolean.FALSE.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class OpenWebStartLauncher {

private static final Logger LOG = LoggerFactory.getLogger(OpenWebStartLauncher.class);

public static void main(String[] args) {
public static void main(String... args) {
final List<String> verboseArgs = getVerboseArgs(args);
if (!InstallerUtil.isMacOS()) {
LOG.info("OWS main args {}.", verboseArgs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class PhaseTwoWebStartLauncher {
private static final String consoleOption = "-console";
private static final List<String> optionsToSkip = Arrays.asList(CommandLineOptions.NOFORK.getOption(), CommandLineOptions.VIEWER.getOption(), consoleOption);

public static void main(final String[] args) {
public static void main(final String... args) {
Install4JUtils.applicationVersion().ifPresent(v -> LOG.info("Starting OpenWebStart {}", v));

Translator.addBundle("i18n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void addMenuAndDesktopEntries(final MenuAndDesktopEntriesFactory factory


if (hasMenu || hasDesktop) {
updateEntries(factory, jnlpFile, supportsMenu && hasDesktop, supportsDesktop && hasDesktop);
updateEntries(factory, jnlpFile, supportsMenu && hasMenu, supportsDesktop && hasDesktop);
} else {
if (shortcutCreationOptions == CREATE_ALWAYS) {
addEntries(factory, jnlpFile, supportsMenu, supportsDesktop);
Expand Down