1 package org
.argeo
.jcr
.ui
.explorer
.commands
;
5 import org
.argeo
.eclipse
.ui
.ErrorFeedback
;
6 import org
.argeo
.eclipse
.ui
.jcr
.views
.AbstractJcrBrowser
;
7 import org
.argeo
.jcr
.ui
.explorer
.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 /** Import a local file system directory tree. */
17 public class ImportFileSystem
extends AbstractHandler
{
18 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
19 ISelection selection
= HandlerUtil
.getActiveWorkbenchWindow(event
)
20 .getActivePage().getSelection();
21 AbstractJcrBrowser view
= (AbstractJcrBrowser
) 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 ImportFileSystemWizard wizard
= new ImportFileSystemWizard(
32 WizardDialog dialog
= new WizardDialog(
33 HandlerUtil
.getActiveShell(event
), wizard
);
37 ErrorFeedback
.show("Can only import to a node");
39 } catch (Exception e
) {
40 ErrorFeedback
.show("Cannot import files to " + obj
, e
);