Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-01-08 18:18:35 +0000
committerMichael Valenta2007-01-08 18:18:35 +0000
commitdfa83a700affda5684a104c9d9e83e5bf55dcd29 (patch)
tree09984a4eb758d7f91ab362304144eeb4f614841f
parent35aa39dd750a23e16ea7d8609d43068057ad6e13 (diff)
downloadeclipse.platform.team-dfa83a700affda5684a104c9d9e83e5bf55dcd29.tar.gz
eclipse.platform.team-dfa83a700affda5684a104c9d9e83e5bf55dcd29.tar.xz
eclipse.platform.team-dfa83a700affda5684a104c9d9e83e5bf55dcd29.zip
Bug 167595 [Wizards] Allow adding projects to Java working set on checkout
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java15
7 files changed, 14 insertions, 39 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
index 3eeadd59f..3beeac87b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
@@ -30,6 +30,7 @@ import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ui.wizards.WorkingSetsDialog;
import org.eclipse.ui.*;
/**
* This class acts as an abstract class for checkout operations.
@@ -514,13 +515,15 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
IWorkingSet oldSet = manager.getWorkingSet(workingSetName);
if (oldSet == null) {
IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects);
+ newSet.setId(WorkingSetsDialog.resourceWorkingSetId);
manager.addWorkingSet(newSet);
- }else {
+ } else {
//don't overwrite the old elements
IAdaptable[] tempElements = oldSet.getElements();
IAdaptable[] finalElementList = new IAdaptable[tempElements.length + projects.length];
System.arraycopy(tempElements, 0, finalElementList, 0, tempElements.length);
- System.arraycopy(projects, 0,finalElementList, tempElements.length, projects.length);
+ IAdaptable[] adaptedProjects = oldSet.adaptElements(projects);
+ System.arraycopy(adaptedProjects, 0,finalElementList, tempElements.length, adaptedProjects.length);
oldSet.setElements(finalElementList);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
index f855c9341..77c7140cd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
@@ -24,9 +24,9 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
import org.eclipse.team.internal.ui.wizards.WorkingSetsDialog;
-import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PlatformUI;
/**
@@ -342,13 +342,6 @@ public class CheckoutAsMainPage extends CVSWizardPage {
if (workingSetName.length() == 0) {
setMessage(CVSUIMessages.CheckoutAsMainPage_EmptyWorkingSetErrorMessage, ERROR);
return false;
- } else {
- // todo: verify name doesn't already exist
- IWorkingSet existingSet = CVSUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName);
- if (existingSet != null && !existingSet.getId().equals(WorkingSetsDialog.resourceWorkingSetId)) {
- setMessage(CVSUIMessages.CheckoutAsMainPage_WorkingSetExistsErrorMessage, ERROR);
- return false;
- }
}
}
setMessage(null);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
index c7315c043..44059f5d0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
@@ -267,7 +267,6 @@ public class TeamUIMessages extends NLS {
public static String ImportProjectSetMainPage_The_specified_file_does_not_exist_4;
public static String ImportProjectSetMainPage_You_have_specified_a_folder_5;
public static String ImportProjectSetMainPage_workingSetNameEmpty;
- public static String ImportProjectSetMainPage_workingSetNameExists;
public static String ImportProjectSetMainPage_createWorkingSetLabel;
public static String ImportProjectSetMainPage_workingSetLabel;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 5f5398eba..45e48d7d1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -94,7 +94,6 @@ ImportProjectSetMainPage_Browse=Br&owse...
ImportProjectSetMainPage_The_specified_file_does_not_exist_4=The specified file does not exist
ImportProjectSetMainPage_You_have_specified_a_folder_5=You have specified a folder
ImportProjectSetMainPage_workingSetNameEmpty=The working set name must not be empty
-ImportProjectSetMainPage_workingSetNameExists=The specified working set already exists
ImportProjectSetMainPage_createWorkingSetLabel=&Create a working set containing the imported projects
ImportProjectSetMainPage_workingSetLabel=&Working Set Name:
ImportProjectSetMainPage_AddToWorkingSet=&Add the imported team project set to a working set
@@ -283,8 +282,8 @@ SynchronizationLabelProvider_0={0} (Initializing)
SynchronizationCompareAdapter_0=Workspace
WorkspaceScope_0=Workspace
WorkingSetScope_0=Workspace
-WorkingSetsDialog_Title=Select a Resource Working Set
-WorkingSetsDialog_Message=Select an existing working set or type in a new one
+WorkingSetsDialog_Title=Select a Working Set
+WorkingSetsDialog_Message=Select an existing working set or enter a new name to create a Resource Working Set
WorkingSetsDialog_Label=Working Set:
SubscriberParticipant_namePattern={0} ({1})
SubscriberParticipantWizard_0=There are no {0} resources to synchronize
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
index 4214758e7..736513b52 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
@@ -24,8 +24,8 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.ui.IWorkingSet;
+import org.eclipse.team.internal.ui.IHelpContextIds;
+import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.ui.PlatformUI;
public class ImportProjectSetMainPage extends TeamWizardPage {
@@ -173,13 +173,6 @@ public class ImportProjectSetMainPage extends TeamWizardPage {
if (workingSetName.length() == 0) {
setMessage(TeamUIMessages.ImportProjectSetMainPage_workingSetNameEmpty, ERROR);
return false;
- } else {
- // todo: verify name doesn't already exist
- IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName);
- if (existingSet != null && !existingSet.getId().equals(WorkingSetsDialog.resourceWorkingSetId)) {
- setMessage(TeamUIMessages.ImportProjectSetMainPage_workingSetNameExists, ERROR);
- return false;
- }
}
}
setMessage(null);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
index 65f0e3ddb..6c94cf95e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
@@ -87,7 +87,8 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
IAdaptable[] tempElements = oldSet.getElements();
IAdaptable[] finalElementList = new IAdaptable[tempElements.length + projects.length];
System.arraycopy(tempElements, 0, finalElementList, 0, tempElements.length);
- System.arraycopy(projects, 0,finalElementList, tempElements.length, projects.length);
+ IAdaptable[] adaptedProjects = oldSet.adaptElements(projects);
+ System.arraycopy(adaptedProjects, 0,finalElementList, tempElements.length, adaptedProjects.length);
oldSet.setElements(finalElementList);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
index d57c10ad3..93ca9f659 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
@@ -78,26 +78,13 @@ public class WorkingSetsDialog extends TitleAreaDialog {
wsTableViewer.setContentProvider(new ArrayContentProvider());
wsTableViewer.setLabelProvider(new WorkingSetLabelProvider());
- wsTableViewer.setInput(getResourceWorkingSets());
+ wsTableViewer.setInput(TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSets());
setupListeners();
return parent;
}
- private Object getResourceWorkingSets() {
- IWorkingSet[] allSets = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSets();
- ArrayList resourceSets = new ArrayList();
- for (int i = 0; i < allSets.length; i++) {
- String id = allSets[i].getId();
- if (id != null && id.equals(WorkingSetsDialog.resourceWorkingSetId)) {
- resourceSets.add(allSets[i]);
- }
- }
- return (IWorkingSet[]) resourceSets.toArray(new IWorkingSet[resourceSets.size()]);
-
- }
-
protected void okPressed() {
selectedWorkingSet = wsNameText.getText();

Back to the top