Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2016-03-18 02:42:46 -0400
committerMickael Istria2016-05-03 10:14:24 -0400
commitf64e5e8104297d9685ce56499febd90cac63a108 (patch)
treed19e717f53c018290a246513865652760f2623d8 /org.eclipse.m2e.importer
parentae41bc441703f743d027001817767f4323abf92b (diff)
downloadm2e-core-f64e5e8104297d9685ce56499febd90cac63a108.tar.gz
m2e-core-f64e5e8104297d9685ce56499febd90cac63a108.tar.xz
m2e-core-f64e5e8104297d9685ce56499febd90cac63a108.zip
Bug 492897 - Use Importer API from Platform
Change-Id: I557218b33eb9ddebd748c819d0b9030fead5727b Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'org.eclipse.m2e.importer')
-rw-r--r--org.eclipse.m2e.importer/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.m2e.importer/plugin.xml2
-rw-r--r--org.eclipse.m2e.importer/src/org/eclipse/m2e/importer/internal/MavenProjectConfigurator.java57
3 files changed, 47 insertions, 15 deletions
diff --git a/org.eclipse.m2e.importer/META-INF/MANIFEST.MF b/org.eclipse.m2e.importer/META-INF/MANIFEST.MF
index 9e5bd696..79b77855 100644
--- a/org.eclipse.m2e.importer/META-INF/MANIFEST.MF
+++ b/org.eclipse.m2e.importer/META-INF/MANIFEST.MF
@@ -5,11 +5,10 @@ Bundle-SymbolicName: org.eclipse.m2e.importer;singleton:=true
Bundle-Version: 1.7.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.e4.ui.importer,
+Require-Bundle: org.eclipse.ui.ide,
org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.ui.ide,
org.eclipse.m2e.core;bundle-version="1.6.0",
org.eclipse.m2e.core.ui;bundle-version="1.6.0",
org.slf4j.api;bundle-version="1.6.2"
diff --git a/org.eclipse.m2e.importer/plugin.xml b/org.eclipse.m2e.importer/plugin.xml
index d1d0b96e..d264277e 100644
--- a/org.eclipse.m2e.importer/plugin.xml
+++ b/org.eclipse.m2e.importer/plugin.xml
@@ -2,7 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension
- point="org.eclipse.e4.ui.importer.projectConfigurators">
+ point="org.eclipse.ui.ide.projectConfigurators">
<projectConfigurator
class="org.eclipse.m2e.importer.internal.MavenProjectConfigurator"
label="Maven">
diff --git a/org.eclipse.m2e.importer/src/org/eclipse/m2e/importer/internal/MavenProjectConfigurator.java b/org.eclipse.m2e.importer/src/org/eclipse/m2e/importer/internal/MavenProjectConfigurator.java
index ec1f42fc..ce85b84b 100644
--- a/org.eclipse.m2e.importer/src/org/eclipse/m2e/importer/internal/MavenProjectConfigurator.java
+++ b/org.eclipse.m2e.importer/src/org/eclipse/m2e/importer/internal/MavenProjectConfigurator.java
@@ -12,6 +12,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
@@ -32,6 +33,7 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.internal.jobs.IBackgroundProcessingQueue;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.LifecycleMappingDiscoveryRequest;
import org.eclipse.m2e.core.internal.project.ProjectConfigurationManager;
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
@@ -41,7 +43,7 @@ import org.eclipse.m2e.core.project.MavenUpdateRequest;
import org.eclipse.m2e.core.project.ResolverConfiguration;
import org.eclipse.m2e.core.ui.internal.wizards.LifecycleMappingDiscoveryHelper;
import org.eclipse.m2e.core.ui.internal.wizards.MappingDiscoveryJob;
-import org.eclipse.ui.internal.wizards.datatransfer.EasymportJob;
+import org.eclipse.ui.internal.wizards.datatransfer.SmartImportJob;
import org.eclipse.ui.wizards.datatransfer.ProjectConfigurator;
public class MavenProjectConfigurator implements ProjectConfigurator {
@@ -69,7 +71,7 @@ public class MavenProjectConfigurator implements ProjectConfigurator {
try {
// This makes job execution wait until the main Import job is completed
// So the mapping discovery happens as a next step, after projects are imported in workspace
- getJobManager().join(EasymportJob.class, monitor);
+ getJobManager().join(SmartImportJob.class, monitor);
} catch (InterruptedException ex) {
throw new CoreException(new Status(IStatus.WARNING,
Activator.getDefault().getBundle().getSymbolicName(), ex.getMessage(), ex));
@@ -114,7 +116,7 @@ public class MavenProjectConfigurator implements ProjectConfigurator {
* @author mistria
*
*/
- private static class UpdateMavenConfigurationJob extends Job {
+ public static class UpdateMavenConfigurationJob extends Job implements IBackgroundProcessingQueue {
private static UpdateMavenConfigurationJob INSTANCE;
private Set<IProject> toProcess;
@@ -146,7 +148,7 @@ public class MavenProjectConfigurator implements ProjectConfigurator {
}
@Override
- protected IStatus run(IProgressMonitor monitor) {
+ public IStatus run(IProgressMonitor monitor) {
Set<IProject> toProcessNow = new HashSet<IProject>();
while (!monitor.isCanceled()) {
synchronized (this.toProcess) {
@@ -172,13 +174,14 @@ public class MavenProjectConfigurator implements ProjectConfigurator {
"Cancelled by user");
}
+ @Override
+ public boolean isEmpty() {
+ return this.toProcess.isEmpty();
+ }
+
}
- // TODO Uncomment @Override when following API got merged.
- // this is commented in order to check it in build before API is available
- // and avoid
- // build failure because inteface doesn't declare the method (yet).
- // @Override
+ @Override
public Set<File> findConfigurableLocations(File root, IProgressMonitor monitor) {
LocalProjectScanner scanner = new LocalProjectScanner(
ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), root.getAbsolutePath(), false,
@@ -199,13 +202,36 @@ public class MavenProjectConfigurator implements ProjectConfigurator {
}
return res;
}
+
+ // TODO Uncomment @Override when this method API is exposed in ProjectConfigurator
+ // @Override
+ public void removeDirtyDirectories(Map<File, List<ProjectConfigurator>> proposals) {
+ Set<File> toRemove = new HashSet<File>();
+ for (File directory : proposals.keySet()) {
+ String path = directory.getAbsolutePath();
+ if (!path.endsWith(File.separator)) {
+ path += File.separator;
+ }
+ int index = path.indexOf(File.separator + "target" + File.separator); //$NON-NLS-1$
+ if (index >= 0) {
+ File potentialPomFile = new File(path.substring(0, index), "pom.xml"); //$NON-NLS-1$
+ if (potentialPomFile.isFile()) {
+ toRemove.add(directory);
+ }
+ }
+ }
+ for (File directory : toRemove) {
+ proposals.remove(directory);
+ }
+ }
@Override
public boolean canConfigure(IProject project, Set<IPath> ignoredPaths, IProgressMonitor monitor) {
return shouldBeAnEclipseProject(project, monitor);
}
- @Override
+ // TODO this method is going to be removed from API.
+ // When done, also remove this method implementation.
public IWizard getConfigurationWizard() {
// no need for a wizard, will just set up the m2e nature
return null;
@@ -259,8 +285,9 @@ public class MavenProjectConfigurator implements ProjectConfigurator {
// }
}
- @Override
- public Set<IFolder> getDirectoriesToIgnore(IProject project, IProgressMonitor monitor) {
+ // Prepare for compatibility with M7
+ // @Override
+ public Set<IFolder> getFoldersToIgnore(IProject project, IProgressMonitor monitor) {
Set<IFolder> res = new HashSet<IFolder>();
// TODO: get these values from pom/project config
res.add(project.getFolder("src"));
@@ -268,4 +295,10 @@ public class MavenProjectConfigurator implements ProjectConfigurator {
return res;
}
+ // Prepare for compatibility with M7
+ // @Override
+ public Set<IFolder> getDirectoriesToIgnore(IProject project, IProgressMonitor monitor) {
+ return getFoldersToIgnore(project, monitor);
+ }
+
}

Back to the top