Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-12-25 23:41:08 -0500
committerIgor Fedorenko2011-12-25 23:41:08 -0500
commit03f3b21e013835193841a7f9aae0efaecfae5802 (patch)
treeaae68d3f53209f84299b330cd0f0f0823c51f34f
parent19b0c62a980b79b4db0340aeb0900f22e9022b43 (diff)
downloadm2e-core-03f3b21e013835193841a7f9aae0efaecfae5802.tar.gz
m2e-core-03f3b21e013835193841a7f9aae0efaecfae5802.tar.xz
m2e-core-03f3b21e013835193841a7f9aae0efaecfae5802.zip
367547 single action to update dependencies, configuration and rebuild
Collapsed "Update Dependencies" and "Update Configuration" actions and corresponding dialogs into sigle "Update Project" action. Added option to execute clean build after the update. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core.ui/plugin.properties3
-rw-r--r--org.eclipse.m2e.core.ui/plugin.xml38
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java38
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/UpdateMavenProjectJob.java (renamed from org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/UpdateConfigurationJob.java)77
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenProjectActionSupport.java2
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateDependenciesAction.java39
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateMavenProjectAction.java (renamed from org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateConfigurationAction.java)13
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateConfigurationDialog.java33
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateDependenciesDialog.java33
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java (renamed from org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/SelectMavenProjectsDialog.java)111
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/markers/MarkerResolutionGenerator.java6
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties30
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java4
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/startup/UpdateConfigurationStartup.java6
14 files changed, 176 insertions, 257 deletions
diff --git a/org.eclipse.m2e.core.ui/plugin.properties b/org.eclipse.m2e.core.ui/plugin.properties
index aaa02534..8836c143 100644
--- a/org.eclipse.m2e.core.ui/plugin.properties
+++ b/org.eclipse.m2e.core.ui/plugin.properties
@@ -26,8 +26,7 @@ m2.popup.project.update-sources.label=Update Source Folders
m2.popup.ModuleProjectWizardAction=New &Maven Module Project
m2.popup.AddPluginAction=Add &Plugin
m2.popup.AddDependencyAction=Add &Dependency
-m2.popup.UpdateConfigurationAction=Update Project &Configuration...
-m2.popup.RefreshMavenModelsAction=&Update Dependencies...
+m2.popup.UpdateMavenProjectAction=&Update Project...
m2.popup.OpenUrlAction.openCiPage=Open Continuous Integration
m2.popup.OpenUrlAction.openScmPage=Open Source Control
m2.popup.OpenUrlAction.openIssuesPage=Open Issue Tracker
diff --git a/org.eclipse.m2e.core.ui/plugin.xml b/org.eclipse.m2e.core.ui/plugin.xml
index 82708f87..22f1b929 100644
--- a/org.eclipse.m2e.core.ui/plugin.xml
+++ b/org.eclipse.m2e.core.ui/plugin.xml
@@ -110,9 +110,9 @@
<objectContribution id="org.eclipse.m2e.updateConfigurationAction"
objectClass="org.eclipse.core.resources.IProject"
adaptable="true">
- <action id="org.eclipse.m2e.updateConfigurationAction"
- class="org.eclipse.m2e.core.ui.internal.actions.UpdateConfigurationAction"
- label="%m2.popup.UpdateConfigurationAction"
+ <action id="org.eclipse.m2e.updateProjectAction"
+ class="org.eclipse.m2e.core.ui.internal.actions.UpdateMavenProjectAction"
+ label="%m2.popup.UpdateMavenProjectAction"
style="push"
icon="icons/update_dependencies.gif"
menubarPath="org.eclipse.m2e.core.mavenMenu/update"
@@ -125,23 +125,6 @@
</visibility>
</objectContribution>
- <objectContribution id="org.eclipse.m2e.refreshMavenModelsAction"
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true">
- <action id="org.eclipse.m2e.refreshMavenModelsAction"
- class="org.eclipse.m2e.core.ui.internal.actions.UpdateDependenciesAction"
- label="%m2.popup.RefreshMavenModelsAction"
- style="push"
- menubarPath="org.eclipse.m2e.core.mavenMenu/update"
- enablesFor="+"/>
- <visibility>
- <and>
- <objectState name="open" value="true"/>
- <objectState name="nature" value="org.eclipse.m2e.core.maven2Nature"/>
- </and>
- </visibility>
- </objectContribution>
-
<objectContribution id="org.eclipse.m2e.disableAction"
objectClass="org.eclipse.core.resources.IProject"
adaptable="true">
@@ -263,19 +246,8 @@
adaptable="true"
objectClass="org.eclipse.ui.IWorkingSet">
<action id="org.eclipse.m2e.updateConfigurationAction"
- class="org.eclipse.m2e.core.ui.internal.actions.UpdateConfigurationAction"
- label="%m2.popup.UpdateConfigurationAction"
- style="push"
- menubarPath="org.eclipse.m2e.core.workingSetMenu/update"
- enablesFor="+"/>
- </objectContribution>
-
- <objectContribution id="org.eclipse.m2e.workingSet.refreshMavenModelsAction"
- adaptable="true"
- objectClass="org.eclipse.ui.IWorkingSet">
- <action id="org.eclipse.m2e.refreshMavenModelsAction"
- class="org.eclipse.m2e.core.ui.internal.actions.UpdateDependenciesAction"
- label="%m2.popup.RefreshMavenModelsAction"
+ class="org.eclipse.m2e.core.ui.internal.actions.UpdateMavenProjectAction"
+ label="%m2.popup.UpdateMavenProjectAction"
style="push"
menubarPath="org.eclipse.m2e.core.workingSetMenu/update"
enablesFor="+"/>
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
index 98d72897..bb63cebf 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
@@ -514,28 +514,6 @@ public class Messages extends NLS {
public static String MavenRepositoryView_update_one;
- public static String MavenSearchPage_btnBrowse;
-
- public static String MavenSearchPage_btnSelect;
-
- public static String MavenSearchPage_btnUnselect;
-
- public static String MavenSearchPage_lblArtifactid;
-
- public static String MavenSearchPage_lblClass;
-
- public static String MavenSearchPage_lblGroupid;
-
- public static String MavenSearchPage_lblPackaging;
-
- public static String MavenSearchPage_lblRepos;
-
- public static String MavenSearchPage_lblSha;
-
- public static String MavenSearchPage_lblVersion;
-
- public static String MavenSearchPage_separator;
-
public static String MavenSettingsPreferencePage_btnBrowse;
public static String MavenSettingsPreferencePage_btnUpdate;
@@ -616,8 +594,6 @@ public class Messages extends NLS {
public static String UpdateDepenciesDialog_deselectTree;
- public static String UpdateDepenciesDialog_dialogMessage;
-
public static String UpdateDepenciesDialog_expandAll;
public static String UpdateDepenciesDialog_forceUpdate;
@@ -628,11 +604,9 @@ public class Messages extends NLS {
public static String UpdateDepenciesDialog_selectTree;
- public static String UpdateDepenciesDialog_title;
-
- public static String UpdateConfigurationDialog_title;
-
- public static String UpdateConfigurationDialog_dialogMessage;
+ public static String UpdateMavenProjectDialog_title;
+
+ public static String UpdateMavenProjectDialog_dialogMessage;
public static String UpdateSourcesAction_error_cannot_update;
@@ -836,6 +810,12 @@ public class Messages extends NLS {
public static String ProjectRepositoriesNode_name;
+ public static String UpdateMavenProjectDialog_btnCheckButton_text;
+
+ public static String UpdateMavenProjectDialog_btnUpdateProjectConfiguration_text;
+
+ public static String UpdateMavenProjectDialog_btnCleanFullBuild_text;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/UpdateConfigurationJob.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/UpdateMavenProjectJob.java
index a517aa21..b40e869e 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/UpdateConfigurationJob.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/UpdateMavenProjectJob.java
@@ -18,6 +18,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -31,38 +33,49 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.IMavenProjectRegistry;
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
import org.eclipse.m2e.core.project.MavenUpdateRequest;
import org.eclipse.m2e.core.ui.internal.actions.OpenMavenConsoleAction;
import org.eclipse.m2e.core.ui.internal.util.M2EUIUtils;
-public class UpdateConfigurationJob extends WorkspaceJob {
- private static final Logger log = LoggerFactory.getLogger(UpdateConfigurationJob.class);
+public class UpdateMavenProjectJob extends WorkspaceJob {
+ private static final Logger log = LoggerFactory.getLogger(UpdateMavenProjectJob.class);
private final IProject[] projects;
private final boolean offline;
- private final boolean forceUpdate;
+ private final boolean forceUpdateDependencies;
- public UpdateConfigurationJob(IProject[] projects) {
- this(projects, MavenPlugin.getMavenConfiguration().isOffline(), false /*forceUpdate*/);
+ private final boolean updateConfiguration;
+
+ private final boolean rebuild;
+
+ public UpdateMavenProjectJob(IProject[] projects) {
+ this(projects, MavenPlugin.getMavenConfiguration().isOffline(), false /*forceUpdateDependencies*/,
+ true /*updateConfiguration*/, true /*rebuild*/);
}
- public UpdateConfigurationJob(IProject[] projects, boolean offline, boolean forceUpdate) {
+ public UpdateMavenProjectJob(IProject[] projects, boolean offline, boolean forceUpdateDependencies,
+ boolean updateConfiguration, boolean rebuild) {
+
super(Messages.UpdateSourcesAction_job_update_conf);
+
this.projects = projects;
this.offline = offline;
- this.forceUpdate = forceUpdate;
+ this.forceUpdateDependencies = forceUpdateDependencies;
+ this.updateConfiguration = updateConfiguration;
+ this.rebuild = rebuild;
setRule(MavenPlugin.getProjectConfigurationManager().getRule());
}
public IStatus runInWorkspace(IProgressMonitor monitor) {
IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
+ IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();
+ boolean autoBuilding = ResourcesPlugin.getWorkspace().isAutoBuilding();
setProperty(IProgressConstants.ACTION_PROPERTY, new OpenMavenConsoleAction());
monitor.beginTask(getName(), projects.length);
@@ -80,25 +93,37 @@ public class UpdateConfigurationJob extends WorkspaceJob {
}
monitor.subTask(project.getName());
- IMavenProjectFacade projectFacade = MavenPlugin.getMavenProjectRegistry().create(project, monitor);
- if(projectFacade != null) {
- try {
- MavenUpdateRequest request = new MavenUpdateRequest(project, offline, forceUpdate);
- configurationManager.updateProjectConfiguration(request, new SubProgressMonitor(monitor, 1));
- } catch(CoreException ex) {
- if(status == null) {
- status = new MultiStatus(IMavenConstants.PLUGIN_ID, IStatus.ERROR, //
- Messages.UpdateSourcesAction_error_cannot_update, null);
+ SubProgressMonitor submonitor = new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL);
+
+ try {
+ MavenUpdateRequest request = new MavenUpdateRequest(project, offline, forceUpdateDependencies);
+ if(updateConfiguration) {
+ configurationManager.updateProjectConfiguration(request, submonitor);
+ } else {
+ projectRegistry.refresh(request, submonitor);
+ }
+ // only rebuild projects that were successfully updated
+ if(rebuild) {
+ project.build(IncrementalProjectBuilder.CLEAN_BUILD, submonitor);
+ if(autoBuilding) {
+ // TODO this is not enough, in most cases we need to re-run the build several times
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, submonitor);
}
- status.add(ex.getStatus());
- updateErrors.put(project.getName(), ex);
- } catch(IllegalArgumentException e) {
- status = new MultiStatus(IMavenConstants.PLUGIN_ID, IStatus.ERROR, //
+ }
+ } catch(CoreException ex) {
+ if(status == null) {
+ status = new MultiStatus(M2EUIPluginActivator.PLUGIN_ID, IStatus.ERROR, //
Messages.UpdateSourcesAction_error_cannot_update, null);
- updateErrors.put(project.getName(), e);
}
+ status.add(ex.getStatus());
+ updateErrors.put(project.getName(), ex);
+ } catch(IllegalArgumentException e) {
+ status = new MultiStatus(M2EUIPluginActivator.PLUGIN_ID, IStatus.ERROR, //
+ Messages.UpdateSourcesAction_error_cannot_update, null);
+ updateErrors.put(project.getName(), e);
}
}
+
if(updateErrors.size() > 0) {
handleErrors(updateErrors);
}
@@ -113,10 +138,10 @@ public class UpdateConfigurationJob extends WorkspaceJob {
if(display != null) {
display.asyncExec(new Runnable() {
public void run() {
- M2EUIUtils.showErrorsForProjectsDialog(display.getActiveShell(),
- Messages.UpdateSourcesAction_error_title, Messages.UpdateSourcesAction_error_message, updateErrors);
+ M2EUIUtils.showErrorsForProjectsDialog(display.getActiveShell(), Messages.UpdateSourcesAction_error_title,
+ Messages.UpdateSourcesAction_error_message, updateErrors);
}
});
}
}
-} \ No newline at end of file
+}
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenProjectActionSupport.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenProjectActionSupport.java
index 6dc049a2..514c0273 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenProjectActionSupport.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenProjectActionSupport.java
@@ -30,7 +30,7 @@ import org.eclipse.m2e.core.internal.IMavenConstants;
public abstract class MavenProjectActionSupport extends MavenActionSupport implements IWorkbenchWindowActionDelegate {
- private static final Logger log = LoggerFactory.getLogger(UpdateDependenciesAction.class);
+ private static final Logger log = LoggerFactory.getLogger(MavenProjectActionSupport.class);
protected IProject[] getProjects() {
ArrayList<IProject> projectList = new ArrayList<IProject>();
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateDependenciesAction.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateDependenciesAction.java
deleted file mode 100644
index 9199c789..00000000
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateDependenciesAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.m2e.core.ui.internal.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.project.IMavenProjectRegistry;
-import org.eclipse.m2e.core.project.MavenUpdateRequest;
-import org.eclipse.m2e.core.ui.internal.dialogs.UpdateDependenciesDialog;
-
-
-public class UpdateDependenciesAction extends MavenProjectActionSupport {
-
- public static final String ID = "org.eclipse.m2e.refreshMavenModelsAction"; //$NON-NLS-1$
-
- public UpdateDependenciesAction() {
- }
-
- public void run(IAction action) {
- UpdateDependenciesDialog dialog = new UpdateDependenciesDialog(getShell(), getProjects());
- if(dialog.open() == Window.OK) {
- IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry();
- projectManager.refresh(new MavenUpdateRequest(dialog.getSelectedProjects(), //
- dialog.isOffline(), dialog.isForceUpdate()));
- }
- }
-
-}
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateConfigurationAction.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateMavenProjectAction.java
index 21cbe72b..12c317f1 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateConfigurationAction.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/UpdateMavenProjectAction.java
@@ -14,21 +14,22 @@ package org.eclipse.m2e.core.ui.internal.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.window.Window;
-import org.eclipse.m2e.core.ui.internal.UpdateConfigurationJob;
-import org.eclipse.m2e.core.ui.internal.dialogs.UpdateConfigurationDialog;
+import org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob;
+import org.eclipse.m2e.core.ui.internal.dialogs.UpdateMavenProjectsDialog;
-public class UpdateConfigurationAction extends MavenProjectActionSupport {
+public class UpdateMavenProjectAction extends MavenProjectActionSupport {
public static final String ID = "org.eclipse.m2e.updateConfigurationAction"; //$NON-NLS-1$
- public UpdateConfigurationAction() {
+ public UpdateMavenProjectAction() {
}
public void run(IAction action) {
- UpdateConfigurationDialog dialog = new UpdateConfigurationDialog(getShell(), getProjects());
+ UpdateMavenProjectsDialog dialog = new UpdateMavenProjectsDialog(getShell(), getProjects());
if(dialog.open() == Window.OK) {
- new UpdateConfigurationJob(dialog.getSelectedProjects(), dialog.isOffline(), dialog.isForceUpdate()).schedule();
+ new UpdateMavenProjectJob(dialog.getSelectedProjects(), dialog.isOffline(), dialog.isForceUpdateDependencies(),
+ dialog.isUpdateConfiguration(), dialog.isRebuild()).schedule();
}
}
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateConfigurationDialog.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateConfigurationDialog.java
deleted file mode 100644
index a6cc2579..00000000
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateConfigurationDialog.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.m2e.core.ui.internal.dialogs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.m2e.core.ui.internal.Messages;
-
-/**
- * Update Maven Project Configuration Dialog
- *
- * @author Fred Bricon
- */
-public class UpdateConfigurationDialog extends SelectMavenProjectsDialog {
-
- /**
- * @param parentShell
- * @param initialSelection
- */
- public UpdateConfigurationDialog(Shell parentShell, IProject[] initialSelection) {
- super(parentShell, initialSelection, Messages.UpdateConfigurationDialog_title, Messages.UpdateConfigurationDialog_dialogMessage);
- }
-
-}
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateDependenciesDialog.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateDependenciesDialog.java
deleted file mode 100644
index 489035c2..00000000
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateDependenciesDialog.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.m2e.core.ui.internal.dialogs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.m2e.core.ui.internal.Messages;
-
-/**
- * Update Maven Project Dependencies Dialog
- *
- * @author Fred Bricon
- */
-public class UpdateDependenciesDialog extends SelectMavenProjectsDialog {
-
- /**
- * @param parentShell
- * @param initialSelection
- */
- public UpdateDependenciesDialog(Shell parentShell, IProject[] initialSelection) {
- super(parentShell, initialSelection, Messages.UpdateDepenciesDialog_title, Messages.UpdateDepenciesDialog_dialogMessage);
- }
-
-}
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/SelectMavenProjectsDialog.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java
index f8a6c846..a5ba0b6d 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/SelectMavenProjectsDialog.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java
@@ -8,6 +8,7 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
+
package org.eclipse.m2e.core.ui.internal.dialogs;
import java.io.File;
@@ -60,9 +61,10 @@ import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.ui.internal.MavenImages;
import org.eclipse.m2e.core.ui.internal.Messages;
-public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuListener {
- private static final Logger log = LoggerFactory.getLogger(SelectMavenProjectsDialog.class);
+public class UpdateMavenProjectsDialog extends TitleAreaDialog implements IMenuListener {
+
+ private static final Logger log = LoggerFactory.getLogger(UpdateMavenProjectsDialog.class);
private static final String SEPARATOR = System.getProperty("file.separator"); //$NON-NLS-1$
@@ -82,19 +84,31 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
private boolean offlineMode;
- private boolean forceUpdate;
-
+ /**
+ * Force update of snapshots and releases from remote repositories
+ */
+ private boolean forceUpdateDependencies;
+
+ /**
+ * Update project configuration
+ */
+ private boolean updateConfiguration;
+
+ /**
+ * Perform full/clean build after project update
+ */
+ private boolean rebuild;
+
protected String dialogTitle;
-
+
protected String dialogMessage;
-
- public SelectMavenProjectsDialog(Shell parentShell, IProject[] initialSelection, String title, String dialogMessage) {
+
+ public UpdateMavenProjectsDialog(Shell parentShell, IProject[] initialSelection) {
super(parentShell);
this.initialSelection = initialSelection;
- this.dialogTitle = title;
- this.dialogMessage = dialogMessage;
+ this.dialogTitle = Messages.UpdateMavenProjectDialog_title;
+ this.dialogMessage = Messages.UpdateMavenProjectDialog_dialogMessage;
offlineMode = MavenPlugin.getMavenConfiguration().isOffline();
- forceUpdate = false;
}
@Override
@@ -105,6 +119,7 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
/**
* Create contents of the dialog.
+ *
* @param parent
*/
@Override
@@ -112,7 +127,7 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
-
+
GridLayout layout = new GridLayout(2, false);
layout.marginLeft = 12;
container.setLayout(layout);
@@ -207,12 +222,16 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
}
Tree tree = codebaseViewer.getTree();
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gd.heightHint = 300;
gd.widthHint = 300;
tree.setLayoutData(gd);
- Button selectAllBtn = new Button(container, SWT.NONE);
+ Composite selectionActionComposite = new Composite(container, SWT.NONE);
+ selectionActionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
+ selectionActionComposite.setLayout(new GridLayout(1, false));
+
+ Button selectAllBtn = new Button(selectionActionComposite, SWT.NONE);
selectAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
selectAllBtn.setText(Messages.UpdateDepenciesDialog_selectAll);
selectAllBtn.addSelectionListener(new SelectionListener() {
@@ -227,7 +246,7 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
}
});
- Button deselectAllBtn = new Button(container, SWT.NONE);
+ Button deselectAllBtn = new Button(selectionActionComposite, SWT.NONE);
deselectAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
deselectAllBtn.setText(Messages.UpdateDepenciesDialog_deselectAll);
deselectAllBtn.addSelectionListener(new SelectionListener() {
@@ -242,8 +261,8 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
}
});
- Button expandAllBtn = new Button(container, SWT.NONE);
- expandAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, true, 1, 1));
+ Button expandAllBtn = new Button(selectionActionComposite, SWT.NONE);
+ expandAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
expandAllBtn.setText(Messages.UpdateDepenciesDialog_expandAll);
expandAllBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
@@ -254,7 +273,7 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
}
});
- Button collapseAllBtn = new Button(container, SWT.NONE);
+ Button collapseAllBtn = new Button(selectionActionComposite, SWT.NONE);
collapseAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
collapseAllBtn.setText(Messages.UpdateDepenciesDialog_collapseAll);
collapseAllBtn.addSelectionListener(new SelectionListener() {
@@ -266,15 +285,38 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
}
});
- offlineModeBtn = new Button(container, SWT.CHECK);
+ Composite optionsComposite = new Composite(container, SWT.NONE);
+ optionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
+ optionsComposite.setLayout(new GridLayout(2, false));
+
+ offlineModeBtn = new Button(optionsComposite, SWT.CHECK);
+ offlineModeBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
offlineModeBtn.setText(Messages.UpdateDepenciesDialog_offline);
- offlineModeBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
offlineModeBtn.setSelection(offlineMode);
- forceUpdateBtn = new Button(container, SWT.CHECK);
+ Button btnCheckButton = new Button(optionsComposite, SWT.CHECK);
+ btnCheckButton.setEnabled(false);
+ btnCheckButton.setSelection(true);
+ btnCheckButton.setText(Messages.UpdateMavenProjectDialog_btnCheckButton_text);
+ new Label(optionsComposite, SWT.NONE);
+
+ forceUpdateBtn = new Button(optionsComposite, SWT.CHECK);
+ GridData gd_forceUpdateBtn = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_forceUpdateBtn.horizontalIndent = 15;
+ forceUpdateBtn.setLayoutData(gd_forceUpdateBtn);
forceUpdateBtn.setText(Messages.UpdateDepenciesDialog_forceUpdate);
- forceUpdateBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
- forceUpdateBtn.setSelection(forceUpdate);
+ forceUpdateBtn.setSelection(true);
+ new Label(optionsComposite, SWT.NONE);
+
+ btnUpdateProjectConfiguration = new Button(optionsComposite, SWT.CHECK);
+ btnUpdateProjectConfiguration.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+ btnUpdateProjectConfiguration.setSelection(true);
+ btnUpdateProjectConfiguration.setText(Messages.UpdateMavenProjectDialog_btnUpdateProjectConfiguration_text);
+
+ btnCleanFullBuild = new Button(optionsComposite, SWT.CHECK);
+ btnCleanFullBuild.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+ btnCleanFullBuild.setSelection(true);
+ btnCleanFullBuild.setText(Messages.UpdateMavenProjectDialog_btnCleanFullBuild_text);
setTitle(getDialogTitle());
setMessage(getDialogMessage());
@@ -284,6 +326,7 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
/**
* Create contents of the button bar.
+ *
* @param parent
*/
@Override
@@ -301,7 +344,9 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
selectedProjects = projects;
offlineMode = offlineModeBtn.getSelection();
- forceUpdate = forceUpdateBtn.getSelection();
+ forceUpdateDependencies = forceUpdateBtn.getSelection();
+ updateConfiguration = btnUpdateProjectConfiguration.getSelection();
+ rebuild = btnCleanFullBuild.getSelection();
super.okPressed();
}
@@ -355,8 +400,16 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
return offlineMode;
}
- public boolean isForceUpdate() {
- return forceUpdate;
+ public boolean isForceUpdateDependencies() {
+ return forceUpdateDependencies;
+ }
+
+ public boolean isUpdateConfiguration() {
+ return updateConfiguration;
+ }
+
+ public boolean isRebuild() {
+ return rebuild;
}
private IProject getProject(String path) {
@@ -412,11 +465,15 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
}
};
+ private Button btnUpdateProjectConfiguration;
+
+ private Button btnCleanFullBuild;
+
/**
* @return Returns the dialogTitle or an empty String if the value is null.
*/
public String getDialogTitle() {
- if (dialogTitle == null) {
+ if(dialogTitle == null) {
dialogTitle = ""; //$NON-NLS-1$
}
return dialogTitle;
@@ -426,7 +483,7 @@ public class SelectMavenProjectsDialog extends TitleAreaDialog implements IMenuL
* @return Returns the dialogMessage or an empty String if the value is null.
*/
public String getDialogMessage() {
- if (dialogMessage == null) {
+ if(dialogMessage == null) {
dialogMessage = ""; //$NON-NLS-1$
}
return dialogMessage;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/markers/MarkerResolutionGenerator.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/markers/MarkerResolutionGenerator.java
index 18f66844..c1dddff3 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/markers/MarkerResolutionGenerator.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/markers/MarkerResolutionGenerator.java
@@ -33,7 +33,7 @@ import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;
import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.ui.internal.Messages;
-import org.eclipse.m2e.core.ui.internal.UpdateConfigurationJob;
+import org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob;
public class MarkerResolutionGenerator implements IMarkerResolutionGenerator, IMarkerResolutionGenerator2 {
@@ -101,7 +101,7 @@ public class MarkerResolutionGenerator implements IMarkerResolutionGenerator, IM
*/
public void run(IMarker marker) {
final Set<IProject> projects = getProjects(marker);
- new UpdateConfigurationJob(projects.toArray(new IProject[projects.size()])).schedule();
+ new UpdateMavenProjectJob(projects.toArray(new IProject[projects.size()])).schedule();
}
/* (non-Javadoc)
@@ -109,7 +109,7 @@ public class MarkerResolutionGenerator implements IMarkerResolutionGenerator, IM
*/
public void run(IMarker[] markers, IProgressMonitor monitor) {
final Set<IProject> projects = getProjects(markers);
- new UpdateConfigurationJob(projects.toArray(new IProject[projects.size()])).schedule();
+ new UpdateMavenProjectJob(projects.toArray(new IProject[projects.size()])).schedule();
}
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
index 3f292142..41df2189 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
@@ -1,5 +1,5 @@
#Eclipse modern messages class
-#Thu Apr 14 10:24:40 EDT 2011
+#Sun Dec 25 21:00:23 EST 2011
AddDependencyAction_error_msg=Can't add dependency to {0}
AddDependencyAction_error_title=Add Dependency
AddDependencyAction_searchDialog_title=Add Dependency
@@ -35,8 +35,8 @@ IndexedArtifactNode_no_pack=[No Packaging]
LifecycleMappingPage_actionColumnTitle=Action
LifecycleMappingPage_autoSelectButton=&Auto Select
LifecycleMappingPage_description=Discover and map Eclipse plugins to Maven plugin goal executions.
-LifecycleMappingPage_deselectAllButton=&Resolve All Later
LifecycleMappingPage_descriptionLabel=Description
+LifecycleMappingPage_deselectAllButton=&Resolve All Later
LifecycleMappingPage_doNotExecuteParent=Do Not Execute (add to parent)
LifecycleMappingPage_doNotExecuteParentDescription=Places metadata which tells m2e to ignore the execution in the pom(s) that adds the Maven plugin to the build.
LifecycleMappingPage_doNotExecutePom=Do Not Execute (add to pom)
@@ -246,17 +246,6 @@ MavenRepositoryView_reload_msg=This will reload the settings.xml and rebuild the
MavenRepositoryView_reload_title=Reload settings.xml
MavenRepositoryView_update_more=Update Indexes
MavenRepositoryView_update_one=Update Index
-MavenSearchPage_btnBrowse=Browse...
-MavenSearchPage_btnSelect=Select All
-MavenSearchPage_btnUnselect=Deselect All
-MavenSearchPage_lblArtifactid=Artifact Id\:
-MavenSearchPage_lblClass=Class Name\:
-MavenSearchPage_lblGroupid=Group Id\:
-MavenSearchPage_lblPackaging=Packaging\:
-MavenSearchPage_lblRepos=Repositories\:
-MavenSearchPage_lblSha=SHA1\:
-MavenSearchPage_lblVersion=Version\:
-MavenSearchPage_separator=Label
MavenSettingsPreferencePage_btnBrowse=&Browse...
MavenSettingsPreferencePage_btnUpdate=Update Settings
MavenSettingsPreferencePage_error_missing=User settings file doesn't exist
@@ -292,24 +281,25 @@ RemoteArchetypeCatalogDialog_message=Specify catalog url and description
RemoteArchetypeCatalogDialog_message_found=Found {0} archetype(s)
RemoteArchetypeCatalogDialog_title=Remote Archetype Catalog
RepositoryNode_updating=\ [updating]
+UpdateMavenProjectDialog_btnCheckButton_text=Update dependencies
+UpdateMavenProjectDialog_btnCleanFullBuild_text=Clean build
+UpdateMavenProjectDialog_btnUpdateProjectConfiguration_text=Update project configuration from pom.xml
SelectionUtil_error_cannot_read=Can't read Maven project
+UpdateMavenProjectDialog_dialogMessage=Select Maven projects and update options
+UpdateMavenProjectDialog_title=Update Maven Project
UpdateDepenciesDialog_availableCodebasesLabel=Available Maven Codebases
UpdateDepenciesDialog_collapseAll=&Collapse All
UpdateDepenciesDialog_deselectAll=&Deselect All
UpdateDepenciesDialog_deselectTree=Deselect Tree
-UpdateDepenciesDialog_dialogMessage=Select Maven codebases to update dependencies
UpdateDepenciesDialog_expandAll=&Expand All
UpdateDepenciesDialog_forceUpdate=Force Update of Snapshots/Releases
UpdateDepenciesDialog_offline=&Offline
UpdateDepenciesDialog_selectAll=&Select All
UpdateDepenciesDialog_selectTree=Select Tree
-UpdateDepenciesDialog_title=Update Maven Dependencies
-UpdateConfigurationDialog_dialogMessage=Select Maven codebases to update project configuration
-UpdateConfigurationDialog_title=Update Maven Project Configuration
UpdateSourcesAction_error_cannot_update=Unable to update Maven configuration
UpdateSourcesAction_error_message=Unable to update maven configuration for the following projects\:
UpdateSourcesAction_error_title=Error Updating Maven Configuration
-UpdateSourcesAction_job_update_conf=Updating Maven Configuration
+UpdateSourcesAction_job_update_conf=Updating Maven Project
WorkingSetGroup_btnAddSet=&Add project(s) to working set
WorkingSetGroup_btnMore=Mor&e...
WorkingSetGroup_lblSet=Wo&rking set\:
@@ -331,11 +321,12 @@ locationComponentDirectory=&Location\:
locationComponentInWorkspace=Create project in &workspace
locationComponentLocation=Location
locationComponentSelectLocation=Select Location
+pomEditorDefaultPage=Open XML page in the POM editor by default
preferencesDebugOutput=Debu&g Output
preferencesDownloadJavadoc=Download Artifact &JavaDoc
preferencesDownloadSources=Do&wnload Artifact Sources
-preferencesOffline=&Offline
preferencesGlobalUpdateNever=Do not automatically update dependencies from remote repositories
+preferencesOffline=&Offline
preferencesReindexButton=Re&index
projectSelectionDialogTitle=Select a Maven project
resolverConfigurationAdvanced=Ad&vanced
@@ -406,4 +397,3 @@ wizardProjectPageProjectTitle=New Maven project
wizardProjectPageProjectValidatorInvalidLocation=Invalid project location path
wizardProjectPageProjectValidatorProjectLocation=Enter a location for the project.
wizardProjectTitle=New Maven Project
-pomEditorDefaultPage=Open XML page in the POM editor by default \ No newline at end of file
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java
index 6a30aade..6d3864a3 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java
@@ -67,7 +67,7 @@ import org.eclipse.m2e.core.project.ProjectImportConfiguration;
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator;
import org.eclipse.m2e.core.ui.internal.Messages;
-import org.eclipse.m2e.core.ui.internal.UpdateConfigurationJob;
+import org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob;
import org.eclipse.m2e.core.ui.internal.actions.SelectionUtil;
import org.eclipse.m2e.core.ui.internal.editing.LifecycleMappingOperation;
import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
@@ -204,7 +204,7 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
}
}
- new UpdateConfigurationJob(changed.toArray(new IProject[changed.size()])).schedule();
+ new UpdateMavenProjectJob(changed.toArray(new IProject[changed.size()])).schedule();
}
private Collection<IProject> getProject(Collection<MavenProject> projects) {
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/startup/UpdateConfigurationStartup.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/startup/UpdateConfigurationStartup.java
index ac44e18a..c7b2bcc6 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/startup/UpdateConfigurationStartup.java
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/startup/UpdateConfigurationStartup.java
@@ -25,7 +25,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.ui.internal.UpdateConfigurationJob;
+import org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob;
import org.eclipse.m2e.internal.discovery.DiscoveryActivator;
import org.eclipse.m2e.internal.discovery.Messages;
import org.eclipse.ui.IStartup;
@@ -85,11 +85,11 @@ public class UpdateConfigurationStartup implements IStartup {
*/
public static void updateConfiguration() {
Collection<IProject> projects = getMarkedProjects();
- new UpdateConfigurationJob(projects.toArray(new IProject[projects.size()])).schedule();
+ new UpdateMavenProjectJob(projects.toArray(new IProject[projects.size()])).schedule();
}
private static void updateConfiguration(IProject[] projects) {
- new UpdateConfigurationJob(projects).schedule();
+ new UpdateMavenProjectJob(projects).schedule();
}
private static void addEarlyStartup() {

Back to the top