Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-06-06 15:56:38 -0400
committerJean Michel-Lemieux2002-06-06 15:56:38 -0400
commit8912f8d5d96c10169680cb3fe864936e6e94c6e9 (patch)
tree526e1ca63c9a79f1baad62bc25727b92daf4aa9d
parent97062860c12175a51bd7692de5bddedb74816931 (diff)
downloadeclipse.platform.team-8912f8d5d96c10169680cb3fe864936e6e94c6e9.tar.gz
eclipse.platform.team-8912f8d5d96c10169680cb3fe864936e6e94c6e9.tar.xz
eclipse.platform.team-8912f8d5d96c10169680cb3fe864936e6e94c6e9.zip
2.0 Fix Pass 3
PR 18852 Reviewed by Mike Valenta
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties26
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java37
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java178
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java38
9 files changed, 276 insertions, 87 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 0220a49d4..0cc40347a 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
@@ -145,14 +145,14 @@ SiteSelectionPage.disconnectTarget=&Disconnect from Site
GetAsProject.thisResourceExists=The resource ''{0}'' already exists in the workspace. Overwrite?
GetAsProject.thisExternalFileExists=The folder ''{0}'' exists in the local file system. Overwrite?
GetAsProject.confirmOverwrite=Confirm Overwrite
-GetAsProject.taskName1=Receiving ''{0}''
-GetAsProject.taskNameN=Receiving {0} folders
+GetAsProject.taskName1=Downloading ''{0}''
+GetAsProject.taskNameN=Downloading {0} folders
GetAsProject.errorCreatingProject=Error creating project: {0}
GetAsProject.errorGettingResources=Error getting resources
GetAs.checkoutFailed=Problems encountered receiving the remote folder
-GetAs.enterProjectTitle=Get ''{0}'' As...
-GetAs.taskname=Receiving ''{0}'' as ''{1}''
+GetAs.enterProjectTitle=Downloading ''{0}'' As...
+GetAs.taskname=Downloading ''{0}'' as ''{1}''
Error=Error
@@ -161,10 +161,10 @@ CreateNewFolderAction.title=New Remote Folder
CreateNewFolderAction.message=Enter the name for the new remote folder:
CreateNewFolderAction.newFolderName=New Folder
-GetAction.title=Get
+GetAction.title=Download
GetAction.working=Downloading from ''{0}''...
-PutAction.title=Put
+PutAction.title=Upload
PutAction.working=Uploading to ''{0}''...
SiteExplorerView.addSiteAction=Target &Site
@@ -191,7 +191,7 @@ SiteExplorerViewLabelProvider.fileSize={0} KB
MappingSelectionPage.description=Specify the location on the site where you want to target your resources.
MappingSelectionPage.label=Select the site or a folder:
-MappingSelectionPage.newFolderLabel=&New Folder...
+MappingSelectionPage.newFolderLabel=&Create Folder...
MappingSelectionPage.mappingTitle=Select the location on the site
ConfigureTargetWizardQuestion_2=Question
@@ -205,12 +205,16 @@ ConfigureTargetWizard.errorOccurred=An error occured connecting to ''{0}''.\n\nC
ConfigureTargetWizard.errorUnmappingProject=An error occured trying to disconnect this project.
GetAction.Exception_getting_provider_2=Exception getting provider
-GetSyncAction.Getting..._1=Getting...
+GetAction.confirmFileOverwrite=You have local changes which you are about to overwrite. Do you wish to continue?
+GetAction.confirmFileOverwriteTitle=Confirm Overwrite
+
+
+GetSyncAction.Getting..._1=Downloading...
PutAction.Exception_getting_provider_2=Exception getting provider
-PutSyncAction.Putting..._1=Putting...
+PutSyncAction.Putting..._1=Uploading...
-TargetCatchupReleaseViewer.Get_1=&Get
-TargetCatchupReleaseViewer.Put_2=&Put
+TargetCatchupReleaseViewer.Get_1=&Download
+TargetCatchupReleaseViewer.Put_2=&Upload
SiteSelectionPage.siteLabelCurrentWithMapping={0} (currently as {1})
SiteSelectionPage.siteLabelCurrent={0} (current)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java
index c1fd3ebb2..cc361b3ab 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java
@@ -19,8 +19,8 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -85,8 +85,28 @@ public class DiscardSiteAction extends TargetAction {
return composite;
}
- protected void createMainDialogArea(Composite composite) {
- Label label = new Label(composite, SWT.WRAP);
+ protected void createMainDialogArea(Composite top) {
+ Composite parent = new Composite(top, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ parent.setFont(parent.getFont());
+
+ // create image
+ Image image = getImage(DLG_IMG_WARNING);
+ if (image != null) {
+ Label label = new Label(parent, 0);
+ image.setBackground(label.getBackground());
+ label.setImage(image);
+ label.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER |
+ GridData.VERTICAL_ALIGN_BEGINNING));
+ }
+
+ Label label = new Label(parent, SWT.WRAP);
label.setText(Policy.bind("SiteExplorerView.projectsAlreadyMapped")); //$NON-NLS-1$
GridData data = new GridData(
GridData.GRAB_HORIZONTAL |
@@ -95,9 +115,16 @@ public class DiscardSiteAction extends TargetAction {
GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
- label.setFont(composite.getFont());
+ label.setFont(parent.getFont());
- unmap = new Button(composite, SWT.CHECK);
+ unmap = new Button(parent, SWT.CHECK);
+ data = new GridData(
+ GridData.GRAB_HORIZONTAL |
+ GridData.GRAB_VERTICAL |
+ GridData.HORIZONTAL_ALIGN_FILL |
+ GridData.VERTICAL_ALIGN_CENTER);
+ data.horizontalSpan = 2;
+ unmap.setLayoutData(data);
unmap.setText(Policy.bind("SiteExplorerView.unmapProjectsAndDisconnect")); //$NON-NLS-1$
unmap.setSelection(false);
unmap.addListener(SWT.Selection, new Listener() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java
index 0f91747fa..80ce5e052 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java
@@ -6,55 +6,183 @@ package org.eclipse.team.internal.ui.target;
*/
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.target.TargetManager;
import org.eclipse.team.core.target.TargetProvider;
-import org.eclipse.team.internal.core.*;
+import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
import org.eclipse.team.internal.core.TeamPlugin;
+import org.eclipse.team.internal.ui.DetailsDialog;
+import org.eclipse.team.internal.ui.IPromptCondition;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
+import org.eclipse.team.internal.ui.PromptingDialog;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
/**
* Action for getting the contents of the selected resources
*/
-public class GetAction extends TeamAction {
- public void run(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getTargetProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000);
- TargetProvider provider = (TargetProvider)iterator.next();
- monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
+public class GetAction extends TargetAction {
+
+ private class OutgoingChangesDialog extends DetailsDialog {
+ private IResource[] outgoingChanges;
+ private org.eclipse.swt.widgets.List detailsList;
+
+ public OutgoingChangesDialog(Shell shell, IResource[] outgoingChanges) {
+ super(shell, Policy.bind("GetAction.confirmFileOverwriteTitle")); //$NON-NLS-1$
+ this.outgoingChanges = outgoingChanges;
+ }
+
+ protected Composite createDropDownDialogArea(Composite parent) {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ composite.setFont(parent.getFont());
+
+ detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ GridData data = new GridData ();
+ data.heightHint = 75;
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ detailsList.setLayoutData(data);
+
+ for (int i = 0; i < outgoingChanges.length; i++) {
+ detailsList.add(outgoingChanges[i].getFullPath().toString()); //$NON-NLS-1$
+ }
+ return composite;
+ }
+
+ protected void createMainDialogArea(Composite top) {
+ Composite parent = new Composite(top, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ parent.setFont(parent.getFont());
+
+ // create image
+ Image image = getImage(DLG_IMG_QUESTION);
+ if (image != null) {
+ Label label = new Label(parent, 0);
+ image.setBackground(label.getBackground());
+ label.setImage(image);
+ label.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER |
+ GridData.VERTICAL_ALIGN_BEGINNING));
+ }
+
+ Label label = new Label(parent, SWT.WRAP);
+ label.setText(Policy.bind("GetAction.confirmFileOverwrite")); //$NON-NLS-1$
+ GridData data = new GridData(
+ GridData.GRAB_HORIZONTAL |
+ GridData.GRAB_VERTICAL |
+ GridData.HORIZONTAL_ALIGN_FILL |
+ GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ setPageComplete(true);
+ }
+
+ protected void updateEnablements() {
+ }
+ }
+
+ public void run(IAction action) {
+ if(promptForOutgoingChanges()) {
+ run(new WorkspaceModifyOperation() {
+ public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ try {
+ Hashtable table = getTargetProviderMapping();
+ Set keySet = table.keySet();
+ monitor.beginTask(null, keySet.size() * 1000);
- provider.get(providerResources, subMonitor);
+ // perform the get on each provider
+ Iterator iterator = keySet.iterator();
+ while (iterator.hasNext()) {
+ TargetProvider provider = (TargetProvider)iterator.next();
+ monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
+ List list = (List)table.get(provider);
+ IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
+ provider.get(providerResources, Policy.subInfiniteMonitorFor(monitor, 1000));
+ }
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
}
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
}
+ }, Policy.bind("GetAction.title"), this.PROGRESS_DIALOG); //$NON-NLS-1$
+ }
+ }
+
+ private boolean promptForOutgoingChanges() {
+ try {
+ // find any outgoing changes that will be overwritten and prompt
+ Hashtable table = getTargetProviderMapping();
+ Set keySet = table.keySet();
+
+ Iterator iterator = keySet.iterator();
+ List outgoingChanges = new ArrayList();
+ while (iterator.hasNext()) {
+ TargetProvider provider = (TargetProvider)iterator.next();
+ List list = (List)table.get(provider);
+ IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
+ outgoingChanges.addAll(Arrays.asList(findResourcesWithOutgoingChanges(providerResources)));
+ }
+ if(! outgoingChanges.isEmpty()) {
+ final OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(),
+ (IResource[]) outgoingChanges.toArray(new IResource[outgoingChanges.size()]));
+ final boolean okToContinue[] = {true};
+ getShell().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ if(dialog.open() != dialog.OK) {
+ okToContinue[0] = false;
+ }
+ }
+ });
+ return okToContinue[0];
}
- }, Policy.bind("GetAction.title"), this.PROGRESS_DIALOG); //$NON-NLS-1$
+ return true;
+ } catch(CoreException e) {
+ TeamUIPlugin.handle(e);
+ } catch(TeamException e) {
+ TeamUIPlugin.handle(e);
+ }
+ return false;
}
+
/**
* @see TeamAction#isEnabled()
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java
index 6a77152d8..620ea3022 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java
@@ -45,16 +45,15 @@ public class GetSyncAction extends TargetSyncAction {
*/
protected boolean isEnabled(ITeamNode node) {
// Get action is enabled for any changed nodes.
- return new SyncSet(new StructuredSelection(node)).getChangedNodes().length > 0;
+ SyncSet set = new SyncSet(new StructuredSelection(node));
+ return set.hasIncomingChanges() || set.hasConflicts();
}
/**
* @see TargetSyncAction#removeNonApplicableNodes(SyncSet, int)
*/
protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- if (syncMode == SyncView.SYNC_INCOMING) {
- set.removeOutgoingNodes();
- }
+ set.removeOutgoingNodes();
}
/**
@@ -107,4 +106,4 @@ public class GetSyncAction extends TargetSyncAction {
monitor.done();
}
}
-}
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
index aa4ae7e4d..4f12420d3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
@@ -241,8 +241,8 @@ public class SiteExplorerView extends ViewPart implements ISiteListener {
folderTree.setSorter(new ViewerSorter() {
public int compare(Viewer viewer, Object e1, Object e2) {
- String name1 = "";
- String name2 = "";
+ String name1 = ""; //$NON-NLS-1$
+ String name2 = ""; //$NON-NLS-1$
if(e1 instanceof RemoteResourceElement) {
name1 = ((RemoteResourceElement)e1).getRemoteResource().getName();
} else if(e1 instanceof SiteElement) {
@@ -269,32 +269,30 @@ public class SiteExplorerView extends ViewPart implements ISiteListener {
});
Table table = new Table(sash, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+ table.setHeaderVisible(true);
TableColumn tableColumn = new TableColumn(table, SWT.NULL);
tableColumn.setText(Policy.bind("SiteExplorerView.Name_1")); //$NON-NLS-1$
tableColumn.addSelectionListener(getColumnListener());
+ layout.addColumnData(new ColumnWeightData(30, true));
tableColumn = new TableColumn(table, SWT.NULL);
tableColumn.setText(Policy.bind("SiteExplorerView.Size_2")); //$NON-NLS-1$
tableColumn.setAlignment(SWT.RIGHT);
tableColumn.addSelectionListener(getColumnListener());
+ layout.addColumnData(new ColumnWeightData(10, true));
tableColumn = new TableColumn(table, SWT.NULL);
tableColumn.setText(Policy.bind("SiteExplorerView.Modified_3")); //$NON-NLS-1$
tableColumn.addSelectionListener(getColumnListener());
+ layout.addColumnData(new ColumnWeightData(30, true));
tableColumn = new TableColumn(table, SWT.NULL);
tableColumn.setText(Policy.bind("SiteExplorerView.URL_4")); //$NON-NLS-1$
-
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(30, true));
- layout.addColumnData(new ColumnWeightData(10, true));
- layout.addColumnData(new ColumnWeightData(30, true));
layout.addColumnData(new ColumnWeightData(30, true));
- table.setLayout(layout);
- table.setHeaderVisible(true);
-
folderContentsTable = new TableViewer(table);
folderContentsTable.setContentProvider(new SiteLazyContentProvider());
folderContentsTable.setLabelProvider(new SiteExplorerViewLabelProvider());
@@ -410,7 +408,7 @@ public class SiteExplorerView extends ViewPart implements ISiteListener {
selectedFolder = (RemoteResourceElement)folderContentsTable.getInput();
}
- IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(shell, selectedFolder.getRemoteResource(), Policy.bind("CreateNewFolderAction.newFolderName"));
+ IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(shell, selectedFolder.getRemoteResource(), Policy.bind("CreateNewFolderAction.newFolderName")); //$NON-NLS-1$
if (newFolder == null)
return;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
index ff79825b9..54a8e01db 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
@@ -30,7 +30,11 @@ public class SiteExplorerViewLabelProvider extends WorkbenchLabelProvider implem
return super.getText(element);
case 1 :
if(element instanceof RemoteResourceElement) {
- int size = ((RemoteResourceElement)element).getSize();
+ RemoteResourceElement remote = ((RemoteResourceElement)element);
+ if(remote.getRemoteResource().isContainer()) {
+ return ""; //$NON-NLS-1$
+ }
+ int size = remote.getSize();
int sizeKb = size / 1000;
if(sizeKb == 0 && size % 1000 > 0) {
sizeKb = 1;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java
index 2c64b33d3..999dbeb02 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java
@@ -100,6 +100,9 @@ public class SiteSelectionPage extends TargetWizardPage {
SiteElement siteElement = (SiteElement)((IStructuredSelection)table.getSelection()).getFirstElement();
if(siteElement != null) {
site = siteElement.getSite();
+ setPageComplete(true);
+ } else {
+ setPageComplete(false);
}
}
});
@@ -120,12 +123,19 @@ public class SiteSelectionPage extends TargetWizardPage {
}
});
+ useNewRepo.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ SiteSelectionPage.this.setPageComplete(! useNewRepo.getSelection());
+ }
+ });
+
if(currentProvider != null ) {
disconnectTarget = createRadioButton(composite, Policy.bind("SiteSelectionPage.disconnectTarget"), 2); //$NON-NLS-1$
disconnectTarget.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
disconnect = disconnectTarget.getSelection();
+ SiteSelectionPage.this.setPageComplete(true);
}
});
}
@@ -159,4 +169,15 @@ public class SiteSelectionPage extends TargetWizardPage {
public boolean isDisconnect() {
return disconnect;
}
+
+ /**
+ * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
+ */
+ public boolean canFlipToNextPage() {
+ if(isDisconnect()) {
+ return false;
+ } else {
+ return true;
+ }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java
index b5277b780..bc678eb1e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java
@@ -12,11 +12,17 @@ package org.eclipse.team.internal.ui.target;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.target.IRemoteTargetResource;
import org.eclipse.team.core.target.Site;
+import org.eclipse.team.core.target.TargetManager;
+import org.eclipse.team.core.target.TargetProvider;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.actions.TeamAction;
@@ -71,4 +77,26 @@ public abstract class TargetAction extends TeamAction {
}
return (Site[])sites.toArray(new Site[sites.size()]);
}
+
+ protected IResource[] findResourcesWithOutgoingChanges(IResource[] resources) throws TeamException, CoreException {
+ // Collect the dirty resource
+ final List dirtyResources = new ArrayList();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ final TargetProvider provider = TargetManager.getProvider(resource.getProject());
+ resource.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) throws CoreException {
+ if (resource.getType() == IResource.FILE) {
+ if (provider.isDirty(resource)) {
+ dirtyResources.add(resource);
+ }
+ } else {
+ // Check for outgoing folder deletions?
+ }
+ return true;
+ }
+ }, IResource.DEPTH_INFINITE, true /* include phantoms */);
+ }
+ return (IResource[]) dirtyResources.toArray(new IResource[dirtyResources.size()]);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
index 643b80d2b..6e28cb595 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
@@ -11,14 +11,12 @@
package org.eclipse.team.internal.ui.target;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -32,10 +30,9 @@ import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.team.internal.ui.IPromptCondition;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.PromptingDialog;
-import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-public class UploadAction extends TeamAction {
+public class UploadAction extends TargetAction {
/**
* @see TeamAction#isEnabled()
@@ -74,33 +71,17 @@ public class UploadAction extends TeamAction {
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1024);
final TargetProvider provider = (TargetProvider)iterator.next();
- monitor.setTaskName(Policy.bind("UploadAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
+ subMonitor.setTaskName(Policy.bind("UploadAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
- // Collect the dirty resource
- List list = (List)table.get(provider);
- final List dirtyResources = new ArrayList();
- for (Iterator iter = list.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- if (provider.isDirty(resource)) {
- dirtyResources.add(resource);
- }
- } else {
- // Check for outgoing folder deletions?
- }
- return true;
- }
- }, IResource.DEPTH_INFINITE, true /* include phantoms */);
- }
- if (dirtyResources.isEmpty()) {
+ IResource[] providerResources = (IResource[])((List)table.get(provider)).toArray(new IResource[0]);
+ IResource[] outgoingChanges = findResourcesWithOutgoingChanges(providerResources);
+ if (outgoingChanges.length == 0) {
getShell().getDisplay().syncExec(
new Runnable() {
public void run() {
MessageDialog.openInformation(getShell(),
- Policy.bind("UploadAction.noDirtyTitle"),
- Policy.bind("UploadAction.noDirtyMessage"));
+ Policy.bind("UploadAction.noDirtyTitle"), //$NON-NLS-1$
+ Policy.bind("UploadAction.noDirtyMessage")); //$NON-NLS-1$
}
});
return;
@@ -109,13 +90,13 @@ public class UploadAction extends TeamAction {
// Prompt for any outgoing deletions
PromptingDialog prompt = new PromptingDialog(
getShell(),
- (IResource[])dirtyResources.toArray(new IResource[list.size()]),
+ outgoingChanges,
new IPromptCondition() {
public boolean needsPrompt(IResource resource) {
return ! resource.exists();
}
public String promptMessage(IResource resource) {
- return Policy.bind("UploadAction.confirmFileDeletionMessage", resource.getFullPath().toString());
+ return Policy.bind("UploadAction.confirmFileDeletionMessage", resource.getFullPath().toString()); //$NON-NLS-1$
}
},
Policy.bind("UploadAction.confirmDeletionTitle"));//$NON-NLS-1$
@@ -133,5 +114,4 @@ public class UploadAction extends TeamAction {
}
}, Policy.bind("UploadAction.problemMessage"), this.PROGRESS_DIALOG); //$NON-NLS-1$
}
-
}

Back to the top