Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-04-28 11:47:33 -0400
committerJean Michel-Lemieux2004-04-28 11:47:33 -0400
commite6114da11c69e5ca894f53dddf710a0fd9a298cb (patch)
tree03bdfe00ebfc3bae3dd471e782c93df6ae2ce974
parente40d67f91824e5b190acce85bc936794946a5f34 (diff)
downloadeclipse.platform.team-branch_20040402_layoutOptionsInSynchronizeAdvisor.tar.gz
eclipse.platform.team-branch_20040402_layoutOptionsInSynchronizeAdvisor.tar.xz
eclipse.platform.team-branch_20040402_layoutOptionsInSynchronizeAdvisor.zip
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/StructuredViewerAdvisor.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TreeViewerAdvisor.java6
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestTreeViewerAdvisor.java4
6 files changed, 35 insertions, 10 deletions
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 ae8c97787..c3769aa73 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
@@ -14,7 +14,6 @@ import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.StructuredViewerAdvisor;
/**
* Manager for hierarchical models
@@ -24,8 +23,8 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
/**
* @param configuration
*/
- public HierarchicalModelManager(StructuredViewerAdvisor advisor, ISynchronizePageConfiguration configuration) {
- super(advisor, configuration);
+ public HierarchicalModelManager(ISynchronizePageConfiguration configuration) {
+ super(configuration);
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
index fea5b1252..42dc88d12 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
@@ -16,6 +16,7 @@ import org.eclipse.jface.action.*;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
+import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IActionBars;
@@ -75,13 +76,20 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
}
}
- public SynchronizeModelManager(StructuredViewerAdvisor advisor, ISynchronizePageConfiguration configuration) {
- this.advisor = advisor;
+ public SynchronizeModelManager(ISynchronizePageConfiguration configuration) {
+ Assert.isNotNull(configuration, "configuration cannot be null"); //$NON-NLS-1$
this.configuration = configuration;
configuration.addActionContribution(this);
}
/**
+ * Initialize the model manager to be used with the provided advisor.
+ */
+ public void setViewerAdvisor(StructuredViewerAdvisor advisor) {
+ this.advisor = advisor;
+ }
+
+ /**
* Return the list of supported model providers for this advisor.
* @param viewer
* @return
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
index 4ef14a9a3..35da310e0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
@@ -56,6 +56,14 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
* set.
*/
public static final String P_ADVISOR = TeamUIPlugin.ID + ".P_ADVISOR"; //$NON-NLS-1$
+
+ /**
+ * Property constant for the page's model manager which is
+ * an instance of <code>SynchronizeModelManager</code>.
+ * This property can be queried by clients but should not be
+ * set.
+ */
+ public static final String P_MODEL_MANAGER = TeamUIPlugin.ID + ".P_MODEL_MANAGER"; //$NON-NLS-1$
/**
* Property that gives access to a set the
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/StructuredViewerAdvisor.java
index be814bc3a..21aa745b8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/StructuredViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/StructuredViewerAdvisor.java
@@ -112,7 +112,15 @@ public abstract class StructuredViewerAdvisor {
public StructuredViewerAdvisor(ISynchronizePageConfiguration configuration) {
this.configuration = configuration;
configuration.setProperty(SynchronizePageConfiguration.P_ADVISOR, this);
- modelManager = createModelManager(configuration);
+
+ // Allow the configuration to provide it's own model manager but if one isn't initialized, then
+ // simply use the default provided by the advisor.
+ modelManager = (SynchronizeModelManager)configuration.getProperty(SynchronizePageConfiguration.P_MODEL_MANAGER);
+ if(modelManager == null) {
+ modelManager = createModelManager(configuration);
+ }
+ Assert.isNotNull(modelManager, "model manager must be set");
+ modelManager.setViewerAdvisor(this);
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TreeViewerAdvisor.java
index ff82a2bd0..dfbbc4a5e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TreeViewerAdvisor.java
@@ -244,15 +244,15 @@ public class TreeViewerAdvisor extends StructuredViewerAdvisor {
viewer.getControl().setLayoutData(data);
initializeViewer(viewer);
}
-
+
/**
* Create the model manager to be used by this advisor
* @param configuration
*/
protected SynchronizeModelManager createModelManager(ISynchronizePageConfiguration configuration) {
- return new HierarchicalModelManager(this, configuration);
+ return new HierarchicalModelManager(configuration);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#navigate(boolean)
*/
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestTreeViewerAdvisor.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestTreeViewerAdvisor.java
index 5d0132396..31d412ef5 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestTreeViewerAdvisor.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestTreeViewerAdvisor.java
@@ -26,7 +26,7 @@ public class TestTreeViewerAdvisor extends TreeViewerAdvisor {
* @see org.eclipse.team.ui.synchronize.TreeViewerAdvisor#createModelManager(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
*/
protected SynchronizeModelManager createModelManager(ISynchronizePageConfiguration configuration) {
- return new SynchronizeModelManager(this, configuration) {
+ SynchronizeModelManager manager = new SynchronizeModelManager(configuration) {
protected ISynchronizeModelProvider createModelProvider(String id) {
return new HierarchicalModelProvider(getSyncInfoSet());
}
@@ -38,5 +38,7 @@ public class TestTreeViewerAdvisor extends TreeViewerAdvisor {
return (SyncInfoTree)getConfiguration().getProperty(ISynchronizePageConfiguration.P_SYNC_INFO_SET);
}
};
+ manager.setViewerAdvisor(this);
+ return manager;
}
}

Back to the top