Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java946
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java672
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java236
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java164
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java584
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java352
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java36
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java108
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java8
-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.java54
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java132
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java416
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java96
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java734
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java106
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java70
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java364
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java98
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java34
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java32
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java6
46 files changed, 2868 insertions, 2868 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
index a2616f7d8..c570a8ba8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
@@ -97,11 +97,11 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
private boolean disposed = false;
- private SynchronizePageActionGroup actionGroup;
+ private SynchronizePageActionGroup actionGroup;
- private ListenerList<IPropertyChangeListener> listeners;
+ private ListenerList<IPropertyChangeListener> listeners;
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = false;
/**
* Constructor for creating a sub-provider
@@ -117,22 +117,22 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
this.set = set;
this.configuration = configuration;
if (parentProvider == null) {
- // The update handler will register for sync change events
- // with the sync set when the handler is activated
- updateHandler = new SynchronizeModelUpdateHandler(this);
- getTree().addTreeListener(this);
+ // The update handler will register for sync change events
+ // with the sync set when the handler is activated
+ updateHandler = new SynchronizeModelUpdateHandler(this);
+ getTree().addTreeListener(this);
} else {
- // We will use the parent's update handler and register for changes with the given set
- updateHandler = parentProvider.updateHandler;
- set.addSyncSetChangedListener(this);
+ // We will use the parent's update handler and register for changes with the given set
+ updateHandler = parentProvider.updateHandler;
+ set.addSyncSetChangedListener(this);
}
}
private Tree getTree() {
- return ((Tree)((AbstractTreeViewer)getViewer()).getControl());
- }
+ return ((Tree)((AbstractTreeViewer)getViewer()).getControl());
+ }
- /**
+ /**
* Constructor for creating a root model provider.
* @param configuration the sync page configuration
* @param set the sync info set from which the model is built
@@ -150,41 +150,41 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
// Register the action group for this provider, since it is the root provider
SynchronizePageActionGroup actionGroup = getActionGroup();
if (actionGroup != null) {
- configuration.addActionContribution(actionGroup);
+ configuration.addActionContribution(actionGroup);
}
}
/**
* Return the action group for this provider or <code>null</code>
- * if there are no actions associated with this provider. The action
- * group will be registered with the configuration if this is
- * the root provider. If this provider is a sub-provider, it
- * is up to the parent provider to register the action group.
- * <p>
- * The action group for a provider is created by calling the
- * <code>createdActionGroup</code> method. If this method returns
- * a non-null group, it is cached so it can be disposed
- * when the provider is disposed.
- * @return the action group for this provider or <code>null</code>
- * if there are no actions associated with this provider
- */
- public final synchronized SynchronizePageActionGroup getActionGroup() {
- if (actionGroup == null) {
- actionGroup = createActionGroup();
- }
- return actionGroup;
- }
-
- /**
- * Create the action group for this provider. By default,
- * a <code>null</code> is returned. Subclasses may override.
- * @return the action group for this provider or <code>null</code>
- */
- protected SynchronizePageActionGroup createActionGroup() {
- return null;
- }
-
- /**
+ * if there are no actions associated with this provider. The action
+ * group will be registered with the configuration if this is
+ * the root provider. If this provider is a sub-provider, it
+ * is up to the parent provider to register the action group.
+ * <p>
+ * The action group for a provider is created by calling the
+ * <code>createdActionGroup</code> method. If this method returns
+ * a non-null group, it is cached so it can be disposed
+ * when the provider is disposed.
+ * @return the action group for this provider or <code>null</code>
+ * if there are no actions associated with this provider
+ */
+ public final synchronized SynchronizePageActionGroup getActionGroup() {
+ if (actionGroup == null) {
+ actionGroup = createActionGroup();
+ }
+ return actionGroup;
+ }
+
+ /**
+ * Create the action group for this provider. By default,
+ * a <code>null</code> is returned. Subclasses may override.
+ * @return the action group for this provider or <code>null</code>
+ */
+ protected SynchronizePageActionGroup createActionGroup() {
+ return null;
+ }
+
+ /**
* Return the set that contains the elements this provider is using as
* a basis for creating a presentation model. This cannot be null.
*
@@ -225,9 +225,9 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
public StructuredViewer getViewer() {
ISynchronizePage page = configuration.getPage();
if (page == null) return null;
- Viewer viewer = page.getViewer();
+ Viewer viewer = page.getViewer();
if (viewer instanceof AbstractTreeViewer) {
- return (AbstractTreeViewer)viewer;
+ return (AbstractTreeViewer)viewer;
}
return null;
}
@@ -239,11 +239,11 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
public ISynchronizeModelElement prepareInput(IProgressMonitor monitor) {
// Connect to the sync set which will register us as a listener and give us a reset event
// in a background thread
- if (isRootProvider()) {
- updateHandler.connect(monitor);
- } else {
- getSyncInfoSet().connect(this, monitor);
- }
+ if (isRootProvider()) {
+ updateHandler.connect(monitor);
+ } else {
+ getSyncInfoSet().connect(this, monitor);
+ }
return getModelRoot();
}
@@ -298,22 +298,22 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
}
} else if (resource == null) {
- // For non-resource elements, show the same propogaqted marker as the children
- IDiffElement[] children = element.getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement child = children[i];
- if (child instanceof ISynchronizeModelElement) {
- ISynchronizeModelElement childElement = (ISynchronizeModelElement)child;
- if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
- property = ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY;
- break;
- } else if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY)) {
+ // For non-resource elements, show the same propogaqted marker as the children
+ IDiffElement[] children = element.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IDiffElement child = children[i];
+ if (child instanceof ISynchronizeModelElement) {
+ ISynchronizeModelElement childElement = (ISynchronizeModelElement)child;
+ if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
+ property = ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY;
+ break;
+ } else if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY)) {
property = ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY;
// Keep going because there may be errors on other resources
}
- }
- }
+ }
+ }
}
return property;
}
@@ -337,10 +337,10 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
updateHandler.queueForLabelUpdate(diffNode);
}
- /**
- * Throw away any old state associated with this provider and
- * rebuild the model from scratch.
- */
+ /**
+ * Throw away any old state associated with this provider and
+ * rebuild the model from scratch.
+ */
protected void reset() {
// save expansion state
if(isRootProvider() && hasViewerState()) {
@@ -360,40 +360,40 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
if (Utils.canUpdateViewer(getViewer())) {
- // If we can update the viewer, that means that the view was updated
- // when the model was rebuilt.
- refreshModelRoot();
+ // If we can update the viewer, that means that the view was updated
+ // when the model was rebuilt.
+ refreshModelRoot();
} else {
- // Only refresh the view if there is now background update in
- // progress. If there is, the background update will refresh
- if (!updateHandler.isPerformingBackgroundUpdate()) {
+ // Only refresh the view if there is now background update in
+ // progress. If there is, the background update will refresh
+ if (!updateHandler.isPerformingBackgroundUpdate()) {
Utils.asyncExec((Runnable) () -> refreshModelRoot(), getViewer());
- }
+ }
}
}
- private void refreshModelRoot() {
- StructuredViewer viewer = getViewer();
+ private void refreshModelRoot() {
+ StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed()) {
try {
viewer.getControl().setRedraw(false);
if (isRootProvider() || getModelRoot().getParent() == null) {
- // Refresh the entire view
- viewer.refresh();
+ // Refresh the entire view
+ viewer.refresh();
} else {
- // Only refresh the model root bu also ensure that
- // the parents of the model root and the model root
- // itself are added to the view
- addToViewer(getModelRoot());
+ // Only refresh the model root bu also ensure that
+ // the parents of the model root and the model root
+ // itself are added to the view
+ addToViewer(getModelRoot());
}
// restore expansion state
if (isRootProvider())
- restoreViewerState();
+ restoreViewerState();
} finally {
viewer.getControl().setRedraw(true);
}
}
- }
+ }
/**
* For each node create children based on the contents of
@@ -404,85 +404,85 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
/**
* Returns whether the viewer has state to be saved.
- * @return whether the viewer has state to be saved
- */
- protected abstract boolean hasViewerState();
-
- /*
- * Return all the resources that are expanded in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected IResource[] getExpandedResources() {
- Set<IResource> expanded = new HashSet<>();
- IResource[] savedExpansionState = getCachedResources(P_VIEWER_EXPANSION_STATE);
- for (int i = 0; i < savedExpansionState.length; i++) {
- IResource resource = savedExpansionState[i];
- expanded.add(resource);
- }
- StructuredViewer viewer = getViewer();
- Object[] objects = ((AbstractTreeViewer) viewer).getVisibleExpandedElements();
- IResource[] currentExpansionState = getResources(objects);
- for (int i = 0; i < currentExpansionState.length; i++) {
- IResource resource = currentExpansionState[i];
- expanded.add(resource);
- }
- return expanded.toArray(new IResource[expanded.size()]);
- }
-
- /*
- * Return all the resources that are selected in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected IResource[] getSelectedResources() {
- StructuredViewer viewer = getViewer();
- return getResources(viewer.getStructuredSelection().toArray());
- }
-
- /*
- * Return all the resources that are checked in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected IResource[] getCheckedResources() {
- StructuredViewer viewer = getViewer();
- if (viewer instanceof CheckboxTreeViewer){
- return getResources(((CheckboxTreeViewer)viewer).getCheckedElements());
- }
-
- return new IResource[0];
- }
-
- /*
- * Expand the resources if they appear in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected void expandResources(IResource[] resources) {
- Set<ISynchronizeModelElement> expandedElements = new HashSet<>();
- StructuredViewer viewer = getViewer();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
+ * @return whether the viewer has state to be saved
+ */
+ protected abstract boolean hasViewerState();
+
+ /*
+ * Return all the resources that are expanded in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected IResource[] getExpandedResources() {
+ Set<IResource> expanded = new HashSet<>();
+ IResource[] savedExpansionState = getCachedResources(P_VIEWER_EXPANSION_STATE);
+ for (int i = 0; i < savedExpansionState.length; i++) {
+ IResource resource = savedExpansionState[i];
+ expanded.add(resource);
+ }
+ StructuredViewer viewer = getViewer();
+ Object[] objects = ((AbstractTreeViewer) viewer).getVisibleExpandedElements();
+ IResource[] currentExpansionState = getResources(objects);
+ for (int i = 0; i < currentExpansionState.length; i++) {
+ IResource resource = currentExpansionState[i];
+ expanded.add(resource);
+ }
+ return expanded.toArray(new IResource[expanded.size()]);
+ }
+
+ /*
+ * Return all the resources that are selected in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected IResource[] getSelectedResources() {
+ StructuredViewer viewer = getViewer();
+ return getResources(viewer.getStructuredSelection().toArray());
+ }
+
+ /*
+ * Return all the resources that are checked in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected IResource[] getCheckedResources() {
+ StructuredViewer viewer = getViewer();
+ if (viewer instanceof CheckboxTreeViewer){
+ return getResources(((CheckboxTreeViewer)viewer).getCheckedElements());
+ }
+
+ return new IResource[0];
+ }
+
+ /*
+ * Expand the resources if they appear in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected void expandResources(IResource[] resources) {
+ Set<ISynchronizeModelElement> expandedElements = new HashSet<>();
+ StructuredViewer viewer = getViewer();
+ for (int j = 0; j < resources.length; j++) {
+ IResource resource = resources[j];
ISynchronizeModelElement[] elements = getModelObjects(resource);
- // Only expand when there is one element per resource
- if (elements.length == 1) {
- for (int i = 0; i < elements.length; i++) {
- ISynchronizeModelElement element = elements[i];
- // Add all parents of the element to the expansion set
- while (element != null) {
- expandedElements.add(element);
- element = (ISynchronizeModelElement)element.getParent();
- }
- }
- }
+ // Only expand when there is one element per resource
+ if (elements.length == 1) {
+ for (int i = 0; i < elements.length; i++) {
+ ISynchronizeModelElement element = elements[i];
+ // Add all parents of the element to the expansion set
+ while (element != null) {
+ expandedElements.add(element);
+ element = (ISynchronizeModelElement)element.getParent();
+ }
+ }
+ }
}
- if (!expandedElements.isEmpty())
- ((AbstractTreeViewer) viewer).setExpandedElements(expandedElements.toArray());
- }
+ if (!expandedElements.isEmpty())
+ ((AbstractTreeViewer) viewer).setExpandedElements(expandedElements.toArray());
+ }
- protected IResource[] getResources(Object[] objects) {
- Set<IResource> result = new HashSet<>();
+ protected IResource[] getResources(Object[] objects) {
+ Set<IResource> result = new HashSet<>();
if (objects.length > 0) {
for (int i = 0; i < objects.length; i++) {
if (objects[i] instanceof ISynchronizeModelElement) {
@@ -493,13 +493,13 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
}
return result.toArray(new IResource[result.size()]);
- }
+ }
- private void clearResourceCache(String configProperty) {
- getConfiguration().setProperty(configProperty, null);
- }
+ private void clearResourceCache(String configProperty) {
+ getConfiguration().setProperty(configProperty, null);
+ }
- private void cacheResources(IResource[] resources, String configProperty) {
+ private void cacheResources(IResource[] resources, String configProperty) {
if (resources.length > 0) {
ISynchronizePageConfiguration config = getConfiguration();
ArrayList<String> paths = new ArrayList<>();
@@ -507,40 +507,40 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
IResource resource = resources[i];
String path = resource.getFullPath().toString();
if (resource.getType() != IResource.FILE && path.charAt(path.length() - 1) != IPath.SEPARATOR) {
- // Include a trailing slash on folders and projects.
- // It is used when recreating cached resources that don't exist locally
- path += IPath.SEPARATOR;
+ // Include a trailing slash on folders and projects.
+ // It is used when recreating cached resources that don't exist locally
+ path += IPath.SEPARATOR;
}
- paths.add(path);
+ paths.add(path);
}
config.setProperty(configProperty, paths);
} else {
- clearResourceCache(configProperty);
+ clearResourceCache(configProperty);
}
- }
+ }
- private IResource[] getCachedResources(String configProperty) {
- List paths = (List)getConfiguration().getProperty(configProperty);
- if (paths == null)
- return new IResource[0];
+ private IResource[] getCachedResources(String configProperty) {
+ List paths = (List)getConfiguration().getProperty(configProperty);
+ if (paths == null)
+ return new IResource[0];
IContainer container = ResourcesPlugin.getWorkspace().getRoot();
ArrayList<IResource> resources = new ArrayList<>();
for (Iterator it = paths.iterator(); it.hasNext();) {
String path = (String) it.next();
IResource resource = getResourceForPath(container, path);
if (resource != null) {
- resources.add(resource);
+ resources.add(resource);
}
}
return resources.toArray(new IResource[resources.size()]);
- }
+ }
- /**
- * Save the viewer state (expansion and selection)
- */
+ /**
+ * Save the viewer state (expansion and selection)
+ */
protected void saveViewerState() {
// save visible expanded elements and selection
- final StructuredViewer viewer = getViewer();
+ final StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
//check to see if we should store the checked states of the tree
@@ -550,10 +550,10 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
final IResource[][] checkedResources = new IResource[1][0];
viewer.getControl().getDisplay().syncExec(() -> {
if (viewer != null && !viewer.getControl().isDisposed()) {
- expandedResources[0] = getExpandedResources();
- selectedResources[0] = getSelectedResources();
- if (storeChecks)
- checkedResources [0] = getCheckedResources();
+ expandedResources[0] = getExpandedResources();
+ selectedResources[0] = getSelectedResources();
+ if (storeChecks)
+ checkedResources [0] = getCheckedResources();
}
});
@@ -571,15 +571,15 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected void restoreViewerState() {
// restore expansion state and selection state
- final StructuredViewer viewer = getViewer();
+ final StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
- IResource[] resourcesToExpand = getCachedResources(P_VIEWER_EXPANSION_STATE);
- IResource[] resourcesToSelect = getCachedResources(P_VIEWER_SELECTION_STATE);
- if (((SynchronizePageConfiguration)configuration).getViewerStyle() == SynchronizePageConfiguration.CHECKBOX){
- IResource[] resourcesToCheck = getCachedResources(P_VIEWER_CHECKED_STATE);
- checkResources(resourcesToCheck);
- }
- expandResources(resourcesToExpand);
+ IResource[] resourcesToExpand = getCachedResources(P_VIEWER_EXPANSION_STATE);
+ IResource[] resourcesToSelect = getCachedResources(P_VIEWER_SELECTION_STATE);
+ if (((SynchronizePageConfiguration)configuration).getViewerStyle() == SynchronizePageConfiguration.CHECKBOX){
+ IResource[] resourcesToCheck = getCachedResources(P_VIEWER_CHECKED_STATE);
+ checkResources(resourcesToCheck);
+ }
+ expandResources(resourcesToExpand);
selectResources(resourcesToSelect);
}
}
@@ -588,96 +588,96 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* Select the given resources in the view. This method can
* only be invoked from the UI thread.
*/
- protected void selectResources(IResource[] resourcesToSelect) {
- StructuredViewer viewer = getViewer();
- final ArrayList<ISynchronizeModelElement> selectedElements = new ArrayList<>();
- for (int i = 0; i < resourcesToSelect.length; i++) {
- IResource resource = resourcesToSelect[i];
- ISynchronizeModelElement[] elements = getModelObjects(resource);
- // Only preserve the selection if there is one element for the resource
- if (elements.length == 1) {
- selectedElements.add(elements[0]);
- }
- }
- if (!selectedElements.isEmpty())
- viewer.setSelection(new StructuredSelection(selectedElements));
- }
-
- /*
+ protected void selectResources(IResource[] resourcesToSelect) {
+ StructuredViewer viewer = getViewer();
+ final ArrayList<ISynchronizeModelElement> selectedElements = new ArrayList<>();
+ for (int i = 0; i < resourcesToSelect.length; i++) {
+ IResource resource = resourcesToSelect[i];
+ ISynchronizeModelElement[] elements = getModelObjects(resource);
+ // Only preserve the selection if there is one element for the resource
+ if (elements.length == 1) {
+ selectedElements.add(elements[0]);
+ }
+ }
+ if (!selectedElements.isEmpty())
+ viewer.setSelection(new StructuredSelection(selectedElements));
+ }
+
+ /*
* Check the given resources in the view. This method can
* only be invoked from the UI thread.
*/
- protected void checkResources(IResource[] resourcesToCheck) {
- Set<ISynchronizeModelElement> checkedElements = new HashSet<>();
- StructuredViewer viewer = getViewer();
- if (!(viewer instanceof CheckboxTreeViewer))
- return;
-
- for (int j = 0; j < resourcesToCheck.length; j++) {
- IResource resource = resourcesToCheck[j];
- if (resource.getType() != IResource.FILE)
- continue;
-
- ISynchronizeModelElement[] elements = getModelObjects(resource);
- // Only expand when there is one element per resource
- if (elements.length == 1) {
- for (int i = 0; i < elements.length; i++) {
- ISynchronizeModelElement element = elements[i];
- checkedElements.add(element);
- }
- }
- }
- if (!checkedElements.isEmpty())
- ((CheckboxTreeViewer) viewer).setCheckedElements(checkedElements.toArray());
- }
-
- /*
- * Convert a path to a resource by first looking in the resource
- * tree and, if that fails, by using the path format to create
- * a handle.
- */
- private IResource getResourceForPath(IContainer container, String path) {
- IResource resource = container.findMember(path, true /* include phantoms */);
- if (resource == null) {
- try {
- // The resource doesn't have an entry on the resources tree
- // but may still appear in the view so try to deduce the type
- // from the path
- if (path.endsWith(Character.toString(IPath.SEPARATOR))) {
- resource = container.getFolder(new Path(null, path));
- } else {
- resource = container.getFile(new Path(null, path));
- }
- } catch (IllegalArgumentException e) {
- // Couldn't get a resource handle so ignore
- }
- }
- return resource;
- }
-
- @Override
+ protected void checkResources(IResource[] resourcesToCheck) {
+ Set<ISynchronizeModelElement> checkedElements = new HashSet<>();
+ StructuredViewer viewer = getViewer();
+ if (!(viewer instanceof CheckboxTreeViewer))
+ return;
+
+ for (int j = 0; j < resourcesToCheck.length; j++) {
+ IResource resource = resourcesToCheck[j];
+ if (resource.getType() != IResource.FILE)
+ continue;
+
+ ISynchronizeModelElement[] elements = getModelObjects(resource);
+ // Only expand when there is one element per resource
+ if (elements.length == 1) {
+ for (int i = 0; i < elements.length; i++) {
+ ISynchronizeModelElement element = elements[i];
+ checkedElements.add(element);
+ }
+ }
+ }
+ if (!checkedElements.isEmpty())
+ ((CheckboxTreeViewer) viewer).setCheckedElements(checkedElements.toArray());
+ }
+
+ /*
+ * Convert a path to a resource by first looking in the resource
+ * tree and, if that fails, by using the path format to create
+ * a handle.
+ */
+ private IResource getResourceForPath(IContainer container, String path) {
+ IResource resource = container.findMember(path, true /* include phantoms */);
+ if (resource == null) {
+ try {
+ // The resource doesn't have an entry on the resources tree
+ // but may still appear in the view so try to deduce the type
+ // from the path
+ if (path.endsWith(Character.toString(IPath.SEPARATOR))) {
+ resource = container.getFolder(new Path(null, path));
+ } else {
+ resource = container.getFile(new Path(null, path));
+ }
+ } catch (IllegalArgumentException e) {
+ // Couldn't get a resource handle so ignore
+ }
+ }
+ return resource;
+ }
+
+ @Override
public void treeCollapsed(TreeEvent e) {
- clearResourceCache(P_VIEWER_EXPANSION_STATE);
- }
+ clearResourceCache(P_VIEWER_EXPANSION_STATE);
+ }
- @Override
+ @Override
public void treeExpanded(TreeEvent e) {
- clearResourceCache(P_VIEWER_EXPANSION_STATE);
- }
+ clearResourceCache(P_VIEWER_EXPANSION_STATE);
+ }
- /**
+ /**
* Return all the model objects in this provider that represent the given resource
- * @param resource the resource
- * @return the model objects for the resource
- */
- protected abstract ISynchronizeModelElement[] getModelObjects(IResource resource);
+ * @param resource the resource
+ * @return the model objects for the resource
+ */
+ protected abstract ISynchronizeModelElement[] getModelObjects(IResource resource);
@Override
public void saveState() {
saveViewerState();
}
- /**
+ /**
* Method invoked when a sync element is added or removed or its state changes.
* This method can be invoked from the UI thread or a background thread.
* @param element synchronize element
@@ -708,41 +708,41 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
@Override
public void dispose() {
- // Only dispose the update handler if it is
- // directly associated with this provider
- if (isRootProvider()) {
- updateHandler.dispose();
- getTree().removeTreeListener(this);
- } else {
- set.removeSyncSetChangedListener(this);
- }
- if (actionGroup != null) {
- Utils.syncExec((Runnable) () -> actionGroup.dispose(), getViewer());
- }
+ // Only dispose the update handler if it is
+ // directly associated with this provider
+ if (isRootProvider()) {
+ updateHandler.dispose();
+ getTree().removeTreeListener(this);
+ } else {
+ set.removeSyncSetChangedListener(this);
+ }
+ if (actionGroup != null) {
+ Utils.syncExec((Runnable) () -> actionGroup.dispose(), getViewer());
+ }
this.disposed = true;
}
- private boolean isRootProvider() {
- return updateHandler.getProvider() == this;
- }
+ private boolean isRootProvider() {
+ return updateHandler.getProvider() == this;
+ }
- /**
+ /**
* Return whether this provide has been disposed.
- * @return whether this provide has been disposed
- */
+ * @return whether this provide has been disposed
+ */
public boolean isDisposed() {
- return disposed;
- }
-
- /**
- * Return the closest parent elements that represents a model element that
- * could contains the given resource. Multiple elements need only be returned
- * if two or more logical views are being shown and each view has an element
- * that could contain the resource.
- * @param resource the resource
- * @return one or more lowest level parents that could contain the resource
- */
- public abstract ISynchronizeModelElement[] getClosestExistingParents(IResource resource);
+ return disposed;
+ }
+
+ /**
+ * Return the closest parent elements that represents a model element that
+ * could contains the given resource. Multiple elements need only be returned
+ * if two or more logical views are being shown and each view has an element
+ * that could contain the resource.
+ * @param resource the resource
+ * @return one or more lowest level parents that could contain the resource
+ */
+ public abstract ISynchronizeModelElement[] getClosestExistingParents(IResource resource);
/**
* Handle the changes made to the viewer's <code>SyncInfoSet</code>.
@@ -758,7 +758,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
handleResourceAdditions(event);
}
- /**
+ /**
* Update the viewer for the sync set additions in the provided event. This
* method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>.
* Subclasses may override.
@@ -782,30 +782,30 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected abstract void handleResourceRemovals(ISyncInfoTreeChangeEvent event);
- @Override
+ @Override
public void syncInfoChanged(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
if (! (event instanceof ISyncInfoTreeChangeEvent)) {
reset();
} else {
- updateHandler.runViewUpdate(() -> handleChanges((ISyncInfoTreeChangeEvent)event, monitor), true /* preserve expansion */);
+ updateHandler.runViewUpdate(() -> handleChanges((ISyncInfoTreeChangeEvent)event, monitor), true /* preserve expansion */);
}
- }
+ }
- @Override
+ @Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- // Not handled
+ // Not handled
- }
+ }
- @Override
+ @Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- reset();
- }
+ reset();
+ }
protected void addToViewer(ISynchronizeModelElement node) {
- if (DEBUG) {
- System.out.println("Adding model element " + node.getName()); //$NON-NLS-1$
- }
+ if (DEBUG) {
+ System.out.println("Adding model element " + node.getName()); //$NON-NLS-1$
+ }
propogateConflictState(node, false);
// Set the marker property on this node.
// There is no need to propagate this to the parents
@@ -824,50 +824,50 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
/*
- * Propagate the marker property to the parent if it is not already there.
- * Only propagate warnings if the parent isn't an error already.
- */
- private void propogateMarkerPropertyToParent(ISynchronizeModelElement node, String property) {
- ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
- if (parent != null
- && !parent.getProperty(property)
- && !parent.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
- parent.setProperty(property, true);
- propogateMarkerPropertyToParent(parent, property);
- }
- }
-
- /**
+ * Propagate the marker property to the parent if it is not already there.
+ * Only propagate warnings if the parent isn't an error already.
+ */
+ private void propogateMarkerPropertyToParent(ISynchronizeModelElement node, String property) {
+ ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
+ if (parent != null
+ && !parent.getProperty(property)
+ && !parent.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
+ parent.setProperty(property, true);
+ propogateMarkerPropertyToParent(parent, property);
+ }
+ }
+
+ /**
* Remove any traces of the model element and any of it's descendants in the
* hierarchy defined by the content provider from the content provider and
* the viewer it is associated with.
* @param nodes the model elements to remove
*/
protected void removeFromViewer(ISynchronizeModelElement[] nodes) {
- List<ISynchronizeModelElement> rootsToClear = new ArrayList<>();
- for (int i = 0; i < nodes.length; i++) {
- ISynchronizeModelElement node = nodes[i];
- if (DEBUG) {
- System.out.println("Removing model element " + node.getName()); //$NON-NLS-1$
- }
+ List<ISynchronizeModelElement> rootsToClear = new ArrayList<>();
+ for (int i = 0; i < nodes.length; i++) {
+ ISynchronizeModelElement node = nodes[i];
+ if (DEBUG) {
+ System.out.println("Removing model element " + node.getName()); //$NON-NLS-1$
+ }
ISynchronizeModelElement rootToClear= getRootToClear(node);
if (DEBUG) {
if (rootToClear != node) {
System.out.println("Removing parent element " + rootToClear.getName()); //$NON-NLS-1$
}
- }
+ }
propogateConflictState(rootToClear, true /* clear the conflict */);
clearModelObjects(rootToClear);
rootsToClear.add(rootToClear);
- }
- ISynchronizeModelElement[] roots = rootsToClear.toArray(new ISynchronizeModelElement[rootsToClear.size()]);
+ }
+ ISynchronizeModelElement[] roots = rootsToClear.toArray(new ISynchronizeModelElement[rootsToClear.size()]);
if (Utils.canUpdateViewer(getViewer())) {
doRemove(roots);
}
for (int i = 0; i < roots.length; i++) {
- ISynchronizeModelElement element = roots[i];
+ ISynchronizeModelElement element = roots[i];
updateHandler.nodeRemoved(element, this);
- }
+ }
}
/**
@@ -878,92 +878,92 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* @param node the root node
*/
protected final void clearModelObjects(ISynchronizeModelElement node) {
- // When clearing model objects, any parents of the node
- // That are not out-of-sync, not the model root and that would
- // be empty as a result of this clear, should also be cleared.
- ISynchronizeModelElement rootToClear = getRootToClear(node);
- // Recursively clear the nodes from the root
- recursiveClearModelObjects(rootToClear);
- if (node == getModelRoot()) {
- IDiffElement[] children = node.getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement element = children[i];
- ((SynchronizeModelElement)node).remove(element);
- }
- } else {
- SynchronizeModelElement parent = ((SynchronizeModelElement)node.getParent());
- if (parent != null) parent.remove(node);
- }
+ // When clearing model objects, any parents of the node
+ // That are not out-of-sync, not the model root and that would
+ // be empty as a result of this clear, should also be cleared.
+ ISynchronizeModelElement rootToClear = getRootToClear(node);
+ // Recursively clear the nodes from the root
+ recursiveClearModelObjects(rootToClear);
+ if (node == getModelRoot()) {
+ IDiffElement[] children = node.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IDiffElement element = children[i];
+ ((SynchronizeModelElement)node).remove(element);
+ }
+ } else {
+ SynchronizeModelElement parent = ((SynchronizeModelElement)node.getParent());
+ if (parent != null) parent.remove(node);
+ }
}
/**
* Method that subclasses can override when clearing model objects.
- * @param node the node to be cleared recursively
- */
- protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
- // Clear all the children of the node
+ * @param node the node to be cleared recursively
+ */
+ protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
+ // Clear all the children of the node
IDiffElement[] children = node.getChildren();
for (int i = 0; i < children.length; i++) {
IDiffElement element = children[i];
if (element instanceof ISynchronizeModelElement) {
- ISynchronizeModelElement sme = (ISynchronizeModelElement) element;
- ISynchronizeModelProvider provider = getProvider(sme);
- if (provider != null && provider instanceof AbstractSynchronizeModelProvider) {
- ((AbstractSynchronizeModelProvider)provider).recursiveClearModelObjects(sme);
- } else {
- recursiveClearModelObjects(sme);
- }
+ ISynchronizeModelElement sme = (ISynchronizeModelElement) element;
+ ISynchronizeModelProvider provider = getProvider(sme);
+ if (provider != null && provider instanceof AbstractSynchronizeModelProvider) {
+ ((AbstractSynchronizeModelProvider)provider).recursiveClearModelObjects(sme);
+ } else {
+ recursiveClearModelObjects(sme);
+ }
}
}
// Notify the update handler that the node has been cleared
if (node != getModelRoot())
updateHandler.modelObjectCleared(node);
- }
-
- /*
- * Remove to root should only remove to the root of the provider and not the
- * diff tree.
- */
- private ISynchronizeModelElement getRootToClear(ISynchronizeModelElement node) {
- if (node == getModelRoot()) return node;
- ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
+ }
+
+ /*
+ * Remove to root should only remove to the root of the provider and not the
+ * diff tree.
+ */
+ private ISynchronizeModelElement getRootToClear(ISynchronizeModelElement node) {
+ if (node == getModelRoot()) return node;
+ ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
if (parent != null && parent != getModelRoot() && !isOutOfSync(parent) && parent.getChildren().length == 1) {
- return getRootToClear(parent);
+ return getRootToClear(parent);
}
return node;
- }
-
- /*
- * Return whether the node represents an out-of-sync resource.
- */
- protected boolean isOutOfSync(ISynchronizeModelElement node) {
- SyncInfo info = Utils.getSyncInfo(node);
- return (info != null && info.getKind() != SyncInfo.IN_SYNC);
- }
-
- protected boolean isOutOfSync(IResource resource) {
- SyncInfo info = getSyncInfoSet().getSyncInfo(resource);
- return (info != null && info.getKind() != SyncInfo.IN_SYNC);
- }
-
- /**
+ }
+
+ /*
+ * Return whether the node represents an out-of-sync resource.
+ */
+ protected boolean isOutOfSync(ISynchronizeModelElement node) {
+ SyncInfo info = Utils.getSyncInfo(node);
+ return (info != null && info.getKind() != SyncInfo.IN_SYNC);
+ }
+
+ protected boolean isOutOfSync(IResource resource) {
+ SyncInfo info = getSyncInfoSet().getSyncInfo(resource);
+ return (info != null && info.getKind() != SyncInfo.IN_SYNC);
+ }
+
+ /**
* Return the provider that created and manages the given
* model element. The default is to return the receiver.
* Subclasses may override.
- * @param element the synchronize model element
- * @return the provider that created the element
- */
- protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element) {
- return this;
- }
-
- /**
- * Add the element to the viewer.
- * @param parent the parent of the element which is already added to the viewer
- * @param element the element to be added to the viewer
- */
+ * @param element the synchronize model element
+ * @return the provider that created the element
+ */
+ protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element) {
+ return this;
+ }
+
+ /**
+ * Add the element to the viewer.
+ * @param parent the parent of the element which is already added to the viewer
+ * @param element the element to be added to the viewer
+ */
protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
- updateHandler.doAdd(parent, element);
+ updateHandler.doAdd(parent, element);
}
/**
@@ -973,17 +973,17 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
protected void doRemove(ISynchronizeModelElement[] elements) {
AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
try {
- viewer.remove(elements);
- } catch (SWTException e) {
- // The remove failed due to an SWT exception. Log it and continue
- TeamUIPlugin.log(IStatus.ERROR, "An error occurred removing elements from the synchronize view", e); //$NON-NLS-1$
- }
- if (DEBUG) {
- for (int i = 0; i < elements.length; i++) {
- ISynchronizeModelElement element = elements[i];
- System.out.println("Removing view item " + element.getName()); //$NON-NLS-1$
- }
- }
+ viewer.remove(elements);
+ } catch (SWTException e) {
+ // The remove failed due to an SWT exception. Log it and continue
+ TeamUIPlugin.log(IStatus.ERROR, "An error occurred removing elements from the synchronize view", e); //$NON-NLS-1$
+ }
+ if (DEBUG) {
+ for (int i = 0; i < elements.length; i++) {
+ ISynchronizeModelElement element = elements[i];
+ System.out.println("Removing view item " + element.getName()); //$NON-NLS-1$
+ }
+ }
}
/**
@@ -994,7 +994,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* @param provider the provider that added the node
*/
protected void nodeAdded(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
- // Default is to do nothing
+ // Default is to do nothing
}
/**
@@ -1006,46 +1006,46 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* @param node
*/
protected void nodeRemoved(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
- // Default is to do nothing
+ // Default is to do nothing
}
- /**
+ /**
* This is a callback from the model update handler that gets invoked
* when a node is cleared from the model. It is only invoked for the
* root level model provider. This callback is deep in the sense that
* a callback is sent for each node that is cleared.
- * @param node the node that was cleared.
- */
- public void modelObjectCleared(ISynchronizeModelElement node) {
- // Default is to do nothing
- }
+ * @param node the node that was cleared.
+ */
+ public void modelObjectCleared(ISynchronizeModelElement node) {
+ // Default is to do nothing
+ }
- @Override
+ @Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- synchronized (this) {
- if (listeners == null) {
- listeners = new ListenerList<>(ListenerList.IDENTITY);
- }
- listeners.add(listener);
- }
-
- }
- @Override
+ synchronized (this) {
+ if (listeners == null) {
+ listeners = new ListenerList<>(ListenerList.IDENTITY);
+ }
+ listeners.add(listener);
+ }
+
+ }
+ @Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (listeners != null) {
- synchronized (this) {
- listeners.remove(listener);
- if (listeners.isEmpty()) {
- listeners = null;
- }
- }
- }
- }
+ if (listeners != null) {
+ synchronized (this) {
+ listeners.remove(listener);
+ if (listeners.isEmpty()) {
+ listeners = null;
+ }
+ }
+ }
+ }
protected void firePropertyChange(String key, Object oldValue, Object newValue) {
Object[] allListeners;
synchronized(this) {
- allListeners = listeners.getListeners();
+ allListeners = listeners.getListeners();
}
final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue);
for (int i = 0; i < allListeners.length; i++) {
@@ -1063,13 +1063,13 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
}
- /**
- * Wait until the provider is done processing any events and
- * the page content are up-to-date.
- * This method is for testing purposes only.
- * @param monitor
- */
- public void waitUntilDone(IProgressMonitor monitor) {
+ /**
+ * Wait until the provider is done processing any events and
+ * the page content are up-to-date.
+ * This method is for testing purposes only.
+ * @param monitor
+ */
+ public void waitUntilDone(IProgressMonitor monitor) {
monitor.worked(1);
// wait for the event handler to process changes.
while(updateHandler.getEventHandlerJob().getState() != Job.NONE) {
@@ -1081,32 +1081,32 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
Policy.checkCanceled(monitor);
}
monitor.worked(1);
- }
+ }
- @Override
+ @Override
public String toString() {
- ISynchronizeModelElement element = getModelRoot();
- String name = getClass().getName();
- int index = name.lastIndexOf("."); //$NON-NLS-1$
- if (index != -1) {
- name = name.substring(index + 1);
- }
- String name2 = element.getName();
- if (name2.length() == 0) {
- name2 = "/"; //$NON-NLS-1$
- }
- return name + ": " + name2; //$NON-NLS-1$
- }
-
- /**
- * Execute a runnable which performs an update of the model being displayed
- * by this provider. The runnable should be executed in a thread-safe manner
- * which results in the view being updated.
- * @param runnable the runnable which updates the model.
- * @param preserveExpansion whether the expansion of the view should be preserver
- * @param runInUIThread
- */
- public void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, boolean runInUIThread) {
- updateHandler.performUpdate(runnable, preserveExpansion, runInUIThread);
- }
+ ISynchronizeModelElement element = getModelRoot();
+ String name = getClass().getName();
+ int index = name.lastIndexOf("."); //$NON-NLS-1$
+ if (index != -1) {
+ name = name.substring(index + 1);
+ }
+ String name2 = element.getName();
+ if (name2.length() == 0) {
+ name2 = "/"; //$NON-NLS-1$
+ }
+ return name + ": " + name2; //$NON-NLS-1$
+ }
+
+ /**
+ * Execute a runnable which performs an update of the model being displayed
+ * by this provider. The runnable should be executed in a thread-safe manner
+ * which results in the view being updated.
+ * @param runnable the runnable which updates the model.
+ * @param preserveExpansion whether the expansion of the view should be preserver
+ * @param runInUIThread
+ */
+ public void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, boolean runInUIThread) {
+ updateHandler.performUpdate(runnable, preserveExpansion, runInUIThread);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
index 2f69a6675..734b49f35 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
@@ -360,7 +360,7 @@ public abstract class AbstractTreeViewerAdvisor extends StructuredViewerAdvisor
/*
* Allow adding an advisor to the PartNavigator and support coordinated
- * navigation between several objects.
+ * navigation between several objects.
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
index 797249982..6d76eb831 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
@@ -50,301 +50,301 @@ import org.eclipse.team.ui.synchronize.SubscriberParticipant;
*/
public class ActiveChangeSetCollector implements IDiffChangeListener {
- private final ISynchronizePageConfiguration configuration;
+ private final ISynchronizePageConfiguration configuration;
- /*
- * Map active change sets to infos displayed by the participant
- */
- private final Map<ChangeSet, SyncInfoSet> activeSets = new HashMap<>();
+ /*
+ * Map active change sets to infos displayed by the participant
+ */
+ private final Map<ChangeSet, SyncInfoSet> activeSets = new HashMap<>();
- /*
- * Set which contains those changes that are not part of an active set
- */
- private SyncInfoTree rootSet = new SyncInfoTree();
+ /*
+ * Set which contains those changes that are not part of an active set
+ */
+ private SyncInfoTree rootSet = new SyncInfoTree();
- private final ChangeSetModelProvider provider;
+ private final ChangeSetModelProvider provider;
- /*
- * Listener registered with active change set manager
- */
- private IChangeSetChangeListener activeChangeSetListener = new IChangeSetChangeListener() {
+ /*
+ * Listener registered with active change set manager
+ */
+ private IChangeSetChangeListener activeChangeSetListener = new IChangeSetChangeListener() {
- @Override
+ @Override
public void setAdded(final ChangeSet set) {
- // Remove any resources that are in the new set
- provider.performUpdate(monitor -> {
- remove(set.getResources());
- createSyncInfoSet(set);
+ // Remove any resources that are in the new set
+ provider.performUpdate(monitor -> {
+ remove(set.getResources());
+ createSyncInfoSet(set);
}, true, true);
- }
+ }
- @Override
+ @Override
public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
- provider.performUpdate(monitor -> {
- if (listener != null)
- listener.defaultSetChanged(previousDefault, set);
+ provider.performUpdate(monitor -> {
+ if (listener != null)
+ listener.defaultSetChanged(previousDefault, set);
}, true, true);
- }
+ }
- @Override
+ @Override
public void setRemoved(final ChangeSet set) {
- provider.performUpdate(monitor -> {
- remove(set);
- if (!set.isEmpty()) {
- add(getSyncInfos(set).getSyncInfos());
- }
+ provider.performUpdate(monitor -> {
+ remove(set);
+ if (!set.isEmpty()) {
+ add(getSyncInfos(set).getSyncInfos());
+ }
}, true, true);
- }
+ }
- @Override
+ @Override
public void nameChanged(final ChangeSet set) {
- provider.performUpdate(monitor -> {
- if (listener != null)
- listener.nameChanged(set);
+ provider.performUpdate(monitor -> {
+ if (listener != null)
+ listener.nameChanged(set);
}, true, true);
- }
+ }
- @Override
+ @Override
public void resourcesChanged(final ChangeSet set, final IPath[] paths) {
- // Look for any resources that were removed from the set but are still out-of sync.
- // Re-add those resources
- final List<SyncInfo> outOfSync = new ArrayList<>();
- for (int i = 0; i < paths.length; i++) {
+ // Look for any resources that were removed from the set but are still out-of sync.
+ // Re-add those resources
+ final List<SyncInfo> outOfSync = new ArrayList<>();
+ for (int i = 0; i < paths.length; i++) {
IPath path = paths[i];
- if (!((DiffChangeSet)set).contains(path)) {
- SyncInfo info = getSyncInfo(path);
- if (info != null && info.getKind() != SyncInfo.IN_SYNC) {
- outOfSync.add(info);
- }
- }
- }
- if (!outOfSync.isEmpty()) {
- provider.performUpdate(monitor -> add(outOfSync.toArray(new SyncInfo[outOfSync.size()])), true, true);
- }
- }
- };
-
- /**
- * Listener that wants to receive change events from this collector
- */
- private IChangeSetChangeListener listener;
-
- public ActiveChangeSetCollector(ISynchronizePageConfiguration configuration, ChangeSetModelProvider provider) {
- this.configuration = configuration;
- this.provider = provider;
- getActiveChangeSetManager().addListener(activeChangeSetListener);
- }
-
- public ISynchronizePageConfiguration getConfiguration() {
- return configuration;
- }
-
- public ActiveChangeSetManager getActiveChangeSetManager() {
- ISynchronizeParticipant participant = getConfiguration().getParticipant();
- if (participant instanceof IChangeSetProvider) {
- return ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
- }
- return null;
- }
-
- /**
- * Re-populate the change sets from the seed set.
- * If <code>null</code> is passed, the state
- * of the collector is cleared but the set is not
- * re-populated.
- * <p>
- * This method is invoked by the model provider when the
- * model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * @param seedSet
- */
- public void reset(SyncInfoSet seedSet) {
- // First, clean up
- rootSet.clear();
- ChangeSet[] sets = activeSets.keySet().toArray(new ChangeSet[activeSets.size()]);
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- remove(set);
- }
- activeSets.clear();
-
- // Now re-populate
- if (seedSet != null) {
- if (getConfiguration().getComparisonType() == ISynchronizePageConfiguration.THREE_WAY) {
- // Show all active change sets even if they are empty
- sets = getActiveChangeSetManager().getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- add(set);
- }
- // The above will add all sync info that are contained in sets.
- // We still need to add uncontained infos to the root set
- SyncInfo[] syncInfos = seedSet.getSyncInfos();
- for (int i = 0; i < syncInfos.length; i++) {
- SyncInfo info = syncInfos[i];
- if (isLocalChange(info)) {
- ChangeSet[] containingSets = findChangeSets(info);
- if (containingSets.length == 0) {
- rootSet.add(info);
- }
- }
- }
- } else {
- add(seedSet.getSyncInfos());
- }
- }
- }
-
- /**
- * Handle a sync info set change event from the provider's
- * seed set.
- * <p>
- * This method is invoked by the model provider when the
- * model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- */
- public void handleChange(ISyncInfoSetChangeEvent event) {
- List<IResource> removals = new ArrayList<>();
- List<SyncInfo> additions = new ArrayList<>();
- removals.addAll(Arrays.asList(event.getRemovedResources()));
- additions.addAll(Arrays.asList(event.getAddedResources()));
- SyncInfo[] changed = event.getChangedResources();
- for (int i = 0; i < changed.length; i++) {
- SyncInfo info = changed[i];
- additions.add(info);
- removals.add(info.getLocal());
- }
- if (!removals.isEmpty()) {
- remove(removals.toArray(new IResource[removals.size()]));
- }
- if (!additions.isEmpty()) {
- add(additions.toArray(new SyncInfo[additions.size()]));
- }
- }
-
- /**
- * Remove the given resources from all sets of this collector.
- * @param resources the resources to be removed
- */
- protected void remove(IResource[] resources) {
- for (Iterator iter = activeSets.values().iterator(); iter.hasNext();) {
- SyncInfoSet set = (SyncInfoSet) iter.next();
- set.removeAll(resources);
- }
- rootSet.removeAll(resources);
- }
-
- protected void add(SyncInfo[] infos) {
- rootSet.beginInput();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (isLocalChange(info) && select(info)) {
- ChangeSet[] sets = findChangeSets(info);
- if (sets.length == 0) {
- rootSet.add(info);
- } else {
- for (int j = 0; j < sets.length; j++) {
- ChangeSet set = sets[j];
- SyncInfoSet targetSet = getSyncInfoSet(set);
- if (targetSet == null) {
- // This will add all the appropriate sync info to the set
- createSyncInfoSet(set);
- } else {
- targetSet.add(info);
- }
- }
- }
- }
- }
- rootSet.endInput(null);
- }
-
- private ChangeSet[] findChangeSets(SyncInfo info) {
- ActiveChangeSetManager manager = getActiveChangeSetManager();
- ChangeSet[] sets = manager.getSets();
- List<ChangeSet> result = new ArrayList<>();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set.contains(info.getLocal())) {
- result.add(set);
- }
- }
- return result.toArray(new ChangeSet[result.size()]);
- }
-
- /*
+ if (!((DiffChangeSet)set).contains(path)) {
+ SyncInfo info = getSyncInfo(path);
+ if (info != null && info.getKind() != SyncInfo.IN_SYNC) {
+ outOfSync.add(info);
+ }
+ }
+ }
+ if (!outOfSync.isEmpty()) {
+ provider.performUpdate(monitor -> add(outOfSync.toArray(new SyncInfo[outOfSync.size()])), true, true);
+ }
+ }
+ };
+
+ /**
+ * Listener that wants to receive change events from this collector
+ */
+ private IChangeSetChangeListener listener;
+
+ public ActiveChangeSetCollector(ISynchronizePageConfiguration configuration, ChangeSetModelProvider provider) {
+ this.configuration = configuration;
+ this.provider = provider;
+ getActiveChangeSetManager().addListener(activeChangeSetListener);
+ }
+
+ public ISynchronizePageConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ public ActiveChangeSetManager getActiveChangeSetManager() {
+ ISynchronizeParticipant participant = getConfiguration().getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ return ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
+ }
+ return null;
+ }
+
+ /**
+ * Re-populate the change sets from the seed set.
+ * If <code>null</code> is passed, the state
+ * of the collector is cleared but the set is not
+ * re-populated.
+ * <p>
+ * This method is invoked by the model provider when the
+ * model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * @param seedSet
+ */
+ public void reset(SyncInfoSet seedSet) {
+ // First, clean up
+ rootSet.clear();
+ ChangeSet[] sets = activeSets.keySet().toArray(new ChangeSet[activeSets.size()]);
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ remove(set);
+ }
+ activeSets.clear();
+
+ // Now re-populate
+ if (seedSet != null) {
+ if (getConfiguration().getComparisonType() == ISynchronizePageConfiguration.THREE_WAY) {
+ // Show all active change sets even if they are empty
+ sets = getActiveChangeSetManager().getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ add(set);
+ }
+ // The above will add all sync info that are contained in sets.
+ // We still need to add uncontained infos to the root set
+ SyncInfo[] syncInfos = seedSet.getSyncInfos();
+ for (int i = 0; i < syncInfos.length; i++) {
+ SyncInfo info = syncInfos[i];
+ if (isLocalChange(info)) {
+ ChangeSet[] containingSets = findChangeSets(info);
+ if (containingSets.length == 0) {
+ rootSet.add(info);
+ }
+ }
+ }
+ } else {
+ add(seedSet.getSyncInfos());
+ }
+ }
+ }
+
+ /**
+ * Handle a sync info set change event from the provider's
+ * seed set.
+ * <p>
+ * This method is invoked by the model provider when the
+ * model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ */
+ public void handleChange(ISyncInfoSetChangeEvent event) {
+ List<IResource> removals = new ArrayList<>();
+ List<SyncInfo> additions = new ArrayList<>();
+ removals.addAll(Arrays.asList(event.getRemovedResources()));
+ additions.addAll(Arrays.asList(event.getAddedResources()));
+ SyncInfo[] changed = event.getChangedResources();
+ for (int i = 0; i < changed.length; i++) {
+ SyncInfo info = changed[i];
+ additions.add(info);
+ removals.add(info.getLocal());
+ }
+ if (!removals.isEmpty()) {
+ remove(removals.toArray(new IResource[removals.size()]));
+ }
+ if (!additions.isEmpty()) {
+ add(additions.toArray(new SyncInfo[additions.size()]));
+ }
+ }
+
+ /**
+ * Remove the given resources from all sets of this collector.
+ * @param resources the resources to be removed
+ */
+ protected void remove(IResource[] resources) {
+ for (Iterator iter = activeSets.values().iterator(); iter.hasNext();) {
+ SyncInfoSet set = (SyncInfoSet) iter.next();
+ set.removeAll(resources);
+ }
+ rootSet.removeAll(resources);
+ }
+
+ protected void add(SyncInfo[] infos) {
+ rootSet.beginInput();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ if (isLocalChange(info) && select(info)) {
+ ChangeSet[] sets = findChangeSets(info);
+ if (sets.length == 0) {
+ rootSet.add(info);
+ } else {
+ for (int j = 0; j < sets.length; j++) {
+ ChangeSet set = sets[j];
+ SyncInfoSet targetSet = getSyncInfoSet(set);
+ if (targetSet == null) {
+ // This will add all the appropriate sync info to the set
+ createSyncInfoSet(set);
+ } else {
+ targetSet.add(info);
+ }
+ }
+ }
+ }
+ }
+ rootSet.endInput(null);
+ }
+
+ private ChangeSet[] findChangeSets(SyncInfo info) {
+ ActiveChangeSetManager manager = getActiveChangeSetManager();
+ ChangeSet[] sets = manager.getSets();
+ List<ChangeSet> result = new ArrayList<>();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ if (set.contains(info.getLocal())) {
+ result.add(set);
+ }
+ }
+ return result.toArray(new ChangeSet[result.size()]);
+ }
+
+ /*
* Return if this sync info is an outgoing change.
*/
private boolean isLocalChange(SyncInfo info) {
- if (!info.getComparator().isThreeWay()) {
- try {
- // Obtain the sync info from the subscriber and use it to see if the change is local
- info = ((SubscriberChangeSetManager)getActiveChangeSetManager()).getSubscriber().getSyncInfo(info.getLocal());
- } catch (TeamException e) {
- TeamUIPlugin.log(e);
- }
- }
+ if (!info.getComparator().isThreeWay()) {
+ try {
+ // Obtain the sync info from the subscriber and use it to see if the change is local
+ info = ((SubscriberChangeSetManager)getActiveChangeSetManager()).getSubscriber().getSyncInfo(info.getLocal());
+ } catch (TeamException e) {
+ TeamUIPlugin.log(e);
+ }
+ }
return (info.getComparator().isThreeWay()
- && ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING ||
- (info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.CONFLICTING));
+ && ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING ||
+ (info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.CONFLICTING));
+ }
+
+ public SyncInfoTree getRootSet() {
+ return rootSet;
+ }
+
+ /*
+ * Add the set from the collector.
+ */
+ public void add(ChangeSet set) {
+ SyncInfoSet targetSet = getSyncInfoSet(set);
+ if (targetSet == null) {
+ createSyncInfoSet(set);
+ }
+ if (listener != null) {
+ listener.setAdded(set);
+ }
}
- public SyncInfoTree getRootSet() {
- return rootSet;
- }
-
- /*
- * Add the set from the collector.
- */
- public void add(ChangeSet set) {
- SyncInfoSet targetSet = getSyncInfoSet(set);
- if (targetSet == null) {
- createSyncInfoSet(set);
- }
- if (listener != null) {
- listener.setAdded(set);
- }
- }
-
- private SyncInfoTree createSyncInfoSet(ChangeSet set) {
- SyncInfoTree sis = getSyncInfoSet(set);
- // Register the listener last since the add will
- // look for new elements
- boolean added = false;
- // Use a variable to ensure that both begin and end are invoked
- try {
- if (sis == null) {
- sis = new SyncInfoTree();
- activeSets.put(set, sis);
- added = true;
- }
- sis.beginInput();
- if (!sis.isEmpty())
- sis.removeAll(sis.getResources());
- sis.addAll(getSyncInfos(set));
- } finally {
- if (sis != null)
- sis.endInput(null);
- }
- if (added) {
- ((DiffChangeSet)set).getDiffTree().addDiffChangeListener(this);
- if (listener != null)
- listener.setAdded(set);
- }
- return sis;
- }
+ private SyncInfoTree createSyncInfoSet(ChangeSet set) {
+ SyncInfoTree sis = getSyncInfoSet(set);
+ // Register the listener last since the add will
+ // look for new elements
+ boolean added = false;
+ // Use a variable to ensure that both begin and end are invoked
+ try {
+ if (sis == null) {
+ sis = new SyncInfoTree();
+ activeSets.put(set, sis);
+ added = true;
+ }
+ sis.beginInput();
+ if (!sis.isEmpty())
+ sis.removeAll(sis.getResources());
+ sis.addAll(getSyncInfos(set));
+ } finally {
+ if (sis != null)
+ sis.endInput(null);
+ }
+ if (added) {
+ ((DiffChangeSet)set).getDiffTree().addDiffChangeListener(this);
+ if (listener != null)
+ listener.setAdded(set);
+ }
+ return sis;
+ }
private SyncInfoSet getSyncInfos(ChangeSet set) {
IDiff[] diffs = ((ResourceDiffTree)((DiffChangeSet)set).getDiffTree()).getDiffs();
@@ -364,7 +364,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
return result;
}
- private SyncInfo asSyncInfo(IDiff diff) {
+ private SyncInfo asSyncInfo(IDiff diff) {
try {
return ((SubscriberParticipant)getConfiguration().getParticipant()).getSubscriber().getSyncInfo(ResourceDiffTree.getResourceFor(diff));
} catch (TeamException e) {
@@ -374,7 +374,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
}
private boolean select(IDiff diff) {
- return getSeedSet().getSyncInfo(ResourceDiffTree.getResourceFor(diff)) != null;
+ return getSeedSet().getSyncInfo(ResourceDiffTree.getResourceFor(diff)) != null;
}
/* private */ SyncInfo getSyncInfo(IPath path) {
@@ -404,73 +404,73 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
}
/*
- * Remove the set from the collector.
- */
- public void remove(ChangeSet set) {
- ((DiffChangeSet)set).getDiffTree().removeDiffChangeListener(this);
- activeSets.remove(set);
- if (listener != null) {
- listener.setRemoved(set);
- }
- }
-
- /*
- * Return the sync info set for the given active change set
- * or null if there isn't one.
- */
- public SyncInfoTree getSyncInfoSet(ChangeSet set) {
- return (SyncInfoTree)activeSets.get(set);
- }
-
- private ChangeSet getChangeSet(IDiffTree tree) {
- for (Iterator iter = activeSets.keySet().iterator(); iter.hasNext();) {
- ChangeSet changeSet = (ChangeSet) iter.next();
- if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
- return changeSet;
- }
- }
- return null;
- }
-
- private boolean select(SyncInfo info) {
- return getSeedSet().getSyncInfo(info.getLocal()) != null;
- }
-
- private SyncInfoSet getSeedSet() {
- return provider.getSyncInfoSet();
- }
-
- public void dispose() {
- getActiveChangeSetManager().removeListener(activeChangeSetListener);
- }
-
- /**
- * Set the change set listener for this collector. There is
- * only one for this type of collector.
- * @param listener change set change listener
- */
- public void setChangeSetChangeListener(IChangeSetChangeListener listener) {
- this.listener = listener;
- if (listener == null) {
- getActiveChangeSetManager().removeListener(activeChangeSetListener);
- } else {
- getActiveChangeSetManager().addListener(activeChangeSetListener);
- }
- }
+ * Remove the set from the collector.
+ */
+ public void remove(ChangeSet set) {
+ ((DiffChangeSet)set).getDiffTree().removeDiffChangeListener(this);
+ activeSets.remove(set);
+ if (listener != null) {
+ listener.setRemoved(set);
+ }
+ }
+
+ /*
+ * Return the sync info set for the given active change set
+ * or null if there isn't one.
+ */
+ public SyncInfoTree getSyncInfoSet(ChangeSet set) {
+ return (SyncInfoTree)activeSets.get(set);
+ }
+
+ private ChangeSet getChangeSet(IDiffTree tree) {
+ for (Iterator iter = activeSets.keySet().iterator(); iter.hasNext();) {
+ ChangeSet changeSet = (ChangeSet) iter.next();
+ if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
+ return changeSet;
+ }
+ }
+ return null;
+ }
+
+ private boolean select(SyncInfo info) {
+ return getSeedSet().getSyncInfo(info.getLocal()) != null;
+ }
+
+ private SyncInfoSet getSeedSet() {
+ return provider.getSyncInfoSet();
+ }
+
+ public void dispose() {
+ getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ }
+
+ /**
+ * Set the change set listener for this collector. There is
+ * only one for this type of collector.
+ * @param listener change set change listener
+ */
+ public void setChangeSetChangeListener(IChangeSetChangeListener listener) {
+ this.listener = listener;
+ if (listener == null) {
+ getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ } else {
+ getActiveChangeSetManager().addListener(activeChangeSetListener);
+ }
+ }
@Override
public void diffsChanged(final IDiffChangeEvent event, IProgressMonitor monitor) {
- provider.performUpdate(monitor1 -> {
- ChangeSet changeSet = getChangeSet(event.getTree());
- if (changeSet != null) {
- SyncInfoSet targetSet = getSyncInfoSet(changeSet);
- if (targetSet != null) {
- targetSet.removeAll(getResources(targetSet, event.getRemovals()));
- targetSet.addAll(asSyncInfoSet(event.getAdditions()));
- targetSet.addAll(asSyncInfoSet(event.getChanges()));
- rootSet.removeAll(((IResourceDiffTree)event.getTree()).getAffectedResources());
- }
- }
+ provider.performUpdate(monitor1 -> {
+ ChangeSet changeSet = getChangeSet(event.getTree());
+ if (changeSet != null) {
+ SyncInfoSet targetSet = getSyncInfoSet(changeSet);
+ if (targetSet != null) {
+ targetSet.removeAll(getResources(targetSet, event.getRemovals()));
+ targetSet.addAll(asSyncInfoSet(event.getAdditions()));
+ targetSet.addAll(asSyncInfoSet(event.getChanges()));
+ rootSet.removeAll(((IResourceDiffTree)event.getTree()).getAffectedResources());
+ }
+ }
}, true /* preserver expansion */, true /* run in UI thread */);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java
index 69ade459b..c0a1ca9f3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java
@@ -27,132 +27,132 @@ import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
*/
public abstract class ChangeSetCapability {
- /**
- * Return whether the associated participant supports
- * the display of checked-in change sets. The default is
- * unsupported (<code>false</code>). If subclasses support
- * checked-in change sets, they must override the
- * <code>createCheckedInChangeSetCollector</code>
- * method to return an appropriate values.
- * @return whether the associated participant supports
- * the display of checked-in change sets
- */
- public boolean supportsCheckedInChangeSets() {
- return false;
- }
+ /**
+ * Return whether the associated participant supports
+ * the display of checked-in change sets. The default is
+ * unsupported (<code>false</code>). If subclasses support
+ * checked-in change sets, they must override the
+ * <code>createCheckedInChangeSetCollector</code>
+ * method to return an appropriate values.
+ * @return whether the associated participant supports
+ * the display of checked-in change sets
+ */
+ public boolean supportsCheckedInChangeSets() {
+ return false;
+ }
- /**
- * Return whether the associated participant supports
- * the use of active change sets. The default is unsupported
- * (<code>false</code>). If a subclass overrides this method in
- * order to support active change sets, they must also override the methods
- * <code>getActiveChangeSetManager</code>,
- * <code>createChangeSet</code> and <code>editChangeSet</code>.
- * @return whether the associated participant supports
- * the use of active change sets
- */
- public boolean supportsActiveChangeSets() {
- return false;
- }
+ /**
+ * Return whether the associated participant supports
+ * the use of active change sets. The default is unsupported
+ * (<code>false</code>). If a subclass overrides this method in
+ * order to support active change sets, they must also override the methods
+ * <code>getActiveChangeSetManager</code>,
+ * <code>createChangeSet</code> and <code>editChangeSet</code>.
+ * @return whether the associated participant supports
+ * the use of active change sets
+ */
+ public boolean supportsActiveChangeSets() {
+ return false;
+ }
- /**
- * Return the change set collector that manages the active change
- * set for the participant associated with this capability. A <code>null</code>
- * is returned if active change sets are not supported. The default is to
- * return <code>null</code>. This method must be
- * overridden by subclasses that support active change sets.
- * @return the change set collector that manages the active change
- * set for the participant associated with this capability or
- * <code>null</code> if active change sets are not supported.
- */
- public ActiveChangeSetManager getActiveChangeSetManager() {
- return null;
- }
+ /**
+ * Return the change set collector that manages the active change
+ * set for the participant associated with this capability. A <code>null</code>
+ * is returned if active change sets are not supported. The default is to
+ * return <code>null</code>. This method must be
+ * overridden by subclasses that support active change sets.
+ * @return the change set collector that manages the active change
+ * set for the participant associated with this capability or
+ * <code>null</code> if active change sets are not supported.
+ */
+ public ActiveChangeSetManager getActiveChangeSetManager() {
+ return null;
+ }
- /**
- * Create a change set from the given manager that contains the given sync info.
- * This method is invoked from the UI thread. A <code>null</code>
- * is returned if active change sets are not supported. The default is to
- * return <code>null</code>. This method must be
- * overridden by subclasses that support active change sets.
- * @param configuration the configuration of the page displaying the change sets
- * @param diffs the sync info to be added to the change set
- * @return the created set.
- */
- public ActiveChangeSet createChangeSet(ISynchronizePageConfiguration configuration, IDiff[] diffs) {
- return null;
- }
+ /**
+ * Create a change set from the given manager that contains the given sync info.
+ * This method is invoked from the UI thread. A <code>null</code>
+ * is returned if active change sets are not supported. The default is to
+ * return <code>null</code>. This method must be
+ * overridden by subclasses that support active change sets.
+ * @param configuration the configuration of the page displaying the change sets
+ * @param diffs the sync info to be added to the change set
+ * @return the created set.
+ */
+ public ActiveChangeSet createChangeSet(ISynchronizePageConfiguration configuration, IDiff[] diffs) {
+ return null;
+ }
- /**
- * Edit the title and comment of the given change set. This method must be
- * overridden by subclasses that support active change sets.
- * This method is invoked from the UI thread.
- * @param configuration the configuration of the page displaying the change sets
- * @param set the set to be edited
- */
- public void editChangeSet(ISynchronizePageConfiguration configuration, ActiveChangeSet set) {
- // Default is to do nothing
- }
+ /**
+ * Edit the title and comment of the given change set. This method must be
+ * overridden by subclasses that support active change sets.
+ * This method is invoked from the UI thread.
+ * @param configuration the configuration of the page displaying the change sets
+ * @param set the set to be edited
+ */
+ public void editChangeSet(ISynchronizePageConfiguration configuration, ActiveChangeSet set) {
+ // Default is to do nothing
+ }
- /**
- * Return a collector that can be used to group a set of checked-in changes
- * into a set of checked-in change sets. This method must be
- * overridden by subclasses that support checked-in change sets.
- * @param configuration the configuration for the page that will be displaying the change sets
- * @return a change set collector
- */
- public SyncInfoSetChangeSetCollector createSyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
- return null;
- }
+ /**
+ * Return a collector that can be used to group a set of checked-in changes
+ * into a set of checked-in change sets. This method must be
+ * overridden by subclasses that support checked-in change sets.
+ * @param configuration the configuration for the page that will be displaying the change sets
+ * @return a change set collector
+ */
+ public SyncInfoSetChangeSetCollector createSyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
+ return null;
+ }
- /**
- * Return an action group for contributing context menu items
- * to the synchronize page while change sets are enabled.
- * Return <code>null</code> if no custom actions are required.
- * Note that only context menus can be contributed since the view menu
- * and toolbar menu are fixed. This method can be overridden by subclasses
- * who wish to support custom change set actions.
- * @return an action group for contributing context menu items
- * to the synchronize page while change sets are enabled or <code>null</code>
- */
- public SynchronizePageActionGroup getActionGroup() {
- return null;
- }
+ /**
+ * Return an action group for contributing context menu items
+ * to the synchronize page while change sets are enabled.
+ * Return <code>null</code> if no custom actions are required.
+ * Note that only context menus can be contributed since the view menu
+ * and toolbar menu are fixed. This method can be overridden by subclasses
+ * who wish to support custom change set actions.
+ * @return an action group for contributing context menu items
+ * to the synchronize page while change sets are enabled or <code>null</code>
+ */
+ public SynchronizePageActionGroup getActionGroup() {
+ 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 boolean enableCheckedInChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return supportsCheckedInChangeSets() &&
- (configuration.getMode() == ISynchronizePageConfiguration.INCOMING_MODE ||
- configuration.getComparisonType() == ISynchronizePageConfiguration.TWO_WAY);
- }
+ /**
+ * 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 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 boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return supportsActiveChangeSets() &&
- configuration.getMode() == ISynchronizePageConfiguration.OUTGOING_MODE;
- }
+ /**
+ * 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 boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
+ return supportsActiveChangeSets() &&
+ configuration.getMode() == ISynchronizePageConfiguration.OUTGOING_MODE;
+ }
- /**
- * Return whether change sets should be enabled by default on pages
- * that display the participant.
- * @return whether change sets should be enabled by default on pages
- * that display the participant
- */
- public boolean enableChangeSetsByDefault() {
- return false;
- }
+ /**
+ * Return whether change sets should be enabled by default on pages
+ * that display the participant.
+ * @return whether change sets should be enabled by default on pages
+ * that display the participant
+ */
+ public boolean enableChangeSetsByDefault() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
index 17476c81b..2077a04a4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
@@ -25,21 +25,21 @@ import org.eclipse.team.internal.ui.TeamUIPlugin;
*/
public class ChangeSetDiffNode extends SynchronizeModelElement {
- private final ChangeSet set;
+ private final ChangeSet set;
- public ChangeSetDiffNode(IDiffContainer parent, ChangeSet set) {
- super(parent);
- this.set = set;
- }
+ public ChangeSetDiffNode(IDiffContainer parent, ChangeSet set) {
+ super(parent);
+ this.set = set;
+ }
- @Override
+ @Override
public IResource getResource() {
- return null;
- }
+ return null;
+ }
- public ChangeSet getSet() {
- return set;
- }
+ public ChangeSet getSet() {
+ return set;
+ }
@Override
public ImageDescriptor getImageDescriptor(Object object) {
@@ -56,25 +56,25 @@ public class ChangeSetDiffNode extends SynchronizeModelElement {
return getName();
}
- @Override
+ @Override
public int hashCode() {
- return set.hashCode();
- }
+ return set.hashCode();
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (object instanceof ChangeSetDiffNode) {
- return((ChangeSetDiffNode)object).getSet() == set;
- }
- return super.equals(object);
- }
+ if (object instanceof ChangeSetDiffNode) {
+ return((ChangeSetDiffNode)object).getSet() == set;
+ }
+ return super.equals(object);
+ }
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter.equals(ChangeSet.class)) {
- return (T) set;
- }
- return super.getAdapter(adapter);
- }
+ if (adapter.equals(ChangeSet.class)) {
+ return (T) set;
+ }
+ return super.getAdapter(adapter);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java
index 3dae67dcf..60bf1dd88 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java
@@ -38,21 +38,21 @@ public class ChangeSetLabelDecorator extends LabelProvider implements ILabelDeco
private Font boldFont;
private ActiveChangeSetManager collector;
- public ChangeSetLabelDecorator(ISynchronizePageConfiguration configuration) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof IChangeSetProvider) {
- this.collector = ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
- }
- }
+ public ChangeSetLabelDecorator(ISynchronizePageConfiguration configuration) {
+ ISynchronizeParticipant participant = configuration.getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ this.collector = ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
+ }
+ }
- @Override
+ @Override
public String decorateText(String input, Object element) {
String text = input;
if (element instanceof ChangeSetDiffNode) {
- ChangeSet set = ((ChangeSetDiffNode)element).getSet();
- if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
- text = NLS.bind(TeamUIMessages.CommitSetDiffNode_0, new String[] { text });
- }
+ ChangeSet set = ((ChangeSetDiffNode)element).getSet();
+ if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
+ text = NLS.bind(TeamUIMessages.CommitSetDiffNode_0, new String[] { text });
+ }
}
return text;
}
@@ -67,9 +67,9 @@ public class ChangeSetLabelDecorator extends LabelProvider implements ILabelDeco
@Override
public Font decorateFont(Object element) {
if (element instanceof ChangeSetDiffNode) {
- ChangeSet set = ((ChangeSetDiffNode)element).getSet();
- if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
- if (boldFont == null) {
+ ChangeSet set = ((ChangeSetDiffNode)element).getSet();
+ if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
+ if (boldFont == null) {
Font defaultFont = JFaceResources.getDefaultFont();
FontData[] data = defaultFont.getFontData();
for (int i = 0; i < data.length; i++) {
@@ -78,18 +78,18 @@ public class ChangeSetLabelDecorator extends LabelProvider implements ILabelDeco
boldFont = new Font(TeamUIPlugin.getStandardDisplay(), data);
}
return boldFont;
- }
+ }
}
return null;
}
private boolean isDefaultActiveSet(ActiveChangeSet set) {
- return collector.isDefault(set);
+ return collector.isDefault(set);
}
- @Override
+ @Override
public Image decorateImage(Image image, Object element) {
- return image;
- }
+ return image;
+ }
}
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 26595c5a4..f234c33ae 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
@@ -29,80 +29,80 @@ import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
*/
public class ChangeSetModelManager extends HierarchicalModelManager implements IPropertyChangeListener {
- private static final String P_COMMIT_SET_ENABLED = TeamUIPlugin.ID + ".P_COMMIT_SET_ENABLED"; //$NON-NLS-1$
+ private static final String P_COMMIT_SET_ENABLED = TeamUIPlugin.ID + ".P_COMMIT_SET_ENABLED"; //$NON-NLS-1$
- public static final String CHANGE_SET_GROUP = "ChangeSet"; //$NON-NLS-1$
+ public static final String CHANGE_SET_GROUP = "ChangeSet"; //$NON-NLS-1$
boolean enabled = false;
private class ToggleCommitSetAction extends Action {
- public ToggleCommitSetAction() {
- super(TeamUIMessages.ChangeLogModelManager_0, TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_CHANGE_SET));
- setToolTipText(TeamUIMessages.ChangeLogModelManager_0);
- update();
- }
- @Override
+ public ToggleCommitSetAction() {
+ super(TeamUIMessages.ChangeLogModelManager_0, TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_CHANGE_SET));
+ setToolTipText(TeamUIMessages.ChangeLogModelManager_0);
+ update();
+ }
+ @Override
public void run() {
- setCommitSetsEnabled(!enabled);
- update();
- }
- private void update() {
- setChecked(enabled);
- }
+ setCommitSetsEnabled(!enabled);
+ update();
+ }
+ private void update() {
+ setChecked(enabled);
+ }
}
private ToggleCommitSetAction toggleCommitSetAction;
private class CommitSetActionContribution extends SynchronizePageActionGroup {
- @Override
+ @Override
public void initialize(ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
toggleCommitSetAction = new ToggleCommitSetAction();
- appendToGroup(
+ appendToGroup(
ISynchronizePageConfiguration.P_TOOLBAR_MENU,
CHANGE_SET_GROUP,
toggleCommitSetAction);
- updateEnablement();
+ updateEnablement();
}
}
public ChangeSetModelManager(ISynchronizePageConfiguration configuration) {
- super(configuration);
+ super(configuration);
configuration.addPropertyChangeListener(this);
configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, CHANGE_SET_GROUP);
configuration.addActionContribution(new CommitSetActionContribution());
ChangeSetCapability changeSetCapability = getChangeSetCapability(configuration);
- if (changeSetCapability != null && changeSetCapability.supportsActiveChangeSets()) {
- configuration.addLabelDecorator(new ChangeSetLabelDecorator(configuration));
+ if (changeSetCapability != null && changeSetCapability.supportsActiveChangeSets()) {
+ configuration.addLabelDecorator(new ChangeSetLabelDecorator(configuration));
}
configuration.addPropertyChangeListener(event -> {
- if (event.getProperty().equals(ISynchronizePageConfiguration.P_MODE)) {
- updateEnablement();
- }
+ if (event.getProperty().equals(ISynchronizePageConfiguration.P_MODE)) {
+ updateEnablement();
+ }
});
}
- private ChangeSetCapability getChangeSetCapability(ISynchronizePageConfiguration configuration) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- return provider.getChangeSetCapability();
- }
- return null;
- }
-
- private void updateEnablement() {
- if (toggleCommitSetAction != null) {
- ISynchronizePageConfiguration configuration = getConfiguration();
- ChangeSetCapability changeSetCapability = getChangeSetCapability(configuration);
- boolean enabled = changeSetCapability != null && (changeSetCapability.enableActiveChangeSetsFor(configuration)
- || changeSetCapability.enableCheckedInChangeSetsFor(configuration));
- toggleCommitSetAction.setEnabled(enabled);
- }
-
- }
+ private ChangeSetCapability getChangeSetCapability(ISynchronizePageConfiguration configuration) {
+ ISynchronizeParticipant participant = configuration.getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ IChangeSetProvider provider = (IChangeSetProvider) participant;
+ return provider.getChangeSetCapability();
+ }
+ return null;
+ }
+
+ private void updateEnablement() {
+ if (toggleCommitSetAction != null) {
+ ISynchronizePageConfiguration configuration = getConfiguration();
+ ChangeSetCapability changeSetCapability = getChangeSetCapability(configuration);
+ boolean enabled = changeSetCapability != null && (changeSetCapability.enableActiveChangeSetsFor(configuration)
+ || changeSetCapability.enableCheckedInChangeSetsFor(configuration));
+ toggleCommitSetAction.setEnabled(enabled);
+ }
+
+ }
@Override
public void dispose() {
@@ -112,61 +112,61 @@ public class ChangeSetModelManager extends HierarchicalModelManager implements I
@Override
protected ISynchronizeModelProvider createModelProvider(String id) {
- if (enabled) {
- return new ChangeSetModelProvider(getConfiguration(), getSyncInfoSet(), id);
- } else {
- return super.createModelProvider(id);
- }
+ if (enabled) {
+ return new ChangeSetModelProvider(getConfiguration(), getSyncInfoSet(), id);
+ } else {
+ return super.createModelProvider(id);
+ }
}
- @Override
+ @Override
protected String getSelectedProviderId() {
- String id = super.getSelectedProviderId();
- if (id.equals(ChangeSetModelProvider.ChangeSetModelProviderDescriptor.ID)) {
- return ((ChangeSetModelProvider)getActiveModelProvider()).getSubproviderId();
- } else {
- return id;
- }
- }
+ String id = super.getSelectedProviderId();
+ if (id.equals(ChangeSetModelProvider.ChangeSetModelProviderDescriptor.ID)) {
+ return ((ChangeSetModelProvider)getActiveModelProvider()).getSubproviderId();
+ } else {
+ return id;
+ }
+ }
@Override
public void propertyChange(PropertyChangeEvent event) {
}
- @Override
+ @Override
protected void saveProviderSettings(String id) {
- super.saveProviderSettings(id);
- IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
+ super.saveProviderSettings(id);
+ IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
pageSettings.put(P_COMMIT_SET_ENABLED, enabled);
}
- }
+ }
- @Override
+ @Override
public void initialize(ISynchronizePageConfiguration configuration) {
- // Load our setting before invoking super since the inherited
- // initialize will create the provider
- IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
- ChangeSetCapability changeSetCapability = getChangeSetCapability(getConfiguration());
- enabled = changeSetCapability != null && changeSetCapability.enableChangeSetsByDefault();
+ // Load our setting before invoking super since the inherited
+ // initialize will create the provider
+ IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
+ ChangeSetCapability changeSetCapability = getChangeSetCapability(getConfiguration());
+ enabled = changeSetCapability != null && changeSetCapability.enableChangeSetsByDefault();
if(pageSettings != null && pageSettings.get(P_COMMIT_SET_ENABLED) != null) {
- enabled = pageSettings.getBoolean(P_COMMIT_SET_ENABLED);
+ enabled = pageSettings.getBoolean(P_COMMIT_SET_ENABLED);
}
- super.initialize(configuration);
- }
-
- /*
- * This method is public so it can be invoked from test cases
- */
- public void setCommitSetsEnabled(boolean enable) {
- if (this.enabled != enable) {
- this.enabled = enable;
- setInput(getSelectedProviderId(), null);
- }
- }
-
- @Override
+ super.initialize(configuration);
+ }
+
+ /*
+ * This method is public so it can be invoked from test cases
+ */
+ public void setCommitSetsEnabled(boolean enable) {
+ if (this.enabled != enable) {
+ this.enabled = enable;
+ setInput(getSelectedProviderId(), null);
+ }
+ }
+
+ @Override
public ISynchronizeModelProvider getActiveModelProvider() {
- return super.getActiveModelProvider();
- }
+ return super.getActiveModelProvider();
+ }
}
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 003407375..09084d186 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
@@ -42,10 +42,10 @@ import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
*/
public class ChangeSetModelProvider extends CompositeModelProvider {
- private ViewerSorter viewerSorter;
+ private ViewerSorter viewerSorter;
// The id of the sub-provider
- private final String subProvierId;
+ private final String subProvierId;
private Map<ISynchronizeModelElement, ISynchronizeModelProvider> rootToProvider = new HashMap<>();
@@ -55,43 +55,43 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
private IChangeSetChangeListener changeSetListener = new IChangeSetChangeListener() {
- @Override
+ @Override
public void setAdded(final ChangeSet set) {
- final SyncInfoTree syncInfoSet;
- // TODO: May need to be modified to work with two-way
- if (set instanceof CheckedInChangeSet) {
- syncInfoSet = checkedInCollector.getSyncInfoSet(set);
- } else {
- syncInfoSet = activeCollector.getSyncInfoSet(set);
- }
- if (syncInfoSet != null)
- createChangeSetModelElement(set, syncInfoSet);
- }
-
- @Override
+ final SyncInfoTree syncInfoSet;
+ // TODO: May need to be modified to work with two-way
+ if (set instanceof CheckedInChangeSet) {
+ syncInfoSet = checkedInCollector.getSyncInfoSet(set);
+ } else {
+ syncInfoSet = activeCollector.getSyncInfoSet(set);
+ }
+ if (syncInfoSet != null)
+ createChangeSetModelElement(set, syncInfoSet);
+ }
+
+ @Override
public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
- refreshLabel(previousDefault);
- refreshLabel(set);
- }
+ refreshLabel(previousDefault);
+ refreshLabel(set);
+ }
- @Override
+ @Override
public void setRemoved(final ChangeSet set) {
- removeModelElementForSet(set);
- }
+ removeModelElementForSet(set);
+ }
- @Override
+ @Override
public void nameChanged(final ChangeSet set) {
- refreshLabel(set);
- }
+ refreshLabel(set);
+ }
- @Override
+ @Override
public void resourcesChanged(ChangeSet set, IPath[] paths) {
- // The sub-providers listen directly to the sets for changes
- // There is no global action to be taken for such changes
- }
- };
+ // The sub-providers listen directly to the sets for changes
+ // There is no global action to be taken for such changes
+ }
+ };
- private ActiveChangeSetCollector activeCollector;
+ private ActiveChangeSetCollector activeCollector;
/* *****************************************************************************
* Descriptor for this model provider
@@ -113,288 +113,288 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
};
private static final ChangeSetModelProviderDescriptor descriptor = new ChangeSetModelProviderDescriptor();
- protected ChangeSetModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set, String subProvierId) {
- super(configuration, set);
- this.subProvierId = subProvierId;
- ChangeSetCapability changeSetCapability = getChangeSetCapability();
- if (changeSetCapability.supportsCheckedInChangeSets()) {
- checkedInCollector = changeSetCapability.createSyncInfoSetChangeSetCollector(configuration);
- checkedInCollector.setProvider(this);
- checkedInCollector.addListener(changeSetListener);
- }
- if (changeSetCapability.supportsActiveChangeSets()) {
- activeCollector = new ActiveChangeSetCollector(configuration, this);
- activeCollector.setChangeSetChangeListener(changeSetListener);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, ChangeSetActionGroup.CHANGE_SET_GROUP);
- }
- }
-
- @Override
+ protected ChangeSetModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set, String subProvierId) {
+ super(configuration, set);
+ this.subProvierId = subProvierId;
+ ChangeSetCapability changeSetCapability = getChangeSetCapability();
+ if (changeSetCapability.supportsCheckedInChangeSets()) {
+ checkedInCollector = changeSetCapability.createSyncInfoSetChangeSetCollector(configuration);
+ checkedInCollector.setProvider(this);
+ checkedInCollector.addListener(changeSetListener);
+ }
+ if (changeSetCapability.supportsActiveChangeSets()) {
+ activeCollector = new ActiveChangeSetCollector(configuration, this);
+ activeCollector.setChangeSetChangeListener(changeSetListener);
+ configuration.addMenuGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, ChangeSetActionGroup.CHANGE_SET_GROUP);
+ }
+ }
+
+ @Override
protected void handleChanges(ISyncInfoTreeChangeEvent event, IProgressMonitor monitor) {
- boolean handled = false;
- if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- checkedInCollector.handleChange(event);
- handled = true;
- }
- if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
- activeCollector.handleChange(event);
- handled = true;
- }
- if (!handled) {
- // Forward the event to the root provider
- ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
- if (provider != null) {
- SyncInfoSet set = provider.getSyncInfoSet();
- try {
- set.beginInput();
- set.removeAll(event.getRemovedResources());
- SyncInfo[] added = event.getAddedResources();
- for (int i = 0; i < added.length; i++) {
- SyncInfo info = added[i];
- set.add(info);
- }
- SyncInfo[] changed = event.getChangedResources();
- for (int i = 0; i < changed.length; i++) {
- SyncInfo info = changed[i];
- set.add(info);
- }
- } finally {
- set.endInput(monitor);
- }
- }
- }
- }
-
- @Override
+ boolean handled = false;
+ if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
+ checkedInCollector.handleChange(event);
+ handled = true;
+ }
+ if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ activeCollector.handleChange(event);
+ handled = true;
+ }
+ if (!handled) {
+ // Forward the event to the root provider
+ ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
+ if (provider != null) {
+ SyncInfoSet set = provider.getSyncInfoSet();
+ try {
+ set.beginInput();
+ set.removeAll(event.getRemovedResources());
+ SyncInfo[] added = event.getAddedResources();
+ for (int i = 0; i < added.length; i++) {
+ SyncInfo info = added[i];
+ set.add(info);
+ }
+ SyncInfo[] changed = event.getChangedResources();
+ for (int i = 0; i < changed.length; i++) {
+ SyncInfo info = changed[i];
+ set.add(info);
+ }
+ } finally {
+ set.endInput(monitor);
+ }
+ }
+ }
+ }
+
+ @Override
protected void handleAddition(SyncInfo info) {
- // Nothing to do since change handling was bypassed
- }
+ // Nothing to do since change handling was bypassed
+ }
- @Override
+ @Override
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
- // This method is invoked on a reset after the provider state has been cleared.
- // Resetting the collector will rebuild the model
+ // This method is invoked on a reset after the provider state has been cleared.
+ // Resetting the collector will rebuild the model
if (node == getModelRoot()) {
- // First, disable the collectors
- if (checkedInCollector != null) {
- checkedInCollector.reset(null);
- checkedInCollector.removeListener(changeSetListener);
- }
- if (activeCollector != null) {
- activeCollector.setChangeSetChangeListener(null);
- activeCollector.reset(null);
- }
-
- // Then, re-enable the proper collection method
- boolean handled = false;
- if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- checkedInCollector.addListener(changeSetListener);
- checkedInCollector.reset(getSyncInfoSet());
- handled = true;
- }
- if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
- activeCollector.setChangeSetChangeListener(changeSetListener);
- activeCollector.reset(getSyncInfoSet());
- handled = true;
- }
- if (!handled) {
- // Forward the sync info to the root provider and trigger a build
- ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
- if (provider != null) {
- ((SynchronizeModelProvider)provider).getSyncInfoSet().addAll(getSyncInfoSet());
- }
- }
+ // First, disable the collectors
+ if (checkedInCollector != null) {
+ checkedInCollector.reset(null);
+ checkedInCollector.removeListener(changeSetListener);
+ }
+ if (activeCollector != null) {
+ activeCollector.setChangeSetChangeListener(null);
+ activeCollector.reset(null);
+ }
+
+ // Then, re-enable the proper collection method
+ boolean handled = false;
+ if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
+ checkedInCollector.addListener(changeSetListener);
+ checkedInCollector.reset(getSyncInfoSet());
+ handled = true;
+ }
+ if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ activeCollector.setChangeSetChangeListener(changeSetListener);
+ activeCollector.reset(getSyncInfoSet());
+ handled = true;
+ }
+ if (!handled) {
+ // Forward the sync info to the root provider and trigger a build
+ ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
+ if (provider != null) {
+ ((SynchronizeModelProvider)provider).getSyncInfoSet().addAll(getSyncInfoSet());
+ }
+ }
}
return new IDiffElement[0];
- }
+ }
- @Override
+ @Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
- return descriptor;
- }
+ return descriptor;
+ }
- @Override
+ @Override
public ViewerSorter getViewerSorter() {
- if (viewerSorter == null) {
- viewerSorter = new ChangeSetModelSorter(this, ChangeSetActionGroup.getSortCriteria(getConfiguration()));
- }
- return viewerSorter;
- }
-
- /*
- * Method to allow ChangeSetActionGroup to set the viewer sorter of this provider.
- */
- public void setViewerSorter(ViewerSorter viewerSorter) {
- this.viewerSorter = viewerSorter;
- firePropertyChange(ISynchronizeModelProvider.P_VIEWER_SORTER, null, null);
- }
-
- @Override
+ if (viewerSorter == null) {
+ viewerSorter = new ChangeSetModelSorter(this, ChangeSetActionGroup.getSortCriteria(getConfiguration()));
+ }
+ return viewerSorter;
+ }
+
+ /*
+ * Method to allow ChangeSetActionGroup to set the viewer sorter of this provider.
+ */
+ public void setViewerSorter(ViewerSorter viewerSorter) {
+ this.viewerSorter = viewerSorter;
+ firePropertyChange(ISynchronizeModelProvider.P_VIEWER_SORTER, null, null);
+ }
+
+ @Override
protected SynchronizePageActionGroup createActionGroup() {
- return new ChangeSetActionGroup(this);
- }
+ return new ChangeSetActionGroup(this);
+ }
- private ISynchronizeModelProvider createProviderRootedAt(ISynchronizeModelElement parent, SyncInfoTree set) {
- ISynchronizeModelProvider provider = createModelProvider(parent, getSubproviderId(), set);
- addProvider(provider);
- rootToProvider.put(parent, provider);
- return provider;
- }
+ private ISynchronizeModelProvider createProviderRootedAt(ISynchronizeModelElement parent, SyncInfoTree set) {
+ ISynchronizeModelProvider provider = createModelProvider(parent, getSubproviderId(), set);
+ addProvider(provider);
+ rootToProvider.put(parent, provider);
+ return provider;
+ }
- private ISynchronizeModelProvider getProviderRootedAt(ISynchronizeModelElement parent) {
- return rootToProvider.get(parent);
- }
+ private ISynchronizeModelProvider getProviderRootedAt(ISynchronizeModelElement parent) {
+ return rootToProvider.get(parent);
+ }
- @Override
+ @Override
protected void removeProvider(ISynchronizeModelProvider provider) {
- rootToProvider.remove(provider.getModelRoot());
- super.removeProvider(provider);
- }
-
- /**
- * Return the id of the sub-provider used by the commit set provider.
- * @return the id of the sub-provider used by the commit set provider
- */
- public String getSubproviderId() {
- return subProvierId;
- }
-
- /**
- * Return the sorter associated with the sub-provider being used.
- * @return the sorter associated with the sub-provider being used
- */
- public ViewerSorter getEmbeddedSorter() {
- return embeddedSorter;
- }
-
- @Override
+ rootToProvider.remove(provider.getModelRoot());
+ super.removeProvider(provider);
+ }
+
+ /**
+ * Return the id of the sub-provider used by the commit set provider.
+ * @return the id of the sub-provider used by the commit set provider
+ */
+ public String getSubproviderId() {
+ return subProvierId;
+ }
+
+ /**
+ * Return the sorter associated with the sub-provider being used.
+ * @return the sorter associated with the sub-provider being used
+ */
+ public ViewerSorter getEmbeddedSorter() {
+ return embeddedSorter;
+ }
+
+ @Override
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
- super.recursiveClearModelObjects(node);
- if (node == getModelRoot()) {
- rootToProvider.clear();
- // Throw away the embedded sorter
- embeddedSorter = null;
- createRootProvider();
- }
- }
-
- /*
- * Create the root subprovider which is used to display resources
- * that are not in a commit set. This provider is created even if
- * it is empty so we can have access to the appropriate sorter
- * and action group
- */
- private void createRootProvider() {
- // Recreate the sub-provider at the root and use it's viewer sorter and action group
- SyncInfoTree tree;
- if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
- // When in outgoing mode, use the root set of the active change set collector at the root
- tree = activeCollector.getRootSet();
- } else {
- tree = new SyncInfoTree();
- }
- final ISynchronizeModelProvider provider = createProviderRootedAt(getModelRoot(), tree);
- embeddedSorter = provider.getViewerSorter();
- if (provider instanceof AbstractSynchronizeModelProvider) {
- SynchronizePageActionGroup actionGroup = ((AbstractSynchronizeModelProvider)provider).getActionGroup();
- if (actionGroup != null) {
- // This action group will be disposed when the provider is disposed
- getConfiguration().addActionContribution(actionGroup);
- provider.addPropertyChangeListener(event -> {
- if (event.getProperty().equals(P_VIEWER_SORTER)) {
- embeddedSorter = provider.getViewerSorter();
- ChangeSetModelProvider.this.firePropertyChange(P_VIEWER_SORTER, null, null);
- }
+ super.recursiveClearModelObjects(node);
+ if (node == getModelRoot()) {
+ rootToProvider.clear();
+ // Throw away the embedded sorter
+ embeddedSorter = null;
+ createRootProvider();
+ }
+ }
+
+ /*
+ * Create the root subprovider which is used to display resources
+ * that are not in a commit set. This provider is created even if
+ * it is empty so we can have access to the appropriate sorter
+ * and action group
+ */
+ private void createRootProvider() {
+ // Recreate the sub-provider at the root and use it's viewer sorter and action group
+ SyncInfoTree tree;
+ if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ // When in outgoing mode, use the root set of the active change set collector at the root
+ tree = activeCollector.getRootSet();
+ } else {
+ tree = new SyncInfoTree();
+ }
+ final ISynchronizeModelProvider provider = createProviderRootedAt(getModelRoot(), tree);
+ embeddedSorter = provider.getViewerSorter();
+ if (provider instanceof AbstractSynchronizeModelProvider) {
+ SynchronizePageActionGroup actionGroup = ((AbstractSynchronizeModelProvider)provider).getActionGroup();
+ if (actionGroup != null) {
+ // This action group will be disposed when the provider is disposed
+ getConfiguration().addActionContribution(actionGroup);
+ provider.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(P_VIEWER_SORTER)) {
+ embeddedSorter = provider.getViewerSorter();
+ ChangeSetModelProvider.this.firePropertyChange(P_VIEWER_SORTER, null, null);
+ }
});
- }
- }
- }
-
- /*
- * Find the root element for the given change set.
- * A linear search is used.
- */
- protected ISynchronizeModelElement getModelElement(ChangeSet set) {
- IDiffElement[] children = getModelRoot().getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement element = children[i];
- if (element instanceof ChangeSetDiffNode && ((ChangeSetDiffNode)element).getSet() == set) {
- return (ISynchronizeModelElement)element;
- }
- }
- return null;
- }
-
- /*
- * Return the change set capability
- */
- public ChangeSetCapability getChangeSetCapability() {
- ISynchronizeParticipant participant = getConfiguration().getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- return provider.getChangeSetCapability();
- }
- return null;
- }
-
- @Override
+ }
+ }
+ }
+
+ /*
+ * Find the root element for the given change set.
+ * A linear search is used.
+ */
+ protected ISynchronizeModelElement getModelElement(ChangeSet set) {
+ IDiffElement[] children = getModelRoot().getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IDiffElement element = children[i];
+ if (element instanceof ChangeSetDiffNode && ((ChangeSetDiffNode)element).getSet() == set) {
+ return (ISynchronizeModelElement)element;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Return the change set capability
+ */
+ public ChangeSetCapability getChangeSetCapability() {
+ ISynchronizeParticipant participant = getConfiguration().getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ IChangeSetProvider provider = (IChangeSetProvider) participant;
+ return provider.getChangeSetCapability();
+ }
+ return null;
+ }
+
+ @Override
public void dispose() {
- if (checkedInCollector != null) {
- checkedInCollector.removeListener(changeSetListener);
- checkedInCollector.dispose();
- }
- if (activeCollector != null) {
- activeCollector.setChangeSetChangeListener(null);
- activeCollector.dispose();
- }
- super.dispose();
- }
-
-
- @Override
+ if (checkedInCollector != null) {
+ checkedInCollector.removeListener(changeSetListener);
+ checkedInCollector.dispose();
+ }
+ if (activeCollector != null) {
+ activeCollector.setChangeSetChangeListener(null);
+ activeCollector.dispose();
+ }
+ super.dispose();
+ }
+
+
+ @Override
public void waitUntilDone(IProgressMonitor monitor) {
- super.waitUntilDone(monitor);
- if (checkedInCollector != null) {
- checkedInCollector.waitUntilDone(monitor);
- // Wait for the provider again since the change set handler may have queued UI updates
- super.waitUntilDone(monitor);
- }
- }
-
- void removeModelElementForSet(final ChangeSet set) {
- ISynchronizeModelElement node = getModelElement(set);
- if (node != null) {
- ISynchronizeModelProvider provider = getProviderRootedAt(node);
- removeFromViewer(new ISynchronizeModelElement[] { node });
- removeProvider(provider);
- }
- }
-
- public void createChangeSetModelElement(ChangeSet set, SyncInfoTree tree) {
- // Add the model element and provider for the set
- ISynchronizeModelElement node = getModelElement(set);
- ISynchronizeModelProvider provider = null;
- if (node != null) {
- provider = getProviderRootedAt(node);
- }
- if (provider == null) {
- provider = createProvider(set, tree);
- provider.prepareInput(null);
- }
- }
-
- private ISynchronizeModelProvider createProvider(ChangeSet set, SyncInfoTree tree) {
- ChangeSetDiffNode node = new ChangeSetDiffNode(getModelRoot(), set);
- addToViewer(node);
- return createProviderRootedAt(node, tree);
- }
-
- public void refreshLabel(ChangeSet set) {
- ISynchronizeModelElement node = getModelElement(set);
- if (node != null) {
- getViewer().refresh(node);
- }
- }
+ super.waitUntilDone(monitor);
+ if (checkedInCollector != null) {
+ checkedInCollector.waitUntilDone(monitor);
+ // Wait for the provider again since the change set handler may have queued UI updates
+ super.waitUntilDone(monitor);
+ }
+ }
+
+ void removeModelElementForSet(final ChangeSet set) {
+ ISynchronizeModelElement node = getModelElement(set);
+ if (node != null) {
+ ISynchronizeModelProvider provider = getProviderRootedAt(node);
+ removeFromViewer(new ISynchronizeModelElement[] { node });
+ removeProvider(provider);
+ }
+ }
+
+ public void createChangeSetModelElement(ChangeSet set, SyncInfoTree tree) {
+ // Add the model element and provider for the set
+ ISynchronizeModelElement node = getModelElement(set);
+ ISynchronizeModelProvider provider = null;
+ if (node != null) {
+ provider = getProviderRootedAt(node);
+ }
+ if (provider == null) {
+ provider = createProvider(set, tree);
+ provider.prepareInput(null);
+ }
+ }
+
+ private ISynchronizeModelProvider createProvider(ChangeSet set, SyncInfoTree tree) {
+ ChangeSetDiffNode node = new ChangeSetDiffNode(getModelRoot(), set);
+ addToViewer(node);
+ return createProviderRootedAt(node, tree);
+ }
+
+ public void refreshLabel(ChangeSet set) {
+ ISynchronizeModelElement node = getModelElement(set);
+ if (node != null) {
+ getViewer().refresh(node);
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java
index 63c91f990..1914bed1e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java
@@ -44,11 +44,11 @@ public class ChangeSetModelSorter extends ViewerSorter {
protected int classComparison(Object element) {
if (element instanceof ChangeSetDiffNode) {
- ChangeSet set = ((ChangeSetDiffNode)element).getSet();
- if (set instanceof ActiveChangeSet) {
- return 0;
- }
- return 1;
+ ChangeSet set = ((ChangeSetDiffNode)element).getSet();
+ if (set instanceof ActiveChangeSet) {
+ return 0;
+ }
+ return 1;
}
return 2;
}
@@ -75,14 +75,14 @@ public class ChangeSetModelSorter extends ViewerSorter {
//if one or both objects are not resources, returned a comparison
//based on class.
if (o1 instanceof ChangeSetDiffNode && o2 instanceof ChangeSetDiffNode) {
- ChangeSet s1 = ((ChangeSetDiffNode) o1).getSet();
- ChangeSet s2 = ((ChangeSetDiffNode) o2).getSet();
- if (s1 instanceof ActiveChangeSet && s2 instanceof ActiveChangeSet) {
- return compareNames(((ActiveChangeSet)s1).getTitle(), ((ActiveChangeSet)s2).getTitle());
- }
- if (s1 instanceof CheckedInChangeSet && s2 instanceof CheckedInChangeSet) {
- CheckedInChangeSet r1 = (CheckedInChangeSet)s1;
- CheckedInChangeSet r2 = (CheckedInChangeSet)s2;
+ ChangeSet s1 = ((ChangeSetDiffNode) o1).getSet();
+ ChangeSet s2 = ((ChangeSetDiffNode) o2).getSet();
+ if (s1 instanceof ActiveChangeSet && s2 instanceof ActiveChangeSet) {
+ return compareNames(((ActiveChangeSet)s1).getTitle(), ((ActiveChangeSet)s2).getTitle());
+ }
+ if (s1 instanceof CheckedInChangeSet && s2 instanceof CheckedInChangeSet) {
+ CheckedInChangeSet r1 = (CheckedInChangeSet)s1;
+ CheckedInChangeSet r2 = (CheckedInChangeSet)s2;
if (commentCriteria == DATE)
return compareDates(r1.getDate(), r2.getDate());
else if (commentCriteria == COMMENT)
@@ -91,25 +91,25 @@ public class ChangeSetModelSorter extends ViewerSorter {
return compareNames(r1.getAuthor(), r2.getAuthor());
else
return 0;
- }
- if (s1 instanceof ActiveChangeSet) {
- return -1;
- } else if (s2 instanceof ActiveChangeSet) {
- return 1;
- }
- if (s1 instanceof CheckedInChangeSet) {
- return -1;
- } else if (s2 instanceof CheckedInChangeSet) {
- return 1;
- }
+ }
+ if (s1 instanceof ActiveChangeSet) {
+ return -1;
+ } else if (s2 instanceof ActiveChangeSet) {
+ return 1;
+ }
+ if (s1 instanceof CheckedInChangeSet) {
+ return -1;
+ } else if (s2 instanceof CheckedInChangeSet) {
+ return 1;
+ }
}
if (o1 instanceof ISynchronizeModelElement && o2 instanceof ISynchronizeModelElement) {
ViewerSorter embeddedSorter = provider.getEmbeddedSorter();
if (embeddedSorter != null) {
- return embeddedSorter.compare(viewer, o1, o2);
+ return embeddedSorter.compare(viewer, o1, o2);
} else {
- return compareNames(((ISynchronizeModelElement)o1).getName(), ((ISynchronizeModelElement)o2).getName());
+ return compareNames(((ISynchronizeModelElement)o1).getName(), ((ISynchronizeModelElement)o2).getName());
}
} else if (o1 instanceof ISynchronizeModelElement)
return 1;
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 e6d15e509..e3a55a7f2 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
@@ -36,160 +36,160 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
*/
public abstract class CompositeModelProvider extends AbstractSynchronizeModelProvider {
- private final List<ISynchronizeModelProvider> providers = new ArrayList<>();
- private final Map<IResource, List <ISynchronizeModelElement>> resourceToElements = new HashMap<>();
- private final Map<ISynchronizeModelElement, AbstractSynchronizeModelProvider> elementToProvider = new HashMap<>();
+ private final List<ISynchronizeModelProvider> providers = new ArrayList<>();
+ private final Map<IResource, List <ISynchronizeModelElement>> resourceToElements = new HashMap<>();
+ private final Map<ISynchronizeModelElement, AbstractSynchronizeModelProvider> elementToProvider = new HashMap<>();
- protected CompositeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(configuration, set);
- }
+ protected CompositeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(configuration, set);
+ }
- /**
- * Add the provider to the list of providers.
- * @param provider the provider to be added
- */
- protected void addProvider(ISynchronizeModelProvider provider) {
- providers.add(provider);
- }
+ /**
+ * Add the provider to the list of providers.
+ * @param provider the provider to be added
+ */
+ protected void addProvider(ISynchronizeModelProvider provider) {
+ providers.add(provider);
+ }
- /**
- * Remove the provider from the list of providers.
- * @param provider the provider to be removed
- */
- protected void removeProvider(ISynchronizeModelProvider provider) {
- providers.remove(provider);
- provider.dispose();
- }
+ /**
+ * Remove the provider from the list of providers.
+ * @param provider the provider to be removed
+ */
+ protected void removeProvider(ISynchronizeModelProvider provider) {
+ providers.remove(provider);
+ provider.dispose();
+ }
- @Override
+ @Override
protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element) {
- return elementToProvider.get(element);
- }
+ return elementToProvider.get(element);
+ }
- @Override
+ @Override
public ISynchronizeModelElement[] getClosestExistingParents(IResource resource) {
- ISynchronizeModelProvider[] providers = getProviders();
- if (providers.length == 0) {
- return new ISynchronizeModelElement[0];
- }
- if (providers.length == 1 && providers[0] instanceof AbstractSynchronizeModelProvider) {
- return ((AbstractSynchronizeModelProvider)providers[0]).getClosestExistingParents(resource);
- }
- List<ISynchronizeModelElement> result = new ArrayList<>();
- for (int i = 0; i < providers.length; i++) {
- ISynchronizeModelProvider provider = providers[i];
- if (provider instanceof AbstractSynchronizeModelProvider) {
- ISynchronizeModelElement[] elements = ((AbstractSynchronizeModelProvider)provider).getClosestExistingParents(resource);
- for (int j = 0; j < elements.length; j++) {
- ISynchronizeModelElement element = elements[j];
- result.add(element);
- }
- }
- }
- return result.toArray(new ISynchronizeModelElement[result.size()]);
- }
+ ISynchronizeModelProvider[] providers = getProviders();
+ if (providers.length == 0) {
+ return new ISynchronizeModelElement[0];
+ }
+ if (providers.length == 1 && providers[0] instanceof AbstractSynchronizeModelProvider) {
+ return ((AbstractSynchronizeModelProvider)providers[0]).getClosestExistingParents(resource);
+ }
+ List<ISynchronizeModelElement> result = new ArrayList<>();
+ for (int i = 0; i < providers.length; i++) {
+ ISynchronizeModelProvider provider = providers[i];
+ if (provider instanceof AbstractSynchronizeModelProvider) {
+ ISynchronizeModelElement[] elements = ((AbstractSynchronizeModelProvider)provider).getClosestExistingParents(resource);
+ for (int j = 0; j < elements.length; j++) {
+ ISynchronizeModelElement element = elements[j];
+ result.add(element);
+ }
+ }
+ }
+ return result.toArray(new ISynchronizeModelElement[result.size()]);
+ }
- /**
- * Return all the sub-providers of this composite.
- * @return the sub-providers of this composite
- */
- protected ISynchronizeModelProvider[] getProviders() {
- return providers.toArray(new ISynchronizeModelProvider[providers.size()]);
- }
+ /**
+ * Return all the sub-providers of this composite.
+ * @return the sub-providers of this composite
+ */
+ protected ISynchronizeModelProvider[] getProviders() {
+ return providers.toArray(new ISynchronizeModelProvider[providers.size()]);
+ }
- /**
- * Return the providers that are displaying the given resource.
- * @param resource the resource
- * @return the providers displaying the resource
- */
- protected ISynchronizeModelProvider[] getProvidersContaining(IResource resource) {
- List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
- if (elements == null || elements.isEmpty()) {
- return new ISynchronizeModelProvider[0];
- }
- List<ISynchronizeModelProvider> result = new ArrayList<>();
- for (Iterator<ISynchronizeModelElement> iter = elements.iterator(); iter.hasNext();) {
- ISynchronizeModelElement element = iter.next();
- result.add(getProvider(element));
- }
- return result.toArray(new ISynchronizeModelProvider[result.size()]);
- }
+ /**
+ * Return the providers that are displaying the given resource.
+ * @param resource the resource
+ * @return the providers displaying the resource
+ */
+ protected ISynchronizeModelProvider[] getProvidersContaining(IResource resource) {
+ List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
+ if (elements == null || elements.isEmpty()) {
+ return new ISynchronizeModelProvider[0];
+ }
+ List<ISynchronizeModelProvider> result = new ArrayList<>();
+ for (Iterator<ISynchronizeModelElement> iter = elements.iterator(); iter.hasNext();) {
+ ISynchronizeModelElement element = iter.next();
+ result.add(getProvider(element));
+ }
+ return result.toArray(new ISynchronizeModelProvider[result.size()]);
+ }
- @Override
+ @Override
protected final void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
- handleAdditions(event.getAddedResources());
- }
+ handleAdditions(event.getAddedResources());
+ }
- /**
- * Handle the resource additions by adding them to any existing
- * sub-providers or by creating addition sub-providers as needed.
- * @param resources
- */
- protected void handleAdditions(SyncInfo[] resources) {
- for (int i = 0; i < resources.length; i++) {
- SyncInfo info = resources[i];
- handleAddition(info);
- }
- }
+ /**
+ * Handle the resource additions by adding them to any existing
+ * sub-providers or by creating addition sub-providers as needed.
+ * @param resources
+ */
+ protected void handleAdditions(SyncInfo[] resources) {
+ for (int i = 0; i < resources.length; i++) {
+ SyncInfo info = resources[i];
+ handleAddition(info);
+ }
+ }
- /**
- * Handle the addition of the given sync info to this provider
- * @param info the added sync info
- */
- protected abstract void handleAddition(SyncInfo info);
+ /**
+ * Handle the addition of the given sync info to this provider
+ * @param info the added sync info
+ */
+ protected abstract void handleAddition(SyncInfo info);
- @Override
+ @Override
protected final void handleResourceChanges(ISyncInfoTreeChangeEvent event) {
- SyncInfo[] infos = event.getChangedResources();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- handleChange(info);
- }
- }
+ SyncInfo[] infos = event.getChangedResources();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ handleChange(info);
+ }
+ }
- /**
- * The state of the sync info for a resource has changed. Propagate the
- * change to any sub-providers that contain the resource.
- * @param info the sync info for the resource whose sync state has changed
- */
- protected void handleChange(SyncInfo info) {
- handleRemoval(info.getLocal());
- handleAddition(info);
- }
+ /**
+ * The state of the sync info for a resource has changed. Propagate the
+ * change to any sub-providers that contain the resource.
+ * @param info the sync info for the resource whose sync state has changed
+ */
+ protected void handleChange(SyncInfo info) {
+ handleRemoval(info.getLocal());
+ handleAddition(info);
+ }
- @Override
+ @Override
protected final void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
- IResource[] resources = event.getRemovedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- handleRemoval(resource);
- }
- }
+ IResource[] resources = event.getRemovedResources();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ handleRemoval(resource);
+ }
+ }
- /**
- * Remove the resource from all providers that are displaying it
- * @param resource the resource to be removed
- */
- protected void handleRemoval(IResource resource) {
- ISynchronizeModelProvider[] providers = getProvidersContaining(resource);
- for (int i = 0; i < providers.length; i++) {
- ISynchronizeModelProvider provider = providers[i];
- removeFromProvider(resource, provider);
- }
- }
+ /**
+ * Remove the resource from all providers that are displaying it
+ * @param resource the resource to be removed
+ */
+ protected void handleRemoval(IResource resource) {
+ ISynchronizeModelProvider[] providers = getProvidersContaining(resource);
+ for (int i = 0; i < providers.length; i++) {
+ ISynchronizeModelProvider provider = providers[i];
+ removeFromProvider(resource, provider);
+ }
+ }
- /**
- * Remove the resource from the sync set of the given provider
- * unless the provider is this composite. Subclasses can
- * override if they show resources directly.
- * @param resource the resource to be removed
- * @param provider the provider from which to remove the resource
- */
- protected void removeFromProvider(IResource resource, ISynchronizeModelProvider provider) {
- if (provider != this) {
- provider.getSyncInfoSet().remove(resource);
- }
- }
+ /**
+ * Remove the resource from the sync set of the given provider
+ * unless the provider is this composite. Subclasses can
+ * override if they show resources directly.
+ * @param resource the resource to be removed
+ * @param provider the provider from which to remove the resource
+ */
+ protected void removeFromProvider(IResource resource, ISynchronizeModelProvider provider) {
+ if (provider != this) {
+ provider.getSyncInfoSet().remove(resource);
+ }
+ }
@Override
protected void nodeAdded(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
@@ -207,49 +207,49 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
super.nodeAdded(node, provider);
}
- @Override
+ @Override
public void modelObjectCleared(ISynchronizeModelElement node) {
- super.modelObjectCleared(node);
- IResource r = node.getResource();
+ super.modelObjectCleared(node);
+ IResource r = node.getResource();
if(r != null) {
List elements = resourceToElements.get(r);
if(elements != null) {
elements.remove(node);
if (elements.isEmpty()) {
- resourceToElements.remove(r);
+ resourceToElements.remove(r);
}
}
}
elementToProvider.remove(node);
- }
+ }
- @Override
+ @Override
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
- super.recursiveClearModelObjects(node);
- if (node == getModelRoot()) {
- clearProviders();
- }
- }
+ super.recursiveClearModelObjects(node);
+ if (node == getModelRoot()) {
+ clearProviders();
+ }
+ }
- private void clearProviders() {
- for (Iterator iter = providers.iterator(); iter.hasNext();) {
- ISynchronizeModelProvider provider = (ISynchronizeModelProvider) iter.next();
- provider.dispose();
- }
- providers.clear();
- resourceToElements.clear();
- elementToProvider.clear();
- }
+ private void clearProviders() {
+ for (Iterator iter = providers.iterator(); iter.hasNext();) {
+ ISynchronizeModelProvider provider = (ISynchronizeModelProvider) iter.next();
+ provider.dispose();
+ }
+ providers.clear();
+ resourceToElements.clear();
+ 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
- */
+ /**
+ * 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, SyncInfoTree syncInfoTree) {
- if (id != null && id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
- return new FlatModelProvider(this, parent, getConfiguration(), syncInfoTree);
+ if (id != null && id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
+ return new FlatModelProvider(this, parent, getConfiguration(), syncInfoTree);
} else if (id != null && id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
return new CompressedFoldersModelProvider(this, parent, getConfiguration(), syncInfoTree);
} else {
@@ -257,23 +257,23 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
}
}
- @Override
+ @Override
public void dispose() {
- clearProviders();
- super.dispose();
- }
+ clearProviders();
+ super.dispose();
+ }
- @Override
+ @Override
protected boolean hasViewerState() {
- return resourceToElements != null && !resourceToElements.isEmpty();
- }
+ return resourceToElements != null && !resourceToElements.isEmpty();
+ }
- @Override
+ @Override
protected ISynchronizeModelElement[] getModelObjects(IResource resource) {
- List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
- if (elements == null) {
- return new ISynchronizeModelElement[0];
- }
- return elements.toArray(new ISynchronizeModelElement[elements.size()]);
- }
+ List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
+ if (elements == null) {
+ return new ISynchronizeModelElement[0];
+ }
+ return elements.toArray(new ISynchronizeModelElement[elements.size()]);
+ }
}
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 cc72e1456..e2f967c15 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
@@ -99,12 +99,12 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
super(configuration, set);
}
- public CompressedFoldersModelProvider(
- AbstractSynchronizeModelProvider parentProvider,
- ISynchronizeModelElement modelRoot,
- ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(parentProvider, modelRoot, configuration, set);
- }
+ public CompressedFoldersModelProvider(
+ AbstractSynchronizeModelProvider parentProvider,
+ ISynchronizeModelElement modelRoot,
+ ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(parentProvider, modelRoot, configuration, set);
+ }
@Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
@@ -272,27 +272,27 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
if (resource.getType() == IResource.FILE) {
if (isCompressedParentEmpty(resource) && !isOutOfSync(resource.getParent())) {
// The parent compressed folder is also empty so remove it
- resourcesToRemove.add(resource.getParent());
+ resourcesToRemove.add(resource.getParent());
} else {
- resourcesToRemove.add(resource);
+ resourcesToRemove.add(resource);
}
} else {
// A folder has been removed (i.e. is in-sync)
// but may still contain children
- resourcesToRemove.add(resource);
- resourcesToAdd.addAll(Arrays.asList(getSyncInfosForFileMembers((IContainer)resource)));
+ resourcesToRemove.add(resource);
+ resourcesToAdd.addAll(Arrays.asList(getSyncInfosForFileMembers((IContainer)resource)));
}
}
}
if (!resourcesToRemove.isEmpty()) {
- removeFromViewer(resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
+ removeFromViewer(resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
}
if (!resourcesToAdd.isEmpty()) {
- addResources(resourcesToAdd.toArray(new SyncInfo[resourcesToAdd.size()]));
+ addResources(resourcesToAdd.toArray(new SyncInfo[resourcesToAdd.size()]));
}
}
- @Override
+ @Override
protected int getLogicalModelDepth(IResource resource) {
if(resource.getType() == IResource.PROJECT) {
return IResource.DEPTH_INFINITE;
@@ -326,16 +326,16 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
private SyncInfo[] getSyncInfosForFileMembers(IContainer parent) {
// Check if the sync set has any file children of the parent
- List<SyncInfo> result = new ArrayList<>();
+ List<SyncInfo> result = new ArrayList<>();
IResource[] members = getSyncInfoTree().members(parent);
for (int i = 0; i < members.length; i++) {
SyncInfo info = getSyncInfoTree().getSyncInfo(members[i]);
if (info != null) {
- result.add(info);
+ result.add(info);
+ }
+ if (members[i] instanceof IContainer) {
+ result.addAll(Arrays.asList(this.getSyncInfosForFileMembers((IContainer)members[i])));
}
- if (members[i] instanceof IContainer) {
- result.addAll(Arrays.asList(this.getSyncInfosForFileMembers((IContainer)members[i])));
- }
}
return result.toArray(new SyncInfo[result.size()]);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
index 5c345e5c1..99381f2d3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
@@ -70,8 +70,8 @@ public class ConfigureRefreshScheduleDialog extends DetailsDialog {
protected void updateEnablements() {
}
- @Override
+ @Override
protected String getHelpContextId() {
- return IHelpContextIds.CONFIGURE_REFRESH_SCHEDULE_DIALOG;
- }
+ return IHelpContextIds.CONFIGURE_REFRESH_SCHEDULE_DIALOG;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java
index 0ac8ef88f..1323b9662 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java
@@ -150,7 +150,7 @@ public class FlatModelProvider extends SynchronizeModelProvider {
@Override
public void run() {
if (isChecked() && sortCriteria != criteria) {
- sortCriteria = criteria;
+ sortCriteria = criteria;
String key = getSettingsKey();
IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
@@ -166,7 +166,7 @@ public class FlatModelProvider extends SynchronizeModelProvider {
}
protected String getSettingsKey() {
- return P_LAST_RESOURCESORT;
+ return P_LAST_RESOURCESORT;
}
}
@@ -201,17 +201,17 @@ public class FlatModelProvider extends SynchronizeModelProvider {
}
}
- public FlatModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(configuration, set);
- initialize(configuration);
- }
+ public FlatModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(configuration, set);
+ initialize(configuration);
+ }
- public FlatModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement modelRoot, ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(parentProvider, modelRoot, configuration, set);
- initialize(configuration);
- }
+ public FlatModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement modelRoot, ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(parentProvider, modelRoot, configuration, set);
+ initialize(configuration);
+ }
- private void initialize(ISynchronizePageConfiguration configuration) {
+ private void initialize(ISynchronizePageConfiguration configuration) {
try {
IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
@@ -221,69 +221,69 @@ public class FlatModelProvider extends SynchronizeModelProvider {
// ignore and use the defaults.
}
switch (sortCriteria) {
- case FlatSorter.PATH:
- case FlatSorter.NAME:
- case FlatSorter.PARENT_NAME:
- break;
- default:
- sortCriteria = FlatSorter.PATH;
- break;
- }
- }
-
- @Override
+ case FlatSorter.PATH:
+ case FlatSorter.NAME:
+ case FlatSorter.PARENT_NAME:
+ break;
+ default:
+ sortCriteria = FlatSorter.PATH;
+ break;
+ }
+ }
+
+ @Override
protected SynchronizePageActionGroup createActionGroup() {
- return new FlatActionGroup();
- }
+ return new FlatActionGroup();
+ }
- @Override
+ @Override
public ViewerSorter getViewerSorter() {
return new FlatSorter(sortCriteria);
- }
+ }
- @Override
+ @Override
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
- if (node == getModelRoot());
- SyncInfo[] infos = getSyncInfoSet().getSyncInfos();
- List result = new ArrayList();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- result.add(createModelObject(node, info));
- }
- return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]);
- }
-
- @Override
+ if (node == getModelRoot());
+ SyncInfo[] infos = getSyncInfoSet().getSyncInfos();
+ List result = new ArrayList();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ result.add(createModelObject(node, info));
+ }
+ return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]);
+ }
+
+ @Override
protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
- addResources(event.getAddedResources());
- }
+ addResources(event.getAddedResources());
+ }
- @Override
+ @Override
protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
- IResource[] resources = event.getRemovedResources();
- removeFromViewer(resources);
- }
+ IResource[] resources = event.getRemovedResources();
+ removeFromViewer(resources);
+ }
- @Override
+ @Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
- return flatDescriptor;
- }
+ return flatDescriptor;
+ }
@Override
protected void addResource(SyncInfo info) {
// Add the node to the root
- ISynchronizeModelElement node = getModelObject(info.getLocal());
- if (node != null) {
- // Somehow the node exists. Remove it and read it to ensure
- // what is shown matches the contents of the sync set
- removeFromViewer(info.getLocal());
- }
+ ISynchronizeModelElement node = getModelObject(info.getLocal());
+ if (node != null) {
+ // Somehow the node exists. Remove it and read it to ensure
+ // what is shown matches the contents of the sync set
+ removeFromViewer(info.getLocal());
+ }
createModelObject(getModelRoot(), info);
}
@Override
protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info) {
- SynchronizeModelElement newNode = new FullPathSyncInfoElement(parent, info);
+ SynchronizeModelElement newNode = new FullPathSyncInfoElement(parent, info);
addToViewer(newNode);
return newNode;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
index d1712d3e2..0a21c362d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
@@ -106,9 +106,9 @@ public abstract class ForwardingChangesSection extends ChangesSection {
if (numChanges > 0) {
String message;
if(numChanges > 1) {
- message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesPlural, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
+ message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesPlural, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
} else {
- message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesSingular, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
+ message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesSingular, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
}
message = NLS.bind(TeamUIMessages.ChangesSection_filterHides, new String[] { Utils.modeToString(getConfiguration().getMode()), message });
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
index e42932b00..64cca1c54 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
@@ -87,7 +87,7 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
top.setLayoutData(data);
setControl(top);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_RESOURCE_SELECTION_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_RESOURCE_SELECTION_PAGE);
Label l = new Label(top, SWT.NULL);
l.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_5);
@@ -379,9 +379,9 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
}
protected void setWorkspaceSelected(boolean selected) {
- workingSetScope.setSelection(!selected);
- selectedResourcesScope.setSelection(!selected);
- participantScope.setSelection(selected);
+ workingSetScope.setSelection(!selected);
+ selectedResourcesScope.setSelection(!selected);
+ participantScope.setSelection(selected);
}
protected boolean isWorkingSetSelected() {
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 61278d117..d9b34c55a 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
@@ -27,7 +27,7 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
@Override
protected ISynchronizeModelProviderDescriptor[] getSupportedModelProviders() {
return new ISynchronizeModelProviderDescriptor[] {
- new FlatModelProvider.FlatModelProviderDescriptor(),
+ new FlatModelProvider.FlatModelProviderDescriptor(),
new HierarchicalModelProvider.HierarchicalModelProviderDescriptor(),
new CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor() };
}
@@ -38,7 +38,7 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
id = getDefaultProviderId();
}
if (id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
- return new FlatModelProvider(getConfiguration(), getSyncInfoSet());
+ return new FlatModelProvider(getConfiguration(), getSyncInfoSet());
} else if(id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
return new CompressedFoldersModelProvider(getConfiguration(), getSyncInfoSet());
} else {
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 8247b2452..bd5d3971f 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
@@ -83,12 +83,12 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
super(configuration, set);
}
- public HierarchicalModelProvider(
- AbstractSynchronizeModelProvider parentProvider,
- ISynchronizeModelElement modelRoot,
- ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(parentProvider, modelRoot, configuration, set);
- }
+ public HierarchicalModelProvider(
+ AbstractSynchronizeModelProvider parentProvider,
+ ISynchronizeModelElement modelRoot,
+ ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(parentProvider, modelRoot, configuration, set);
+ }
@Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
@@ -159,24 +159,24 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
protected void addResources(IResource[] added) {
for (int i = 0; i < added.length; i++) {
IResource resource = added[i];
- addResource(resource);
+ addResource(resource);
}
}
- private void addResource(IResource resource) {
- ISynchronizeModelElement node = getModelObject(resource);
- if (node != null) {
- // Somehow the node exists. Remove it and read it to ensure
- // what is shown matches the contents of the sync set
- removeFromViewer(resource);
- }
- // Build the sub-tree rooted at this node
- ISynchronizeModelElement parent = getModelObject(resource.getParent());
- if (parent != null) {
- node = createModelObject(parent, resource);
- buildModelObjects(node);
- }
- }
+ private void addResource(IResource resource) {
+ ISynchronizeModelElement node = getModelObject(resource);
+ if (node != null) {
+ // Somehow the node exists. Remove it and read it to ensure
+ // what is shown matches the contents of the sync set
+ removeFromViewer(resource);
+ }
+ // Build the sub-tree rooted at this node
+ ISynchronizeModelElement parent = getModelObject(resource.getParent());
+ if (parent != null) {
+ node = createModelObject(parent, resource);
+ buildModelObjects(node);
+ }
+ }
@Override
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
@@ -222,13 +222,13 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
}
}
- @Override
+ @Override
protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info) {
- return createModelObject(parent, info.getLocal());
- }
+ return createModelObject(parent, info.getLocal());
+ }
- @Override
+ @Override
protected void addResource(SyncInfo info) {
- addResource(info.getLocal());
- }
+ addResource(info.getLocal());
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java
index 2ab987df3..d3fabe5f1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java
@@ -20,11 +20,11 @@ package org.eclipse.team.internal.ui.synchronize;
*/
public interface IChangeSetProvider {
- /**
- * Return the change set capability for this participant or <code>null</code>
- * if change sets are not supported.
- * @return the change set capability for this participant
- * @since 3.1
- */
- public ChangeSetCapability getChangeSetCapability();
+ /**
+ * Return the change set capability for this participant or <code>null</code>
+ * if change sets are not supported.
+ * @return the change set capability for this participant
+ * @since 3.1
+ */
+ public ChangeSetCapability getChangeSetCapability();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java
index ac66d0a92..bbcc47756 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java
@@ -18,8 +18,8 @@ package org.eclipse.team.internal.ui.synchronize;
* @since 3.0
*/
public interface IPageValidator {
- /**
- * If errorMessage in <code>null</code> then the page is complete otherwise
+ /**
+ * If errorMessage in <code>null</code> then the page is complete otherwise
* the error message indicates that the reason why the page is not complete.
*/
public void setComplete(String errorMessage);
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 c4d91ec90..30ecf3f6e 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
@@ -29,13 +29,13 @@ import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
*/
public interface ISynchronizeModelProvider {
- /**
- * Property constant used to indicate that the viewer sorter has changed.
- * Property change notifications for the viewer sorter change do not include
- * the old and new viewer sorter. Instead, clients should re-obtain the sorter
- * from the provider.
- */
- public static final String P_VIEWER_SORTER = TeamUIPlugin.ID + ".P_VIEWER_SORTER"; //$NON-NLS-1$
+ /**
+ * Property constant used to indicate that the viewer sorter has changed.
+ * Property change notifications for the viewer sorter change do not include
+ * the old and new viewer sorter. Instead, clients should re-obtain the sorter
+ * from the provider.
+ */
+ public static final String P_VIEWER_SORTER = TeamUIPlugin.ID + ".P_VIEWER_SORTER"; //$NON-NLS-1$
/**
* Returns the sync set this model provider is showing.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
index 25d37b81d..01e63bfb6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
@@ -58,7 +58,7 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
private final CompareEditorInput editorInput;
private boolean isSaving;
private IContentChangeListener contentChangeListener;
- private ITypedElement fileElement;
+ private ITypedElement fileElement;
private IDocument document;
/**
@@ -123,7 +123,7 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
// Discard of the buffer
ITypedElement left = getFileElement();
if (left instanceof LocalResourceTypedElement)
- ((LocalResourceTypedElement) left).discardBuffer();
+ ((LocalResourceTypedElement) left).discardBuffer();
document = null;
}
@@ -245,7 +245,7 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
// Only the left is ever editable
ITypedElement left = getFileElement();
if (left instanceof LocalResourceTypedElement)
- ((LocalResourceTypedElement) left).discardBuffer();
+ ((LocalResourceTypedElement) left).discardBuffer();
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
index 1be2a0b6d..f5a42ae35 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
@@ -97,17 +97,17 @@ public class RefreshModelParticipantJob extends RefreshParticipantJob {
return ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree().size();
}
- @Override
+ @Override
protected int getIncomingChangeCount() {
- IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
- return (int) diffTree.countFor(IThreeWayDiff.INCOMING, IThreeWayDiff.DIRECTION_MASK);
- }
+ IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
+ return (int) diffTree.countFor(IThreeWayDiff.INCOMING, IThreeWayDiff.DIRECTION_MASK);
+ }
- @Override
+ @Override
protected int getOutgoingChangeCount() {
- IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
- return (int) diffTree.countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
- }
+ IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
+ return (int) diffTree.countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
+ }
@Override
protected void handleProgressGroupSet(IProgressMonitor group, int ticks) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
index 8ed33cc10..23402f815 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
@@ -116,49 +116,49 @@ public abstract class RefreshParticipantJob extends Job {
* that have occurred during the refresh
*/
private final class GotoActionWrapper extends WorkbenchAction {
- private ActionFactory.IWorkbenchAction gotoAction;
- private IStatus status;
- @Override
+ private ActionFactory.IWorkbenchAction gotoAction;
+ private IStatus status;
+ @Override
public void run() {
- if (status != null && !status.isOK()) {
- ErrorDialog.openError(Utils.getShell(null), null, TeamUIMessages.RefreshSubscriberJob_3, status);
- } else if(gotoAction != null) {
- gotoAction.run();
- }
- }
- @Override
+ if (status != null && !status.isOK()) {
+ ErrorDialog.openError(Utils.getShell(null), null, TeamUIMessages.RefreshSubscriberJob_3, status);
+ } else if(gotoAction != null) {
+ gotoAction.run();
+ }
+ }
+ @Override
public boolean isEnabled() {
- if(gotoAction != null) {
- return gotoAction.isEnabled();
- }
- return true;
- }
- @Override
+ if(gotoAction != null) {
+ return gotoAction.isEnabled();
+ }
+ return true;
+ }
+ @Override
public String getText() {
- if(gotoAction != null) {
- return gotoAction.getText();
- }
- return null;
- }
- @Override
+ if(gotoAction != null) {
+ return gotoAction.getText();
+ }
+ return null;
+ }
+ @Override
public String getToolTipText() {
- if (status != null && !status.isOK()) {
- return status.getMessage();
- }
- if(gotoAction != null) {
- return gotoAction.getToolTipText();
- }
- return Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, RefreshParticipantJob.this.getName());
- }
- @Override
+ if (status != null && !status.isOK()) {
+ return status.getMessage();
+ }
+ if(gotoAction != null) {
+ return gotoAction.getToolTipText();
+ }
+ return Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, RefreshParticipantJob.this.getName());
+ }
+ @Override
public void dispose() {
- super.dispose();
- if(gotoAction != null) {
- gotoAction.dispose();
- }
- }
- public void setGotoAction(ActionFactory.IWorkbenchAction gotoAction) {
- this.gotoAction = gotoAction;
+ super.dispose();
+ if(gotoAction != null) {
+ gotoAction.dispose();
+ }
+ }
+ public void setGotoAction(ActionFactory.IWorkbenchAction gotoAction) {
+ this.gotoAction = gotoAction;
setEnabled(isEnabled());
setToolTipText(getToolTipText());
gotoAction.addPropertyChangeListener(event -> {
@@ -167,13 +167,13 @@ public abstract class RefreshParticipantJob extends Job {
GotoActionWrapper.this.setEnabled(bool.booleanValue());
}
});
- }
- public void setStatus(IStatus status) {
- this.status = status;
- }
- }
+ }
+ public void setStatus(IStatus status) {
+ this.status = status;
+ }
+ }
- /**
+ /**
* Notification for safely notifying listeners of refresh lifecycle.
*/
private abstract class Notification implements ISafeRunnable {
@@ -349,21 +349,21 @@ public abstract class RefreshParticipantJob extends Job {
}
}
} catch(CoreException e) {
- // Determine the status to be returned and the GOTO action
- status = e.getStatus();
- if (!isUser()) {
- // Use the GOTO action to show the error and return OK
- Object prop = getProperty(IProgressConstants.ACTION_PROPERTY);
- if (prop instanceof GotoActionWrapper) {
- GotoActionWrapper wrapper = (GotoActionWrapper)prop;
- wrapper.setStatus(e.getStatus());
- status = new Status(IStatus.OK, TeamUIPlugin.ID, IStatus.OK, e.getStatus().getMessage(), e);
- }
- }
- if (!isUser() && status.getSeverity() == IStatus.ERROR) {
- // Never prompt for errors on non-user jobs
- setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
+ // Determine the status to be returned and the GOTO action
+ status = e.getStatus();
+ if (!isUser()) {
+ // Use the GOTO action to show the error and return OK
+ Object prop = getProperty(IProgressConstants.ACTION_PROPERTY);
+ if (prop instanceof GotoActionWrapper) {
+ GotoActionWrapper wrapper = (GotoActionWrapper)prop;
+ wrapper.setStatus(e.getStatus());
+ status = new Status(IStatus.OK, TeamUIPlugin.ID, IStatus.OK, e.getStatus().getMessage(), e);
+ }
+ }
+ if (!isUser() && status.getSeverity() == IStatus.ERROR) {
+ // Never prompt for errors on non-user jobs
+ setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
+ }
} finally {
event.setStopTime(System.currentTimeMillis());
}
@@ -383,7 +383,7 @@ public abstract class RefreshParticipantJob extends Job {
return event.getStatus();
} finally {
if (acquired) lock.release();
- monitor.done();
+ monitor.done();
}
}
@@ -422,12 +422,12 @@ public abstract class RefreshParticipantJob extends Job {
code = IRefreshEvent.STATUS_CHANGES;
int incomingChanges = getIncomingChangeCount();
- String numIncomingChanges = incomingChanges==0 ? "" //$NON-NLS-1$
- : NLS.bind(TeamUIMessages.RefreshCompleteDialog_incomingChanges, Integer.toString(incomingChanges));
+ String numIncomingChanges = incomingChanges==0 ? "" //$NON-NLS-1$
+ : NLS.bind(TeamUIMessages.RefreshCompleteDialog_incomingChanges, Integer.toString(incomingChanges));
int outgoingChanges = getOutgoingChangeCount();
String numOutgoingChanges = outgoingChanges==0 ? "" //$NON-NLS-1$
- : NLS.bind(TeamUIMessages.RefreshCompleteDialog_outgoingChanges, Integer.toString(outgoingChanges));
+ : NLS.bind(TeamUIMessages.RefreshCompleteDialog_outgoingChanges, Integer.toString(outgoingChanges));
String sep = incomingChanges>0 && outgoingChanges>0 ? "; " : ""; //$NON-NLS-1$ //$NON-NLS-2$
@@ -436,9 +436,9 @@ public abstract class RefreshParticipantJob extends Job {
code = IRefreshEvent.STATUS_NEW_CHANGES;
String numNewChanges = Integer.toString(changeCount);
if (changeCount == 1) {
- text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesSingular, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
+ text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesSingular, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
} else {
- text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesPlural, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
+ text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesPlural, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
}
} else {
// Refreshed resources contain changes
@@ -487,7 +487,7 @@ public abstract class RefreshParticipantJob extends Job {
Job update = new UIJob("") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- runnable.run();
+ runnable.run();
return Status.OK_STATUS;
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java
index 593ffa68e..99d6c6474 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java
@@ -57,35 +57,35 @@ public class RefreshSubscriberParticipantJob extends RefreshParticipantJob {
return numChanges;
}
- @Override
+ @Override
protected int getIncomingChangeCount() {
- return getChangesInMode(SyncInfo.INCOMING);
- }
+ return getChangesInMode(SyncInfo.INCOMING);
+ }
- @Override
+ @Override
protected int getOutgoingChangeCount() {
- return getChangesInMode(SyncInfo.OUTGOING);
- }
+ return getChangesInMode(SyncInfo.OUTGOING);
+ }
- private int getChangesInMode(int kind) {
- int numChanges = 0;
- SubscriberSyncInfoCollector collector = getCollector();
- if (collector != null) {
- SyncInfoTree set = collector.getSyncInfoSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- SyncInfo[] infos = set.getSyncInfos(resource, IResource.DEPTH_INFINITE);
- if(infos != null && infos.length > 0) {
- for(int j = 0; j < infos.length; j++) {
- if((infos[j].getKind() & kind)>0) {
- numChanges++;
- }
- }
- }
- }
- }
- return numChanges;
- }
+ private int getChangesInMode(int kind) {
+ int numChanges = 0;
+ SubscriberSyncInfoCollector collector = getCollector();
+ if (collector != null) {
+ SyncInfoTree set = collector.getSyncInfoSet();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ SyncInfo[] infos = set.getSyncInfos(resource, IResource.DEPTH_INFINITE);
+ if(infos != null && infos.length > 0) {
+ for(int j = 0; j < infos.length; j++) {
+ if((infos[j].getKind() & kind)>0) {
+ numChanges++;
+ }
+ }
+ }
+ }
+ }
+ return numChanges;
+ }
@Override
protected RefreshParticipantJob.IChangeDescription createChangeDescription() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java
index 467f888a6..b901a59f7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java
@@ -49,20 +49,20 @@ public class StartupPreferencePage extends FieldEditorPreferencePage implements
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_STARTUP_PREFERENCE_PAGE);
+ // set F1 help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_STARTUP_PREFERENCE_PAGE);
}
@Override
protected void createFieldEditors() {
- addField(new RadioGroupFieldEditor(PROP_STARTUP_ACTION,
- TeamUIMessages.StartupPreferencePage_2, 1,
- new String[][] {
- {TeamUIMessages.StartupPreferencePage_3, STARTUP_ACTION_POPULATE},
- {TeamUIMessages.StartupPreferencePage_4, STARTUP_ACTION_SYNCHRONIZE},
- {TeamUIMessages.StartupPreferencePage_5, STARTUP_ACTION_NONE}
- },
- getFieldEditorParent(), true /* use a group */));
+ addField(new RadioGroupFieldEditor(PROP_STARTUP_ACTION,
+ TeamUIMessages.StartupPreferencePage_2, 1,
+ new String[][] {
+ {TeamUIMessages.StartupPreferencePage_3, STARTUP_ACTION_POPULATE},
+ {TeamUIMessages.StartupPreferencePage_4, STARTUP_ACTION_SYNCHRONIZE},
+ {TeamUIMessages.StartupPreferencePage_5, STARTUP_ACTION_NONE}
+ },
+ getFieldEditorParent(), true /* use a group */));
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
index 14f808abe..aaf139b8d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
@@ -185,7 +185,7 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
IResource resource = syncNode.getResource();
if (syncNode != null && resource != null && resource.getType() == IResource.FILE) {
// The open is handled by the open strategy but say we handled
- // it so that overriding methods will not do anything
+ // it so that overriding methods will not do anything
return true;
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
index 361c227bd..327151fe5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
@@ -44,237 +44,237 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
*/
public abstract class SyncInfoSetChangeSetCollector extends ChangeSetManager {
- private final ISynchronizePageConfiguration configuration;
- private ChangeSetModelProvider provider;
+ private final ISynchronizePageConfiguration configuration;
+ private ChangeSetModelProvider provider;
- /*
- * Listener that will remove sets when they become empty.
- * The sets in this collector are only modified from either the
- * UI thread or the provider's event handler thread so updates
- * done by this listener will update the view properly.
- */
- ISyncInfoSetChangeListener changeSetListener = new ISyncInfoSetChangeListener() {
+ /*
+ * Listener that will remove sets when they become empty.
+ * The sets in this collector are only modified from either the
+ * UI thread or the provider's event handler thread so updates
+ * done by this listener will update the view properly.
+ */
+ ISyncInfoSetChangeListener changeSetListener = new ISyncInfoSetChangeListener() {
- @Override
+ @Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- handleChangeEvent(set);
- }
+ handleChangeEvent(set);
+ }
- @Override
+ @Override
public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- handleChangeEvent(event.getSet());
- }
+ handleChangeEvent(event.getSet());
+ }
- @Override
+ @Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- // TODO Auto-generated method stub
- }
+ // TODO Auto-generated method stub
+ }
- /*
- * The collector removes change sets once they are empty
- */
- private void handleChangeEvent(SyncInfoSet set) {
- if (set.isEmpty()) {
- ChangeSet changeSet = getChangeSet(set);
- if (changeSet != null) {
- remove(changeSet);
- }
- }
- }
- };
+ /*
+ * The collector removes change sets once they are empty
+ */
+ private void handleChangeEvent(SyncInfoSet set) {
+ if (set.isEmpty()) {
+ ChangeSet changeSet = getChangeSet(set);
+ if (changeSet != null) {
+ remove(changeSet);
+ }
+ }
+ }
+ };
- /**
- * Create a collector that contains the sync info from the given seed set
- * @param configuration the set used to determine which sync info
- * should be included in the change sets.
- */
- public SyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
- this.configuration = configuration;
- }
+ /**
+ * Create a collector that contains the sync info from the given seed set
+ * @param configuration the set used to determine which sync info
+ * should be included in the change sets.
+ */
+ public SyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
+ this.configuration = configuration;
+ }
- /**
- * Add the given resource sync info nodes to the appropriate
- * change sets, adding them if necessary.
- * This method is invoked by the <code>handleChanges</code>
- * and <code>reset</code> methods
- * when the model provider changes state. Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should perform adds
- * within a runnable passed to the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses must override this method.
- * @param infos the sync infos to add
- */
- protected abstract void add(SyncInfo[] infos);
+ /**
+ * Add the given resource sync info nodes to the appropriate
+ * change sets, adding them if necessary.
+ * This method is invoked by the <code>handleChanges</code>
+ * and <code>reset</code> methods
+ * when the model provider changes state. Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should perform adds
+ * within a runnable passed to the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses must override this method.
+ * @param infos the sync infos to add
+ */
+ protected abstract void add(SyncInfo[] infos);
- /**
- * Remove the given resources from all sets of this collector.
- * This method is invoked by the <code>handleChanges</code> method
- * when the model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread).
- * Updates done from other threads should perform removes
- * within a runnable passed to the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses may override this method.
- * @param resources the resources to be removed
- */
- protected void remove(IResource[] resources) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- set.remove(resources);
- }
- }
+ /**
+ * Remove the given resources from all sets of this collector.
+ * This method is invoked by the <code>handleChanges</code> method
+ * when the model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread).
+ * Updates done from other threads should perform removes
+ * within a runnable passed to the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses may override this method.
+ * @param resources the resources to be removed
+ */
+ protected void remove(IResource[] resources) {
+ ChangeSet[] sets = getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ set.remove(resources);
+ }
+ }
- protected ISyncInfoSetChangeListener getChangeSetChangeListener() {
- return changeSetListener;
- }
+ protected ISyncInfoSetChangeListener getChangeSetChangeListener() {
+ return changeSetListener;
+ }
- /**
- * Re-populate the change sets from the seed set.
- * If <code>null</code> is passed, clear any state
- * but do not re-populate.
- * <p>
- * This method is invoked by the model provider when the
- * model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses may override this method.
- * @param seedSet
- */
- public void reset(SyncInfoSet seedSet) {
- // First, remove all the sets
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set2 = sets[i];
- remove(set2);
- }
- if (seedSet != null) {
- add(seedSet.getSyncInfos());
- }
- }
+ /**
+ * Re-populate the change sets from the seed set.
+ * If <code>null</code> is passed, clear any state
+ * but do not re-populate.
+ * <p>
+ * This method is invoked by the model provider when the
+ * model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses may override this method.
+ * @param seedSet
+ */
+ public void reset(SyncInfoSet seedSet) {
+ // First, remove all the sets
+ ChangeSet[] sets = getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set2 = sets[i];
+ remove(set2);
+ }
+ if (seedSet != null) {
+ add(seedSet.getSyncInfos());
+ }
+ }
- /**
- * This method is invoked by the model provider when the
- * seed <code>SyncInfoSet</code> changes. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses may override this method.
- * @param event the set change event.
- */
- public void handleChange(ISyncInfoSetChangeEvent event) {
- List<IResource> removals = new ArrayList<>();
- List<SyncInfo> additions = new ArrayList<>();
- removals.addAll(Arrays.asList(event.getRemovedResources()));
- additions.addAll(Arrays.asList(event.getAddedResources()));
- SyncInfo[] changed = event.getChangedResources();
- for (int i = 0; i < changed.length; i++) {
- SyncInfo info = changed[i];
- additions.add(info);
- removals.add(info.getLocal());
- }
- if (!removals.isEmpty()) {
- remove(removals.toArray(new IResource[removals.size()]));
- }
- if (!additions.isEmpty()) {
- add(additions.toArray(new SyncInfo[additions.size()]));
- }
- }
+ /**
+ * This method is invoked by the model provider when the
+ * seed <code>SyncInfoSet</code> changes. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses may override this method.
+ * @param event the set change event.
+ */
+ public void handleChange(ISyncInfoSetChangeEvent event) {
+ List<IResource> removals = new ArrayList<>();
+ List<SyncInfo> additions = new ArrayList<>();
+ removals.addAll(Arrays.asList(event.getRemovedResources()));
+ additions.addAll(Arrays.asList(event.getAddedResources()));
+ SyncInfo[] changed = event.getChangedResources();
+ for (int i = 0; i < changed.length; i++) {
+ SyncInfo info = changed[i];
+ additions.add(info);
+ removals.add(info.getLocal());
+ }
+ if (!removals.isEmpty()) {
+ remove(removals.toArray(new IResource[removals.size()]));
+ }
+ if (!additions.isEmpty()) {
+ add(additions.toArray(new SyncInfo[additions.size()]));
+ }
+ }
- /**
- * Return the configuration for the page that is displaying the model created
- * using this collector.
- * @return the configuration for the page that is displaying the model created
- * using this collector
- */
- public final ISynchronizePageConfiguration getConfiguration() {
- return configuration;
- }
+ /**
+ * Return the configuration for the page that is displaying the model created
+ * using this collector.
+ * @return the configuration for the page that is displaying the model created
+ * using this collector
+ */
+ public final ISynchronizePageConfiguration getConfiguration() {
+ return configuration;
+ }
- /**
- * Execute the given runnable which updates the sync sets contained
- * in this collector. This method should be used by subclasses when they
- * are populating or modifying sets from another thread. In other words,
- * if the sets of this collector are updated directly in the <code>add</code>
- * method then this method is not required. However, if sets are created
- * or modified by another thread, that thread must use this method to ensure
- * the updates occur in the proper thread in order to ensure thread safety.
- * <p>
- * The update may be run in a different thread then the caller.
- * However, regardless of which thread the update is run in, the view
- * will be updated once the update is completed.
- * @param runnable the workspace runnable that updates the sync sets.
- * @param preserveExpansion whether the expansed items in the view should
- * remain expanded after the update is performed.
- * @param monitor a progress monitor
- */
- protected final void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, IProgressMonitor monitor) {
- provider.performUpdate(runnable, preserveExpansion, false /* run in the handler thread and refresh at the end */);
- }
+ /**
+ * Execute the given runnable which updates the sync sets contained
+ * in this collector. This method should be used by subclasses when they
+ * are populating or modifying sets from another thread. In other words,
+ * if the sets of this collector are updated directly in the <code>add</code>
+ * method then this method is not required. However, if sets are created
+ * or modified by another thread, that thread must use this method to ensure
+ * the updates occur in the proper thread in order to ensure thread safety.
+ * <p>
+ * The update may be run in a different thread then the caller.
+ * However, regardless of which thread the update is run in, the view
+ * will be updated once the update is completed.
+ * @param runnable the workspace runnable that updates the sync sets.
+ * @param preserveExpansion whether the expansed items in the view should
+ * remain expanded after the update is performed.
+ * @param monitor a progress monitor
+ */
+ protected final void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, IProgressMonitor monitor) {
+ provider.performUpdate(runnable, preserveExpansion, false /* run in the handler thread and refresh at the end */);
+ }
- /*
- * Sets the provider for this collector. This method is for internal use only.
- */
- public final void setProvider(ChangeSetModelProvider provider) {
- this.provider = provider;
- }
+ /*
+ * Sets the provider for this collector. This method is for internal use only.
+ */
+ public final void setProvider(ChangeSetModelProvider provider) {
+ this.provider = provider;
+ }
- /**
- * This method should wait until any background processing is
- * completed. It is for testing purposes. By default, it does not wait at all.
- * Subclasses that perform work in the background should override.
- * @param monitor a progress monitor
- */
- public void waitUntilDone(IProgressMonitor monitor) {
- // Do nothing, by default
- }
+ /**
+ * This method should wait until any background processing is
+ * completed. It is for testing purposes. By default, it does not wait at all.
+ * Subclasses that perform work in the background should override.
+ * @param monitor a progress monitor
+ */
+ public void waitUntilDone(IProgressMonitor monitor) {
+ // Do nothing, by default
+ }
- @Override
+ @Override
protected void handleSetAdded(ChangeSet set) {
- ((CheckedInChangeSet)set).getSyncInfoSet().addSyncSetChangedListener(getChangeSetChangeListener());
- super.handleSetAdded(set);
- }
+ ((CheckedInChangeSet)set).getSyncInfoSet().addSyncSetChangedListener(getChangeSetChangeListener());
+ super.handleSetAdded(set);
+ }
- @Override
+ @Override
protected void handleSetRemoved(ChangeSet set) {
- ((CheckedInChangeSet)set).getSyncInfoSet().removeSyncSetChangedListener(getChangeSetChangeListener());
- super.handleSetRemoved(set);
- }
+ ((CheckedInChangeSet)set).getSyncInfoSet().removeSyncSetChangedListener(getChangeSetChangeListener());
+ super.handleSetRemoved(set);
+ }
- /**
- * Return the Change Set whose sync info set is the
- * one given.
- * @param set a sync info set
- * @return the change set for the given sync info set
- */
- protected ChangeSet getChangeSet(SyncInfoSet set) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet changeSet = sets[i];
- if (((CheckedInChangeSet)changeSet).getSyncInfoSet() == set) {
- return changeSet;
- }
- }
- return null;
- }
+ /**
+ * Return the Change Set whose sync info set is the
+ * one given.
+ * @param set a sync info set
+ * @return the change set for the given sync info set
+ */
+ protected ChangeSet getChangeSet(SyncInfoSet set) {
+ ChangeSet[] sets = getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet changeSet = sets[i];
+ if (((CheckedInChangeSet)changeSet).getSyncInfoSet() == set) {
+ return changeSet;
+ }
+ }
+ return null;
+ }
public SyncInfoTree getSyncInfoSet(ChangeSet set) {
return ((CheckedInChangeSet)set).getSyncInfoSet();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
index 594a7a9eb..4fa15f001 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
@@ -210,7 +210,7 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
@Override
public void dispose() {
- workbenchLabelProvider.dispose();
+ workbenchLabelProvider.dispose();
if(busyFont != null) {
busyFont.dispose();
}
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 0e01553fd..dc68ea5a1 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
@@ -123,10 +123,10 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
protected String getDefaultProviderId() {
String defaultLayout = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT);
if (defaultLayout.equals(IPreferenceIds.TREE_LAYOUT)) {
- return HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
+ return HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
}
if (defaultLayout.equals(IPreferenceIds.FLAT_LAYOUT)) {
- return FlatModelProvider.FlatModelProviderDescriptor.ID;
+ return FlatModelProvider.FlatModelProviderDescriptor.ID;
}
// Return compressed folder is the others were not a match
return CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID;
@@ -156,7 +156,7 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
*/
protected void setInput(String id, IProgressMonitor monitor) {
if(modelProvider != null) {
- modelProvider.saveState();
+ modelProvider.saveState();
modelProvider.dispose();
}
modelProvider = createModelProvider(id);
@@ -248,7 +248,7 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
}
setInput(defaultProviderId, null);
} else {
- setInput();
+ setInput();
}
}
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 575cb6f9a..2520c08e3 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
@@ -48,7 +48,7 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
protected final Map<IResource, ISynchronizeModelElement> resourceMap = Collections.synchronizedMap(new HashMap<>());
- protected static final boolean DEBUG = false;
+ protected static final boolean DEBUG = false;
public SynchronizeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
super(configuration, set);
@@ -59,10 +59,10 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
associateRoot(modelRoot);
}
- private void associateRoot(ISynchronizeModelElement modelRoot) {
- // associate the root resource with the provider's root element
+ private void associateRoot(ISynchronizeModelElement modelRoot) {
+ // associate the root resource with the provider's root element
resourceMap.put(ResourcesPlugin.getWorkspace().getRoot(), modelRoot);
- }
+ }
/**
* Dispose of the builder
@@ -92,14 +92,14 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
return resourceMap.get(resource);
}
- @Override
+ @Override
protected ISynchronizeModelElement[] getModelObjects(IResource resource) {
- ISynchronizeModelElement element = getModelObject(resource);
- if (element == null) {
- return new ISynchronizeModelElement[0];
- }
- return new ISynchronizeModelElement[] { element };
- }
+ ISynchronizeModelElement element = getModelObject(resource);
+ if (element == null) {
+ return new ISynchronizeModelElement[0];
+ }
+ return new ISynchronizeModelElement[] { element };
+ }
protected void associateDiffNode(ISynchronizeModelElement node) {
IResource resource = node.getResource();
@@ -130,16 +130,16 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
* @param resources the resources to remove
*/
protected void removeFromViewer(IResource[] resources) {
- List<ISynchronizeModelElement> elements = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ List<ISynchronizeModelElement> elements = new ArrayList<>();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
ISynchronizeModelElement element = getModelObject(resource);
if(element != null) {
- elements.add(element);
+ elements.add(element);
}
- }
+ }
if (!elements.isEmpty()) {
- removeFromViewer(elements.toArray(new ISynchronizeModelElement[elements.size()]));
+ removeFromViewer(elements.toArray(new ISynchronizeModelElement[elements.size()]));
}
}
@@ -147,11 +147,11 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
super.recursiveClearModelObjects(node);
if (node == getModelRoot()) {
- // If we are clearing everything under the root
- // than just purge the resource map
- resourceMap.clear();
- // Reassociate the root node to allow the children to be readded
- associateRoot(getModelRoot());
+ // If we are clearing everything under the root
+ // than just purge the resource map
+ resourceMap.clear();
+ // Reassociate the root node to allow the children to be readded
+ associateRoot(getModelRoot());
} else {
IResource resource = node.getResource();
if (resource != null) {
@@ -166,10 +166,10 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
super.addToViewer(node);
}
- @Override
+ @Override
protected boolean hasViewerState() {
- return ! resourceMap.isEmpty();
- }
+ return ! resourceMap.isEmpty();
+ }
@Override
public ISynchronizeModelElement[] getClosestExistingParents(IResource resource) {
@@ -181,15 +181,15 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
} while(element == null && resource != null);
}
if (element == null) {
- return new ISynchronizeModelElement[0];
+ return new ISynchronizeModelElement[0];
}
return new ISynchronizeModelElement[] { element };
}
- @Override
+ @Override
protected final void handleChanges(ISyncInfoTreeChangeEvent event, IProgressMonitor monitor) {
- super.handleChanges(event, monitor);
- }
+ super.handleChanges(event, monitor);
+ }
@Override
protected void handleResourceChanges(ISyncInfoTreeChangeEvent event) {
@@ -205,12 +205,12 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
}
}
- /**
- * The sync state for the existing diff node has changed and the new state
- * is provided by the given sync info.
- * @param diffNode the changed diff node
- * @param info the new sync state
- */
+ /**
+ * The sync state for the existing diff node has changed and the new state
+ * is provided by the given sync info.
+ * @param diffNode the changed diff node
+ * @param info the new sync state
+ */
protected void handleChange(ISynchronizeModelElement diffNode, SyncInfo info) {
IResource local = info.getLocal();
@@ -227,30 +227,30 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
}
}
- /**
- * Add the give sync infos to the provider, creating
- * any intermediate nodes a required.
- * @param added the added infos
- */
+ /**
+ * Add the give sync infos to the provider, creating
+ * any intermediate nodes a required.
+ * @param added the added infos
+ */
protected void addResources(SyncInfo[] added) {
for (int i = 0; i < added.length; i++) {
SyncInfo info = added[i];
- addResource(info);
+ addResource(info);
}
}
/**
- * Add the give sync info to the provider, creating
- * any intermediate nodes a required and adding any children as well
- * @param info the added infos
- */
- protected abstract void addResource(SyncInfo info);
+ * Add the give sync info to the provider, creating
+ * any intermediate nodes a required and adding any children as well
+ * @param info the added infos
+ */
+ protected abstract void addResource(SyncInfo info);
- /**
+ /**
* Create the model object for the given sync info as a child of the given parent node.
* @param parent the parent
* @param info the info to be used for the new node
* @return the created node
*/
- protected abstract ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info);
+ protected abstract ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
index 14aacad9c..e027dffc3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
@@ -59,9 +59,9 @@ import com.ibm.icu.text.SimpleDateFormat;
* handler's thread.
*/
public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implements IResourceChangeListener, ISyncInfoSetChangeListener {
- private static final IWorkspaceRoot ROOT = ResourcesPlugin.getWorkspace().getRoot();
+ private static final IWorkspaceRoot ROOT = ResourcesPlugin.getWorkspace().getRoot();
- // Event that indicates that the markers for a set of elements has changed
+ // Event that indicates that the markers for a set of elements has changed
private static final int MARKERS_CHANGED = 1;
private static final int BUSY_STATE_CHANGED = 2;
private static final int RESET = 3;
@@ -81,14 +81,14 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
* Custom event for posting marker changes
*/
class MarkerChangeEvent extends Event {
- private final ISynchronizeModelElement[] elements;
- public MarkerChangeEvent(ISynchronizeModelElement[] elements) {
- super(MARKERS_CHANGED);
- this.elements = elements;
- }
- public ISynchronizeModelElement[] getElements() {
- return elements;
- }
+ private final ISynchronizeModelElement[] elements;
+ public MarkerChangeEvent(ISynchronizeModelElement[] elements) {
+ super(MARKERS_CHANGED);
+ this.elements = elements;
+ }
+ public ISynchronizeModelElement[] getElements() {
+ return elements;
+ }
}
/**
@@ -96,65 +96,65 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
*/
class BusyStateChangeEvent extends Event {
- private final ISynchronizeModelElement element;
- private final boolean isBusy;
- public BusyStateChangeEvent(ISynchronizeModelElement element, boolean isBusy) {
- super(BUSY_STATE_CHANGED);
- this.element = element;
- this.isBusy = isBusy;
- }
- public ISynchronizeModelElement getElement() {
- return element;
- }
- public boolean isBusy() {
- return isBusy;
- }
+ private final ISynchronizeModelElement element;
+ private final boolean isBusy;
+ public BusyStateChangeEvent(ISynchronizeModelElement element, boolean isBusy) {
+ super(BUSY_STATE_CHANGED);
+ this.element = element;
+ this.isBusy = isBusy;
+ }
+ public ISynchronizeModelElement getElement() {
+ return element;
+ }
+ public boolean isBusy() {
+ return isBusy;
+ }
}
/**
* Custom event for posting sync info set changes
*/
class SyncInfoSetChangeEvent extends Event {
- private final ISyncInfoSetChangeEvent event;
- public SyncInfoSetChangeEvent(ISyncInfoSetChangeEvent event) {
- super(SYNC_INFO_SET_CHANGED);
- this.event = event;
- }
- public ISyncInfoSetChangeEvent getEvent() {
- return event;
- }
+ private final ISyncInfoSetChangeEvent event;
+ public SyncInfoSetChangeEvent(ISyncInfoSetChangeEvent event) {
+ super(SYNC_INFO_SET_CHANGED);
+ this.event = event;
+ }
+ public ISyncInfoSetChangeEvent getEvent() {
+ return event;
+ }
}
private IPropertyChangeListener listener = event -> {
if (event.getProperty() == ISynchronizeModelElement.BUSY_PROPERTY) {
Object source = event.getSource();
if (source instanceof ISynchronizeModelElement)
- updateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
+ updateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
}
};
- private boolean performingBackgroundUpdate;
+ private boolean performingBackgroundUpdate;
- /*
- * Map used to keep track of additions so they can be added in batch at the end of the update
- */
- private Map<ISynchronizeModelElement, Set<ISynchronizeModelElement>> additionsMap;
+ /*
+ * Map used to keep track of additions so they can be added in batch at the end of the update
+ */
+ private Map<ISynchronizeModelElement, Set<ISynchronizeModelElement>> additionsMap;
/**
- * Create the marker update handler.
- */
- public SynchronizeModelUpdateHandler(AbstractSynchronizeModelProvider provider) {
- super(TeamUIMessages.SynchronizeModelProvider_0, TeamUIMessages.SynchronizeModelUpdateHandler_0); //
- this.provider = provider;
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- provider.getSyncInfoSet().addSyncSetChangedListener(this);
- }
-
- /**
- * Return the marker types that are of interest to this handler.
- * @return the marker types that are of interest to this handler
- */
- protected String[] getMarkerTypes() {
+ * Create the marker update handler.
+ */
+ public SynchronizeModelUpdateHandler(AbstractSynchronizeModelProvider provider) {
+ super(TeamUIMessages.SynchronizeModelProvider_0, TeamUIMessages.SynchronizeModelUpdateHandler_0); //
+ this.provider = provider;
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ provider.getSyncInfoSet().addSyncSetChangedListener(this);
+ }
+
+ /**
+ * Return the marker types that are of interest to this handler.
+ * @return the marker types that are of interest to this handler
+ */
+ protected String[] getMarkerTypes() {
return new String[] {IMarker.PROBLEM};
}
@@ -181,38 +181,38 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
IMarkerDelta delta = markerDeltas[i];
IResource resource = delta.getResource();
if (!handledResources.contains(resource)) {
- handledResources.add(resource);
- ISynchronizeModelElement[] elements = provider.getClosestExistingParents(delta.getResource());
+ handledResources.add(resource);
+ ISynchronizeModelElement[] elements = provider.getClosestExistingParents(delta.getResource());
if(elements != null && elements.length > 0) {
- for (int j = 0; j < elements.length; j++) {
- ISynchronizeModelElement element = elements[j];
- changes.add(element);
- }
+ for (int j = 0; j < elements.length; j++) {
+ ISynchronizeModelElement element = elements[j];
+ changes.add(element);
+ }
}
}
}
}
if (!changes.isEmpty()) {
- updateMarkersFor(changes.toArray(new ISynchronizeModelElement[changes.size()]));
+ updateMarkersFor(changes.toArray(new ISynchronizeModelElement[changes.size()]));
}
}
- private void updateMarkersFor(ISynchronizeModelElement[] elements) {
- queueEvent(new MarkerChangeEvent(elements), false /* not on front of queue */);
- }
+ private void updateMarkersFor(ISynchronizeModelElement[] elements) {
+ queueEvent(new MarkerChangeEvent(elements), false /* not on front of queue */);
+ }
- protected void updateBusyState(ISynchronizeModelElement element, boolean isBusy) {
- queueEvent(new BusyStateChangeEvent(element, isBusy), false /* not on front of queue */);
- }
+ protected void updateBusyState(ISynchronizeModelElement element, boolean isBusy) {
+ queueEvent(new BusyStateChangeEvent(element, isBusy), false /* not on front of queue */);
+ }
- @Override
+ @Override
protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException {
- switch (event.getType()) {
+ switch (event.getType()) {
case BackgroundEventHandler.RUNNABLE_EVENT :
executeRunnable(event, monitor);
break;
- case MARKERS_CHANGED:
+ case MARKERS_CHANGED:
// Changes contains all elements that need their labels updated
long start = System.currentTimeMillis();
ISynchronizeModelElement[] elements = getChangedElements(event);
@@ -227,46 +227,46 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
String took = TIME_FORMAT.format(new Date(time));
System.out.println(took + " for " + elements.length + " files"); //$NON-NLS-1$//$NON-NLS-2$
}
- break;
- case BUSY_STATE_CHANGED:
- BusyStateChangeEvent e = (BusyStateChangeEvent)event;
- queueForLabelUpdate(e.getElement());
- if (e.isBusy()) {
- // indicate that we want an early dispatch to show busy elements
- dispatchEarly = true;
- }
- break;
- case RESET:
- // Perform the reset immediately
- pendingLabelUpdates.clear();
- provider.reset();
- break;
- case SYNC_INFO_SET_CHANGED:
- // Handle the sync change immediately
- handleChanges(((SyncInfoSetChangeEvent)event).getEvent(), monitor);
- default:
- break;
- }
- }
-
- private ISynchronizeModelElement[] getChangedElements(Event event) {
- if (event.getType() == MARKERS_CHANGED) {
- return ((MarkerChangeEvent)event).getElements();
- }
- return new ISynchronizeModelElement[0];
- }
-
- @Override
+ break;
+ case BUSY_STATE_CHANGED:
+ BusyStateChangeEvent e = (BusyStateChangeEvent)event;
+ queueForLabelUpdate(e.getElement());
+ if (e.isBusy()) {
+ // indicate that we want an early dispatch to show busy elements
+ dispatchEarly = true;
+ }
+ break;
+ case RESET:
+ // Perform the reset immediately
+ pendingLabelUpdates.clear();
+ provider.reset();
+ break;
+ case SYNC_INFO_SET_CHANGED:
+ // Handle the sync change immediately
+ handleChanges(((SyncInfoSetChangeEvent)event).getEvent(), monitor);
+ default:
+ break;
+ }
+ }
+
+ private ISynchronizeModelElement[] getChangedElements(Event event) {
+ if (event.getType() == MARKERS_CHANGED) {
+ return ((MarkerChangeEvent)event).getElements();
+ }
+ return new ISynchronizeModelElement[0];
+ }
+
+ @Override
protected boolean doDispatchEvents(IProgressMonitor monitor) throws TeamException {
// Fire label changed
- dispatchEarly = false;
- if (pendingLabelUpdates.isEmpty()) {
- return false;
- } else {
+ dispatchEarly = false;
+ if (pendingLabelUpdates.isEmpty()) {
+ return false;
+ } else {
Utils.asyncExec((Runnable) () -> firePendingLabelUpdates(), getViewer());
return true;
- }
- }
+ }
+ }
/**
* Forces the viewer to update the labels for queued elemens
@@ -287,7 +287,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
* Forces the viewer to update the labels for the given elements
*/
private void updateLabels(Object[] elements) {
- StructuredViewer tree = getViewer();
+ StructuredViewer tree = getViewer();
if (Utils.canUpdateViewer(tree)) {
tree.update(elements, null);
}
@@ -390,287 +390,287 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
/*
* Queue an event that will reset the provider
*/
- private void reset() {
- queueEvent(new ResourceEvent(ROOT, RESET, IResource.DEPTH_INFINITE), false);
- }
+ private void reset() {
+ queueEvent(new ResourceEvent(ROOT, RESET, IResource.DEPTH_INFINITE), false);
+ }
- public void dispose() {
- shutdown();
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- provider.getSyncInfoSet().removeSyncSetChangedListener(this);
- }
+ public void dispose() {
+ shutdown();
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ provider.getSyncInfoSet().removeSyncSetChangedListener(this);
+ }
- @Override
+ @Override
protected long getShortDispatchDelay() {
- if (dispatchEarly) {
- dispatchEarly = false;
- return EARLY_DISPATCH_INCREMENT;
- }
- return super.getShortDispatchDelay();
- }
-
- /**
- * This method is invoked whenever a node is added to the viewer
- * by the provider or a sub-provider. The handler adds an update
- * listener to the node and notifies the root provider that
- * a node was added.
- * @param element the added element
- * @param provider the provider that added the element
- */
- public void nodeAdded(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
- element.addPropertyChangeListener(listener);
- this.provider.nodeAdded(element, provider);
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Node added: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * This method is invoked whenever a node is removed the viewer
- * by the provider or a sub-provider. The handler removes any
- * listener and notifies the root provider that
- * a node was removed. The node removed may have children for which
- * a nodeRemoved callback was not invoked (see modelObjectCleared).
- * @param element the removed element
- * @param provider the provider that added the element
- */
- public void nodeRemoved(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
- element.removePropertyChangeListener(listener);
- this.provider.nodeRemoved(element, provider);
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Node removed: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * This method is invoked whenever a model object (i.e. node)
- * is cleared from the model. This is similar to node removal but
- * is deep.
- * @param node the node that was cleared
- */
- public void modelObjectCleared(ISynchronizeModelElement node) {
- node.removePropertyChangeListener(listener);
- this.provider.modelObjectCleared(node);
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Node cleared: " + getDebugDisplayLabel(node)); //$NON-NLS-1$
- }
- }
-
- private String getDebugDisplayLabel(ISynchronizeModelElement node) {
- if (node == null) {
- return "ROOT"; //$NON-NLS-1$
- }
- if (node.getResource() != null) {
- return node.getResource().getFullPath().toString();
- }
- return node.getName();
- }
-
- private String getDebugDisplayLabel(AbstractSynchronizeModelProvider provider2) {
- return provider2.toString();
- }
-
- @Override
+ if (dispatchEarly) {
+ dispatchEarly = false;
+ return EARLY_DISPATCH_INCREMENT;
+ }
+ return super.getShortDispatchDelay();
+ }
+
+ /**
+ * This method is invoked whenever a node is added to the viewer
+ * by the provider or a sub-provider. The handler adds an update
+ * listener to the node and notifies the root provider that
+ * a node was added.
+ * @param element the added element
+ * @param provider the provider that added the element
+ */
+ public void nodeAdded(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
+ element.addPropertyChangeListener(listener);
+ this.provider.nodeAdded(element, provider);
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Node added: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * This method is invoked whenever a node is removed the viewer
+ * by the provider or a sub-provider. The handler removes any
+ * listener and notifies the root provider that
+ * a node was removed. The node removed may have children for which
+ * a nodeRemoved callback was not invoked (see modelObjectCleared).
+ * @param element the removed element
+ * @param provider the provider that added the element
+ */
+ public void nodeRemoved(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
+ element.removePropertyChangeListener(listener);
+ this.provider.nodeRemoved(element, provider);
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Node removed: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * This method is invoked whenever a model object (i.e. node)
+ * is cleared from the model. This is similar to node removal but
+ * is deep.
+ * @param node the node that was cleared
+ */
+ public void modelObjectCleared(ISynchronizeModelElement node) {
+ node.removePropertyChangeListener(listener);
+ this.provider.modelObjectCleared(node);
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Node cleared: " + getDebugDisplayLabel(node)); //$NON-NLS-1$
+ }
+ }
+
+ private String getDebugDisplayLabel(ISynchronizeModelElement node) {
+ if (node == null) {
+ return "ROOT"; //$NON-NLS-1$
+ }
+ if (node.getResource() != null) {
+ return node.getResource().getFullPath().toString();
+ }
+ return node.getName();
+ }
+
+ private String getDebugDisplayLabel(AbstractSynchronizeModelProvider provider2) {
+ return provider2.toString();
+ }
+
+ @Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
if(provider.isDisposed()) {
set.removeSyncSetChangedListener(this);
} else {
- reset();
+ reset();
}
- }
+ }
- @Override
+ @Override
public void syncInfoChanged(final ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
if (! (event instanceof ISyncInfoTreeChangeEvent)) {
reset();
} else {
queueEvent(new SyncInfoSetChangeEvent(event), false);
}
- }
+ }
- /*
- * Handle the sync info set change event in the UI thread.
- */
- private void handleChanges(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
- runViewUpdate(() -> {
+ /*
+ * Handle the sync info set change event in the UI thread.
+ */
+ private void handleChanges(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
+ runViewUpdate(() -> {
provider.handleChanges((ISyncInfoTreeChangeEvent)event, monitor);
firePendingLabelUpdates();
}, true /* preserve expansion */);
- }
+ }
- @Override
+ @Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
// When errors occur we currently don't process them. It may be possible to decorate
// elements in the model with errors, but currently we prefer to let ignore and except
// another listener to display them.
- }
-
- public ISynchronizeModelProvider getProvider() {
- return provider;
- }
-
- public void connect(IProgressMonitor monitor) {
- getProvider().getSyncInfoSet().connect(this, monitor);
- }
-
- public void runViewUpdate(final Runnable runnable, final boolean preserveExpansion) {
- if (Utils.canUpdateViewer(getViewer()) || isPerformingBackgroundUpdate()) {
- internalRunViewUpdate(runnable, preserveExpansion);
- } else {
- if (Thread.currentThread() != getEventHandlerJob().getThread()) {
- // Run view update should only be called from the UI thread or
- // the update handler thread.
- // We will log the problem for now and make it an assert later
- TeamUIPlugin.log(IStatus.WARNING, "View update invoked from invalid thread", new TeamException("View update invoked from invalid thread")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- final Control ctrl = getViewer().getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().syncExec(() -> {
+ }
+
+ public ISynchronizeModelProvider getProvider() {
+ return provider;
+ }
+
+ public void connect(IProgressMonitor monitor) {
+ getProvider().getSyncInfoSet().connect(this, monitor);
+ }
+
+ public void runViewUpdate(final Runnable runnable, final boolean preserveExpansion) {
+ if (Utils.canUpdateViewer(getViewer()) || isPerformingBackgroundUpdate()) {
+ internalRunViewUpdate(runnable, preserveExpansion);
+ } else {
+ if (Thread.currentThread() != getEventHandlerJob().getThread()) {
+ // Run view update should only be called from the UI thread or
+ // the update handler thread.
+ // We will log the problem for now and make it an assert later
+ TeamUIPlugin.log(IStatus.WARNING, "View update invoked from invalid thread", new TeamException("View update invoked from invalid thread")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ final Control ctrl = getViewer().getControl();
+ if (ctrl != null && !ctrl.isDisposed()) {
+ ctrl.getDisplay().syncExec(() -> {
if (!ctrl.isDisposed()) {
BusyIndicator.showWhile(ctrl.getDisplay(), () -> internalRunViewUpdate(runnable, preserveExpansion));
}
});
- }
- }
- }
-
- /*
- * Return whether the event handler is performing a background view update.
- * In other words, a client has invoked <code>performUpdate</code>.
- */
- public boolean isPerformingBackgroundUpdate() {
- return Thread.currentThread() == getEventHandlerJob().getThread() && performingBackgroundUpdate;
- }
-
- /*
- * Method that can be called from the UI thread to update the view model.
- */
- private void internalRunViewUpdate(final Runnable runnable, boolean preserveExpansion) {
- StructuredViewer viewer = getViewer();
- IResource[] expanded = null;
- IResource[] selected = null;
+ }
+ }
+ }
+
+ /*
+ * Return whether the event handler is performing a background view update.
+ * In other words, a client has invoked <code>performUpdate</code>.
+ */
+ public boolean isPerformingBackgroundUpdate() {
+ return Thread.currentThread() == getEventHandlerJob().getThread() && performingBackgroundUpdate;
+ }
+
+ /*
+ * Method that can be called from the UI thread to update the view model.
+ */
+ private void internalRunViewUpdate(final Runnable runnable, boolean preserveExpansion) {
+ StructuredViewer viewer = getViewer();
+ IResource[] expanded = null;
+ IResource[] selected = null;
try {
- if (Utils.canUpdateViewer(viewer)) {
- viewer.getControl().setRedraw(false);
- if (preserveExpansion) {
- expanded = provider.getExpandedResources();
- selected = provider.getSelectedResources();
- }
- if (viewer instanceof AbstractTreeViewer && additionsMap == null)
- additionsMap = new HashMap<>();
- }
+ if (Utils.canUpdateViewer(viewer)) {
+ viewer.getControl().setRedraw(false);
+ if (preserveExpansion) {
+ expanded = provider.getExpandedResources();
+ selected = provider.getSelectedResources();
+ }
+ if (viewer instanceof AbstractTreeViewer && additionsMap == null)
+ additionsMap = new HashMap<>();
+ }
runnable.run();
} finally {
- if (Utils.canUpdateViewer(viewer)) {
- try {
- if (additionsMap != null && !additionsMap.isEmpty() && Utils.canUpdateViewer(viewer)) {
- for (Iterator iter = additionsMap.keySet().iterator(); iter.hasNext();) {
- ISynchronizeModelElement parent = (ISynchronizeModelElement) iter.next();
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Adding child view items of " + parent.getName()); //$NON-NLS-1$
- }
- Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
- ((AbstractTreeViewer)viewer).add(parent, toAdd.toArray(new Object[toAdd.size()]));
- }
- additionsMap = null;
- }
- if (expanded != null) {
- provider.expandResources(expanded);
- }
- if (selected != null) {
- provider.selectResources(selected);
- }
- } finally {
- viewer.getControl().setRedraw(true);
- }
- }
+ if (Utils.canUpdateViewer(viewer)) {
+ try {
+ if (additionsMap != null && !additionsMap.isEmpty() && Utils.canUpdateViewer(viewer)) {
+ for (Iterator iter = additionsMap.keySet().iterator(); iter.hasNext();) {
+ ISynchronizeModelElement parent = (ISynchronizeModelElement) iter.next();
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Adding child view items of " + parent.getName()); //$NON-NLS-1$
+ }
+ Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
+ ((AbstractTreeViewer)viewer).add(parent, toAdd.toArray(new Object[toAdd.size()]));
+ }
+ additionsMap = null;
+ }
+ if (expanded != null) {
+ provider.expandResources(expanded);
+ }
+ if (selected != null) {
+ provider.selectResources(selected);
+ }
+ } finally {
+ viewer.getControl().setRedraw(true);
+ }
+ }
}
ISynchronizeModelElement root = provider.getModelRoot();
if(root instanceof SynchronizeModelElement)
((SynchronizeModelElement)root).fireChanges();
- }
-
- /**
- * Execute a runnable which performs an update of the model being displayed
- * by the handler's provider. The runnable should be executed in a thread-safe manner
- * which esults in the view being updated.
- * @param runnable the runnable which updates the model.
- * @param preserveExpansion whether the expansion of the view should be preserver
- * @param updateInUIThread if <code>true</code>, the model will be updated in the
- * UI thread. Otherwise, the model will be updated in the handler thread and the view
- * updated in the UI thread at the end.
- */
- public void performUpdate(final IWorkspaceRunnable runnable, boolean preserveExpansion, boolean updateInUIThread) {
- if (updateInUIThread) {
- queueEvent(new BackgroundEventHandler.RunnableEvent(getUIUpdateRunnable(runnable, preserveExpansion), true), true);
- } else {
- queueEvent(new BackgroundEventHandler.RunnableEvent(getBackgroundUpdateRunnable(runnable, preserveExpansion), true), true);
- }
- }
-
- /**
- * Wrap the runnable in an outer runnable that preserves expansion.
- */
- private IWorkspaceRunnable getUIUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
- return monitor -> {
- final CoreException[] exception = new CoreException[] { null };
- runViewUpdate(() -> {
- try {
- runnable.run(monitor);
- } catch (CoreException e) {
- exception[0] = e;
- }
+ }
+
+ /**
+ * Execute a runnable which performs an update of the model being displayed
+ * by the handler's provider. The runnable should be executed in a thread-safe manner
+ * which esults in the view being updated.
+ * @param runnable the runnable which updates the model.
+ * @param preserveExpansion whether the expansion of the view should be preserver
+ * @param updateInUIThread if <code>true</code>, the model will be updated in the
+ * UI thread. Otherwise, the model will be updated in the handler thread and the view
+ * updated in the UI thread at the end.
+ */
+ public void performUpdate(final IWorkspaceRunnable runnable, boolean preserveExpansion, boolean updateInUIThread) {
+ if (updateInUIThread) {
+ queueEvent(new BackgroundEventHandler.RunnableEvent(getUIUpdateRunnable(runnable, preserveExpansion), true), true);
+ } else {
+ queueEvent(new BackgroundEventHandler.RunnableEvent(getBackgroundUpdateRunnable(runnable, preserveExpansion), true), true);
+ }
+ }
+
+ /**
+ * Wrap the runnable in an outer runnable that preserves expansion.
+ */
+ private IWorkspaceRunnable getUIUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
+ return monitor -> {
+ final CoreException[] exception = new CoreException[] { null };
+ runViewUpdate(() -> {
+ try {
+ runnable.run(monitor);
+ } catch (CoreException e) {
+ exception[0] = e;
+ }
}, true /* preserve expansion */);
- if (exception[0] != null)
- throw exception[0];
+ if (exception[0] != null)
+ throw exception[0];
};
- }
-
- /*
- * Wrap the runnable in an outer runnable that preserves expansion if requested
- * and refreshes the view when the update is completed.
- */
- private IWorkspaceRunnable getBackgroundUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
- return new IWorkspaceRunnable() {
- IResource[] expanded;
- IResource[] selected;
- @Override
+ }
+
+ /*
+ * Wrap the runnable in an outer runnable that preserves expansion if requested
+ * and refreshes the view when the update is completed.
+ */
+ private IWorkspaceRunnable getBackgroundUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
+ return new IWorkspaceRunnable() {
+ IResource[] expanded;
+ IResource[] selected;
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
- if (preserveExpansion)
- recordExpandedResources();
- try {
- performingBackgroundUpdate = true;
- runnable.run(monitor);
- } finally {
- performingBackgroundUpdate = false;
- }
- updateView();
-
- }
- private void recordExpandedResources() {
- final StructuredViewer viewer = getViewer();
- if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
- viewer.getControl().getDisplay().syncExec(() -> {
+ if (preserveExpansion)
+ recordExpandedResources();
+ try {
+ performingBackgroundUpdate = true;
+ runnable.run(monitor);
+ } finally {
+ performingBackgroundUpdate = false;
+ }
+ updateView();
+
+ }
+ private void recordExpandedResources() {
+ final StructuredViewer viewer = getViewer();
+ if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
+ viewer.getControl().getDisplay().syncExec(() -> {
if (viewer != null && !viewer.getControl().isDisposed()) {
- expanded = provider.getExpandedResources();
- selected = provider.getSelectedResources();
+ expanded = provider.getExpandedResources();
+ selected = provider.getSelectedResources();
}
});
- }
- }
- private void updateView() {
- // Refresh the view and then set the expansion
- runViewUpdate(() -> {
- provider.getViewer().refresh();
- if (expanded != null)
- provider.expandResources(expanded);
- if (selected != null)
- provider.selectResources(selected);
+ }
+ }
+ private void updateView() {
+ // Refresh the view and then set the expansion
+ runViewUpdate(() -> {
+ provider.getViewer().refresh();
+ if (expanded != null)
+ provider.expandResources(expanded);
+ if (selected != null)
+ provider.selectResources(selected);
}, false /* do not preserve expansion (since it is done above) */);
- }
- };
- }
+ }
+ };
+ }
/*
* Execute the RunnableEvent
@@ -689,29 +689,29 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
}
}
- /**
- * Add the element to the viewer.
- * @param parent the parent of the element which is already added to the viewer
- * @param element the element to be added to the viewer
- */
- protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
- if (additionsMap == null) {
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Added view item " + element.getName()); //$NON-NLS-1$
- }
- AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
- viewer.add(parent, element);
- } else {
- // Accumulate the additions
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Queueing view item for addition " + element.getName()); //$NON-NLS-1$
- }
- Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
- if (toAdd == null) {
- toAdd = new HashSet<>();
- additionsMap.put(parent, toAdd);
- }
- toAdd.add(element);
- }
- }
+ /**
+ * Add the element to the viewer.
+ * @param parent the parent of the element which is already added to the viewer
+ * @param element the element to be added to the viewer
+ */
+ protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
+ if (additionsMap == null) {
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Added view item " + element.getName()); //$NON-NLS-1$
+ }
+ AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
+ viewer.add(parent, element);
+ } else {
+ // Accumulate the additions
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Queueing view item for addition " + element.getName()); //$NON-NLS-1$
+ }
+ Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
+ if (toAdd == null) {
+ toAdd = new HashSet<>();
+ additionsMap.put(parent, toAdd);
+ }
+ toAdd.add(element);
+ }
+ }
}
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 6e98c6ee4..3380973b9 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
@@ -116,10 +116,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
public static final int CHECKBOX = TreeViewerAdvisor.CHECKBOX;
- // State flags
- private static final int UNINITIALIZED = 0;
- private static final int INITIALIZED = 1;
- private static final int DISPOSED = 2;
+ // State flags
+ private static final int UNINITIALIZED = 0;
+ private static final int INITIALIZED = 1;
+ private static final int DISPOSED = 2;
private ISynchronizeParticipant participant;
private ISynchronizePageSite site;
@@ -192,25 +192,25 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void addActionContribution(SynchronizePageActionGroup contribution) {
- int currentActionState;
+ int currentActionState;
synchronized(actionContributions) {
- // Determine the action state while locked so we handle the addition properly below
- currentActionState = actionState;
- if (currentActionState != DISPOSED)
- actionContributions.add(contribution);
+ // Determine the action state while locked so we handle the addition properly below
+ currentActionState = actionState;
+ if (currentActionState != DISPOSED)
+ actionContributions.add(contribution);
}
if (currentActionState == INITIALIZED) {
- // This is tricky because we are doing the initialize while not locked.
- // It is possible that another thread is concurrently disposing the contributions
- // but we can't lock while calling client code. We'll change for DISPOSE after
- // we initialize and, if we are disposed, we dispose this one, just in case.
+ // This is tricky because we are doing the initialize while not locked.
+ // It is possible that another thread is concurrently disposing the contributions
+ // but we can't lock while calling client code. We'll change for DISPOSE after
+ // we initialize and, if we are disposed, we dispose this one, just in case.
contribution.initialize(this);
- if (actionState == DISPOSED) {
- contribution .dispose();
- }
+ if (actionState == DISPOSED) {
+ contribution .dispose();
+ }
} else if (currentActionState == DISPOSED) {
- contribution.dispose();
- }
+ contribution.dispose();
+ }
}
@Override
@@ -244,16 +244,16 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void initialize(final ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
- // need to synchronize here to ensure that actions that are added concurrently also get initialized
- final Object[] listeners;
- synchronized(actionContributions) {
- if (actionState != UNINITIALIZED) {
- // Initialization has already taken place so just return.
- return;
- }
- actionState = INITIALIZED;
- listeners = actionContributions.getListeners();
- }
+ // need to synchronize here to ensure that actions that are added concurrently also get initialized
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ if (actionState != UNINITIALIZED) {
+ // Initialization has already taken place so just return.
+ return;
+ }
+ actionState = INITIALIZED;
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -272,10 +272,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void setContext(final ActionContext context) {
super.setContext(context);
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -298,10 +298,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
*/
@Override
public void fillContextMenu(final IMenuManager manager) {
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -326,10 +326,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
if (actionState == UNINITIALIZED) {
initialize(this);
}
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -347,10 +347,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void updateActionBars() {
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -368,10 +368,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void modelChanged(final ISynchronizeModelElement root) {
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -390,11 +390,11 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void dispose() {
super.dispose();
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- actionState = DISPOSED;
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ actionState = DISPOSED;
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
index f38e5bc85..bb2bffbd6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -179,8 +179,8 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
* Preference key to save
*/
private static final String KEY_LAST_ACTIVE_PARTICIPANT_ID = "lastactiveparticipant_id"; //$NON-NLS-1$
- private static final String KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID = "lastactiveparticipant_sec_id"; //$NON-NLS-1$
- private static final String KEY_LINK_WITH_EDITOR = "linkWithEditor"; //$NON-NLS-1$
+ private static final String KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID = "lastactiveparticipant_sec_id"; //$NON-NLS-1$
+ private static final String KEY_LINK_WITH_EDITOR = "linkWithEditor"; //$NON-NLS-1$
private static final String KEY_SETTINGS_SECTION= "SynchronizeViewSettings"; //$NON-NLS-1$
@@ -338,14 +338,14 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
getSite().getPage().removePartListener(fLinkWithEditorListener);
}
- /**
- *
- */
- private void rememberCurrentParticipant() {
- IDialogSettings section = getDialogSettings();
- section.put(KEY_LAST_ACTIVE_PARTICIPANT_ID, activeParticipantRef.getId());
- section.put(KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID, activeParticipantRef.getSecondaryId());
- }
+ /**
+ *
+ */
+ private void rememberCurrentParticipant() {
+ IDialogSettings section = getDialogSettings();
+ section.put(KEY_LAST_ACTIVE_PARTICIPANT_ID, activeParticipantRef.getId());
+ section.put(KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID, activeParticipantRef.getSecondaryId());
+ }
@Override
protected IPage createDefaultPage(PageBook book) {
@@ -659,7 +659,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
private String getSettingsKey(ISynchronizeParticipant participant) {
String id = participant.getId();
String secondaryId = participant.getSecondaryId();
- return secondaryId == null ? id : id + '.' + secondaryId;
+ return secondaryId == null ? id : id + '.' + secondaryId;
}
private IDialogSettings getDialogSettings(ISynchronizeParticipant participant) {
@@ -1104,7 +1104,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
if (input instanceof IEditorInput) {
return showInput(getInputFromEditor((IEditorInput) input));
}
- return showInput(input);
+ return showInput(input);
}
return false;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
index 479e016fe..425806ddb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
@@ -33,7 +33,7 @@ public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
@Override
public boolean equals(Object obj) {
return (obj instanceof SynchronizeViewWorkbenchPart) &&
- participant.equals(((SynchronizeViewWorkbenchPart)obj).getParticipant());
+ participant.equals(((SynchronizeViewWorkbenchPart)obj).getParticipant());
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
index a4fc927c9..1223f1640 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
@@ -166,16 +166,16 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
* @param configuration
*/
protected SynchronizeModelManager createModelManager(ISynchronizePageConfiguration configuration) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- ChangeSetCapability changeSetCapability = provider.getChangeSetCapability();
- if (changeSetCapability != null) {
- if (changeSetCapability.supportsActiveChangeSets() || changeSetCapability.supportsCheckedInChangeSets()) {
- return new ChangeSetModelManager(configuration);
- }
- }
- }
+ ISynchronizeParticipant participant = configuration.getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ IChangeSetProvider provider = (IChangeSetProvider) participant;
+ ChangeSetCapability changeSetCapability = provider.getChangeSetCapability();
+ if (changeSetCapability != null) {
+ if (changeSetCapability.supportsActiveChangeSets() || changeSetCapability.supportsCheckedInChangeSets()) {
+ return new ChangeSetModelManager(configuration);
+ }
+ }
+ }
return new HierarchicalModelManager(configuration);
}
@@ -240,21 +240,21 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
viewer.setSorter(modelProvider.getViewerSorter());
viewer.setInput(modelRoot);
modelProvider.addPropertyChangeListener(event -> {
- if (event.getProperty() == ISynchronizeModelProvider.P_VIEWER_SORTER) {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- viewer.getControl().getDisplay().syncExec(() -> {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- ViewerSorter newSorter = modelProvider.getViewerSorter();
- ViewerSorter oldSorter = viewer.getSorter();
- if (newSorter == oldSorter) {
- viewer.refresh();
- } else {
- viewer.setSorter(newSorter);
- }
- }
+ if (event.getProperty() == ISynchronizeModelProvider.P_VIEWER_SORTER) {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().getDisplay().syncExec(() -> {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ ViewerSorter newSorter = modelProvider.getViewerSorter();
+ ViewerSorter oldSorter = viewer.getSorter();
+ if (newSorter == oldSorter) {
+ viewer.refresh();
+ } else {
+ viewer.setSorter(newSorter);
+ }
+ }
});
- }
- }
+ }
+ }
});
}
}
@@ -271,24 +271,24 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
final DragSourceListener listener = new DragSourceListener() {
- @Override
+ @Override
public void dragStart(DragSourceEvent event) {
final IStructuredSelection selection = viewer.getStructuredSelection();
- final Object [] array= selection.toArray();
- event.doit= Utils.getResources(array).length > 0;
+ final Object [] array= selection.toArray();
+ event.doit= Utils.getResources(array).length > 0;
}
- @Override
+ @Override
public void dragSetData(DragSourceEvent event) {
- if (ResourceTransfer.getInstance().isSupportedType(event.dataType)) {
- final IStructuredSelection selection= viewer.getStructuredSelection();
- final Object [] array= selection.toArray();
- event.data= Utils.getResources(array);
- }
- }
+ if (ResourceTransfer.getInstance().isSupportedType(event.dataType)) {
+ final IStructuredSelection selection= viewer.getStructuredSelection();
+ final Object [] array= selection.toArray();
+ event.data= Utils.getResources(array);
+ }
+ }
- @Override
+ @Override
public void dragFinished(DragSourceEvent event) {}
};
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 a9b59a959..65839d020 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
@@ -66,103 +66,103 @@ import org.eclipse.ui.actions.BaseSelectionListenerAction;
*/
public class ChangeSetActionGroup extends SynchronizePageActionGroup {
- /**
- * Menu group that can be added to the context menu
- */
- public final static String CHANGE_SET_GROUP = "change_set_group"; //$NON-NLS-1$
+ /**
+ * Menu group that can be added to the context menu
+ */
+ public final static String CHANGE_SET_GROUP = "change_set_group"; //$NON-NLS-1$
// Constants for persisting sorting options
private static final String P_LAST_COMMENTSORT = TeamUIPlugin.ID + ".P_LAST_COMMENT_SORT"; //$NON-NLS-1$
- public static final FastSyncInfoFilter OUTGOING_RESOURCE_FILTER = new SyncInfoDirectionFilter(
- new int[] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING });
+ public static final FastSyncInfoFilter OUTGOING_RESOURCE_FILTER = new SyncInfoDirectionFilter(
+ new int[] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING });
private class CreateChangeSetAction extends SynchronizeModelAction {
- public CreateChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_0, configuration);
- }
+ public CreateChangeSetAction(ISynchronizePageConfiguration configuration) {
+ super(TeamUIMessages.ChangeLogModelProvider_0, configuration);
+ }
@Override
protected boolean needsToSaveDirtyEditors() {
return false;
}
- @Override
+ @Override
protected FastSyncInfoFilter getSyncInfoFilter() {
- return OUTGOING_RESOURCE_FILTER;
- }
+ return OUTGOING_RESOURCE_FILTER;
+ }
- @Override
+ @Override
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new SynchronizeModelOperation(configuration, elements) {
- @Override
+ return new SynchronizeModelOperation(configuration, elements) {
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- syncExec(() -> {
- ActiveChangeSet set = createChangeSet(getDiffs(getSyncInfoSet().getResources()));
- if (set != null) {
- getActiveChangeSetManager().add(set);
- }
+ syncExec(() -> {
+ ActiveChangeSet set = createChangeSet(getDiffs(getSyncInfoSet().getResources()));
+ if (set != null) {
+ getActiveChangeSetManager().add(set);
+ }
});
- }
- };
- }
+ }
+ };
+ }
}
private abstract class ChangeSetAction extends BaseSelectionListenerAction {
- public ChangeSetAction(String title, ISynchronizePageConfiguration configuration) {
- super(title);
- }
+ public ChangeSetAction(String title, ISynchronizePageConfiguration configuration) {
+ super(title);
+ }
- @Override
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
- return getSelectedSet() != null;
- }
-
- protected ActiveChangeSet getSelectedSet() {
- IStructuredSelection selection = getStructuredSelection();
- if (selection.size() == 1) {
- Object first = selection.getFirstElement();
- if (first instanceof IAdaptable) {
- Object adapter = ((IAdaptable)first).getAdapter(ChangeSet.class);
- if (adapter instanceof ActiveChangeSet) {
- return (ActiveChangeSet)adapter;
- }
- }
- }
- return null;
- }
+ return getSelectedSet() != null;
+ }
+
+ protected ActiveChangeSet getSelectedSet() {
+ IStructuredSelection selection = getStructuredSelection();
+ if (selection.size() == 1) {
+ Object first = selection.getFirstElement();
+ if (first instanceof IAdaptable) {
+ Object adapter = ((IAdaptable)first).getAdapter(ChangeSet.class);
+ if (adapter instanceof ActiveChangeSet) {
+ return (ActiveChangeSet)adapter;
+ }
+ }
+ }
+ return null;
+ }
}
private class EditChangeSetAction extends ChangeSetAction {
- public EditChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_6, configuration);
- }
+ public EditChangeSetAction(ISynchronizePageConfiguration configuration) {
+ super(TeamUIMessages.ChangeLogModelProvider_6, configuration);
+ }
- @Override
+ @Override
public void run() {
- ActiveChangeSet set = getSelectedSet();
- if (set == null) return;
- editChangeSet(set);
- }
+ ActiveChangeSet set = getSelectedSet();
+ if (set == null) return;
+ editChangeSet(set);
+ }
}
private class RemoveChangeSetAction extends ChangeSetAction {
- public RemoveChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_7, configuration);
- }
+ public RemoveChangeSetAction(ISynchronizePageConfiguration configuration) {
+ super(TeamUIMessages.ChangeLogModelProvider_7, configuration);
+ }
- @Override
+ @Override
public void run() {
- ActiveChangeSet set = getSelectedSet();
- if (set == null) return;
- if (MessageDialog.openConfirm(getConfiguration().getSite().getShell(), TeamUIMessages.ChangeSetActionGroup_0, NLS.bind(TeamUIMessages.ChangeSetActionGroup_1, new String[] { LegacyActionTools.escapeMnemonics(set.getTitle()) }))) { //
- getActiveChangeSetManager().remove(set);
- }
- }
+ ActiveChangeSet set = getSelectedSet();
+ if (set == null) return;
+ if (MessageDialog.openConfirm(getConfiguration().getSite().getShell(), TeamUIMessages.ChangeSetActionGroup_0, NLS.bind(TeamUIMessages.ChangeSetActionGroup_1, new String[] { LegacyActionTools.escapeMnemonics(set.getTitle()) }))) { //
+ getActiveChangeSetManager().remove(set);
+ }
+ }
}
private class MakeDefaultChangeSetAction extends ChangeSetAction {
@@ -198,44 +198,44 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
private class AddToChangeSetAction extends SynchronizeModelAction {
- private final ActiveChangeSet set;
+ private final ActiveChangeSet set;
- public AddToChangeSetAction(ISynchronizePageConfiguration configuration, ActiveChangeSet set, ISelection selection) {
- super(set == null ? TeamUIMessages.ChangeSetActionGroup_2 : LegacyActionTools.escapeMnemonics(set.getTitle()), configuration);
- this.set = set;
- selectionChanged(selection);
- }
+ public AddToChangeSetAction(ISynchronizePageConfiguration configuration, ActiveChangeSet set, ISelection selection) {
+ super(set == null ? TeamUIMessages.ChangeSetActionGroup_2 : LegacyActionTools.escapeMnemonics(set.getTitle()), configuration);
+ this.set = set;
+ selectionChanged(selection);
+ }
- @Override
+ @Override
protected FastSyncInfoFilter getSyncInfoFilter() {
- return OUTGOING_RESOURCE_FILTER;
- }
+ return OUTGOING_RESOURCE_FILTER;
+ }
@Override
protected boolean needsToSaveDirtyEditors() {
return false;
}
- @Override
+ @Override
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new SynchronizeModelOperation(configuration, elements) {
- @Override
+ return new SynchronizeModelOperation(configuration, elements) {
+ @Override
public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- IResource[] resources = getSyncInfoSet().getResources();
- if (set != null) {
- IDiff[] diffArray = getDiffs(resources);
+ throws InvocationTargetException, InterruptedException {
+ IResource[] resources = getSyncInfoSet().getResources();
+ if (set != null) {
+ IDiff[] diffArray = getDiffs(resources);
set.add(diffArray);
- } else {
- ChangeSet[] sets = getActiveChangeSetManager().getSets();
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet activeSet = (ActiveChangeSet)sets[i];
+ } else {
+ ChangeSet[] sets = getActiveChangeSetManager().getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ActiveChangeSet activeSet = (ActiveChangeSet)sets[i];
activeSet.remove(resources);
- }
- }
- }
- };
- }
+ }
+ }
+ }
+ };
+ }
}
/* *****************************************************************************
@@ -252,7 +252,7 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
@Override
public void run() {
if (isChecked() && sortCriteria != criteria) {
- sortCriteria = criteria;
+ sortCriteria = criteria;
String key = getSettingsKey();
IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
@@ -264,11 +264,11 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
}
public void update() {
- setChecked(criteria == sortCriteria);
+ setChecked(criteria == sortCriteria);
}
protected String getSettingsKey() {
- return P_LAST_COMMENTSORT;
+ return P_LAST_COMMENTSORT;
}
}
@@ -283,19 +283,19 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
private MenuManager sortByComment;
private CreateChangeSetAction createChangeSet;
private MenuManager addToChangeSet;
- private EditChangeSetAction editChangeSet;
- private RemoveChangeSetAction removeChangeSet;
- private MakeDefaultChangeSetAction makeDefault;
+ private EditChangeSetAction editChangeSet;
+ private RemoveChangeSetAction removeChangeSet;
+ private MakeDefaultChangeSetAction makeDefault;
- private SynchronizePageActionGroup subActions;
+ private SynchronizePageActionGroup subActions;
- /*
- * The currently chosen sort criteria
- */
- private int sortCriteria = ChangeSetModelSorter.DATE;
+ /*
+ * The currently chosen sort criteria
+ */
+ private int sortCriteria = ChangeSetModelSorter.DATE;
- public static int getSortCriteria(ISynchronizePageConfiguration configuration) {
- int sortCriteria = ChangeSetModelSorter.DATE;
+ public static int getSortCriteria(ISynchronizePageConfiguration configuration) {
+ int sortCriteria = ChangeSetModelSorter.DATE;
try {
IDialogSettings pageSettings = configuration.getSite().getPageSettings();
if(pageSettings != null) {
@@ -305,27 +305,27 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
// ignore and use the defaults.
}
switch (sortCriteria) {
- case ChangeSetModelSorter.COMMENT:
- case ChangeSetModelSorter.DATE:
- case ChangeSetModelSorter.USER:
- break;
- default:
- sortCriteria = ChangeSetModelSorter.DATE;
- break;
- }
+ case ChangeSetModelSorter.COMMENT:
+ case ChangeSetModelSorter.DATE:
+ case ChangeSetModelSorter.USER:
+ break;
+ default:
+ sortCriteria = ChangeSetModelSorter.DATE;
+ break;
+ }
return sortCriteria;
- }
+ }
- public ChangeSetActionGroup(ChangeSetModelProvider provider) {
- this.provider = provider;
- }
+ public ChangeSetActionGroup(ChangeSetModelProvider provider) {
+ this.provider = provider;
+ }
@Override
public void initialize(ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
if (getChangeSetCapability().supportsCheckedInChangeSets()) {
- sortCriteria = getSortCriteria(configuration);
+ sortCriteria = getSortCriteria(configuration);
sortByComment = new MenuManager(TeamUIMessages.ChangeLogModelProvider_0a);
sortByComment.add(new ToggleSortOrderAction(TeamUIMessages.ChangeLogModelProvider_1a, ChangeSetModelSorter.COMMENT));
sortByComment.add(new ToggleSortOrderAction(TeamUIMessages.ChangeLogModelProvider_2a, ChangeSetModelSorter.DATE));
@@ -346,16 +346,16 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
subActions = getChangeSetCapability().getActionGroup();
if (subActions != null) {
- subActions.initialize(configuration);
+ subActions.initialize(configuration);
}
}
- @Override
+ @Override
public void fillContextMenu(IMenuManager menu) {
- if (getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- appendToGroup(menu, ISynchronizePageConfiguration.SORT_GROUP, sortByComment);
- }
- if (getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ if (getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
+ appendToGroup(menu, ISynchronizePageConfiguration.SORT_GROUP, sortByComment);
+ }
+ if (getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
appendToGroup(
menu,
CHANGE_SET_GROUP,
@@ -372,102 +372,102 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
menu,
CHANGE_SET_GROUP,
makeDefault);
- }
+ }
if (subActions != null) {
- subActions.fillContextMenu(menu);
+ subActions.fillContextMenu(menu);
}
- }
+ }
- protected void addChangeSets(IMenuManager manager) {
- ChangeSet[] sets = getActiveChangeSetManager().getSets();
- Arrays.sort(sets, new Comparator<ChangeSet>() {
- private Collator collator = Collator.getInstance();
- @Override
+ protected void addChangeSets(IMenuManager manager) {
+ ChangeSet[] sets = getActiveChangeSetManager().getSets();
+ Arrays.sort(sets, new Comparator<ChangeSet>() {
+ private Collator collator = Collator.getInstance();
+ @Override
public int compare(ChangeSet o1, ChangeSet o2) {
- return collator.compare(o1.getName(), o2.getName());
- }
- });
- ISelection selection = getContext().getSelection();
- createChangeSet.selectionChanged(selection);
+ return collator.compare(o1.getName(), o2.getName());
+ }
+ });
+ ISelection selection = getContext().getSelection();
+ createChangeSet.selectionChanged(selection);
addToChangeSet.add(createChangeSet);
addToChangeSet.add(new Separator());
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet set = (ActiveChangeSet)sets[i];
- AddToChangeSetAction action = new AddToChangeSetAction(getConfiguration(), set, selection);
- manager.add(action);
- }
- addToChangeSet.add(new Separator());
- // Action that removes change set resources
- addToChangeSet.add(new AddToChangeSetAction(getConfiguration(), null, selection));
- }
-
- /**
- * Return the change set manager for the current page.
- * @return the change set manager for the current page
- */
- protected ActiveChangeSetManager getActiveChangeSetManager() {
- return getChangeSetCapability().getActiveChangeSetManager();
- }
+ for (int i = 0; i < sets.length; i++) {
+ ActiveChangeSet set = (ActiveChangeSet)sets[i];
+ AddToChangeSetAction action = new AddToChangeSetAction(getConfiguration(), set, selection);
+ manager.add(action);
+ }
+ addToChangeSet.add(new Separator());
+ // Action that removes change set resources
+ addToChangeSet.add(new AddToChangeSetAction(getConfiguration(), null, selection));
+ }
+
+ /**
+ * Return the change set manager for the current page.
+ * @return the change set manager for the current page
+ */
+ protected ActiveChangeSetManager getActiveChangeSetManager() {
+ return getChangeSetCapability().getActiveChangeSetManager();
+ }
@Override
public void dispose() {
- if (addToChangeSet != null) {
+ if (addToChangeSet != null) {
addToChangeSet.dispose();
addToChangeSet.removeAll();
- }
- if (sortByComment != null) {
+ }
+ if (sortByComment != null) {
sortByComment.dispose();
sortByComment.removeAll();
- }
- if (subActions != null) {
- subActions.dispose();
- }
+ }
+ if (subActions != null) {
+ subActions.dispose();
+ }
super.dispose();
}
- @Override
+ @Override
public void updateActionBars() {
- if (editChangeSet != null)
- editChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
- if (removeChangeSet != null)
- removeChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
- if (makeDefault != null)
- makeDefault.selectionChanged((IStructuredSelection)getContext().getSelection());
- super.updateActionBars();
- }
-
- private void syncExec(final Runnable runnable) {
+ if (editChangeSet != null)
+ editChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
+ if (removeChangeSet != null)
+ removeChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
+ if (makeDefault != null)
+ makeDefault.selectionChanged((IStructuredSelection)getContext().getSelection());
+ super.updateActionBars();
+ }
+
+ private void syncExec(final Runnable runnable) {
final Control ctrl = getConfiguration().getPage().getViewer().getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.getDisplay().syncExec(() -> {
if (!ctrl.isDisposed()) {
- runnable.run();
+ runnable.run();
}
});
}
- }
+ }
- /**
- * Return a viewer sorter that utilizes the sort criteria
- * selected by the user.
- * @return a sorter
- */
+ /**
+ * Return a viewer sorter that utilizes the sort criteria
+ * selected by the user.
+ * @return a sorter
+ */
public ViewerSorter getViewerSorter() {
return new ChangeSetModelSorter(provider, sortCriteria);
}
- private ActiveChangeSet createChangeSet(IDiff[] diffs) {
- return getChangeSetCapability().createChangeSet(getConfiguration(), diffs);
- }
+ private ActiveChangeSet createChangeSet(IDiff[] diffs) {
+ return getChangeSetCapability().createChangeSet(getConfiguration(), diffs);
+ }
- private void editChangeSet(ActiveChangeSet set) {
- getChangeSetCapability().editChangeSet(getConfiguration(), set);
- }
+ private void editChangeSet(ActiveChangeSet set) {
+ getChangeSetCapability().editChangeSet(getConfiguration(), set);
+ }
- private ChangeSetCapability getChangeSetCapability() {
- return provider.getChangeSetCapability();
- }
+ private ChangeSetCapability getChangeSetCapability() {
+ return provider.getChangeSetCapability();
+ }
private IDiff[] getDiffs(IResource[] resources) {
List<IDiff> diffs = new ArrayList<>();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
index 89d673e6e..6b9513c55 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
@@ -53,36 +53,36 @@ import org.eclipse.ui.part.ResourceTransfer;
*/
class CopyToClipboardAction extends SelectionListenerAction {
- private static final String EOL = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String EOL = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- private final static String ID= TeamUIPlugin.PLUGIN_ID + ".synchronize.action.copy"; //$NON-NLS-1$
+ private final static String ID= TeamUIPlugin.PLUGIN_ID + ".synchronize.action.copy"; //$NON-NLS-1$
- private final Shell fShell;
- private final Clipboard fClipboard;
+ private final Shell fShell;
+ private final Clipboard fClipboard;
private final INavigatorContentService navigatorContentService;
- protected CopyToClipboardAction(Shell shell, INavigatorContentService navigatorContentService) {
- super(TeamUIMessages.CopyToClipboardAction_1);
+ protected CopyToClipboardAction(Shell shell, INavigatorContentService navigatorContentService) {
+ super(TeamUIMessages.CopyToClipboardAction_1);
this.navigatorContentService = navigatorContentService;
- Assert.isNotNull(shell);
- fShell= shell;
- fClipboard= new Clipboard(shell.getDisplay());
- setToolTipText(TeamUIMessages.CopyToClipboardAction_2);
- setId(ID);
- }
+ Assert.isNotNull(shell);
+ fShell= shell;
+ fClipboard= new Clipboard(shell.getDisplay());
+ setToolTipText(TeamUIMessages.CopyToClipboardAction_2);
+ setId(ID);
+ }
- @Override
+ @Override
public void run() {
copyResources(getSelectedResources(), getTextualClipboardContents());
}
- /*
- * Return a text representation of all selected elements.
- * Use the name from the tree node so what is copied
- * matches what appears in the tree.
- */
- private String getTextualClipboardContents() {
+ /*
+ * Return a text representation of all selected elements.
+ * Use the name from the tree node so what is copied
+ * matches what appears in the tree.
+ */
+ private String getTextualClipboardContents() {
StringBuilder buf = new StringBuilder();
int i = 0;
IStructuredSelection structuredSelection = getStructuredSelection();
@@ -177,36 +177,36 @@ class CopyToClipboardAction extends SelectionListenerAction {
* @param fileNames file names of the resources to copy to the clipboard
* @param names string representation of all names
*/
- private void setClipboard(IResource[] resources, String[] fileNames, String names) {
- try {
- // set the clipboard contents
- List data = new ArrayList();
- List<Transfer> dataTypes = new ArrayList<>();
- if (resources.length > 0) {
- data.add(resources);
- dataTypes.add(ResourceTransfer.getInstance());
- }
- if (fileNames.length > 0) {
- data.add(fileNames);
- dataTypes.add(FileTransfer.getInstance());
- }
- if (names != null && names.length() > 0) {
- data.add(names);
- dataTypes.add(TextTransfer.getInstance());
- }
- if (!data.isEmpty())
- fClipboard.setContents(
- data.toArray(),
- dataTypes.toArray(new Transfer[dataTypes.size()]));
- } catch (SWTError e) {
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(fShell, TeamUIMessages.CopyToClipboardAction_3, TeamUIMessages.CopyToClipboardAction_4))
- setClipboard(resources, fileNames, names);
- }
- }
+ private void setClipboard(IResource[] resources, String[] fileNames, String names) {
+ try {
+ // set the clipboard contents
+ List data = new ArrayList();
+ List<Transfer> dataTypes = new ArrayList<>();
+ if (resources.length > 0) {
+ data.add(resources);
+ dataTypes.add(ResourceTransfer.getInstance());
+ }
+ if (fileNames.length > 0) {
+ data.add(fileNames);
+ dataTypes.add(FileTransfer.getInstance());
+ }
+ if (names != null && names.length() > 0) {
+ data.add(names);
+ dataTypes.add(TextTransfer.getInstance());
+ }
+ if (!data.isEmpty())
+ fClipboard.setContents(
+ data.toArray(),
+ dataTypes.toArray(new Transfer[dataTypes.size()]));
+ } catch (SWTError e) {
+ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
+ throw e;
+ if (MessageDialog.openQuestion(fShell, TeamUIMessages.CopyToClipboardAction_3, TeamUIMessages.CopyToClipboardAction_4))
+ setClipboard(resources, fileNames, names);
+ }
+ }
- @Override
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
if (!super.updateSelection(selection))
return false;
@@ -250,7 +250,7 @@ class CopyToClipboardAction extends SelectionListenerAction {
@Override
protected List<? extends IResource> getSelectedResources() {
- // Calling our own selection utility because the elements in the
+ // Calling our own selection utility because the elements in the
// synchronize view can't adapt to IResource because we don't want the usual object
// contribution/ on them.
return Arrays.asList(Utils.getResources(getStructuredSelection().toArray()));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
index 3afe5d6e2..9e49dd9fe 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
@@ -55,26 +55,26 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup {
}
}
- @Override
+ @Override
public void fillActionBars(IActionBars actionBars) {
- if (openWithActions != null) openWithActions.fillActionBars(actionBars);
- if (refactorActions != null) refactorActions.fillActionBars(actionBars);
- if (actionBars != null && showPreferences != null) {
- IMenuManager menu = actionBars.getMenuManager();
- appendToGroup(menu, ISynchronizePageConfiguration.PREFERENCES_GROUP, showPreferences);
- }
- }
+ if (openWithActions != null) openWithActions.fillActionBars(actionBars);
+ if (refactorActions != null) refactorActions.fillActionBars(actionBars);
+ if (actionBars != null && showPreferences != null) {
+ IMenuManager menu = actionBars.getMenuManager();
+ appendToGroup(menu, ISynchronizePageConfiguration.PREFERENCES_GROUP, showPreferences);
+ }
+ }
- @Override
+ @Override
public void updateActionBars() {
- if (openWithActions != null) openWithActions.updateActionBars();
- if (refactorActions != null) refactorActions.updateActionBars();
- }
+ if (openWithActions != null) openWithActions.updateActionBars();
+ if (refactorActions != null) refactorActions.updateActionBars();
+ }
@Override
public void fillContextMenu(IMenuManager manager) {
- final IContributionItem fileGroup = findGroup(manager, ISynchronizePageConfiguration.FILE_GROUP);
+ final IContributionItem fileGroup = findGroup(manager, ISynchronizePageConfiguration.FILE_GROUP);
if (openWithActions != null && fileGroup != null) {
openWithActions.fillContextMenu(manager, fileGroup.getId());
}
@@ -92,9 +92,9 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup {
if (openWithActions != null) openWithActions.dispose();
}
- @Override
+ @Override
public void setContext(ActionContext context) {
- if (openWithActions != null) openWithActions.setContext(context);
- if (refactorActions != null) refactorActions.setContext(context);
- }
+ if (openWithActions != null) openWithActions.setContext(context);
+ if (refactorActions != null) refactorActions.setContext(context);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
index bf37bf446..761eadfed 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
@@ -173,7 +173,7 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
return null;
}
};
- syncLatest = hs.activateHandler("org.eclipse.team.ui.synchronizeLast", handler); //$NON-NLS-1$
+ syncLatest = hs.activateHandler("org.eclipse.team.ui.synchronizeLast", handler); //$NON-NLS-1$
}
setMenuCreator(this);
TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
index 735508da8..37aa9eba9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
@@ -52,7 +52,7 @@ public class NavigateAction extends Action {
/**
* Two types of navigation is supported: navigation that is specific to coordinating between a view
* and a compare editor and navigation simply using the configured navigator.
- */
+ */
@Override
public void run() {
ICompareNavigator nav = (ICompareNavigator)configuration.getProperty(SynchronizePageConfiguration.P_NAVIGATOR);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index 9d139ae12..4ac48f61d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -104,11 +104,11 @@ public class OpenInCompareAction extends Action {
// all files
IResource resources[] = Utils.getResources(elements);
for (int i = 0; i < resources.length; i++) {
- if (resources[i].getType() != IResource.FILE) {
- // Only supported if all the items are files.
- return false;
- }
- }
+ if (resources[i].getType() != IResource.FILE) {
+ // Only supported if all the items are files.
+ return false;
+ }
+ }
}
return true;
}
@@ -210,32 +210,32 @@ public class OpenInCompareAction extends Action {
return page;
}
- public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page) {
- // try to reuse editors, if possible
+ public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page) {
+ // try to reuse editors, if possible
openCompareEditor(input, page, true);
}
- public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, boolean reuseEditorIfPossible) {
- if (page == null || input == null)
- return;
+ public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, boolean reuseEditorIfPossible) {
+ if (page == null || input == null)
+ return;
IEditorPart editor = Utils.findReusableCompareEditor(input, page,
new Class[] { SyncInfoCompareInput.class,
ModelCompareEditorInput.class });
- // reuse editor only for single selection
- if(editor != null && reuseEditorIfPossible) {
- IEditorInput otherInput = editor.getEditorInput();
- if(otherInput.equals(input)) {
- // simply provide focus to editor
- page.activate(editor);
- } else {
- // if editor is currently not open on that input either re-use existing
- CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
- page.activate(editor);
- }
- } else {
- CompareUI.openCompareEditorOnPage(input, page);
- }
- }
+ // reuse editor only for single selection
+ if(editor != null && reuseEditorIfPossible) {
+ IEditorInput otherInput = editor.getEditorInput();
+ if(otherInput.equals(input)) {
+ // simply provide focus to editor
+ page.activate(editor);
+ } else {
+ // if editor is currently not open on that input either re-use existing
+ CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
+ page.activate(editor);
+ }
+ } else {
+ CompareUI.openCompareEditorOnPage(input, page);
+ }
+ }
/**
* Returns an editor handle if a SyncInfoCompareInput compare editor is opened on
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
index 9708c6d71..fba0cd937 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
@@ -89,11 +89,11 @@ public class OpenWithActionGroup extends ActionGroup {
*/
private void fillOpenWithMenu(IMenuManager menu, String groupId, IStructuredSelection selection) {
- // Only supported if at least one file is selected.
- if (selection == null || selection.size() < 1)
- return;
- Object[] elements = selection.toArray();
- IResource resources[] = Utils.getResources(elements);
+ // Only supported if at least one file is selected.
+ if (selection == null || selection.size() < 1)
+ return;
+ Object[] elements = selection.toArray();
+ IResource resources[] = Utils.getResources(elements);
if (resources.length == 0) {
if (openInCompareAction != null) {
// We can still show the compare editor open if the element has
@@ -118,12 +118,12 @@ public class OpenWithActionGroup extends ActionGroup {
return;
}
- if (elements.length != resources.length){
- // Only supported if all the items are resources.
- return;
- }
+ if (elements.length != resources.length){
+ // Only supported if all the items are resources.
+ return;
+ }
- boolean allFiles = true;
+ boolean allFiles = true;
for (int i = 0; i < resources.length; i++) {
if (resources[i].getType() != IResource.FILE) {
// Open actions are only supported if all the items are files.
@@ -173,7 +173,7 @@ public class OpenWithActionGroup extends ActionGroup {
showInSubmenu.add(showInMenu);
menu.appendToGroup(groupId, showInSubmenu);
}
- }
+ }
/**
* {@link SaveablesCompareEditorInput#getShowInMenuLabel}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
index 7b2a919a5..9d1f9a086 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
@@ -77,13 +77,13 @@ public class RefactorActionGroup extends ActionGroup {
parentMenu.appendToGroup(groupId, renameAction);
}
- @Override
+ @Override
public void fillActionBars(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
- actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
- }
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
+ actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
+ actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
+ }
@Override
public void updateActionBars() {
@@ -150,22 +150,22 @@ public class RefactorActionGroup extends ActionGroup {
.setActionDefinitionId(IWorkbenchCommandConstants.FILE_RENAME);
}
- private IStructuredSelection getSelection() {
- final ISelection selection= getContext().getSelection();
+ private IStructuredSelection getSelection() {
+ final ISelection selection= getContext().getSelection();
- if (!(selection instanceof IStructuredSelection))
- return new StructuredSelection();
+ if (!(selection instanceof IStructuredSelection))
+ return new StructuredSelection();
- return new StructuredSelection(Utils.getResources(((IStructuredSelection)selection).toArray()));
+ return new StructuredSelection(Utils.getResources(((IStructuredSelection)selection).toArray()));
}
- private IStructuredSelection getObjectSelection() {
- final ISelection selection= getContext().getSelection();
+ private IStructuredSelection getObjectSelection() {
+ final ISelection selection= getContext().getSelection();
- if (!(selection instanceof IStructuredSelection))
- return new StructuredSelection();
+ if (!(selection instanceof IStructuredSelection))
+ return new StructuredSelection();
- return (IStructuredSelection)selection;
+ return (IStructuredSelection)selection;
}
private boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
index 8b384042f..cd7c571b0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
@@ -136,8 +136,8 @@ public class RemoveSynchronizeParticipantAction extends Action {
}
private boolean promptToSave(List dirtyModels) {
- if (dirtyModels.size() == 1) {
- Saveable model = (Saveable) dirtyModels.get(0);
+ if (dirtyModels.size() == 1) {
+ Saveable model = (Saveable) dirtyModels.get(0);
String message = NLS.bind(TeamUIMessages.RemoveSynchronizeParticipantAction_2, model.getName());
// Show a dialog.
String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
@@ -159,28 +159,28 @@ public class RemoveSynchronizeParticipantAction extends Action {
case 2: // cancel
return false;
}
- } else {
- ListSelectionDialog dlg = new ListSelectionDialog(
- view.getSite().getShell(), dirtyModels,
- new ArrayContentProvider(),
- new WorkbenchPartLabelProvider(), TeamUIMessages.RemoveSynchronizeParticipantAction_4);
- dlg.setInitialSelections(dirtyModels.toArray());
- dlg.setTitle(TeamUIMessages.RemoveSynchronizeParticipantAction_5);
-
- int result = dlg.open();
- //Just return false to prevent the operation continuing
- if (result == IDialogConstants.CANCEL_ID)
- return false;
-
- dirtyModels = Arrays.asList(dlg.getResult());
- }
-
- // If the editor list is empty return.
- if (dirtyModels.isEmpty())
- return true;
+ } else {
+ ListSelectionDialog dlg = new ListSelectionDialog(
+ view.getSite().getShell(), dirtyModels,
+ new ArrayContentProvider(),
+ new WorkbenchPartLabelProvider(), TeamUIMessages.RemoveSynchronizeParticipantAction_4);
+ dlg.setInitialSelections(dirtyModels.toArray());
+ dlg.setTitle(TeamUIMessages.RemoveSynchronizeParticipantAction_5);
+
+ int result = dlg.open();
+ //Just return false to prevent the operation continuing
+ if (result == IDialogConstants.CANCEL_ID)
+ return false;
+
+ dirtyModels = Arrays.asList(dlg.getResult());
+ }
+
+ // If the editor list is empty return.
+ if (dirtyModels.isEmpty())
+ return true;
// Create save block.
- final List finalModels = dirtyModels;
+ final List finalModels = dirtyModels;
IRunnableWithProgress progressOp = monitor -> {
monitor.beginTask(null, finalModels.size());
for (Iterator i = finalModels.iterator(); i.hasNext();) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
index eeb6cb7cd..93fb4a03d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
@@ -34,7 +34,7 @@ import org.eclipse.team.ui.synchronize.SubscriberParticipant;
public class ShowSynchronizeParticipantAction extends Action implements IPropertyChangeListener {
- private ISynchronizeParticipantReference fPage;
+ private ISynchronizeParticipantReference fPage;
private ISynchronizeView fView;
@Override
@@ -59,22 +59,22 @@ public class ShowSynchronizeParticipantAction extends Action implements IPropert
super(Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, ref.getDisplayName()), IAction.AS_RADIO_BUTTON);
fPage = ref;
fView = view;
- setImageDescriptor( new ParticipantOverlay( ref));
+ setImageDescriptor( new ParticipantOverlay( ref));
- try {
- fPage.getParticipant().addPropertyChangeListener( this);
- } catch( TeamException e) {
- Utils.handle(e);
- }
+ try {
+ fPage.getParticipant().addPropertyChangeListener( this);
+ } catch( TeamException e) {
+ Utils.handle(e);
+ }
}
@Override
public void propertyChange( PropertyChangeEvent event) {
- String property = event.getProperty();
- if( AbstractSynchronizeParticipant.P_PINNED.equals( property) ||
- AbstractSynchronizeParticipant.P_SCHEDULED.equals(property)) {
- setImageDescriptor(new ParticipantOverlay( fPage));
- }
+ String property = event.getProperty();
+ if( AbstractSynchronizeParticipant.P_PINNED.equals( property) ||
+ AbstractSynchronizeParticipant.P_SCHEDULED.equals(property)) {
+ setImageDescriptor(new ParticipantOverlay( fPage));
+ }
}
@@ -100,18 +100,18 @@ public class ShowSynchronizeParticipantAction extends Action implements IPropert
if (this.participant.isPinned()) {
drawImage(pinnedData, this.imageData.width - pinnedData.width, 0);
}
- if (this.participant instanceof SubscriberParticipant) {
- SubscriberParticipant participant = ( SubscriberParticipant) this.participant;
- SubscriberRefreshSchedule schedule = participant.getRefreshSchedule();
- if(schedule!=null && schedule.isEnabled()) {
- drawImage(scheduledData, 0, 0);
- }
- } else {
- SubscriberRefreshSchedule schedule = Adapters.adapt(participant, SubscriberRefreshSchedule.class);
- if(schedule!=null && schedule.isEnabled()) {
- drawImage(scheduledData, 0, 0);
- }
- }
+ if (this.participant instanceof SubscriberParticipant) {
+ SubscriberParticipant participant = ( SubscriberParticipant) this.participant;
+ SubscriberRefreshSchedule schedule = participant.getRefreshSchedule();
+ if(schedule!=null && schedule.isEnabled()) {
+ drawImage(scheduledData, 0, 0);
+ }
+ } else {
+ SubscriberRefreshSchedule schedule = Adapters.adapt(participant, SubscriberRefreshSchedule.class);
+ if(schedule!=null && schedule.isEnabled()) {
+ drawImage(scheduledData, 0, 0);
+ }
+ }
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
index 94066ef1a..20d393563 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
@@ -20,7 +20,7 @@ import org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
public class SyncViewerShowPreferencesAction extends Action {
- private final ISynchronizePageConfiguration configuration;
+ private final ISynchronizePageConfiguration configuration;
public SyncViewerShowPreferencesAction(ISynchronizePageConfiguration configuration) {
this.configuration = configuration;
@@ -29,8 +29,8 @@ public class SyncViewerShowPreferencesAction extends Action {
@Override
public void run() {
- PreferencePage[] pages = configuration.getParticipant().getPreferencePages();
- PreferencePageContainerDialog dialog = new PreferencePageContainerDialog(configuration.getSite().getShell(), pages);
+ PreferencePage[] pages = configuration.getParticipant().getPreferencePages();
+ PreferencePageContainerDialog dialog = new PreferencePageContainerDialog(configuration.getSite().getShell(), pages);
dialog.setBlockOnOpen(true);
dialog.open();
}

Back to the top