You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2014/05/21 16:38:45 UTC

svn commit: r1596584 - in /sling/trunk/tooling/ide/eclipse-ui: plugin.xml src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDir.java

Author: rombert
Date: Wed May 21 14:38:45 2014
New Revision: 1596584

URL: http://svn.apache.org/r1596584
Log:
SLING-3593 - Add node type decorator for jcr nodes

Added:
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java   (with props)
Modified:
    sling/trunk/tooling/ide/eclipse-ui/plugin.xml
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDir.java

Modified: sling/trunk/tooling/ide/eclipse-ui/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/plugin.xml?rev=1596584&r1=1596583&r2=1596584&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Wed May 21 14:38:45 2014
@@ -487,6 +487,19 @@
            </objectClass>
          </enablement>
       </decorator>
+      <decorator
+      		adaptable="true"
+      		class="org.apache.sling.ide.eclipse.ui.internal.JcrNodeDecorator"
+            id="org.apache.sling.ide.eclipse-ui.JcrNodeDecorator"
+            label="JCR Node decorator"
+            lightweight="true"
+            state="true">
+            <enablement>
+            	<objectClass
+                   name="org.apache.sling.ide.eclipse.ui.nav.model.JcrNode">
+            	</objectClass>
+            </enablement>
+      </decorator>
    </extension>
    <extension
          point="org.eclipse.ui.navigator.linkHelper">

Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java?rev=1596584&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java Wed May 21 14:38:45 2014
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.eclipse.ui.internal;
+
+import org.apache.sling.ide.eclipse.ui.nav.model.JcrNode;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+public class JcrNodeDecorator extends LabelProvider implements ILabelDecorator, ILightweightLabelDecorator {
+
+    @Override
+    public Image decorateImage(Image image, Object element) {
+        return image;
+    }
+
+    @Override
+    public String decorateText(String text, Object element) {
+        return text;
+    }
+
+    @Override
+    public void decorate(Object element, IDecoration decoration) {
+
+        if (element instanceof JcrNode) {
+            JcrNode node = (JcrNode) element;
+            if (node.getPrimaryType() != null) {
+                decoration.addSuffix(" [" + node.getPrimaryType() + "]");
+            }
+        }
+    }
+}

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/JcrNodeDecorator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDir.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDir.java?rev=1596584&r1=1596583&r2=1596584&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDir.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDir.java Wed May 21 14:38:45 2014
@@ -57,7 +57,7 @@ public class SyncDir extends JcrNode {
 	}
 
 	public String getLabel() {
-		return folder.getProjectRelativePath()+" [sling synched]";
+        return folder.getProjectRelativePath().toString();
 	}
 	
 	@Override