Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-05-18 14:15:07 -0400
committerjames2002-05-18 14:15:07 -0400
commit67c92e82222d5af0ca18517ef7ee7616863374e3 (patch)
treed8fc9dbd7ea75664d06afd68395259df67b92a81
parent977489f80f83325967bacb68cc2cd341432f423d (diff)
downloadeclipse.platform.team-67c92e82222d5af0ca18517ef7ee7616863374e3.tar.gz
eclipse.platform.team-67c92e82222d5af0ca18517ef7ee7616863374e3.tar.xz
eclipse.platform.team-67c92e82222d5af0ca18517ef7ee7616863374e3.zip
Updates
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java37
2 files changed, 68 insertions, 9 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java
index 4218df7c2..f52d7e596 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java
@@ -1,12 +1,48 @@
package org.eclipse.team.internal.ui.target;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer;
import org.eclipse.team.internal.ui.sync.SyncCompareInput;
+import org.eclipse.team.internal.ui.sync.SyncView;
public class TargetCatchupReleaseViewer extends CatchupReleaseViewer {
-
- public TargetCatchupReleaseViewer(Composite parent, SyncCompareInput input) {
+ private GetSyncAction getAction;
+ private PutSyncAction putAction;
+
+ public TargetCatchupReleaseViewer(Composite parent, TargetSyncCompareInput input) {
super(parent, input);
+ initializeActions(input);
+ }
+
+ /**
+ * Creates the actions for this viewer.
+ */
+ private void initializeActions(final TargetSyncCompareInput diffModel) {
+ Shell shell = getControl().getShell();
+ getAction = new GetSyncAction(diffModel, this, "Get", shell);
+ putAction = new PutSyncAction(diffModel, this, "Put", shell);
+ }
+ protected void fillContextMenu(IMenuManager manager) {
+ super.fillContextMenu(manager);
+// manager.add(new Separator());
+// switch (getSyncMode()) {
+// case SyncView.SYNC_INCOMING:
+// getAction.update(SyncView.SYNC_INCOMING);
+// manager.add(getAction);
+// break;
+// case SyncView.SYNC_OUTGOING:
+// putAction.update(SyncView.SYNC_INCOMING);
+// manager.add(putAction);
+// break;
+// case SyncView.SYNC_BOTH:
+// getAction.update(SyncView.SYNC_INCOMING);
+// manager.add(getAction);
+// putAction.update(SyncView.SYNC_INCOMING);
+// manager.add(putAction);
+// break;
+// }
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java
index 0857440d8..18841db70 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java
@@ -1,14 +1,15 @@
package org.eclipse.team.internal.ui.target;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
+import java.util.Hashtable;
+import java.util.List;
import java.util.Set;
+import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -22,14 +23,15 @@ import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
+import org.eclipse.team.core.target.TargetManager;
+import org.eclipse.team.core.target.TargetProvider;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
import org.eclipse.team.internal.ui.sync.ITeamNode;
import org.eclipse.team.internal.ui.sync.SyncSet;
import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
public abstract class TargetSyncAction extends Action {
private TargetSyncCompareInput diffModel;
@@ -39,7 +41,7 @@ public abstract class TargetSyncAction extends Action {
private Shell shell;
/**
- * Creates a MergeAction which works on selection and doesn't commit changes.
+ * Creates a TargetSyncAction which works on selection and doesn't commit changes.
*/
public TargetSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
super(label);
@@ -192,5 +194,26 @@ public abstract class TargetSyncAction extends Action {
*/
protected boolean saveIfNecessary() {
return getDiffModel().saveIfNecessary();
- }
+ }
+
+ /**
+ * Convenience method that maps the given resources to their target providers.
+ * The returned Hashtable has keys which are TargetProviders, and values
+ * which are Lists of IResources that are shared with that provider.
+ *
+ * @return a hashtable mapping providers to their resources
+ */
+ protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException {
+ Hashtable result = new Hashtable();
+ for (int i = 0; i < resources.length; i++) {
+ TargetProvider provider = TargetManager.getProvider(resources[i].getProject());
+ List list = (List)result.get(provider);
+ if (list == null) {
+ list = new ArrayList();
+ result.put(provider, list);
+ }
+ list.add(resources[i]);
+ }
+ return result;
+ }
}

Back to the top