Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-09-09 09:11:05 -0400
committerMichael Valenta2004-09-09 09:11:05 -0400
commit8ba583642275599c7ddff25080be2c3feaf9039e (patch)
treea08dcf60036722bb329f0da8216f3181eff15223
parent4e2f92bfa628418c3767026a88a6899aa5a76fef (diff)
downloadeclipse.platform.team-8ba583642275599c7ddff25080be2c3feaf9039e.tar.gz
eclipse.platform.team-8ba583642275599c7ddff25080be2c3feaf9039e.tar.xz
eclipse.platform.team-8ba583642275599c7ddff25080be2c3feaf9039e.zip
Work continues
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java82
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java2
8 files changed, 74 insertions, 61 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java
index 7fb4e9198..e27d2d782 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java
@@ -10,24 +10,51 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ui.IPreferenceIds;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
/**
* Manager for hierarchical models
*/
-public class ChangeLogModelManager extends SynchronizeModelManager implements IPropertyChangeListener {
-
+public class ChangeLogModelManager extends HierarchicalModelManager implements IPropertyChangeListener {
+
+ public static final String COMMIT_SET_GROUP = "CommitSet"; //$NON-NLS-1$
+
/** support for showing change logs for ranges of tags **/
private CVSTag tag1;
private CVSTag tag2;
+ boolean enabled = false;
+
+ private class ToggleCommitSetAction extends Action {
+ public ToggleCommitSetAction() {
+ super("Show Commit Sets", CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_CHANGELOG));
+ setChecked(enabled);
+ }
+ public void run() {
+ enabled = !enabled;
+ setChecked(enabled);
+ }
+ }
+
+ private class CommitSetActionContribution extends SynchronizePageActionGroup {
+ public void initialize(ISynchronizePageConfiguration configuration) {
+ super.initialize(configuration);
+
+ appendToGroup(
+ ISynchronizePageConfiguration.P_TOOLBAR_MENU,
+ COMMIT_SET_GROUP,
+ new ToggleCommitSetAction());
+ }
+ }
+
public ChangeLogModelManager(ISynchronizePageConfiguration configuration) {
this(configuration, null, null);
}
@@ -37,6 +64,9 @@ public class ChangeLogModelManager extends SynchronizeModelManager implements IP
this.tag1 = tag1;
this.tag2 = tag2;
configuration.addPropertyChangeListener(this);
+ configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, this);
+ configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, COMMIT_SET_GROUP);
+ configuration.addActionContribution(new CommitSetActionContribution());
}
/* (non-Javadoc)
@@ -48,46 +78,14 @@ public class ChangeLogModelManager extends SynchronizeModelManager implements IP
}
/* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelManager#getSupportedModelProviders()
- */
- protected ISynchronizeModelProviderDescriptor[] getSupportedModelProviders() {
- return new ISynchronizeModelProviderDescriptor[] {
- new HierarchicalModelProvider.HierarchicalModelProviderDescriptor(),
- new CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor(),
- new ChangeLogModelProvider.ChangeLogModelProviderDescriptor()};
- }
-
- /* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelManager#createModelProvider(java.lang.String)
*/
protected ISynchronizeModelProvider createModelProvider(String id) {
- if(id == null) {
- if (getShowCompressedFolders()) {
- id = CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID;
- } else {
- id = HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
- }
- }
- if(id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
- return new CompressedFoldersModelProvider(getConfiguration(), getSyncInfoSet());
- } else if(id.endsWith(HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID)) {
- return new HierarchicalModelProvider(getConfiguration(), getSyncInfoSet());
- } else {
- return new ChangeLogModelProvider(getConfiguration(), getSyncInfoSet(), tag1, tag2);
- }
- }
-
- private SyncInfoTree getSyncInfoSet() {
- return (SyncInfoTree)getConfiguration().getProperty(ISynchronizePageConfiguration.P_SYNC_INFO_SET);
- }
-
- /**
- * Return the state of the compressed folder setting.
- *
- * @return the state of the compressed folder setting.
- */
- private boolean getShowCompressedFolders() {
- return TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS);
+ if (enabled) {
+ return new ChangeLogModelProvider(getConfiguration(), getSyncInfoSet(), tag1, tag2, id);
+ } else {
+ return super.createModelProvider(id);
+ }
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
index cf9fdd7d7..e15574877 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
@@ -74,6 +74,9 @@ public class ChangeLogModelProvider extends CompositeModelProvider implements IC
private CVSTag tag1;
private CVSTag tag2;
+ // The id of the sub-provider
+ private final String id;
+
private Set queuedAdditions = new HashSet(); // Set of SyncInfo
private Map rootToProvider = new HashMap(); // Maps ISynchronizeModelElement -> AbstractSynchronizeModelProvider
@@ -451,10 +454,11 @@ public class ChangeLogModelProvider extends CompositeModelProvider implements IC
};
private static final ChangeLogModelProviderDescriptor descriptor = new ChangeLogModelProviderDescriptor();
- public ChangeLogModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set, CVSTag tag1, CVSTag tag2) {
+ public ChangeLogModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set, CVSTag tag1, CVSTag tag2, String id) {
super(configuration, set);
this.tag1 = tag1;
this.tag2 = tag2;
+ this.id = id;
configuration.addMenuGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, SORT_ORDER_GROUP);
configuration.addMenuGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, COMMIT_SET_GROUP);
this.sortGroup = new ChangeLogActionGroup();
@@ -724,7 +728,7 @@ public class ChangeLogModelProvider extends CompositeModelProvider implements IC
* Add the info to the commit set rooted at the given node.
*/
private void addToCommitSetProvider(SyncInfo info, ISynchronizeModelElement parent) {
- AbstractSynchronizeModelProvider provider = getProviderRootedAt(parent);
+ ISynchronizeModelProvider provider = getProviderRootedAt(parent);
if (provider == null) {
// TODO: Will not get event batching for new providers
provider = createProviderRootedAt(parent);
@@ -732,8 +736,8 @@ public class ChangeLogModelProvider extends CompositeModelProvider implements IC
provider.getSyncInfoSet().add(info);
}
- private AbstractSynchronizeModelProvider createProviderRootedAt(ISynchronizeModelElement parent) {
- AbstractSynchronizeModelProvider provider = new CompressedFoldersModelProvider(this, parent, getConfiguration(), new SyncInfoTree());
+ private ISynchronizeModelProvider createProviderRootedAt(ISynchronizeModelElement parent) {
+ ISynchronizeModelProvider provider = createModelProvider(parent, id);
addProvider(provider);
rootToProvider.put(parent, provider);
return provider;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
index 68c18826c..b2a6297bb 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
@@ -22,13 +22,10 @@ import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-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.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
@@ -155,8 +152,8 @@ public class CompareParticipant extends CVSParticipant implements IPropertyChang
NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP);
configuration.addActionContribution(new CompareParticipantActionContribution());
if(localTag != null) {
- // non-api use of SynchronizePageConfiguration
- configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, new ChangeLogModelManager(configuration, localTag, getTag()));
+ // The manager adds itself to the configuration in it's constructor
+ new ChangeLogModelManager(configuration, localTag, getTag());
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
index 7e4f6e948..4c6e0dfe1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
@@ -23,7 +23,6 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IMemento;
@@ -264,8 +263,8 @@ public class MergeSynchronizeParticipant extends CVSParticipant {
configuration.setMode(ISynchronizePageConfiguration.INCOMING_MODE);
configuration.addActionContribution(new MergeParticipantActionContribution());
- // non-api use of SynchronizePageConfiguration
- configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, new ChangeLogModelManager(configuration));
+ // The manager adds itself to the configuration in it's constructor
+ new ChangeLogModelManager(configuration);
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
index d334c58a3..d9ec3ac26 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
@@ -18,7 +18,6 @@ import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.actions.*;
import org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant;
-import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IMemento;
@@ -149,8 +148,8 @@ public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipa
configuration.setSupportedModes(ISynchronizePageConfiguration.ALL_MODES);
configuration.setMode(ISynchronizePageConfiguration.BOTH_MODE);
- // non-api use of SynchronizePageConfiguration
- configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, new ChangeLogModelManager(configuration));
+ // The manager adds itself to the configuration in it's constructor
+ new ChangeLogModelManager(configuration);
// Add context menu groups here to give the client displaying the
// page a chance to remove the context menu
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
index db1165db5..5ad1539d4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
@@ -48,7 +48,7 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
* Add the provider to the list of providers.
* @param provider the provider to be added
*/
- protected void addProvider(AbstractSynchronizeModelProvider provider) {
+ protected void addProvider(ISynchronizeModelProvider provider) {
providers.add(provider);
}
@@ -297,4 +297,20 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
elementToProvider.clear();
}
}
+
+ /**
+ * Helper method for creating a provider for the given id.
+ * @param parent the root node for the new provider
+ * @param id the id of the providers descriptor
+ * @return the new provider
+ */
+ protected ISynchronizeModelProvider createModelProvider(ISynchronizeModelElement parent, String id) {
+ if (id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
+ return new FlatModelProvider(getConfiguration(), getSyncInfoSet());
+ } else if(id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
+ return new CompressedFoldersModelProvider(this, parent, getConfiguration(), getSyncInfoSet());
+ } else {
+ return new HierarchicalModelProvider(this, parent, getConfiguration(), getSyncInfoSet());
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
index ebf8f28fd..9411efffd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
@@ -91,7 +91,7 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
public CompressedFoldersModelProvider(
AbstractSynchronizeModelProvider parentProvider,
ISynchronizeModelElement modelRoot,
- ISynchronizePageConfiguration configuration, SyncInfoTree set) {
+ ISynchronizePageConfiguration configuration, SyncInfoSet set) {
super(parentProvider, modelRoot, configuration, set);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
index 839b4cd83..ad38476ec 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
@@ -57,7 +57,7 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
}
}
- private SyncInfoTree getSyncInfoSet() {
+ protected SyncInfoTree getSyncInfoSet() {
return (SyncInfoTree)getConfiguration().getProperty(ISynchronizePageConfiguration.P_SYNC_INFO_SET);
}

Back to the top