Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-06-16 13:31:20 -0400
committerMichael Valenta2003-06-16 13:31:20 -0400
commit48322c161fc280c50092e4d0a1ae9ea064d059d8 (patch)
tree9968486791fba9dc80ff661df51f377857414f56
parent20872b8a9561bd6bc07cd2965c7a22215d95f9d9 (diff)
downloadeclipse.platform.team-48322c161fc280c50092e4d0a1ae9ea064d059d8.tar.gz
eclipse.platform.team-48322c161fc280c50092e4d0a1ae9ea064d059d8.tar.xz
eclipse.platform.team-48322c161fc280c50092e4d0a1ae9ea064d059d8.zip
35239: [CVS UI] restore from repository dialog shouldn't show deleted revision
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java26
6 files changed, 36 insertions, 19 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
index 5ee523df6..efacce39f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
@@ -16,6 +16,7 @@ import java.util.Date;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableLayout;
@@ -26,10 +27,10 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -37,6 +38,7 @@ import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+import org.eclipse.ui.internal.WorkbenchColors;
/**
* This class provides the table and it's required components for a file's revision
@@ -46,7 +48,6 @@ public class HistoryTableProvider {
private ICVSFile currentFile;
private String currentRevision;
- private Shell shell;
/**
* Constructor for HistoryTableProvider.
@@ -65,7 +66,7 @@ public class HistoryTableProvider {
/**
* The history label provider.
*/
- class HistoryLabelProvider extends LabelProvider implements ITableLabelProvider {
+ class HistoryLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider {
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
@@ -110,6 +111,23 @@ public class HistoryTableProvider {
}
return ""; //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+ */
+ public Color getForeground(Object element) {
+ ILogEntry entry = adaptToLogEntry(element);
+ if (entry.isDeletion()) {
+ return WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
+ } else {
+ return null;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
+ */
+ public Color getBackground(Object element) {
+ return null;
+ }
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index ba490c1a3..7e289819e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -28,7 +28,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
index 27e606464..0b746d236 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
@@ -74,7 +74,7 @@ public class RestoreFromRepositoryAction extends CVSAction {
ICVSFolder commandRoot,
IProgressMonitor monitor) {
- // Find all RCS file names tat contain "Attic"
+ // Find all RCS file names that contain "Attic"
int index = line.indexOf(ATTIC);
if (index == -1) return OK;
// Extract the file name and path from the RCS path
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index c7e010508..d6e4e1379 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -824,6 +824,7 @@ RestoreFromRepositoryFileSelectionPage.fileToRestore={0} ({1} to be restored)
RestoreFromRepositoryFileSelectionPage.fileContentPaneTitle={0} {1} in ''{2}''
RestoreFromRepositoryFileSelectionPage.emptyRevisionPane=Remote revisions of selected file:
RestoreFromRepositoryFileSelectionPage.fileExists=File ''{0}'' already exists locally.
+RestoreFromRepositoryFileSelectionPage.revisionIsDeletion=Revision {0} of {1} is the deletion and can not be restored. Select another revision of this file.
RestoreFromRepositoryAction.noFilesTitle=No Deleted Files Found
RestoreFromRepositoryAction.noFilesMessage=There were no deleted files found on the repository in folder ''{0}''.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java
index 8621e04ad..84b0a63dc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java
@@ -12,7 +12,6 @@ package org.eclipse.team.internal.ccvs.ui.repo;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
import org.eclipse.team.internal.ccvs.ui.model.RemoteProjectsElement;
import org.eclipse.team.internal.ui.actions.TeamAction;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
index 526c4b701..ed926953f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
@@ -250,11 +250,13 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
* Method updateWidgetEnablements.
*/
private void updateWidgetEnablements() {
- setErrorMessage(null);
+
if (filesToRestore.isEmpty()) {
setPageComplete(false);
+ setErrorMessage(null);
return;
}
+
for (Iterator iter = filesToRestore.keySet().iterator(); iter.hasNext();) {
IFile file = (IFile) iter.next();
if (file.exists()) {
@@ -262,8 +264,16 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
setErrorMessage(Policy.bind("RestoreFromRepositoryFileSelectionPage.fileExists", file.getName())); //$NON-NLS-1$
return;
}
+
+ ILogEntry entry = (ILogEntry) filesToRestore.get(file);
+ if (entry.isDeletion()) {
+ setPageComplete(false);
+ setErrorMessage(Policy.bind("RestoreFromRepositoryFileSelectionPage.revisionIsDeletion", entry.getRevision(), file.getName())); //$NON-NLS-1$
+ return;
+ }
}
setPageComplete(true);
+ setErrorMessage(null);
}
/**
@@ -341,7 +351,6 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
if (fileContentPane != null && !fileContentPane.isDisposed()) {
fileContentPane.setInput(null);
}
- setErrorMessage(null);
// refresh the tree
if (fileTree != null) {
@@ -377,8 +386,6 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
revisionSelectionPane.setImage(CompareUI.getImage(selectedFile));
// Clear the file content pane
fileContentPane.setInput(null);
- // Clear any previous error messages
- setErrorMessage(null);
}
private void handleFileSelection(SelectionChangedEvent event) {
@@ -427,7 +434,6 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
}
}
});
-
} catch (CVSException e) {
setErrorMessage(
CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
@@ -477,19 +483,13 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
} catch (InterruptedException e) {
return null;
}
- setErrorMessage(null);
return new BufferedInputStream(is[0]);
}
private void handleRevisionChecked(CheckStateChangedEvent event) {
- // Only allow one element to be checked
if (event.getChecked()) {
- if (((ILogEntry)event.getElement()).isDeletion()) {
- revisionsTable.setChecked(event.getElement(), false);
- } else {
- revisionsTable.setCheckedElements(new Object[] {event.getElement()});
- filesToRestore.put(selectedFile, event.getElement());
- }
+ revisionsTable.setCheckedElements(new Object[] {event.getElement()});
+ filesToRestore.put(selectedFile, event.getElement());
}
if (revisionsTable.getCheckedElements().length == 0) {
filesToRestore.remove(selectedFile);

Back to the top