1 package org
.argeo
.eclipse
.ui
.jcr
.commands
;
5 import org
.argeo
.eclipse
.ui
.dialogs
.Error
;
6 import org
.argeo
.eclipse
.ui
.jcr
.views
.GenericJcrBrowser
;
7 import org
.argeo
.eclipse
.ui
.jcr
.wizards
.ImportFileSystemWizard
;
8 import org
.eclipse
.core
.commands
.AbstractHandler
;
9 import org
.eclipse
.core
.commands
.ExecutionEvent
;
10 import org
.eclipse
.core
.commands
.ExecutionException
;
11 import org
.eclipse
.jface
.viewers
.ISelection
;
12 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
13 import org
.eclipse
.jface
.wizard
.WizardDialog
;
14 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
16 public class ImportFileSystem
extends AbstractHandler
{
18 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
19 ISelection selection
= HandlerUtil
.getActiveWorkbenchWindow(event
)
20 .getActivePage().getSelection();
21 GenericJcrBrowser view
= (GenericJcrBrowser
) HandlerUtil
22 .getActiveWorkbenchWindow(event
).getActivePage()
23 .findView(HandlerUtil
.getActivePartId(event
));
24 if (selection
!= null && !selection
.isEmpty()
25 && selection
instanceof IStructuredSelection
) {
26 Object obj
= ((IStructuredSelection
) selection
).getFirstElement();
28 if (obj
instanceof Node
) {
29 Node folder
= (Node
) obj
;
30 // if (!folder.getPrimaryNodeType().getName()
31 // .equals(NodeType.NT_FOLDER)) {
32 // Error.show("Can only import to a folder node");
35 ImportFileSystemWizard wizard
= new ImportFileSystemWizard(
37 WizardDialog dialog
= new WizardDialog(
38 HandlerUtil
.getActiveShell(event
), wizard
);
42 Error
.show("Can only import to a node");
44 } catch (Exception e
) {
45 Error
.show("Cannot import files to " + obj
, e
);