Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-05-28 15:40:10 +0000
committerJean Michel-Lemieux2004-05-28 15:40:10 +0000
commitd2e67e5eb2dbdcbe1db34773699a73c02f3d9872 (patch)
tree5c56feac7e50a871dfaaad79b33e9d593a81a833 /bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui
parentca434a1cd87a4d9faeb28fe6af09bd144c99ebc7 (diff)
downloadeclipse.platform.team-d2e67e5eb2dbdcbe1db34773699a73c02f3d9872.tar.gz
eclipse.platform.team-d2e67e5eb2dbdcbe1db34773699a73c02f3d9872.tar.xz
eclipse.platform.team-d2e67e5eb2dbdcbe1db34773699a73c02f3d9872.zip
Bug 62962 CVS create synchronization wizard should help
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java240
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java93
3 files changed, 196 insertions, 139 deletions
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 9374543c5..2c60b4c08 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
@@ -423,6 +423,8 @@ SynchronizeManager.20=Not allowed to create multiple synchronize instances of th
WorkspaceScope.0=Workspace
WorkingSetScope.0=Workspace
SubscriberParticipant.namePattern={0} ({1})
+SubscriberParticipantWizard.0=There are no {0} resources to synchronize
+SubscriberParticipantWizard.1=Before you can synchronize resources you will have to import resources into your workspace using the ''{0}'' wizard.
RemoveFromView.warningTitle=Confirm Remove
RemoveFromView.warningMessage=The selected resources will be removed from the view. A resource will reappear if it is modified or if its synchronization state changes.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
index de2d34f0f..97bfcd54f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
@@ -132,132 +132,130 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
Composite top = new Composite(parent2, SWT.NULL);
top.setLayout(new GridLayout());
initializeDialogUnits(top);
-
+
GridData data = new GridData(GridData.FILL_BOTH);
data.widthHint = 50;
top.setLayoutData(data);
setControl(top);
-
- if (resources.isEmpty()) {
- Label l = new Label(top, SWT.NULL);
- l.setText(Policy.bind("GlobalRefreshResourceSelectionPage.4")); //$NON-NLS-1$
- setPageComplete(false);
- } else {
- Label l = new Label(top, SWT.NULL);
- l.setText(Policy.bind("GlobalRefreshResourceSelectionPage.5")); //$NON-NLS-1$
-
- // The viewer
- fViewer = new ContainerCheckedTreeViewer(top, SWT.BORDER);
- data = new GridData(GridData.FILL_BOTH);
- //data.widthHint = 200;
- data.heightHint = 100;
- fViewer.getControl().setLayoutData(data);
- fViewer.setContentProvider(new MyContentProvider());
- fViewer.setLabelProvider( new DecoratingLabelProvider(
- new MyLabelProvider(),
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- fViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateOKStatus();
- }
- });
- fViewer.setSorter(new ResourceSorter(ResourceSorter.NAME));
- fViewer.setInput(resources);
-
- Composite selectGroup = new Composite(top, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- //layout.makeColumnsEqualWidth = false;
- selectGroup.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- selectGroup.setLayoutData(data);
-
- Button selectAll = new Button(selectGroup, SWT.NULL);
- selectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.12")); //$NON-NLS-1$
- selectAll.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- participantScope.setSelection(true);
- selectedResourcesScope.setSelection(false);
- workingSetScope.setSelection(false);
- updateParticipantScope();
- scopeCheckingElement = true;
- updateOKStatus();
- scopeCheckingElement = false;
- }
- });
- setButtonLayoutData(selectAll);
-
- Button deSelectAll = new Button(selectGroup, SWT.NULL);
- deSelectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.13")); //$NON-NLS-1$
- deSelectAll.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fViewer.setCheckedElements(new Object[0]);
- updateOKStatus();
- }
- });
- setButtonLayoutData(deSelectAll);
-
- // Scopes
- Group scopeGroup = new Group(top, SWT.NULL);
- scopeGroup.setText(Policy.bind("GlobalRefreshResourceSelectionPage.6")); //$NON-NLS-1$
- layout = new GridLayout();
- layout.numColumns = 3;
- layout.makeColumnsEqualWidth = false;
- scopeGroup.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 50;
- scopeGroup.setLayoutData(data);
-
- participantScope = new Button(scopeGroup, SWT.RADIO);
- participantScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.7")); //$NON-NLS-1$
- participantScope.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateParticipantScope();
- }
- });
-
- selectedResourcesScope = new Button(scopeGroup, SWT.RADIO);
- selectedResourcesScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.8")); //$NON-NLS-1$
- selectedResourcesScope.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateSelectedResourcesScope();
- }
- });
- data = new GridData();
- data.horizontalSpan = 2;
- selectedResourcesScope.setLayoutData(data);
-
-
- workingSetScope = new Button(scopeGroup, SWT.RADIO);
- workingSetScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.10")); //$NON-NLS-1$
- workingSetScope.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if(workingSetScope.getSelection()) {
- updateWorkingSetScope();
- }
+
+ Label l = new Label(top, SWT.NULL);
+ l.setText(Policy.bind("GlobalRefreshResourceSelectionPage.5")); //$NON-NLS-1$
+
+ // The viewer
+ fViewer = new ContainerCheckedTreeViewer(top, SWT.BORDER);
+ data = new GridData(GridData.FILL_BOTH);
+ //data.widthHint = 200;
+ data.heightHint = 100;
+ fViewer.getControl().setLayoutData(data);
+ fViewer.setContentProvider(new MyContentProvider());
+ fViewer.setLabelProvider(new DecoratingLabelProvider(new MyLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
+ fViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ updateOKStatus();
+ }
+ });
+ fViewer.setSorter(new ResourceSorter(ResourceSorter.NAME));
+ fViewer.setInput(resources);
+
+ Composite selectGroup = new Composite(top, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ //layout.makeColumnsEqualWidth = false;
+ selectGroup.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ selectGroup.setLayoutData(data);
+
+ Button selectAll = new Button(selectGroup, SWT.NULL);
+ selectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.12")); //$NON-NLS-1$
+ selectAll.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ participantScope.setSelection(true);
+ selectedResourcesScope.setSelection(false);
+ workingSetScope.setSelection(false);
+ updateParticipantScope();
+ scopeCheckingElement = true;
+ updateOKStatus();
+ scopeCheckingElement = false;
+ }
+ });
+ setButtonLayoutData(selectAll);
+
+ Button deSelectAll = new Button(selectGroup, SWT.NULL);
+ deSelectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.13")); //$NON-NLS-1$
+ deSelectAll.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ fViewer.setCheckedElements(new Object[0]);
+ updateOKStatus();
+ }
+ });
+ setButtonLayoutData(deSelectAll);
+
+ // Scopes
+ Group scopeGroup = new Group(top, SWT.NULL);
+ scopeGroup.setText(Policy.bind("GlobalRefreshResourceSelectionPage.6")); //$NON-NLS-1$
+ layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.makeColumnsEqualWidth = false;
+ scopeGroup.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 50;
+ scopeGroup.setLayoutData(data);
+
+ participantScope = new Button(scopeGroup, SWT.RADIO);
+ participantScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.7")); //$NON-NLS-1$
+ participantScope.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ updateParticipantScope();
+ }
+ });
+
+ selectedResourcesScope = new Button(scopeGroup, SWT.RADIO);
+ selectedResourcesScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.8")); //$NON-NLS-1$
+ selectedResourcesScope.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ updateSelectedResourcesScope();
+ }
+ });
+ data = new GridData();
+ data.horizontalSpan = 2;
+ selectedResourcesScope.setLayoutData(data);
+
+ workingSetScope = new Button(scopeGroup, SWT.RADIO);
+ workingSetScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.10")); //$NON-NLS-1$
+ workingSetScope.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ if (workingSetScope.getSelection()) {
+ updateWorkingSetScope();
}
- });
-
- workingSetLabel = new Text(scopeGroup, SWT.BORDER);
- workingSetLabel.setEditable(false);
- data = new GridData(GridData.FILL_HORIZONTAL);
- workingSetLabel.setLayoutData(data);
-
- Button selectWorkingSetButton = new Button(scopeGroup, SWT.NULL);
- selectWorkingSetButton.setText(Policy.bind("GlobalRefreshResourceSelectionPage.11")); //$NON-NLS-1$
- selectWorkingSetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectWorkingSetAction();
- }
- });
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- selectWorkingSetButton.setLayoutData(data);
- Dialog.applyDialogFont(selectWorkingSetButton);
-
- initializeScopingHint();
- }
+ }
+ });
+
+ workingSetLabel = new Text(scopeGroup, SWT.BORDER);
+ workingSetLabel.setEditable(false);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ workingSetLabel.setLayoutData(data);
+
+ Button selectWorkingSetButton = new Button(scopeGroup, SWT.NULL);
+ selectWorkingSetButton.setText(Policy.bind("GlobalRefreshResourceSelectionPage.11")); //$NON-NLS-1$
+ selectWorkingSetButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ selectWorkingSetAction();
+ }
+ });
+ data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ selectWorkingSetButton.setLayoutData(data);
+ Dialog.applyDialogFont(selectWorkingSetButton);
+
+ initializeScopingHint();
Dialog.applyDialogFont(top);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java
index c7b48266d..b3df7f9b7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberParticipantWizard.java
@@ -11,13 +11,12 @@
package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.*;
import org.eclipse.team.internal.ui.ITeamUIImages;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.ui.*;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ISynchronizeScope;
-import org.eclipse.team.ui.synchronize.SubscriberParticipant;
+import org.eclipse.team.ui.TeamImages;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.*;
/**
* This is the class registered with the org.eclipse.team.ui.synchronizeWizard
@@ -25,7 +24,8 @@ import org.eclipse.team.ui.synchronize.SubscriberParticipant;
public abstract class SubscriberParticipantWizard extends Wizard {
private GlobalRefreshResourceSelectionPage selectionPage;
-
+ private IWizard importWizard;
+
public SubscriberParticipantWizard() {
setDefaultPageImageDescriptor(TeamImages.getImageDescriptor(ITeamUIImages.IMG_WIZBAN_SHARE));
setNeedsProgressMonitor(false);
@@ -42,24 +42,79 @@ public abstract class SubscriberParticipantWizard extends Wizard {
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
public void addPages() {
- selectionPage = new GlobalRefreshResourceSelectionPage(getRootResources());
- selectionPage.setTitle(Policy.bind("GlobalRefreshSubscriberPage.1", getName())); //$NON-NLS-1$
- selectionPage.setMessage(Policy.bind("GlobalRefreshSubscriberPage.2")); //$NON-NLS-1$
- addPage(selectionPage);
+ if (getRootResources().length == 0) {
+ importWizard = getImportWizard();
+ importWizard.setContainer(getContainer());
+ importWizard.addPages();
+ IWizardPage[] pages = importWizard.getPages();
+ if (pages.length > 0) {
+ pages[0].setTitle(Policy.bind("SubscriberParticipantWizard.0", getName())); //$NON-NLS-1$
+ pages[0].setDescription(Policy.bind("SubscriberParticipantWizard.1", importWizard.getWindowTitle())); //$NON-NLS-1$
+ }
+ } else {
+ selectionPage = new GlobalRefreshResourceSelectionPage(getRootResources());
+ selectionPage.setTitle(Policy.bind("GlobalRefreshSubscriberPage.1", getName())); //$NON-NLS-1$
+ selectionPage.setMessage(Policy.bind("GlobalRefreshSubscriberPage.2")); //$NON-NLS-1$
+ addPage(selectionPage);
+ }
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
public boolean performFinish() {
- IResource[] resources = selectionPage.getRootResources();
- if(resources != null && resources.length > 0) {
- SubscriberParticipant participant = createParticipant(selectionPage.getSynchronizeScope());
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- // We don't know in which site to show progress because a participant could actually be shown in multiple sites.
- participant.run(null /* no site */);
+ if (importWizard != null) {
+ return importWizard.performFinish();
+ } else {
+ IResource[] resources = selectionPage.getRootResources();
+ if (resources != null && resources.length > 0) {
+ SubscriberParticipant participant = createParticipant(selectionPage.getSynchronizeScope());
+ TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
+ // We don't know in which site to show progress because a participant could actually be shown in multiple sites.
+ participant.run(null /* no site */);
+ }
+ return true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
+ */
+ public IWizardPage getNextPage(IWizardPage page) {
+ if(importWizard != null ) {
+ return importWizard.getNextPage(page);
+ }
+ return super.getNextPage(page);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performCancel()
+ */
+ public boolean performCancel() {
+ if(importWizard != null) {
+ return importWizard.performFinish();
+ }
+ return super.performCancel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#canFinish()
+ */
+ public boolean canFinish() {
+ if(importWizard != null) {
+ return importWizard.canFinish();
}
- return true;
+ return super.canFinish();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#getStartingPage()
+ */
+ public IWizardPage getStartingPage() {
+ if(importWizard != null) {
+ return importWizard.getStartingPage();
+ }
+ return super.getStartingPage();
}
protected abstract IResource[] getRootResources();
@@ -67,4 +122,6 @@ public abstract class SubscriberParticipantWizard extends Wizard {
protected abstract SubscriberParticipant createParticipant(ISynchronizeScope scope);
protected abstract String getName();
-}
+
+ protected abstract IWizard getImportWizard();
+} \ No newline at end of file

Back to the top