Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2013-01-01 04:21:03 +0000
committerIgor Fedorenko2013-01-01 04:21:03 +0000
commita8b5512972ebd9a273b8955fd1306e039428d400 (patch)
treef6cd368f8ee88082c81eb7087dcbe3bfed3997f6 /org.eclipse.m2e.launching/src
parentcf04c93473bf354448dd453877b688643d4d5cf9 (diff)
downloadm2e-core-a8b5512972ebd9a273b8955fd1306e039428d400.tar.gz
m2e-core-a8b5512972ebd9a273b8955fd1306e039428d400.tar.xz
m2e-core-a8b5512972ebd9a273b8955fd1306e039428d400.zip
Code format, organize imports
... also enabled automatic code format and organize imports on file save, hopefully this will help us keep formatting consistent in the future. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.m2e.launching/src')
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java49
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java78
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/LaunchingUtils.java11
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java74
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java8
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java8
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java3
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java17
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java22
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java58
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java1
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java7
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java153
13 files changed, 270 insertions, 219 deletions
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java
index 7a30696c..d94eeab3 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java
@@ -13,6 +13,9 @@ package org.eclipse.m2e.actions;
import java.util.ArrayList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -45,6 +48,14 @@ import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
@@ -54,15 +65,6 @@ import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator;
import org.eclipse.m2e.internal.launch.LaunchingUtils;
import org.eclipse.m2e.internal.launch.Messages;
import org.eclipse.m2e.ui.internal.launch.MavenLaunchMainTab;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
@@ -130,7 +132,7 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
if(basecon == null) {
return;
}
-
+
IContainer basedir = findPomXmlBasedir(basecon);
ILaunchConfiguration launchConfiguration = getLaunchConfiguration(basedir, mode);
@@ -195,24 +197,26 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager
.getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID);
-
+
String launchSafeGoalName = goal.replace(':', '-');
- ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, //
- NLS.bind(Messages.ExecutePomAction_executing, launchSafeGoalName, basedir.getLocation().toString().replace('/', '-')));
+ ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(
+ null, //
+ NLS.bind(Messages.ExecutePomAction_executing, launchSafeGoalName,
+ basedir.getLocation().toString().replace('/', '-')));
workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, basedir.getLocation().toOSString());
workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, goal);
workingCopy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_SCOPE, "${project}"); //$NON-NLS-1$
workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_RECURSIVE, true);
-
+
setProjectConfiguration(workingCopy, basedir);
IPath path = getJREContainerPath(basedir);
if(path != null) {
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, path.toPortableString());
}
-
+
// TODO when launching Maven with debugger consider to add the following property
// -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE"
@@ -284,7 +288,8 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
ArrayList<ILaunchConfiguration> matchingConfigs = new ArrayList<ILaunchConfiguration>();
for(ILaunchConfiguration configuration : launchConfigurations) {
// substitute variables
- String workDir = LaunchingUtils.substituteVar(configuration.getAttribute(MavenLaunchConstants.ATTR_POM_DIR, (String) null));
+ String workDir = LaunchingUtils.substituteVar(configuration.getAttribute(MavenLaunchConstants.ATTR_POM_DIR,
+ (String) null));
if(workDir == null) {
continue;
}
@@ -293,11 +298,11 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
matchingConfigs.add(configuration);
}
}
-
- if(matchingConfigs.size()==1) {
+
+ if(matchingConfigs.size() == 1) {
log.info("Using existing launch configuration");
return matchingConfigs.get(0);
- } else if(matchingConfigs.size()>1) {
+ } else if(matchingConfigs.size() > 1) {
final IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), //
new ILabelProvider() {
@@ -336,7 +341,7 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
});
dialog.setElements(matchingConfigs.toArray(new ILaunchConfiguration[matchingConfigs.size()]));
dialog.setTitle(Messages.ExecutePomAction_dialog_title);
- if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ if(mode.equals(ILaunchManager.DEBUG_MODE)) {
dialog.setMessage(Messages.ExecutePomAction_dialog_debug_message);
} else {
dialog.setMessage(Messages.ExecutePomAction_dialog_run_message);
@@ -346,7 +351,7 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
labelProvider.dispose();
return result == Window.OK ? (ILaunchConfiguration) dialog.getFirstResult() : null;
}
-
+
} catch(CoreException ex) {
log.error(ex.getMessage(), ex);
}
@@ -360,7 +365,7 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, basedirLocation.toString());
setProjectConfiguration(workingCopy, basedir);
-
+
// set other defaults if needed
// MavenLaunchMainTab maintab = new MavenLaunchMainTab();
// maintab.setDefaults(workingCopy);
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java
index 88565093..535f61c0 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java
@@ -13,38 +13,50 @@ package org.eclipse.m2e.actions;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+
public interface MavenLaunchConstants {
- public final String PLUGIN_ID = "org.eclipse.m2e.launching";
-
- // this should correspond with launchConfigurationType.id attribute in plugin.xml!
- public final String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.m2e.Maven2LaunchConfigurationType"; //$NON-NLS-1$
- public final String BUILDER_CONFIGURATION_TYPE_ID = "org.eclipse.m2e.Maven2BuilderConfigurationType"; //$NON-NLS-1$
-
- // pom directory automatically became working directory for maven embedder launch
- public final String ATTR_POM_DIR = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY;
-
- public final String ATTR_GOALS = "M2_GOALS"; //$NON-NLS-1$
- public final String ATTR_GOALS_AUTO_BUILD = "M2_GOALS_AUTO_BUILD"; //$NON-NLS-1$
- public final String ATTR_GOALS_MANUAL_BUILD = "M2_GOALS_MANUAL_BUILD"; //$NON-NLS-1$
- public final String ATTR_GOALS_CLEAN = "M2_GOALS_CLEAN"; //$NON-NLS-1$
- public final String ATTR_GOALS_AFTER_CLEAN = "M2_GOALS_AFTER_CLEAN"; //$NON-NLS-1$
-
- public final String ATTR_PROFILES = "M2_PROFILES"; //$NON-NLS-1$
- public final String ATTR_PROPERTIES = "M2_PROPERTIES"; //$NON-NLS-1$
-
- public final String ATTR_OFFLINE = "M2_OFFLINE"; //$NON-NLS-1$
- public final String ATTR_UPDATE_SNAPSHOTS = "M2_UPDATE_SNAPSHOTS"; //$NON-NLS-1$
- public final String ATTR_DEBUG_OUTPUT = "M2_DEBUG_OUTPUT"; //$NON-NLS-1$
- public final String ATTR_SKIP_TESTS = "M2_SKIP_TESTS"; //$NON-NLS-1$
- public final String ATTR_NON_RECURSIVE = "M2_NON_RECURSIVE"; //$NON-NLS-1$
- public final String ATTR_WORKSPACE_RESOLUTION = "M2_WORKSPACE_RESOLUTION"; //$NON-NLS-1$
-
- public final String ATTR_USER_SETTINGS = "M2_USER_SETTINGS"; //$NON-NLS-1$
-
- public final String ATTR_RUNTIME = "M2_RUNTIME"; //$NON-NLS-1$
-
- // hidden (for now) list of workspace components to be pushed into maven runtime
- public final String ATTR_FORCED_COMPONENTS_LIST = "M2_FORCED_COMPONENTS_LIST"; //$NON-NLS-1$
-
- public final String ATTR_DISABLED_EXTENSIONS = "M2_DISABLED_EXTENSIONS";
+ public final String PLUGIN_ID = "org.eclipse.m2e.launching";
+
+ // this should correspond with launchConfigurationType.id attribute in plugin.xml!
+ public final String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.m2e.Maven2LaunchConfigurationType"; //$NON-NLS-1$
+
+ public final String BUILDER_CONFIGURATION_TYPE_ID = "org.eclipse.m2e.Maven2BuilderConfigurationType"; //$NON-NLS-1$
+
+ // pom directory automatically became working directory for maven embedder launch
+ public final String ATTR_POM_DIR = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY;
+
+ public final String ATTR_GOALS = "M2_GOALS"; //$NON-NLS-1$
+
+ public final String ATTR_GOALS_AUTO_BUILD = "M2_GOALS_AUTO_BUILD"; //$NON-NLS-1$
+
+ public final String ATTR_GOALS_MANUAL_BUILD = "M2_GOALS_MANUAL_BUILD"; //$NON-NLS-1$
+
+ public final String ATTR_GOALS_CLEAN = "M2_GOALS_CLEAN"; //$NON-NLS-1$
+
+ public final String ATTR_GOALS_AFTER_CLEAN = "M2_GOALS_AFTER_CLEAN"; //$NON-NLS-1$
+
+ public final String ATTR_PROFILES = "M2_PROFILES"; //$NON-NLS-1$
+
+ public final String ATTR_PROPERTIES = "M2_PROPERTIES"; //$NON-NLS-1$
+
+ public final String ATTR_OFFLINE = "M2_OFFLINE"; //$NON-NLS-1$
+
+ public final String ATTR_UPDATE_SNAPSHOTS = "M2_UPDATE_SNAPSHOTS"; //$NON-NLS-1$
+
+ public final String ATTR_DEBUG_OUTPUT = "M2_DEBUG_OUTPUT"; //$NON-NLS-1$
+
+ public final String ATTR_SKIP_TESTS = "M2_SKIP_TESTS"; //$NON-NLS-1$
+
+ public final String ATTR_NON_RECURSIVE = "M2_NON_RECURSIVE"; //$NON-NLS-1$
+
+ public final String ATTR_WORKSPACE_RESOLUTION = "M2_WORKSPACE_RESOLUTION"; //$NON-NLS-1$
+
+ public final String ATTR_USER_SETTINGS = "M2_USER_SETTINGS"; //$NON-NLS-1$
+
+ public final String ATTR_RUNTIME = "M2_RUNTIME"; //$NON-NLS-1$
+
+ // hidden (for now) list of workspace components to be pushed into maven runtime
+ public final String ATTR_FORCED_COMPONENTS_LIST = "M2_FORCED_COMPONENTS_LIST"; //$NON-NLS-1$
+
+ public final String ATTR_DISABLED_EXTENSIONS = "M2_DISABLED_EXTENSIONS";
}
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/LaunchingUtils.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/LaunchingUtils.java
index ea553e23..92878457 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/LaunchingUtils.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/LaunchingUtils.java
@@ -8,17 +8,20 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
+
package org.eclipse.m2e.internal.launch;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.variables.VariablesPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.variables.VariablesPlugin;
+
+
public class LaunchingUtils {
-
+
private static Logger log = LoggerFactory.getLogger(LaunchingUtils.class);
-
+
/**
* Substitute any variable
*/
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java
index 9443260a..15fc655a 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java
@@ -17,7 +17,9 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.codehaus.plexus.util.DirectoryScanner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -34,10 +36,6 @@ import org.eclipse.debug.ui.console.IConsoleLineTracker;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.m2e.actions.MavenLaunchConstants;
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.m2e.core.project.IMavenProjectRegistry;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -46,8 +44,13 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IHyperlink;
import org.eclipse.ui.ide.IDE;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import org.codehaus.plexus.util.DirectoryScanner;
+
+import org.eclipse.m2e.actions.MavenLaunchConstants;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.IMavenProjectRegistry;
/**
@@ -61,13 +64,13 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
private static final String PLUGIN_ID = "org.eclipse.m2e.launching"; //$NON-NLS-1$
private static final String LISTENING_MARKER = "Listening for transport dt_socket at address: ";
-
+
private static final String RUNNING_MARKER = "Running ";
private static final String TEST_TEMPLATE = "(?: )test.+\\(([\\w\\.]+)\\)"; //$NON-NLS-1$
-
+
private static final Pattern PATTERN2 = Pattern.compile(TEST_TEMPLATE);
-
+
private IConsole console;
public void init(IConsole console) {
@@ -79,15 +82,15 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
ILaunch launch = process.getLaunch();
ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
- if(launchConfiguration!=null && isMavenProcess(launchConfiguration)) {
+ if(launchConfiguration != null && isMavenProcess(launchConfiguration)) {
try {
int offset = line.getOffset();
int length = line.getLength();
String text = console.getDocument().get(offset, length);
-
+
String testName = null;
-
+
int index = text.indexOf(RUNNING_MARKER);
if(index > -1) {
testName = text.substring(RUNNING_MARKER.length());
@@ -96,24 +99,24 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
} else if(text.startsWith(LISTENING_MARKER)) {
// create and start remote Java app launch configuration
String baseDir = getBaseDir(launchConfiguration);
- if(baseDir!=null) {
+ if(baseDir != null) {
String portString = text.substring(LISTENING_MARKER.length()).trim();
MavenDebugHyperLink link = new MavenDebugHyperLink(baseDir, portString);
console.addLink(link, offset, LISTENING_MARKER.length() + portString.length());
// launchRemoteJavaApp(baseDir, portString);
}
-
+
} else {
Matcher m = PATTERN2.matcher(text);
if(m.find()) {
testName = m.group(1);
offset += m.start(1);
- }
+ }
}
if(testName != null) {
String baseDir = getBaseDir(launchConfiguration);
- if(baseDir!=null) {
+ if(baseDir != null) {
MavenConsoleHyperLink link = new MavenConsoleHyperLink(baseDir, testName);
console.addLink(link, offset, testName.length());
}
@@ -170,19 +173,20 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
*/
-
+
ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, //
"Connecting debugger to port " + portString);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, false);
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR);
-
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR,
+ IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR);
+
Map<String, String> connectMap = new HashMap<String, String>();
connectMap.put("port", portString); //$NON-NLS-1$
connectMap.put("hostname", "localhost"); //$NON-NLS-1$ //$NON-NLS-2$
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, connectMap);
IProject project = getProject(baseDir);
- if(project!=null) {
+ if(project != null) {
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
}
@@ -200,14 +204,14 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
}
return null;
}
-
-
+
/**
- * Opens a text editor for Maven test report
+ * Opens a text editor for Maven test report
*/
public class MavenConsoleHyperLink implements IHyperlink {
private final String baseDir;
+
private final String testName;
public MavenConsoleHyperLink(String baseDir, String testName) {
@@ -227,11 +231,11 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
-
+
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor("foo.txt"); //$NON-NLS-1$
-
+
File reportFile = new File(baseDir, includedFiles[0]);
-
+
try {
IDE.openEditor(page, new MavenFileEditorInput(reportFile.getAbsolutePath()), desc.getId());
} catch(PartInitException ex) {
@@ -249,24 +253,25 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
}
/**
- * Creates debug launch configuration for remote Java application. For example,
- * with surefire plugin the following property can be specified:
- * -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE"
+ * Creates debug launch configuration for remote Java application. For example, with surefire plugin the following
+ * property can be specified: -Dmaven.surefire.debug=
+ * "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE"
*/
public class MavenDebugHyperLink implements IHyperlink {
private final String baseDir;
+
private final String portString;
public MavenDebugHyperLink(String baseDir, String portString) {
this.baseDir = baseDir;
this.portString = portString;
}
-
+
public void linkActivated() {
try {
launchRemoteJavaApp(baseDir, portString);
- } catch (CoreException ex) {
+ } catch(CoreException ex) {
log.error(ex.getMessage(), ex);
}
}
@@ -276,8 +281,7 @@ public class MavenConsoleLineTracker implements IConsoleLineTracker {
public void linkExited() {
}
-
+
}
-
-}
+}
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java
index d6829ab6..0bb3b970 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java
@@ -23,15 +23,17 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+
+
/**
* Maven file editor input
- *
+ *
* @author Eugene Kuleshov
*/
public class MavenFileEditorInput implements IStorageEditorInput {
@@ -104,7 +106,7 @@ public class MavenFileEditorInput implements IStorageEditorInput {
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
- if(adapter==ILocationProvider.class) {
+ if(adapter == ILocationProvider.class) {
return new ILocationProvider() {
public IPath getPath(Object element) {
return Path.fromOSString(fileName);
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java
index 7596906b..38dec65f 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java
@@ -20,6 +20,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -37,15 +40,14 @@ import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.JavaLaunchDelegate;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.jdt.launching.sourcelookup.containers.JavaSourceLookupParticipant;
+import org.eclipse.osgi.util.NLS;
+
import org.eclipse.m2e.actions.MavenLaunchConstants;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.IMavenConfiguration;
import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
import org.eclipse.m2e.core.embedder.MavenRuntime;
import org.eclipse.m2e.core.internal.MavenPluginActivator;
-import org.eclipse.osgi.util.NLS;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class MavenLaunchDelegate extends JavaLaunchDelegate implements MavenLaunchConstants {
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java
index 17fb637e..82e5dabb 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java
@@ -13,8 +13,9 @@ package org.eclipse.m2e.internal.launch;
import org.eclipse.core.runtime.Plugin;
+
public class MavenLaunchPlugin extends Plugin {
-
+
private static MavenLaunchPlugin instance;
public MavenLaunchPlugin() {
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
index ed51974d..0418c7ac 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
@@ -17,12 +17,21 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
-import org.apache.maven.artifact.Artifact;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ibm.icu.util.StringTokenizer;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.osgi.util.NLS;
+
+import org.apache.maven.artifact.Artifact;
+
import org.eclipse.m2e.actions.MavenLaunchConstants;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.IMaven;
@@ -31,12 +40,6 @@ import org.eclipse.m2e.core.embedder.MavenRuntime;
import org.eclipse.m2e.core.embedder.MavenRuntimeManager;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.IMavenProjectRegistry;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ibm.icu.util.StringTokenizer;
/**
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java
index 2bc6b171..8bcb34c2 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java
@@ -23,9 +23,11 @@ import java.util.Map;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.osgi.util.NLS;
+
import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.osgi.util.NLS;
+
/**
* MavenLauncherConfigurationHandler
@@ -35,9 +37,13 @@ import org.eclipse.osgi.util.NLS;
public class MavenLauncherConfigurationHandler implements IMavenLauncherConfiguration {
private String mainType;
+
private String mainRealm;
+
private LinkedHashMap<String, List<String>> realms = new LinkedHashMap<String, List<String>>();
+
private List<String> forcedEntries = new ArrayList<String>();
+
private List<String> curEntries = forcedEntries;
public void addArchiveEntry(String entry) {
@@ -47,13 +53,13 @@ public class MavenLauncherConfigurationHandler implements IMavenLauncherConfigur
public void addProjectEntry(IMavenProjectFacade facade) {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFolder output = root.getFolder(facade.getOutputLocation());
- if (output.isAccessible()) {
+ if(output.isAccessible()) {
addArchiveEntry(output.getLocation().toFile().getAbsolutePath());
}
}
public void addRealm(String realm) {
- if (!realms.containsKey(realm)) {
+ if(!realms.containsKey(realm)) {
curEntries = new ArrayList<String>();
realms.put(realm, curEntries);
}
@@ -67,17 +73,17 @@ public class MavenLauncherConfigurationHandler implements IMavenLauncherConfigur
public void save(OutputStream os) throws IOException {
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(os, "UTF-8")); //$NON-NLS-1$
out.write(NLS.bind("main is {0} from {1}\n", mainType, mainRealm));
- for (Map.Entry<String, List<String>> realm : realms.entrySet()) {
- if (LAUNCHER_REALM.equals(realm.getKey())) {
+ for(Map.Entry<String, List<String>> realm : realms.entrySet()) {
+ if(LAUNCHER_REALM.equals(realm.getKey())) {
continue;
}
out.write(NLS.bind("[{0}]\n", realm.getKey()));
- if (mainRealm.equals(realm.getKey())) {
- for (String entry : forcedEntries) {
+ if(mainRealm.equals(realm.getKey())) {
+ for(String entry : forcedEntries) {
out.write(NLS.bind("load {0}\n", entry));
}
}
- for (String entry : realm.getValue()) {
+ for(String entry : realm.getValue()) {
out.write(NLS.bind("load {0}\n", entry));
}
}
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
index 8f3916cf..7475edb7 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
@@ -23,8 +23,6 @@ import java.util.Properties;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import org.apache.maven.artifact.Artifact;
-import org.codehaus.plexus.util.DirectoryScanner;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -35,6 +33,11 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
+
+import org.codehaus.plexus.util.DirectoryScanner;
+
+import org.apache.maven.artifact.Artifact;
+
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.IMaven;
import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
@@ -43,11 +46,8 @@ import org.eclipse.m2e.core.project.IMavenProjectFacade;
/**
- * Computes Maven launch configuration default source lookup path.
- *
- * Default source lookup includes Maven core libraries only.
- * It does not (and cannot) include entries for any Maven plugins
- * which are loaded dynamically at runtime.
+ * Computes Maven launch configuration default source lookup path. Default source lookup includes Maven core libraries
+ * only. It does not (and cannot) include entries for any Maven plugins which are loaded dynamically at runtime.
*
* @author Eugene Kuleshov
*/
@@ -74,14 +74,17 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
public void addArchiveEntry(String entry) throws CoreException {
addArchiveRuntimeClasspathEntry(entries, entry);
}
+
public void addProjectEntry(IMavenProjectFacade facade) {
IJavaProject javaProject = JavaCore.create(facade.getProject());
if(javaProject != null) {
entries.add(JavaRuntime.newDefaultProjectClasspathEntry(javaProject));
}
}
+
public void addRealm(String world) {
}
+
public void setMainType(String type, String world) {
}
};
@@ -95,22 +98,22 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
return JavaRuntime.getSourceContainers(resolved);
}
- protected void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath) throws CoreException {
+ protected void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath)
+ throws CoreException {
File entryFile = new File(entryPath);
-
- if (!entryFile.exists()) {
+
+ if(!entryFile.exists()) {
return;
}
-
- if (entryFile.isDirectory()) {
+
+ if(entryFile.isDirectory()) {
DirectoryScanner ds = new DirectoryScanner();
ds.setBasedir(entryFile);
- ds.setIncludes(new String[] {
- "META-INF/maven/*/*/pom.properties", //$NON-NLS-1$
+ ds.setIncludes(new String[] {"META-INF/maven/*/*/pom.properties", //$NON-NLS-1$
});
ds.scan();
String[] files = ds.getIncludedFiles();
- for (String file : files) {
+ for(String file : files) {
try {
BufferedInputStream is = new BufferedInputStream(new FileInputStream(new File(entryFile, file)));
try {
@@ -118,7 +121,7 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
} finally {
is.close();
}
- } catch (IOException e) {
+ } catch(IOException e) {
// ignore it
}
@@ -128,24 +131,25 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
JarFile jar = new JarFile(entryFile);
try {
Enumeration<JarEntry> zes = jar.entries();
- while (zes.hasMoreElements()) {
+ while(zes.hasMoreElements()) {
JarEntry ze = zes.nextElement();
String name = ze.getName();
- if (!ze.isDirectory() && name.startsWith("META-INF/maven/") && name.endsWith("pom.properties")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if(!ze.isDirectory() && name.startsWith("META-INF/maven/") && name.endsWith("pom.properties")) { //$NON-NLS-1$ //$NON-NLS-2$
addArchiveRuntimeClasspathEntry(entries, entryPath, jar.getInputStream(ze));
}
}
} finally {
jar.close();
}
- } catch (IOException e) {
+ } catch(IOException e) {
// ignore it
}
}
-
+
}
-
- private void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath, InputStream is) throws IOException, CoreException {
+
+ private void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath, InputStream is)
+ throws IOException, CoreException {
Properties p = new Properties();
p.load(is);
@@ -154,8 +158,8 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
String version = p.getProperty("version"); //$NON-NLS-1$
File sourcesJar = getSourcesJar(groupId, artifactId, version);
- if (sourcesJar != null) {
- IRuntimeClasspathEntry entry = null;
+ if(sourcesJar != null) {
+ IRuntimeClasspathEntry entry = null;
entry = JavaRuntime.newArchiveRuntimeClasspathEntry(Path.fromOSString(entryPath));
entry.setSourceAttachmentPath(Path.fromOSString(sourcesJar.getAbsolutePath()));
entries.add(entry);
@@ -163,14 +167,14 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
}
private File getSourcesJar(String groupId, String artifactId, String version) {
- if (groupId != null && artifactId != null && version != null) {
+ if(groupId != null && artifactId != null && version != null) {
IMaven maven = MavenPlugin.getMaven();
try {
Artifact artifact = maven.resolve(groupId, artifactId, version, "jar", "sources", null, null); //$NON-NLS-1$ //$NON-NLS-2$
File file = artifact.getFile();
-
- if (file != null && file.exists() && file.canRead()) {
+
+ if(file != null && file.exists() && file.canRead()) {
return file;
}
} catch(CoreException ex) {
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java
index 2128066e..a1197898 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java
@@ -21,6 +21,7 @@ import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.RefreshTab;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+
import org.eclipse.m2e.internal.launch.MavenLaunchParticipantInfo;
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java
index 3bc9a981..e42a5e44 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java
@@ -29,9 +29,6 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.m2e.actions.MavenLaunchConstants;
-import org.eclipse.m2e.internal.launch.MavenLaunchParticipantInfo;
-import org.eclipse.m2e.internal.launch.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
@@ -40,6 +37,10 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.m2e.actions.MavenLaunchConstants;
+import org.eclipse.m2e.internal.launch.MavenLaunchParticipantInfo;
+import org.eclipse.m2e.internal.launch.Messages;
+
public class MavenLaunchExtensionsTab extends AbstractLaunchConfigurationTab {
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java
index 827fd5e7..83115dd1 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java
@@ -16,6 +16,9 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -35,16 +38,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.m2e.actions.MavenLaunchConstants;
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.embedder.IMavenConfiguration;
-import org.eclipse.m2e.core.embedder.MavenRuntime;
-import org.eclipse.m2e.core.embedder.MavenRuntimeManager;
-import org.eclipse.m2e.core.ui.internal.MavenImages;
-import org.eclipse.m2e.core.ui.internal.dialogs.MavenGoalSelectionDialog;
-import org.eclipse.m2e.core.ui.internal.dialogs.MavenPropertyDialog;
-import org.eclipse.m2e.internal.launch.LaunchingUtils;
-import org.eclipse.m2e.internal.launch.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
@@ -69,12 +62,21 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import org.eclipse.m2e.actions.MavenLaunchConstants;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.embedder.IMavenConfiguration;
+import org.eclipse.m2e.core.embedder.MavenRuntime;
+import org.eclipse.m2e.core.embedder.MavenRuntimeManager;
+import org.eclipse.m2e.core.ui.internal.MavenImages;
+import org.eclipse.m2e.core.ui.internal.dialogs.MavenGoalSelectionDialog;
+import org.eclipse.m2e.core.ui.internal.dialogs.MavenPropertyDialog;
+import org.eclipse.m2e.internal.launch.LaunchingUtils;
+import org.eclipse.m2e.internal.launch.Messages;
/**
- * Maven Launch dialog Main tab
+ * Maven Launch dialog Main tab
*
* @author Dmitri Maximovich
* @author Eugene Kuleshov
@@ -86,16 +88,21 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
public static final String ID_EXTERNAL_TOOLS_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup"; //$NON-NLS-1$
private final boolean isBuilder;
-
+
protected Text pomDirNameText;
protected Text goalsText;
+
protected Text goalsAutoBuildText;
+
protected Text goalsManualBuildText;
+
protected Text goalsCleanText;
+
protected Text goalsAfterCleanText;
-
+
protected Text profilesText;
+
protected Table propsTable;
private Button offlineButton;
@@ -105,17 +112,16 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
private Button debugOutputButton;
private Button skipTestsButton;
-
+
private Button nonRecursiveButton;
-
+
private Button enableWorkspaceResolution;
private Button removePropButton;
-
+
private Button editPropButton;
-
- ComboViewer runtimeComboViewer;
+ ComboViewer runtimeComboViewer;
public MavenLaunchMainTab(boolean isBuilder) {
this.isBuilder = isBuilder;
@@ -174,13 +180,13 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), //
ResourcesPlugin.getWorkspace().getRoot(), false, Messages.launchChoosePomDir); //$NON-NLS-1$
dialog.showClosedProjects(false);
-
+
int buttonId = dialog.open();
if(buttonId == IDialogConstants.OK_ID) {
Object[] resource = dialog.getResult();
if(resource != null && resource.length > 0) {
- String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression(
- "workspace_loc", ((IPath) resource[0]).toString()); //$NON-NLS-1$
+ String fileLoc = VariablesPlugin.getDefault().getStringVariableManager()
+ .generateVariableExpression("workspace_loc", ((IPath) resource[0]).toString()); //$NON-NLS-1$
pomDirNameText.setText(fileLoc);
entriesChanged();
}
@@ -214,7 +220,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
}
}
});
-
+
// pom file
// goals
@@ -248,7 +254,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
goalsManualBuildButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
goalsManualBuildButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnManualBuild);
goalsManualBuildButton.addSelectionListener(new GoalSelectionAdapter(goalsManualBuildText));
-
+
Label cleanBuildGoalsLabel = new Label(mainComposite, SWT.NONE);
cleanBuildGoalsLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblCleanBuild);
goalsCleanText = new Text(mainComposite, SWT.BORDER);
@@ -259,7 +265,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
goalsCleanButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
goalsCleanButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnCleanBuild);
goalsCleanButton.addSelectionListener(new GoalSelectionAdapter(goalsCleanText));
-
+
Label afterCleanGoalsLabel = new Label(mainComposite, SWT.NONE);
afterCleanGoalsLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblAfterClean);
goalsAfterCleanText = new Text(mainComposite, SWT.BORDER);
@@ -270,7 +276,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
goalsAfterCleanButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
goalsAfterCleanButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnAfterClean);
goalsAfterCleanButton.addSelectionListener(new GoalSelectionAdapter(goalsAfterCleanText));
-
+
} else {
Label goalsLabel = new Label(mainComposite, SWT.NONE);
GridData gd_goalsLabel = new GridData();
@@ -358,14 +364,14 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
}
}
});
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
TableItem[] items = propsTable.getSelection();
- if(items == null || items.length == 0){
+ if(items == null || items.length == 0) {
editPropButton.setEnabled(false);
removePropButton.setEnabled(false);
- } else if(items.length == 1){
+ } else if(items.length == 1) {
editPropButton.setEnabled(true);
removePropButton.setEnabled(true);
} else {
@@ -373,12 +379,12 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
removePropButton.setEnabled(true);
}
}
-
+
});
-
+
this.propsTable = tableViewer.getTable();
//this.tProps.setItemCount(10);
- this.propsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 3));
+ this.propsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 3));
this.propsTable.setLinesVisible(true);
this.propsTable.setHeaderVisible(true);
@@ -458,12 +464,12 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
entriesChanged();
}
});
-
+
MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();
runtimeComboViewer.setInput(runtimeManager.getMavenRuntimes());
runtimeComboViewer.setSelection(new StructuredSelection(runtimeManager.getDefaultRuntime()));
}
-
+
Button configureRuntimesButton = new Button(mainComposite, SWT.NONE);
GridData gd_configureRuntimesButton = new GridData(SWT.FILL, SWT.CENTER, false, false);
configureRuntimesButton.setLayoutData(gd_configureRuntimesButton);
@@ -477,20 +483,21 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
runtimeComboViewer.setSelection(new StructuredSelection(runtimeManager.getDefaultRuntime()));
}
});
-
+
if(isBuilder) {
goalsAutoBuildText.setFocus();
} else {
goalsText.setFocus();
}
}
-
+
protected Shell getShell() {
return super.getShell();
}
void addProperty() {
- MavenPropertyDialog dialog = getMavenPropertyDialog(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_property_dialog_title, "", ""); //$NON-NLS-2$ //$NON-NLS-3$
+ MavenPropertyDialog dialog = getMavenPropertyDialog(
+ org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_property_dialog_title, "", ""); //$NON-NLS-2$ //$NON-NLS-3$
if(dialog.open() == IDialogConstants.OK_ID) {
TableItem item = new TableItem(propsTable, SWT.NONE);
item.setText(0, dialog.getName());
@@ -500,7 +507,8 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
}
void editProperty(String name, String value) {
- MavenPropertyDialog dialog = getMavenPropertyDialog(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_property_dialog_edit_title, name, value);
+ MavenPropertyDialog dialog = getMavenPropertyDialog(
+ org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_property_dialog_edit_title, name, value);
if(dialog.open() == IDialogConstants.OK_ID) {
TableItem[] item = propsTable.getSelection();
item[0].setText(0, dialog.getName());
@@ -522,7 +530,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
variablesButton.setLayoutData(gd);
variablesButton.setFont(comp.getFont());
variablesButton.setText(Messages.launchPropertyDialogBrowseVariables); //$NON-NLS-1$;
-
+
variablesButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
StringVariableSelectionDialog variablesDialog = new StringVariableSelectionDialog(getShell());
@@ -534,19 +542,19 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
}
}
});
-
+
return comp;
}
};
}
-
+
public void initializeFrom(ILaunchConfiguration configuration) {
String pomDirName = getAttribute(configuration, ATTR_POM_DIR, ""); //$NON-NLS-1$
- if(isBuilder && pomDirName.length()==0) {
+ if(isBuilder && pomDirName.length() == 0) {
pomDirName = "${workspace_loc:/" + configuration.getFile().getProject().getName() + "}"; //$NON-NLS-1$ //$NON-NLS-2$
}
this.pomDirNameText.setText(pomDirName);
-
+
if(isBuilder) {
this.goalsAutoBuildText.setText(getAttribute(configuration, ATTR_GOALS_AUTO_BUILD, "install")); //$NON-NLS-1$
this.goalsManualBuildText.setText(getAttribute(configuration, ATTR_GOALS_MANUAL_BUILD, "install")); //$NON-NLS-1$
@@ -555,28 +563,29 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
} else {
this.goalsText.setText(getAttribute(configuration, ATTR_GOALS, "")); //$NON-NLS-1$
}
-
+
this.profilesText.setText(getAttribute(configuration, ATTR_PROFILES, "")); //$NON-NLS-1$
try {
-
+
MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();
IMavenConfiguration mavenConfiguration = MavenPlugin.getMavenConfiguration();
-
+
this.offlineButton.setSelection(getAttribute(configuration, ATTR_OFFLINE, mavenConfiguration.isOffline()));
- this.debugOutputButton.setSelection(getAttribute(configuration, ATTR_DEBUG_OUTPUT, mavenConfiguration.isDebugOutput()));
-
+ this.debugOutputButton.setSelection(getAttribute(configuration, ATTR_DEBUG_OUTPUT,
+ mavenConfiguration.isDebugOutput()));
+
this.updateSnapshotsButton.setSelection(getAttribute(configuration, ATTR_UPDATE_SNAPSHOTS, false));
this.skipTestsButton.setSelection(getAttribute(configuration, ATTR_SKIP_TESTS, false));
this.nonRecursiveButton.setSelection(getAttribute(configuration, ATTR_NON_RECURSIVE, false));
this.enableWorkspaceResolution.setSelection(getAttribute(configuration, ATTR_WORKSPACE_RESOLUTION, false));
-
+
String location = getAttribute(configuration, ATTR_RUNTIME, ""); //$NON-NLS-1$
MavenRuntime runtime = runtimeManager.getRuntime(location);
- if(runtime != null){
+ if(runtime != null) {
this.runtimeComboViewer.setSelection(new StructuredSelection(runtime));
- }
+ }
propsTable.removeAll();
-
+
@SuppressWarnings("unchecked")
List<String> properties = configuration.getAttribute(ATTR_PROPERTIES, Collections.EMPTY_LIST);
for(String property : properties) {
@@ -589,7 +598,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
value = property.substring(n + 1);
}
}
-
+
TableItem item = new TableItem(propsTable, SWT.NONE);
item.setText(0, name);
item.setText(1, value);
@@ -599,7 +608,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
}
setDirty(false);
}
-
+
private String getAttribute(ILaunchConfiguration configuration, String name, String defaultValue) {
try {
return configuration.getAttribute(name, defaultValue);
@@ -616,38 +625,38 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
return defaultValue;
}
}
-
+
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(ATTR_POM_DIR, this.pomDirNameText.getText());
-
+
if(isBuilder) {
configuration.setAttribute(ATTR_GOALS_AUTO_BUILD, goalsAutoBuildText.getText());
configuration.setAttribute(ATTR_GOALS_MANUAL_BUILD, this.goalsManualBuildText.getText());
configuration.setAttribute(ATTR_GOALS_CLEAN, this.goalsCleanText.getText());
configuration.setAttribute(ATTR_GOALS_AFTER_CLEAN, this.goalsAfterCleanText.getText());
-
+
StringBuffer sb = new StringBuffer();
- if(goalsAfterCleanText.getText().trim().length()>0) {
+ if(goalsAfterCleanText.getText().trim().length() > 0) {
sb.append(IExternalToolConstants.BUILD_TYPE_FULL).append(',');
}
- if(goalsManualBuildText.getText().trim().length()>0) {
+ if(goalsManualBuildText.getText().trim().length() > 0) {
sb.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(',');
}
- if(goalsAutoBuildText.getText().trim().length()>0) {
+ if(goalsAutoBuildText.getText().trim().length() > 0) {
sb.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(',');
}
- if(goalsCleanText.getText().trim().length()>0) {
+ if(goalsCleanText.getText().trim().length() > 0) {
sb.append(IExternalToolConstants.BUILD_TYPE_CLEAN);
}
configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, sb.toString());
-
+
} else {
configuration.setAttribute(ATTR_GOALS, this.goalsText.getText());
}
-
+
configuration.setAttribute(ATTR_PROFILES, this.profilesText.getText());
configuration.setAttribute(ATTR_OFFLINE, this.offlineButton.getSelection());
@@ -716,21 +725,19 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
updateLaunchConfigurationDialog();
}
-
private static final class GoalsFocusListener extends FocusAdapter {
private Text text;
public GoalsFocusListener(Text text) {
this.text = text;
}
-
+
public void focusGained(FocusEvent e) {
super.focusGained(e);
text.setData("focus"); //$NON-NLS-1$
}
}
-
private final class GoalSelectionAdapter extends SelectionAdapter {
private Text text;
@@ -748,12 +755,12 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
MavenGoalSelectionDialog dialog = new MavenGoalSelectionDialog(getShell());
int rc = dialog.open();
if(rc == IDialogConstants.OK_ID) {
- text.insert(""); // clear selected text //$NON-NLS-1$
-
+ text.insert(""); // clear selected text //$NON-NLS-1$
+
String txt = text.getText();
int len = txt.length();
int pos = text.getCaretPosition();
-
+
StringBuffer sb = new StringBuffer();
if((pos > 0 && txt.charAt(pos - 1) != ' ')) {
sb.append(' ');
@@ -771,16 +778,16 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
}
sep = " "; //$NON-NLS-1$
}
-
+
if(pos < len && txt.charAt(pos) != ' ') {
sb.append(' ');
}
-
+
text.insert(sb.toString());
text.setFocus();
entriesChanged();
}
}
}
-
+
}

Back to the top