Commit 679b8054 authored by Adam Knapp's avatar Adam Knapp
Browse files

Launch shortcut for Titan Native Java launcher



Change-Id: I1f4425357e578f372c94a52fcb128f17625ae30a
Signed-off-by: default avatarAdam Knapp <adam.knapp@sigmatechnology.se>
parent ca89090c
...@@ -17,7 +17,10 @@ Require-Bundle: org.eclipse.ui, ...@@ -17,7 +17,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.expressions, org.eclipse.core.expressions,
org.eclipse.titan.common;bundle-version="7.2.0", org.eclipse.titan.common;bundle-version="7.2.0",
org.eclipse.titan.designer;bundle-version="7.2.0", org.eclipse.titan.designer;bundle-version="7.2.0",
org.eclipse.titan.runtime;bundle-version="7.2.0" org.eclipse.titan.runtime;bundle-version="7.2.0",
org.eclipse.jdt.core;bundle-version="3.10.2",
org.eclipse.jdt.debug.ui;bundle-version="3.10.2",
org.eclipse.jdt.launching;bundle-version="3.10.2"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true Eclipse-LazyStart: true
Bundle-Vendor: Eclipse Titan Project Bundle-Vendor: Eclipse Titan Project
......
...@@ -31,6 +31,7 @@ public final class GeneralConstants { ...@@ -31,6 +31,7 @@ public final class GeneralConstants {
public static final String CONFIGFILEPATH = PLUGIN_ID + ".configurationFilePath"; public static final String CONFIGFILEPATH = PLUGIN_ID + ".configurationFilePath";
public static final String SHORTCUTEXECUTION = PLUGIN_ID + ".executeStartedFromShortCut"; public static final String SHORTCUTEXECUTION = PLUGIN_ID + ".executeStartedFromShortCut";
public static final String EXECUTECONFIGFILEONLAUNCH = PLUGIN_ID + ".executeConfigurationFileOnLaunch"; public static final String EXECUTECONFIGFILEONLAUNCH = PLUGIN_ID + ".executeConfigurationFileOnLaunch";
public static final String SINGLEMODEJAVAEXECUTOR = PLUGIN_ID + ".singleModeJavaExecutor";
public static final String HOSTNAMES = PLUGIN_ID + ".hostNames"; public static final String HOSTNAMES = PLUGIN_ID + ".hostNames";
public static final String HOSTWORKINGDIRECTORIES = PLUGIN_ID + ".hostWorkingDirectories"; public static final String HOSTWORKINGDIRECTORIES = PLUGIN_ID + ".hostWorkingDirectories";
public static final String HOSTEXECUTABLES = PLUGIN_ID + ".hostExecutables"; public static final String HOSTEXECUTABLES = PLUGIN_ID + ".hostExecutables";
......
...@@ -7,10 +7,18 @@ ...@@ -7,10 +7,18 @@
******************************************************************************/ ******************************************************************************/
package org.eclipse.titan.executor.executors.java_mctr; package org.eclipse.titan.executor.executors.java_mctr;
import static org.eclipse.titan.executor.GeneralConstants.SINGLEMODEJAVAEXECUTOR;
import java.util.List;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.titan.executor.Activator;
import org.eclipse.titan.executor.executors.LaunchConfigurationUtil;
import org.eclipse.titan.executor.executors.TitanLaunchConfigurationDelegate; import org.eclipse.titan.executor.executors.TitanLaunchConfigurationDelegate;
/** /**
...@@ -19,11 +27,28 @@ import org.eclipse.titan.executor.executors.TitanLaunchConfigurationDelegate; ...@@ -19,11 +27,28 @@ import org.eclipse.titan.executor.executors.TitanLaunchConfigurationDelegate;
*/ */
public final class LaunchConfigurationDelegate extends TitanLaunchConfigurationDelegate { public final class LaunchConfigurationDelegate extends TitanLaunchConfigurationDelegate {
private static final String MISSING_LINKED_LAUNCH_CONFIG = "Unable to locate the launch configuration for single mode";
@Override @Override
public void launch(final ILaunchConfiguration arg0, final String arg1, final ILaunch arg2, final IProgressMonitor arg3) throws CoreException { public void launch(final ILaunchConfiguration arg0, final String arg1, final ILaunch arg2, final IProgressMonitor arg3) throws CoreException {
showExecutionPerspective(); showExecutionPerspective();
final boolean singleMode = arg0.getAttribute(SINGLEMODEJAVAEXECUTOR, false);
if (singleMode) {
List<String> list = LaunchConfigurationUtil.getLinkedLaunchConfigurations(arg0);
if (list == null || list.size() != 1) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, MISSING_LINKED_LAUNCH_CONFIG, null);
throw new CoreException(status);
}
ILaunchConfiguration singleConfig = LaunchConfigurationUtil.findJavaAppLaunchConfigurationByName(list.get(0));
if (singleConfig == null) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, MISSING_LINKED_LAUNCH_CONFIG, null);
throw new CoreException(status);
}
singleConfig.launch(arg1, null);
return;
}
final NativeJavaExecutor executor = new NativeJavaExecutor(arg0); final NativeJavaExecutor executor = new NativeJavaExecutor(arg0);
executor.startSession(arg2); executor.startSession(arg2);
} }
} }
...@@ -7,19 +7,28 @@ ...@@ -7,19 +7,28 @@
******************************************************************************/ ******************************************************************************/
package org.eclipse.titan.executor.executors.java_mctr; package org.eclipse.titan.executor.executors.java_mctr;
import static org.eclipse.titan.executor.GeneralConstants.SINGLEMODEJAVAEXECUTOR;
import java.util.ArrayList;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.titan.executor.executors.LaunchConfigurationUtil;
import org.eclipse.titan.executor.tabpages.maincontroller.NativeJavaMainControllerTab; import org.eclipse.titan.executor.tabpages.maincontroller.NativeJavaMainControllerTab;
import org.eclipse.titan.executor.views.executormonitor.ExecutorMonitorView;
/** /**
* @author Kristof Szabados * @author Kristof Szabados
* @author Adam Knapp
* */ * */
public final class LaunchShortcut extends org.eclipse.titan.executor.executors.LaunchShortcut { public final class LaunchShortcut extends org.eclipse.titan.executor.executors.LaunchShortcut {
@Override @Override
/** {@inheritDoc} */ /** {@inheritDoc} */
protected String getConfigurationId() { protected String getConfigurationId() {
return "org.eclipse.titan.executor.executors.java_mctr.LaunchConfigurationDelegate"; return ExecutorMonitorView.NATIVE_JAVA_LAUNCHCONFIGURATION_ID;
} }
@Override @Override
...@@ -31,7 +40,41 @@ public final class LaunchShortcut extends org.eclipse.titan.executor.executors.L ...@@ -31,7 +40,41 @@ public final class LaunchShortcut extends org.eclipse.titan.executor.executors.L
@Override @Override
/** {@inheritDoc} */ /** {@inheritDoc} */
protected String getLaunchConfigurationType() { protected String getLaunchConfigurationType() {
return "Parallel-Java"; return "MC-Java";
}
@Override
/** {@inheritDoc} */
protected void performLaunch(ILaunchConfiguration configuration, final String mode) throws CoreException {
ILaunchConfigurationWorkingCopy wc = null;
if (configuration.isWorkingCopy()) {
wc = (ILaunchConfigurationWorkingCopy)configuration;
} else {
wc = configuration.getWorkingCopy();
}
final boolean singleMode = wc.getAttribute(SINGLEMODEJAVAEXECUTOR, false);
ArrayList<String> list = new ArrayList<String>(2);
if (singleMode) {
final ILaunchConfiguration confSingle = LaunchConfigurationUtil.createJavaAppLaunchConfiguration(wc);
if (confSingle == null) {
return;
}
list.add(confSingle.getName());
LaunchConfigurationUtil.setLinkedLaunchConfigurations(wc, list);
configuration = wc.doSave();
configuration.launch(mode, null);
return;
}
final ILaunchConfiguration confHC = LaunchConfigurationUtil.createJavaAppLaunchConfiguration(wc);
final ILaunchConfiguration confGroup = LaunchConfigurationUtil.createGroupLaunchConfiguration(wc, confHC);
if (confHC == null || confGroup == null) {
return;
}
list.add(confHC.getName());
list.add(confGroup.getName());
LaunchConfigurationUtil.setLinkedLaunchConfigurations(wc, list);
configuration = wc.doSave();
//confGroup.launch(mode, null);
} }
@Override @Override
...@@ -40,5 +83,4 @@ public final class LaunchShortcut extends org.eclipse.titan.executor.executors.L ...@@ -40,5 +83,4 @@ public final class LaunchShortcut extends org.eclipse.titan.executor.executors.L
return NativeJavaMainControllerTab.initLaunchConfiguration(configuration, project, configFilePath); return NativeJavaMainControllerTab.initLaunchConfiguration(configuration, project, configFilePath);
} }
} }
...@@ -7,18 +7,27 @@ ...@@ -7,18 +7,27 @@
******************************************************************************/ ******************************************************************************/
package org.eclipse.titan.executor.executors.java_mctr; package org.eclipse.titan.executor.executors.java_mctr;
import static org.eclipse.titan.executor.GeneralConstants.SINGLEMODEJAVAEXECUTOR;
import java.util.ArrayList;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.titan.executor.executors.LaunchConfigurationUtil;
import org.eclipse.titan.executor.tabpages.maincontroller.NativeJavaMainControllerTab; import org.eclipse.titan.executor.tabpages.maincontroller.NativeJavaMainControllerTab;
import org.eclipse.titan.executor.views.executormonitor.ExecutorMonitorView;
/** /**
* @author Kristof Szabados * @author Kristof Szabados
* @author Adam Knapp
* */ * */
public final class LaunchShortcutConfig extends org.eclipse.titan.executor.executors.LaunchShortcutConfig { public final class LaunchShortcutConfig extends org.eclipse.titan.executor.executors.LaunchShortcutConfig {
@Override @Override
/** {@inheritDoc} */ /** {@inheritDoc} */
protected String getConfigurationId() { protected String getConfigurationId() {
return "org.eclipse.titan.executor.executors.java_mctr.LaunchConfigurationDelegate"; return ExecutorMonitorView.NATIVE_JAVA_LAUNCHCONFIGURATION_ID;
} }
@Override @Override
...@@ -30,7 +39,41 @@ public final class LaunchShortcutConfig extends org.eclipse.titan.executor.execu ...@@ -30,7 +39,41 @@ public final class LaunchShortcutConfig extends org.eclipse.titan.executor.execu
@Override @Override
/** {@inheritDoc} */ /** {@inheritDoc} */
protected String getLaunchConfigurationType() { protected String getLaunchConfigurationType() {
return "Parallel-Java"; return "MC-Java";
}
@Override
/** {@inheritDoc} */
protected void performLaunch(ILaunchConfiguration configuration, final String mode) throws CoreException {
ILaunchConfigurationWorkingCopy wc = null;
if (configuration.isWorkingCopy()) {
wc = (ILaunchConfigurationWorkingCopy)configuration;
} else {
wc = configuration.getWorkingCopy();
}
final boolean singleMode = wc.getAttribute(SINGLEMODEJAVAEXECUTOR, false);
ArrayList<String> list = new ArrayList<String>(2);
if (singleMode) {
final ILaunchConfiguration confSingle = LaunchConfigurationUtil.createJavaAppLaunchConfiguration(wc);
if (confSingle == null) {
return;
}
list.add(confSingle.getName());
LaunchConfigurationUtil.setLinkedLaunchConfigurations(wc, list);
configuration = wc.doSave();
configuration.launch(mode, null);
return;
}
final ILaunchConfiguration confHC = LaunchConfigurationUtil.createJavaAppLaunchConfiguration(wc);
final ILaunchConfiguration confGroup = LaunchConfigurationUtil.createGroupLaunchConfiguration(wc, confHC);
if (confHC == null || confGroup == null) {
return;
}
list.add(confHC.getName());
list.add(confGroup.getName());
LaunchConfigurationUtil.setLinkedLaunchConfigurations(wc, list);
configuration = wc.doSave();
//confGroup.launch(mode, null);
} }
@Override @Override
...@@ -38,4 +81,5 @@ public final class LaunchShortcutConfig extends org.eclipse.titan.executor.execu ...@@ -38,4 +81,5 @@ public final class LaunchShortcutConfig extends org.eclipse.titan.executor.execu
public boolean initLaunchConfiguration(final ILaunchConfigurationWorkingCopy configuration, final IProject project, final String configFilePath) { public boolean initLaunchConfiguration(final ILaunchConfigurationWorkingCopy configuration, final IProject project, final String configFilePath) {
return NativeJavaMainControllerTab.initLaunchConfiguration(configuration, project, configFilePath); return NativeJavaMainControllerTab.initLaunchConfiguration(configuration, project, configFilePath);
} }
} }
...@@ -11,6 +11,7 @@ import static org.eclipse.titan.executor.GeneralConstants.CONFIGFILEPATH; ...@@ -11,6 +11,7 @@ import static org.eclipse.titan.executor.GeneralConstants.CONFIGFILEPATH;
import static org.eclipse.titan.executor.GeneralConstants.EXECUTABLEFILEPATH; import static org.eclipse.titan.executor.GeneralConstants.EXECUTABLEFILEPATH;
import static org.eclipse.titan.executor.GeneralConstants.EXECUTECONFIGFILEONLAUNCH; import static org.eclipse.titan.executor.GeneralConstants.EXECUTECONFIGFILEONLAUNCH;
import static org.eclipse.titan.executor.GeneralConstants.PROJECTNAME; import static org.eclipse.titan.executor.GeneralConstants.PROJECTNAME;
import static org.eclipse.titan.executor.GeneralConstants.SINGLEMODEJAVAEXECUTOR;
import static org.eclipse.titan.executor.GeneralConstants.WORKINGDIRECTORYPATH; import static org.eclipse.titan.executor.GeneralConstants.WORKINGDIRECTORYPATH;
import java.io.File; import java.io.File;
...@@ -22,6 +23,7 @@ import java.util.Map; ...@@ -22,6 +23,7 @@ import java.util.Map;
import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
...@@ -32,6 +34,7 @@ import org.eclipse.debug.core.ILaunchConfiguration; ...@@ -32,6 +34,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.window.Window; import org.eclipse.jface.window.Window;
...@@ -52,16 +55,20 @@ import org.eclipse.titan.common.fieldeditors.TITANResourceLocator; ...@@ -52,16 +55,20 @@ import org.eclipse.titan.common.fieldeditors.TITANResourceLocator;
import org.eclipse.titan.common.logging.ErrorReporter; import org.eclipse.titan.common.logging.ErrorReporter;
import org.eclipse.titan.common.parsers.cfg.ConfigFileHandler; import org.eclipse.titan.common.parsers.cfg.ConfigFileHandler;
import org.eclipse.titan.common.path.TITANPathUtilities; import org.eclipse.titan.common.path.TITANPathUtilities;
import org.eclipse.titan.designer.core.TITANJavaBuilder;
import org.eclipse.titan.designer.productUtilities.ProductConstants; import org.eclipse.titan.designer.productUtilities.ProductConstants;
import org.eclipse.titan.designer.properties.data.ProjectFileHandler;
import org.eclipse.titan.executor.designerconnection.DesignerHelper; import org.eclipse.titan.executor.designerconnection.DesignerHelper;
import org.eclipse.titan.executor.designerconnection.DynamicLinkingHelper; import org.eclipse.titan.executor.designerconnection.DynamicLinkingHelper;
import org.eclipse.titan.executor.designerconnection.EnvironmentHelper; import org.eclipse.titan.executor.designerconnection.EnvironmentHelper;
import org.eclipse.titan.executor.executors.LaunchConfigurationUtil;
import org.eclipse.titan.executor.graphics.ImageCache; import org.eclipse.titan.executor.graphics.ImageCache;
import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.ui.model.WorkbenchLabelProvider;
/** /**
* @author Kristof Szabados * @author Kristof Szabados
* @author Adam Knapp
* */ * */
public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab { public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab {
protected static final String EMPTY = ""; protected static final String EMPTY = "";
...@@ -71,7 +78,8 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab ...@@ -71,7 +78,8 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab
"This field is required.\n" + "This field is required.\n" +
"When an existing project is selected and the Designer plug-in is also present the working directory " + "When an existing project is selected and the Designer plug-in is also present the working directory " +
"and executable fields are filled out automatically\n with the values set as project properties."; "and executable fields are filled out automatically\n with the values set as project properties.";
private static final String CONFIGFILE = "Configuration file (REQUIRED):"; private static final String CONFIGFILE = " Configuration file:";
private static final String CONFIGFILE_REQUIRED = "Configuration file (REQUIRED):";
private static final String CONFIGFILE_TOOLTIP = "This field is required.\n" + private static final String CONFIGFILE_TOOLTIP = "This field is required.\n" +
"The runtime configuration file used to describe the runtime behaviour of the executable test program."; "The runtime configuration file used to describe the runtime behaviour of the executable test program.";
private static final String BROWSE_WORKSPACE = "Browse Workspace.."; private static final String BROWSE_WORKSPACE = "Browse Workspace..";
...@@ -117,6 +125,7 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab ...@@ -117,6 +125,7 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab
private Group configFileGroup; private Group configFileGroup;
private Button projectSelectionButton; private Button projectSelectionButton;
private Button automaticExecuteSectionExecution; private Button automaticExecuteSectionExecution;
private Button singleModeExecutionCheckBox;
protected boolean projectIsValid; protected boolean projectIsValid;
private boolean projectIsJava; private boolean projectIsJava;
protected boolean configurationFileIsValid; protected boolean configurationFileIsValid;
...@@ -131,6 +140,14 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab ...@@ -131,6 +140,14 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab
configurationFileIsValid = false; configurationFileIsValid = false;
} }
protected void addListeners() {
projectNameText.addModifyListener(generalListener);
projectSelectionButton.addSelectionListener(generalListener);
configurationFileText.getTextControl(configFileGroup).addModifyListener(generalListener);
automaticExecuteSectionExecution.addSelectionListener(generalListener);
singleModeExecutionCheckBox.addSelectionListener(generalListener);
}
@Override @Override
public final void createControl(final Composite parent) { public final void createControl(final Composite parent) {
final Composite pageComposite = new Composite(parent, SWT.NONE); final Composite pageComposite = new Composite(parent, SWT.NONE);
...@@ -166,37 +183,70 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab ...@@ -166,37 +183,70 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab
if (!temp.equals(projectNameText.getText())) { if (!temp.equals(projectNameText.getText())) {
projectNameText.setText(temp); projectNameText.setText(temp);
} }
addListeners();
temp = configuration.getAttribute(CONFIGFILEPATH, EMPTY); temp = configuration.getAttribute(CONFIGFILEPATH, EMPTY);
if (!temp.equals(configurationFileText.getStringValue())) { if (!temp.equals(configurationFileText.getStringValue())) {
configurationFileText.setStringValue(temp); configurationFileText.setStringValue(temp);
} }
boolean tempBoolean = configuration.getAttribute(EXECUTECONFIGFILEONLAUNCH, false);
final boolean tempBoolean = configuration.getAttribute(EXECUTECONFIGFILEONLAUNCH, false);
if (tempBoolean != automaticExecuteSectionExecution.getSelection()) { if (tempBoolean != automaticExecuteSectionExecution.getSelection()) {
automaticExecuteSectionExecution.setSelection(tempBoolean); automaticExecuteSectionExecution.setSelection(tempBoolean);
} }
tempBoolean = configuration.getAttribute(SINGLEMODEJAVAEXECUTOR, false);
if (tempBoolean != singleModeExecutionCheckBox.getSelection()) {
singleModeExecutionCheckBox.setSelection(tempBoolean);
}
final IProject project = getProject(); final IProject project = getProject();
if (project == null) { if (project == null) {
return; return;
} }
final String projectPath = project.getLocation().toOSString(); //TODO should use URI based addresses final String projectPath = project.getLocation().toOSString(); //TODO should use URI based addresses
configurationFileText.setRootPath(projectPath); configurationFileText.setRootPath(projectPath);
} catch (CoreException e) { } catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e); ErrorReporter.logExceptionStackTrace(e);
} }
} }
@Override @Override
public final void performApply(final ILaunchConfigurationWorkingCopy configuration) { public final void performApply(final ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(PROJECTNAME, projectNameText.getText()); configuration.setAttribute(PROJECTNAME, projectNameText.getText());
configuration.setAttribute(CONFIGFILEPATH, configurationFileText.getStringValue()); final String configFileName = configurationFileText.getStringValue();
configuration.setAttribute(CONFIGFILEPATH, configFileName);
configuration.setAttribute(EXECUTECONFIGFILEONLAUNCH, automaticExecuteSectionExecution.getSelection()); configuration.setAttribute(EXECUTECONFIGFILEONLAUNCH, automaticExecuteSectionExecution.getSelection());
final boolean singleMode = singleModeExecutionCheckBox.getSelection();
configuration.setAttribute(SINGLEMODEJAVAEXECUTOR, singleMode);
final IProject project = getProject(); final IProject project = getProject();
configuration.setMappedResources(new IResource[] {project}); IFile configFile = null;
if (project != null) {
configFile = project.getFile(configFileName);
}
configuration.setMappedResources(new IResource[] {project, configFile});
ArrayList<String> list = new ArrayList<String>(2);
try {
if (singleMode) {
final ILaunchConfiguration confSingle = LaunchConfigurationUtil.createJavaAppLaunchConfiguration(configuration);
if (confSingle == null) {
return;
}
LaunchConfigurationUtil.disableHCinGroupLaunchConfiguration(configuration);
list.add(confSingle.getName());
LaunchConfigurationUtil.setLinkedLaunchConfigurations(configuration, list);
return;
}
final ILaunchConfiguration confHC = LaunchConfigurationUtil.createJavaAppLaunchConfiguration(configuration);
final ILaunchConfiguration confGroup = LaunchConfigurationUtil.createGroupLaunchConfiguration(configuration, confHC);
if (confHC == null || confGroup == null) {
return;
}
list.add(confHC.getName());
list.add(confGroup.getName());
LaunchConfigurationUtil.setLinkedLaunchConfigurations(configuration, list);
} catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e);
}
} }
@Override @Override
...@@ -206,6 +256,7 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab ...@@ -206,6 +256,7 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab
configuration.setAttribute(EXECUTABLEFILEPATH, EMPTY); configuration.setAttribute(EXECUTABLEFILEPATH, EMPTY);
configuration.setAttribute(CONFIGFILEPATH, EMPTY); configuration.setAttribute(CONFIGFILEPATH, EMPTY);
configuration.setAttribute(EXECUTECONFIGFILEONLAUNCH, false); configuration.setAttribute(EXECUTECONFIGFILEONLAUNCH, false);
configuration.setAttribute(SINGLEMODEJAVAEXECUTOR, false);
configuration.setMappedResources(new IResource[0]); configuration.setMappedResources(new IResource[0]);
} }
...@@ -224,15 +275,13 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab ...@@ -224,15 +275,13 @@ public class NativeJavaMainControllerTab extends AbstractLaunchConfigurationTab
gd = new GridData(GridData.FILL_HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL);
projectNameText.setLayoutData(gd); projectNameText.setLayoutData(gd);
projectNameText.setFont(font); projectNameText.setFont(font);
projectNameText.addModifyListener(generalListener);
projectSelectionButton = createPushButton(group, BROWSE_WORKSPACE, null); projectSelectionButton = createPushButton(group, BROWSE_WORKSPACE, null);
projectSelectionButton.addSelectionListener(generalListener);
} }
protected final void createConfigurationEditor(final Composite parent) { protected final void createConfigurationEditor(final Composite parent) {
final Font font = parent.getFont(); final Font font = parent.getFont();
configFileGroup = new Group(parent, SWT.NONE); configFileGroup = new Group(parent, SWT.NONE);
configFileGroup.setText(CONFIGFILE); configFileGroup.setText(CONFIGFILE_REQUIRED);
configFileGroup.setToolTipText(CONFIGFILE_TOOLTIP); configFileGroup.setToolTipText(CONFIGFILE_TOOLTIP);
final GridData gd = new GridData(GridData.FILL_HORIZONTAL); final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
configFileGroup.setLayoutData(gd); configFileGroup.setLayo