Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-04-17 19:11:54 +0000
committerMichael Valenta2002-04-17 19:11:54 +0000
commit855178c1552c0f28ebd48b0f9d249230a9230fb2 (patch)
tree1094fb732d0b69edddd4ce41faf2f14def0afdf0
parent9dd78c4046fa03cb66bcc4e46afb5bad27e94b42 (diff)
downloadeclipse.platform.team-855178c1552c0f28ebd48b0f9d249230a9230fb2.tar.gz
eclipse.platform.team-855178c1552c0f28ebd48b0f9d249230a9230fb2.tar.xz
eclipse.platform.team-855178c1552c0f28ebd48b0f9d249230a9230fb2.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java98
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java38
4 files changed, 132 insertions, 132 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
index b3aaa19ae..21deb2627 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
@@ -75,25 +75,25 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
private boolean shutdown = false;
- private OverlayIconCache iconCache = new OverlayIconCache();
+ private OverlayIconCache iconCache = new OverlayIconCache();
// Keep track of deconfigured projects
private Set deconfiguredProjects = new HashSet();
- private static class DecoratorOverlayIcon extends OverlayIcon {
- private static final int HEIGHT = 16;
- private static final int WIDTH = 16;
- public DecoratorOverlayIcon(Image base, ImageDescriptor[] overlays) {
- super(base, overlays, new Point(WIDTH, HEIGHT));
- }
- protected void drawOverlays(ImageDescriptor[] overlays) {
- for (int i = overlays.length - 1; i >= 0; --i) {
- ImageData imageData = overlays[i].getImageData();
- drawImage(imageData, 0, 0);
- }
- }
- }
-
+ private static class DecoratorOverlayIcon extends OverlayIcon {
+ private static final int HEIGHT = 16;
+ private static final int WIDTH = 16;
+ public DecoratorOverlayIcon(Image base, ImageDescriptor[] overlays) {
+ super(base, overlays, new Point(WIDTH, HEIGHT));
+ }
+ protected void drawOverlays(ImageDescriptor[] overlays) {
+ for (int i = overlays.length - 1; i >= 0; --i) {
+ ImageData imageData = overlays[i].getImageData();
+ drawImage(imageData, 0, 0);
+ }
+ }
+ }
+
public CVSDecorator() {
// thread that calculates the decoration for a resource
decoratorUpdateThread = new Thread(new CVSDecorationRunnable(this), "CVS"); //$NON-NLS-1$
@@ -139,14 +139,14 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
if (decoration != null) {
List overlays = decoration.getOverlays();
- if (overlays != null) {
- return iconCache.getImageFor(new DecoratorOverlayIcon(image,
- (ImageDescriptor[]) overlays.toArray(new ImageDescriptor[overlays.size()])));
- }
+ if (overlays != null) {
+ return iconCache.getImageFor(new DecoratorOverlayIcon(image,
+ (ImageDescriptor[]) overlays.toArray(new ImageDescriptor[overlays.size()])));
+ }
} else {
addResourcesToBeDecorated(new IResource[] { resource });
}
- return image;
+ return image;
}
@@ -428,7 +428,7 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
// dispose of images created as overlays
decoratorNeedsUpdating.clear();
clearCache();
- iconCache.disposeAll();
+ iconCache.disposeAll();
}
/**
* @see IResourceStateChangeListener#projectConfigured(IProject)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java
index 95fcbeaa4..40f5f2e83 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.team.internal.ccvs.ui;
-import java.util.Arrays;
-
+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.Image;
import org.eclipse.swt.graphics.Point;
/**
* An OverlayIcon consists of a main icon and several adornments.
*/
-public abstract class OverlayIcon extends CompositeImageDescriptor {
- // the base image
- private Image base;
- // the overlay images
- private ImageDescriptor[] overlays;
- // the size
- private Point size;
+public abstract class OverlayIcon extends CompositeImageDescriptor {
+ // the base image
+ private Image base;
+ // the overlay images
+ private ImageDescriptor[] overlays;
+ // the size
+ private Point size;
/**
- * OverlayIcon constructor.
+ * OverlayIcon constructor.
*
- * @param base the base image
- * @param overlays the overlay images
- * @param size the size
+ * @param base the base image
+ * @param overlays the overlay images
+ * @param size the size
*/
- public OverlayIcon(Image base, ImageDescriptor[] overlays, Point size) {
+ public OverlayIcon(Image base, ImageDescriptor[] overlays, Point size) {
this.base = base;
this.overlays = overlays;
this.size = size;
}
/**
- * Superclasses override to draw the overlays.
+ * Superclasses override to draw the overlays.
*/
- protected abstract void drawOverlays(ImageDescriptor[] overlays);
-
- 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);
+ protected abstract void drawOverlays(ImageDescriptor[] overlays);
+
+ 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();
+
+ public int hashCode() {
+ int code = base.hashCode();
+ for (int i = 0; i < overlays.length; i++) {
+ code ^= overlays[i].hashCode();
}
- return code;
+ return code;
}
-
-
+
+
protected void drawCompositeImage(int width, int height) {
- drawImage(base.getImageData(), 0, 0);
- drawOverlays(overlays);
+ drawImage(base.getImageData(), 0, 0);
+ drawOverlays(overlays);
}
-
+
protected Point getSize() {
return size;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java
index eed81dad7..906b0fa3e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Maintains a cache of OverlayIcons.
- */
-public class OverlayIconCache {
- private Map /*from OverlayIcon to Image*/ cache = new HashMap();
-
- /**
- * Returns and caches an image corresponding to the specified icon.
- * @param icon the icon
- * @return the image
- */
- public Image getImageFor(OverlayIcon icon) {
- Image image = (Image) cache.get(icon);
- if (image == null) {
- image = icon.createImage();
- cache.put(icon, image);
- }
- return image;
- }
-
- /**
- * Disposes of all images in the cache.
- */
- public void disposeAll() {
- for (Iterator it = cache.values().iterator(); it.hasNext();) {
- Image image = (Image) it.next();
- image.dispose();
- }
- cache.clear();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Maintains a cache of OverlayIcons.
+ */
+public class OverlayIconCache {
+ private Map /*from OverlayIcon to Image*/ cache = new HashMap();
+
+ /**
+ * Returns and caches an image corresponding to the specified icon.
+ * @param icon the icon
+ * @return the image
+ */
+ public Image getImageFor(OverlayIcon icon) {
+ Image image = (Image) cache.get(icon);
+ if (image == null) {
+ image = icon.createImage();
+ cache.put(icon, image);
+ }
+ return image;
+ }
+
+ /**
+ * Disposes of all images in the cache.
+ */
+ public void disposeAll() {
+ for (Iterator it = cache.values().iterator(); it.hasNext();) {
+ Image image = (Image) it.next();
+ image.dispose();
+ }
+ cache.clear();
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
index c42e9a164..f9e3986ff 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
@@ -41,8 +41,8 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.HistoryView;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.OverlayIcon;
-import org.eclipse.team.internal.ccvs.ui.OverlayIconCache;
+import org.eclipse.team.internal.ccvs.ui.OverlayIcon;
+import org.eclipse.team.internal.ccvs.ui.OverlayIconCache;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.merge.OverrideUpdateMergeAction;
import org.eclipse.team.internal.ccvs.ui.merge.UpdateMergeAction;
@@ -65,20 +65,20 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
private HistoryAction showInHistory;
private OverrideUpdateMergeAction forceUpdateMergeAction;
- private static class DiffOverlayIcon extends OverlayIcon {
- private static final int HEIGHT = 16;
- private static final int WIDTH = 22;
- public DiffOverlayIcon(Image baseImage, ImageDescriptor overlay) {
- super(baseImage, new ImageDescriptor[] { overlay }, new Point(WIDTH, HEIGHT));
+ private static class DiffOverlayIcon extends OverlayIcon {
+ private static final int HEIGHT = 16;
+ private static final int WIDTH = 22;
+ public DiffOverlayIcon(Image baseImage, ImageDescriptor overlay) {
+ super(baseImage, new ImageDescriptor[] { overlay }, new Point(WIDTH, HEIGHT));
}
- protected void drawOverlays(ImageDescriptor[] overlays) {
- ImageDescriptor overlay = overlays[0];
+ protected void drawOverlays(ImageDescriptor[] overlays) {
+ ImageDescriptor overlay = overlays[0];
ImageData overlayData = overlay.getImageData();
drawImage(overlayData, WIDTH - overlayData.width, (HEIGHT - overlayData.height) / 2);
}
}
-
- private static class HistoryAction extends Action implements ISelectionChangedListener {
+
+ private static class HistoryAction extends Action implements ISelectionChangedListener {
IStructuredSelection selection;
public HistoryAction(String label) {
super(label);
@@ -143,19 +143,19 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
final ImageDescriptor questionableDescriptor = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_QUESTIONABLE);
final LabelProvider oldProvider = (LabelProvider)getLabelProvider();
setLabelProvider(new LabelProvider() {
- private OverlayIconCache iconCache = new OverlayIconCache();
-
- public void dispose() {
- iconCache.disposeAll();
- oldProvider.dispose();
- }
+ private OverlayIconCache iconCache = new OverlayIconCache();
+
+ public void dispose() {
+ iconCache.disposeAll();
+ oldProvider.dispose();
+ }
public Image getImage(Object element) {
Image image = oldProvider.getImage(element);
if (element instanceof ITeamNode) {
ITeamNode node = (ITeamNode)element;
int kind = node.getKind();
if ((kind & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) {
- return iconCache.getImageFor(new DiffOverlayIcon(image, conflictDescriptor));
+ return iconCache.getImageFor(new DiffOverlayIcon(image, conflictDescriptor));
}
if (kind == (IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION)) {
IResource resource = node.getResource();
@@ -163,7 +163,7 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
try {
ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
if (cvsFile.getSyncInfo() == null) {
- return iconCache.getImageFor(new DiffOverlayIcon(image, questionableDescriptor));
+ return iconCache.getImageFor(new DiffOverlayIcon(image, questionableDescriptor));
}
} catch (TeamException e) {
ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus());

Back to the top