Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java126
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java23
9 files changed, 172 insertions, 20 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 0fa4fd363..203d2bc98 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
@@ -62,11 +62,11 @@ public class ChangeLogModelManager extends SynchronizeModelManager implements IP
}
}
if(id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
- return new CompressedFoldersModelProvider(getSyncInfoSet());
+ return new CompressedFoldersModelProvider(getConfiguration(), getSyncInfoSet());
} else if(id.endsWith(HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID)) {
- return new HierarchicalModelProvider(getSyncInfoSet());
+ return new HierarchicalModelProvider(getConfiguration(), getSyncInfoSet());
} else {
- return new ChangeLogModelProvider(getSyncInfoSet());
+ return new ChangeLogModelProvider(getConfiguration(), getSyncInfoSet());
}
}
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 354e1bf10..02fb3659c 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
@@ -30,6 +30,7 @@ import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.team.ui.synchronize.ISynchronizeManager;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.ui.progress.UIJob;
@@ -143,8 +144,8 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
};
private static final ChangeLogModelProviderDescriptor descriptor = new ChangeLogModelProviderDescriptor();
- public ChangeLogModelProvider(SyncInfoSet set) {
- super(set);
+ public ChangeLogModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(configuration, set);
}
/* (non-Javadoc)
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 6df411cca..e986c0e2c 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
@@ -21,6 +21,7 @@ import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.ISharedImages;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
@@ -84,8 +85,8 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
};
private static final CompressedFolderModelProviderDescriptor compressedDescriptor = new CompressedFolderModelProviderDescriptor();
- public CompressedFoldersModelProvider(SyncInfoTree set) {
- super(set);
+ public CompressedFoldersModelProvider(ISynchronizePageConfiguration configuration, SyncInfoTree set) {
+ super(configuration, set);
}
/* (non-Javadoc)
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 c3769aa73..4a252226f 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
@@ -48,9 +48,9 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
}
}
if(id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
- return new CompressedFoldersModelProvider(getSyncInfoSet());
+ return new CompressedFoldersModelProvider(getConfiguration(), getSyncInfoSet());
} else {
- return new HierarchicalModelProvider(getSyncInfoSet());
+ return new HierarchicalModelProvider(getConfiguration(), getSyncInfoSet());
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
index 864b47d16..e4a5e6c35 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
@@ -21,6 +21,7 @@ import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.ISharedImages;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
/**
* An input that can be used with both {@link } and
@@ -60,8 +61,8 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
*
* @param set the sync set used as the basis for the model created by this input.
*/
- public HierarchicalModelProvider(SyncInfoTree set) {
- super(set);
+ public HierarchicalModelProvider(ISynchronizePageConfiguration configuration, SyncInfoTree set) {
+ super(configuration, set);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java
index 11e077685..ad9754ee1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java
@@ -14,6 +14,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
/**
@@ -24,6 +25,18 @@ import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
*/
public interface ISynchronizeModelProvider {
/**
+ * Property constant for the expansion state for the elements displayed by the page. The
+ * expansion state is a List of resource paths.
+ */
+ public static final String P_VIEWER_EXPANSION_STATE = TeamUIPlugin.ID + ".P_VIEWER_EXPANSION_STATE"; //$NON-NLS-1$
+
+ /**
+ * Property constant for the selection state for the elements displayed by the page. The
+ * selection state is a List of resource paths.
+ */
+ public static final String P_VIEWER_SELECTION_STATE = TeamUIPlugin.ID + ".P_VIEWER_SELECTION_STATE"; //$NON-NLS-1$
+
+ /**
* Returns the sync set this model provider is showing.
* @return the sync set this model provider is showing.
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java
index 481ff5b35..bcd5e7de4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetSynchronizePage.java
@@ -90,6 +90,11 @@ public abstract class SyncInfoSetSynchronizePage extends Page implements ISynchr
IMenuManager viewMenu = actionBars.getMenuManager();
group = findGroup(manager, ISynchronizePageConfiguration.MODE_GROUP);
if (viewMenu != null && group != null) {
+ IContributionItem layoutGroup = findGroup(manager, ISynchronizePageConfiguration.LAYOUT_GROUP);
+ if (layoutGroup != null) {
+ // Put the modes in the layout group to save space
+ group = layoutGroup;
+ }
MenuManager modesItem = new MenuManager(Policy.bind("action.modes.label")); //$NON-NLS-1$
viewMenu.appendToGroup(group.getId(), modesItem);
modes.fillMenu(modesItem);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
index 29c98a8be..f54b0a2ba 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
@@ -29,6 +29,7 @@ import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.ui.progress.WorkbenchJob;
/**
@@ -63,6 +64,8 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
private LabelUpdateJob labelUpdater = new LabelUpdateJob();
+ private ISynchronizePageConfiguration configuration;
+
private IPropertyChangeListener listener = new IPropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent event) {
if (event.getProperty() == SynchronizeModelElement.BUSY_PROPERTY) {
@@ -117,7 +120,7 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
* the sync set used as the basis for the model created by this
* input.
*/
- public SynchronizeModelProvider(SyncInfoSet set) {
+ public SynchronizeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
this(new UnchangedResourceModelElement(null, ResourcesPlugin.getWorkspace().getRoot()) {
/*
* Override to ensure that the diff viewer will appear in CompareEditorInputs
@@ -125,21 +128,38 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
public boolean hasChildren() {
return true;
}
- }, set);
+ }, configuration, set);
}
- public SynchronizeModelProvider(SynchronizeModelElement parent, SyncInfoSet set) {
+ public SynchronizeModelProvider(SynchronizeModelElement parent, ISynchronizePageConfiguration configuration, SyncInfoSet set) {
Assert.isNotNull(set);
Assert.isNotNull(parent);
this.root = parent;
this.set = set;
+ this.configuration = configuration;
}
+ /**
+ * Return the set that contains the elements this provider is using as
+ * a basis for creating a presentation model. This cannot be null.
+ *
+ * @return the set that contains the elements this provider is
+ * using as a basis for creating a presentation model.
+ */
public SyncInfoSet getSyncInfoSet() {
return set;
}
/**
+ * Return the page configuration for this provider.
+ *
+ * @return the page configuration for this provider.
+ */
+ public ISynchronizePageConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ /**
* Return the <code>AbstractTreeViewer</code> asociated with this content
* provider or <code>null</code> if the viewer is not of the proper type.
* @return
@@ -160,7 +180,7 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
// Connect to the sync set which will register us as a listener and give us a reset event
// in a background thread
getSyncInfoSet().connect(this, monitor);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_AUTO_BUILD);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
return getModelRoot();
}
@@ -182,20 +202,29 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
* Dispose of the builder
*/
public void dispose() {
+ if(! resourceMap.isEmpty()) {
+ saveViewerState();
+ }
resourceMap.clear();
getSyncInfoSet().removeSyncSetChangedListener(this);
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
}
/**
- * Returns the input created by this controller or <code>null</code> if
+ * Returns the input created by this provider or <code>null</code> if
* {@link #prepareInput(IProgressMonitor)} hasn't been called on this object yet.
- * @return
+ *
+ * @return the input created by this provider.
*/
public ISynchronizeModelElement getModelRoot() {
return root;
}
+ /**
+ * Returns the sorter for this model provider.
+ *
+ * @return the sorter for this model provider.
+ */
public abstract ViewerSorter getViewerSorter();
/**
@@ -309,6 +338,10 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
protected void reset() {
try {
setAllowRefreshViewer(false);
+ // save expansion state
+ if(! resourceMap.isEmpty()) {
+ saveViewerState();
+ }
// Clear existing model, but keep the root node
resourceMap.clear();
@@ -336,6 +369,8 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed()) {
viewer.refresh();
+ // restore expansion state
+ restoreViewerState();
}
}
});
@@ -408,6 +443,85 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
// another listener to display them.
}
+ protected void saveViewerState() {
+ // save visible expanded elements and selection
+ if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
+ final Object[][] expandedElements = new Object[1][1];
+ final Object[][] selectedElements = new Object[1][1];
+ viewer.getControl().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ expandedElements[0] = ((AbstractTreeViewer) viewer).getVisibleExpandedElements();
+ selectedElements[0] = ((IStructuredSelection) viewer.getSelection()).toArray();
+ }
+ });
+ //
+ // Save expansion
+ //
+ if (expandedElements[0].length > 0) {
+ ISynchronizePageConfiguration config = getConfiguration();
+ ArrayList savedExpansionState = new ArrayList();
+ for (int i = 0; i < expandedElements[0].length; i++) {
+ if (expandedElements[0][i] instanceof ISynchronizeModelElement) {
+ IResource resource = ((ISynchronizeModelElement) expandedElements[0][i]).getResource();
+ savedExpansionState.add(resource.getFullPath().toString());
+ }
+ }
+ config.setProperty(P_VIEWER_EXPANSION_STATE, savedExpansionState);
+ }
+ //
+ // Save selection
+ //
+ if (selectedElements[0].length > 0) {
+ ISynchronizePageConfiguration config = getConfiguration();
+ ArrayList savedSelectedState = new ArrayList();
+ for (int i = 0; i < selectedElements[0].length; i++) {
+ if (selectedElements[0][i] instanceof ISynchronizeModelElement) {
+ IResource resource = ((ISynchronizeModelElement) selectedElements[0][i]).getResource();
+ savedSelectedState.add(resource.getFullPath().toString());
+ }
+ }
+ config.setProperty(P_VIEWER_SELECTION_STATE, savedSelectedState);
+ }
+ }
+ }
+
+ protected void restoreViewerState() {
+ // restore expansion state and selection state
+ if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
+ List savedExpansionState = (List)configuration.getProperty(P_VIEWER_EXPANSION_STATE);
+ List savedSelectionState = (List)configuration.getProperty(P_VIEWER_SELECTION_STATE);
+ IContainer container = ResourcesPlugin.getWorkspace().getRoot();
+ final ArrayList expandedElements = new ArrayList();
+ if (savedExpansionState != null) {
+ for (Iterator it = savedExpansionState.iterator(); it.hasNext();) {
+ String path = (String) it.next();
+ IResource resource = container.findMember(path, true /* include phantoms */);
+ ISynchronizeModelElement element = getModelObject(resource);
+ if (element != null) {
+ expandedElements.add(element);
+ }
+ }
+ }
+ final ArrayList selectedElements = new ArrayList();
+ if (savedSelectionState != null) {
+ for (Iterator it = savedSelectionState.iterator(); it.hasNext();) {
+ String path = (String) it.next();
+ IResource resource = container.findMember(path, true /* include phantoms */);
+ ISynchronizeModelElement element = getModelObject(resource);
+ if (element != null) {
+ selectedElements.add(element);
+ }
+ }
+ }
+ asyncExec(new Runnable() {
+ public void run() {
+ ((AbstractTreeViewer) viewer).setExpandedElements(expandedElements.toArray());
+ viewer.setSelection(new StructuredSelection(selectedElements));
+ }
+ });
+ }
+ }
+
/**
* Update the label of the given diff node. Diff nodes
* are accumulated and updated in a single call.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java
index a15c0fbdd..77a6a57e9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SubscriberActionContribution.java
@@ -83,7 +83,13 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
* @see org.eclipse.team.ui.synchronize.IActionContribution#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
public void fillContextMenu(IMenuManager manager) {
- appendToGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, refreshSelectionAction);
+ if (findGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP) != null
+ && findGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP) != null) {
+ // Place synchronize with navigato to save space
+ appendToGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP, refreshSelectionAction);
+ } else {
+ appendToGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, refreshSelectionAction);
+ }
}
/* (non-Javadoc)
@@ -94,11 +100,22 @@ public final class SubscriberActionContribution extends SynchronizePageActionGro
// toolbar
IToolBarManager manager = actionBars.getToolBarManager();
- appendToGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, refreshAllAction);
+ if (findGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP) != null
+ && findGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP) != null) {
+ // Place synchronize with navigato to save space
+ appendToGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP, refreshAllAction);
+ } else {
+ appendToGroup(manager, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, refreshAllAction);
+ }
// view menu
IMenuManager menu = actionBars.getMenuManager();
- appendToGroup(menu, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, configureSchedule);
+ if (findGroup(menu, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP) != null
+ && findGroup(menu, ISynchronizePageConfiguration.PREFERENCES_GROUP) != null) {
+ appendToGroup(menu, ISynchronizePageConfiguration.PREFERENCES_GROUP, configureSchedule);
+ } else {
+ appendToGroup(menu, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, configureSchedule);
+ }
appendToGroup(menu, ISynchronizePageConfiguration.PREFERENCES_GROUP, showPreferences);
}
}

Back to the top