Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java2
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java15
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java2
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties3
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java61
5 files changed, 74 insertions, 9 deletions
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 535f61c0..6dd33070 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
@@ -59,4 +59,6 @@ public interface MavenLaunchConstants {
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 ATTR_THREADS = "M2_THREADS"; //$NON-NLS-1$
}
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 51cedc74..b24cf74f 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
@@ -182,11 +182,11 @@ public class MavenLaunchDelegate extends JavaLaunchDelegate implements MavenLaun
public String getVMArguments(ILaunchConfiguration configuration) throws CoreException {
/*
* <pre>
- * %MAVEN_JAVA_EXE% %MAVEN_OPTS%
- * -classpath %CLASSWORLDS_JAR%
- * "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf"
- * "-Dmaven.home=%M2_HOME%"
- * org.codehaus.classworlds.Launcher
+ * %MAVEN_JAVA_EXE% %MAVEN_OPTS%
+ * -classpath %CLASSWORLDS_JAR%
+ * "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf"
+ * "-Dmaven.home=%M2_HOME%"
+ * org.codehaus.classworlds.Launcher
* %MAVEN_CMD_LINE_ARGS%
* </pre>
*/
@@ -313,6 +313,11 @@ public class MavenLaunchDelegate extends JavaLaunchDelegate implements MavenLaun
sb.append(" -Dmaven.test.skip=true"); //$NON-NLS-1$
}
+ String threads = configuration.getAttribute(MavenLaunchConstants.ATTR_THREADS, (String) null);
+ if(threads != null && threads.trim().length() > 0) {
+ sb.append(" --threads ").append(threads);
+ }
+
String settings = configuration.getAttribute(MavenLaunchConstants.ATTR_USER_SETTINGS, (String) null);
if(settings == null || settings.trim().length() <= 0) {
settings = mavenConfiguration.getUserSettingsFile();
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java
index 4bb742c3..ad9938a4 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java
@@ -53,6 +53,8 @@ public class Messages extends NLS {
public static String MavenLaunchMainTab_btnSkipTests;
+ public static String MavenLaunchMainTab_lblThreads;
+
public static String MavenLaunchMainTab_btnUpdateSnapshots;
public static String MavenLaunchMainTab_lblAfterClean;
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties
index 73e5aa22..16a68c90 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties
@@ -3,7 +3,7 @@ ExecutePomAction_dialog_run_message=Select a launch configuration to run:
ExecutePomAction_dialog_title=Select Configuration
ExecutePomAction_executing=Executing {0} in {1}
MavenFileEditorInput_0=Unable to open {0}
-MavenLaunchDelegate_error_cannot_create_conf=Can't create m2.conf
+MavenLaunchDelegate_error_cannot_create_conf=Can't create m2.conf
MavenLaunchDelegate_job_name=Refreshing resources...
MavenLaynchDelegate_unsupported_source_locator=Unknown or unsupported source locator {0}
MavenLaunchMainTab_btnAfterClean=Selec&t...
@@ -22,6 +22,7 @@ MavenLaunchMainTab_lblAutoBuildGoals=Auto &Build Goals:
MavenLaunchMainTab_lblCleanBuild=&During a Clean Goals:
MavenLaunchMainTab_lblManualGoals=Ma&nual Build Goals:
MavenLaunchMainTab_lblRuntime=Maven Runt&ime:
+MavenLaunchMainTab_lblThreads=&Threads
MavenLaunchMainTab_property_dialog_edit_title=Edit Parameter
MavenLaunchMainTab_property_dialog_title=Add Parameter
MavenLaunchExtensionsTab_name=Launch Extensions
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 83115dd1..c8cede6a 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
@@ -123,6 +123,8 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
ComboViewer runtimeComboViewer;
+ private ComboViewer threadsComboViewer;
+
public MavenLaunchMainTab(boolean isBuilder) {
this.isBuilder = isBuilder;
}
@@ -221,7 +223,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
}
});
- // pom file
+ // pom file
// goals
@@ -355,6 +357,54 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
enableWorkspaceResolution.setData("name", "enableWorkspaceResolution"); //$NON-NLS-1$ //$NON-NLS-2$
enableWorkspaceResolution.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnResolveWorkspace);
+ final int processors = Runtime.getRuntime().availableProcessors();
+ if(processors > 1) {
+ Composite composite = new Composite(mainComposite, SWT.NONE);
+ composite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+ GridLayout gridLayout = new GridLayout(2, false);
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ composite.setLayout(gridLayout);
+
+ final Object[] threadsToUse = new Object[processors];
+ for(int i = 1; i <= processors; i++ ) {
+ threadsToUse[i - 1] = i + "";
+ }
+
+ threadsComboViewer = new ComboViewer(composite, SWT.BORDER | SWT.READ_ONLY | SWT.SINGLE);
+ threadsComboViewer.getCombo().setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ threadsComboViewer.setContentProvider(new IStructuredContentProvider() {
+
+ @Override
+ public Object[] getElements(Object input) {
+ return threadsToUse;
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+ });
+
+ threadsComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ entriesChanged();
+ }
+ });
+
+ threadsComboViewer.setInput("1");
+ threadsComboViewer.setSelection(new StructuredSelection("1"));
+
+ Label threadsLabel = new Label(composite, SWT.NONE);
+ threadsLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ threadsLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblThreads);
+ threadsLabel.setToolTipText("--threads"); //$NON-NLS-1$
+ }
+
TableViewer tableViewer = new TableViewer(mainComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
@@ -578,6 +628,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
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));
+ this.threadsComboViewer.setSelection(new StructuredSelection(getAttribute(configuration, ATTR_THREADS, ""))); //$NON-NLS-1$
String location = getAttribute(configuration, ATTR_RUNTIME, ""); //$NON-NLS-1$
MavenRuntime runtime = runtimeManager.getRuntime(location);
@@ -670,7 +721,11 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
MavenRuntime runtime = (MavenRuntime) selection.getFirstElement();
configuration.setAttribute(ATTR_RUNTIME, runtime.getLocation());
- // store as String in "param=value" format
+ IStructuredSelection threadsSelection = (IStructuredSelection) threadsComboViewer.getSelection();
+ String threads = (String) threadsSelection.getFirstElement();
+ configuration.setAttribute(ATTR_THREADS, threads);
+
+ // store as String in "param=value" format
List<String> properties = new ArrayList<String>();
for(TableItem item : this.propsTable.getItems()) {
String p = item.getText(0);
@@ -748,7 +803,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
public void widgetSelected(SelectionEvent e) {
// String fileName = Util.substituteVar(fPomDirName.getText());
// if(!isDirectoryExist(fileName)) {
-// MessageDialog.openError(getShell(), Messages.getString("launch.errorPomMissing"),
+// MessageDialog.openError(getShell(), Messages.getString("launch.errorPomMissing"),
// Messages.getString("launch.errorSelectPom")); //$NON-NLS-1$ //$NON-NLS-2$
// return;
// }

Back to the top