Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-03-16 21:03:21 -0500
committerJean Michel-Lemieux2004-03-16 21:03:21 -0500
commit10557815d1b8acfc5d6c125c3a81c18984e5feb7 (patch)
treea4de0dd938e42037d5141a2ce031198619d98d3c
parent628b5d7b24b728747544fc14475498662c57ca23 (diff)
downloadeclipse.platform.team-branch_20040314_markersInSyncview.tar.gz
eclipse.platform.team-branch_20040314_markersInSyncview.tar.xz
eclipse.platform.team-branch_20040314_markersInSyncview.zip
*** empty log message ***branch_20040314_markersInSyncview
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/ovr/error_co.gifbin0 -> 84 bytes
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java77
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelElement.java2
8 files changed, 130 insertions, 25 deletions
diff --git a/bundles/org.eclipse.team.ui/icons/full/ovr/error_co.gif b/bundles/org.eclipse.team.ui/icons/full/ovr/error_co.gif
new file mode 100644
index 000000000..8612eaff5
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/ovr/error_co.gif
Binary files differ
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 7639c7438..fc411c752 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
@@ -292,6 +292,8 @@ public class TeamUIPlugin extends AbstractUIPlugin {
createImageDescriptor(plugin, ISharedImages.IMG_CONFLICT_OVR, baseURL);
createImageDescriptor(plugin, ISharedImages.IMG_CHECKEDIN_OVR, baseURL);
createImageDescriptor(plugin, ISharedImages.IMG_CHECKEDOUT_OVR, baseURL);
+ createImageDescriptor(plugin, ISharedImages.IMG_ERROR_OVR, baseURL);
+ createImageDescriptor(plugin, ISharedImages.IMG_WARNING_OVR, baseURL);
createImageDescriptor(plugin, ISharedImages.IMG_SYNC_VIEW, baseURL);
createImageDescriptor(plugin, ISharedImages.IMG_COMPARE_VIEW, baseURL);
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 00665e21b..f8ff17b92 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
@@ -116,16 +116,9 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
IResource local = info.getLocal();
if(diffNode instanceof SyncInfoModelElement) {
- boolean wasConflict = isConflicting(diffNode);
- // The update preserves any of the additional sync info bits
((SyncInfoModelElement)diffNode).update(info);
- boolean isConflict = isConflicting(diffNode);
updateLabel(diffNode);
- if (wasConflict && !isConflict) {
- setParentConflict(diffNode, false);
- } else if (!wasConflict && isConflict) {
- setParentConflict(diffNode, true);
- }
+ calculateProperties(diffNode);
} else {
removeFromViewer(local);
addResources(new IResource[] {local});
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java
index 598833150..c7978bd82 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java
@@ -29,8 +29,10 @@ public abstract class SynchronizeModelElement extends DiffNode implements IAdapt
/*
* Internal flags bits for stroing properties in the flags variable
*/
- private static final int BUSY_FLAG = 1;
- private static final int PROPAGATED_CONFLICT_FLAG = 2;
+ private static final int BUSY_FLAG = 0x01;
+ private static final int PROPAGATED_CONFLICT_FLAG = 0x02;
+ private static final int PROPAGATED_ERROR_FLAG = 0x04;
+ private static final int PROPAGATED_WARNING_FLAG =0x08;
// Instance variable containing the flags for this node
private int flags;
@@ -153,6 +155,10 @@ public abstract class SynchronizeModelElement extends DiffNode implements IAdapt
return BUSY_FLAG;
} else if (propertyName == PROPAGATED_CONFLICT_PROPERTY) {
return PROPAGATED_CONFLICT_FLAG;
+ } else if(propertyName == PROPAGATED_ERROR_MARKER_PROPERTY) {
+ return PROPAGATED_ERROR_FLAG;
+ } else if(propertyName == PROPAGATED_WARNING_MARKER_PROPERTY) {
+ return PROPAGATED_WARNING_FLAG;
}
return 0;
}
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 f84d1b87b..8458777d5 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
@@ -81,14 +81,12 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
int kind = syncNode.getKind();
Image decoratedImage;
decoratedImage = getCompareImage(base, kind);
- if (syncNode.hasChildren()) {
+
// The reason we still overlay the compare image is to
// ensure that the image width for all images shown in the viewer
// are consistent.
return propagateConflicts(decoratedImage, syncNode);
- } else {
- return decoratedImage;
- }
+
}
}
return base;
@@ -129,10 +127,31 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
private Image propagateConflicts(Image base, DiffNode element) {
// if the folder is already conflicting then don't bother propagating
// the conflict
+ List overlays = new ArrayList();
+ List locations = new ArrayList();
+
int kind = element.getKind();
if ((kind & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) {
if (hasDecendantConflicts(element)) {
- 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));
+ overlays.add(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR));
+ locations.add(new Integer(OverlayIcon.BOTTOM_RIGHT));
+ }
+ }
+ if(hasErrorMarker(element)) {
+ overlays.add(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_ERROR_OVR));
+ locations.add(new Integer(OverlayIcon.BOTTOM_LEFT));
+ } else if(hasWarningMarker(element)) {
+ overlays.add(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_WARNING_OVR));
+ locations.add(new Integer(OverlayIcon.BOTTOM_LEFT));
+ }
+
+ if(! overlays.isEmpty()) {
+ ImageDescriptor[] overlayImages = (ImageDescriptor[]) overlays.toArray(new ImageDescriptor[overlays.size()]);
+ int[] locationInts = new int[locations.size()];
+ for (int i = 0; i < locations.size(); i++) {
+ locationInts[i] =((Integer) locations.get(i)).intValue();
+ }
+ ImageDescriptor overlay = new OverlayIcon(base, overlayImages, locationInts, new Point(base.getBounds().width, base.getBounds().height));
if (fgImageCache == null) {
fgImageCache = new HashMap(10);
}
@@ -143,7 +162,7 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
}
return conflictDecoratedImage;
}
- }
+
return base;
}
@@ -157,6 +176,28 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
}
return false;
}
+
+ /**
+ * Return whether this diff node has descendant conflicts in the view in which it appears.
+ * @return whether the node has descendant conflicts
+ */
+ private boolean hasErrorMarker(DiffNode node) {
+ if(node instanceof ISynchronizeModelElement) {
+ return ((ISynchronizeModelElement)node).getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY);
+ }
+ return false;
+ }
+
+ /**
+ * Return whether this diff node has descendant conflicts in the view in which it appears.
+ * @return whether the node has descendant conflicts
+ */
+ private boolean hasWarningMarker(DiffNode node) {
+ if(node instanceof ISynchronizeModelElement) {
+ return ((ISynchronizeModelElement)node).getProperty(ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY);
+ }
+ return false;
+ }
/*
* (non-Javadoc)
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 311911027..368ef9150 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
@@ -14,6 +14,7 @@ import java.util.*;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
+import org.eclipse.core.resources.*;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.*;
@@ -45,7 +46,7 @@ import org.eclipse.ui.progress.UIJob;
* @see CompressedFoldersModelProvider
* @since 3.0
*/
-public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeListener, ISynchronizeModelProvider {
+public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeListener, ISynchronizeModelProvider, IResourceChangeListener {
// Flasg to indicate if tree control should be updated while
// building the model.
@@ -345,9 +346,7 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
protected void removeFromViewer(IResource resource) {
ISynchronizeModelElement node = getModelObject(resource);
if (node == null) return;
- if (isConflicting(node)) {
- setParentConflict(node, false);
- }
+ calculateProperties(node);
clearModelObjects(node);
if (canUpdateViewer()) {
doRemove(node);
@@ -383,9 +382,7 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
protected void addToViewer(ISynchronizeModelElement node) {
associateDiffNode(node);
node.addPropertyChangeListener(listener);
- if (isConflicting(node)) {
- setParentConflict(node, true);
- }
+ calculateProperties(node);
if (canUpdateViewer()) {
doAdd((SynchronizeModelElement)node.getParent(), node);
}
@@ -439,8 +436,30 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
}
}
- protected void setParentConflict(ISynchronizeModelElement diffNode, boolean value) {
- diffNode.setPropertyToRoot(ISynchronizeModelElement.PROPAGATED_CONFLICT_PROPERTY, value);
+ protected void calculateProperties(ISynchronizeModelElement element) {
+ element.setPropertyToRoot(ISynchronizeModelElement.PROPAGATED_CONFLICT_PROPERTY, isConflicting(element));
+ IResource resource = element.getResource();
+ if(resource != null) {
+ try {
+ boolean error = false;
+ IMarker[] markers = resource.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
+ for (int i = 0; i < markers.length; i++) {
+ IMarker marker = markers[i];
+ Integer severity = (Integer)marker.getAttribute(IMarker.SEVERITY);
+ if(severity.intValue() == IMarker.SEVERITY_ERROR) {
+ error = true; break;
+ }
+ }
+ element.setPropertyToRoot(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY, error);
+ } catch (CoreException e) {
+ TeamUIPlugin.log(e);
+ }
+ }
+ updateParentLabels(element);
+ }
+
+ protected void setPropertyToRoot(ISynchronizeModelElement diffNode, String propertyName, boolean value) {
+ diffNode.setPropertyToRoot(propertyName, value);
updateParentLabels(diffNode);
}
@@ -451,4 +470,44 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
updateLabel(diffNode);
}
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged(final IResourceChangeEvent event) {
+ final Control ctrl = getViewer().getControl();
+ if (ctrl != null && !ctrl.isDisposed()) {
+ ctrl.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ if (!ctrl.isDisposed()) {
+ BusyIndicator.showWhile(ctrl.getDisplay(), new Runnable() {
+ public void run() {
+ String[] markerTypes = getMarkerTypes();
+ boolean refreshNeeded = false;
+ for (int idx = 0; idx < markerTypes.length; idx++) {
+ IMarkerDelta[] markerDeltas = event.findMarkerDeltas(markerTypes[idx], true);
+ List changes = new ArrayList(markerDeltas.length);
+ for (int i = 0; idx < markerDeltas.length; idx++) {
+ IMarkerDelta delta = markerDeltas[i];
+ int kind = delta.getKind();
+ ISynchronizeModelElement element = getModelObject(delta.getResource());
+ if(element != null) {
+ calculateProperties(element);
+ }
+ }
+ }
+ firePendingLabelUpdates();
+ }
+ });
+ }
+ }
+ });
+ }
+ }
+
+
+ protected String[] getMarkerTypes() {
+ return new String[] {IMarker.PROBLEM};
+ }
} \ No newline at end of file
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 81e612616..7908dca5f 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
@@ -21,6 +21,8 @@ public interface ISharedImages {
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_ERROR_OVR = "ovr/error_co.gif"; //$NON-NLS-1$
+ public final String IMG_WARNING_OVR = "ovr/warning_co.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$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelElement.java
index 1e978d48e..6b92889bc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/ISynchronizeModelElement.java
@@ -22,6 +22,8 @@ public interface ISynchronizeModelElement extends IDiffContainer, ITypedElement,
public static final String BUSY_PROPERTY = TeamUIPlugin.ID + ".busy"; //$NON-NLS-1$
public static final String PROPAGATED_CONFLICT_PROPERTY = TeamUIPlugin.ID + ".conflict"; //$NON-NLS-1$
+ public static final String PROPAGATED_ERROR_MARKER_PROPERTY = TeamUIPlugin.ID + ".error"; //$NON-NLS-1$
+ public static final String PROPAGATED_WARNING_MARKER_PROPERTY = TeamUIPlugin.ID + ".warning"; //$NON-NLS-1$
public abstract void addPropertyChangeListener(IPropertyChangeListener listener);

Back to the top