Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-02-04 17:00:36 +0000
committerjames2002-02-04 17:00:36 +0000
commit18c1e6b4f1769021275039395b214742173f4d63 (patch)
treeee877d75405f3dafe1b7467939480a7a359be1b8
parent8d01c0125721698140eee5596b5f7dd3bb39609a (diff)
downloadeclipse.platform.team-18c1e6b4f1769021275039395b214742173f4d63.tar.gz
eclipse.platform.team-18c1e6b4f1769021275039395b214742173f4d63.tar.xz
eclipse.platform.team-18c1e6b4f1769021275039395b214742173f4d63.zip
7523: Better history view support for tags
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java106
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties19
4 files changed, 106 insertions, 21 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 2f8277b08..e15708e92 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -155,6 +155,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
protected void initializePreferences() {
IPreferenceStore store = getPreferenceStore();
store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true);
+ store.setDefault(ICVSUIConstants.PREF_SHOW_TAGS, true);
store.setDefault(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSProviderPlugin.DEFAULT_PRUNE);
store.setDefault(ICVSUIConstants.PREF_TIMEOUT, CVSProviderPlugin.DEFAULT_TIMEOUT);
store.setDefault(ICVSUIConstants.PREF_SHOW_MODULES, false);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
index 4475dbf22..feb040642 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
@@ -27,7 +27,6 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ISelection;
@@ -40,6 +39,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.custom.SashForm;
@@ -74,7 +74,6 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.part.ResourceTransfer;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.IUpdate;
/**
* The history view allows browsing of an array of resource revisions
@@ -85,14 +84,17 @@ public class HistoryView extends ViewPart implements ISelectionListener {
private TableViewer tableViewer;
private TextViewer textViewer;
+ private TableViewer tagViewer;
private OpenRemoteFileAction openAction;
private IAction toggleTextAction;
+ private IAction toggleListAction;
private TextViewerAction copyAction;
private TextViewerAction selectAllAction;
private Action addAction;
private SashForm sashForm;
+ private SashForm innerSashForm;
//column constants
private static final int COL_REVISION = 0;
@@ -101,6 +103,9 @@ public class HistoryView extends ViewPart implements ISelectionListener {
private static final int COL_AUTHOR = 3;
private static final int COL_COMMENT = 4;
+ private Image branchImage;
+ private Image versionImage;
+
class HistoryLabelProvider extends LabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
return null;
@@ -225,15 +230,19 @@ public class HistoryView extends ViewPart implements ISelectionListener {
final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
toggleTextAction = new Action(Policy.bind("HistoryView.showComment")) {
public void run() {
- if (sashForm.getMaximizedControl() != null) {
- sashForm.setMaximizedControl(null);
- } else {
- sashForm.setMaximizedControl(tableViewer.getControl());
- }
+ setViewerVisibility();
store.setValue(ICVSUIConstants.PREF_SHOW_COMMENTS, toggleTextAction.isChecked());
}
};
toggleTextAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_SHOW_COMMENTS));
+ // Toggle list visible action
+ toggleListAction = new Action(Policy.bind("HistoryView.showTags")) {
+ public void run() {
+ setViewerVisibility();
+ store.setValue(ICVSUIConstants.PREF_SHOW_TAGS, toggleListAction.isChecked());
+ }
+ };
+ toggleListAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_SHOW_TAGS));
// Contribute actions to popup menu
MenuManager menuMgr = new MenuManager();
@@ -251,6 +260,7 @@ public class HistoryView extends ViewPart implements ISelectionListener {
IActionBars actionBars = getViewSite().getActionBars();
IMenuManager actionBarsMenu = actionBars.getMenuManager();
actionBarsMenu.add(toggleTextAction);
+ actionBarsMenu.add(toggleListAction);
// Create the local tool bar
IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
@@ -279,7 +289,22 @@ public class HistoryView extends ViewPart implements ISelectionListener {
menu = menuMgr.createContextMenu(text);
text.setMenu(menu);
}
-
+ private void setViewerVisibility() {
+ boolean showText = toggleTextAction.isChecked();
+ boolean showList = toggleListAction.isChecked();
+ if (showText && showList) {
+ sashForm.setMaximizedControl(null);
+ innerSashForm.setMaximizedControl(null);
+ } else if (showText) {
+ sashForm.setMaximizedControl(null);
+ innerSashForm.setMaximizedControl(textViewer.getTextWidget());
+ } else if (showList) {
+ sashForm.setMaximizedControl(null);
+ innerSashForm.setMaximizedControl(tagViewer.getTable());
+ } else {
+ sashForm.setMaximizedControl(tableViewer.getControl());
+ }
+ }
/**
* Creates the columns for the history table.
*/
@@ -324,20 +349,27 @@ public class HistoryView extends ViewPart implements ISelectionListener {
* Method declared on IWorkbenchPart
*/
public void createPartControl(Composite parent) {
+ initializeImages();
sashForm = new SashForm(parent, SWT.VERTICAL);
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
tableViewer = createTable(sashForm);
- textViewer = createText(sashForm);
+ innerSashForm = new SashForm(sashForm, SWT.HORIZONTAL);
+ tagViewer = createTagTable(innerSashForm);
+ textViewer = createText(innerSashForm);
sashForm.setWeights(new int[] { 70, 30 });
+ innerSashForm.setWeights(new int[] { 50, 50 });
getSite().getPage().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
contributeActions();
- if (!CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_COMMENTS)) {
- sashForm.setMaximizedControl(tableViewer.getControl());
- }
+ setViewerVisibility();
// set F1 help
//WorkbenchHelp.setHelp(viewer.getControl(), new ViewContextComputer (this, IVCMHelpContextIds.RESOURCE_HISTORY_VIEW));
initDragAndDrop();
}
+ private void initializeImages() {
+ CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
+ versionImage = plugin.getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION).createImage();
+ branchImage = plugin.getImageDescriptor(ICVSUIConstants.IMG_TAG).createImage();
+ }
/**
* Creates the group that displays lists of the available repositories
* and team streams.
@@ -393,15 +425,18 @@ public class HistoryView extends ViewPart implements ISelectionListener {
ISelection selection = event.getSelection();
if (selection == null || !(selection instanceof IStructuredSelection)) {
textViewer.setDocument(new Document(""));
+ tagViewer.setInput(null);
return;
}
IStructuredSelection ss = (IStructuredSelection)selection;
if (ss.size() != 1) {
textViewer.setDocument(new Document(""));
+ tagViewer.setInput(null);
return;
}
ILogEntry entry = (ILogEntry)ss.getFirstElement();
textViewer.setDocument(new Document(entry.getComment()));
+ tagViewer.setInput(entry.getTags());
}
});
@@ -412,6 +447,51 @@ public class HistoryView extends ViewPart implements ISelectionListener {
return viewer;
}
+ private TableViewer createTagTable(Composite parent) {
+ Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
+ TableViewer result = new TableViewer(table);
+ TableLayout layout = new TableLayout();
+ layout.addColumnData(new ColumnWeightData(100));
+ table.setLayout(layout);
+ result.setContentProvider(new SimpleContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ if (inputElement == null) return new Object[0];
+ CVSTag[] tags = (CVSTag[])inputElement;
+ return tags;
+ }
+ });
+ result.setLabelProvider(new LabelProvider() {
+ public Image getImage(Object element) {
+ if (element == null) return null;
+ CVSTag tag = (CVSTag)element;
+ switch (tag.getType()) {
+ case CVSTag.BRANCH:
+ case CVSTag.HEAD:
+ return branchImage;
+ case CVSTag.VERSION:
+ return versionImage;
+ }
+ return null;
+ }
+ public String getText(Object element) {
+ return ((CVSTag)element).getName();
+ }
+ });
+ result.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (!(e1 instanceof CVSTag) || !(e2 instanceof CVSTag)) return super.compare(viewer, e1, e2);
+ CVSTag tag1 = (CVSTag)e1;
+ CVSTag tag2 = (CVSTag)e2;
+ int type1 = tag1.getType();
+ int type2 = tag2.getType();
+ if (type1 != type2) {
+ return type2 - type1;
+ }
+ return super.compare(viewer, tag1, tag2);
+ }
+ });
+ return result;
+ }
protected TextViewer createText(Composite parent) {
TextViewer result = new TextViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.READ_ONLY);
result.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -423,6 +503,8 @@ public class HistoryView extends ViewPart implements ISelectionListener {
}
public void dispose() {
getSite().getPage().getWorkbenchWindow().getSelectionService().removeSelectionListener(this);
+ branchImage.dispose();
+ versionImage.dispose();
}
/**
* Adds the listener that sets the sorter.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index e77a0ef7c..984487282 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -28,6 +28,7 @@ public interface ICVSUIConstants {
// preferences
public final String PREF_SHOW_COMMENTS = "pref_show_comments";
+ public final String PREF_SHOW_TAGS = "pref_show_tags";
public final String PREF_PRUNE_EMPTY_DIRECTORIES = "pref_prune_empty_directories";
public final String PREF_TIMEOUT = "pref_timeout";
public final String PREF_QUIETNESS = "pref_quietness";
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 0a59df3b1..7565ac9a1 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
@@ -121,15 +121,6 @@ CompareWithRemoteAction.compare=Compare
CompareWithRemoteAction.noRemote=No Remote Resource
CompareWithRemoteAction.noRemoteLong=The selected resource has no remote resource to compare with.
-SharingWizard.autoConnectTitle=Connect Project to Repository
-SharingWizard.couldNotImport=Could Not Import
-SharingWizard.couldNotImportLong=Your resources could not be imported into the repository because a module with that name already exists.
-SharingWizard.description=Configure a Project to Use CVS
-SharingWizard.importTitle=Share Project with Repository
-SharingWizard.title=Configure a Project to Use CVS
-SharingWizard.enterInformation=Enter Repository Location Information
-SharingWizard.enterModuleName=Enter Module Name
-
ConfigurationWizardAutoconnectPage.description=Your project already has CVS/ directories. It was probably previously shared, or checked out using another tool. It will be automatically shared using the following information.
ConfigurationWizardAutoconnectPage.user=User:
ConfigurationWizardAutoconnectPage.host=Host:
@@ -197,6 +188,7 @@ HistoryView.comment=Comment
HistoryView.refresh=Refresh View
HistoryView.selectAll=Select &All
HistoryView.showComment=Show Comment Viewer
+HistoryView.showTags=Show Tag Viewer
HistoryView.title=Resource History
HistoryView.titleWithArgument=Resource History - {0}
@@ -260,6 +252,15 @@ ResourcePropertiesPage.checkedIn=Checked In
#ResourcePropertiesPage.none=none
ResourcePropertiesPage.error=Error
+SharingWizard.autoConnectTitle=Connect Project to Repository
+SharingWizard.couldNotImport=Could Not Import
+SharingWizard.couldNotImportLong=Your resources could not be imported into the repository because a module with that name already exists.
+SharingWizard.description=Configure a Project to Use CVS
+SharingWizard.importTitle=Share Project with Repository
+SharingWizard.title=Configure a Project to Use CVS
+SharingWizard.enterInformation=Enter Repository Location Information
+SharingWizard.enterModuleName=Enter Module Name
+
SharingWizard.validationFailedText={0}. Set project sharing anyway?
SharingWizard.validationFailedTitle=Unable to Validate

Back to the top