[dna-commits] DNA SVN: r1281 - in trunk/tools/org.jboss.dna.eclipse.jcr.rest.client: src/org/jboss/dna/eclipse/jcr/rest/client and 1 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Fri Oct 2 13:03:04 EDT 2009


Author: elvisisking
Date: 2009-10-02 13:03:04 -0400 (Fri, 02 Oct 2009)
New Revision: 1281

Modified:
   trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-jar-with-dependencies.jar
   trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-sources.jar
   trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/DnaResourceHelper.java
   trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/ServerView.java
Log:
DNA 531 Servers View Should Provide Global Action Handlers: Setup no-op actions for cut, copy, and paste, and hooked up the delete server action to work with the delete key and the global delete action. Also added updated client jars from Maven project.

Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-jar-with-dependencies.jar
===================================================================
(Binary files differ)

Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/dna-web-jcr-rest-client-0.7-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)

Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/DnaResourceHelper.java
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/DnaResourceHelper.java	2009-10-02 16:13:40 UTC (rev 1280)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/DnaResourceHelper.java	2009-10-02 17:03:04 UTC (rev 1281)
@@ -63,7 +63,7 @@
      * file has been published to at least one DNA repository. The value of the property is a list of DNA repository workspaces
      * where this file has been published.
      */
-    private static QualifiedName PUBLISHED_RESOURCE_PROPERTY = new QualifiedName(IUiConstants.PLUGIN_ID, "publishedIn"); //$NON-NLS-1$
+    private static QualifiedName PUBLISHED_RESOURCE_PROPERTY = new QualifiedName(IUiConstants.PLUGIN_ID, "publishedLocations"); //$NON-NLS-1$
 
     // ===========================================================================================================================
     // Fields

Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/ServerView.java
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/ServerView.java	2009-10-02 16:13:40 UTC (rev 1280)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/ServerView.java	2009-10-02 17:03:04 UTC (rev 1281)
@@ -39,9 +39,13 @@
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionFactory;
 import org.eclipse.ui.actions.BaseSelectionListenerAction;
 import org.eclipse.ui.help.IWorkbenchHelpSystem;
 import org.eclipse.ui.part.ViewPart;
@@ -208,6 +212,7 @@
         constructActions();
         constructToolBar();
         constructContextMenu();
+        hookGlobalActions();
 
         setTitleToolTip(RestClientI18n.serverViewToolTip.text());
 
@@ -230,6 +235,10 @@
         super.dispose();
     }
 
+    IAction getDeleteAction() {
+        return this.deleteAction;
+    }
+
     /**
      * @return the server manager being used by this view
      */
@@ -259,6 +268,36 @@
     }
 
     /**
+     * Sets global action handlers.
+     */
+    private void hookGlobalActions() {
+        IActionBars bars = getViewSite().getActionBars();
+
+        // hook delete server action up
+        bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), this.deleteAction);
+        this.viewer.getControl().addKeyListener(new KeyAdapter() {
+            @Override
+            public void keyPressed( KeyEvent event ) {
+                if ((event.character == SWT.DEL) && (event.stateMask == 0) && getDeleteAction().isEnabled()) {
+                    getDeleteAction().run();
+                }
+            }
+        });
+        
+        // don't want cut, copy, or paste actions so hook them up with a disabled action
+        class NoOpAction extends Action {
+            NoOpAction() {
+                setEnabled(false);
+            }
+        }
+        
+        IAction noop = new NoOpAction();
+        bars.setGlobalActionHandler(ActionFactory.CUT.getId(), noop);
+        bars.setGlobalActionHandler(ActionFactory.COPY.getId(), noop);
+        bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), noop);
+    }
+
+    /**
      * {@inheritDoc}
      * 
      * @see org.jboss.dna.web.jcr.rest.client.IServerRegistryListener#serverRegistryChanged(org.jboss.dna.web.jcr.rest.client.ServerRegistryEvent)



More information about the dna-commits mailing list