[Importer] Give priority to .project
When a given folder is already an Eclipse project (with a .project),
rely on existing .project and import it as an Eclipse project, do not
try to configure it otherwise.
+ Parameter to enable/disable deep-scan
+ More laziness in PDE and Java importer strategies
Signed-off-by: Mickael Istria <mistria@redhat.com>
Change-Id: I0e83ee85c5b99a4f73b3505681f0f6395ee71a7a
diff --git a/bundles/org.eclipse.e4.ui.importer.java/src/org/eclipse/jdt/ui/wizards/JavaProjectNature.java b/bundles/org.eclipse.e4.ui.importer.java/src/org/eclipse/jdt/ui/wizards/JavaProjectNature.java
index c5c1ca0..9583020 100644
--- a/bundles/org.eclipse.e4.ui.importer.java/src/org/eclipse/jdt/ui/wizards/JavaProjectNature.java
+++ b/bundles/org.eclipse.e4.ui.importer.java/src/org/eclipse/jdt/ui/wizards/JavaProjectNature.java
@@ -216,6 +216,9 @@
Set<IFolder> res = new HashSet<IFolder>();
try {
IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
+ if (javaProject == null) {
+ return res;
+ }
IResource resource = project.getWorkspace().getRoot().findMember(javaProject.getOutputLocation());
if (resource != null && resource.exists() && resource.getType() == IResource.FOLDER) {
res.add((IFolder)resource);
diff --git a/bundles/org.eclipse.e4.ui.importer.pde/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java b/bundles/org.eclipse.e4.ui.importer.pde/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java
index 46d2616..4a61ee9 100644
--- a/bundles/org.eclipse.e4.ui.importer.pde/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java
+++ b/bundles/org.eclipse.e4.ui.importer.pde/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java
@@ -12,6 +12,7 @@
import java.io.InputStream;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.jar.Manifest;
@@ -20,6 +21,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -32,11 +34,11 @@
import org.eclipse.jdt.ui.wizards.JavaProjectNature;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.pde.core.build.IBuildEntry;
+import org.eclipse.pde.core.build.IBuildModel;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.PluginRegistry;
import org.eclipse.pde.internal.core.ClasspathComputer;
import org.eclipse.pde.internal.core.PDECore;
-import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.pde.internal.core.natures.PluginProject;
import org.eclipse.pde.internal.core.project.PDEProject;
@@ -48,8 +50,8 @@
@Override
public boolean canConfigure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) {
- IFile manifestFile = project.getFile(new Path("META-INF/MANIFEST.MF"));
- if (manifestFile.exists()) {
+ IFile manifestFile = PDEProject.getManifest(project);;
+ if (manifestFile != null && manifestFile.exists()) {
for (IPath ignoredDirectory : ignoredDirectories) {
if (ignoredDirectory.isPrefixOf(manifestFile.getLocation())) {
return false;
@@ -146,17 +148,30 @@
res.addAll(new JavaProjectNature().getDirectoriesToIgnore(project, monitor));
try {
IFile buildProperties = PDEProject.getBuildProperties(project);
- PluginProject pdeProject = (PluginProject) project.getNature(PDE.PLUGIN_NATURE);
IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(project);
- for (IBuildEntry entry : PluginRegistry.createBuildModel(model).getBuild().getBuildEntries()) {
- if (entry.getName().startsWith("src.") || entry.getName().startsWith("bin.")) {
+ if (model == null) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), "Could not resolve PDE build model for " + project.getLocation()));
+ // in such case, exclude everything
+ for (IResource child : project.members()) {
+ if (child.getType() == IResource.FOLDER) {
+ res.add((IFolder)child);
+ }
+ }
+ return res;
+ }
+ IBuildModel buildModel = PluginRegistry.createBuildModel(model);
+ for (IBuildEntry entry : buildModel.getBuild().getBuildEntries()) {
+ if (entry.getName().startsWith("src.") || entry.getName().startsWith("source.") ||
+ entry.getName().startsWith("bin.") || entry.getName().startsWith("output.")) {
for (String token : entry.getTokens()) {
if (token.endsWith("/")) {
token = token.substring(0, token.length() - 1);
}
- IFolder folder = project.getFolder(token);
- if (folder.exists()) {
- res.add(folder);
+ if (token != null && token.length() > 0 && !token.equals(".")) {
+ IFolder folder = project.getFolder(token);
+ if (folder.exists()) {
+ res.add(folder);
+ }
}
}
}
diff --git a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/ConfigureProjectHandler.java b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/ConfigureProjectHandler.java
index 4d0d1bc..4899bb7 100644
--- a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/ConfigureProjectHandler.java
+++ b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/ConfigureProjectHandler.java
@@ -50,7 +50,7 @@
}
}
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- EasymportJob job = new EasymportJob(project.getLocation().toFile(), workingSets, true);
+ EasymportJob job = new EasymportJob(project.getLocation().toFile(), workingSets, true, true);
EasymportJobReportDialog dialog = new EasymportJobReportDialog(shell, job);
job.schedule();
return dialog.open();
diff --git a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportJob.java b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportJob.java
index 390a650..8c3b74d 100644
--- a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportJob.java
+++ b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportJob.java
@@ -45,9 +45,19 @@
public class EasymportJob extends Job {
+ /*
+ * Input parameters
+ */
private File rootDirectory;
+ private boolean discardRootProject;
+ private boolean deepChildrenDetection;
+ private boolean configureProjects;
+ private boolean reconfigureEclipseProjects;
private IWorkingSet[] workingSets;
- private boolean recursiveConfigure;
+
+ /*
+ * working fields
+ */
private IProject rootProject;
private IWorkspaceRoot workspaceRoot;
private ProjectConfiguratorExtensionManager configurationManager;
@@ -55,12 +65,11 @@
private Map<IProject, List<ProjectConfigurator>> report;
private boolean isRootANewProject;
- private boolean discardRootProject;
private Map<IPath, Exception> errors;
private JobGroup crawlerJobGroup;
- public EasymportJob(File rootDirectory, Set<IWorkingSet> workingSets, boolean recuriveConfigure) {
+ public EasymportJob(File rootDirectory, Set<IWorkingSet> workingSets, boolean configureProjects, boolean recuriveChildrenDetection) {
super(rootDirectory.getAbsolutePath());
this.workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
this.rootDirectory = rootDirectory;
@@ -69,12 +78,18 @@
} else {
this.workingSets = new IWorkingSet[0];
}
- this.recursiveConfigure = recuriveConfigure;
+ this.configureProjects = configureProjects;
+ this.deepChildrenDetection = recuriveChildrenDetection;
this.report = new HashMap<>();
this.crawlerJobGroup = new JobGroup("Detecting and configurating nested projects", 0, 1);
this.errors = new HashMap<>();
}
+ @Deprecated
+ public EasymportJob(File rootDirectory, Set<IWorkingSet> workingSets, boolean configureAndDetectNestedProject) {
+ this(rootDirectory, workingSets, configureAndDetectNestedProject, configureAndDetectNestedProject);
+ }
+
public void setListener(RecursiveImportListener listener) {
this.listener = listener;
}
@@ -82,13 +97,14 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- this.isRootANewProject = projectAlreadyExistsInWorkspace(this.rootDirectory) == null;
+ this.isRootANewProject = !new File(this.rootDirectory, ".project").isFile();
this.rootProject = toExistingOrNewProject(
this.rootDirectory,
monitor,
IResource.NONE); // complete load of the root project
- if (this.recursiveConfigure) {
+
+ if (this.configureProjects) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription description = workspace.getDescription();
boolean isAutoBuilding = workspace.isAutoBuilding();
@@ -97,7 +113,7 @@
workspace.setDescription(description);
}
- importProjectAndChildrenRecursively(this.rootProject, true, monitor);
+ importProjectAndChildrenRecursively(this.rootProject, this.deepChildrenDetection, true, monitor);
if (isAutoBuilding) {
description.setAutoBuilding(true);
@@ -126,7 +142,7 @@
}
protected boolean rootProjectWorthBeingRemoved() {
- if (!this.isRootANewProject) {
+ if (this.isRootANewProject) {
return false;
}
if (this.report.size() == 1) {
@@ -158,7 +174,7 @@
@Override
public IStatus run(IProgressMonitor progressMonitor) {
try {
- Set<IProject> projectFromCurrentContainer = importProjectAndChildrenRecursively(childFolder, false, progressMonitor);
+ Set<IProject> projectFromCurrentContainer = importProjectAndChildrenRecursively(childFolder, true, false, progressMonitor);
res.addAll(projectFromCurrentContainer);
return Status.OK_STATUS;
} catch (Exception ex) {
@@ -204,29 +220,27 @@
return res;
}
- /**
- * @param folder
- * @param workingSets
- * @param progressMonitor
- * @param listener
- * @return
- * @throws Exception
- */
- private Set<IProject> importProjectAndChildrenRecursively(IContainer container, boolean isRootProject, IProgressMonitor progressMonitor) throws Exception {
+ private Set<IProject> importProjectAndChildrenRecursively(IContainer container, boolean deepDetectChildren, boolean isRootProject, IProgressMonitor progressMonitor) throws Exception {
if (progressMonitor.isCanceled()) {
return null;
}
- container.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor); // Make sure we have folder content
+ progressMonitor.setTaskName("Inspecting " + container.getLocation().toFile().getAbsolutePath());
+ Set<IProject> projectFromCurrentContainer = new HashSet<IProject>();
+ EclipseProjectConfigurator eclipseProjectConfigurator = new EclipseProjectConfigurator();
+ boolean isAlreadyAnEclipseProject = false;
+ Set<ProjectConfigurator> mainProjectConfigurators = new HashSet<ProjectConfigurator>();
+ Set<IPath> excludedPaths = new HashSet<IPath>();
+ IProject project = null;
+ container.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
+ if (eclipseProjectConfigurator.shouldBeAnEclipseProject(container, progressMonitor) && !(container == this.rootProject && this.isRootANewProject)) {
+ isAlreadyAnEclipseProject = true;
+ }
+
if (this.configurationManager == null) {
this.configurationManager = new ProjectConfiguratorExtensionManager();
}
- progressMonitor.setTaskName("Inspecting " + container.getLocation().toFile().getAbsolutePath());
Collection<ProjectConfigurator> activeConfigurators = this.configurationManager.getAllActiveProjectConfigurators(container);
- Set<IProject> projectFromCurrentContainer = new HashSet<IProject>();
- Set<ProjectConfigurator> mainProjectConfigurators = new HashSet<ProjectConfigurator>();
Set<ProjectConfigurator> potentialSecondaryConfigurators = new HashSet<ProjectConfigurator>();
- Set<IPath> excludedPaths = new HashSet<IPath>();
- IProject project = null;
for (ProjectConfigurator configurator : activeConfigurators) {
if (progressMonitor.isCanceled()) {
return null;
@@ -256,21 +270,27 @@
}
if (!mainProjectConfigurators.isEmpty()) {
- for (ProjectConfigurator configurator : mainProjectConfigurators) {
+ project.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
+ }
+ for (ProjectConfigurator configurator : mainProjectConfigurators) {
+ if (configurator instanceof EclipseProjectConfigurator || !isAlreadyAnEclipseProject || this.reconfigureEclipseProjects) {
configurator.configure(project, excludedPaths, progressMonitor);
this.report.get(project).add(configurator);
if (this.listener != null) {
listener.projectConfigured(project, configurator);
}
- excludedPaths.addAll(toPathSet(configurator.getDirectoriesToIgnore(project, progressMonitor)));
}
+ excludedPaths.addAll(toPathSet(configurator.getDirectoriesToIgnore(project, progressMonitor)));
}
- Set<IProject> allNestedProjects = searchAndImportChildrenProjectsRecursively(container, excludedPaths, progressMonitor);
- excludedPaths.addAll(toPathSet(allNestedProjects));
+ Set<IProject> allNestedProjects = new HashSet<>();
+ if (deepChildrenDetection) {
+ allNestedProjects.addAll( searchAndImportChildrenProjectsRecursively(container, excludedPaths, progressMonitor) );
+ excludedPaths.addAll(toPathSet(allNestedProjects));
+ }
if (allNestedProjects.isEmpty() && isRootProject) {
- // No sub-project found, so apply available configurators anyway
+ // Root without sub-project found, create project anyway
progressMonitor.beginTask("Configuring 'leaf' of project at " + container.getLocation().toFile().getAbsolutePath(), activeConfigurators.size());
try {
project = toExistingOrNewProject(container.getLocation().toFile(), progressMonitor, IResource.BACKGROUND_REFRESH);
@@ -293,10 +313,12 @@
progressMonitor.beginTask("Continue configuration of project at " + container.getLocation().toFile().getAbsolutePath(), potentialSecondaryConfigurators.size());
for (ProjectConfigurator additionalConfigurator : potentialSecondaryConfigurators) {
if (additionalConfigurator.canConfigure(project, excludedPaths, progressMonitor)) {
- additionalConfigurator.configure(project, excludedPaths, progressMonitor);
- this.report.get(project).add(additionalConfigurator);
- if (this.listener != null) {
- listener.projectConfigured(project, additionalConfigurator);
+ if (!isAlreadyAnEclipseProject || this.reconfigureEclipseProjects) {
+ additionalConfigurator.configure(project, excludedPaths, progressMonitor);
+ this.report.get(project).add(additionalConfigurator);
+ if (this.listener != null) {
+ listener.projectConfigured(project, additionalConfigurator);
+ }
}
excludedPaths.addAll(toPathSet(additionalConfigurator.getDirectoriesToIgnore(project, progressMonitor)));
}
diff --git a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportWizard.java b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportWizard.java
index ecc26d6..c668eb2 100644
--- a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportWizard.java
+++ b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EasymportWizard.java
@@ -12,21 +12,13 @@
package org.eclipse.ui.internal.wizards.datatransfer;
import java.io.File;
-import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IImportWizard;
@@ -50,15 +42,15 @@
setDialogSettings(dialogSettings);
}
}
-
+
public void setInitialDirectory(File directory) {
this.initialSelection = directory;
}
-
+
public void setInitialWorkingSets(Set<IWorkingSet> workingSets) {
this.initialWorkingSets = workingSets;
}
-
+
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
if (selection != null) {
@@ -75,14 +67,14 @@
}
}
}
-
+
public static File toFile(Object o) {
if (o instanceof File) {
return (File)o;
} else if (o instanceof IResource) {
return ((IResource)o).getLocation().toFile();
} else if (o instanceof IAdaptable) {
- IResource resource = (IResource) ((IAdaptable)o).getAdapter(IResource.class);
+ IResource resource = ((IAdaptable)o).getAdapter(IResource.class);
if (resource != null) {
return resource.getLocation().toFile();
}
@@ -94,7 +86,7 @@
if (o instanceof IWorkingSet) {
return (IWorkingSet)o;
} else if (o instanceof IAdaptable) {
- return (IWorkingSet) ((IAdaptable)o).getAdapter(IWorkingSet.class);
+ return ((IAdaptable)o).getAdapter(IWorkingSet.class);
}
return null;
}
@@ -108,13 +100,13 @@
@Override
public boolean performFinish() {
getDialogSettings().put(SelectImportRootWizardPage.ROOT_DIRECTORY, projectRootPage.getSelectedRootDirectory().getAbsolutePath());
- EasymportJob job = new EasymportJob(projectRootPage.getSelectedRootDirectory(), projectRootPage.getSelectedWorkingSets(), projectRootPage.isConfigureAndDetectNestedProject());
+ EasymportJob job = new EasymportJob(projectRootPage.getSelectedRootDirectory(), projectRootPage.getSelectedWorkingSets(), projectRootPage.isConfigureProjects(), projectRootPage.isDetectNestedProject());
EasymportJobReportDialog dialog = new EasymportJobReportDialog(getShell(), job);
job.schedule();
- if (projectRootPage.isConfigureAndDetectNestedProject()) {
+ if (projectRootPage.isDetectNestedProject() || projectRootPage.isConfigureProjects()) {
dialog.open();
}
return true;
}
-
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EclipseProjectConfigurator.java b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EclipseProjectConfigurator.java
index a9b3200..cdc265b 100644
--- a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EclipseProjectConfigurator.java
+++ b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/EclipseProjectConfigurator.java
@@ -16,9 +16,13 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.ui.wizards.datatransfer.ProjectConfigurator;
@@ -46,7 +50,11 @@
@Override
public void configure(IProject project, Set<IPath> excludedDirectories, IProgressMonitor monitor) {
- // Nothing to do
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (CoreException ex) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), ex.getMessage(), ex));
+ }
}
}
diff --git a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.java b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.java
index f1a72df..6594e15 100644
--- a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.java
+++ b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.java
@@ -36,6 +36,7 @@
public static String EasymportWizardPage_nestedProjects;
public static String EasymportWizardPage_detectNestedProjects;
public static String EasymportWizardPage_importRawProject;
+ public static String EasymportWizardPage_importAndConfigureProject;
public static String EasymportWizardPage_showAvailableDetectors;
public static String EasymportWizardPage_availableDetectors_title;
public static String EasymportWizardPage_availableDetectors_description;
diff --git a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.properties b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.properties
index 30909d7..b4cf838 100644
--- a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.properties
+++ b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/Messages.properties
@@ -28,7 +28,8 @@
EasymportWizardPage_workingSets=Working Sets
EasymportWizardPage_nestedProjects=Nested Projects
EasymportWizardPage_importRawProject=Import raw project (I'll configure it later)
-EasymportWizardPage_detectNestedProjects=Detect and configure nested projects under the given location.
+EasymportWizardPage_importAndConfigureProject=Import and configure root project only
+EasymportWizardPage_detectNestedProjects=Detect and configure nested projects under the given location
EasymportWizardPage_availableDetectors=Available project detectors and configurators
EasymportWizardPage_showAvailableDetectors=Show available detectors
EasymportWizardPage_availableDetectors_title=Available detectors
diff --git a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/SelectImportRootWizardPage.java b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/SelectImportRootWizardPage.java
index 292c9ab..602c975 100644
--- a/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/SelectImportRootWizardPage.java
+++ b/bundles/org.eclipse.e4.ui.importer/src/org/eclipse/ui/internal/wizards/datatransfer/SelectImportRootWizardPage.java
@@ -50,6 +50,7 @@
private File selection;
private boolean detectNestedProjects = true;
+ private boolean configureProjects = true;
private Set<IWorkingSet> workingSets;
private ControlDecoration rootDirectoryTextDecorator;
private WorkingSetConfigurationBlock workingSetsBlock;
@@ -119,7 +120,25 @@
@Override
public void widgetSelected(SelectionEvent e) {
boolean selection = importRawProjectRadio.getSelection();
- SelectImportRootWizardPage.this.detectNestedProjects = !selection;
+ if (selection) {
+ SelectImportRootWizardPage.this.detectNestedProjects = false;
+ SelectImportRootWizardPage.this.configureProjects = false;
+ }
+ setPageComplete(isPageComplete());
+ }
+ });
+ final Button importAndConfigureProjectRadio = new Button(res, SWT.RADIO);
+ importAndConfigureProjectRadio.setText(Messages.EasymportWizardPage_importAndConfigureProject);
+ importAndConfigureProjectRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+ importAndConfigureProjectRadio.setSelection(!this.detectNestedProjects);
+ importAndConfigureProjectRadio.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean selection = importAndConfigureProjectRadio.getSelection();
+ if (selection) {
+ SelectImportRootWizardPage.this.detectNestedProjects = false;
+ SelectImportRootWizardPage.this.configureProjects = true;
+ }
setPageComplete(isPageComplete());
}
});
@@ -131,7 +150,10 @@
@Override
public void widgetSelected(SelectionEvent e) {
boolean selection = detectNestedProjectCheckbox.getSelection();
- SelectImportRootWizardPage.this.detectNestedProjects = selection;
+ if (selection) {
+ SelectImportRootWizardPage.this.detectNestedProjects = true;
+ SelectImportRootWizardPage.this.configureProjects = true;
+ }
setPageComplete(isPageComplete());
}
});
@@ -225,8 +247,23 @@
return this.workingSets;
}
- public boolean isConfigureAndDetectNestedProject() {
+ public boolean isDetectNestedProject() {
return this.detectNestedProjects;
}
+ public boolean isConfigureProjects() {
+ return this.configureProjects;
+ }
+
+ /**
+ *
+ * @return
+ * @deprecated Use {@link #isConfigureProjects()} and {@link #isDetectNestedProject()} instead
+ */
+ @Deprecated
+ public boolean isConfigureAndDetectNestedProject() {
+ return isConfigureProjects();
+ }
+
}
+