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 2013/10/10 14:15:22 UTC
svn commit: r1530933 - in /sling/trunk/tooling/ide/eclipse-ui: plugin.xml
src/org/apache/sling/ide/eclipse/ui/internal/ImportContentAction.java
Author: rombert
Date: Thu Oct 10 12:15:22 2013
New Revision: 1530933
URL: http://svn.apache.org/r1530933
Log:
SLING-3110 - Add key binding for importing content from the repository
Add keybinding Ctrl+Shift+I key for starting a content import.
Modified:
sling/trunk/tooling/ide/eclipse-ui/plugin.xml
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportContentAction.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=1530933&r1=1530932&r2=1530933&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Thu Oct 10 12:15:22 2013
@@ -83,6 +83,7 @@
<action
class="org.apache.sling.ide.eclipse.ui.internal.ImportContentAction"
id="org.apache.sling.ide.menu.importContentAction"
+ definitionId="org.apache.sling.ide.commands.importContent"
label="Import Content..."
menubarPath="org.apache.sling.ide.menu/sling"
style="push">
@@ -122,7 +123,17 @@
</description>
</wizard>
</extension>
-
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.apache.sling.ide.commands.importContent"
+ name="Import Content from a Sling Repository"
+ categoryId="org.eclipse.ui.category.window"
+ defaultHandler="org.apache.sling.ide.eclipse.ui.internal.ImportContentAction">
+ </command>
+ </extension>
+
<!-- Property page for project to select directory to sync -->
<extension point="org.eclipse.ui.propertyPages">
<page
@@ -510,6 +521,15 @@
id="org.apache.sling.ide.eclipse.ui.editors.WebBrowser"
name="WebBrowser">
</editor>
- </extension>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.apache.sling.ide.commands.importContent"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M2+I">
+ </key>
+ </extension>
</plugin>
Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportContentAction.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportContentAction.java?rev=1530933&r1=1530932&r2=1530933&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportContentAction.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportContentAction.java Thu Oct 10 12:15:22 2013
@@ -18,6 +18,9 @@ package org.apache.sling.ide.eclipse.ui.
import java.util.Iterator;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -29,10 +32,11 @@ import org.eclipse.jface.wizard.WizardDi
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.ServerUtil;
-public class ImportContentAction implements IObjectActionDelegate, IExecutableExtension {
+public class ImportContentAction extends AbstractHandler implements IObjectActionDelegate, IExecutableExtension {
private ISelection selection;
@@ -43,11 +47,15 @@ public class ImportContentAction impleme
*/
@Override
public void run(IAction action) {
- if (!(selection instanceof IStructuredSelection)) {
+ run(selection);
+ }
+
+ private void run(ISelection currentSelection) {
+ if (!(currentSelection instanceof IStructuredSelection)) {
return;
}
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ IStructuredSelection structuredSelection = (IStructuredSelection) currentSelection;
for (Iterator<?> it = structuredSelection.iterator(); it.hasNext();) {
Object selected = it.next();
@@ -107,4 +115,11 @@ public class ImportContentAction impleme
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ run(HandlerUtil.getCurrentSelection(event));
+ return null;
+ }
+
}