Author: stefanegli
Date: Wed Jun  4 11:23:22 2014
New Revision: 1600107

URL: http://svn.apache.org/r1600107
Log:
SLING-3641 : moved 'link-with-editor' behavior from 
'automagic-bringToTop-depending-on-project-explorer-link-toggle' to a new, 
explicit 'link-with-editor' toggle in the jcr properties view (which is checked 
by default)

Modified:
    
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.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/LinkHelper.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java?rev=1600107&r1=1600106&r2=1600107&view=diff
==============================================================================
--- 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java
 (original)
+++ 
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/LinkHelper.java
 Wed Jun  4 11:23:22 2014
@@ -98,10 +98,12 @@ public class LinkHelper implements ILink
                }
                final JcrNode node = (JcrNode) selectedElement;
                // bring properties view to top, if it is open
-               IViewPart propertiesView = 
aPage.findView(IPageLayout.ID_PROP_SHEET);
-               if (propertiesView!=null) {
-                       aPage.bringToTop(propertiesView);
-               }
+               // SLING-3641 : moved link-with-editor behavior to the JCR 
Properties view atm
+               //TODO: to be reviewed at a later stage with SLING-3641
+//             IViewPart propertiesView = 
aPage.findView(IPageLayout.ID_PROP_SHEET);
+//             if (propertiesView!=null) {
+//                     aPage.bringToTop(propertiesView);
+//             }
                final IResource resource = node.getResource();
                if (resource==null || !(resource instanceof IFile)) {
                        return;

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=1600107&r1=1600106&r2=1600107&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
 Wed Jun  4 11:23:22 2014
@@ -83,6 +83,8 @@ public class JcrPropertiesView extends V
 
     private JcrNode lastInput;
 
+    private Action synchedAction;
+
        class ViewContentProvider implements IStructuredContentProvider {
                public void inputChanged(Viewer v, Object oldInput, Object 
newInput) {
                }
@@ -283,6 +285,7 @@ public class JcrPropertiesView extends V
                manager.add(deleteAction);
         manager.add(showInEditorAction);
         manager.add(pinAction);
+        manager.add(synchedAction);
        }
 
        private void fillContextMenu(IMenuManager manager) {
@@ -290,6 +293,7 @@ public class JcrPropertiesView extends V
         manager.add(deleteAction);
         manager.add(showInEditorAction);
         manager.add(pinAction);
+        manager.add(synchedAction);
                // Other plug-ins can contribute there actions here
                manager.add(new 
Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        }
@@ -299,6 +303,7 @@ public class JcrPropertiesView extends V
                manager.add(deleteAction);
         manager.add(showInEditorAction);
         manager.add(pinAction);
+        manager.add(synchedAction);
        }
 
        private void makeActions() {
@@ -375,6 +380,8 @@ public class JcrPropertiesView extends V
                        } else {
                            setContentDescription("[pinned]");
                        }
+                       // toggle state of syncedAction accordingly
+                       synchedAction.setEnabled(!pinAction.isChecked());
                    }
                };
                pinAction.setText("Pin to selection");
@@ -383,6 +390,21 @@ public class JcrPropertiesView extends V
                 
.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR));
                pinAction.setDisabledImageDescriptor(WorkbenchImages
                 
.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR_DISABLED));
+               pinAction.setChecked(false);
+               
+               synchedAction = new Action("Link with Editor and selection", 
IAction.AS_CHECK_BOX) {
+            public void run() {
+                // toggle state of pinAction accordingly
+                pinAction.setEnabled(!synchedAction.isChecked());
+            }
+        };
+        synchedAction.setText("Link with Editor and selection");
+        synchedAction.setToolTipText("Link with Editor and selection");
+        synchedAction.setImageDescriptor(WorkbenchImages
+                .getImageDescriptor(ISharedImages.IMG_ELCL_SYNCED));
+        synchedAction.setDisabledImageDescriptor(WorkbenchImages
+                .getImageDescriptor(ISharedImages.IMG_ELCL_SYNCED_DISABLED));
+        synchedAction.setChecked(true);
        }
 
        private void hookDoubleClickAction() {
@@ -416,6 +438,9 @@ public class JcrPropertiesView extends V
         if (pinAction.isChecked()) {
             lastInput = jcrNode;
         } else {
+            if (synchedAction.isChecked()) {
+                getViewSite().getPage().bringToTop(this);
+            }
             viewer.setInput(jcrNode);
             titleLabel.setText(jcrNode.getJcrPath());
             
insertAction.setEnabled(!jcrNode.getPrimaryType().equals("nt:folder"));


Reply via email to