Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-01-29 12:15:23 -0500
committerJean Michel-Lemieux2004-01-29 12:15:23 -0500
commit9ee484e61bbb9716b51b913926d3f30e98b00821 (patch)
tree1b2da8d8ee33c5575e4b928d75878cd7a998c007
parent75ed2e664306836669593a1a89b003e4b7307bef (diff)
downloadeclipse.platform.team-9ee484e61bbb9716b51b913926d3f30e98b00821.tar.gz
eclipse.platform.team-9ee484e61bbb9716b51b913926d3f30e98b00821.tar.xz
eclipse.platform.team-9ee484e61bbb9716b51b913926d3f30e98b00821.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java23
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java76
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java58
4 files changed, 91 insertions, 86 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index 3a60442f2..550827c65 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -18,7 +18,9 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
import org.eclipse.team.internal.ccvs.ui.subscriber.CVSLocalCompareConfiguration;
@@ -35,17 +37,26 @@ public class CompareWithTagAction extends WorkspaceAction {
// Show the compare viewer
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
- CompareUI.openCompareEditorOnPage(
- input,
- getTargetPage());
+ CompareUI.openCompareEditorOnPage(input, getTargetPage());
}
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
private SyncInfoSetCompareInput createCompareInput(IResource[] resources, CVSTag tag) {
- final SyncInfoSetCompareInput input = new SyncInfoSetCompareInput(
- new CompareConfiguration(),
- CVSLocalCompareConfiguration.create(resources, tag));
+ final CVSLocalCompareConfiguration viewerConfig = CVSLocalCompareConfiguration.create(resources, tag);
+ final SyncInfoSetCompareInput input = new SyncInfoSetCompareInput(new CompareConfiguration(), viewerConfig) {
+ protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ return viewerConfig.prepareInput(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ public void contributeToToolBar(ToolBarManager tbm) {
+ viewerConfig.contributeToToolBar(tbm);
+ super.contributeToToolBar(tbm);
+ }
+ };
return input;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java
index 9b6478f51..904b57fe1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java
@@ -12,15 +12,14 @@ package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
import org.eclipse.team.ui.synchronize.DiffTreeViewerConfiguration;
+import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
import org.eclipse.team.ui.synchronize.actions.RefreshAction;
/**
@@ -31,6 +30,7 @@ public class CVSLocalCompareConfiguration extends DiffTreeViewerConfiguration {
private CVSCompareSubscriber subscriber;
private TeamSubscriberSyncInfoCollector collector;
private RefreshAction refreshAction;
+ private RefreshAction refreshAllAction;
private FilteredSyncInfoCollector filteredSyncSet;
/**
@@ -63,13 +63,10 @@ public class CVSLocalCompareConfiguration extends DiffTreeViewerConfiguration {
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
- */
public SyncInfoDiffNode prepareInput(IProgressMonitor monitor) throws TeamException {
subscriber.refresh(subscriber.roots(), IResource.DEPTH_INFINITE, monitor);
collector.waitForCollector(monitor);
- return super.prepareInput(monitor);
+ return super.getInput();
}
/* (non-Javadoc)
@@ -82,6 +79,13 @@ public class CVSLocalCompareConfiguration extends DiffTreeViewerConfiguration {
}
/* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.DiffTreeViewerConfiguration#contributeToToolBar(org.eclipse.jface.action.IToolBarManager)
+ */
+ public void contributeToToolBar(IToolBarManager tbm) {
+ tbm.add(refreshAllAction);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration#initializeViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.viewers.StructuredViewer)
*/
public void initializeViewer(Composite parent, StructuredViewer viewer) {
@@ -91,7 +95,7 @@ public class CVSLocalCompareConfiguration extends DiffTreeViewerConfiguration {
protected void initializeActions(StructuredViewer viewer) {
super.initializeActions(viewer);
refreshAction = new RefreshAction(viewer, ((CVSSyncTreeSubscriber)collector.getTeamSubscriber()).getName(), collector, null /* no listener */, false);
-
+ refreshAllAction = new RefreshAction(viewer, ((CVSSyncTreeSubscriber)collector.getTeamSubscriber()).getName(), collector, null /* no listener */, true);
}
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration#getSyncSet()
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java
index 3833804be..7b7a5aafa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java
@@ -12,11 +12,8 @@ package org.eclipse.team.ui.synchronize;
import java.util.ArrayList;
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.INavigatable;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.*;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.events.MenuEvent;
@@ -24,7 +21,6 @@ import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfoSet;
import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.ui.Utils;
@@ -61,8 +57,17 @@ public class DiffTreeViewerConfiguration {
private LogicalViewProvider logicalView;
private ExpandAllAction expandAllAction;
- private NavigationAction nextAction;
- private NavigationAction previousAction;
+
+ /**
+ * Create a <code>SyncInfoSetCompareConfiguration</code> for the given sync set
+ * and menuId. If the menuId is <code>null</code>, then no contributed menus will be shown
+ * in the diff viewer created from this configuration.
+ * @param menuId the id of menu objectContributions
+ * @param set the <code>SyncInfoSet</code> to be displayed in the resulting diff viewer
+ */
+ public DiffTreeViewerConfiguration(SyncInfoSet set) {
+ this(null, set);
+ }
/**
* Create a <code>SyncInfoSetCompareConfiguration</code> for the given sync set
@@ -94,32 +99,12 @@ public class DiffTreeViewerConfiguration {
initializeListeners(viewer);
hookContextMenu(viewer);
initializeActions(viewer);
- initializeNavigation(viewer);
logicalView = getDefaultLogicalViewProvider();
setLogicalViewProvider(logicalView);
viewer.setInput(getInput());
}
- /**
- * Method invoked from <code>initializeViewer(Composite, StructuredViewer)</code> in order
- * to initialize the navigation controller for the diff tree. The navigation control
- * is provided by an instance of <code>SyncInfoDiffTreeNavigator</code>.
- * @param viewer the viewer to be navigated
- * @param target the interface used to navigate the viewer
- * @see SyncInfoDiffTreeNavigator
- */
- protected void initializeNavigation(final StructuredViewer viewer) {
- if(viewer instanceof INavigatable) {
- INavigatable nav= new INavigatable() {
- public boolean gotoDifference(boolean next) {
- // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
- return ((INavigatable)viewer).gotoDifference(next);
- }
- };
- viewer.getControl().setData(INavigatable.NAVIGATOR_PROPERTY, nav);
- }
- }
/**
* Get the input that will be assigned to the viewer initialized by this configuration.
@@ -168,7 +153,6 @@ public class DiffTreeViewerConfiguration {
* @param viewer the viewer being initialize
*/
protected void initializeActions(StructuredViewer viewer) {
- createNextPreviousButtons(viewer.getControl().getParent());
expandAllAction = new ExpandAllAction((AbstractTreeViewer)viewer);
Utils.initAction(expandAllAction, "action.expandAll."); //$NON-NLS-1$
}
@@ -182,18 +166,7 @@ public class DiffTreeViewerConfiguration {
return set;
}
- private void createNextPreviousButtons(Composite parent) {
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent);
- if (tbm != null) {
- tbm.removeAll();
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
- nextAction = new NavigationAction(true);
- previousAction = new NavigationAction(false);
- tbm.appendToGroup("navigation", nextAction);
- tbm.appendToGroup("navigation", previousAction);
- tbm.update(true);
- }
- }
+
/**
* Method invoked from <code>initializeViewer(Composite, StructuredViewer)</code> in order
@@ -254,6 +227,9 @@ public class DiffTreeViewerConfiguration {
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
+ public void contributeToToolBar(IToolBarManager tbm) {
+ }
+
protected LogicalViewProvider getDefaultLogicalViewProvider() {
return new DefaultLogicalView(this);
}
@@ -274,16 +250,6 @@ public class DiffTreeViewerConfiguration {
}
/**
- * Called from the <code>SyncInfoCompareInput</code> to hook up the navigation
- * commands to the compare input
- * @param input the compare input
- */
- public void updateCompareEditorInput(CompareEditorInput input) {
- nextAction.setCompareEditorInput(input);
- previousAction.setCompareEditorInput(input);
- }
-
- /**
* Set the logical view to be used in the diff tree viewer. Passing <code>null</code>
* will remove any logical view and use the standard resource hierarchy view.
* @param viewer the viewer
@@ -361,16 +327,4 @@ public class DiffTreeViewerConfiguration {
protected boolean allowParticipantMenuContributions() {
return getMenuId() != null;
}
-
- /**
- * Prepare the input that is to be shown in the diff viewer of the configuration's
- * compare input. This method may be overridden by sublcass but should only be
- * invoked by the compare input
- * @param monitor a progress monitor
- * @return the input ot the compare input's diff viewer
- * @throws TeamException
- */
- public SyncInfoDiffNode prepareInput(IProgressMonitor monitor) throws TeamException {
- return getInput();
- }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java
index 4349c065a..915b144bb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareInput.java
@@ -13,11 +13,13 @@ package org.eclipse.team.ui.synchronize;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.*;
+import org.eclipse.compare.internal.INavigatable;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.Utils;
@@ -32,6 +34,8 @@ import org.eclipse.team.internal.ui.Utils;
public class SyncInfoSetCompareInput extends CompareEditorInput {
private DiffTreeViewerConfiguration diffViewerConfiguration;
+ private NavigationAction nextAction;
+ private NavigationAction previousAction;
/**
* Create a <code>SyncInfoSetCompareInput</code> whose diff viewer is configured
@@ -45,11 +49,27 @@ public class SyncInfoSetCompareInput extends CompareEditorInput {
}
public final Viewer createDiffViewer(Composite parent) {
- StructuredViewer v = internalCreateDiffViewer(parent, diffViewerConfiguration);
- v.getControl().setData(CompareUI.COMPARE_VIEWER_TITLE, diffViewerConfiguration.getTitle());
- diffViewerConfiguration.updateCompareEditorInput(this);
- initializeDiffViewer(v);
- return v;
+ final StructuredViewer viewer = internalCreateDiffViewer(parent, diffViewerConfiguration);
+ viewer.getControl().setData(CompareUI.COMPARE_VIEWER_TITLE, diffViewerConfiguration.getTitle());
+
+ if(viewer instanceof INavigatable) {
+ INavigatable nav= new INavigatable() {
+ public boolean gotoDifference(boolean next) {
+ // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
+ return ((INavigatable)viewer).gotoDifference(next);
+ }
+ };
+ viewer.getControl().setData(INavigatable.NAVIGATOR_PROPERTY, nav);
+
+ nextAction = new NavigationAction(true);
+ previousAction = new NavigationAction(false);
+ nextAction.setCompareEditorInput(this);
+ previousAction.setCompareEditorInput(this);
+ }
+
+ initializeToolBar(viewer.getControl().getParent());
+ initializeDiffViewer(viewer);
+ return viewer;
}
/**
@@ -86,11 +106,20 @@ public class SyncInfoSetCompareInput extends CompareEditorInput {
});
}
- protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- return diffViewerConfiguration.prepareInput(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
+ public void contributeToToolBar(ToolBarManager tbm) {
+ if(nextAction != null && previousAction != null) {
+ tbm.appendToGroup("navigation", nextAction);
+ tbm.appendToGroup("navigation", previousAction);
+ }
+ }
+
+ private void initializeToolBar(Composite parent) {
+ ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent);
+ if (tbm != null) {
+ tbm.removeAll();
+ tbm.add(new Separator("navigation")); //$NON-NLS-1$
+ contributeToToolBar(tbm);
+ tbm.update(true);
}
}
@@ -105,5 +134,12 @@ public class SyncInfoSetCompareInput extends CompareEditorInput {
}
}
return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ return diffViewerConfiguration.getInput();
}
}

Back to the top