diff options
Diffstat (limited to 'bundles')
9 files changed, 136 insertions, 32 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/clcl16/synced.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/clcl16/synced.gif Binary files differnew file mode 100644 index 000000000..f865f3a39 --- /dev/null +++ b/bundles/org.eclipse.team.cvs.ui/icons/full/clcl16/synced.gif diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/synced.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/synced.gif Binary files differnew file mode 100644 index 000000000..ae5d5488c --- /dev/null +++ b/bundles/org.eclipse.team.cvs.ui/icons/full/elcl16/synced.gif 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 4f3b72a7a..4177604d8 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 @@ -342,6 +342,8 @@ public class CVSUIPlugin extends AbstractUIPlugin { createImageDescriptor(ICVSUIConstants.IMG_REFRESH, baseURL); createImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED, baseURL); createImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED, baseURL); + createImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR, baseURL); + createImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR_ENABLED, baseURL); createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL, baseURL); createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL_ENABLED, baseURL); createImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION, baseURL); @@ -566,6 +568,7 @@ public class CVSUIPlugin extends AbstractUIPlugin { store.setDefault(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, false); store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true); store.setDefault(ICVSUIConstants.PREF_SHOW_TAGS, true); + store.setDefault(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING, false); store.setDefault(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSProviderPlugin.DEFAULT_PRUNE); store.setDefault(ICVSUIConstants.PREF_TIMEOUT, CVSProviderPlugin.DEFAULT_TIMEOUT); store.setDefault(ICVSUIConstants.PREF_CONSIDER_CONTENTS, false); 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 efacce39f..7d2c7bc06 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 @@ -394,4 +394,8 @@ public class HistoryTableProvider { this.currentFile = file; this.currentRevision = getRevision(this.currentFile); } + + public ICVSFile getICVSFile() { + return this.currentFile; + } } 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 2bbb38c2b..3211d9541 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 @@ -22,7 +22,9 @@ import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuListener; @@ -65,8 +67,10 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Table; import org.eclipse.team.core.RepositoryProvider; import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.internal.ccvs.core.CVSException; import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; +import org.eclipse.team.internal.ccvs.core.CVSSyncInfo; import org.eclipse.team.internal.ccvs.core.CVSTag; import org.eclipse.team.internal.ccvs.core.CVSTeamProvider; import org.eclipse.team.internal.ccvs.core.ICVSFile; @@ -79,9 +83,14 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.ui.actions.CVSAction; import org.eclipse.team.internal.ccvs.ui.actions.MoveRemoteTagAction; import org.eclipse.team.internal.ccvs.ui.actions.OpenLogEntryAction; +import org.eclipse.team.internal.ui.sync.compare.SyncInfoCompareInput; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IActionDelegate; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IPartListener; import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.help.WorkbenchHelp; @@ -113,6 +122,7 @@ public class HistoryView extends ViewPart { private Action getRevisionAction; private Action refreshAction; private Action tagWithExistingAction; + private Action linkWithEditorAction; private SashForm sashForm; private SashForm innerSashForm; @@ -121,9 +131,27 @@ public class HistoryView extends ViewPart { private Image versionImage; private ILogEntry currentSelection; + private boolean linkingEnabled; + + private IPreferenceStore settings; public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.HistoryView"; //$NON-NLS-1$ + private IPartListener partListener = new IPartListener() { + public void partActivated(IWorkbenchPart part) { + if (part instanceof IEditorPart) + editorActivated((IEditorPart) part); + } + public void partBroughtToTop(IWorkbenchPart part) { + } + public void partClosed(IWorkbenchPart part) { + } + public void partDeactivated(IWorkbenchPart part) { + } + public void partOpened(IWorkbenchPart part) { + } + }; + /** * Adds the action contributions for this view. */ @@ -139,6 +167,16 @@ public class HistoryView extends ViewPart { refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED)); refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH)); + // Refresh (toolbar) + linkWithEditorAction = new Action(Policy.bind("HistoryView.linkWithLabel"), plugin.getImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR_ENABLED)) { //$NON-NLS-1$ + public void run() { + setLinkingEnabled(isChecked()); + } + }; + linkWithEditorAction.setToolTipText(Policy.bind("HistoryView.linkWithLabel")); //$NON-NLS-1$ + linkWithEditorAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR)); + linkWithEditorAction.setChecked(isLinkingEnabled()); + // Double click open action openAction = new OpenLogEntryAction(); tableViewer.getTable().addListener(SWT.DefaultSelection, new Listener() { @@ -272,6 +310,7 @@ public class HistoryView extends ViewPart { // Create the local tool bar IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager(); tbm.add(refreshAction); + tbm.add(linkWithEditorAction); tbm.update(false); // Create actions for the text editor @@ -316,20 +355,31 @@ public class HistoryView extends ViewPart { * Method declared on IWorkbenchPart */ public void createPartControl(Composite parent) { + settings = CVSUIPlugin.getPlugin().getPreferenceStore(); + this.linkingEnabled = settings.getBoolean(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING); + initializeImages(); + sashForm = new SashForm(parent, SWT.VERTICAL); sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); + tableViewer = createTable(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 }); + contributeActions(); + setViewerVisibility(); + // set F1 help WorkbenchHelp.setHelp(sashForm, IHelpContextIds.RESOURCE_HISTORY_VIEW); initDragAndDrop(); + + // add listener for editor page activation - this is to support editor linking + getSite().getPage().addPartListener(partListener); } private void initializeImages() { CVSUIPlugin plugin = CVSUIPlugin.getPlugin(); @@ -468,6 +518,7 @@ public class HistoryView extends ViewPart { versionImage.dispose(); versionImage = null; } + getSite().getPage().removePartListener(partListener); } /** * Returns the table viewer contained in this view. @@ -563,6 +614,33 @@ public class HistoryView extends ViewPart { } /** + * An editor has been activated. Sets the selection in this navigator + * to be the editor's input, if linking is enabled. + * + * @param editor the active editor + * @since 2.0 + */ + protected void editorActivated(IEditorPart editor) { + if (!isLinkingEnabled()) { + return; + } + IEditorInput input = editor.getEditorInput(); + if (input instanceof SyncInfoCompareInput) { + SyncInfoCompareInput syncInput = (SyncInfoCompareInput) input; + SyncInfo info = syncInput.getSyncInfo(); + if(info instanceof CVSSyncInfo && info.getLocal().getType() == IResource.FILE) { + ICVSRemoteFile remote = (ICVSRemoteFile)info.getRemote(); + ICVSRemoteFile base = (ICVSRemoteFile)info.getBase(); + if(remote != null) { + showHistory(remote); + } else if(base != null) { + showHistory(base); + } + } + } + } + + /** * Shows the history for the given ICVSRemoteFile in the view. */ public void showHistory(ICVSRemoteFile remoteFile) { @@ -572,6 +650,8 @@ public class HistoryView extends ViewPart { setTitle(Policy.bind("HistoryView.title")); //$NON-NLS-1$ return; } + ICVSFile existingFile = historyTableProvider.getICVSFile(); + if(existingFile != null && existingFile.equals(remoteFile)) return; this.file = null; historyTableProvider.setFile(remoteFile); tableViewer.setInput(remoteFile); @@ -679,21 +759,48 @@ public class HistoryView extends ViewPart { * Select the revision in the receiver. */ public void selectRevision(String revision) { - if (entries == null) { - return; - } - - ILogEntry entry = null; - for (int i = 0; i < entries.length; i++) { - if (entries[i].getRevision().equals(revision)) { - entry = entries[i]; - break; - } + if (entries == null) { + return; + } + + ILogEntry entry = null; + for (int i = 0; i < entries.length; i++) { + if (entries[i].getRevision().equals(revision)) { + entry = entries[i]; + break; } - - if (entry != null) { - IStructuredSelection selection = new StructuredSelection(entry); - tableViewer.setSelection(selection, true); + } + + if (entry != null) { + IStructuredSelection selection = new StructuredSelection(entry); + tableViewer.setSelection(selection, true); + } + } + + /** + * Enabled linking to the active editor + * @since 3.0 + */ + public void setLinkingEnabled(boolean enabled) { + this.linkingEnabled = enabled; + + // remember the last setting in the dialog settings + settings.setValue(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING, enabled); + + // if turning linking on, update the selection to correspond to the active editor + if (enabled) { + IEditorPart editor = getSite().getPage().getActiveEditor(); + if (editor != null) { + editorActivated(editor); } } + } + + /** + * Returns if linking to the ative editor is enabled or disabled. + * @return boolean indicating state of editor linking. + */ + private boolean isLinkingEnabled() { + return linkingEnabled; + } } 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 da6c72cb0..1d8c2b7c2 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 @@ -38,15 +38,17 @@ public interface ICVSUIConstants { public final String IMG_REFRESH = "clcl16/refresh.gif"; //$NON-NLS-1$ public final String IMG_CLEAR = "clcl16/clear_co.gif"; //$NON-NLS-1$ public final String IMG_COLLAPSE_ALL = "clcl16/collapseall.gif"; //$NON-NLS-1$ + public final String IMG_LINK_WITH_EDITOR = "clcl16/synced.gif"; //$NON-NLS-1$ // toolbar (disabled) public final String IMG_REFRESH_DISABLED = "dlcl16/refresh.gif"; //$NON-NLS-1$ public final String IMG_CLEAR_DISABLED = "dlcl16/clear_co.gif"; //$NON-NLS-1$ - + // toolbar (enabled) public final String IMG_REFRESH_ENABLED = "elcl16/refresh.gif"; //$NON-NLS-1$ public final String IMG_CLEAR_ENABLED = "elcl16/clear_co.gif"; //$NON-NLS-1$ public final String IMG_COLLAPSE_ALL_ENABLED = "elcl16/collapseall.gif"; //$NON-NLS-1$ + public final String IMG_LINK_WITH_EDITOR_ENABLED = "elcl16/synced.gif"; //$NON-NLS-1$ // wizards public final String IMG_NEWLOCATION = "wizards/newlocation_wiz.gif"; //$NON-NLS-1$ @@ -54,6 +56,7 @@ public interface ICVSUIConstants { // preferences public final String PREF_SHOW_COMMENTS = "pref_show_comments"; //$NON-NLS-1$ public final String PREF_SHOW_TAGS = "pref_show_tags"; //$NON-NLS-1$ + public final String PREF_HISTORY_VIEW_EDITOR_LINKING = "pref_history_view_linking"; //$NON-NLS-1$ public final String PREF_PRUNE_EMPTY_DIRECTORIES = "pref_prune_empty_directories"; //$NON-NLS-1$ public final String PREF_TIMEOUT = "pref_timeout"; //$NON-NLS-1$ public final String PREF_QUIETNESS = "pref_quietness"; //$NON-NLS-1$ 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 e5e687768..7f608ba66 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 @@ -377,6 +377,7 @@ HistoryView.author=Author HistoryView.comment=Comment HistoryView.refreshLabel=&Refresh View HistoryView.refresh=Refresh View +HistoryView.linkWithLabel=Link with &Editor HistoryView.selectAll=Select &All HistoryView.showComment=Show Comment Viewer HistoryView.showTags=Show Tag Viewer @@ -384,6 +385,8 @@ HistoryView.title=CVS Resource History HistoryView.titleWithArgument=CVS Resource History - {0} HistoryView.overwriteTitle=Overwrite local changes? HistoryView.overwriteMsg=You have local changes. Do you want to overwrite them? +HistoryView.fetchHistoryJob=Fetching CVS revision history +HistoryView.fetchHistoryJobFile=Fetching CVS revision history for: {0} IgnoreAction.ignore=Error Ignoring Resource diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java index 93b6f3ec1..c7af6ee56 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java @@ -72,8 +72,8 @@ public class OpenInCompareAction extends Action { // if editor is currently not open on that input either re-use existing if (!prefetchFileContents(viewer, info)) return null; if(editor != null && editor instanceof IReusableEditor) { - page.activate(editor); CompareUI.reuseCompareEditor(input, (IReusableEditor)editor); + page.activate(editor); } } } else { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java index f970229db..49edc3ba6 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/compare/SyncInfoCompareInput.java @@ -245,20 +245,4 @@ public class SyncInfoCompareInput extends CompareEditorInput { public SyncInfo getSyncInfo() { return sync; } - - /* (non-Javadoc) - * @see org.eclipse.compare.IPropertyChangeNotifier#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { - super.removePropertyChangeListener(listener); - } - - - - /* (non-Javadoc) - * @see org.eclipse.compare.IPropertyChangeNotifier#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) - */ - public void addPropertyChangeListener(IPropertyChangeListener listener) { - super.addPropertyChangeListener(listener); - } } |