aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Muskalla2010-06-30 11:47:30 (EDT)
committerChris Aniszczyk2010-07-06 11:16:43 (EDT)
commitf6b8d102e77b4f291112598fa298744c39e99f02 (patch)
tree23cf899af7d2fdf32eb6235e784be0871104d890
parente2d8180a27f4b2abdada59128735f12ce4726772 (diff)
downloadegit-f6b8d102e77b4f291112598fa298744c39e99f02.zip
egit-f6b8d102e77b4f291112598fa298744c39e99f02.tar.gz
egit-f6b8d102e77b4f291112598fa298744c39e99f02.tar.bz2
Added workingset option to projects import wizardrefs/changes/12/1012/3
Due to bug 245106, we need to hardcode the ids of the known working sets. Bug: 318398 Change-Id: Ic40595afafa935a05e494dbd754474b52e8538cc Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java33
1 files changed, 31 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java
index b913782..326374c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java
@@ -1,5 +1,3 @@
-package org.eclipse.egit.ui.internal.clone;
-
/*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others.
* Copyright (C) 2007, Martin Oberhuber (martin.oberhuber@windriver.com)
@@ -14,6 +12,8 @@ package org.eclipse.egit.ui.internal.clone;
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
+package org.eclipse.egit.ui.internal.clone;
+
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -28,6 +28,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -59,9 +60,13 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
+import org.eclipse.ui.dialogs.WorkingSetGroup;
import org.eclipse.ui.statushandlers.StatusManager;
/**
@@ -93,6 +98,8 @@ public class GitProjectsImportPage extends WizardPage {
private Button deselectAll;
+ private WorkingSetGroup workingSetGroup;
+
/**
* Creates a new project creation wizard page.
*/
@@ -116,10 +123,20 @@ public class GitProjectsImportPage extends WizardPage {
createProjectsRoot(workArea);
createProjectsList(workArea);
+ createWorkingSetGroup(workArea);
Dialog.applyDialogFont(workArea);
}
+ private void createWorkingSetGroup(Composite workArea) {
+ // TODO: replace hardcoded ids once bug 245106 is fixed
+ String[] workingSetTypes = new String[] {
+ "org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$
+ "org.eclipse.jdt.ui.JavaWorkingSetPage" //$NON-NLS-1$
+ };
+ workingSetGroup = new WorkingSetGroup(workArea, null, workingSetTypes);
+ }
+
/**
* Create the checkbox list for the found projects.
*
@@ -491,9 +508,21 @@ public class GitProjectsImportPage extends WizardPage {
t, true);
return false;
}
+ addProjectsToWorkingSet(selected);
return true;
}
+ private void addProjectsToWorkingSet(Set<ProjectRecord> selected) {
+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (ProjectRecord projectRecord : selected) {
+ IWorkingSet[] selectedWorkingSets = workingSetGroup.getSelectedWorkingSets();
+ String projectName = projectRecord.getProjectName();
+ IProject project = root.getProject(projectName);
+ workingSetManager.addToWorkingSets(project, selectedWorkingSets);
+ }
+ }
+
/**
* Create the project described in record. If it is successful return true.
*