Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-01-23 10:23:55 -0500
committerMichael Valenta2004-01-23 10:23:55 -0500
commit51e20210b2edc04b7e24953f81ba16fdb0bae660 (patch)
tree4ae9b6da1669f0bbba4d476eabe4eb7cf6d46efc
parentab04aa02b58dbaca08037772215730c758b70513 (diff)
downloadeclipse.platform.team-51e20210b2edc04b7e24953f81ba16fdb0bae660.tar.gz
eclipse.platform.team-51e20210b2edc04b7e24953f81ba16fdb0bae660.tar.xz
eclipse.platform.team-51e20210b2edc04b7e24953f81ba16fdb0bae660.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java83
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.properties3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java100
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java66
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java32
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java121
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/RefreshSchedule.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableControl.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableTree.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/IRefreshEvent.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshEvent.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/IRefreshSubscriberListener.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshSubscriberListener.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefreshAction.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java)79
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoDiffTreeNavigator.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffTreeNavigator.java)40
26 files changed, 585 insertions, 215 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
index 179666d4e..10ef4de4c 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
@@ -10,8 +10,13 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.core;
+import java.util.*;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
+import org.eclipse.team.core.subscribers.TeamDelta;
import org.eclipse.team.core.subscribers.utils.SessionSynchronizationCache;
import org.eclipse.team.core.subscribers.utils.SynchronizationCache;
@@ -19,7 +24,7 @@ import org.eclipse.team.core.subscribers.utils.SynchronizationCache;
* This subscriber is used when comparing the local workspace with its
* corresponding remote.
*/
-public class CVSCompareSubscriber extends CVSSyncTreeSubscriber {
+public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ITeamResourceChangeListener {
public static final String QUALIFIED_NAME = CVSProviderPlugin.ID + ".compare"; //$NON-NLS-1$
private static final String UNIQUE_ID_PREFIX = "compare-"; //$NON-NLS-1$
@@ -37,10 +42,11 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber {
private void initialize() {
remoteSynchronizer = new SessionSynchronizationCache();
+ CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().addListener(this);
}
public void dispose() {
- // ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().removeListener(this);
remoteSynchronizer.dispose();
}
@@ -92,4 +98,77 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber {
public IResource[] roots() {
return resources;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.ITeamResourceChangeListener#teamResourceChanged(org.eclipse.team.core.subscribers.TeamDelta[])
+ */
+ public void teamResourceChanged(TeamDelta[] deltas) {
+ List outgoingDeltas = new ArrayList(deltas.length);
+ for (int i = 0; i < deltas.length; i++) {
+ TeamDelta delta = deltas[i];
+ if ((delta.getFlags() & TeamDelta.ROOT_REMOVED) != 0) {
+ IResource resource = delta.getResource();
+ outgoingDeltas.addAll(Arrays.asList(handleRemovedRoot(resource)));
+ } else if ((delta.getFlags() & TeamDelta.SYNC_CHANGED) != 0) {
+ IResource resource = delta.getResource();
+ try {
+ if (isSupervised(resource)) {
+ outgoingDeltas.add(new TeamDelta(this, delta.getFlags(), resource));
+ }
+ } catch (TeamException e) {
+ // Log and ignore
+ CVSProviderPlugin.log(e);
+ }
+ }
+ }
+
+ fireTeamResourceChange((TeamDelta[]) outgoingDeltas.toArray(new TeamDelta[outgoingDeltas.size()]));
+ }
+
+ private TeamDelta[] handleRemovedRoot(IResource removedRoot) {
+ // Determine if any of the roots of the compare are affected
+ List removals = new ArrayList(resources.length);
+ for (int j = 0; j < resources.length; j++) {
+ IResource root = resources[j];
+ if (removedRoot.getFullPath().isPrefixOf(root.getFullPath())) {
+ // The root is no longer managed by CVS
+ removals.add(root);
+ }
+ }
+ if (removals.isEmpty()) {
+ return new TeamDelta[0];
+ }
+
+ // Adjust the roots of the subscriber
+ List newRoots = new ArrayList(resources.length);
+ newRoots.addAll(Arrays.asList(resources));
+ newRoots.removeAll(removals);
+ resources = (IResource[]) newRoots.toArray(new IResource[newRoots.size()]);
+
+ // Create the deltas for the removals
+ TeamDelta[] deltas = new TeamDelta[removals.size()];
+ for (int i = 0; i < deltas.length; i++) {
+ deltas[i] = new TeamDelta(this, TeamDelta.ROOT_REMOVED, (IResource)removals.get(i));
+ }
+ return deltas;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.TeamSubscriber#isSupervised(org.eclipse.core.resources.IResource)
+ */
+ public boolean isSupervised(IResource resource) throws TeamException {
+ if (super.isSupervised(resource)) {
+ if (!resource.exists() && getRemoteSynchronizationCache().getSyncBytes(resource) == null) {
+ // Exclude conflicting deletions
+ return false;
+ }
+ for (int i = 0; i < resources.length; i++) {
+ IResource root = resources[i];
+ if (root.getFullPath().isPrefixOf(resource.getFullPath())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index 2d318bae3..4f87f4f47 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -190,5 +190,8 @@ CVSWorkspaceSubscriber.confirmMerged.tooltip=Mark the conflict as merged by upgr
CVSWorkspaceSubscriber.merge.label=&Update
CVSWorkspaceSubscriber.merge.tooltip=Perform an update merge on the visible resources
+CVSCompareSubscriber.revert.label=&Revert local to remote
+CVSCompareSubscriber.revert.tooltip=Revert the local file contents to match that of their corresponding remotes
+
WorkInProgress.name=Work In Progress
CVSRemoteQuickDiffProvider.label=Latest CVS Revision \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 0ea5ad22d..f65ad3cc9 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -724,7 +724,15 @@
<viewerContribution
id="org.eclipse.team.ccvs.ui.CVSCompareSubscriberContributions"
- targetID="org.eclipse.team.cvs.ui.compare-participant">
+ targetID="org.eclipse.team.cvs.ui.compare-participant">
+ <action
+ label="%CVSCompareSubscriber.revert.label"
+ menubarPath="SubscriberActionsGroup1"
+ tooltip="%CVSCompareSubscriber.revert.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.CompareRevertAction"
+ helpContextId="org.eclipse.team.cvs.ui.compare_revert_action"
+ id="org.eclipse.team.ccvs.ui.CVSCompareSubscriber.revert">
+ </action>
<action
label="%ShowHistoryAction.label"
tooltip="%ShowHistoryAction.tooltip"
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 509293553..d2a45f889 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,12 +12,16 @@ 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.viewers.StructuredViewer;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.TeamSubscriberSyncInfoCollector;
-import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
import org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration;
+import org.eclipse.team.ui.synchronize.actions.RefreshAction;
/**
* Provides compare specific support
@@ -26,6 +30,7 @@ public class CVSLocalCompareConfiguration extends SyncInfoSetCompareConfiguratio
private CVSCompareSubscriber subscriber;
private TeamSubscriberSyncInfoCollector collector;
+ private RefreshAction refreshAction;
/**
* Return a <code>SyncInfoSetCompareConfiguration</code> that can be used in a
@@ -63,4 +68,26 @@ public class CVSLocalCompareConfiguration extends SyncInfoSetCompareConfiguratio
collector.waitForCollector(monitor);
return super.prepareInput(monitor);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration#fillContextMenu(org.eclipse.jface.viewers.StructuredViewer, org.eclipse.jface.action.IMenuManager)
+ */
+ protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) {
+ manager.add(refreshAction);
+ manager.add(new Separator());
+ super.fillContextMenu(viewer, manager);
+ }
+
+ /* (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) {
+ super.initializeViewer(parent, viewer);
+ initializeActions(viewer);
+ }
+
+ private void initializeActions(StructuredViewer viewer) {
+ refreshAction = new RefreshAction(viewer, ((CVSSyncTreeSubscriber)collector.getTeamSubscriber()).getName(), collector, null /* no listener */, false);
+
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java
index a52adb18d..300222a4a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberAction.java
@@ -297,4 +297,67 @@ public abstract class CVSSubscriberAction extends SubscriberAction {
});
return (result[0] == UpdateDialog.YES);
}
+
+ /**
+ * Make the contents of the local resource match that of the remote
+ * without modifying the sync info of the local resource.
+ * If called on a new folder, the sync info will be copied.
+ */
+ protected void makeRemoteLocal(SyncInfo info, IProgressMonitor monitor) throws TeamException {
+ ISubscriberResource remote = info.getRemote();
+ IResource local = info.getLocal();
+ try {
+ if(remote==null) {
+ if (local.exists()) {
+ local.delete(IResource.KEEP_HISTORY, monitor);
+ }
+ } else {
+ if(remote.isContainer()) {
+ ensureContainerExists(info);
+ } else {
+ monitor.beginTask(null, 200);
+ try {
+ IFile localFile = (IFile)local;
+ if(local.exists()) {
+ localFile.setContents(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
+ } else {
+ ensureContainerExists(getParent(info));
+ localFile.create(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, Policy.subMonitorFor(monitor, 100));
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+ }
+ } catch(CoreException e) {
+ throw new CVSException(Policy.bind("UpdateMergeActionProblems_merging_remote_resources_into_workspace_1"), e); //$NON-NLS-1$
+ }
+ }
+
+ private boolean ensureContainerExists(SyncInfo info) throws TeamException {
+ IResource local = info.getLocal();
+ // make sure that the parent exists
+ if (!local.exists()) {
+ if (!ensureContainerExists(getParent(info))) {
+ return false;
+ }
+ }
+ // make sure that the folder sync info is set;
+ if (isOutOfSync(info)) {
+ if (info instanceof CVSSyncInfo) {
+ CVSSyncInfo cvsInfo = (CVSSyncInfo)info;
+ IStatus status = cvsInfo.makeInSync();
+ if (status.getSeverity() == IStatus.ERROR) {
+ logError(status);
+ return false;
+ }
+ }
+ }
+ // create the folder if it doesn't exist
+ ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
+ if (!cvsFolder.exists()) {
+ cvsFolder.mkdir();
+ }
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
new file mode 100644
index 000000000..19463caa0
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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.ccvs.ui.subscriber;
+
+import java.util.*;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+
+/**
+ * Action in compare editor that reverts the local contents to match the contents on the server.
+ */
+public class CompareRevertAction extends CVSSubscriberAction {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#run(org.eclipse.team.core.subscribers.MutableSyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void run(MutableSyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
+ SyncInfo[] changed = syncSet.members();
+ if (changed.length == 0) return;
+
+ // The list of sync resources to be updated using "cvs update"
+ List updateShallow = new ArrayList();
+ // A list of sync resource folders which need to be created locally
+ // (incoming addition or previously pruned)
+ Set parentCreationElements = new HashSet();
+
+ for (int i = 0; i < changed.length; i++) {
+ SyncInfo changedNode = changed[i];
+
+ // Make sure that parent folders exist
+ SyncInfo parent = getParent(changedNode);
+ if (parent != null && isOutOfSync(parent)) {
+ // We need to ensure that parents that are either incoming folder additions
+ // or previously pruned folders are recreated.
+ parentCreationElements.add(parent);
+ }
+
+ IResource resource = changedNode.getLocal();
+ if (resource.getType() == IResource.FILE) {
+ if (changedNode.getLocal().exists()) {
+ updateShallow.add(changedNode);
+ } else if (changedNode.getRemote() != null) {
+ updateShallow.add(changedNode);
+ }
+ } else {
+ // Special handling for folders to support shallow operations on files
+ // (i.e. folder operations are performed using the sync info already
+ // contained in the sync info.
+ if (isOutOfSync(changedNode)) {
+ parentCreationElements.add(changedNode);
+ }
+ }
+
+ }
+ try {
+ // Calculate the total amount of work needed
+ int work = updateShallow.size() * 100;
+ monitor.beginTask(null, work);
+
+ if (parentCreationElements.size() > 0) {
+ makeInSync((SyncInfo[]) parentCreationElements.toArray(new SyncInfo[parentCreationElements.size()]));
+ }
+ if (updateShallow.size() > 0) {
+ runUpdate((SyncInfo[])updateShallow.toArray(new SyncInfo[updateShallow.size()]), Policy.subMonitorFor(monitor, updateShallow.size() * 100));
+ }
+ } finally {
+ monitor.done();
+ }
+ return;
+ }
+
+ private void runUpdate(SyncInfo[] infos, IProgressMonitor monitor) throws TeamException {
+ monitor.beginTask(null, 100 * infos.length);
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ makeRemoteLocal(info, Policy.subMonitorFor(monitor, 100));
+ }
+ monitor.done();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.core.subscribers.SyncInfoSet)
+ */
+ protected String getJobName(SyncInfoSet syncSet) {
+ return "Reverting {0} resources" + new Integer(syncSet.size()).toString();
+
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
index 9fc520e66..b162cfc02 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
@@ -13,8 +13,10 @@ package org.eclipse.team.internal.ccvs.ui.subscriber;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.core.subscribers.SyncInfoFilter.OrSyncInfoFilter;
@@ -22,7 +24,6 @@ import org.eclipse.team.core.subscribers.SyncInfoFilter.SyncInfoDirectionFilter;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
/**
@@ -150,65 +151,6 @@ public class MergeUpdateAction extends SafeUpdateAction {
}
}
- /*
- * If called on a new folder, the folder will become an outgoing addition.
- */
- private void makeRemoteLocal(SyncInfo info, IProgressMonitor monitor) throws TeamException {
- ISubscriberResource remote = info.getRemote();
- IResource local = info.getLocal();
- try {
- if(remote==null) {
- local.delete(false, monitor);
- } else {
- if(remote.isContainer()) {
- ensureContainerExists(info);
- } else {
- monitor.beginTask(null, 200);
- try {
- IFile localFile = (IFile)local;
- if(local.exists()) {
- localFile.setContents(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
- } else {
- ensureContainerExists(getParent(info));
- localFile.create(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
- }
- } catch(CoreException e) {
- throw new CVSException(Policy.bind("UpdateMergeActionProblems_merging_remote_resources_into_workspace_1"), e); //$NON-NLS-1$
- }
- }
-
- private boolean ensureContainerExists(SyncInfo info) throws TeamException {
- IResource local = info.getLocal();
- // make sure that the parent exists
- if (!local.exists()) {
- if (!ensureContainerExists(getParent(info))) {
- return false;
- }
- }
- // make sure that the folder sync info is set;
- if (isOutOfSync(info)) {
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo)info;
- IStatus status = cvsInfo.makeInSync();
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- return false;
- }
- }
- }
- // create the folder if it doesn't exist
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
- if (!cvsFolder.exists()) {
- cvsFolder.mkdir();
- }
- return true;
- }
-
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
index 658b6794c..208eb9974 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java
@@ -23,6 +23,7 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.ui.synchronize.actions.*;
/**
* Job to refresh a subscriber with its remote state.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
index 96ed6540b..eae15758a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
@@ -7,6 +7,7 @@ import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.RefreshCompleteDialog;
import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.team.ui.synchronize.actions.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java
index 188322ba2..fa69c87fa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java
@@ -26,8 +26,8 @@ import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.team.internal.ui.jobs.IRefreshEvent;
import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.actions.IRefreshEvent;
public class RefreshCompleteDialog extends DetailsDialog {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java
index 73e9b8a53..c744f7499 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewCompareConfiguration.java
@@ -19,9 +19,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoDiffTreeNavigator.INavigationTarget;
import org.eclipse.team.internal.ui.synchronize.actions.*;
import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.actions.INavigableTree;
import org.eclipse.ui.IWorkbenchActionConstants;
/**
@@ -34,7 +34,7 @@ public class SynchronizeViewCompareConfiguration extends SyncInfoSetCompareConfi
private OpenWithActionGroup openWithActions;
private RefactorActionGroup refactorActions;
- private RefreshAction refreshSelectionAction;
+ private TeamParticipantRefreshAction refreshSelectionAction;
public SynchronizeViewCompareConfiguration(ISynchronizeView view, TeamSubscriberParticipant participant) {
super(participant.getId(), participant.getSyncInfoSetCollector().getSyncInfoSet());
@@ -47,7 +47,7 @@ public class SynchronizeViewCompareConfiguration extends SyncInfoSetCompareConfi
openWithActions = new OpenWithActionGroup(view, participant);
refactorActions = new RefactorActionGroup(view.getSite().getPage().getActivePart());
- refreshSelectionAction = new RefreshAction(view.getSite().getPage(), participant, false /*refresh*/);
+ refreshSelectionAction = new TeamParticipantRefreshAction(treeViewer, participant, false /*refresh*/);
return treeViewer;
}
@@ -140,7 +140,7 @@ public class SynchronizeViewCompareConfiguration extends SyncInfoSetCompareConfi
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration#initializeNavigation(org.eclipse.swt.widgets.Control, org.eclipse.team.internal.ui.synchronize.SyncInfoDiffTreeNavigator.INavigationTarget)
*/
- protected void initializeNavigation(Control tree, INavigationTarget target) {
+ protected void initializeNavigation(Control tree, INavigableTree target) {
super.initializeNavigation(tree, target);
getNavigator().setShowOpenAction(false);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
index 7b4f5e49d..8c6526621 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
@@ -15,11 +15,10 @@ import org.eclipse.compare.ICompareNavigator;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoDiffTreeNavigator;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.actions.ActionFactory;
@@ -34,15 +33,15 @@ import org.eclipse.ui.actions.ActionFactory;
public class NavigateAction extends Action {
private final int direction;
private ISynchronizeView view;
- private Viewer viewer;
+ private SyncInfoDiffTreeNavigator navigator;
- public NavigateAction(ISynchronizeView view, Viewer viewer, int direction) {
- this.viewer = viewer;
+ public NavigateAction(ISynchronizeView view, SyncInfoDiffTreeNavigator navigator, int direction) {
+ this.navigator = navigator;
this.view = view;
this.direction = direction;
IKeyBindingService kbs = view.getSite().getKeyBindingService();
- if(direction == INavigableControl.NEXT) {
+ if(direction == SyncInfoDiffTreeNavigator.NEXT) {
Utils.initAction(this, "action.navigateNext."); //$NON-NLS-1$
view.getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.NEXT.getId(), this);
} else {
@@ -57,9 +56,8 @@ public class NavigateAction extends Action {
private void navigate() {
SyncInfo info = getSyncInfoFromSelection();
- INavigableControl navigable = (INavigableControl)viewer;
if(info == null) {
- if(navigable.gotoDifference(direction)) {
+ if(navigator.gotoDifference(direction)) {
return;
} else {
info = getSyncInfoFromSelection();
@@ -68,7 +66,7 @@ public class NavigateAction extends Action {
}
if(info.getLocal().getType() != IResource.FILE) {
- if(! navigable.gotoDifference(direction)) {
+ if(! navigator.gotoDifference(direction)) {
info = getSyncInfoFromSelection();
OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
}
@@ -85,8 +83,8 @@ public class NavigateAction extends Action {
input = (CompareEditorInput)editor.getEditorInput();
navigator = (ICompareNavigator)input.getAdapter(ICompareNavigator.class);
if(navigator != null) {
- if(navigator.selectChange(direction == INavigableControl.NEXT)) {
- if(! navigable.gotoDifference(direction)) {
+ if(navigator.selectChange(direction == SyncInfoDiffTreeNavigator.NEXT)) {
+ if(! this.navigator.gotoDifference(direction)) {
info = getSyncInfoFromSelection();
OpenInCompareAction.openCompareEditor(view, view.getParticipant(), info, true /* keep focus */);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java
new file mode 100644
index 000000000..cf1a8aa1f
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.synchronize.actions;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.team.internal.ui.jobs.RefreshUserNotificationPolicy;
+import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
+import org.eclipse.team.ui.synchronize.actions.RefreshAction;
+
+/**
+ * A specialized RefreshAction that extracts the required components from a
+ * particpant.
+ */
+public class TeamParticipantRefreshAction extends RefreshAction {
+
+ public TeamParticipantRefreshAction(ISelectionProvider provider, TeamSubscriberParticipant participant, boolean refreshAll) {
+ super(provider, participant.getName(), participant.getSyncInfoCollector(), new RefreshUserNotificationPolicy(participant), refreshAll);
+ }
+
+ public static void run(IResource[] resources, TeamSubscriberParticipant participant) {
+ run(participant.getName(), resources, participant.getSyncInfoCollector(), new RefreshUserNotificationPolicy(participant));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
index 9772e4e3f..07d9fdcf0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
@@ -14,6 +14,7 @@ import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.team.core.subscribers.ISyncInfoSetChangeEvent;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.core.subscribers.SyncSetChangedEvent;
import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
@@ -24,14 +25,67 @@ import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
public class CompressedFolderContentProvider extends SyncSetTreeContentProvider {
/* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider#handleResourceChanges(org.eclipse.team.core.subscribers.ISyncInfoSetChangeEvent)
+ */
+ protected void handleResourceChanges(ISyncInfoSetChangeEvent event) {
+ AbstractTreeViewer tree = getTreeViewer();
+ if (tree != null) {
+ SyncInfo[] infos = event.getChangedResources();
+
+ // Determine if any folders changed sync state
+ Set projectsToRefresh = new HashSet();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ if (info.getLocal().getType() != IResource.FILE) {
+ // For folder sync changes, we refresh the whole project
+ // so that any compressed folders are adjusted properly
+ // (as rebalancing is tricky)
+ // TODO: Perhaps this could be optimized
+ projectsToRefresh.add(info.getLocal().getProject());
+ }
+ }
+ if (!projectsToRefresh.isEmpty()) {
+
+ // Exclude any resources whose project will be refreshed
+ // Create a new event
+ SyncSetChangedEvent remainingChanges = new SyncSetChangedEvent(event.getSet());
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ if (!projectsToRefresh.contains(info.getLocal().getProject())) {
+ remainingChanges.changed(info);
+ }
+ }
+ // Refresh the projects
+ for (Iterator iter = projectsToRefresh.iterator(); iter.hasNext();) {
+ IResource resource = (IResource) iter.next();
+ tree.refresh(getModelObject(resource), true);
+ }
+ event = remainingChanges;
+ }
+ }
+ super.handleResourceChanges(event);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider#handleResourceAdditions(org.eclipse.team.internal.ui.sync.views.SyncSetChangedEvent)
*/
- protected void handleResourceAdditions(SyncSetChangedEvent event) {
+ protected void handleResourceAdditions(ISyncInfoSetChangeEvent event) {
AbstractTreeViewer tree = getTreeViewer();
if (tree != null) {
- // TODO: For now, refresh any projects with additions
IResource[] roots = event.getAddedRoots();
- refreshProjects(tree, roots);
+ for (int i = 0; i < roots.length; i++) {
+ IResource resource = roots[i];
+ if (resource.getType() == IResource.PROJECT) {
+ // Add the project
+ tree.add(getModelObject(resource.getParent()), getModelObject(resource));
+ updateParentLabels(resource);
+ } else {
+ // TODO: Refresh the resources project for now
+ // because trying to rebalance compressed folder may be tricky
+ // perhaps we could be smarter
+ tree.refresh(getModelObject(resource.getProject()), true);
+ }
+ }
} else {
super.handleResourceAdditions(event);
}
@@ -40,32 +94,58 @@ public class CompressedFolderContentProvider extends SyncSetTreeContentProvider
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.internal.ui.sync.views.SyncSetChangedEvent)
*/
- protected void handleResourceRemovals(SyncSetChangedEvent event) {
+ protected void handleResourceRemovals(ISyncInfoSetChangeEvent event) {
AbstractTreeViewer tree = getTreeViewer();
if (tree != null) {
- // TODO: For now, refresh any projects with deletions
IResource[] roots = event.getRemovedRoots();
- refreshProjects(tree, roots);
+ IResource[] resources = event.getRemovedResources();
+ Set removals = new HashSet();
+
+ // First, deal with any projects that have been removed
+ List remainingRoots = new ArrayList();
+ for (int i = 0; i < roots.length; i++) {
+ IResource resource = roots[i];
+ if (resource.getType() == IResource.PROJECT) {
+ removals.add(getModelObject(resource));
+ } else {
+ remainingRoots.add(resource);
+ }
+ }
+ roots = (IResource[]) remainingRoots.toArray(new IResource[remainingRoots.size()]);
+
+ // Then determine the other model objects that must be removed
+ if (roots.length > 0) {
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (isChildOfRoot(resource, roots)) {
+ // A root of the resource has also been removed.
+ // However, the resource's model parent would be a
+ // compressed folder on the resource's parent folder.
+ removals.add(getModelObject(resource.getParent()));
+ updateParentLabels(resource);
+ } else {
+ // The resources parent still has children so just remove
+ // the resource's model object
+ removals.add(getModelObject(resource));
+ updateParentLabels(resource);
+ }
+ }
+ }
+ tree.remove(removals.toArray(new Object[removals.size()]));
} else {
super.handleResourceRemovals(event);
}
}
- private void refreshProjects(AbstractTreeViewer tree, IResource[] roots) {
- if (roots.length == 0) return;
- Set projects = new HashSet();
+ private boolean isChildOfRoot(IResource resource, IResource[] roots) {
for (int i = 0; i < roots.length; i++) {
- if (roots[i].getType() == IResource.PROJECT) {
- // when a project is involved, refresh the whole tree
- tree.refresh();
- return;
+ IResource root = roots[i];
+ if (!root.equals(resource)
+ && root.getFullPath().isPrefixOf(resource.getFullPath())) {
+ return true;
}
- projects.add(getModelObject(roots[i].getProject()));
- }
- for (Iterator iter = projects.iterator(); iter.hasNext();) {
- Object element = (Object) iter.next();
- tree.refresh(element);
}
+ return false;
}
public Object getParent(Object element) {
@@ -111,7 +191,7 @@ public class CompressedFolderContentProvider extends SyncSetTreeContentProvider
result.add(getModelObject(info.getLocal()));
}
}
- return (Object[]) result.toArray(new Object[result.size()]);
+ return result.toArray(new Object[result.size()]);
}
private Object[] getProjectChildren(IProject project) {
@@ -130,7 +210,7 @@ public class CompressedFolderContentProvider extends SyncSetTreeContentProvider
}
}
}
- return (Object[]) result.toArray(new Object[result.size()]);
+ return result.toArray(new Object[result.size()]);
}
/**
@@ -154,5 +234,4 @@ public class CompressedFolderContentProvider extends SyncSetTreeContentProvider
}
return getLowestInSyncParent(parent);
}
-
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/RefreshSchedule.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/RefreshSchedule.java
index c9798f1cd..6e788d662 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/RefreshSchedule.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/RefreshSchedule.java
@@ -8,6 +8,7 @@ import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.jobs.*;
+import org.eclipse.team.ui.synchronize.actions.*;
import org.eclipse.ui.IMemento;
public class RefreshSchedule {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java
index 7aef248a6..11785e0f2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffCheckboxTreeViewer.java
@@ -15,12 +15,12 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoDiffTreeNavigator;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
+import org.eclipse.team.ui.synchronize.actions.INavigableTree;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoDiffTreeNavigator;
import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer;
// TODO: This is an internal superclass
-public class SyncInfoDiffCheckboxTreeViewer extends ContainerCheckedTreeViewer implements INavigableControl, SyncInfoDiffTreeNavigator.INavigationTarget {
+public class SyncInfoDiffCheckboxTreeViewer extends ContainerCheckedTreeViewer implements INavigableTree {
private SyncInfoSetCompareConfiguration configuration;
@@ -60,7 +60,7 @@ public class SyncInfoDiffCheckboxTreeViewer extends ContainerCheckedTreeViewer i
* @see org.eclipse.team.ui.synchronize.actions.INavigableControl#gotoDifference(int)
*/
public boolean gotoDifference(int direction) {
- boolean next = direction == INavigableControl.NEXT ? true : false;
+ boolean next = direction == SyncInfoDiffTreeNavigator.NEXT ? true : false;
return configuration.getNavigator().navigate(next, false);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java
index 6d12e7e18..820ae24fa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffTreeViewer.java
@@ -15,10 +15,10 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoDiffTreeNavigator;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
+import org.eclipse.team.ui.synchronize.actions.INavigableTree;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoDiffTreeNavigator;
-public class SyncInfoDiffTreeViewer extends TreeViewer implements INavigableControl, SyncInfoDiffTreeNavigator.INavigationTarget {
+public class SyncInfoDiffTreeViewer extends TreeViewer implements INavigableTree {
private SyncInfoSetCompareConfiguration configuration;
@@ -58,7 +58,7 @@ public class SyncInfoDiffTreeViewer extends TreeViewer implements INavigableCont
* @see org.eclipse.team.ui.synchronize.actions.INavigableControl#gotoDifference(int)
*/
public boolean gotoDifference(int direction) {
- boolean next = direction == INavigableControl.NEXT ? true : false;
+ boolean next = direction == SyncInfoDiffTreeNavigator.NEXT ? true : false;
return configuration.getNavigator().navigate(next, false);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
index 2eb63c494..ede2c42f0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
@@ -29,9 +29,9 @@ import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfoSet;
import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoDiffTreeNavigator;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoDiffTreeNavigator.INavigationTarget;
import org.eclipse.team.internal.ui.synchronize.views.*;
+import org.eclipse.team.ui.synchronize.actions.INavigableTree;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoDiffTreeNavigator;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.internal.PluginAction;
@@ -86,8 +86,8 @@ public class SyncInfoSetCompareConfiguration {
initializeListeners(viewer);
viewer.getControl().setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
- if (viewer instanceof INavigationTarget) {
- initializeNavigation(viewer.getControl(), (INavigationTarget)viewer);
+ if (viewer instanceof INavigableTree) {
+ initializeNavigation(viewer.getControl(), (INavigableTree)viewer);
navigator.createActions(viewer);
}
hookContextMenu(viewer);
@@ -125,7 +125,7 @@ public class SyncInfoSetCompareConfiguration {
return new TeamSubscriberParticipantLabelProvider();
}
- protected void initializeNavigation(Control tree, INavigationTarget target) {
+ protected void initializeNavigation(Control tree, INavigableTree target) {
this.navigator = new SyncInfoDiffTreeNavigator(target);
INavigatable nav= new INavigatable() {
public boolean gotoDifference(boolean next) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
index f51aa4ad1..4f7115064 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.synchronize.actions.RefreshAction;
+import org.eclipse.team.internal.ui.synchronize.actions.TeamParticipantRefreshAction;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.ui.*;
import org.eclipse.ui.part.IPageBookViewPage;
@@ -131,9 +131,9 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti
public void refreshWithRemote(IResource[] resources) {
if((resources == null || resources.length == 0)) {
- RefreshAction.run(filteredSyncSet.getWorkingSet(), this);
+ TeamParticipantRefreshAction.run(filteredSyncSet.getWorkingSet(), this);
} else {
- RefreshAction.run(resources, this);
+ TeamParticipantRefreshAction.run(resources, this);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
index 5962bbec0..b6e3f3f0a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
@@ -23,7 +23,7 @@ import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.jobs.JobBusyCursor;
import org.eclipse.team.internal.ui.synchronize.*;
import org.eclipse.team.internal.ui.synchronize.actions.*;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
+import org.eclipse.team.ui.synchronize.actions.SyncInfoDiffTreeNavigator;
import org.eclipse.ui.*;
import org.eclipse.ui.part.*;
@@ -56,10 +56,11 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
private NavigateAction gotoPrevious;
private Action configureSchedule;
private SyncViewerShowPreferencesAction showPreferences;
- private RefreshAction refreshAllAction;
+ private TeamParticipantRefreshAction refreshAllAction;
private Action collapseAll;
private WorkingSetFilterActionGroup workingSetGroup;
private StatusLineContributionGroup statusLine;
+ private SynchronizeViewCompareConfiguration configuration;
/**
* Constructs a new SynchronizeView.
@@ -88,12 +89,13 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
// Create the busy cursor with no control to start with (createViewer will set it)
busyCursor = new JobBusyCursor(parent.getParent().getParent(), TeamSubscriber.SUBSCRIBER_JOB_TYPE);
- changesSection = new ChangesSection(composite, this);
+ // Create the changes section which, in turn, creates the changes viewer and its configuration
+ changesSection = new ChangesSection(composite, this);
// toolbar
- gotoNext = new NavigateAction(view, changesSection.getChangesViewer(), INavigableControl.NEXT);
- gotoPrevious = new NavigateAction(view, changesSection.getChangesViewer(), INavigableControl.PREVIOUS);
- refreshAllAction = new RefreshAction(getSite().getPage(), getParticipant(), true /* refresh all */);
+ gotoNext = new NavigateAction(view, configuration.getNavigator(), SyncInfoDiffTreeNavigator.NEXT);
+ gotoPrevious = new NavigateAction(view, configuration.getNavigator(), SyncInfoDiffTreeNavigator.PREVIOUS);
+ refreshAllAction = new TeamParticipantRefreshAction(getSite().getSelectionProvider(), getParticipant(), true /* refresh all */);
collapseAll = new Action() {
public void run() {
Viewer viewer = getChangesViewer();
@@ -264,7 +266,7 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
}
public Viewer createChangesViewer(Composite parent) {
- SynchronizeViewCompareConfiguration configuration = new SynchronizeViewCompareConfiguration(getSynchronizeView(), getParticipant());
+ configuration = new SynchronizeViewCompareConfiguration(getSynchronizeView(), getParticipant());
Viewer viewer = configuration.createViewer(parent);
getSite().setSelectionProvider(viewer);
return viewer;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableControl.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableControl.java
deleted file mode 100644
index 5a797bdd8..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableControl.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.ui.synchronize.actions;
-
-public interface INavigableControl {
-
- /**
- * Direction to navigate
- */
- 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/ui/synchronize/actions/INavigableTree.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableTree.java
new file mode 100644
index 000000000..1cc4a22a8
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/INavigableTree.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.ui.synchronize.actions;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * This interface is used by the <code>SyncInfoDiffTreeNavigator</code>. Any
+ * tree widget that is used as the diff viewer associated with a
+ * <code>SyncInfoSetCompareConfiguration</code> should implement this interface
+ * in order to get menu, toolbar and keyboard navigation.
+ */
+public interface INavigableTree {
+
+ /**
+ * Open the currently selected item. For a <code>TreeViewer</code>,
+ * this can be accomplished using the expression
+ * <code>fireOpen(new OpenEvent(this, getSelection()))</code>.
+ */
+ void openSelection();
+
+ /**
+ * Get the <code>Tree</code> that is the control for this viewer.
+ * This method is already defined on <code>TreeViewer</code>.
+ * @return a <code>Tree</code> control
+ */
+ Tree getTree();
+
+ /**
+ * Create the children of the given <code>TreeItem</code> if they have not
+ * already been created.
+ * This method is already defined on <code>TreeViewer</code> but is protected
+ * so an implementor must override it to make it public.
+ * @param item the parent tree item
+ */
+ void createChildren(TreeItem item);
+
+ /**
+ * Get the currently selected item.
+ * This method is already defined on <code>TreeViewer</code>.
+ * @return the selection
+ */
+ ISelection getSelection();
+
+ /**
+ * Set the viewers selection to the given selection.
+ * This method is already defined on <code>TreeViewer</code>.
+ * @param selection the new selection
+ * @param fireOpen open selection as well
+ */
+ void setSelection(ISelection selection, boolean fireOpen);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/IRefreshEvent.java
index 328daa37b..a1879a1b9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshEvent.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/IRefreshEvent.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.jobs;
+package org.eclipse.team.ui.synchronize.actions;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshSubscriberListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/IRefreshSubscriberListener.java
index 5360aa40a..0a503df7c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshSubscriberListener.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/IRefreshSubscriberListener.java
@@ -1,4 +1,4 @@
-package org.eclipse.team.internal.ui.jobs;
+package org.eclipse.team.ui.synchronize.actions;
public interface IRefreshSubscriberListener {
public void refreshStarted(IRefreshEvent event);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefreshAction.java
index 5c4e33c0c..7aa01a96b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/RefreshAction.java
@@ -8,49 +8,60 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize.actions;
+package org.eclipse.team.ui.synchronize.actions;
-import java.lang.reflect.InvocationTargetException;
import java.util.*;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.JobStatusHandler;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.*;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
-import org.eclipse.team.internal.ui.jobs.RefreshUserNotificationPolicy;
import org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider;
-import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
-import org.eclipse.ui.IWorkbenchPage;
+/**
+ * A general refresh action that will refresh a subscriber in the background.
+ */
public class RefreshAction extends Action {
+
+ private ISelectionProvider selectionProvider;
private boolean refreshAll;
- private IWorkbenchPage page;
- private TeamSubscriberParticipant participant;
+ private TeamSubscriberSyncInfoCollector collector;
+ private IRefreshSubscriberListener listener;
+ private String description;
+
+ public static void run(String description, IResource[] resources, TeamSubscriberSyncInfoCollector collector, IRefreshSubscriberListener listener) {
+ // Cancel the scheduled background refresh or any other refresh that is happening.
+ // The scheduled background refresh will restart automatically.
+ Platform.getJobManager().cancel(RefreshSubscriberJob.getFamily());
+ RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", description), resources, collector); //$NON-NLS-1$
+ if (listener != null) {
+ RefreshSubscriberJob.addRefreshListener(listener);
+ }
+ JobStatusHandler.schedule(job, TeamSubscriber.SUBSCRIBER_JOB_TYPE);
+ }
- public RefreshAction(IWorkbenchPage page, TeamSubscriberParticipant participant, boolean refreshAll) {
- this.participant = participant;
- this.page = page;
+ public RefreshAction(ISelectionProvider page, String description, TeamSubscriberSyncInfoCollector collector, IRefreshSubscriberListener listener, boolean refreshAll) {
+ this.selectionProvider = page;
+ this.description = description;
+ this.collector = collector;
+ this.listener = listener;
this.refreshAll = refreshAll;
Utils.initAction(this, "action.refreshWithRemote."); //$NON-NLS-1$
}
public void run() {
- ISelection selection = page.getSelection();
+ ISelection selection = selectionProvider.getSelection();
if(selection instanceof IStructuredSelection) {
IResource[] resources = getResources((IStructuredSelection)selection);
if (refreshAll || resources.length == 0) {
// If no resources are selected, refresh all the subscriber roots
- resources = participant.getSubscriber().roots();
+ resources = collector.getRoots();
}
- run(resources, participant);
+ run(description, resources, collector, listener);
}
}
@@ -68,28 +79,4 @@ public class RefreshAction extends Action {
}
return (IResource[]) resources.toArray(new IResource[resources.size()]);
}
-
- public static void run(IResource[] resources, TeamSubscriberParticipant participant) {
- // Cancel the scheduled background refresh or any other refresh that is happening.
- // The scheduled background refresh will restart automatically.
- Platform.getJobManager().cancel(RefreshSubscriberJob.getFamily());
- RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", participant.getName()), resources, participant.getSyncInfoCollector()); //$NON-NLS-1$
- RefreshSubscriberJob.addRefreshListener(new RefreshUserNotificationPolicy(participant));
- JobStatusHandler.schedule(job, TeamSubscriber.SUBSCRIBER_JOB_TYPE);
- }
-
- private static void runBlocking(final TeamSubscriber s, final IResource[] resources) {
- TeamUIPlugin.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, 100);
- s.refresh(resources, IResource.DEPTH_INFINITE, Policy.subMonitorFor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- }
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffTreeNavigator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoDiffTreeNavigator.java
index 201139c39..8fa62b191 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffTreeNavigator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/SyncInfoDiffTreeNavigator.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.synchronize;
+package org.eclipse.team.ui.synchronize.actions;
import java.util.Iterator;
@@ -21,30 +21,31 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
-import org.eclipse.team.ui.synchronize.actions.INavigableControl;
/**
- * This class provides the navigation support required for keybindings
+ * This class provides the tree navigation support for tree based diff viewers
+ * created using a <code>SyncInfoSetCompareConfiguration</code>. This includes
+ * menu actions for expanding the tree and opening the selected item in the
+ * text compare pane as well as up and down navigation actions that are added
+ * to the toolbas and bound to the navigation keys.
*/
public class SyncInfoDiffTreeNavigator {
+ /**
+ * Direction to navigate
+ */
+ final public static int NEXT = 1;
+ final public static int PREVIOUS = 2;
+
private Action expandAll;
private Action open;
private NavigationAction nextAction;
private NavigationAction previousAction;
- public interface INavigationTarget {
- void openSelection();
- Tree getTree();
- void createChildren(TreeItem item);
- ISelection getSelection();
- void setSelection(ISelection selection, boolean b);
- }
-
- INavigationTarget target;
+ INavigableTree target;
boolean showOpenAction = true;
- public SyncInfoDiffTreeNavigator(INavigationTarget target) {
+ public SyncInfoDiffTreeNavigator(INavigableTree target) {
this.target = target;
}
@@ -57,7 +58,7 @@ public class SyncInfoDiffTreeNavigator {
* @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;
+ boolean next = direction == SyncInfoDiffTreeNavigator.NEXT ? true : false;
return navigate(next, false);
}
@@ -203,7 +204,7 @@ public class SyncInfoDiffTreeNavigator {
return item;
}
- public INavigationTarget getTarget() {
+ public INavigableTree getTarget() {
return target;
}
@@ -225,6 +226,15 @@ public class SyncInfoDiffTreeNavigator {
public void run() {
expandAllFromSelection(viewer);
}
+ // TODO: needs to be invoked when the selection changes
+ public void update() {
+ ISelection selection = target.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ setEnabled(!ss.isEmpty());
+ }
+ setEnabled(false);
+ }
};
Utils.initAction(expandAll, "action.expandAll."); //$NON-NLS-1$

Back to the top