diff options
author | Tomasz Zarna | 2008-08-05 13:45:15 +0000 |
---|---|---|
committer | Tomasz Zarna | 2008-08-05 13:45:15 +0000 |
commit | c00f4e62b31404cb6e461193410e7e3abaee78f2 (patch) | |
tree | b549cff34fed1c7eaa132733e51d2a8c04b15ec9 /bundles/org.eclipse.team.cvs.ui | |
parent | b84102f9597b65cb163eb9a04f7ac2108aa551fb (diff) | |
download | eclipse.platform.team-c00f4e62b31404cb6e461193410e7e3abaee78f2.tar.gz eclipse.platform.team-c00f4e62b31404cb6e461193410e7e3abaee78f2.tar.xz eclipse.platform.team-c00f4e62b31404cb6e461193410e7e3abaee78f2.zip |
bug 225749: [Wizards] Creating working sets from Import > Project from CVS wizard
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui')
5 files changed, 42 insertions, 113 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java index 2777e0a2f..9e285fc29 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * 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 @@ -15,6 +15,7 @@ import org.eclipse.core.runtime.*; import org.eclipse.team.internal.ccvs.core.CVSException; import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkingSet; /** * This operation checks out a multiple remote folders into the workspace. @@ -24,18 +25,18 @@ import org.eclipse.ui.IWorkbenchPart; public class CheckoutMultipleProjectsOperation extends CheckoutProjectOperation { boolean hasTargetLocation; - //The name of the working set to add all of the projects to - String workingSetName; + //The working set to add all of the projects to + IWorkingSet[] workingSets; public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation) { - this(part,remoteFolders,targetLocation,null); + this(part,remoteFolders,targetLocation, null); } - public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation, String wsName) { + public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation, IWorkingSet[] workingSets) { super(part, remoteFolders, targetLocation); hasTargetLocation = targetLocation != null; setInvolvesMultipleResources(remoteFolders.length > 1); - this.workingSetName=wsName; + this.workingSets=workingSets; } /** @@ -57,8 +58,8 @@ public class CheckoutMultipleProjectsOperation extends CheckoutProjectOperation return checkout(folder, null, monitor); } - protected String getWorkingSetName(){ - return workingSetName; + protected IWorkingSet[] getWorkingSets(){ + return workingSets; } } 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 8847c0eab..e838f6c4a 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * 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 @@ -172,9 +172,10 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation { } }, Policy.subMonitorFor(pm, 90)); } - String wsName = getWorkingSetName(); - if (wsName != null){ - createWorkingSet(wsName, targetProjects); + IWorkingSet[] ws = getWorkingSets(); + if (ws != null) { + for (int i = 0; i < ws.length; i++) + createWorkingSet(ws[i].getName(), targetProjects); } return result[0]; } catch (CVSException e) { @@ -528,9 +529,9 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation { } /* - * Returns the name of the working set to add the checked out projects to or null for none + * Returns the working sets to add the checked out projects to or null for none */ - protected String getWorkingSetName(){ + protected IWorkingSet[] getWorkingSets() { return null; } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java index 39814160e..7c77c4299 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * 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 @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.team.internal.ccvs.core.CVSException; import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkingSet; /** * This operation checks out a single remote folder into the workspace as @@ -25,17 +26,17 @@ public class CheckoutSingleProjectOperation extends CheckoutProjectOperation { private boolean preconfigured; private IProject targetProject; - private String workingSetName; + private IWorkingSet[] workingSets; public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured) { this(part,remoteFolder,targetProject,targetLocation,preconfigured,null); } - public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured, String wsName) { + public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured, IWorkingSet[] workingSets) { super(part, new ICVSRemoteFolder[] { remoteFolder }, targetLocation); this.targetProject = targetProject; this.preconfigured = preconfigured; - this.workingSetName = wsName; + this.workingSets = workingSets; } private boolean isPreconfigured() { @@ -66,8 +67,8 @@ public class CheckoutSingleProjectOperation extends CheckoutProjectOperation { return checkout(folder, targetProject, monitor); } - protected String getWorkingSetName(){ - return workingSetName; + protected IWorkingSet[] getWorkingSets(){ + return workingSets; } } 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 ea43f0258..e19a5a6b1 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * 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 @@ -16,7 +16,6 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; @@ -26,8 +25,9 @@ import org.eclipse.swt.widgets.*; import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; 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; +import org.eclipse.ui.dialogs.WorkingSetGroup; /** * This is the main page of the Check Out As wizard. It allows the user to specify @@ -48,10 +48,7 @@ public class CheckoutAsMainPage extends CVSWizardPage { private Button recurseCheck; private boolean recurse = true; - private Button addToWorkingSet; - private Button browseButton; - Text workingSetField; - private boolean haveBrowsed; + private WorkingSetGroup workingSetGroup; public static final String NAME = "CheckoutAsMainPage"; //$NON-NLS-1$ @@ -223,24 +220,6 @@ public class CheckoutAsMainPage extends CVSWizardPage { } } } - - workingSetField.setEnabled(addToWorkingSet.getSelection()); - browseButton.setEnabled(addToWorkingSet.getSelection()); - //If add to working set checkbox selected and the user has not selected - //a working set, mark page incomplete - if (addToWorkingSet.getSelection() && !haveBrowsed){ - setPageComplete(false); - return; - } - - if (!validateWorkingSetName()){ - setPageComplete(false); - return; - } - - - setErrorMessage(null); - setPageComplete(true); } public String getProjectName() { @@ -282,31 +261,17 @@ public class CheckoutAsMainPage extends CVSWizardPage { } /** - * Returns the name of the chosen working set - * @return String a string representing the working set or an empty string if no working set has been selected - */ - public String getWorkingSetName(){ - return workingSetField.getText(); - } - - /** - * Returns whether the checkout should add the project(s) to a working set - * @return boolean true if it should add it to a working set, false otherwise + * Returns the chosen working sets + * + * @return an array containing the selected working sets; can be empty if no + * working set has been selected */ - public boolean shouldAddToWorkingSet(){ - return addToWorkingSet.getSelection(); + public IWorkingSet[] getWorkingSets(){ + return workingSetGroup.getSelectedWorkingSets(); } private void addWorkingSetSection(Composite composite, String label) { - addToWorkingSet = createCheckBox(composite, label); - addToWorkingSet.setSelection(false); - addToWorkingSet.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - updateEnablements(); - } - }); - Composite inner = new Composite(composite, SWT.NULL); inner.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(); @@ -315,39 +280,13 @@ public class CheckoutAsMainPage extends CVSWizardPage { layout.marginWidth = 0; inner.setLayout(layout); - workingSetField = createTextField(inner); - workingSetField.setEditable(false); - browseButton = new Button(inner, SWT.PUSH); - browseButton.setText(CVSUIMessages.CheckoutAsMainPage_Browse); - //keep track if the user has browsed for working sets; don't show any error message until then - haveBrowsed = false; - browseButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - //open workspace selection dialog - final WorkingSetsDialog dialog = new WorkingSetsDialog(getShell()); - haveBrowsed = true; - if (dialog.open() == Window.OK) - workingSetField.setText(dialog.getSelectedWorkingSet()); - - updateEnablements(); - } - }); + setWorkingSetGroup(new WorkingSetGroup(inner, null, new String[] { + "org.eclipse.ui.resourcesWorkingSetPage", //$NON-NLS-1$ + "org.eclipse.jdt.ui.JavaWorkingSetPage" })); //$NON-NLS-1$ updateEnablements(); - } - private boolean validateWorkingSetName() { - if (addToWorkingSet.getSelection()) { - String workingSetName = workingSetField.getText(); - if (workingSetName.length() == 0) { - setMessage(CVSUIMessages.CheckoutAsMainPage_EmptyWorkingSetErrorMessage, ERROR); - return false; - } - } - setMessage(null); - return true; + public void setWorkingSetGroup(WorkingSetGroup workingSetGroup) { + this.workingSetGroup = workingSetGroup; } - - - } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java index 8bd84a6c4..1666c2c58 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * 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 @@ -253,19 +253,11 @@ public class CheckoutAsWizard extends Wizard { // Run the checkout in the background ICVSRemoteFolder folder = getRemoteFolder(); final boolean recurse = mainPage.isRecurse(); - if (mainPage.shouldAddToWorkingSet()){ - new CheckoutSingleProjectOperation(part, folder, newProject, targetLocation, false, mainPage.getWorkingSetName()) { + new CheckoutSingleProjectOperation(part, folder, newProject, targetLocation, false, mainPage.getWorkingSets()) { protected boolean isRecursive() { return recurse; } }.run(); - } else { - new CheckoutSingleProjectOperation(part, folder, newProject, targetLocation, false) { - protected boolean isRecursive() { - return recurse; - } - }.run(); - } return true; } @@ -275,13 +267,8 @@ public class CheckoutAsWizard extends Wizard { */ private boolean performMultipleCheckoutAs() throws InvocationTargetException, InterruptedException { String targetLocation = locationSelectionPage.getTargetLocation(); - if (mainPage.shouldAddToWorkingSet()){ - //Run the checkout in the background - new CheckoutMultipleProjectsOperation(part, getRemoteFoldersWithProjectDescriptions(), targetLocation, mainPage.getWorkingSetName()).run(); - } else { - // Run the checkout in the background - new CheckoutMultipleProjectsOperation(part, getRemoteFoldersWithProjectDescriptions(), targetLocation).run(); - } + // Run the checkout in the background + new CheckoutMultipleProjectsOperation(part, getRemoteFoldersWithProjectDescriptions(), targetLocation, mainPage.getWorkingSets()).run(); return true; } |