Author: stefanegli
Date: Tue May 20 17:09:46 2014
New Revision: 1596319

URL: http://svn.apache.org/r1596319
Log:
SLING-2985 : fix 'show in editor' behavior of both content browser and 
properties view

Modified:
    
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/views/JcrPropertiesView.java

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=1596319&r1=1596318&r2=1596319&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
 Tue May 20 17:09:46 2014
@@ -678,20 +678,25 @@ public class JcrNode implements IAdaptab
        }
 
        public IFile getFileForEditor() {
+           if ("nt:folder".equals(getPrimaryType())) {
+               // nt:folder doesn't have an underlying file for editor
+               return null;
+           }
+           
                if (resource instanceof IFile) {
-//                     if (!isVaultFile(resource)) {
                        return (IFile)resource;
-               } else if (underlying!=null && underlying.file!=null && 
domElement!=null) {
-                       if (properties!=null) {
-                               GenericJcrRootFile propUnderlying = 
properties.getUnderlying();
-                               if (propUnderlying!=null) {
-                                       return propUnderlying.file;
-                               }
-                       }
-                       return underlying.file;
-               } else {
-                       return null;
                }
+               
+               if (properties!=null && properties.getUnderlying()!=null && 
properties.getUnderlying().file!=null) {
+                   return properties.getUnderlying().file;
+               }
+               
+               if (underlying!=null && underlying.file!=null) {
+                   return underlying.file;
+               }
+               
+               
org.apache.sling.ide.eclipse.ui.internal.Activator.getDefault().getPluginLogger().warn("No
 file found for editor for node="+this);
+               return null;
        }
 
        public void rename(String string) {

Modified: 
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=1596319&r1=1596318&r2=1596319&view=diff
==============================================================================
--- 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java
 (original)
+++ 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrPropertiesView.java
 Tue May 20 17:09:46 2014
@@ -417,6 +417,7 @@ public class JcrPropertiesView extends V
             titleLabel.setText(jcrNode.getJcrPath());
             insertAction.setEnabled(true);
             deleteAction.setEnabled(false);
+            showInEditorAction.setEnabled(jcrNode.getFileForEditor()!=null);
         }
     }
 


Reply via email to