summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRobin Rosenberg2012-12-28 19:36:34 (EST)
committer Paul Webster2013-02-26 09:16:24 (EST)
commit2a65c7da375e80c78357ad5f44a2f881f1f3c2a4 (patch)
treecec17ba098418df609a67e8df9b4acb5baa2a8a2
parent72ee48e5280550809fa9798070cb101bbd941590 (diff)
downloadeclipse.platform.ui-2a65c7da375e80c78357ad5f44a2f881f1f3c2a4.zip
eclipse.platform.ui-2a65c7da375e80c78357ad5f44a2f881f1f3c2a4.tar.gz
eclipse.platform.ui-2a65c7da375e80c78357ad5f44a2f881f1f3c2a4.tar.bz2
Bug 209190 Decorate symbolic linksv20130226-141624
Add an icon inspired by the one used for linked resources. Unlike linked resources, symbolic links are real file system objects subject to e.g. version control so the icon should not be placed at the same location that team providers typically use. The top-right location is already used by the image for certain node types, so this icon is made quite small, but still has a distinguishable arrow and lets detail from below be seen.
-rw-r--r--bundles/org.eclipse.ui.ide/icons/full/ovr16/symlink_ovr.gifbin0 -> 261 bytes
-rw-r--r--bundles/org.eclipse.ui.ide/plugin.properties2
-rw-r--r--bundles/org.eclipse.ui.ide/plugin.xml17
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/SymlinkDecorator.java65
4 files changed, 84 insertions, 0 deletions
diff --git a/bundles/org.eclipse.ui.ide/icons/full/ovr16/symlink_ovr.gif b/bundles/org.eclipse.ui.ide/icons/full/ovr16/symlink_ovr.gif
new file mode 100644
index 0000000..50e6c83
--- /dev/null
+++ b/bundles/org.eclipse.ui.ide/icons/full/ovr16/symlink_ovr.gif
Binary files differ
diff --git a/bundles/org.eclipse.ui.ide/plugin.properties b/bundles/org.eclipse.ui.ide/plugin.properties
index 02c3073..5f7acf1 100644
--- a/bundles/org.eclipse.ui.ide/plugin.properties
+++ b/bundles/org.eclipse.ui.ide/plugin.properties
@@ -94,6 +94,8 @@ openLocalFile.description= Opens a File
GoToResourceAction.label = &Resource...
DecoratorLinkedResource.label = Linked Resources
DecoratorLinkedResource.description = Adds an icon decoration to linked resources.
+DecoratorSymlinkResource.label = Symbolic links
+DecoratorSymlinkResource.description = Adds an icon decoration for symbolic links
DecoratorVirtualResource.label = Virtual Folders
DecoratorVirtualResource.description = Shows an icon for virtual folders.
DecoratorSpecificContentType.label = File Icons Based On Content Analysis
diff --git a/bundles/org.eclipse.ui.ide/plugin.xml b/bundles/org.eclipse.ui.ide/plugin.xml
index e8622b3..66688ca 100644
--- a/bundles/org.eclipse.ui.ide/plugin.xml
+++ b/bundles/org.eclipse.ui.ide/plugin.xml
@@ -376,6 +376,23 @@
<decorator
lightweight="true"
adaptable="true"
+ location="TOP_RIGHT"
+ label="%DecoratorSymlinkResource.label"
+ class="org.eclipse.ui.internal.ide.SymlinkDecorator"
+ state="true"
+ id="org.eclipse.ui.SymlinkDecorator">
+ <description>
+ %DecoratorSymlinkResource.description
+ </description>
+ <enablement>
+ <objectClass
+ name="org.eclipse.core.runtime.PlatformObject">
+ </objectClass>
+ </enablement>
+ </decorator>
+ <decorator
+ lightweight="true"
+ adaptable="true"
location="BOTTOM_RIGHT"
label="%DecoratorVirtualResource.label"
class="org.eclipse.ui.internal.ide.VirtualResourceDecorator"
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/SymlinkDecorator.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/SymlinkDecorator.java
new file mode 100644
index 0000000..943e2a7
--- /dev/null
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/SymlinkDecorator.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (C) 2012 Robin Rosenberg <robin.rosenberg@dewire.com>
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.ui.internal.ide;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourceAttributes;
+import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Decorate symbolic links
+ * @since 3.8.200
+ */
+public class SymlinkDecorator implements ILightweightLabelDecorator {
+
+ private static ImageDescriptor SYMLINK;
+
+ static {
+ SYMLINK = AbstractUIPlugin.imageDescriptorFromPlugin(
+ IDEWorkbenchPlugin.IDE_WORKBENCH,
+ "$nl$/icons/full/ovr16/symlink_ovr.gif"); //$NON-NLS-1$
+
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ // empty
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ // empty
+ }
+
+ public void decorate(Object element, IDecoration decoration) {
+ if (element instanceof ResourceMapping)
+ element = ((ResourceMapping) element).getModelObject();
+ if (element instanceof IAdaptable)
+ element = ((IAdaptable)element).getAdapter(IResource.class);
+ if (element instanceof IResource) {
+ IResource resource = (IResource) element;
+ ResourceAttributes resourceAttributes = resource
+ .getResourceAttributes();
+ if (resourceAttributes != null
+ && resourceAttributes.isSymbolicLink())
+ decoration.addOverlay(SYMLINK);
+ }
+ }
+}