Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-07-09 20:21:13 +0000
committerJean Michel-Lemieux2003-07-09 20:21:13 +0000
commitcc7226db1d36da5715e786630ca1998e825a23fb (patch)
tree347b217d2cc5e55cef026b0e0ae3770f235bb771 /bundles/org.eclipse.team.ui
parent8c25b991f4be2becd767bb3b69488cf0e3313fca (diff)
downloadeclipse.platform.team-cc7226db1d36da5715e786630ca1998e825a23fb.tar.gz
eclipse.platform.team-cc7226db1d36da5715e786630ca1998e825a23fb.tar.xz
eclipse.platform.team-cc7226db1d36da5715e786630ca1998e825a23fb.zip
support for ctrl. and ctrl, in sync view
fixed select all enablement bug
Diffstat (limited to 'bundles/org.eclipse.team.ui')
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties13
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml83
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java45
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java39
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java212
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewer.java55
8 files changed, 401 insertions, 80 deletions
diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties
index 3b7b65aa9..d95418876 100644
--- a/bundles/org.eclipse.team.ui/plugin.properties
+++ b/bundles/org.eclipse.team.ui/plugin.properties
@@ -52,7 +52,12 @@ SiteExplorerGetAsProject.tooltip=Download the selected remote folder and create
SiteExplorerDiscardSite.label=D&iscard Site
SiteExplorerDiscardSite.tooltip=Discard the site
-TeamActionSet.categoryName=Team
-TeamActionSet.description=Actions that apply when working with a Team
-TeamActionSet.syncLabel=Synchronize
-TeamActionSet.syncTooltip=Synchronize \ No newline at end of file
+Command.category.name=Team
+Command.category.description=Actions that apply when working with a Team
+Command.syncAll.name=Synchronize
+Command.syncAll.description=Synchronize
+
+Command.selectNextChange.name=Select Next Change
+Command.selectNextChange.description=Select Next Change
+Command.selectPreviousChange.name=Select Previous Change
+Command.selectPreviousChange.description=Select Previous Change \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index f00fd3919..74d481643 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -262,44 +262,61 @@
</perspectiveExtension>
</extension>
-<!-- ***************** Actions ********************** -->
- <extension point="org.eclipse.ui.commands">
- <category
- name="%TeamActionSet.categoryName"
- description="%TeamActionSet.description"
- id="org.eclipse.team.ui.actionSet">
- </category>
+<!-- ***************** Commands ********************** -->
+ <extension point="org.eclipse.ui.commands">
+ <category
+ name="%Command.category.name"
+ description="%Command.category.description"
+ id="org.eclipse.team.ui.commands.category"
+ />
<command
- category="org.eclipse.team.ui.actionSet"
- name="%TeamActionSet.syncLabel"
- description="%TeamActionSet.syncTooltip"
- id="org.eclipse.team.ui.sync.all">
- </command>
+ category="org.eclipse.team.ui.commands.category"
+ id="org.eclipse.team.ui.syncview.selectNextChange"
+ name= "%Command.selectNextChange.name"
+ description="%Command.selectNextChange.description"
+ />
+ <keyBinding
+ string=""
+ scope="org.eclipse.ui.globalScope"
+ command="org.eclipse.team.ui.syncview.selectNextChange"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration"
+ />
+ <command
+ category="org.eclipse.team.ui.commands.category"
+ id="org.eclipse.team.ui.syncview.selectPreviousChange"
+ name= "%Command.selectPreviousChange.name"
+ description="%Command.selectPreviousChange.description"
+ />
+ <keyBinding
+ string=""
+ scope="org.eclipse.ui.globalScope"
+ command="org.eclipse.team.ui.syncview.selectPreviousChange"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration"
+ />
<command
- category="org.eclipse.team.ui.actionSet"
- name="%TeamActionSet.syncLabel"
- description="%TeamActionSet.syncTooltip"
- id="org.eclipse.team.ui.sync.all">
- </command>
- </extension>
+ category="org.eclipse.team.ui.commands.category"
+ id="org.eclipse.team.ui.syncview.syncAll"
+ name="%Command.syncAll.name"
+ description="%Command.syncAll.description"
+ />
+ </extension>
- <extension point="org.eclipse.ui.actionSets">
- <actionSet
- label="%Team"
- visible="true"
- id="org.eclipse.team.ui.actionSet"
- description="%ActionSet.description">
- <action
- toolbarPath="Normal/CVS"
+<!-- ***************** Action sets ********************** -->
+<extension point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="%Team"
+ visible="true"
+ id="org.eclipse.team.ui.actionSet"
+ description="%ActionSet.description">
+ <action
+ toolbarPath="Normal/CVS"
style="pulldown"
- label="%TeamActionSet.syncLabel"
- tooltip="%TeamActionSet.syncTooltip"
+ label="%Command.syncAll.name"
+ tooltip="%Command.syncAll.description"
icon="icons/full/cview16/synch_synch.gif"
class="org.eclipse.team.internal.ui.sync.actions.SyncAllAction"
id="org.eclipse.team.internal.ui.sync.actions.SyncAllAction"
- definitionId="org.eclipse.team.ui.sync.all">
- </action>
- </actionSet>
- </extension>
-
+ definitionId="org.eclipse.team.ui.syncview.syncAll"/>
+ </actionSet>
+</extension>
</plugin>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 8803c3c8a..a936f08f3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -12,6 +12,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
@@ -20,6 +21,7 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
+import org.eclipse.ui.IKeyBindingService;
/**
* @author Jean-Michel Lemieux
@@ -177,4 +179,11 @@ public class Utils {
TeamUIPlugin.log(error.getSeverity(), error.getMessage(), t);
}
}
+
+ public static void registerAction(IKeyBindingService kbs, IAction a, String id) {
+ if (kbs != null) {
+ a.setActionDefinitionId(id);
+ kbs.registerAction(a);
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
index 18b4f5c42..069515bbc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
@@ -23,17 +23,22 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.sync.views.INavigableControl;
import org.eclipse.team.internal.ui.sync.views.SubscriberInput;
import org.eclipse.team.internal.ui.sync.views.SyncViewer;
import org.eclipse.team.ui.ISharedImages;
import org.eclipse.team.ui.sync.AndSyncInfoFilter;
+import org.eclipse.team.ui.sync.ISyncViewer;
import org.eclipse.team.ui.sync.PseudoConflictFilter;
import org.eclipse.team.ui.sync.SyncInfoChangeTypeFilter;
import org.eclipse.team.ui.sync.SyncInfoDirectionFilter;
import org.eclipse.team.ui.sync.SyncInfoFilter;
import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionContext;
@@ -67,6 +72,7 @@ public class SyncViewerActions extends SyncViewerActionGroup {
private Action open;
private ExpandAllAction expandAll;
private CancelSubscription cancelSubscription;
+ private SelectAllAction selectAllAction;
class CollapseAllAction extends Action {
public CollapseAllAction() {
@@ -107,18 +113,21 @@ public class SyncViewerActions extends SyncViewerActionGroup {
setChecked(viewer.getCurrentViewType() == SyncViewer.TREE_VIEW);
}
}
- }
-
- class SelectAllAction extends Action {
- public boolean isEnabled() {
- // Always enable the action but selectAll on Tree does nothing
- // Being smarter would require a refresh of the global command when the
- // view switches type (TREE<>TABLE)
- return true;
+ }
+
+ class SelectAllAction extends Action implements IPropertyListener {
+ public SelectAllAction() {
+ getSyncView().addPropertyListener(this);
}
public void run() {
getSyncView().selectAll();
}
+ public void propertyChanged(Object source, int propId) {
+ if(propId == SyncViewer.PROP_VIEWTYPE) {
+ selectAllAction.setEnabled(getSyncView().getCurrentViewType() == ISyncViewer.TABLE_VIEW);
+ getSyncView().getViewSite().getActionBars().updateActionBars();
+ }
+ }
}
class ChooseSubscriberAction extends SyncViewerToolbarDropDownAction {
@@ -197,6 +206,23 @@ public class SyncViewerActions extends SyncViewerActionGroup {
expandAll = new ExpandAllAction(this);
cancelSubscription = new CancelSubscription(this);
+ IKeyBindingService kbs = getSyncView().getSite().getKeyBindingService();
+ Action a= new Action("Select next team change") {
+ public void run() {
+ getSyncView().gotoDifference(INavigableControl.NEXT);
+ }
+ };
+ Utils.registerAction(kbs, a, "org.eclipse.team.ui.syncview.selectNextChange"); //$NON-NLS-1$
+ getSyncView().getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.NEXT, a);
+
+ a= new Action("Select previous team change") {
+ public void run() {
+ getSyncView().gotoDifference(INavigableControl.PREVIOUS);
+ }
+ };
+ Utils.registerAction(kbs, a, "org.eclipse.team.ui.syncview.selectPreviousChange"); //$NON-NLS-1$
+ getSyncView().getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, a);
+
toggleViewerType = new ToggleViewAction(getSyncView(), getSyncView().getCurrentViewType());
open = new OpenInCompareAction(syncView);
@@ -227,7 +253,7 @@ public class SyncViewerActions extends SyncViewerActionGroup {
public void fillActionBars(IActionBars actionBars) {
super.fillActionBars(actionBars);
- Action selectAllAction = new SelectAllAction();
+ selectAllAction = new SelectAllAction();
actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, selectAllAction);
IToolBarManager manager = actionBars.getToolBarManager();
@@ -311,6 +337,7 @@ public class SyncViewerActions extends SyncViewerActionGroup {
protected void initializeActions() {
SubscriberInput input = getSubscriberContext();
refreshSelectionAction.setEnabled(input != null);
+
cancelSubscription.updateTitle(input);
if(input == null) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
new file mode 100644
index 000000000..30b018fad
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.sync.views;
+
+public interface INavigableControl {
+
+ /**
+ * Direction to naviate
+ */
+ final public static int NEXT = 1;
+ final public static int PREVIOUS = 2;
+
+ /**
+ * Returns true if at end or beginning.
+ */
+ boolean gotoDifference(int direction);
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
new file mode 100644
index 000000000..b3d0168b6
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.sync.views;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+
+public class SyncTableViewer extends TableViewer implements INavigableControl {
+
+ public SyncTableViewer(Table table) {
+ super(table);
+ }
+
+ public boolean gotoDifference(int direction) {
+ Control c = getControl();
+
+ if (!(c instanceof Table))
+ return false;
+
+ Table table = (Table)c;
+ int inc = direction == NEXT ? 1 : -1;
+ int total = table.getItemCount();
+ int next = table.getSelectionIndex() + inc;
+ if(next >= total || next < 0) {
+ return true;
+ }
+ table.setSelection(next);
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
new file mode 100644
index 000000000..7e937d9e1
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.sync.views;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * Subclass of TreeViewer which handles decorator events properly. We should not need to create
+ * a subclass just for this!
+ */
+public class SyncTreeViewer extends TreeViewer implements INavigableControl {
+ private final SyncViewer viewer;
+ public SyncTreeViewer(SyncViewer viewer, Composite parent, int style) {
+ super(parent, style);
+ this.viewer = viewer;
+ }
+ protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
+ Object[] changed= event.getElements();
+ if (changed != null && this.viewer.getInput() != null) {
+ ArrayList others= new ArrayList();
+ for (int i= 0; i < changed.length; i++) {
+ Object curr = changed[i];
+ if (curr instanceof IResource) {
+ curr = SyncSet.getModelObject(viewer.getInput().getFilteredSyncSet(), (IResource)curr);
+ }
+ others.add(curr);
+ }
+ if (others.isEmpty()) {
+ return;
+ }
+ event= new LabelProviderChangedEvent((IBaseLabelProvider) event.getSource(), others.toArray());
+ }
+ super.handleLabelProviderChanged(event);
+ }
+
+ /**
+ * Selects the next (or previous) node of the current selection.
+ * If there is no current selection the first (last) node in the tree is selected.
+ * Wraps around at end or beginning.
+ * Clients may override.
+ *
+ * @param next if <code>true</code> the next node is selected, otherwise the previous node
+ */
+ public boolean gotoDifference(int direction) {
+ boolean next = direction == INavigableControl.NEXT ? true : false;
+ return internalNavigate(next, false);
+ }
+
+ /**
+ * Selects the next (or previous) node of the current selection.
+ * If there is no current selection the first (last) node in the tree is selected.
+ * Wraps around at end or beginning.
+ * Clients may override.
+ *
+ * @param next if <code>true</code> the next node is selected, otherwise the previous node
+ * @return <code>true</code> if at end (or beginning)
+ */
+ private boolean internalNavigate(boolean next, boolean fireOpen) {
+
+ Control c= getControl();
+ if (!(c instanceof Tree))
+ return false;
+
+ Tree tree= (Tree) c;
+ TreeItem item= null;
+ TreeItem children[]= tree.getSelection();
+ if (children != null && children.length > 0)
+ item= children[0];
+ if (item == null) {
+ children= tree.getItems();
+ if (children != null && children.length > 0) {
+ item= children[0];
+ if (item != null && item.getItemCount() <= 0) {
+ internalSetSelection(item, fireOpen); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
+ return false;
+ }
+ }
+ }
+
+ while (true) {
+ item= findNextPrev(item, next);
+ if (item == null)
+ break;
+ if (item.getItemCount() <= 0)
+ break;
+ }
+
+ if (item != null) {
+ internalSetSelection(item, fireOpen); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
+ return false;
+ }
+ return true;
+ }
+
+ private TreeItem findNextPrev(TreeItem item, boolean next) {
+
+ if (item == null)
+ return null;
+
+ TreeItem children[]= null;
+
+ if (!next) {
+
+ TreeItem parent= item.getParentItem();
+ if (parent != null)
+ children= parent.getItems();
+ else
+ children= item.getParent().getItems();
+
+ if (children != null && children.length > 0) {
+ // goto previous child
+ int index= 0;
+ for (; index < children.length; index++)
+ if (children[index] == item)
+ break;
+
+ if (index > 0) {
+
+ item= children[index-1];
+
+ while (true) {
+ createChildren(item);
+ int n= item.getItemCount();
+ if (n <= 0)
+ break;
+
+ item.setExpanded(true);
+ item= item.getItems()[n-1];
+ }
+
+ // previous
+ return item;
+ }
+ }
+
+ // go up
+ return parent;
+
+ } else {
+ item.setExpanded(true);
+ createChildren(item);
+
+ if (item.getItemCount() > 0) {
+ // has children: go down
+ children= item.getItems();
+ return children[0];
+ }
+
+ while (item != null) {
+ children= null;
+ TreeItem parent= item.getParentItem();
+ if (parent != null)
+ children= parent.getItems();
+ else
+ children= item.getParent().getItems();
+
+ if (children != null && children.length > 0) {
+ // goto next child
+ int index= 0;
+ for (; index < children.length; index++)
+ if (children[index] == item)
+ break;
+
+ if (index < children.length-1) {
+ // next
+ return children[index+1];
+ }
+ }
+
+ // go up
+ item= parent;
+ }
+ }
+
+ return item;
+ }
+
+ private void internalSetSelection(TreeItem ti, boolean fireOpen) {
+ if (ti != null) {
+ Object data= ti.getData();
+ if (data != null) {
+ // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
+ ISelection selection= new StructuredSelection(data);
+ setSelection(selection, true);
+ ISelection currentSelection= getSelection();
+ if (fireOpen && currentSelection != null && selection.equals(currentSelection)) {
+ fireOpen(new OpenEvent(this, selection));
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewer.java
index 83358f91b..5f47e1bac 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewer.java
@@ -34,13 +34,11 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -138,34 +136,6 @@ public class SyncViewer extends ViewPart implements ITeamResourceChangeListener,
private static final String VIEWER_TYPE_MEMENTO_KEY = "viewerType"; // $NON-NLS-1$
- /**
- * Subclass of TreeViewer which handles decorator events properly. We should not need to create
- * a subclass just for this!
- */
- public class SyncTreeViewer extends TreeViewer {
- public SyncTreeViewer(Composite parent, int style) {
- super(parent, style);
- }
- protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
- Object[] changed= event.getElements();
- if (changed != null && input != null) {
- ArrayList others= new ArrayList();
- for (int i= 0; i < changed.length; i++) {
- Object curr = changed[i];
- if (curr instanceof IResource) {
- curr = SyncSet.getModelObject(input.getFilteredSyncSet(), (IResource)curr);
- }
- others.add(curr);
- }
- if (others.isEmpty()) {
- return;
- }
- event= new LabelProviderChangedEvent((IBaseLabelProvider) event.getSource(), others.toArray());
- }
- super.handleLabelProviderChanged(event);
- }
- }
-
public SyncViewer() {
}
@@ -250,7 +220,7 @@ public class SyncViewer extends ViewPart implements ITeamResourceChangeListener,
}
private void createTreeViewerPartControl(Composite parent) {
- viewer = new SyncTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer = new SyncTreeViewer(this, parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setContentProvider(new SyncSetTreeContentProvider());
viewer.setLabelProvider(SyncViewerLabelProvider.getDecoratingLabelProvider());
viewer.setSorter(new SyncViewerSorter());
@@ -269,7 +239,7 @@ public class SyncViewer extends ViewPart implements ITeamResourceChangeListener,
table.setLayout(layout);
// Create the viewer
- TableViewer tableViewer = new TableViewer(table);
+ TableViewer tableViewer = new SyncTableViewer(table);
// Create the table columns
createColumns(table, layout, tableViewer);
@@ -519,12 +489,22 @@ public class SyncViewer extends ViewPart implements ITeamResourceChangeListener,
*/
public void dispose() {
super.dispose();
+
+ // cancel and wait
+ RefreshSubscriberInputJob job = TeamUIPlugin.getPlugin().getRefreshJob();
+ job.cancel();
+ try {
+ job.join();
+ } catch (InterruptedException e) {
+ // continue with shutdown
+ }
+ job.setSubscriberInput(null);
+
TeamProvider.removeListener(this);
for (Iterator it = subscriberInputs.values().iterator(); it.hasNext();) {
SubscriberInput input = (SubscriberInput) it.next();
input.dispose();
- }
- TeamUIPlugin.getPlugin().getRefreshJob().setSubscriberInput(null);
+ }
}
public void run(IRunnableWithProgress runnable) {
@@ -824,4 +804,11 @@ public class SyncViewer extends ViewPart implements ITeamResourceChangeListener,
// tree.getTree().selectAll();
}
}
+
+ public boolean gotoDifference(int direction) {
+ if(viewer instanceof INavigableControl) {
+ return ((INavigableControl)viewer).gotoDifference(direction);
+ }
+ return false;
+ }
} \ No newline at end of file

Back to the top