Mercurial > hg > de.mpg.mpiwg.itgroup.digilib.plugin
annotate src/de/mpg/mpiwg/itgroup/digilib/plugin/DigilibHandler.java @ 28:0205c3f41d1d default tip
repackaging (separate textgridlab and dgilib local parts more rigorously
author | dwinter |
---|---|
date | Fri, 24 Aug 2012 09:42:57 +0200 |
parents | e63a64652f4d |
children |
rev | line source |
---|---|
1 | 1 package de.mpg.mpiwg.itgroup.digilib.plugin; |
2 | |
3 import org.eclipse.core.commands.ExecutionEvent; | |
4 import org.eclipse.core.commands.ExecutionException; | |
5 import org.eclipse.core.commands.IHandler; | |
6 import org.eclipse.core.commands.IHandlerListener; | |
7 import org.eclipse.core.resources.IFile; | |
8 import org.eclipse.jface.viewers.ISelection; | |
9 import org.eclipse.jface.viewers.IStructuredSelection; | |
10 import org.eclipse.ui.PartInitException; | |
11 import org.eclipse.ui.handlers.HandlerUtil; | |
12 | |
13 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorInput; | |
28
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
9
diff
changeset
|
14 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.IDigilibLinkEditorPart; |
1 | 15 |
9 | 16 /** |
17 * @author dwinter | |
18 * | |
19 * Open an DigilibLinkEditorPart on the selected files. Currently, the selected files have to be index meta files. | |
20 * Where archive-path and texttols/image points to the image folder. | |
21 * TODO chck the format and allow other formats. | |
22 */ | |
1 | 23 public class DigilibHandler implements IHandler { |
24 | |
25 public void addHandlerListener(IHandlerListener handlerListener) { | |
26 // TODO Auto-generated method stub | |
27 | |
28 } | |
29 | |
30 public void dispose() { | |
31 // TODO Auto-generated method stub | |
32 | |
33 } | |
34 | |
35 public Object execute(ExecutionEvent event) throws ExecutionException { | |
36 | |
37 ISelection currentSelection = HandlerUtil.getCurrentSelection(event); | |
38 if (IStructuredSelection.class.isInstance(currentSelection)) { | |
39 IStructuredSelection selection = (IStructuredSelection) currentSelection; | |
9 | 40 |
1 | 41 Object object = selection.getFirstElement(); |
42 | |
43 IFile file = (IFile) object; | |
44 DigilibLinkEditorInput input = new DigilibLinkEditorInput(file,DigilibLinkEditorInput.INDEX_META); | |
45 | |
46 try { | |
28
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
9
diff
changeset
|
47 IDigilibLinkEditorPart dp = (IDigilibLinkEditorPart) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().openEditor(input,"de.mpg.mpiwg.itgroup.digilib.plugin.digilibLinkEditor"); |
1 | 48 return dp; |
49 } catch (PartInitException e) { | |
50 // TODO Auto-generated catch block | |
51 e.printStackTrace(); | |
52 } | |
53 } | |
54 return null; | |
55 } | |
56 | |
57 public boolean isEnabled() { | |
58 | |
59 return true; | |
60 } | |
61 | |
62 public boolean isHandled() { | |
63 // TODO Auto-generated method stub | |
64 return true; | |
65 } | |
66 | |
67 public void removeHandlerListener(IHandlerListener handlerListener) { | |
68 // TODO Auto-generated method stub | |
69 | |
70 } | |
71 | |
72 } |