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

svn commit: r1594817 - in /sling/trunk/tooling/ide/eclipse-ui: ./ META-INF/ src/org/apache/sling/ide/eclipse/ui/nav/model/ src/org/apache/sling/ide/eclipse/ui/views/

Author: stefanegli
Date: Thu May 15 08:35:44 2014
New Revision: 1594817

URL: http://svn.apache.org/r1594817
Log:
SLING-2985 : add new 'JcrPropertiesView' which gives us full feature control and allows easy insert/delete/showInEditor/pin features, and additionally eventually we can support typed cell-editors

Added:
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java   (with props)
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/UpdateHandler.java   (with props)
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrCellLabelProvider.java   (with props)
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java   (with props)
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java   (with props)
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/NewRow.java   (with props)
Modified:
    sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF
    sling/trunk/tooling/ide/eclipse-ui/plugin.xml
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDir.java

Modified: sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF?rev=1594817&r1=1594816&r2=1594817&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/eclipse-ui/META-INF/MANIFEST.MF Thu May 15 08:35:44 2014
@@ -7,7 +7,8 @@ Bundle-Version: 0.0.1.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ClassPath: .,
  lib/decentxml-1.4.jar
-Import-Package: org.apache.commons.httpclient;version="3.1.0",
+Import-Package: javax.jcr,
+ org.apache.commons.httpclient;version="3.1.0",
  org.apache.commons.httpclient.auth;version="3.1.0",
  org.apache.commons.httpclient.methods;version="3.1.0",
  org.apache.commons.httpclient.methods.multipart;version="3.1.0",

Modified: sling/trunk/tooling/ide/eclipse-ui/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/plugin.xml?rev=1594817&r1=1594816&r2=1594817&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Thu May 15 08:35:44 2014
@@ -552,5 +552,31 @@
          <bundle
                name="org.apache.sling.ide.eclipse-ui"></bundle>
       </component>
-   </extension>   
+   </extension>
+    <extension
+          point="org.eclipse.ui.views">
+       <category
+             id="org.apache.sling.ide.eclipse-ui"
+             name="Apache Sling">
+       </category>
+       <view
+             category="org.apache.sling.ide.eclipse-ui"
+             class="org.apache.sling.ide.eclipse.ui.views.JcrPropertiesView"
+             icon="icons/obj16/sling.gif"
+             id="org.apache.sling.ide.eclipse.ui.views.JcrPropertiesView"
+             name="JCR Properties">
+       </view>
+    </extension>
+    <extension
+          point="org.eclipse.ui.perspectiveExtensions">
+       <perspectiveExtension
+             targetID="org.eclipse.jdt.ui.JavaPerspective">
+          <view
+                id="org.apache.sling.ide.eclipse.ui.views.JcrPropertiesView"
+                ratio="0.5"
+                relationship="right"
+                relative="org.eclipse.ui.views.ProblemView">
+          </view>
+       </perspectiveExtension>
+    </extension>
 </plugin>    

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java?rev=1594817&r1=1594816&r2=1594817&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java Thu May 15 08:35:44 2014
@@ -193,8 +193,8 @@ public class GenericJcrRootFile extends 
 	}
 	
 	@Override
-	public void createChild(String nodeName) {
-		createChild(nodeName, document.getRootElement());
+	public void createChild(String nodeName, String nodeType) {
+		createChild(nodeName, nodeType, document.getRootElement(), underlying);
 	}
 	
 	public void save() {
@@ -205,7 +205,8 @@ public class GenericJcrRootFile extends 
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
- 
+		
+		SyncDirManager.syncDirChanged(getSyncDir());
 	}
 	
 }

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java?rev=1594817&r1=1594816&r2=1594817&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java Thu May 15 08:35:44 2014
@@ -33,8 +33,12 @@ import javax.xml.parsers.SAXParserFactor
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.sling.ide.eclipse.core.ISlingLaunchpadServer;
 import org.apache.sling.ide.eclipse.core.ProjectUtil;
+import org.apache.sling.ide.eclipse.core.debug.PluginLogger;
+import org.apache.sling.ide.eclipse.core.internal.Activator;
 import org.apache.sling.ide.eclipse.ui.WhitelabelSupport;
-import org.apache.sling.ide.eclipse.ui.internal.Activator;
+import org.apache.sling.ide.filter.Filter;
+import org.apache.sling.ide.filter.FilterResult;
+import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
@@ -66,7 +70,6 @@ import de.pdark.decentxml.Element;
 import de.pdark.decentxml.Namespace;
 import de.pdark.decentxml.Node;
 import de.pdark.decentxml.Text;
-import de.pdark.decentxml.XMLParseException;
 import de.pdark.decentxml.XMLTokenizer.Type;
 
 /** WIP: model object for a jcr node shown in the content package view in project explorer **/
@@ -494,7 +497,7 @@ public class JcrNode implements IAdaptab
 		return domName;
 	}
 		
-	String getJcrPath() {
+	public String getJcrPath() {
 		String prefix;
 		if (parent==null) {
 			prefix = "";
@@ -633,6 +636,10 @@ public class JcrNode implements IAdaptab
 		return null;
 	}
 
+	public ModifiableProperties getProperties() {
+	    return properties;
+	}
+	
 	protected boolean isBrowsable() {
 		return true;
 	}
@@ -692,43 +699,67 @@ public class JcrNode implements IAdaptab
 		return resource;
 	}
 
-	public void createChild(String nodeName) {
+	public void createChild(String nodeName, String nodeType) {
 		if (domElement==null) {
 			// then we're not in the context of a .content.xml file yet
 			// so we need to create one
-			final String minimalContentXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<jcr:root\n    xmlns:sling=\"http://sling.apache.org/jcr/sling/1.0\"\n    xmlns:jcr=\"http://www.jcp.org/jcr/1.0\"/>";
+		    
+		    //TODO then it probably never will be OK to create a child here !
+		    // as this is a plain folder/file-based entry - in which case it
+		    // is very likely not to be fine to create just a .content.xml or nodename.xml !
+		    
+			final String minimalContentXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<jcr:root \n    xmlns:sling=\"http://sling.apache.org/jcr/sling/1.0\"\n    xmlns:jcr=\"http://www.jcp.org/jcr/1.0\"\n    jcr:primaryType=\""+nodeType+"\"/>";
 			if (resource instanceof IFolder) {
 				IFolder folder = (IFolder)resource;
-				IFile file = folder.getFile(nodeName+".xml");
+				final String filename = nodeName+".xml";
+                IFile file = folder.getFile(filename);
+                if (file.exists()) {
+                    System.out.println("then what?");
+                }
 				try {
 					file.create(new ByteArrayInputStream(minimalContentXml.getBytes()), true, new NullProgressMonitor());
 				} catch (CoreException e) {
 					//TODO proper logging
 					e.printStackTrace();
+	                MessageDialog.openInformation(Display.getDefault().getActiveShell(), 
+	                        "Cannot create JCR node on a File", "Following Exception encountered: "+e);
 				}
 			} else {
 				MessageDialog.openInformation(Display.getDefault().getActiveShell(), 
 						"Cannot create JCR node on a File", "Creating a JCR node on a File is not yet supported");
 			}
 		} else {
-			try{
-				createChild(nodeName, domElement);
-			} catch(Exception e) {
-				MessageDialog.openError(Display.getDefault().getActiveShell(), "Error creating new JCR node", "The following error occurred: "+e.getMessage());
-			}
+		    boolean underlyingMatch = underlying==properties.getUnderlying();
+		    if (domElement==properties.getDomElement()) {
+		        // normal case
+		        try{
+		            createChild(nodeName, nodeType, domElement, underlying);
+		        } catch(Exception e) {
+		            MessageDialog.openError(Display.getDefault().getActiveShell(), "Error creating new JCR node", "The following error occurred: "+e.getMessage());
+		        }
+		    } else {
+		        // trickier case
+                try{
+                    createChild(nodeName, nodeType, properties.getDomElement(), properties.getUnderlying());
+                } catch(Exception e) {
+                    MessageDialog.openError(Display.getDefault().getActiveShell(), "Error creating new JCR node", "The following error occurred: "+e.getMessage());
+                }
+		        
+		    }
+		    
 		}
 	}
 
-	protected void createChild(String nodeName,
-			Element domElement) {
+	protected void createChild(String nodeName, String nodeType,
+			Element domElement, GenericJcrRootFile effectiveUnderlying) {
 		if (domElement==null) {
 			throw new IllegalArgumentException("domNode must not be null");
 		}
-		if (underlying==null) {
-			throw new IllegalArgumentException("underlying must not be null");
+		if (effectiveUnderlying==null) {
+			throw new IllegalArgumentException("effectiveUnderlying must not be null");
 		}
 		Element element = new Element(nodeName);
-		element.addAttribute("jcr:primaryType", "nt:unstructured");
+		element.addAttribute("jcr:primaryType", nodeType);
 		StringBuffer indent = new StringBuffer();
 		Element parElement = domElement.getParentElement();
 		while(parElement!=null) {
@@ -739,7 +770,7 @@ public class JcrNode implements IAdaptab
 		element = domElement.addNode(element);
 		domElement.addNode(new Text("\n"+indent.toString()));
 		JcrNode childNode = new JcrNode(this, element, null);
-		underlying.save();
+		effectiveUnderlying.save();
 	}
 
 	public void delete() {
@@ -793,4 +824,60 @@ public class JcrNode implements IAdaptab
 		return url;
 	}
 
+    public boolean isInContentXml() {
+        return domElement!=null;
+    }
+
+    public boolean canCreateChild() {
+        try {
+            final IProject project = getProject();
+            final Filter filter = ProjectUtil.loadFilter(project);
+            final String relativeFilePath = getJcrPath();
+//            final Repository repository = Activator.getDefault().getRepositoryFactory().newRepository(null);//ServerUtil.getRepository(null, null);
+//            final RepositoryInfo repositoryInfo = repository.getRepositoryInfo();
+//            if (repositoryInfo==null) {
+//                return false;
+//            }
+            final FilterResult result = filter.filter(ProjectUtil.getSyncDirectoryFile(project), relativeFilePath, null);
+            return result==FilterResult.ALLOW;
+        } catch (CoreException e) {
+            PluginLogger logger = Activator.getDefault().getPluginLogger();
+            logger.error("Could not verify child node allowance: "+this, e);
+            return false;
+        }
+    }
+
+    public String getPrimaryType() {
+        final String pt = properties.getValue("jcr:primaryType");
+        if (pt!=null && pt.length()!=0) {
+            return pt;
+        }
+        if (domElement==null) {
+            if (resource!=null) {
+                if (resource instanceof IContainer) {
+                    return "nt:folder";
+                } else {
+                    return "nt:file";
+                }
+            }
+        }
+        return null;
+    }
+
+    public void deleteProperty(String displayName) {
+        properties.deleteProperty(displayName);
+    }
+
+    public SyncDir getSyncDir() {
+        return getParent().getSyncDir();
+    }
+
+    public void setPropertyValue(Object key, Object value) {
+        properties.setPropertyValue(key, value);
+    }
+
+    public void addProperty(String name, String value) {
+        properties.addProperty(name, value);
+    }
+
 }

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java?rev=1594817&r1=1594816&r2=1594817&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/ModifiableProperties.java Thu May 15 08:35:44 2014
@@ -51,6 +51,10 @@ public class ModifiableProperties implem
 		return genericJcrRootFile;
 	}
 	
+	public Element getDomElement() {
+	    return domElement;
+	}
+	
 	@Override
 	public Object getEditableValue() {
 		return this;
@@ -89,23 +93,45 @@ public class ModifiableProperties implem
 
 	@Override
 	public void setPropertyValue(Object id, Object value) {
-		Map.Entry<String, String> entry = (Map.Entry<String, String>)id;
-		entry.setValue(String.valueOf(value));
-		Attribute a = domElement.getAttribute(entry.getKey());
-		a.setValue(String.valueOf(value));
-		genericJcrRootFile.save();
+	    if (id instanceof Map.Entry<?, ?>) {
+	        Map.Entry<String, String> entry = (Map.Entry<String, String>)id;
+	        entry.setValue(String.valueOf(value));
+	        Attribute a = domElement.getAttribute(entry.getKey());
+	        a.setValue(String.valueOf(value));
+	        genericJcrRootFile.save();
+	    } else if (value instanceof String) {
+            Attribute a = domElement.getAttribute((String) id);
+            a.setValue((String) value);
+            genericJcrRootFile.save();
+	    } else {
+	        System.out.println("UNSUPPORTED VALUE TYPE: "+value.getClass());
+	    }
 	}
 
 	public void setNode(GenericJcrRootFile genericJcrRootFile, Element domNode) {
 		this.domElement = domNode;
-		List<Attribute> attributes = domNode.getAttributes();
+		final List<Attribute> attributes = domNode.getAttributes();
 		if (attributes!=null) {
 			for (Iterator<Attribute> it = attributes.iterator(); it.hasNext();) {
-				Attribute a = it.next();
-				properties.put(a.getName(), a.getValue());
+				final Attribute a = it.next();
+				final String name = a.getName();
+				if (name.startsWith("xmlns:")) {
+				    continue;
+				}
+                properties.put(name, a.getValue());
 			}
 		}
 		this.genericJcrRootFile = genericJcrRootFile;
 	}
 
+    public void deleteProperty(String displayName) {
+        domElement.removeAttribute(displayName);
+        genericJcrRootFile.save();
+    }
+
+    public void addProperty(String name, String value) {
+        domElement.addAttribute(name, value);
+        genericJcrRootFile.save();
+    }
+
 }

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=1594817&r1=1594816&r2=1594817&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 Thu May 15 08:35:44 2014
@@ -16,6 +16,8 @@
  */
 package org.apache.sling.ide.eclipse.ui.nav.model;
 
+import java.util.StringTokenizer;
+
 import org.apache.sling.ide.eclipse.ui.internal.SharedImages;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
@@ -32,6 +34,7 @@ public class SyncDir extends JcrNode {
 		}
 		this.folder = folder;
 		setResource(folder);
+		SyncDirManager.registerNewSyncDir(this);
 	}
 	
 	@Override
@@ -75,5 +78,25 @@ public class SyncDir extends JcrNode {
 	public IFile getFileForEditor() {
 		return null;
 	}
+	
+	@Override
+	public SyncDir getSyncDir() {
+	    return this;
+	}
 
+	public JcrNode getNode(String path) {
+	    StringTokenizer st = new StringTokenizer(path, "/");
+	    JcrNode node = SyncDirManager.getSyncDirOrNull(folder);
+	    while(st.hasMoreTokens()) {
+	        String nodeName = st.nextToken();
+	        node.getChildren(true);
+	        JcrNode child = node.getChild(nodeName);
+	        if (child==null) {
+	            return null;
+	        }
+	        node = child;
+	    }
+	    return node;
+	}
+	
 }

Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java?rev=1594817&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java Thu May 15 08:35:44 2014
@@ -0,0 +1,52 @@
+package org.apache.sling.ide.eclipse.ui.nav.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFolder;
+
+/**
+ * TODO: Currently static - change into a service
+ * <p>
+ * This manager keeps track of SyncDir (models) and allows to 
+ * register a listener that gets informed if the model changes.
+ * <p>
+ * Alternative would be to move the update/listener mechanism
+ * into the SyncDir object itself..
+ */
+public class SyncDirManager {
+
+    private static Map<IFolder,SyncDir> syncDirs = new HashMap<IFolder,SyncDir>();
+    private static List<UpdateHandler> handlers = new LinkedList<UpdateHandler>();
+    
+    public static void registerNewSyncDir(SyncDir syncDir) {
+        syncDirs.put(syncDir.getFolder(), syncDir);
+        syncDirChanged(syncDir);
+    }
+
+    public static void syncDirChanged(SyncDir syncDir) {
+        List<UpdateHandler> handlersCopy;
+        synchronized(handlers) {
+            handlersCopy = new ArrayList<UpdateHandler>(handlers);
+        }
+        for (Iterator it = handlersCopy.iterator(); it.hasNext();) {
+            UpdateHandler updateHandler = (UpdateHandler) it.next();
+            updateHandler.syncDirUpdated(syncDir);
+        }
+    }
+    
+    public static SyncDir getSyncDirOrNull(IFolder folder) {
+        return syncDirs.get(folder);
+    }
+    
+    public static void registerUpdateListener(UpdateHandler updateHandler) {
+        synchronized(handlers) {
+            handlers.add(updateHandler);
+        }
+    }
+
+}

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/SyncDirManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/UpdateHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/UpdateHandler.java?rev=1594817&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/UpdateHandler.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/UpdateHandler.java Thu May 15 08:35:44 2014
@@ -0,0 +1,7 @@
+package org.apache.sling.ide.eclipse.ui.nav.model;
+
+public interface UpdateHandler {
+    
+    public void syncDirUpdated(SyncDir syncDir);
+
+}

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/UpdateHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrCellLabelProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrCellLabelProvider.java?rev=1594817&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrCellLabelProvider.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrCellLabelProvider.java Thu May 15 08:35:44 2014
@@ -0,0 +1,121 @@
+package org.apache.sling.ide.eclipse.ui.views;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.sling.ide.eclipse.ui.nav.model.JcrNode;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+public class JcrCellLabelProvider extends CellLabelProvider {
+
+    private final TableViewer viewer;
+    private Font italic;
+    private Font normal;
+    private Font bold;
+    private Color greyColor;
+    private Color normalColor;
+
+    public JcrCellLabelProvider(TableViewer viewer) {
+        this.viewer = viewer;
+
+        Display display = viewer.getControl().getDisplay();
+        
+        FontData fontData = viewer.getTable().getFont().getFontData()[0];
+        italic = new Font(display, new FontData(fontData.getName(), fontData
+                .getHeight(), SWT.ITALIC));
+        normal = new Font(display, new FontData(fontData.getName(), fontData
+                .getHeight(), SWT.NORMAL));
+        bold = new Font(display, new FontData(fontData.getName(), fontData
+                .getHeight(), SWT.BOLD));
+        greyColor = new Color(display, 100, 100, 100);
+        normalColor = viewer.getTable().getForeground();
+    }
+    
+    @Override
+    public void update(ViewerCell cell) {
+        int index = cell.getColumnIndex();
+        if (isNewRow(cell)) {
+            cell.setFont(italic);
+        } else {
+            cell.setFont(normal);
+        }
+        if (canEdit(cell)) {
+            cell.setForeground(normalColor);
+        } else {
+            cell.setForeground(greyColor);
+        }
+        if (index==0) {
+            updateName(cell);
+            return;
+        } else if (index==1) {
+            cell.setText("String");
+            return;
+        } else if (index==2) {
+            updateValue(cell);
+            return;
+        } else {
+            cell.setText("false");
+            return;
+        }
+    }
+
+    private boolean canEdit(ViewerCell cell) {
+        Object element = cell.getElement();
+        if (element instanceof NewRow) {
+            return (cell.getColumnIndex()==0 || cell.getColumnIndex()==2);
+        } else if (element instanceof IPropertyDescriptor){
+            IPropertyDescriptor pd = (IPropertyDescriptor)element;
+            JcrNode jcrNode = (JcrNode)viewer.getInput();
+            Map.Entry me = (Entry) pd.getId();
+            if (me.getKey().equals("jcr:primaryType")) {
+                return false;
+            } else {
+                return true;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    private boolean isNewRow(ViewerCell cell) {
+        return (cell.getElement() instanceof NewRow);
+    }
+
+    private void updateValue(ViewerCell cell) {
+        final Object element = cell.getElement();
+        if (element instanceof NewRow) {
+            NewRow newRow = (NewRow)element;
+            cell.setText(String.valueOf(newRow.getValue()));
+        } else if (element instanceof IPropertyDescriptor) {
+            IPropertyDescriptor pd = (IPropertyDescriptor)element;
+            JcrNode jcrNode = (JcrNode)viewer.getInput();
+//            jcrNode.getProperties().getPropertyValue(pd); 
+            Map.Entry me = (Entry) pd.getId();
+            cell.setText(String.valueOf(me.getValue()));
+        } else {
+            cell.setText(String.valueOf(element));
+        }
+    }
+
+    private void updateName(ViewerCell cell) {
+        final Object element = cell.getElement();
+        if (element instanceof NewRow) {
+            NewRow newRow = (NewRow)element;
+            cell.setText(String.valueOf(newRow.getName()));
+        } else if (element instanceof IPropertyDescriptor) {
+            IPropertyDescriptor pd = (IPropertyDescriptor)element;
+            cell.setText(pd.getDisplayName());
+        } else {
+            cell.setText(String.valueOf(element));
+        }
+    }
+
+}

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrCellLabelProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java?rev=1594817&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java Thu May 15 08:35:44 2014
@@ -0,0 +1,166 @@
+package org.apache.sling.ide.eclipse.ui.views;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.sling.ide.eclipse.ui.nav.model.JcrNode;
+import org.apache.sling.ide.eclipse.ui.nav.model.SyncDir;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+public class JcrEditingSupport extends EditingSupport {
+    
+    static enum ColumnType {
+        NAME, VALUE
+    }
+
+    private final ColumnType columnType;
+    private final TableViewer tableViewer;
+    private final JcrPropertiesView view;
+    
+    private class Field {
+        private final Object element;
+
+        Field(Object element) {
+            this.element = element;
+        }
+
+        public boolean canEdit() {
+            if (element instanceof NewRow) {
+                return true;
+            }
+            if (columnType==ColumnType.NAME) {
+                return false;
+            }
+            IPropertyDescriptor pd = (IPropertyDescriptor) element;
+            Map.Entry me = (Entry) pd.getId();
+            if (me.getKey().equals("jcr:primaryType")) {
+                return false;
+            }
+            return true;
+        }
+        
+        public Object getValue() {
+            IPropertyDescriptor pd = (IPropertyDescriptor) element;
+            JcrNode jcrNode = getNode();
+            Map.Entry me = (Entry) pd.getId();
+            
+            return String.valueOf(me.getValue());
+        }
+
+        public void setValue(Object element, Object value) {
+            if (getValue().equals(value)) {
+                // then ignore this
+                return;
+            }
+            IPropertyDescriptor pd = (IPropertyDescriptor) element;
+            JcrNode jcrNode = getNode();
+            Map.Entry me = (Entry) pd.getId();
+
+            jcrNode.setPropertyValue(me.getKey(), value);
+
+            view.refreshContent();
+        }
+    }
+    
+    private class NewRowField extends Field {
+
+        private final NewRow newRow;
+
+        NewRowField(NewRow newRow) {
+            super(newRow);
+            this.newRow = newRow;
+        }
+        
+        @Override
+        public boolean canEdit() {
+            return (columnType==ColumnType.NAME || columnType==ColumnType.VALUE);
+        }
+        
+        @Override
+        public Object getValue() {
+            if (columnType==ColumnType.NAME) {
+                return newRow.getName();
+            } else if (columnType==ColumnType.VALUE) {
+                return newRow.getValue();
+            } else {
+                return null;
+            }
+        }
+        
+        @Override
+        public void setValue(Object element, Object value) {
+            if (getValue().equals(value)) {
+                // then ignore this
+                return;
+            }
+            if (columnType==ColumnType.NAME) {
+                newRow.setName(String.valueOf(value));
+            } else if (columnType==ColumnType.VALUE) {
+                newRow.setValue(String.valueOf(value));
+            } else {
+                // otherwise non-editable
+                return;
+            }
+            handleNewRowUpdate(newRow);
+        }
+    }
+
+    public JcrEditingSupport(JcrPropertiesView view, TableViewer viewer, ColumnType columnType) {
+        super(viewer);
+        this.view = view;
+        this.columnType = columnType;
+        this.tableViewer = viewer;
+    }
+
+    @Override
+    protected CellEditor getCellEditor(Object element) {
+        return new TextCellEditor(tableViewer.getTable());
+    }
+
+    @Override
+    protected boolean canEdit(Object element) {
+        return asField(element).canEdit();
+    }
+    
+    private Field asField(Object element) {
+        if (element instanceof NewRow) {
+            return new NewRowField((NewRow)element);
+        } else {
+            return new Field(element);
+        }
+    }
+
+    @Override
+    protected Object getValue(Object element) {
+        return asField(element).getValue();
+    }
+
+    @Override
+    protected void setValue(Object element, Object value) {
+        Field field = asField(element);
+        if (!field.canEdit()) {
+            return;
+        }
+        field.setValue(element, value);
+    }
+
+    void handleNewRowUpdate(NewRow newRow) {
+        if (newRow.isComplete()) {
+            tableViewer.remove(newRow);
+            JcrNode jcrNode = (JcrNode)tableViewer.getInput();
+            jcrNode.addProperty(String.valueOf(newRow.getName()), String.valueOf(newRow.getValue()));
+            view.refreshContent();
+        } else {
+            tableViewer.update(newRow, null);
+        }
+    }
+
+    private JcrNode getNode() {
+        return (JcrNode)tableViewer.getInput();
+    }
+    
+}

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java?rev=1594817&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java Thu May 15 08:35:44 2014
@@ -0,0 +1,407 @@
+package org.apache.sling.ide.eclipse.ui.views;
+
+import org.apache.sling.ide.eclipse.ui.nav.model.JcrNode;
+import org.apache.sling.ide.eclipse.ui.nav.model.SyncDir;
+import org.apache.sling.ide.eclipse.ui.nav.model.SyncDirManager;
+import org.apache.sling.ide.eclipse.ui.nav.model.UpdateHandler;
+import org.apache.sling.ide.eclipse.ui.views.JcrEditingSupport.ColumnType;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.OpenFileAction;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
+import org.eclipse.ui.internal.WorkbenchImages;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+public class JcrPropertiesView extends ViewPart {
+
+    private static final String TITLE_FONT = "org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyTitle"; //$NON-NLS-1$
+
+    private TableViewer viewer;
+	private Action insertAction;
+	private Action deleteAction;
+	private Action doubleClickAction;
+
+    private Label titleLabel;
+
+    private ISelectionListener listener;
+
+    private Action showInEditorAction;
+
+    private Action pinAction;
+
+    private JcrNode lastInput;
+
+	class ViewContentProvider implements IStructuredContentProvider {
+		public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+		}
+		public void dispose() {
+		}
+		public Object[] getElements(Object parent) {
+		    if (parent instanceof JcrNode) {
+		        JcrNode node = (JcrNode)parent;
+		        final IPropertyDescriptor[] pds = node.getProperties().getPropertyDescriptors();
+                return pds;
+		    } else {
+		        return new String[] {};
+		    }
+		}
+	}
+	/**
+	 * The constructor.
+	 */
+	public JcrPropertiesView() {
+	}
+
+	/**
+	 * This is a callback that will allow us
+	 * to create the viewer and initialize it.
+	 */
+	public void createPartControl(Composite parent) {
+	    SyncDirManager.registerUpdateListener(new UpdateHandler() {
+            
+            @Override
+            public void syncDirUpdated(SyncDir syncDir) {
+                refreshContent();
+            }
+        });
+	    
+	    Composite c = new Composite(parent, SWT.NONE);
+	    final GridLayout gridLayout = new GridLayout(1, true);
+        c.setLayout(gridLayout);
+	    
+        titleLabel = new Label(c, SWT.WRAP);
+        titleLabel.setText("");
+        GridData data = new GridData(GridData.FILL_HORIZONTAL);
+        titleLabel.setLayoutData(data);
+        
+        Label horizontalLine = new Label(c, SWT.SEPARATOR | SWT.HORIZONTAL);
+        data = new GridData(GridData.FILL_HORIZONTAL);
+        horizontalLine.setLayoutData(data);
+        Font font;
+        if (! JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) {
+            FontData[] fontData = JFaceResources.getFontRegistry().getBold(
+                    JFaceResources.DEFAULT_FONT).getFontData();
+            /* title font is 2pt larger than that used in the tabs. */  
+            fontData[0].setHeight(fontData[0].getHeight() + 2);
+            JFaceResources.getFontRegistry().put(TITLE_FONT, fontData);
+        }
+        font = JFaceResources.getFont(TITLE_FONT);
+        titleLabel.setFont(font);
+
+        Composite tableParent = new Composite(c, SWT.NONE);
+        tableParent.setLayoutData(new GridData(GridData.FILL_BOTH));
+        TableColumnLayout tableLayout = new TableColumnLayout();
+        tableParent.setLayout(tableLayout);
+        viewer = new TableViewer(tableParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        viewer.getTable().setLinesVisible(true);
+        viewer.getTable().setHeaderVisible(true);
+        viewer.setContentProvider(new ViewContentProvider());
+		viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+            
+            @Override
+            public void selectionChanged(SelectionChangedEvent event) {
+                final ISelection selection = event.getSelection();
+                if (selection instanceof IStructuredSelection) {
+                    IStructuredSelection iss = (IStructuredSelection)selection;
+                    if (iss.isEmpty()) {
+                        deleteAction.setEnabled(false);
+                    } else {
+                        deleteAction.setEnabled(true);
+                    }
+                } else {
+                    deleteAction.setEnabled(false);
+                }
+            }
+        });
+		
+		CellLabelProvider clp = new JcrCellLabelProvider(viewer);
+
+		TableViewerColumn column0 = new TableViewerColumn(viewer, SWT.NONE);
+		column0.getColumn().setText("Name");
+		column0.getColumn().setResizable(true);
+		column0.getColumn().setWidth(200);
+        tableLayout.setColumnData(column0.getColumn(), new ColumnWeightData(30, 150));
+
+        final TableViewerColumn column1 = new TableViewerColumn(viewer, SWT.NONE);
+        column1.getColumn().setText("Type");
+        column1.getColumn().setResizable(true);
+        column1.getColumn().setWidth(300);
+        column1.setLabelProvider(clp);
+        tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(5, 50));
+        
+        final TableViewerColumn column2 = new TableViewerColumn(viewer, SWT.NONE);
+        column2.getColumn().setText("Value");
+        column2.getColumn().setResizable(true);
+        column2.getColumn().setWidth(300);
+        tableLayout.setColumnData(column2.getColumn(), new ColumnWeightData(70, 250));
+        
+        final TableViewerColumn column3 = new TableViewerColumn(viewer, SWT.NONE);
+        column3.getColumn().setText("Protected");
+        column3.getColumn().setResizable(true);
+        column3.getColumn().setWidth(300);
+        column3.setLabelProvider(clp);
+        tableLayout.setColumnData(column3.getColumn(), new ColumnWeightData(5, 50));
+
+        final TableViewerColumn column4 = new TableViewerColumn(viewer, SWT.NONE);
+        column4.getColumn().setText("Mandatory");
+        column4.getColumn().setResizable(true);
+        column4.getColumn().setWidth(300);
+        column4.setLabelProvider(clp);
+        tableLayout.setColumnData(column4.getColumn(), new ColumnWeightData(5, 50));
+
+        final TableViewerColumn column5 = new TableViewerColumn(viewer, SWT.NONE);
+        column5.getColumn().setText("Multiple");
+        column5.getColumn().setResizable(true);
+        column5.getColumn().setWidth(300);
+        column5.setLabelProvider(clp);
+        tableLayout.setColumnData(column5.getColumn(), new ColumnWeightData(5, 50));
+
+        final TableViewerColumn column6 = new TableViewerColumn(viewer, SWT.NONE);
+        column6.getColumn().setText("Auto Created");
+        column6.getColumn().setResizable(true);
+        column6.getColumn().setWidth(300);
+        column6.setLabelProvider(clp);
+        tableLayout.setColumnData(column6.getColumn(), new ColumnWeightData(5, 50));
+
+        column0.setLabelProvider(clp);
+        column0.setEditingSupport(new JcrEditingSupport(this, viewer, ColumnType.NAME));
+
+		column2.setLabelProvider(clp);
+		column2.setEditingSupport(new JcrEditingSupport(this, viewer, ColumnType.VALUE));
+		
+		// Create the help context id for the viewer's control
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.apache.sling.ide.eclipse-ui.viewer");
+		makeActions();
+		hookContextMenu();
+		hookDoubleClickAction();
+		contributeToActionBars();
+		
+		listener = new ISelectionListener() {
+            
+            @Override
+            public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+                if (selection instanceof IStructuredSelection) {
+                    IStructuredSelection iss = (IStructuredSelection)selection;
+                    Object firstElem = iss.getFirstElement();
+                    if (firstElem instanceof JcrNode) {
+                        JcrNode jcrNode = (JcrNode)firstElem;
+                        setInput(jcrNode);
+                        return;
+                    }
+                }
+            }
+        };
+        getViewSite().getPage().addSelectionListener(listener);
+	}
+	
+	@Override
+	public void dispose() {
+	    super.dispose();
+	    if (listener!=null) {
+	        getViewSite().getPage().removeSelectionListener(listener);
+	        listener = null;
+	    }
+	}
+
+	private void hookContextMenu() {
+		MenuManager menuMgr = new MenuManager("#PopupMenu");
+		menuMgr.setRemoveAllWhenShown(true);
+		menuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager manager) {
+				JcrPropertiesView.this.fillContextMenu(manager);
+			}
+		});
+		Menu menu = menuMgr.createContextMenu(viewer.getControl());
+		viewer.getControl().setMenu(menu);
+		getSite().registerContextMenu(menuMgr, viewer);
+	}
+
+	private void contributeToActionBars() {
+		IActionBars bars = getViewSite().getActionBars();
+		fillLocalPullDown(bars.getMenuManager());
+		fillLocalToolBar(bars.getToolBarManager());
+	}
+
+	private void fillLocalPullDown(IMenuManager manager) {
+		manager.add(insertAction);
+//		manager.add(new Separator());
+		manager.add(deleteAction);
+        manager.add(showInEditorAction);
+        manager.add(pinAction);
+	}
+
+	private void fillContextMenu(IMenuManager manager) {
+		manager.add(insertAction);
+        manager.add(deleteAction);
+        manager.add(showInEditorAction);
+        manager.add(pinAction);
+		// Other plug-ins can contribute there actions here
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+	}
+	
+	private void fillLocalToolBar(IToolBarManager manager) {
+		manager.add(insertAction);
+		manager.add(deleteAction);
+        manager.add(showInEditorAction);
+        manager.add(pinAction);
+	}
+
+	private void makeActions() {
+		insertAction = new Action() {
+			public void run() {
+			    NewRow newRow = new NewRow();
+			    viewer.add(newRow);
+			    viewer.getTable().setTopIndex(viewer.getTable().getItemCount());
+			    viewer.getTable().select(viewer.getTable().getItemCount()-1);
+			    viewer.editElement(newRow, 0);
+			}
+		};
+		insertAction.setText("Insert");
+		insertAction.setToolTipText("Insert a property");
+		insertAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+			getImageDescriptor(ISharedImages.IMG_OBJ_ADD));
+		
+		deleteAction = new Action() {
+			public void run() {
+			    if (viewer.getSelection().isEmpty()) {
+			        return;
+			    }
+			    ISelection sel = viewer.getSelection();
+			    if (sel instanceof IStructuredSelection) {
+			        IStructuredSelection iss = (IStructuredSelection)sel;
+			        Object elem = iss.getFirstElement();
+			        if (elem instanceof IPropertyDescriptor) {
+			            IPropertyDescriptor pd = (IPropertyDescriptor)elem;
+			            JcrNode jcrnode = (JcrNode)viewer.getInput();
+			            jcrnode.deleteProperty(pd.getDisplayName());
+			            refreshContent();
+			        }
+			    }
+			}
+		};
+		deleteAction.setText("Delete");
+		deleteAction.setToolTipText("Delete a proeprty");
+		deleteAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+				getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+		doubleClickAction = new Action() {
+			public void run() {
+			    //TODO doesn't do anything currently..
+				ISelection selection = viewer.getSelection();
+//				Object obj = ((IStructuredSelection)selection).getFirstElement();
+//				showMessage("Double-click detected on "+obj.toString());
+			}
+		};
+		
+		showInEditorAction = new Action() {
+		    public void run() {
+		        
+		        JcrNode node = (JcrNode)viewer.getInput();
+                final IFile file = node.getFileForEditor();
+                try {
+                    IDE.openEditor(getViewSite().getPage(), file, true);
+                } catch (PartInitException e) {
+                    e.printStackTrace(System.out);
+                }
+		    }
+		};
+		showInEditorAction.setText("Show in editor");
+		showInEditorAction.setToolTipText("Show underlying vault file in editor");
+		showInEditorAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+                getImageDescriptor(ISharedImages.IMG_OBJ_FILE));
+		
+		pinAction = new Action("pin to selection", IAction.AS_CHECK_BOX) {
+		    public void run() {
+		        if (!pinAction.isChecked()) {
+		            // unpin
+		            setContentDescription("");
+		            setInput(lastInput);
+		        } else {
+		            setContentDescription("[pinned]");
+		        }
+		    }
+		};
+		pinAction.setText("Pin to selection");
+		pinAction.setToolTipText("Pin this property view to the current selection");
+		pinAction.setImageDescriptor(WorkbenchImages
+                .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR));
+		pinAction.setDisabledImageDescriptor(WorkbenchImages
+                .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR_DISABLED));
+	}
+
+	private void hookDoubleClickAction() {
+		viewer.addDoubleClickListener(new IDoubleClickListener() {
+			public void doubleClick(DoubleClickEvent event) {
+				doubleClickAction.run();
+			}
+		});
+	}
+	
+	/**
+	 * Passing the focus request to the viewer's control.
+	 */
+	public void setFocus() {
+		viewer.getControl().setFocus();
+	}
+
+    void refreshContent() {
+        final Object input = viewer.getInput();
+        if (input!=null && input instanceof JcrNode) {
+            JcrNode jcrnode = (JcrNode)input;
+            SyncDir syncDir = jcrnode.getSyncDir();
+            JcrNode newnode = syncDir.getNode(jcrnode.getJcrPath());
+            if (newnode!=null) {
+                viewer.setInput(newnode);
+            }
+        }
+    }
+
+    private void setInput(JcrNode jcrNode) {
+        if (pinAction.isChecked()) {
+            lastInput = jcrNode;
+        } else {
+            viewer.setInput(jcrNode);
+            titleLabel.setText(jcrNode.getDescription());
+            insertAction.setEnabled(true);
+            deleteAction.setEnabled(false);
+        }
+    }
+
+}
\ No newline at end of file

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/NewRow.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/NewRow.java?rev=1594817&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/NewRow.java (added)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/NewRow.java Thu May 15 08:35:44 2014
@@ -0,0 +1,38 @@
+package org.apache.sling.ide.eclipse.ui.views;
+
+class NewRow {
+
+    private String name;
+    private Object value;
+
+    public NewRow() {
+        this.name = "";
+        this.value = "";
+    }
+    
+    @Override
+    public String toString() {
+        return super.toString();
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public Object getName() {
+        return name;
+    }
+
+    public boolean isComplete() {
+        return (name!=null && name.length()>0 && value!=null && String.valueOf(value).length()>0);
+    }
+
+}
\ No newline at end of file

Propchange: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/NewRow.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain