Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-10-17 16:53:17 +0000
committerJean Michel-Lemieux2003-10-17 16:53:17 +0000
commit52ac78bc92594e8dc26cb432d777134df237f89a (patch)
tree96a4710fcc646dedfcaf6869d0da00ca9ea45042
parentd7647034f06abc9009d4a9ce5961ff602230fb9d (diff)
downloadeclipse.platform.team-52ac78bc92594e8dc26cb432d777134df237f89a.tar.gz
eclipse.platform.team-52ac78bc92594e8dc26cb432d777134df237f89a.tar.xz
eclipse.platform.team-52ac78bc92594e8dc26cb432d777134df237f89a.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSMergeSubscriberPage.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberPage.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java8
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gifbin0 -> 174 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gifbin0 -> 170 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gifbin0 -> 164 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gifbin0 -> 101 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gifbin0 -> 101 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gifbin0 -> 97 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gifbin0 -> 138 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gifbin0 -> 133 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gifbin0 -> 162 bytes
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java96
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java65
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java93
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java135
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java292
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java124
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java109
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java86
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ComparisonCriteriaActionGroup.java148
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/DirectionFilterActionGroup.java63
33 files changed, 492 insertions, 955 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
index 711f518ae..a3cee4bad 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
@@ -122,4 +122,8 @@ public class Policy {
return monitor;
return new InfiniteSubProgressMonitor(monitor, ticks);
}
+
+ public static ResourceBundle getBundle() {
+ return bundle;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index c98de0633..010780067 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -41,9 +41,9 @@ public class SyncAction extends WorkspaceAction {
INewSynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage(null);
if(view != null) {
CVSSubscriberPage cvsPage = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeViewPage();
- //view.setWorkingSet(workingSet);
+ cvsPage.setWorkingSet(workingSet);
view.display(cvsPage);
- //view.refreshWithRemote(cvsWorkspaceSubscriber, resources);
+ cvsPage.refreshWithRemote(resources);
} else {
CVSUIPlugin.openError(getShell(), Policy.bind("error"), Policy.bind("Error.unableToShowSyncView"), null); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
index dc72864a4..369761998 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
@@ -71,9 +71,8 @@ public class MergeWizard extends Wizard {
INewSynchronizeView view = manager.showSynchronizeViewInActivePage(null);
if(view != null) {
- //view.setWorkingSet(null); /* show all resources in the merge */
view.display(page);
- //view.refreshWithRemote(s, resources);
+ page.refreshWithRemote(null /* all roots */);
} else {
CVSUIPlugin.openError(getShell(), Policy.bind("error"), Policy.bind("Error.unableToShowSyncView"), null); //$NON-NLS-1$ //$NON-NLS-2$
return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
index f2534ba10..f0d4c430d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
@@ -116,6 +116,7 @@ public class MergeWizardStartPage extends CVSWizardPage {
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
table.refresh();
+ setPageComplete(! table.getSelection().isEmpty());
}
});
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index 6186b8bcf..7656f3be6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -1030,3 +1030,14 @@ FetchMembersOperation.0=Fetching members of {0};
RemoteRevisionQuickDiffProvider.readingFile=Error reading remote file
RemoteRevisionQuickDiffProvider.closingFile=Error closing remote file
RemoteRevisionQuickDiffProvider.fetchingFile=CVS QuickDiff: fetching remote contents for ''{0}''
+
+action.SynchronizeViewCommit.label=Commit All Outgoing Changes
+action.SynchronizeViewCommit.tooltip=Commit All Outgoing Changes
+action.SynchronizeViewCommit.description=Commit All Outgoing Changes
+action.SynchronizeViewCommit.image=checkin_action.gif
+
+action.SynchronizeViewUpdate.label=Update All Incoming Changes
+action.SynchronizeViewUpdate.tooltip=Commit All Incoming Changes
+action.SynchronizeViewUpdate.description=Commit All Incoming Changes
+action.SynchronizeViewUpdate.image=checkout_action.gif
+
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSMergeSubscriberPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSMergeSubscriberPage.java
index b14d1dd5e..dd4e3d4e5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSMergeSubscriberPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSMergeSubscriberPage.java
@@ -10,15 +10,19 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
import org.eclipse.team.ui.sync.SubscriberPage;
+import org.eclipse.team.ui.sync.actions.DirectionFilterActionGroup;
import org.eclipse.team.ui.sync.actions.RemoveSynchronizeViewPageAction;
import org.eclipse.ui.IActionBars;
public class CVSMergeSubscriberPage extends SubscriberPage {
private RemoveSynchronizeViewPageAction removeAction;
+ private DirectionFilterActionGroup modes;
+ private Action updateAdapter;
public CVSMergeSubscriberPage(CVSMergeSubscriber subscriber, String name, ImageDescriptor imageDescriptor) {
super(subscriber, name, imageDescriptor);
@@ -27,6 +31,9 @@ public class CVSMergeSubscriberPage extends SubscriberPage {
private void makeActions() {
removeAction = new RemoveSynchronizeViewPageAction(this);
+ modes = new DirectionFilterActionGroup(this, INCOMING_MODE | CONFLICTING_MODE | BOTH_MODE);
+ updateAdapter = CVSSubscriberPage.createUpdateAdapter(new WorkspaceUpdateAction(), this);
+ setMode(INCOMING_MODE);
}
/* (non-Javadoc)
@@ -34,6 +41,11 @@ public class CVSMergeSubscriberPage extends SubscriberPage {
*/
public void setActionsBars(IActionBars actionBars) {
super.setActionsBars(actionBars);
+ IToolBarManager toolbar = actionBars.getToolBarManager();
+ toolbar.add(new Separator());
+ modes.fillActionBars(actionBars, null);
+ toolbar.add(new Separator());
+ actionBars.getToolBarManager().add(updateAdapter);
actionBars.getToolBarManager().add(removeAction);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberPage.java
index fc167d8c9..ca9c62173 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberPage.java
@@ -10,30 +10,60 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.ui.Utilities;
import org.eclipse.team.ui.sync.SubscriberPage;
+import org.eclipse.team.ui.sync.actions.DirectionFilterActionGroup;
import org.eclipse.ui.IActionBars;
public class CVSSubscriberPage extends SubscriberPage {
-
- private SubscriberCommitAction commit;
+
+ private DirectionFilterActionGroup modes;
private Action commitAdapter;
+ private Action updateAdapter;
private int num;
public CVSSubscriberPage(TeamSubscriber subscriber, String name, ImageDescriptor imageDescriptor, int num) {
super(subscriber, name, imageDescriptor);
this.num = num;
- commit = new SubscriberCommitAction();
- commitAdapter = new Action("", CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) {
+ modes = new DirectionFilterActionGroup(this, ALL_MODES);
+ commitAdapter = createCommitAdapter(new SubscriberCommitAction(), this);
+ updateAdapter = createUpdateAdapter(new WorkspaceUpdateAction(), this);
+ }
+
+ public static Action createCommitAdapter(final SubscriberCommitAction commitAction, final SubscriberPage page) {
+ Action adapter = new Action() {
+ public void run() {
+ IStructuredContentProvider cp = (IStructuredContentProvider)page.getPage().getViewer().getContentProvider();
+ StructuredSelection selection = new StructuredSelection(cp.getElements(page.getInput()));
+ if(! selection.isEmpty()) {
+ commitAction.selectionChanged(this, selection);
+ commitAction.run(this);
+ }
+ }
+ };
+ Utilities.initAction(adapter, "action.SynchronizeViewCommit.", Policy.getBundle());
+ return adapter;
+ }
+
+ public static Action createUpdateAdapter(final WorkspaceUpdateAction updateAction, final SubscriberPage page) {
+ Action adapter = new Action() {
public void run() {
- commit.selectionChanged(this, page.getSite().getPage().getSelection());
- commit.run(this);
+ IStructuredContentProvider cp = (IStructuredContentProvider)page.getPage().getViewer().getContentProvider();
+ StructuredSelection selection = new StructuredSelection(cp.getElements(page.getInput()));
+ if(! selection.isEmpty()) {
+ updateAction.selectionChanged(this, selection);
+ updateAction.run(this);
+ }
}
};
+ Utilities.initAction(adapter, "action.SynchronizeViewUpdate.", Policy.getBundle());
+ return adapter;
}
/* (non-Javadoc)
@@ -41,9 +71,11 @@ public class CVSSubscriberPage extends SubscriberPage {
*/
public void setActionsBars(IActionBars actionBars) {
super.setActionsBars(actionBars);
- if(num >= 3) {
- actionBars.getToolBarManager().add(commitAdapter);
- }
+ IToolBarManager toolbar = actionBars.getToolBarManager();
+ toolbar.add(new Separator());
+ modes.fillActionBars(actionBars, null);
+ toolbar.add(new Separator());
+ actionBars.getToolBarManager().add(updateAdapter);
+ actionBars.getToolBarManager().add(commitAdapter);
}
-
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
index c560d4126..1b83e2367 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
@@ -52,6 +52,7 @@ import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
import org.eclipse.team.ui.IConfigurationWizard;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.sync.INewSynchronizeView;
+import org.eclipse.team.ui.sync.SubscriberPage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
@@ -300,10 +301,11 @@ public class SharingWizard extends Wizard implements IConfigurationWizard {
}
INewSynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage(null);
if(view != null) {
+ SubscriberPage page = CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeViewPage();
IWorkingSet workingSet = CVSUIPlugin.getWorkingSet(new IResource[] {project}, Policy.bind("SyncAction.workingSetName")); //$NON-NLS-1$)
- //view.setWorkingSet(workingSet);
- view.display(CVSUIPlugin.getPlugin().getCvsWorkspaceSynchronizeViewPage());
- //view.setMode(ISynchronizeView.OUTGOING_MODE);
+ page.setWorkingSet(workingSet);
+ view.display(page);
+ page.setMode(SubscriberPage.OUTGOING_MODE);
} else {
CVSUIPlugin.openError(getContainer().getShell(), Policy.bind("error"), Policy.bind("Error.unableToShowSyncView"), null); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif
new file mode 100644
index 000000000..b95e26a1b
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkin_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif
new file mode 100644
index 000000000..706dc020e
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/checkout_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif
new file mode 100644
index 000000000..8411bc227
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/showsync_rn.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif
new file mode 100644
index 000000000..e84103f40
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkin_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif
new file mode 100644
index 000000000..4e9a3eb98
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/checkout_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif
new file mode 100644
index 000000000..3dcccb3c7
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/dlcl16/showsync_rn.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif
new file mode 100644
index 000000000..feb14bf53
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkin_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif
new file mode 100644
index 000000000..4fdde615d
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/checkout_action.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif b/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif
new file mode 100644
index 000000000..4410b22ee
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/elcl16/showsync_rn.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
index 4c2b884a6..a89a0862d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
@@ -30,7 +30,7 @@ import org.eclipse.team.internal.core.NullSubProgressMonitor;
public class Policy {
// The resource bundle to get strings from
protected static ResourceBundle bundle = null;
-
+
/**
* Creates a NLS catalog for the given locale.
*
@@ -72,7 +72,7 @@ public class Policy {
* @param id the id to look up
* @param binding1 the first string to bind to the result
* @param binding2 the second string to bind to the result
- * @param binding3 the third string to bind to the result
+ * @param binding3 the third string to bind to the result
* @return the bound string
*/
public static String bind(String id, String binding1, String binding2,String binding3) {
@@ -86,6 +86,23 @@ public class Policy {
* @param key the id to look up
* @return the string with the given key
*/
+ public static String bind(String key, ResourceBundle b) {
+ try {
+ return b.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ } catch (NullPointerException e) {
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * Gets a string from the resource bundle. We don't want to crash because of a missing String.
+ * Returns the key if not found.
+ *
+ * @param key the id to look up
+ * @return the string with the given key
+ */
public static String bind(String key) {
try {
return bundle.getString(key);
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 969d5f081..6ee1ccf75 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
@@ -1,35 +1,27 @@
-/*
- * Created on Jun 26, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
+/*******************************************************************************
+ * 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;
import java.lang.reflect.InvocationTargetException;
-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.core.runtime.*;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
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;
+import org.eclipse.team.ui.Utilities;
-/**
- * @author Jean-Michel Lemieux
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
public class Utils {
/**
@@ -181,67 +173,7 @@ public class Utils {
}
}
- public static void registerAction(IKeyBindingService kbs, IAction a, String id) {
- if (kbs != null) {
- a.setActionDefinitionId(id);
- kbs.registerAction(a);
- }
- }
-
- /**
- * Initialize the given Action from a ResourceBundle.
- */
public static void initAction(IAction a, String prefix) {
-
- String labelKey= "label"; //$NON-NLS-1$
- String tooltipKey= "tooltip"; //$NON-NLS-1$
- String imageKey= "image"; //$NON-NLS-1$
- String descriptionKey= "description"; //$NON-NLS-1$
-
- if (prefix != null && prefix.length() > 0) {
- labelKey= prefix + labelKey;
- tooltipKey= prefix + tooltipKey;
- imageKey= prefix + imageKey;
- descriptionKey= prefix + descriptionKey;
- }
-
- String s = Policy.bind(labelKey);
- if(s != null)
- a.setText(s);
- s = Policy.bind(tooltipKey);
- if(s != null)
- a.setToolTipText(s);
- s = Policy.bind(descriptionKey);
- if(s != null)
- a.setDescription(s);
-
- String relPath= Policy.bind(imageKey);
- if (relPath != null && ! relPath.equals(imageKey) && relPath.trim().length() > 0) {
-
- String cPath;
- String dPath;
- String ePath;
-
- if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$
- String path= relPath.substring(1);
- cPath= 'c' + path;
- dPath= 'd' + path;
- ePath= 'e' + path;
- } else {
- cPath= "clcl16/" + relPath; //$NON-NLS-1$
- dPath= "dlcl16/" + relPath; //$NON-NLS-1$
- ePath= "elcl16/" + relPath; //$NON-NLS-1$
- }
-
- ImageDescriptor id= TeamUIPlugin.getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87)
- if (id != null)
- a.setDisabledImageDescriptor(id);
- id= TeamUIPlugin.getImageDescriptor(cPath);
- if (id != null)
- a.setHoverImageDescriptor(id);
- id= TeamUIPlugin.getImageDescriptor(ePath);
- if (id != null)
- a.setImageDescriptor(id);
- }
+ Utilities.initAction(a, prefix, Policy.bundle);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 3c98c4b4b..acfd6ba69 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -369,10 +369,15 @@ action.directionFilterBoth.description=Incoming/Outgoing mode (shows outgoing ch
action.directionFilterBoth.image=catchuprelease_rls.gif
action.refreshSubscriber.label=Registered Synchronize Partners
-action.refreshSubscriber.tooltip=Refresh the current synchronization target with Remote
-action.refreshSubscriber.description=Refresh the current synchronization target with Remote
+action.refreshSubscriber.tooltip=Registered Synchronize Partners
+action.refreshSubscriber.description=Registered Synchronize Partners
action.refreshSubscriber.image=contents.gif
+action.comparisonCriteria.label=Synchronize Comparison Criteria
+action.comparisonCriteria.tooltip=Synchronize Comparison Criteria
+action.comparisonCriteria.description=Synchronize Comparison Criteria
+action.comparisonCriteria.image=showsync_rn.gif
+
action.navigateNext.label=Go to Next Difference
action.navigateNext.tooltip=Go to Next Difference
action.navigateNext.description=Go to Next Difference
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java
deleted file mode 100644
index 7505ecfd1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/ExpandAllAction.java
+++ /dev/null
@@ -1,65 +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.internal.ui.sync.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.actions.ActionContext;
-
-
-class ExpandAllAction extends Action {
- private final SyncViewerActions actions;
- public ExpandAllAction(SyncViewerActions actions) {
- this.actions = actions;
- Utils.initAction(this, "action.expandAll."); //$NON-NLS-1$
- }
- public void run() {
- expandSelection();
- }
- public void update() {
- setEnabled(getTreeViewer() != null && hasSelection());
- }
- protected void expandSelection() {
- AbstractTreeViewer treeViewer = getTreeViewer();
- if (treeViewer != null) {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- treeViewer.expandToLevel(next, AbstractTreeViewer.ALL_LEVELS);
- }
- }
- }
- }
- private AbstractTreeViewer getTreeViewer() {
- Viewer viewer = actions.getSyncView().getViewer();
- if (viewer instanceof AbstractTreeViewer) {
- return (AbstractTreeViewer)viewer;
- }
- return null;
- }
- private ISelection getSelection() {
- ActionContext context = actions.getContext();
- if (context == null) return null;
- return actions.getContext().getSelection();
- }
- private boolean hasSelection() {
- ISelection selection = getSelection();
- return (selection != null && !selection.isEmpty());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java
deleted file mode 100644
index 558a21a29..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java
+++ /dev/null
@@ -1,93 +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.internal.ui.sync.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-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.team.core.TeamException;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.jobs.JobStatusHandler;
-import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.team.ui.sync.actions.SubscriberAction;
-import org.eclipse.ui.actions.ActionContext;
-
-public class RefreshAction extends Action {
- private final SyncViewerActions actions;
- private boolean refreshAll;
-
- public RefreshAction(SyncViewerActions actions, boolean refreshAll) {
- this.refreshAll = refreshAll;
- this.actions = actions;
- Utils.initAction(this, "action.refreshWithRemote."); //$NON-NLS-1$
- }
-
- public void run() {
- final SynchronizeView view = actions.getSyncView();
- ActionContext context = actions.getContext();
- if(context != null) {
- getResources(context.getSelection());
- SubscriberInput input = (SubscriberInput)context.getInput();
- IResource[] resources = getResources(context.getSelection());
- if (refreshAll || resources.length == 0) {
- // If no resources are selected, refresh all the subscriber roots
- resources = input.workingSetRoots();
- }
- run(view, resources, input.getSubscriber());
- }
- }
-
- private IResource[] getResources(ISelection selection) {
- if(selection == null) {
- return new IResource[0];
- }
- return (IResource[])TeamAction.getSelectedAdaptables(selection, IResource.class);
- }
-
- public static void run(SynchronizeView viewer, IResource[] resources, TeamSubscriber subscriber) {
- // Cancel the scheduled background refresh or any other refresh that is happening.
- // The scheduled background refresh will restart automatically.
- Platform.getJobManager().cancel(RefreshSubscriberJob.getFamily());
- if(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_BACKGROUND_SYNC)) {
- RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", new Integer(resources.length).toString(), subscriber.getName()), resources, subscriber); //$NON-NLS-1$
- JobStatusHandler.schedule(job, SubscriberAction.SUBSCRIBER_JOB_TYPE);
- } else {
- runBlocking(viewer, subscriber, resources);
- }
- }
-
- private static void runBlocking(SynchronizeView viewer, final TeamSubscriber s, final IResource[] resources) {
- viewer.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/sync/actions/SelectAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java
deleted file mode 100644
index 6178f75d2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SelectAllAction.java
+++ /dev/null
@@ -1,35 +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.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IPropertyListener;
-
-class SelectAllAction extends Action implements IPropertyListener {
- private final SynchronizeView viewer;
-
- public SelectAllAction(SynchronizeView viewer) {
- this.viewer = viewer;
- viewer.addPropertyListener(this);
- }
-
- public void run() {
- viewer.selectAll();
- }
-
- public void propertyChanged(Object source, int propId) {
- if(propId == SynchronizeView.PROP_VIEWTYPE) {
- setEnabled(viewer.getCurrentViewType() == SynchronizeView.TABLE_VIEW);
- viewer.getViewSite().getActionBars().updateActionBars();
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java
deleted file mode 100644
index 37686d89b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncAllAction.java
+++ /dev/null
@@ -1,135 +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.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.sync.ISynchronizeView;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-
-public class SyncAllAction implements IWorkbenchWindowPulldownDelegate2 {
-
- private IWorkbenchWindow window;
- private Menu createdMenu;
-
- class SubscriberAction extends Action {
- TeamSubscriber subscriber;
- SubscriberAction(TeamSubscriber s) {
- this.subscriber = s;
- setText(s.getName());
- }
- public void run() {
- ISynchronizeView view = TeamUI.showSyncViewInActivePage(window.getActivePage());
- if(view != null) {
- view.refreshWithRemote(subscriber);
- }
- }
- }
-
- public void run(IAction action) {
- ISynchronizeView view = TeamUI.showSyncViewInActivePage(window.getActivePage());
- if(view != null) {
- view.refreshWithRemote();
- }
- }
-
- public void dispose() {
- if(getCreatedMenu() != null) {
- getCreatedMenu().dispose();
- }
- }
-
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- private void createAction(Menu parent, IAction action, int count) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- if (count != -1) {
- label.append('&');
- label.append(count);
- label.append(' ');
- }
- label.append(action.getText());
- action.setText(label.toString());
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- public Menu getMenu(Menu parent) {
- dispose();
- setCreatedMenu(new Menu(parent));
- fillMenu();
- initMenu();
- return getCreatedMenu();
- }
-
- private Menu getCreatedMenu() {
- return createdMenu;
- }
-
- private void setCreatedMenu(Menu menu) {
- createdMenu = menu;
- }
-
- private void fillMenu() {
- TeamSubscriber[] subscribers = TeamSubscriber.getSubscriberManager().getSubscribers();
- for (int i = 0; i < subscribers.length; i++) {
- TeamSubscriber subscriber = subscribers[i];
- createAction(getCreatedMenu(), new SubscriberAction(subscriber), i + 1);
- }
- if(subscribers.length > 0 ) {
- new Separator().fill(getCreatedMenu(), -1);
- }
- createAction(getCreatedMenu(), new SyncViewerShowPreferencesAction(window.getShell()), -1);
- }
-
- /**
- * Creates the menu for the action
- */
- private void initMenu() {
- // Add listener to repopulate the menu each time
- // it is shown to reflect changes in selection or active perspective
- getCreatedMenu().addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu m = (Menu)e.widget;
- MenuItem[] items = m.getItems();
- for (int i=0; i < items.length; i++) {
- items[i].dispose();
- }
- fillMenu();
- }
- });
- }
-
- public Menu getMenu(Control parent) {
- dispose();
- setCreatedMenu(new Menu(parent));
- fillMenu();
- initMenu();
- return getCreatedMenu();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-} \ No newline at end of file
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
deleted file mode 100644
index bf542b34b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
+++ /dev/null
@@ -1,292 +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.internal.ui.sync.actions;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.WorkingSetFilterActionGroup;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * This class managers the actions associated with the SynchronizeView class.
- */
-public class SyncViewerActions extends SyncViewerActionGroup {
-
- // action groups for view filtering
- private SyncViewerDirectionFilters directionsFilters;
- private SyncViewerChangeFilters changeFilters;
- private SyncViewerComparisonCriteria comparisonCriteria;
- private SyncViewerSubscriberListActions subscriberInputs;
-
- private WorkingSetFilterActionGroup workingSetGroup;
- private OpenWithActionGroup openWithActionGroup;
-
- private SyncViewerToolbarDropDownAction chooseSubscriberAction;
- private SyncViewerToolbarDropDownAction chooseChangeFilterAction;
-
- private RefactorActionGroup refactoringActions;
-
- // other view actions
- private Action collapseAll;
- private Action refreshSelectionAction;
- private Action refreshViewContents;
-
- private Action toggleLayoutFlatAction;
- private Action toggleLayoutHierarchicalAction;
- private ExpandAllAction expandAll;
- private SelectAllAction selectAllAction;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
- */
- public void updateActionBars() {
- super.updateActionBars();
- changeFilters.updateActionBars();
- directionsFilters.updateActionBars();
- comparisonCriteria.updateActionBars();
- subscriberInputs.updateActionBars();
- refactoringActions.updateActionBars();
- expandAll.update();
- }
-
- public SyncViewerActions(SynchronizeView viewer) {
- super(viewer);
- createActions();
- }
-
- private void createActions() {
- // initialize action groups
- SynchronizeView syncView = getSyncView();
- directionsFilters = new SyncViewerDirectionFilters(syncView, this);
- changeFilters = new SyncViewerChangeFilters(syncView, this);
-
- // initialize the dropdown for choosing a subscriber
- subscriberInputs = new SyncViewerSubscriberListActions(syncView);
- comparisonCriteria = new SyncViewerComparisonCriteria(syncView);
- chooseSubscriberAction = new ChooseSubscriberAction(this, new SyncViewerActionGroup[] {subscriberInputs, comparisonCriteria});
-
- // initialize the dropdown for choosing a change type filter
- chooseChangeFilterAction = new ChooseChangeFilterAction(this, changeFilters);
-
- // initialize other actions
- refreshSelectionAction = new RefreshAction(this, false);
- refreshSelectionAction.setEnabled(false);
-
- selectAllAction = new SelectAllAction(getSyncView());
- getSyncView().getViewSite().getActionBars().setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, selectAllAction);
-
- expandAll = new ExpandAllAction(this);
-
-
- toggleLayoutFlatAction = new ToggleViewLayoutAction(getSyncView(), SynchronizeView.TABLE_VIEW);
- toggleLayoutHierarchicalAction = new ToggleViewLayoutAction(getSyncView(), SynchronizeView.TREE_VIEW);
-
- collapseAll = new Action() {
- public void run() {
- getSyncView().collapseAll();
- }
- };
- Utils.initAction(collapseAll, "action.collapseAll."); //$NON-NLS-1$
-
- refreshViewContents = new Action() {
- public void run() {
- SubscriberInput input = getSyncView().getInput();
- if(input != null) {
- try {
- input.reset();
- } catch (TeamException e) {
- Utils.handle(e);
- }
- }
- }
- };
- Utils.initAction(refreshViewContents, "action.refreshViewContents."); //$NON-NLS-1$
-
- IPropertyChangeListener workingSetUpdater = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
-
- if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET.equals(property)) {
- Object newValue = event.getNewValue();
-
- if (newValue instanceof IWorkingSet) {
- getSyncView().workingSetChanged((IWorkingSet) newValue);
- }
- else
- if (newValue == null) {
- getSyncView().workingSetChanged(null);
- }
- }
- }
- };
- workingSetGroup = new WorkingSetFilterActionGroup(syncView.getSite().getShell(), workingSetUpdater);
- openWithActionGroup = new OpenWithActionGroup(getSyncView());
- refactoringActions = new RefactorActionGroup(getSyncView());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- super.fillActionBars(actionBars);
-
- // Setup toolbars
- IToolBarManager manager = actionBars.getToolBarManager();
- manager.add(chooseSubscriberAction);
- manager.add(new Separator());
- directionsFilters.fillActionBars(actionBars);
- manager.add(new Separator());
- manager.add(collapseAll);
-
- // Setup drop down menu
- IMenuManager dropDownMenu = actionBars.getMenuManager();
- workingSetGroup.fillActionBars(actionBars);
- dropDownMenu.add(refreshViewContents);
- dropDownMenu.add(new Separator());
-
- MenuManager layoutMenu = new MenuManager(Policy.bind("action.layout.label")); //$NON-NLS-1$
- layoutMenu.add(toggleLayoutFlatAction);
- layoutMenu.add(toggleLayoutHierarchicalAction);
- dropDownMenu.add(layoutMenu);
- dropDownMenu.add(new Separator());
- dropDownMenu.add(new SyncViewerShowPreferencesAction(getSyncView().getSite().getShell()));
- refactoringActions.fillActionBars(actionBars);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager manager) {
- super.fillContextMenu(manager);
- openWithActionGroup.fillContextMenu(manager);
- manager.add(new Separator());
- manager.add(expandAll);
- manager.add(new Separator());
- refactoringActions.fillContextMenu(manager);
- manager.add(new Separator());
- manager.add(refreshSelectionAction);
- manager.add(new Separator("SubscriberActionsGroup1")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup2")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup3")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup4")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup5")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup6")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup7")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup8")); //$NON-NLS-1$
- manager.add(new Separator("SubscriberActionsGroup9")); //$NON-NLS-1$
- // Other plug-ins can contribute there actions here
- manager.add(new Separator("Additions")); //$NON-NLS-1$
- }
-
- public void refreshFilters() {
- final SubscriberInput input = getSubscriberContext();
- if(input != null) {
- getSyncView().updateInputFilter(directionsFilters.getDirectionFilter(), changeFilters.getChangeFilters());
- }
- }
-
- public void open() {
- openWithActionGroup.openInCompareEditor();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.actions.SyncViewerActionGroup#restore(org.eclipse.ui.IMemento)
- */
- public void restore(IMemento memento) {
- if(memento == null) return;
- super.restore(memento);
- changeFilters.restore(memento);
- directionsFilters.restore(memento);
- comparisonCriteria.restore(memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.actions.SyncViewerActionGroup#save(org.eclipse.ui.IMemento)
- */
- public void save(IMemento memento) {
- if(memento == null) return;
- super.save(memento);
- changeFilters.save(memento);
- directionsFilters.save(memento);
- comparisonCriteria.save(memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#initializeActions()
- */
- protected void initializeActions() {
- SubscriberInput input = getSubscriberContext();
- refreshSelectionAction.setEnabled(input != null);
- chooseSubscriberAction.setEnabled(input != null);
- chooseChangeFilterAction.setEnabled(input != null);
- collapseAll.setEnabled(input != null);
- toggleLayoutFlatAction.setEnabled(input != null);
- toggleLayoutHierarchicalAction.setEnabled(input != null);
- // refresh the selected filter
- refreshFilters();
- }
-
- /* (non-Javadoc)
- * @see ActionGroup#setContext(org.eclipse.ui.actions.ActionContext)
- */
- public void setContext(ActionContext context) {
- changeFilters.setContext(context);
- directionsFilters.setContext(context);
- comparisonCriteria.setContext(context);
- subscriberInputs.setContext(context);
- openWithActionGroup.setContext(context);
-
- // causes initializeActions to be called. Must be called after
- // setting the context for contained groups.
- super.setContext(context);
- }
-
- /* (non-Javadoc)
- * @see ActionGroup#setContext(org.eclipse.ui.actions.ActionContext)
- */
- public void addContext(ActionContext context) {
- subscriberInputs.addContext(context);
- }
-
- public void removeContext(ActionContext context) {
- subscriberInputs.removeContext(context);
- }
-
- /**
- * This method sets the working set through the workingSetGroup
- * which will result in a call to changeWorkingSet().
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- if (workingSet != null) {
- PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(workingSet);
- }
- workingSetGroup.setWorkingSet(workingSet);
- }
-
- /**
- * Sets the current mode shown in the sync view.
- * @param mode the mode id
- */
- public void setMode(int mode) {
- directionsFilters.setCurrentMode(mode);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
deleted file mode 100644
index 20d63b96a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerComparisonCriteria.java
+++ /dev/null
@@ -1,124 +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.internal.ui.sync.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ComparisonCriteria;
-import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-
-/**
- * This action group allows the user to choose one or more comparison critera
- * to be applied to a comparison
- */
-public class SyncViewerComparisonCriteria extends SyncViewerActionGroup {
-
- private static final String MEMENTO_KEY = "SelectedComparisonCriteria"; //$NON-NLS-1$
-
- private ComparisonCriteria[] criteria;
- private ComparisonCriteriaAction[] actions;
-
- /**
- * Action for filtering by change type.
- */
- class ComparisonCriteriaAction extends Action {
- private ComparisonCriteria criteria;
- public ComparisonCriteriaAction(ComparisonCriteria criteria) {
- super(criteria.getName(), Action.AS_RADIO_BUTTON);
- this.criteria = criteria;
- }
- public void run() {
- SyncViewerComparisonCriteria.this.activate(this);
- }
- public ComparisonCriteria getComparisonCriteria() {
- return criteria;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.actions.SyncViewerActionGroup#fillMenu(org.eclipse.team.internal.ui.sync.actions.SyncViewerToolbarDropDownAction)
- */
- public void fillMenu(SyncViewerToolbarDropDownAction dropDown) {
- super.fillMenu(dropDown);
- if(getSubscriberContext() != null) {
- for (int i = 0; i < actions.length; i++) {
- ComparisonCriteriaAction action = actions[i];
- dropDown.add(action);
- }
- }
- }
-
- public SyncViewerComparisonCriteria(SynchronizeView syncView) {
- super(syncView);
- setContext(null);
- }
-
- /**
- * @param action
- */
- public void activate(final ComparisonCriteriaAction activatedAction) {
- for (int i = 0; i < actions.length; i++) {
- ComparisonCriteriaAction action = actions[i];
- action.setChecked(activatedAction == action);
- }
- final SynchronizeView view = getSyncView();
- view.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // when the comparison criteria changes, recalculate the entire sync set based on
- // the new input.
- SubscriberInput input = getSubscriberContext();
- input.getSubscriber().setCurrentComparisonCriteria(activatedAction.getComparisonCriteria().getId());
- input.reset();
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- }
-
- public void initializeActions() {
- SubscriberInput input = getSubscriberContext();
- if(input != null) {
- this.criteria = input.getSubscriber().getComparisonCriterias();
- this.actions = new ComparisonCriteriaAction[criteria.length];
- for (int i = 0; i < criteria.length; i++) {
- ComparisonCriteria c = criteria[i];
- actions[i] = new ComparisonCriteriaAction(c);
- actions[i].setChecked(c == getSyncView().getInput().getSubscriber().getCurrentComparisonCriteria());
- }
- } else {
- // there aren't any comparison criterias to show!
- this.actions = null;
- this.criteria = null;
-
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager menu) {
- super.fillContextMenu(menu);
- if(getSubscriberContext() != null) {
- for (int i = 0; i < actions.length; i++) {
- ComparisonCriteriaAction action = actions[i];
- menu.add(action);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java
index 5e88864a9..f7d80c7a1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java
@@ -23,7 +23,6 @@ public class ShowSynchronizeViewPage extends Action {
*/
public void run() {
if (!fPage.equals(fView.getActivePage())) {
- // only change if required (and un-pin the console if pinned)
fView.display(fPage);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java
index 412a148b6..7c8863cf0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java
@@ -1,8 +1,9 @@
package org.eclipse.team.internal.ui.sync.pages;
+import java.util.Iterator;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.*;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -66,17 +67,19 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
private Action toggleLayoutTable;
private RefactorActionGroup refactorActions;
private SyncViewerShowPreferencesAction showPreferences;
- private DirectionFilterActionGroup modesGroup;
private WorkingSetFilterActionGroup workingSetGroup;
private RefreshAction refreshAction;
+ private ComparisonCriteriaActionGroup comparisonCriteria;
+ private Action collapseAll;
+ private Action expandAll;
/**
* Constructs a new SynchronizeView.
*/
- public SubscriberSynchronizeViewPage(SubscriberPage page, INewSynchronizeView view) {
+ public SubscriberSynchronizeViewPage(SubscriberPage page, INewSynchronizeView view, SubscriberInput input) {
this.page = page;
this.view = view;
- this.input = new SubscriberInput(page.getSubscriber());
+ this.input = input;
layout = getStore().getInt(IPreferenceIds.SYNCVIEW_VIEW_TYPE);
if (layout != SubscriberPage.TREE_LAYOUT) {
layout = SubscriberPage.TABLE_LAYOUT;
@@ -97,15 +100,13 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
// Create the busy cursor with no control to start with (createViewer will set it)
busyCursor = new JobBusyCursor(null /* control */, SubscriberAction.SUBSCRIBER_JOB_TYPE);
createViewer(composite);
- updateStatusPanel();
- updateTooltip();
-
+
// create actions
openWithActions = new OpenWithActionGroup(view);
refactorActions = new RefactorActionGroup(view);
gotoNext = new NavigateAction(view, this, INavigableControl.NEXT);
gotoPrevious = new NavigateAction(view, this, INavigableControl.PREVIOUS);
- modesGroup = new DirectionFilterActionGroup(view, page);
+ comparisonCriteria = new ComparisonCriteriaActionGroup(input);
toggleLayoutTable = new ToggleViewLayoutAction(page, SubscriberPage.TABLE_LAYOUT);
toggleLayoutTree = new ToggleViewLayoutAction(page, SubscriberPage.TREE_LAYOUT);
@@ -113,36 +114,42 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
showPreferences = new SyncViewerShowPreferencesAction(view.getSite().getShell());
workingSetGroup = new WorkingSetFilterActionGroup(getSite().getShell(), this, view, page);
- refreshAction = new RefreshAction(getSite().getPage(), input, true /* refresh all */);
+ refreshAction = new RefreshAction(getSite().getPage(), input, true /* refresh all */);
+
+ collapseAll = new Action() {
+ public void run() {
+ collapseAll();
+ }
+ };
+ Utils.initAction(collapseAll, "action.collapseAll."); //$NON-NLS-1$
+
+ expandAll = new Action() {
+ public void run() {
+ Viewer viewer = getViewer();
+ ISelection selection = viewer.getSelection();
+ if(viewer instanceof AbstractTreeViewer && ! selection.isEmpty()) {
+ Iterator elements = ((IStructuredSelection)selection).iterator();
+ while (elements.hasNext()) {
+ Object next = elements.next();
+ ((AbstractTreeViewer) viewer).expandToLevel(next, AbstractTreeViewer.ALL_LEVELS);
+ }
+ }
+ }
+ };
+ Utils.initAction(expandAll, "action.expandAll."); //$NON-NLS-1$
- initializeSubscriberInput(input);
+ updateStatusPanel();
+
+ input.registerListeners(this);
+ page.addPropertyChangeListener(this);
+ updateMode(page.getMode());
}
/* (non-Javadoc)
* @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
*/
public void init(IPageSite site) throws PartInitException {
- this.site = site;
- page.addPropertyChangeListener(this);
- RefreshSubscriberInputJob refreshJob = TeamUIPlugin.getPlugin().getRefreshJob();
- if(getStore().getBoolean(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC) && refreshJob.getState() == Job.NONE) {
- refreshJob.setReschedule(true);
- // start once the UI has started and stabilized
- refreshJob.schedule(20000 /* 20 seconds */);
- }
- }
-
- /*
- * This method is synchronized to ensure that all internal state is not corrupted
- */
- public void initializeSubscriberInput(final SubscriberInput input) {
- // listen to sync set changes in order to update state relating to the
- // size of the sync sets and update the title
- input.registerListeners(this);
- RefreshSubscriberInputJob refreshJob = TeamUIPlugin.getPlugin().getRefreshJob();
- refreshJob.addSubscriberInput(input);
- updateStatusPanel();
- page.setMode(TeamUIPlugin.getPlugin().getPreferenceStore().getInt(IPreferenceIds.SYNCVIEW_SELECTED_MODE));
+ this.site = site;
}
private void hookContextMenu() {
@@ -163,6 +170,8 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
protected void setContextMenu(IMenuManager manager) {
openWithActions.fillContextMenu(manager);
refactorActions.fillContextMenu(manager);
+ manager.add(new Separator());
+ manager.add(expandAll);
manager.add(new Separator("SubscriberActionsGroup1")); //$NON-NLS-1$
manager.add(new Separator("SubscriberActionsGroup2")); //$NON-NLS-1$
manager.add(new Separator("SubscriberActionsGroup3")); //$NON-NLS-1$
@@ -314,7 +323,7 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
}
protected void handleOpen(OpenEvent event) {
- // actions.open();
+ openWithActions.openInCompareEditor();
}
/**
* Handles a double-click event from the viewer.
@@ -325,16 +334,14 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
*/
protected void handleDoubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object element = selection.getFirstElement();
-
+ Object element = selection.getFirstElement();
// Double-clicking should expand/collapse containers
if (viewer instanceof TreeViewer) {
TreeViewer tree = (TreeViewer)viewer;
if (tree.isExpandable(element)) {
tree.setExpandedState(element, !tree.getExpandedState(element));
}
- }
-
+ }
}
protected void updateStatusPanel() {
@@ -347,22 +354,7 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
}
});
}
-
- protected void updateTooltip() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- // SubscriberInput input = getInput();
- // if(input != null) {
- // if(input.getWorkingSet() != null) {
- // String tooltip = Policy.bind("LiveSyncView.titleTooltip", input.getWorkingSet().getName()); //$NON-NLS-1$
- // setTitleToolTip(tooltip);
- // } else {
- // setTitleToolTip(""); //$NON-NLS-1$
- // }
- // }
- }
- });
- }
+
/* (non-Javadoc)
* @see org.eclipse.ui.part.IPage#setFocus()
*/
@@ -483,7 +475,6 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
public void workingSetChanged(IWorkingSet set) {
input.setWorkingSet(set);
- updateTooltip();
}
/* (non-Javadoc)
@@ -498,10 +489,12 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
*/
public void setActionBars(final IActionBars actionBars) {
IToolBarManager manager = actionBars.getToolBarManager();
+ manager.add(comparisonCriteria);
manager.add(refreshAction);
+ manager.add(new Separator(SubscriberPage.MB_MODESGROUP));
manager.add(gotoNext);
manager.add(gotoPrevious);
- modesGroup.fillActionBars(actionBars);
+ manager.add(collapseAll);
// drop down menu
IMenuManager menu = actionBars.getMenuManager();
@@ -550,7 +543,6 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
private void updateWorkingSet(IWorkingSet set) {
input.setWorkingSet(set);
- updateTooltip();
}
private void updateMode(int mode) {
@@ -577,4 +569,11 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
Utils.handleError(getSite().getShell(), e, Policy.bind("SynchronizeView.16"), e.getMessage()); //$NON-NLS-1$
}
}
+
+ /**
+ * @return Returns the refreshAction.
+ */
+ public RefreshAction getRefreshAction() {
+ return refreshAction;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java
index 09ff9e7db..f2867353d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java
@@ -10,20 +10,14 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.sync.pages;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.sync.INewSynchronizeView;
-import org.eclipse.team.ui.sync.ISynchronizePageListener;
-import org.eclipse.team.ui.sync.ISynchronizeViewPage;
+import org.eclipse.team.ui.Utilities;
+import org.eclipse.team.ui.sync.*;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.texteditor.IUpdate;
@@ -44,7 +38,7 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
fView= view;
Utils.initAction(this, "action.refreshSubscriber."); //$NON-NLS-1$
IKeyBindingService kbs = view.getSite().getKeyBindingService();
- Utils.registerAction(kbs, this, "org.eclipse.team.ui.syncview.syncAll"); //$NON-NLS-1$
+ Utilities.registerAction(kbs, this, "org.eclipse.team.ui.syncview.syncAll"); //$NON-NLS-1$
setMenuCreator(this);
TeamUI.getSynchronizeManager().addSynchronizePageListener(this);
update();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java
new file mode 100644
index 000000000..31a8d5d92
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/Utilities.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.ui.IKeyBindingService;
+
+public class Utilities {
+
+ public static void registerAction(IKeyBindingService kbs, IAction a, String id) {
+ if (kbs != null) {
+ a.setActionDefinitionId(id);
+ kbs.registerAction(a);
+ }
+ }
+
+ /**
+ * Initialize the given Action from a ResourceBundle.
+ */
+ public static void initAction(IAction a, String prefix, ResourceBundle bundle) {
+
+ String labelKey= "label"; //$NON-NLS-1$
+ String tooltipKey= "tooltip"; //$NON-NLS-1$
+ String imageKey= "image"; //$NON-NLS-1$
+ String descriptionKey= "description"; //$NON-NLS-1$
+
+ if (prefix != null && prefix.length() > 0) {
+ labelKey= prefix + labelKey;
+ tooltipKey= prefix + tooltipKey;
+ imageKey= prefix + imageKey;
+ descriptionKey= prefix + descriptionKey;
+ }
+
+ String s = Policy.bind(labelKey, bundle);
+ if(s != null)
+ a.setText(s);
+ s = Policy.bind(tooltipKey, bundle);
+ if(s != null)
+ a.setToolTipText(s);
+ s = Policy.bind(descriptionKey, bundle);
+ if(s != null)
+ a.setDescription(s);
+
+ String relPath= Policy.bind(imageKey, bundle);
+ if (relPath != null && ! relPath.equals(imageKey) && relPath.trim().length() > 0) {
+
+ String cPath;
+ String dPath;
+ String ePath;
+
+ if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$
+ String path= relPath.substring(1);
+ cPath= 'c' + path;
+ dPath= 'd' + path;
+ ePath= 'e' + path;
+ } else {
+ cPath= "clcl16/" + relPath; //$NON-NLS-1$
+ dPath= "dlcl16/" + relPath; //$NON-NLS-1$
+ ePath= "elcl16/" + relPath; //$NON-NLS-1$
+ }
+
+ ImageDescriptor id= TeamImages.getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87)
+ if (id != null)
+ a.setDisabledImageDescriptor(id);
+ id= TeamUIPlugin.getImageDescriptor(cPath);
+ if (id != null)
+ a.setHoverImageDescriptor(id);
+ id= TeamUIPlugin.getImageDescriptor(ePath);
+ if (id != null)
+ a.setImageDescriptor(id);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java
index 1b91cf9be..867035d54 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java
@@ -1,20 +1,24 @@
package org.eclipse.team.ui.sync;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.jobs.RefreshSubscriberInputJob;
import org.eclipse.team.internal.ui.sync.pages.SubscriberSynchronizeViewPage;
import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
+import org.eclipse.team.ui.sync.actions.RefreshAction;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.part.IPageBookViewPage;
public class SubscriberPage extends AbstractSynchronizeViewPage {
- protected TeamSubscriber subscriber;
- protected SubscriberSynchronizeViewPage page;
- protected int currentMode;
+ private SubscriberInput input;
+ private SubscriberSynchronizeViewPage page;
+ private int currentMode;
/**
* Property constant indicating the mode of a page has changed.
@@ -29,10 +33,11 @@ public class SubscriberPage extends AbstractSynchronizeViewPage {
/**
* Modes are direction filters for the view
*/
- public final static int INCOMING_MODE = 1;
- public final static int OUTGOING_MODE = 2;
- public final static int BOTH_MODE = 3;
- public final static int CONFLICTING_MODE = 4;
+ public final static int INCOMING_MODE = 0x1;
+ public final static int OUTGOING_MODE = 0x2;
+ public final static int BOTH_MODE = 0x4;
+ public final static int CONFLICTING_MODE = 0x8;
+ public final static int ALL_MODES = INCOMING_MODE | OUTGOING_MODE | CONFLICTING_MODE | BOTH_MODE;
/**
* Property constant indicating the mode of a page has changed.
@@ -51,16 +56,23 @@ public class SubscriberPage extends AbstractSynchronizeViewPage {
*/
public static final int TABLE_LAYOUT = 1;
+ public static final String MB_MODESGROUP = TeamUIPlugin.ID + ".modes";
+
public SubscriberPage(TeamSubscriber subscriber, String name, ImageDescriptor imageDescriptor) {
super(name, imageDescriptor);
- this.subscriber = subscriber;
+ this.input = new SubscriberInput(subscriber);
+ this.currentMode = BOTH_MODE;
}
/* (non-Javadoc)
* @see org.eclipse.team.ui.sync.ISynchronizeViewPage#createPage(org.eclipse.team.ui.sync.ISynchronizeView)
*/
public IPageBookViewPage createPage(INewSynchronizeView view) {
- this.page = new SubscriberSynchronizeViewPage(this, view);
+ this.page = new SubscriberSynchronizeViewPage(this, view, input);
+ return page;
+ }
+
+ public SubscriberSynchronizeViewPage getPage() {
return page;
}
@@ -91,8 +103,16 @@ public class SubscriberPage extends AbstractSynchronizeViewPage {
firePropertyChange(this, P_SYNCVIEWPAGE_WORKINGSET, null, set);
}
- public TeamSubscriber getSubscriber() {
- return subscriber;
+ public IWorkingSet getWorkingSet() {
+ return getInput().getWorkingSet();
+ }
+
+ public void refreshWithRemote(IResource[] resources) {
+ if(resources == null || resources.length == 0) {
+ //page.getRefreshAction().run();
+ } else {
+ RefreshAction.run(resources, input.getSubscriber());
+ }
}
public void setActionsBars(IActionBars actionBars) {
@@ -103,6 +123,10 @@ public class SubscriberPage extends AbstractSynchronizeViewPage {
*/
protected void dispose() {
super.dispose();
+ RefreshSubscriberInputJob refreshJob = TeamUIPlugin.getPlugin().getRefreshJob();
+ refreshJob.removeSubscriberInput(input);
+
+ input.dispose();
}
/* (non-Javadoc)
@@ -110,5 +134,12 @@ public class SubscriberPage extends AbstractSynchronizeViewPage {
*/
protected void init() {
super.init();
+ RefreshSubscriberInputJob refreshJob = TeamUIPlugin.getPlugin().getRefreshJob();
+ refreshJob.addSubscriberInput(input);
+
+ if(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC) && refreshJob.getState() == Job.NONE) {
+ refreshJob.setReschedule(true);
+ refreshJob.schedule(20000 /* 20 seconds */);
+ }
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ComparisonCriteriaActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ComparisonCriteriaActionGroup.java
new file mode 100644
index 000000000..51b652127
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ComparisonCriteriaActionGroup.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * 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.sync.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.ComparisonCriteria;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.sync.ISynchronizeViewPage;
+
+/**
+ * This action group allows the user to choose one or more comparison critera
+ * to be applied to a comparison
+ */
+public class ComparisonCriteriaActionGroup extends Action implements IMenuCreator {
+
+ private ComparisonCriteria[] criteria;
+ private ComparisonCriteriaAction[] actions;
+ private SubscriberInput input;
+ private Menu fMenu;
+
+ /**
+ * Action for filtering by change type.
+ */
+ class ComparisonCriteriaAction extends Action {
+ private ComparisonCriteria criteria;
+ public ComparisonCriteriaAction(ComparisonCriteria criteria) {
+ super(criteria.getName(), Action.AS_RADIO_BUTTON);
+ this.criteria = criteria;
+ }
+ public void run() {
+ ComparisonCriteriaActionGroup.this.activate(this);
+ }
+ public ComparisonCriteria getComparisonCriteria() {
+ return criteria;
+ }
+ }
+
+ public ComparisonCriteriaActionGroup(SubscriberInput input) {
+ this.input = input;
+ setMenuCreator(this);
+ Utils.initAction(this, "action.comparisonCriteria."); //$NON-NLS-1$
+ initializeActions();
+ }
+
+ public void activate(final ComparisonCriteriaAction activatedAction) {
+ for (int i = 0; i < actions.length; i++) {
+ ComparisonCriteriaAction action = actions[i];
+ action.setChecked(activatedAction == action);
+ }
+ TeamUIPlugin.run(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ // when the comparison criteria changes, recalculate the entire sync set based on
+ // the new input.
+ input.getSubscriber().setCurrentComparisonCriteria(activatedAction.getComparisonCriteria().getId());
+ input.reset();
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ }
+
+ public void initializeActions() {
+ this.criteria = input.getSubscriber().getComparisonCriterias();
+ this.actions = new ComparisonCriteriaAction[criteria.length];
+ for (int i = 0; i < criteria.length; i++) {
+ ComparisonCriteria c = criteria[i];
+ actions[i] = new ComparisonCriteriaAction(c);
+ actions[i].setChecked(c == input.getSubscriber().getCurrentComparisonCriteria());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ */
+ public void update() {
+ ISynchronizeViewPage[] pages = TeamUI.getSynchronizeManager().getSynchronizePages();
+ setEnabled(pages.length >= 1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ fMenu= new Menu(parent);
+ ComparisonCriteria currentComparisonCriteria = input.getSubscriber().getCurrentComparisonCriteria();
+ for (int i = 0; i < actions.length; i++) {
+ ComparisonCriteriaAction action = actions[i];
+ action.setChecked(action.getComparisonCriteria() == currentComparisonCriteria);
+ addActionToMenu(fMenu, action);
+ }
+ return fMenu;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ // do nothing - this is a menu
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ protected void addMenuSeparator() {
+ new MenuItem(fMenu, SWT.SEPARATOR);
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/DirectionFilterActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/DirectionFilterActionGroup.java
index 73fc81634..fd0f03e5b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/DirectionFilterActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/DirectionFilterActionGroup.java
@@ -10,19 +10,15 @@
*******************************************************************************/
package org.eclipse.team.ui.sync.actions;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.sync.INewSynchronizeView;
import org.eclipse.team.ui.sync.SubscriberPage;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IKeyBindingService;
+import org.eclipse.ui.*;
import org.eclipse.ui.actions.ActionGroup;
/**
@@ -31,7 +27,7 @@ import org.eclipse.ui.actions.ActionGroup;
* button is active at a time
*/
public class DirectionFilterActionGroup extends ActionGroup implements IPropertyChangeListener {
-
+
// An array of the selection actions for the modes (indexed by mode constant)
private List actions = new ArrayList(3);
@@ -39,12 +35,13 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
private DirectionFilterAction outgoingMode;
private DirectionFilterAction bothMode;
private DirectionFilterAction conflictsMode;
- private INewSynchronizeView view;
private SubscriberPage page;
+ private int supportedModes;
+
class DirectionFilterAction extends Action {
private int modeId;
-
+
public DirectionFilterAction(String prefix,String commandId, int modeId) {
super("", AS_RADIO_BUTTON); //$NON-NLS-1$
this.modeId = modeId;
@@ -54,8 +51,8 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
DirectionFilterAction.this.run();
}
};
- IKeyBindingService kbs = view.getSite().getKeyBindingService();
- Utils.registerAction(kbs, a, commandId); //$NON-NLS-1$
+ //IKeyBindingService kbs = site.getKeyBindingService();
+ //Utils.registerAction(kbs, a, commandId); //$NON-NLS-1$
}
public void run() {
// checkMode() is called because programatic checking of radio buttons doesn't
@@ -69,9 +66,9 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
}
}
- public DirectionFilterActionGroup(INewSynchronizeView view, SubscriberPage page) {
+ public DirectionFilterActionGroup(SubscriberPage page, int supportedModes) {
+ this.supportedModes = supportedModes;
this.page = page;
- this.view = view;
createActions();
page.addPropertyChangeListener(this);
checkMode(page.getMode());
@@ -82,31 +79,43 @@ public class DirectionFilterActionGroup extends ActionGroup implements IProperty
*/
private void createActions() {
// Create the actions
- incomingMode = new DirectionFilterAction("action.directionFilterIncoming.", "org.eclipse.team.ui.syncview.incomingFilter", SubscriberPage.INCOMING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(incomingMode);
-
- outgoingMode = new DirectionFilterAction("action.directionFilterOutgoing.", "org.eclipse.team.ui.syncview.outgoingFilter", SubscriberPage.OUTGOING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(outgoingMode);
-
- bothMode = new DirectionFilterAction("action.directionFilterBoth.", "org.eclipse.team.ui.syncview.bothFilter", SubscriberPage.BOTH_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(bothMode);
-
- conflictsMode = new DirectionFilterAction("action.directionFilterConflicts.", "org.eclipse.team.ui.syncview.conflictsFilter", SubscriberPage.CONFLICTING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
- actions.add(conflictsMode);
+ if((supportedModes & SubscriberPage.INCOMING_MODE) != 0) {
+ incomingMode = new DirectionFilterAction("action.directionFilterIncoming.", "org.eclipse.team.ui.syncview.incomingFilter", SubscriberPage.INCOMING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
+ actions.add(incomingMode);
+ }
+
+ if((supportedModes & SubscriberPage.OUTGOING_MODE) != 0) {
+ outgoingMode = new DirectionFilterAction("action.directionFilterOutgoing.", "org.eclipse.team.ui.syncview.outgoingFilter", SubscriberPage.OUTGOING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
+ actions.add(outgoingMode);
+ }
+
+ if((supportedModes & SubscriberPage.BOTH_MODE) != 0) {
+ bothMode = new DirectionFilterAction("action.directionFilterBoth.", "org.eclipse.team.ui.syncview.bothFilter", SubscriberPage.BOTH_MODE); //$NON-NLS-1$ //$NON-NLS-2$
+ actions.add(bothMode);
+ }
+
+ if((supportedModes & SubscriberPage.CONFLICTING_MODE) != 0) {
+ conflictsMode = new DirectionFilterAction("action.directionFilterConflicts.", "org.eclipse.team.ui.syncview.conflictsFilter", SubscriberPage.CONFLICTING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
+ actions.add(conflictsMode);
+ }
}
/* (non-Javadoc)
* @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
*/
- public void fillActionBars(IActionBars actionBars) {
+ public void fillActionBars(IActionBars actionBars, String group) {
super.fillActionBars(actionBars);
IToolBarManager toolBar = actionBars.getToolBarManager();
for (Iterator it = actions.iterator(); it.hasNext();) {
DirectionFilterAction action = (DirectionFilterAction) it.next();
- toolBar.add(action);
+ if(group != null) {
+ toolBar.appendToGroup(group, action);
+ } else {
+ toolBar.add(action);
+ }
}
}
-
+
private void checkMode(int mode) {
for (Iterator it = actions.iterator(); it.hasNext();) {
DirectionFilterAction action = (DirectionFilterAction)it.next();

Back to the top