Author: rombert
Date: Sat Feb 20 21:08:23 2016
New Revision: 1731464
URL: http://svn.apache.org/viewvc?rev=1731464&view=rev
Log:
SLING-4046 - Keyboard shortcuts do not work on content structure
Convert import and export actions to handlers.
Added:
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/AbstractJcrNodeImportExportContentHandler.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeExportContentHandler.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeImportContentHandler.java
Removed:
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeExportContentAction.java
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeImportContentAction.java
Modified:
sling/trunk/tooling/ide/eclipse-ui/plugin.xml
Modified: sling/trunk/tooling/ide/eclipse-ui/plugin.xml
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/plugin.xml?rev=1731464&r1=1731463&r2=1731464&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/plugin.xml (original)
+++ sling/trunk/tooling/ide/eclipse-ui/plugin.xml Sat Feb 20 21:08:23 2016
@@ -445,6 +445,24 @@
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<command
+
commandId="org.apache.sling.ide.eclipse.ui.actions.jcrNodeImportContentHandler"
+ icon="icons/obj16/sling_misc.gif"
+ label="Import from server...">
+ <visibleWhen
+ checkEnabled="false">
+ <reference
definitionId="org.apache.sling.ide.eclipse.jcrNode"/>
+ </visibleWhen>
+ </command>
+ <command
+
commandId="org.apache.sling.ide.eclipse.ui.actions.jcrNodeExportContentHandler"
+ icon="icons/obj16/sling_misc.gif"
+ label="Export to server...">
+ <visibleWhen
+ checkEnabled="false">
+ <reference
definitionId="org.apache.sling.ide.eclipse.jcrNode"/>
+ </visibleWhen>
+ </command>
+ <command
commandId="org.apache.sling.ide.eclipse.ui.actions.openHtmlInBrowserHandler"
icon="platform:/plugin/org.eclipse.ui.browser/icons/obj16/internal_browser.gif"
label="&Open .html (on server) in browser">
@@ -496,6 +514,16 @@
defaultHandler="org.apache.sling.ide.eclipse.ui.actions.OpenHtmlInBrowserHandler"
name="Open Node in Browser...">
</command>
+ <command
+
id="org.apache.sling.ide.eclipse.ui.actions.jcrNodeExportContentHandler"
+
defaultHandler="org.apache.sling.ide.eclipse.ui.actions.JcrNodeExportContentHandler"
+ name="Export JCR content to server...">
+ </command>
+ <command
+
id="org.apache.sling.ide.eclipse.ui.actions.jcrNodeImportContentHandler"
+
defaultHandler="org.apache.sling.ide.eclipse.ui.actions.JcrNodeImportContentHandler"
+ name="Import JCR content from server...">
+ </command>
</extension>
<extension
@@ -548,20 +576,6 @@
</separator>
</menu>
<action
-
class="org.apache.sling.ide.eclipse.ui.actions.JcrNodeExportContentAction"
- icon="icons/obj16/sling_misc.gif"
- id="org.apache.sling.ide.menu.exportContentAction"
- label="Export to server..."
- menubarPath="jcr">
- </action>
- <action
-
class="org.apache.sling.ide.eclipse.ui.actions.JcrNodeImportContentAction"
- id="org.apache.sling.ide.menu.importContentAction"
- icon="icons/obj16/sling_misc.gif"
- label="Import from server..."
- menubarPath="jcr">
- </action>
- <action
class="org.apache.sling.ide.eclipse.ui.actions.JcrNewNodeAction"
icon="icons/obj16/sling_misc.gif"
id="org.apache.sling.ide.eclipse.ui.nav.NewJcrNodeAction"
@@ -591,20 +605,6 @@
label="Node..."
menubarPath="common.new.menu/jcr">
</action>
- <action
-
class="org.apache.sling.ide.eclipse.ui.actions.JcrNodeExportContentAction"
- icon="icons/obj16/sling_misc.gif"
- id="org.apache.sling.ide.menu.exportContentAction"
- label="Export to server..."
- menubarPath="jcr">
- </action>
- <action
-
class="org.apache.sling.ide.eclipse.ui.actions.JcrNodeImportContentAction"
- id="org.apache.sling.ide.menu.importContentAction"
- icon="icons/obj16/sling_misc.gif"
- label="Import from server..."
- menubarPath="jcr">
- </action>
<visibility>
<objectState
name="nonDomNode"
Added:
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/AbstractJcrNodeImportExportContentHandler.java
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/AbstractJcrNodeImportExportContentHandler.java?rev=1731464&view=auto
==============================================================================
---
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/AbstractJcrNodeImportExportContentHandler.java
(added)
+++
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/AbstractJcrNodeImportExportContentHandler.java
Sat Feb 20 21:08:23 2016
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.eclipse.ui.actions;
+
+import org.apache.sling.ide.eclipse.core.internal.ProjectHelper;
+import org.apache.sling.ide.eclipse.ui.internal.SelectionUtils;
+import org.apache.sling.ide.eclipse.ui.nav.model.JcrNode;
+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.resources.IResource;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+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 abstract class AbstractJcrNodeImportExportContentHandler extends
AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ ISelection sel = HandlerUtil.getCurrentSelection(event);
+
+ JcrNode node = SelectionUtils.getFirst(sel, JcrNode.class);
+ if ( node == null ) {
+ return null;
+ }
+
+ IProject project = node.getProject();
+ if (!ProjectHelper.isContentProject(project)) {
+ return null;
+ }
+
+ IModule module = ServerUtil.getModule(project);
+ if (module == null) {
+ return null;
+ }
+
+ IResource resource = node.getResourceForImportExport();
+ if (resource==null) {
+ return null;
+ }
+
+ Wizard wiz = createWizard(resource);
+
+ WizardDialog dialog = new
WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wiz);
+ dialog.open();
+
+ return null;
+ }
+
+ protected abstract Wizard createWizard(IResource resource);
+}
\ No newline at end of file
Added:
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeExportContentHandler.java
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeExportContentHandler.java?rev=1731464&view=auto
==============================================================================
---
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeExportContentHandler.java
(added)
+++
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeExportContentHandler.java
Sat Feb 20 21:08:23 2016
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.eclipse.ui.actions;
+
+import org.apache.sling.ide.eclipse.ui.internal.ExportWizard;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.PlatformUI;
+
+/** Export content at a certain node level**/
+public class JcrNodeExportContentHandler extends
AbstractJcrNodeImportExportContentHandler {
+
+ @Override
+ protected Wizard createWizard(IResource resource) {
+
+ ExportWizard wiz = new ExportWizard();
+ wiz.init(PlatformUI.getWorkbench(), resource);
+ return wiz;
+ }
+}
\ No newline at end of file
Added:
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeImportContentHandler.java
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeImportContentHandler.java?rev=1731464&view=auto
==============================================================================
---
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeImportContentHandler.java
(added)
+++
sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/actions/JcrNodeImportContentHandler.java
Sat Feb 20 21:08:23 2016
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.eclipse.ui.actions;
+
+import org.apache.sling.ide.eclipse.ui.wizards.ImportWizard;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/** Import content at a certain node level**/
+public class JcrNodeImportContentHandler extends
AbstractJcrNodeImportExportContentHandler {
+
+ protected ImportWizard createWizard(IResource resource) {
+
+ ImportWizard wiz = new ImportWizard();
+ wiz.init(PlatformUI.getWorkbench(), new
StructuredSelection(resource));
+ return wiz;
+ }
+}
\ No newline at end of file