Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-09-11 18:03:40 +0000
committerMichael Valenta2007-09-11 18:03:40 +0000
commit7dcdc820d03a9efce8fafc94cc83594aefac4f5c (patch)
tree8a147a1fb8b904e12322cdccc2a3fbbb9df4a057 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse
parent30d3bcaf6ead7b480d9297f28e590d90762ca457 (diff)
downloadeclipse.platform.team-7dcdc820d03a9efce8fafc94cc83594aefac4f5c.tar.gz
eclipse.platform.team-7dcdc820d03a9efce8fafc94cc83594aefac4f5c.tar.xz
eclipse.platform.team-7dcdc820d03a9efce8fafc94cc83594aefac4f5c.zip
Bug 202422 [Annotate] Remove old Annotate mechanisms
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java388
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java246
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java220
11 files changed, 19 insertions, 932 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java
index 1cc86822c..b4ac10f4e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotatePreferencePage.java
@@ -10,22 +10,15 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui;
-import java.util.Arrays;
-
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.*;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ccvs.ui.CVSPreferencesPage.PerspectiveDescriptorComparator;
import org.eclipse.ui.*;
public class AnnotatePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
- private RadioGroupFieldEditor quickDiffAnnotateMode = null;
- private RadioGroupFieldEditor annotatePerspectiveSwitch = null;
private RadioGroupFieldEditor binaryPrompt = null;
- private ComboFieldEditor annotatePerspectiveToUse = null;
- private String[][] PERSPECTIVES = null;
public AnnotatePreferencePage() {
super(GRID);
@@ -41,18 +34,6 @@ public class AnnotatePreferencePage extends FieldEditorPreferencePage implements
}
public void createFieldEditors() {
- quickDiffAnnotateMode = new RadioGroupFieldEditor(ICVSUIConstants.PREF_USE_QUICKDIFFANNOTATE, CVSUIMessages.CVSPreferencesPage_QuickDiffAnnotate, 3, new String[][] { {CVSUIMessages.CVSPreferencesPage_11, MessageDialogWithToggle.ALWAYS}, {CVSUIMessages.CVSPreferencesPage_12, MessageDialogWithToggle.NEVER}, {CVSUIMessages.CVSPreferencesPage_13, MessageDialogWithToggle.PROMPT}}, getFieldEditorParent(), true /* use a group */);
-
- addField(quickDiffAnnotateMode);
-
- annotatePerspectiveSwitch = new RadioGroupFieldEditor(ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS, CVSUIMessages.CVSPreferencesPage_42, 3, new String[][] { {CVSUIMessages.CVSPreferencesPage_11, MessageDialogWithToggle.ALWAYS}, {CVSUIMessages.CVSPreferencesPage_12, MessageDialogWithToggle.NEVER}, {CVSUIMessages.CVSPreferencesPage_13, MessageDialogWithToggle.PROMPT}}, getFieldEditorParent(), true /* use a group */);
-
- addField(annotatePerspectiveSwitch);
-
- initPerspectiveLabels();
- annotatePerspectiveToUse = new ComboFieldEditor(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS, CVSUIMessages.CVSPreferencesPage_43, PERSPECTIVES, getFieldEditorParent());
- addField(annotatePerspectiveToUse);
-
binaryPrompt = new RadioGroupFieldEditor(ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY, CVSUIMessages.AnnotatePreferencePage_AnnotatePrefPageBinaryFileMessage, 3, new String[][] { {CVSUIMessages.CVSPreferencesPage_11, MessageDialogWithToggle.ALWAYS}, {CVSUIMessages.CVSPreferencesPage_12, MessageDialogWithToggle.NEVER}, {CVSUIMessages.CVSPreferencesPage_13, MessageDialogWithToggle.PROMPT}}, getFieldEditorParent(), true /* use a group */);
addField(binaryPrompt);
@@ -63,18 +44,6 @@ public class AnnotatePreferencePage extends FieldEditorPreferencePage implements
public void init(IWorkbench workbench) {
}
- private void initPerspectiveLabels() {
- final IPerspectiveDescriptor[] perspectives = PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives();
- PERSPECTIVES = new String[perspectives.length + 1][2];
- Arrays.sort(perspectives, new PerspectiveDescriptorComparator());
- PERSPECTIVES[0][0] = CVSUIMessages.CVSPreferencesPage_10;
- PERSPECTIVES[0][1] = ICVSUIConstants.OPTION_NO_PERSPECTIVE;
- for (int i = 0; i < perspectives.length; i++) {
- PERSPECTIVES[i + 1][0] = perspectives[i].getLabel();
- PERSPECTIVES[i + 1][1] = perspectives[i].getId();
- }
- }
-
/* (non-Javadoc)
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java
deleted file mode 100644
index 4a90f2f78..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.history.IHistoryPage;
-import org.eclipse.team.ui.history.IHistoryView;
-import org.eclipse.ui.*;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.internal.registry.EditorDescriptor;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * A view showing the results of the CVS Annotate Command. A linked
- * combination of a View of annotations, a source editor and the
- * Resource History View
- */
-public class AnnotateView extends ViewPart implements ISelectionChangedListener {
-
- ITextEditor editor;
- IHistoryView historyView;
- IWorkbenchPage page;
-
- ListViewer viewer;
- IDocument document;
- Collection cvsAnnotateBlocks;
- ICVSResource cvsResource;
- InputStream contents;
-
- IStructuredSelection previousListSelection;
- ITextSelection previousTextSelection;
- boolean lastSelectionWasText = false;
-
-
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.AnnotateView"; //$NON-NLS-1$
- private Composite top;
-
- private IPartListener partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- }
- public void partClosed(IWorkbenchPart part) {
- if (editor != null && part == editor) {
- disconnect();
- }
- }
- public void partDeactivated(IWorkbenchPart part) {
- }
- public void partOpened(IWorkbenchPart part) {
- }
- };
-
- public AnnotateView() {
- super();
- }
-
- public void createPartControl(Composite parent) {
-
- this.top = parent;
-
- // Create default contents
- Label label = new Label(top, SWT.WRAP);
- label.setText(CVSUIMessages.CVSAnnotateView_viewInstructions);
- top.layout();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(label, IHelpContextIds.ANNOTATE_VIEW);
- }
-
- /**
- * Show the annotation view.
- * @param cvsResource
- * @param cvsAnnotateBlocks
- * @param contents
- * @throws PartInitException, CVSException
- */
- public void showAnnotations(ICVSResource cvsResource, Collection cvsAnnotateBlocks, InputStream contents) throws PartInitException, CVSException {
- showAnnotations(cvsResource, cvsAnnotateBlocks, contents, true);
- }
-
- /**
- * Show the annotation view.
- * @param cvsResource
- * @param cvsAnnotateBlocks
- * @param contents
- * @param useHistoryView
- * @throws PartInitException, CVSException
- */
- public void showAnnotations(ICVSResource cvsResource, Collection cvsAnnotateBlocks, InputStream contents, boolean useHistoryView) throws PartInitException, CVSException {
-
- // Disconnect from old annotation editor
- disconnect();
-
- // Remove old viewer
- Control[] oldChildren = top.getChildren();
- if (oldChildren != null) {
- for (int i = 0; i < oldChildren.length; i++) {
- oldChildren[i].dispose();
- }
- }
-
- viewer = new ListViewer(top, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new ArrayContentProvider());
- viewer.setLabelProvider(new LabelProvider());
- viewer.addSelectionChangedListener(this);
- viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), IHelpContextIds.ANNOTATE_VIEW);
-
- top.layout();
-
- this.cvsResource = cvsResource;
- this.contents = contents;
- this.cvsAnnotateBlocks = cvsAnnotateBlocks;
- page = CVSUIPlugin.getActivePage();
- viewer.setInput(cvsAnnotateBlocks);
- editor = (ITextEditor) openEditor();
- IDocumentProvider provider = editor.getDocumentProvider();
- document = provider.getDocument(editor.getEditorInput());
-
- setPartName(NLS.bind(CVSUIMessages.CVSAnnotateView_showFileAnnotation, (new Object[] {cvsResource.getName()})));
- IResource localResource = cvsResource.getIResource();
- if (localResource != null) {
- setTitleToolTip(localResource.getFullPath().toString());
- } else {
- setTitleToolTip(cvsResource.getName());
- }
-
- if (!useHistoryView) {
- return;
- }
-
- // Show the history in the history view
- historyView = TeamUI.showHistoryFor(page, CVSWorkspaceRoot.getRemoteResourceFor(cvsResource), null);
- }
-
- protected void disconnect() {
- if(editor != null) {
- if (editor.getSelectionProvider() instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) editor.getSelectionProvider()).removePostSelectionChangedListener(this);
- }
- editor.getSite().getPage().removePartListener(partListener);
- editor = null;
- document = null;
- }
- }
-
- /**
- * Makes the view visible in the active perspective. If there
- * isn't a view registered <code>null</code> is returned.
- * Otherwise the opened view part is returned.
- */
- public static AnnotateView openInActivePerspective() throws PartInitException {
- return (AnnotateView) CVSUIPlugin.getActivePage().showView(VIEW_ID);
- }
-
- /**
- * Selection changed in either the Annotate List View or the
- * Source editor.
- */
- public void selectionChanged(SelectionChangedEvent event) {
-
- if (event.getSelection() instanceof IStructuredSelection) {
- listSelectionChanged((IStructuredSelection) event.getSelection());
- } else if (event.getSelection() instanceof ITextSelection) {
- textSelectionChanged((ITextSelection) event.getSelection());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- disconnect();
- }
-
- /**
- * A selection event in the Annotate Source Editor
- * @param event
- */
- private void textSelectionChanged(ITextSelection selection) {
-
- // Track where the last selection event came from to avoid
- // a selection event loop.
- lastSelectionWasText = true;
-
- // Locate the annotate block containing the selected line number.
- CVSAnnotateBlock match = null;
- for (Iterator iterator = cvsAnnotateBlocks.iterator(); iterator.hasNext();) {
- CVSAnnotateBlock block = (CVSAnnotateBlock) iterator.next();
- if (block.contains(selection.getStartLine())) {
- match = block;
- break;
- }
- }
-
- // Select the annotate block in the List View.
- if (match == null) {
- return;
- }
-
- StructuredSelection listSelection = new StructuredSelection(match);
- viewer.setSelection(listSelection, true);
- }
-
- /**
- * A selection event in the Annotate List View
- * @param selection
- */
- private void listSelectionChanged(IStructuredSelection selection) {
-
- // If the editor was closed, reopen it.
- if (editor == null || editor.getSelectionProvider() == null) {
- try {
- contents.reset();
- showAnnotations(cvsResource, cvsAnnotateBlocks, contents, false);
- } catch (CVSException e) {
- return;
- } catch (PartInitException e) {
- return;
- } catch (IOException e) {
- return;
- }
- }
-
- ISelectionProvider selectionProvider = editor.getSelectionProvider();
- if (selectionProvider == null) {
- // Failed to open the editor but what else can we do.
- return;
- }
-
- ITextSelection textSelection = (ITextSelection) selectionProvider.getSelection();
- if (textSelection == null) return;
-
- if (selection.size() != 1 || !(selection.getFirstElement() instanceof CVSAnnotateBlock))
- return;
-
- CVSAnnotateBlock listSelection = (CVSAnnotateBlock) selection.getFirstElement();
- if (listSelection == null) return;
-
- /**
- * Ignore event if the current text selection is already equal to the corresponding
- * list selection. Nothing to do. This prevents infinite event looping.
- *
- * Extra check to handle single line deltas
- */
-
- if (textSelection.getStartLine() == listSelection.getStartLine() && textSelection.getEndLine() == listSelection.getEndLine() && selection.equals(previousListSelection)) {
- return;
- }
-
- // If the last selection was a text selection then bale to prevent a selection loop.
- if (!lastSelectionWasText) {
- try {
- int start = document.getLineOffset(listSelection.getStartLine());
- int end = document.getLineOffset(listSelection.getEndLine() + 1);
- editor.selectAndReveal(start, end - start);
- if (editor != null && !page.isPartVisible(editor)) {
- page.activate(editor);
- }
-
- } catch (BadLocationException e) {
- // Ignore - nothing we can do.
- }
- }
-
-
- // Select the revision in the history view.
- if(historyView != null) {
- IHistoryPage historyPage = historyView.getHistoryPage();
- if (historyPage instanceof CVSHistoryPage){
- ((CVSHistoryPage) historyPage).selectRevision(listSelection.getRevision());
- lastSelectionWasText = false;
- }
- }
- }
-
- /**
- * Try and open the correct registered editor type for the file.
- * @throws CVSException, PartInitException
- */
- private IEditorPart openEditor() throws CVSException, PartInitException {
- ICVSRemoteFile file = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(cvsResource);
-
- // Determine if the registered editor is an ITextEditor.
- // There is currently no support from UI to determine this information. This
- // problem has been logged in: https://bugs.eclipse.org/bugs/show_bug.cgi?id=47362
- // For now, use internal classes.
- String id = getEditorId(file);
- ITextEditor editor = getEditor(id, file);
-
- // Hook Editor post selection listener.
- if (editor.getSelectionProvider() instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) editor.getSelectionProvider()).addPostSelectionChangedListener(this);
- }
- editor.getSite().getPage().addPartListener(partListener);
- return editor;
- }
-
- private ITextEditor getEditor(String id, ICVSRemoteFile file) throws PartInitException {
- // Either reuse an existing editor or open a new editor of the correct type.
- if (editor != null && editor instanceof IReusableEditor && page.isPartVisible(editor) && editor.getSite().getId().equals(id)) {
- // We can reuse the editor
- ((IReusableEditor) editor).setInput(new RemoteAnnotationEditorInput(file, contents));
- return editor;
- } else {
- // We can not reuse the editor so close the existing one and open a new one.
- if (editor != null) {
- page.closeEditor(editor, false);
- editor = null;
- }
- IEditorPart part = page.openEditor(new RemoteAnnotationEditorInput(file, contents), id);
- if (part instanceof ITextEditor) {
- return (ITextEditor)part;
- } else {
- // We asked for a text editor but didn't get one
- // so open a vanilla text editor
- page.closeEditor(part, false);
- part = page.openEditor(new RemoteAnnotationEditorInput(file, contents), EditorsUI.DEFAULT_TEXT_EDITOR_ID);
- if (part instanceof ITextEditor) {
- return (ITextEditor)part;
- } else {
- // There is something really wrong so just bail
- throw new PartInitException(CVSUIMessages.AnnotateView_0);
- }
- }
- }
- }
-
- private String getEditorId(ICVSRemoteFile file) {
- String id;
- IEditorRegistry registry = CVSUIPlugin.getPlugin().getWorkbench().getEditorRegistry();
- IEditorDescriptor descriptor = registry.getDefaultEditor(file.getName());
- if (descriptor == null || !descriptor.isInternal()) {
- id = EditorsUI.DEFAULT_TEXT_EDITOR_ID;
- } else {
- try {
- if (isTextEditor(descriptor)) {
- id = descriptor.getId();
- } else {
- id = EditorsUI.DEFAULT_TEXT_EDITOR_ID;
- }
- } catch (CoreException e) {
- id = EditorsUI.DEFAULT_TEXT_EDITOR_ID;
- }
- }
- return id;
- }
-
- private boolean isTextEditor(IEditorDescriptor descriptor)
- throws CoreException {
- if (descriptor instanceof EditorDescriptor) {
- EditorDescriptor desc = (EditorDescriptor) descriptor;
- return desc.createEditor() instanceof ITextEditor;
- }
- return false;
- }
-
- // This method implemented to be an ISelectionChangeListener but we
- // don't really care when the List or Editor get focus.
- public void setFocus() {
- return;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
index 3f65fcde9..2cba2ce60 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
@@ -353,14 +353,6 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref
}
YES_NO_PROMPT= new String [] { CVSUIMessages.CVSPreferencesPage_11, CVSUIMessages.CVSPreferencesPage_12, CVSUIMessages.CVSPreferencesPage_13 }; //
- /**
- * Handle deleted perspectives
- */
- final IPreferenceStore store= CVSUIPlugin.getPlugin().getPreferenceStore();
- final String id= store.getString(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS);
- if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) {
- store.putValue(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS, ICVSUIConstants.OPTION_NO_PERSPECTIVE);
- }
}
protected Control createContents(Composite parent) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
index fff6803c6..2ec126a1b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
@@ -159,9 +159,6 @@ public class CVSUIMessages extends NLS {
public static String CVSAction_mixingTagsTitle;
public static String CVSAction_mixingTags;
- public static String CVSAnnotateView_showFileAnnotation;
- public static String CVSAnnotateView_viewInstructions;
-
public static String ShowAnnotationAction_noSyncInfo;
public static String ShowAnnotationOperation_taskName;
public static String ShowAnnotationOperation_0;
@@ -1083,7 +1080,6 @@ public class CVSUIMessages extends NLS {
public static String LogEntryCacheUpdateHandler_2;
public static String MultiFolderTagSource_0;
public static String LocalProjectTagSource_0;
- public static String AnnotateView_0;
public static String ModeWizard_0;
public static String ModeWizard_1;
public static String ModeWizard_2;
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 ee8b23a39..c8c423ad9 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
@@ -564,9 +564,6 @@ public class CVSUIPlugin extends AbstractUIPlugin {
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, true);
store.setDefault(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, ICVSUIConstants.OPTION_PROMPT);
- store.setDefault(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS, CVSPerspective.ID);
- store.setDefault(ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS, MessageDialogWithToggle.PROMPT);
- store.setDefault(ICVSUIConstants.PREF_USE_QUICKDIFFANNOTATE, MessageDialogWithToggle.ALWAYS);
store.setDefault(ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY, MessageDialogWithToggle.PROMPT);
store.setDefault(ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS, MessageDialogWithToggle.PROMPT);
store.setDefault(ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT, MessageDialogWithToggle.NEVER);
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 cbea661b2..35917d6a4 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
@@ -117,7 +117,6 @@ public interface ICVSUIConstants {
public final String PREF_AUTO_SHARE_ON_IMPORT = "pref_auto_share_on_import"; //$NON-NLS-1$
public final String PREF_ENABLE_WATCH_ON_EDIT = "pref_enable_watch_on_edit"; //$NON-NLS-1$
public final String PREF_USE_PROJECT_NAME_ON_CHECKOUT = "pref_use_project_name_on_checkout"; //$NON-NLS-1$
- public final String PREF_USE_QUICKDIFFANNOTATE = "pref_use_quickdiffannotate"; //$NON-NLS-1$
public final String PREF_INCLUDE_CHANGE_SETS_IN_COMMIT = "pref_include_change_sets"; //$NON-NLS-1$
public final String PREF_ANNOTATE_PROMPTFORBINARY = "pref_annotate_promptforbinary"; //$NON-NLS-1$
public final String PREF_ALLOW_COMMIT_WITH_WARNINGS = "pref_commit_with_warning"; //$NON-NLS-1$
@@ -173,8 +172,6 @@ public interface ICVSUIConstants {
// Perspective changing preferences
public final String PREF_CHANGE_PERSPECTIVE_ON_NEW_REPOSITORY_LOCATION = "pref_change_perspective_on_new_location"; //$NON-NLS-1$
- public final String PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS= "pref_change_perspective_on_show_annotations"; //$NON-NLS-1$
- public final String PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS= "pref_default_perspective_for_show_annotations"; //$NON-NLS-1$
public final String PREF_ALLOW_EMPTY_COMMIT_COMMENTS= "pref_allow_empty_commit_comment"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java
deleted file mode 100644
index 8f42f66cf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-
-/**
- * An editor input for a cvs annotation response
- */
-public class RemoteAnnotationEditorInput extends RemoteFileEditorInput {
-
- InputStream contents;
-
- public RemoteAnnotationEditorInput(ICVSRemoteFile file, InputStream contents) {
- super(file, new NullProgressMonitor());
- this.contents = contents;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.RemoteFileEditorInput#initializeStorage(org.eclipse.team.internal.ccvs.core.ICVSRemoteFile, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void initializeStorage(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException {
- if (contents != null) {
- storage = new RemoteAnnotationStorage(file, contents);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java
deleted file mode 100644
index 1b262cffb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.net.URI;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.filehistory.CVSResourceVariantFileRevision;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.history.IHistoryPageSource;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * An editor input for a file in a repository.
- */
-public class RemoteFileEditorInput extends PlatformObject implements IWorkbenchAdapter, IStorageEditorInput {
- ICVSRemoteFile file;
- IStorage storage;
-
- /**
- * Creates FileEditionEditorInput on the given file.
- */
- public RemoteFileEditorInput(ICVSRemoteFile file, IProgressMonitor monitor) {
- this.file = file;
- try {
- initializeStorage(file, monitor);
- } catch (TeamException e) {
- // Log and continue
- CVSUIPlugin.log(e);
- }
- }
-
- /**
- * Initialize the strogae of this instance from the given file.
- * @param file the file being displayed
- * @param monitor a progress monitor
- */
- protected void initializeStorage(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException {
- // Cache the contents of the file for use in the editor
- storage = ((IResourceVariant)file).getStorage(monitor);
- }
-
- /**
- * Returns whether the editor input exists.
- * <p>
- * This method is primarily used to determine if an editor input should
- * appear in the "File Most Recently Used" menu. An editor input will appear
- * in the list until the return value of <code>exists</code> becomes
- * <code>false</code> or it drops off the bottom of the list.
- *
- * @return <code>true</code> if the editor input exists; <code>false</code>
- * otherwise
- */
- public boolean exists() {
- return true;
- }
- public boolean equals(Object o) {
- if (!(o instanceof RemoteFileEditorInput)) return false;
- RemoteFileEditorInput input = (RemoteFileEditorInput)o;
- return file.equals(input.file);
- }
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
-
- if (adapter == IHistoryPageSource.class)
- return file.getAdapter(IHistoryPageSource.class);
-
- if (adapter == ICVSFile.class || adapter == IResourceVariant.class)
- return file;
-
- if (adapter == IFileRevision.class)
- return getFileRevision();
-
- return super.getAdapter(adapter);
- }
-
- public CVSResourceVariantFileRevision getFileRevision() {
- return new CVSResourceVariantFileRevision((IResourceVariant)file);
- }
- /**
- * Returns the children of this object. When this object
- * is displayed in a tree, the returned objects will be this
- * element's children. Returns an empty array if this
- * object has no children.
- *
- * @param object The object to get the children for.
- */
- public Object[] getChildren(Object o) {
- return new Object[0];
- }
- /**
- * Returns the content type of the input. For instance, if the input
- * wraps an <code>IFile</code> the content type would be derived from
- * the extension or mime type. If the input wraps another object it
- * may just be the object type. The content type is used for
- * editor mapping.
- */
- public String getContentType() {
- String name = file.getName();
- return name.substring(name.lastIndexOf('.')+1);
- }
- /**
- * Returns the fully qualified path name of the input.
- */
- public String getFullPath() {
- //use path to make sure slashes are correct
- ICVSRepositoryLocation location = file.getRepository();
- IPath path = new Path(null, location.getRootDirectory());
- path = path.setDevice(location.getHost() + IPath.DEVICE_SEPARATOR);
- path = path.append(file.getRepositoryRelativePath());
- String fullPath;
- try {
- String revision = file.getRevision();
- fullPath = NLS.bind(CVSUIMessages.RemoteFileEditorInput_fullPathAndRevision, new String[] { path.toString(), revision });
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- fullPath = path.toString();
- }
- return fullPath;
- }
- /**
- * Returns the image descriptor for this input.
- *
- * @return the image descriptor for this input
- */
- public ImageDescriptor getImageDescriptor() {
- IWorkbenchAdapter fileAdapter = (IWorkbenchAdapter)file.getAdapter(IWorkbenchAdapter.class);
- return fileAdapter == null ? null : fileAdapter.getImageDescriptor(file);
- }
- /**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- IWorkbenchAdapter fileAdapter = (IWorkbenchAdapter)file.getAdapter(IWorkbenchAdapter.class);
- return fileAdapter == null ? null : fileAdapter.getImageDescriptor(file);
- }
- /**
- * @see IWorkbenchAdapter#getLabel
- */
- public String getLabel(Object o) {
- return file.getName();
- }
- /**
- * Returns the input name for display purposes. For instance, if
- * the fully qualified input name is "a\b\MyFile.gif" the return value for
- * <code>getName</code> is "MyFile.gif".
- */
- public String getName() {
- String name = file.getName();
- try {
- return NLS.bind(CVSUIMessages.nameAndRevision, new String[] { name, file.getRevision() });
- } catch (TeamException e) {
- return name;
- }
- }
- /**
- * Returns the logical parent of the given object in its tree.
- * Returns <code>null</code> if there is no parent, or if this object doesn't
- * belong to a tree.
- *
- * @param object The object to get the parent for.
- */
- public Object getParent(Object o) {
- return null;
- }
- /*
- * Returns an interface used to persist the object. If the editor input
- * cannot be persisted this method returns <code>null</code>.
- */
- public IPersistableElement getPersistable() {
- //not persistable
- return null;
- }
- /**
- * Returns the underlying IStorage object.
- *
- * @return an IStorage object.
- * @exception CoreException if this method fails
- */
- public IStorage getStorage() throws CoreException {
- if (storage == null) {
- initializeStorage(file, new NullProgressMonitor());
- }
- return storage;
- }
- /**
- * Returns the tool tip text for this editor input. This text
- * is used to differentiate between two input with the same name.
- * For instance, MyClass.java in folder X and MyClass.java in folder Y.
- * <p>
- * The format of the path will vary with each input type. For instance,
- * if the editor input is of type <code>IFileEditorInput</code> this method
- * should return the fully qualified resource path. For editor input of
- * other types it may be different.
- * </p>
- * @return the tool tip text
- */
- public String getToolTipText() {
- return getFullPath();
- }
-
- /**
- * Returns the remote CVS file shown in this editor input.
- * @return the remote file handle.
- */
- public ICVSRemoteFile getCVSRemoteFile() {
- return file;
- }
-
- public URI getURI() {
- IFileRevision revision = (IFileRevision)Utils.getAdapter(file, IFileRevision.class);
- if (revision != null)
- return revision.getURI();
- return null;
- }
-
-}
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 17873401a..4c0ff52fd 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
@@ -65,9 +65,6 @@ CVSAction_multipleProblemsMessage=Multiple problems occurred:
CVSAction_mixingTagsTitle=Confirm Mixing Tags
CVSAction_mixingTags=You are mixing tags within a project. Beware that synchronization uses the tag information associated with each resource to determine the remote resource with which the local resource is compared. \n\nThis means that the part(s) of your project that you are replacing with another tag will be synchronized with the tag ''{0}'' while other resources in the project will be synchronized with another tag. \n\nDo you wish to continue?
-CVSAnnotateView_showFileAnnotation=CVS Annotate - {0}
-CVSAnnotateView_viewInstructions=This view shows annotations for a file in CVS. Select a file and then choose \"Team->Show Annotation\" from the context menu.
-
ShowAnnotationAction_noSyncInfo=Cannot display annotation for {0} because it does not have a remote revision.
ShowAnnotationOperation_taskName=Fetching annotations from repository
ShowAnnotationOperation_QDAnnotateTitle=Quick Diff Annotate
@@ -1133,7 +1130,6 @@ LogEntryCacheUpdateHandler_1=Updating revision histories
LogEntryCacheUpdateHandler_2=Could not fetch revision histories due to an internal timeout.
MultiFolderTagSource_0={0} folders
LocalProjectTagSource_0={0} Projects
-AnnotateView_0=Could not find an appropriate editor
ModeWizard_0=ModeWizard
ModeWizard_1=Change the ASCII/Binary Property
ModeWizard_2=An error occurred
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
index a9822fb69..d5ef132ff 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
@@ -76,10 +76,6 @@ public class CVSAdapterFactory implements IAdapterFactory {
return compareAdapter;
}
- if (IFileRevision.class == adapterType && adaptableObject instanceof RemoteFileEditorInput) {
- return ((RemoteFileEditorInput)adaptableObject).getFileRevision();
- }
-
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
index b8c97d14c..c166321e8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
@@ -11,39 +11,35 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.operations;
-import java.io.*;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.revisions.Revision;
import org.eclipse.jface.text.revisions.RevisionInformation;
import org.eclipse.jface.text.source.LineRange;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.*;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.listeners.AnnotateListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.history.*;
import org.eclipse.ui.*;
@@ -73,52 +69,32 @@ public class ShowAnnotationOperation extends CVSOperation {
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
-
- final boolean useLiveAnnotate= isKnownUseLiveAnnotate();
- final boolean useView= isKnownUseView();
- monitor.beginTask(null, 80 + (useView ? 0 : 20) + (useLiveAnnotate ? 0 : 20));
+ monitor.beginTask(null, 100);
// Get the annotations from the repository.
final AnnotateListener listener= new AnnotateListener();
fetchAnnotation(listener, fCVSResource, fRevision, Policy.subMonitorFor(monitor, 80));
- // If we're not using live annotate or the file is a remote file,
- // we need to fetch the contents to ensure the encoding is correct
- // (i.e. the contents from the annotate command will only work if the file is ASCII).
- if (!useLiveAnnotate || fCVSResource.getIResource() == null)
- fetchContents(listener, Policy.subMonitorFor(monitor, 20));
-
// this is not needed if there is no live annotate
- final RevisionInformation information;
- if (!useView)
- information= createRevisionInformation(listener, Policy.subMonitorFor(monitor, 20));
- else
- information= null;
+ final RevisionInformation information = createRevisionInformation(listener, Policy.subMonitorFor(monitor, 20));
// Open the view and display it from the UI thread.
final Display display= getPart().getSite().getShell().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- //If the file being annotated is not binary, check to see if we can use the quick
- //annotate. Until we are able to show quick diff annotate on read only text editors
- //we can't make use of it for binary files/remote files.
- boolean useQuickDiffAnnotate = promptForQuickDiffAnnotate();
- if (useQuickDiffAnnotate){
- try {
- //is there an open editor for the given input? If yes, use live annotate
- final AbstractDecoratedTextEditor editor= getEditor(listener);
- if (editor != null) {
- editor.showRevisionInformation(information, "org.eclipse.quickdiff.providers.CVSReferenceProvider"); //$NON-NLS-1$
- final IWorkbenchPage page= getPart().getSite().getPage();
- showHistoryView(page, editor);
- page.activate(editor);
- }
- } catch (PartInitException e) {
- CVSException.wrapException(e);
+ try {
+ //is there an open editor for the given input? If yes, use live annotate
+ final AbstractDecoratedTextEditor editor= getEditor(listener);
+ if (editor != null) {
+ editor.showRevisionInformation(information, "org.eclipse.quickdiff.providers.CVSReferenceProvider"); //$NON-NLS-1$
+ final IWorkbenchPage page= getPart().getSite().getPage();
+ showHistoryView(page, editor);
+ page.activate(editor);
}
- } else
- showView(listener);
+ } catch (PartInitException e) {
+ CVSException.wrapException(e);
+ }
}
});
@@ -165,36 +141,6 @@ public class ShowAnnotationOperation extends CVSOperation {
}
}
- /**
- * Shows the view once the background operation is finished. This must be called
- * from the UI thread.
- *
- * @param listener The listener with the results.
- */
- protected void showView(final AnnotateListener listener) {
- final IWorkbench workbench= PlatformUI.getWorkbench();
- final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
-
- final String defaultPerspectiveID= promptForPerspectiveSwitch();
-
- if (defaultPerspectiveID != null) {
- try {
- workbench.showPerspective(defaultPerspectiveID, window);
- } catch (WorkbenchException e) {
- Utils.handleError(window.getShell(), e, CVSUIMessages.ShowAnnotationOperation_0, e.getMessage());
- }
- }
-
- try {
- final AnnotateView view = AnnotateView.openInActivePerspective();
- view.showAnnotations(fCVSResource, listener.getCvsAnnotateBlocks(), listener.getContents());
- } catch (PartInitException e) {
- CVSUIPlugin.log(e);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
private AbstractDecoratedTextEditor getEditor(AnnotateListener listener) throws PartInitException {
IResource resource= fCVSResource.getIResource();
if (resource instanceof IFile){
@@ -330,132 +276,4 @@ public class ShowAnnotationOperation extends CVSOperation {
return info;
}
-
- private void fetchContents(final AnnotateListener listener, IProgressMonitor monitor) {
- try {
- if (hasCharset(fCVSResource, listener.getContents())) {
- listener.setContents(getRemoteContents(fCVSResource, monitor));
- }
- } catch (CoreException e) {
- // Log and continue, using the original fetched contents
- CVSUIPlugin.log(e);
- }
- }
-
- private InputStream getRemoteContents(ICVSResource resource, IProgressMonitor monitor) throws CoreException {
-
- final ICVSRemoteResource remote = CVSWorkspaceRoot.getRemoteResourceFor(resource);
- if (remote == null) {
- return new ByteArrayInputStream(new byte[0]);
- }
- final IStorage storage = ((IResourceVariant)remote).getStorage(monitor);
- if (storage == null) {
- return new ByteArrayInputStream(new byte[0]);
- }
- return storage.getContents();
- }
-
- /**
- * @return The ID of the perspective if the perspective needs to be changed,
- * null otherwise.
- */
- private String promptForPerspectiveSwitch() {
- // check whether we should ask the user.
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS);
- final String desiredID = store.getString(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS);
-
- if (option.equals(MessageDialogWithToggle.ALWAYS))
- return desiredID; // no, always switch
-
- if (option.equals(MessageDialogWithToggle.NEVER))
- return null; // no, never switch
-
- // Check whether the desired perspective is already active.
- final IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry();
- final IPerspectiveDescriptor desired = registry.findPerspectiveWithId(desiredID);
- final IWorkbenchPage page = CVSUIPlugin.getActivePage();
-
- if (page != null) {
- final IPerspectiveDescriptor current = page.getPerspective();
- if (current != null && current.getId().equals(desiredID)) {
- return null; // it is active, so no prompt and no switch
- }
- }
-
- if (desired != null) {
-
- String message;;
- String desc = desired.getDescription();
- if (desc == null) {
- message = NLS.bind(CVSUIMessages.ShowAnnotationOperation_2, new String[] { desired.getLabel() });
- } else {
- message = NLS.bind(CVSUIMessages.ShowAnnotationOperation_3, new String[] { desired.getLabel(), desc });
- }
- // Ask the user whether to switch
- final MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(
- Utils.getShell(null),
- CVSUIMessages.ShowAnnotationOperation_1,
- message,
- CVSUIMessages.ShowAnnotationOperation_4,
- false /* toggle state */,
- store,
- ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS);
-
- final int result = m.getReturnCode();
- switch (result) {
- // yes
- case IDialogConstants.YES_ID:
- case IDialogConstants.OK_ID :
- return desiredID;
- // no
- case IDialogConstants.NO_ID :
- return null;
- }
- }
- return null;
- }
-
- private boolean isKnownUseView() {
- //check whether we should ask the user.
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_USE_QUICKDIFFANNOTATE);
-
- return option.equals(MessageDialogWithToggle.NEVER);
- }
-
- private boolean isKnownUseLiveAnnotate() {
- //check whether we should ask the user.
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_USE_QUICKDIFFANNOTATE);
-
- return option.equals(MessageDialogWithToggle.ALWAYS);
- }
-
- /**
- * Returns true if the user wishes to always use the live annotate view, false otherwise.
- * @return
- */
- private boolean promptForQuickDiffAnnotate(){
- //check whether we should ask the user.
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_USE_QUICKDIFFANNOTATE);
-
- if (option.equals(MessageDialogWithToggle.ALWAYS))
- return true; //use live annotate
- else if (option.equals(MessageDialogWithToggle.NEVER))
- return false; //don't use live annotate
-
- final MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(Utils.getShell(null), CVSUIMessages.ShowAnnotationOperation_QDAnnotateTitle,
- CVSUIMessages.ShowAnnotationOperation_QDAnnotateMessage,CVSUIMessages.ShowAnnotationOperation_4, false, store, ICVSUIConstants.PREF_USE_QUICKDIFFANNOTATE);
-
- final int result = dialog.getReturnCode();
- switch (result) {
- //yes
- case IDialogConstants.YES_ID:
- case IDialogConstants.OK_ID :
- return true;
- }
- return false;
- }
}

Back to the top