Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-10-01 16:21:53 +0000
committerMichael Valenta2004-10-01 16:21:53 +0000
commiteb7c58da91005474f74b8787ac96ff3571d8314d (patch)
treea423ceae089b7672be54233b953df9a23daf16e0
parent1221a80eb1e9d941e43e1404e9128a064c1d3d17 (diff)
downloadeclipse.platform.team-eb7c58da91005474f74b8787ac96ff3571d8314d.tar.gz
eclipse.platform.team-eb7c58da91005474f74b8787ac96ff3571d8314d.tar.xz
eclipse.platform.team-eb7c58da91005474f74b8787ac96ff3571d8314d.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ChangeSetCapability.java26
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch6
8 files changed, 101 insertions, 25 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java
index 9203f79b8..81bf2c347 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java
@@ -30,7 +30,7 @@ public class CVSChangeSetActionGroup extends SynchronizePageActionGroup {
* @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
public void fillContextMenu(IMenuManager menu) {
- if (getConfiguration().getMode() == ISynchronizePageConfiguration.OUTGOING_MODE) {
+ if (getConfiguration().getParticipant().getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
appendToGroup(
menu,
ISynchronizePageConfiguration.FILE_GROUP,
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
index d2ae65f7b..7ae06c720 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
@@ -42,6 +42,12 @@ import org.eclipse.team.ui.synchronize.*;
*/
public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector {
+ /*
+ * Constant used to add the collector to the configuration of a page so
+ * it can be accessed by the CVS custom actions
+ */
+ public static final String CVS_CHECKED_IN_COLLECTOR = CVSUIPlugin.ID + ".CVSCheckedInCollector"; //$NON-NLS-1$
+
// Log operation that is used to fetch revision histories from the server. It also
// provides caching so we keep it around.
private LogEntryCache logs;
@@ -51,6 +57,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector {
private FetchLogEntriesJob fetchLogEntriesJob;
private DefaultCheckedInChangeSet defaultSet;
+
/* *****************************************************************************
* Special sync info that has its kind already calculated.
@@ -171,6 +178,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector {
public CVSChangeSetCollector(ISynchronizePageConfiguration configuration) {
super(configuration);
+ configuration.setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, this);
}
/* (non-Javadoc)
@@ -444,6 +452,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector {
if (logs != null) {
logs.clearEntries();
}
+ getConfiguration().setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, null);
super.dispose();
}
@@ -630,4 +639,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector {
}
monitor.worked(1);
}
+ public LogEntryCache getLogs() {
+ return logs;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java
index 34dded90b..33014da39 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java
@@ -27,6 +27,7 @@ import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation.CompareTreeBuilder;
+import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
import org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode;
import org.eclipse.team.ui.synchronize.*;
@@ -72,10 +73,30 @@ class OpenChangeSetAction extends SynchronizeModelAction {
}
private ChangeSet getChangeSet(Object[] elements) {
- // TODO Auto-generated method stub
- return null;
+ ChangeSet foundSet = null;
+ for (int i = 0; i < elements.length; i++) {
+ Object object = elements[i];
+ ChangeSet set = getChangeSet((ISynchronizeModelElement)object);
+ if (set == null) return null;
+ if (foundSet == null) {
+ foundSet = set;
+ } else if (foundSet != set) {
+ return null;
+ }
+ }
+ return foundSet;
}
+ private ChangeSet getChangeSet(ISynchronizeModelElement element) {
+ if (element == null) return null;
+ if (element instanceof IAdaptable) {
+ ChangeSet set = (ChangeSet)((IAdaptable)element).getAdapter(ChangeSet.class);
+ if (set != null)
+ return set;
+ }
+ return getChangeSet((ISynchronizeModelElement)element.getParent());
+ }
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
*/
@@ -167,7 +188,7 @@ class OpenChangeSetAction extends SynchronizeModelAction {
}
} else if (remote instanceof ICVSRemoteFile) {
try {
- ICVSRemoteFile predecessor = OpenChangeSetAction.this.provider.logs.getImmediatePredecessor((ICVSRemoteFile)remote);
+ ICVSRemoteFile predecessor = getImmediatePredecessor(remote);
builder.addToTrees(predecessor, (ICVSRemoteFile)remote);
} catch (TeamException e) {
handle(e);
@@ -178,5 +199,20 @@ class OpenChangeSetAction extends SynchronizeModelAction {
return true;
}
};
- }
+ }
+
+ private ICVSRemoteFile getImmediatePredecessor(IResourceVariant remote) throws TeamException {
+ CVSChangeSetCollector changeSetCollector = getChangeSetCollector();
+ if (changeSetCollector != null) {
+ LogEntryCache logs = changeSetCollector.getLogs();
+ if (logs != null)
+ return logs.getImmediatePredecessor((ICVSRemoteFile)remote);
+ }
+ return null;
+ }
+
+ private CVSChangeSetCollector getChangeSetCollector() {
+ return (CVSChangeSetCollector)getConfiguration().getProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR);
+ }
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
index 00764e8f9..2f1340c22 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
@@ -17,6 +17,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
@@ -82,13 +83,10 @@ public class ChangeSetModelManager extends HierarchicalModelManager implements I
private void updateEnablement() {
if (toggleCommitSetAction != null) {
- boolean enabled = false;
- int mode = getConfiguration().getMode();
- if (mode == ISynchronizePageConfiguration.INCOMING_MODE) {
- enabled = getConfiguration().getParticipant().getChangeSetCapability().supportsCheckedInChangeSets();
- } else if (mode == ISynchronizePageConfiguration.OUTGOING_MODE) {
- enabled = getConfiguration().getParticipant().getChangeSetCapability().supportsActiveChangeSets();
- }
+ ISynchronizePageConfiguration configuration = getConfiguration();
+ ChangeSetCapability changeSetCapability = configuration.getParticipant().getChangeSetCapability();
+ boolean enabled = changeSetCapability.enableActiveChangeSetsFor(configuration)
+ || changeSetCapability.enableCheckedInChangeSetsFor(configuration);
toggleCommitSetAction.setEnabled(enabled);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
index bfea748c1..5e8fbcbe5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
@@ -182,9 +182,9 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
* @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#handleChanges(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
*/
protected void handleChanges(ISyncInfoTreeChangeEvent event, IProgressMonitor monitor) {
- if (checkedInCollector != null && getConfiguration().getMode() == ISynchronizePageConfiguration.INCOMING_MODE) {
+ if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
checkedInCollector.handleChange(event);
- } else if (activeCollector != null && getConfiguration().getMode() == ISynchronizePageConfiguration.OUTGOING_MODE) {
+ } else if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
activeCollector.handleChange(event);
} else {
// Forward the event to the root provider
@@ -212,17 +212,21 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
if (node == getModelRoot()) {
// First, disable the collectors
- checkedInCollector.reset(null);
- checkedInCollector.removeListener(checkedInCollectorListener);
- activeCollector.reset(null);
- activeCollector.getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ if (checkedInCollector != null) {
+ checkedInCollector.reset(null);
+ checkedInCollector.removeListener(checkedInCollectorListener);
+ }
+ if (activeCollector != null) {
+ activeCollector.reset(null);
+ activeCollector.getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ }
// Then, re-enable the proper collection method
- if (checkedInCollector != null && getConfiguration().getMode() == ISynchronizePageConfiguration.INCOMING_MODE) {
+ if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
checkedInCollector.addListener(checkedInCollectorListener);
checkedInCollector.reset(getSyncInfoSet());
- } else if (activeCollector != null && getConfiguration().getMode() == ISynchronizePageConfiguration.OUTGOING_MODE) {
+ } else if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
activeCollector.getActiveChangeSetManager().addListener(activeChangeSetListener);
activeCollector.reset(getSyncInfoSet());
} else {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
index 410a2489d..43eaeb50a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
@@ -263,10 +263,10 @@ public final class ChangeSetActionGroup extends SynchronizePageActionGroup {
* @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
public void fillContextMenu(IMenuManager menu) {
- if (getChangeSetCapability().supportsCheckedInChangeSets() && getConfiguration().getMode() == ISynchronizePageConfiguration.INCOMING_MODE) {
+ if (getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
appendToGroup(menu, ISynchronizePageConfiguration.SORT_GROUP, sortByComment);
}
- if (getChangeSetCapability().supportsActiveChangeSets() && getConfiguration().getMode() == ISynchronizePageConfiguration.OUTGOING_MODE) {
+ if (getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
appendToGroup(
menu,
CHANGE_SET_GROUP,
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ChangeSetCapability.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ChangeSetCapability.java
index 29ad078fb..69697b92d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ChangeSetCapability.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ChangeSetCapability.java
@@ -115,4 +115,30 @@ public abstract class ChangeSetCapability {
return null;
}
+ /**
+ * Returns whether checked-in change sets should be enabled for the given state
+ * in the configuration. The default is to enable for three-way incoming mode and
+ * two-way.
+ * @param configuration the configuration for a synchronize page
+ * @return whether checked-in change sets should be enabled for the given state
+ * in the configuration
+ */
+ public final boolean enableCheckedInChangeSetsFor(ISynchronizePageConfiguration configuration) {
+ return supportsCheckedInChangeSets() &&
+ (configuration.getMode() == ISynchronizePageConfiguration.INCOMING_MODE ||
+ configuration.getComparisonType() == ISynchronizePageConfiguration.TWO_WAY);
+ }
+
+ /**
+ * Returns whether active change sets should be enabled for the given state
+ * in the configuration. The default is to enable for three-way outgoing mode.
+ * @param configuration the configuration for a synchronize page
+ * @return whether active change sets should be enabled for the given state
+ * in the configuration
+ */
+ public final boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
+ return supportsActiveChangeSets() &&
+ configuration.getMode() == ISynchronizePageConfiguration.OUTGOING_MODE;
+ }
+
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
index 9828795a9..a6e7c1d63 100644
--- a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
+++ b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
@@ -3,14 +3,14 @@
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<booleanAttribute key="clearws" value="true"/>
<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.subscriber.CVSChangeSetTests"/>
<booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.subscriber.CVSChangeSetTests"/>
<booleanAttribute key="tracing" value="false"/>
<stringAttribute key="location1" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
-<stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName=testSimpleCommit"/>
<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName2=testSimpleCommit"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>

Back to the top