Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-09-10 14:18:27 -0400
committerJean Michel-Lemieux2003-09-10 14:18:27 -0400
commitc87a4431a911907b51edd96a13deced032701e69 (patch)
tree012c17d356b88e610329ae85341985130a999814
parent621873d4e5958b04809927a5891b1bffde99e03a (diff)
downloadeclipse.platform.team-branch_SyncViewStatisticsExperiments.tar.gz
eclipse.platform.team-branch_SyncViewStatisticsExperiments.tar.xz
eclipse.platform.team-branch_SyncViewStatisticsExperiments.zip
*** empty log message ***branch_SyncViewStatisticsExperiments
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gifbin0 -> 93 bytes
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java99
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java37
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java56
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java1
11 files changed, 280 insertions, 115 deletions
diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif
new file mode 100644
index 000000000..020fc5438
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/ovr/confchg_ov.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java
new file mode 100644
index 000000000..801bd250e
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/OverlayIcon.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui;
+
+import java.util.Arrays;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * An OverlayIcon consists of a main icon and several adornments.
+ */
+public class OverlayIcon extends CompositeImageDescriptor {
+ // the base image
+ private Image base;
+ // the overlay images
+ private ImageDescriptor[] overlays;
+ // the size
+ private Point size;
+ // the locations
+ private int[] locations;
+
+ public static final int TOP_LEFT = 0;
+ public static final int TOP_RIGHT = 1;
+ public static final int BOTTOM_LEFT = 2;
+ public static final int BOTTOM_RIGHT = 3;
+
+ /**
+ * OverlayIcon constructor.
+ *
+ * @param base the base image
+ * @param overlays the overlay images
+ * @param locations the location of each image
+ * @param size the size
+ */
+ public OverlayIcon(Image base, ImageDescriptor[] overlays, int[] locations, Point size) {
+ this.base = base;
+ this.overlays = overlays;
+ this.locations = locations;
+ this.size = size;
+ }
+
+ protected void drawOverlays(ImageDescriptor[] overlays, int[] locations) {
+ Point size = getSize();
+ for (int i = 0; i < overlays.length; i++) {
+ ImageDescriptor overlay = overlays[i];
+ ImageData overlayData = overlay.getImageData();
+ switch (locations[i]) {
+ case TOP_LEFT:
+ drawImage(overlayData, 0, 0);
+ break;
+ case TOP_RIGHT:
+ drawImage(overlayData, size.x - overlayData.width, 0);
+ break;
+ case BOTTOM_LEFT:
+ drawImage(overlayData, 0, size.y - overlayData.height);
+ break;
+ case BOTTOM_RIGHT:
+ drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height);
+ break;
+ }
+ }
+ }
+
+ public boolean equals(Object o) {
+ if (! (o instanceof OverlayIcon)) return false;
+ OverlayIcon other = (OverlayIcon) o;
+ return base.equals(other.base) && Arrays.equals(overlays, other.overlays);
+ }
+
+ public int hashCode() {
+ int code = base.hashCode();
+ for (int i = 0; i < overlays.length; i++) {
+ code ^= overlays[i].hashCode();
+ }
+ return code;
+ }
+
+
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(base.getImageData(), 0, 0);
+ drawOverlays(overlays, locations);
+ }
+
+ protected Point getSize() {
+ return size;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
index 9f18abc07..1ff8f2e97 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
@@ -296,6 +296,7 @@ public class TeamUIPlugin extends AbstractUIPlugin implements IPropertyChangeLis
// View decoration overlays
createImageDescriptor(ISharedImages.IMG_DIRTY_OVR, baseURL);
+ createImageDescriptor(ISharedImages.IMG_CONFLICT_OVR, baseURL);
createImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR, baseURL);
createImageDescriptor(ISharedImages.IMG_CHECKEDOUT_OVR, baseURL);
createImageDescriptor(ISharedImages.IMG_SYNC_VIEW, baseURL);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 0714e38ad..7d5f66b12 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -96,11 +96,7 @@ SyncView.errorSaving=Error while saving modified resources
SyncView.cantSaveError=Can't save changes: {0}
SyncView.dirtyIndicatorInTitle=*{0}
-LiveSyncView.title=Synchronize
-LiveSyncView.titleTooltip={0}\nWorking Set: {1}\n
-LiveSyncView.titleChangeNumbers=mode matched {0} of {1} changes: {2} hidden by working set
-LiveSyncView.titleChangeNumbersNoWorkingSet=mode matched {0} of {1} changes
-LiveSyncView.titleWithSubscriber={0} ({1}) - {2}
+LiveSyncView.titleTooltip=Working Set: {1}
SubscriberEventHandler.jobName=Updating synchronization state
SubscriberEventHandler.errors=Errors have occured while calculating the synchronization state. The Synchronize View may be out-of-date. Refresh the view or fix the errors and re-run the Synchronize command.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
index 1207fb948..9437e2509 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
@@ -14,12 +14,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.core.ExceptionCollector;
@@ -94,6 +94,7 @@ public class SubscriberEventHandler {
return result;
}
}
+
/**
* Create a handler. This will initialize all resources for the subscriber associated with
* the set.
@@ -186,22 +187,28 @@ public class SubscriberEventHandler {
* Create the job used for processing the events in the queue. The job stops working when
* the queue is empty.
*/
- private void createEventHandlingJob() {
- // We need to use a WorkspaceJob since
- // the EclipseSynchronizer currently obtains rules which causes
- // many workers to be created (see bug 41979).
- eventHandlerJob = new WorkspaceJob(Policy.bind("SubscriberEventHandler.jobName")) {//$NON-NLS-1$
- public IStatus runInWorkspace(IProgressMonitor monitor) {
- return processEvents(monitor);
+ private void createEventHandlingJob() {
+ eventHandlerJob = new Job(Policy.bind("SubscriberEventHandler.jobName")) {//$NON-NLS-1$
+ public IStatus run(IProgressMonitor monitor) {
+ return processEvents(monitor);
}
};
+ eventHandlerJob.addJobChangeListener(new JobChangeAdapter() {
+ public void done(IJobChangeEvent event) {
+ // Make sure an unhandled event didn't squeak in.
+ if (hasUnprocessedEvents()) {
+ schedule();
+ }
+ }
+ });
eventHandlerJob.setPriority(Job.SHORT);
eventHandlerJob.setSystem(true);
}
+
/**
* Process events from the events queue and dispatch results.
*/
- private IStatus processEvents(IProgressMonitor monitor) {
+ /* internal use only */ IStatus processEvents(IProgressMonitor monitor) {
List resultCache = new ArrayList();
Event event;
errors.clear();
@@ -240,7 +247,7 @@ public class SubscriberEventHandler {
errors.handleException(e);
}
- if (awaitingProcessing.isEmpty()
+ if (!hasUnprocessedEvents()
|| resultCache.size() > NOTIFICATION_BATCHING_NUMBER) {
dispatchEvents(
(Event[]) resultCache.toArray(
@@ -267,7 +274,7 @@ public class SubscriberEventHandler {
if (resource.getType() != IResource.FILE
&& depth != IResource.DEPTH_ZERO) {
IResource[] members =
- set.getSubscriber().members((IContainer) resource);
+ set.getSubscriber().members(resource);
for (int i = 0; i < members.length; i++) {
collect(
members[i],
@@ -354,7 +361,7 @@ public class SubscriberEventHandler {
}
}
set.getSyncSet().endInput();
- };
+ }
/**
* Initialize all resources for the subscriber associated with the set. This will basically recalculate
* all synchronization information for the subscriber.
@@ -367,4 +374,8 @@ public class SubscriberEventHandler {
queueEvent(new Event(resources[i], type, IResource.DEPTH_INFINITE));
}
}
+
+ /* internal use only */ boolean hasUnprocessedEvents() {
+ return !awaitingProcessing.isEmpty();
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
index 390fd5656..e2454c688 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
@@ -36,7 +36,6 @@ import org.eclipse.team.ui.ISharedImages;
*/
public class StatisticsPanel extends Composite {
- private StatisticsCounterBar bar;
private ViewStatusInformation stats;
private Text nOutgoing;
@@ -54,9 +53,8 @@ public class StatisticsPanel extends Composite {
gridLayout.numColumns= 9;
gridLayout.makeColumnsEqualWidth= false;
gridLayout.marginWidth= 3;
- gridLayout.marginHeight= 3;
+ gridLayout.marginHeight= 1;
setLayout(gridLayout);
- bar = new StatisticsCounterBar(this, 9);
nConflicting = createLabel(Policy.bind("StatisticsPanel.conflicting"), iConflicting, "0/0");
nIncoming = createLabel(Policy.bind("StatisticsPanel.incoming"), iIncoming, "0/0");
@@ -70,6 +68,15 @@ public class StatisticsPanel extends Composite {
addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
+// Need code to get rid of the direction text if the control is resized too much
+// System.out.println("Client Area: " + nOutgoing.getClientArea().width);
+// System.out.println("Bounds Area: " + nOutgoing.getBorderWidth());
+// System.out.println("Border Area: " + nOutgoing.getBounds().width);
+// GC gc = new GC(StatisticsPanel.this);
+// gc.setFont(nOutgoing.getFont());
+// FontMetrics fontMetrics = gc.getFontMetrics();
+// int pixelWidth = fontMetrics.getAverageCharWidth() * nOutgoing.getCharCount();
+// System.out.println("Char width: " + pixelWidth);
redraw();
}
});
@@ -133,9 +140,15 @@ public class StatisticsPanel extends Composite {
nIncoming.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString()));
nOutgoing.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString()));
- bar.update(workspaceConflicting, workspaceOutgoing, workspaceIncoming);
-
redraw();
}
}
-}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Widget#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ disposeIcons();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java
index ddea777a8..0d1c9ad09 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetContentProvider.java
@@ -10,10 +10,12 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.sync.views;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
@@ -129,8 +131,10 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
protected void handleResourceChanges(SyncSetChangedEvent event) {
// Refresh the viewer for each changed resource
SyncInfo[] infos = event.getChangedResources();
- for (int i = 0; i < infos.length; i++) {
- ((StructuredViewer) viewer).refresh(getModelObject(infos[i].getLocal()), true);
+ for (int i = 0; i < infos.length; i++) {
+ IResource local = infos[i].getLocal();
+ ((StructuredViewer) viewer).refresh(getModelObject(local), true);
+ updateParentLabels(local);
}
}
@@ -146,6 +150,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
for (int i = 0; i < removed.length; i++) {
IResource resource = removed[i];
((StructuredViewer) viewer).refresh(getModelObject(resource));
+ updateParentLabels(resource);
}
}
@@ -161,12 +166,7 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
for (int i = 0; i < added.length; i++) {
IResource resource = added[i];
((StructuredViewer) viewer).refresh(getModelObject(resource.getParent()));
- }
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if(selection.size() == 0) {
- if(viewer instanceof INavigableControl) {
- ((INavigableControl)viewer).gotoDifference(INavigableControl.NEXT);
- }
+ updateParentLabels(resource);
}
}
@@ -268,4 +268,22 @@ public abstract class SyncSetContentProvider implements IStructuredContentProvid
}
return result;
}
-}
+
+ /**
+ * Forces the viewer to update the labels for parents of this element. This
+ * can be useful when parents labels include information about their children
+ * that needs updating when a child changes.
+ */
+ protected void updateParentLabels(IResource resource) {
+ List parents = new ArrayList(3);
+ IResource parent = resource.getParent();
+ while(parent.getType() != IResource.ROOT) {
+ parents.add(getModelObject(parent));
+ parent = parent.getParent();
+ }
+ getViewer().update(
+ (SynchronizeViewNode[])parents.toArray(new SynchronizeViewNode[parents.size()]),
+ null
+ );
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
index 15278c5cd..ecd8f0db3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncSetTreeContentProvider.java
@@ -10,12 +10,16 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.sync.views;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.team.internal.ui.sync.sets.*;
+import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
+import org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent;
/**
* This class provides the contents for a AbstractTreeViewer using a SyncSet as the model
@@ -83,7 +87,8 @@ public class SyncSetTreeContentProvider extends SyncSetContentProvider implement
parent = getModelParent(resource);
}
Object element = getModelObject(resource);
- tree.add(parent, element);
+ tree.add(parent, element);
+ updateParentLabels(resource);
}
} else {
super.handleResourceAdditions(event);
@@ -101,6 +106,7 @@ public class SyncSetTreeContentProvider extends SyncSetContentProvider implement
Object[] modelRoots = new Object[roots.length];
for (int i = 0; i < modelRoots.length; i++) {
modelRoots[i] = getModelObject(roots[i]);
+ updateParentLabels(roots[i]);
}
tree.remove(modelRoots);
} else {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java
index dda9ef6fb..564fc63a3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncViewerLabelProvider.java
@@ -1,14 +1,21 @@
package org.eclipse.team.internal.ui.sync.views;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.core.sync.IRemoteSyncElement;
+import org.eclipse.team.internal.ui.OverlayIcon;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
@@ -29,14 +36,14 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
private Image compressedFolderImage;
+ // cache for folder images that have been overlayed with conflict icon
+ private Map fgImageCache;
+
// Keep track of the compare and workbench image providers
// so they can be properly disposed
CompareConfiguration compareConfig = new CompareConfiguration();
WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
- /**
- * @return
- */
public Image getCompressedFolderImage() {
if (compressedFolderImage == null) {
compressedFolderImage = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_COMPRESSED_FOLDER).createImage();
@@ -71,54 +78,73 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
name = resource.getProjectRelativePath().toString();
} else {
name = workbenchLabelProvider.getText(resource);
- }
-
- if(element instanceof SynchronizeViewNode && resource.getType() != IResource.FILE) {
- SubscriberInput input = ((SynchronizeViewNode)element).getSubscriberInput();
- SyncSet set = new SyncSet();
- SyncInfo[] infos = input.getWorkingSetSyncSet().getOutOfSyncDescendants(resource);
- for (int i = 0; i < infos.length; i++) {
- set.add(infos[i]);
- }
- StringBuffer postfix = new StringBuffer(" (");
- SyncInfoStatistics stats = set.getStatistics();
- long count = stats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
- if(count > 0) {
- postfix.append("conflicts:" + count);
- }
- count = stats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
- if(count > 0) {
- postfix.append("incoming:" + count);
- }
- count = stats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
- if(count > 0) {
- postfix.append("outgoing:" + count);
- }
- postfix.append(")");
- return name + postfix.toString();
- }
-
+ }
return name;
}
+ /**
+ * An image is decorated by at most 3 different plugins.
+ * 1. ask the workbench for the default icon for the resource
+ * 2. ask the compare plugin for the sync kind overlay
+ * 3. overlay the conflicting image on folders/projects containing conflicts
+ */
public Image getImage(Object element) {
+ Image decoratedImage = null;
+ IResource resource = getResource(element);
+
if (element instanceof CompressedFolder) {
- return compareConfig.getImage(getCompressedFolderImage(), IRemoteSyncElement.IN_SYNC);
+ decoratedImage = compareConfig.getImage(getCompressedFolderImage(), IRemoteSyncElement.IN_SYNC);
+ } else {
+ int kind = getSyncKind(element);
+ switch (kind & IRemoteSyncElement.DIRECTION_MASK) {
+ case IRemoteSyncElement.OUTGOING:
+ kind = (kind &~ IRemoteSyncElement.OUTGOING) | IRemoteSyncElement.INCOMING;
+ break;
+ case IRemoteSyncElement.INCOMING:
+ kind = (kind &~ IRemoteSyncElement.INCOMING) | IRemoteSyncElement.OUTGOING;
+ break;
+ }
+ Image image = workbenchLabelProvider.getImage(resource);
+ decoratedImage = compareConfig.getImage(image, kind);
}
- IResource resource = getResource(element);
- int kind = getSyncKind(element);
- switch (kind & IRemoteSyncElement.DIRECTION_MASK) {
- case IRemoteSyncElement.OUTGOING:
- kind = (kind &~ IRemoteSyncElement.OUTGOING) | IRemoteSyncElement.INCOMING;
- break;
- case IRemoteSyncElement.INCOMING:
- kind = (kind &~ IRemoteSyncElement.INCOMING) | IRemoteSyncElement.OUTGOING;
- break;
- }
- Image image = workbenchLabelProvider.getImage(resource);
- return compareConfig.getImage(image, kind);
+
+ return propagateConflicts(decoratedImage, element, resource);
}
+ private Image propagateConflicts(Image base, Object element, IResource resource) {
+ if(element instanceof SynchronizeViewNode && resource.getType() != IResource.FILE) {
+ // if the folder is already conflicting then don't bother propagating the conflict
+ if((getSyncKind(element) & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) {
+ SubscriberInput input = ((SynchronizeViewNode)element).getSubscriberInput();
+ SyncSet set = new SyncSet();
+ SyncInfo[] infos = input.getWorkingSetSyncSet().getOutOfSyncDescendants(resource);
+ for (int i = 0; i < infos.length; i++) {
+ set.add(infos[i]);
+ }
+ SyncInfoStatistics stats = set.getStatistics();
+ long count = stats.countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK);
+ if(count > 0) {
+ ImageDescriptor overlay = new OverlayIcon(
+ base,
+ new ImageDescriptor[] { TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR)},
+ new int[] {OverlayIcon.BOTTOM_LEFT},
+ new Point(base.getBounds().width, base.getBounds().height));
+
+ if(fgImageCache == null) {
+ fgImageCache = new HashMap(10);
+ }
+ Image conflictDecoratedImage = (Image) fgImageCache.get(overlay);
+ if (conflictDecoratedImage == null) {
+ conflictDecoratedImage = overlay.createImage();
+ fgImageCache.put(overlay, conflictDecoratedImage);
+ }
+ return conflictDecoratedImage;
+ }
+ }
+ }
+ return base;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
*/
@@ -126,8 +152,16 @@ public class SyncViewerLabelProvider extends LabelProvider implements ITableLabe
super.dispose();
workbenchLabelProvider.dispose();
compareConfig.dispose();
- if (compressedFolderImage != null)
+ if (compressedFolderImage != null) {
compressedFolderImage.dispose();
+ }
+ if(fgImageCache != null) {
+ Iterator it = fgImageCache.values().iterator();
+ while (it.hasNext()) {
+ Image element = (Image) it.next();
+ element.dispose();
+ }
+ }
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
index 7440ef62b..070cbe87b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
@@ -127,9 +127,6 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
// Remembering the current input and the previous.
private SubscriberInput input = null;
- // Stats about the current subscriber. This is used for status line and/or title updating
- private ViewStatusInformation statusInformation;
-
// A set of common actions. They are hooked to the active SubscriberInput and must
// be reset when the input changes.
private SyncViewerActions actions;
@@ -187,6 +184,7 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
setViewImage(initialImg);
updateTitle();
+ updateTooltip();
initializeJobListener();
actions.setContext(null);
@@ -482,45 +480,33 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
initializeSubscriberInput(newInput);
}
}
- /*
- * Synchronize - (showing N of M changes) - {Subscriber name}
- */
+
protected void updateTitle() {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
SubscriberInput input = getInput();
- if(input != null) {
+ if(input != null && statsPanel != null) {
statsPanel.update(new ViewStatusInformation(input));
}
-//
-// TeamSubscriber subscriber = input.getSubscriber();
-// String changesText;
-// if(input.getWorkingSet() != null) {
-// changesText = Policy.bind("LiveSyncView.titleChangeNumbers", //$NON-NLS-1$
-// new Long(statusInformation.getNumShowing()).toString(),
-// new Long(statusInformation.getNumInWorkingSet()).toString(),
-// new Long(statusInformation.getNumInWorkspace() - statusInformation.getNumInWorkingSet()).toString());
-// } else {
-// changesText = Policy.bind("LiveSyncView.titleChangeNumbersNoWorkingSet", //$NON-NLS-1$
-// new Long(statusInformation.getNumShowing()).toString(),
-// new Long(statusInformation.getNumInWorkingSet()).toString());
-// }
-// String title = Policy.bind("LiveSyncView.titleWithSubscriber", new String[] {Policy.bind("LiveSyncView.title"), changesText, subscriber.getName()}); //$NON-NLS-1$ //$NON-NLS-2$
-// setTitle(title);
-// StringBuffer b = new StringBuffer(title + "\n"); //$NON-NLS-1$
-// b.append(input.getSubscriberSyncSet().getStatistics().toString());
-// setTitleToolTip(b.toString());
-// }
-// } else {
-// setTitle(Policy.bind("LiveSyncView.title")); //$NON-NLS-1$
-// setTitleToolTip(""); //$NON-NLS-1$
-// }
- }
+ }
+ });
+ }
+
+ protected void updateTooltip() {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ SubscriberInput input = getInput();
+ if(input != null) {
+ if(input.getWorkingSet() != null) {
+ String tooltip = Policy.bind("LiveSyncView.titleTooltip", input.getWorkingSet().getName());
+ setTitleToolTip(tooltip);
+ } else {
+ setTitleToolTip("");
+ }
+ }
+ }
});
}
-
-
-
/**
* Passing the focus request to the viewer's control.
*/
@@ -855,7 +841,7 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
public void workingSetChanged(IWorkingSet set) {
input.setWorkingSet(set);
- updateTitle();
+ updateTooltip();
}
/**
* Updates the filter applied to the active subscriber input and ensures that selection and expansions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java
index 8838e6016..097f7a723 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java
@@ -23,6 +23,7 @@ public interface ISharedImages {
public final String IMG_DIRTY_OVR = "ovr/dirty_ov.gif"; //$NON-NLS-1$
public final String IMG_CHECKEDIN_OVR = "ovr/version_controlled.gif"; //$NON-NLS-1$
public final String IMG_CHECKEDOUT_OVR = "ovr/checkedout_ov.gif"; //$NON-NLS-1$
+ public final String IMG_CONFLICT_OVR = "ovr/confchg_ov.gif"; //$NON-NLS-1$
public final String IMG_COLLAPSE_ALL = "clcl16/collapseall.gif"; //$NON-NLS-1$
public final String IMG_COLLAPSE_ALL_ENABLED = "elcl16/collapseall.gif"; //$NON-NLS-1$

Back to the top