Mercurial > hg > de.mpg.mpiwg.itgroup.digilib.plugin
comparison src/de/mpg/mpiwg/itgroup/digilib/plugin/DigilibHandler.java @ 9:e63a64652f4d
added comments
author | dwinter |
---|---|
date | Mon, 03 Jan 2011 16:53:48 +0100 |
parents | 83c58ea33792 |
children | 0205c3f41d1d |
comparison
equal
deleted
inserted
replaced
8:52023cf79d86 | 9:e63a64652f4d |
---|---|
11 import org.eclipse.ui.handlers.HandlerUtil; | 11 import org.eclipse.ui.handlers.HandlerUtil; |
12 | 12 |
13 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorInput; | 13 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorInput; |
14 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorPart; | 14 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorPart; |
15 | 15 |
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 */ | |
16 public class DigilibHandler implements IHandler { | 23 public class DigilibHandler implements IHandler { |
17 | 24 |
18 public void addHandlerListener(IHandlerListener handlerListener) { | 25 public void addHandlerListener(IHandlerListener handlerListener) { |
19 // TODO Auto-generated method stub | 26 // TODO Auto-generated method stub |
20 | 27 |
28 public Object execute(ExecutionEvent event) throws ExecutionException { | 35 public Object execute(ExecutionEvent event) throws ExecutionException { |
29 | 36 |
30 ISelection currentSelection = HandlerUtil.getCurrentSelection(event); | 37 ISelection currentSelection = HandlerUtil.getCurrentSelection(event); |
31 if (IStructuredSelection.class.isInstance(currentSelection)) { | 38 if (IStructuredSelection.class.isInstance(currentSelection)) { |
32 IStructuredSelection selection = (IStructuredSelection) currentSelection; | 39 IStructuredSelection selection = (IStructuredSelection) currentSelection; |
33 //TextGridObject object = AdapterUtils.getAdapter(selection.getFirstElement(), TextGridObject.class); | 40 |
34 Object object = selection.getFirstElement(); | 41 Object object = selection.getFirstElement(); |
35 | 42 |
36 //IFile file = (IFile) object.getAdapter(IFile.class); | |
37 IFile file = (IFile) object; | 43 IFile file = (IFile) object; |
38 DigilibLinkEditorInput input = new DigilibLinkEditorInput(file,DigilibLinkEditorInput.INDEX_META); | 44 DigilibLinkEditorInput input = new DigilibLinkEditorInput(file,DigilibLinkEditorInput.INDEX_META); |
39 | 45 |
40 try { | 46 try { |
41 DigilibLinkEditorPart dp = (DigilibLinkEditorPart) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().openEditor(input,"de.mpg.mpiwg.itgroup.digilib.plugin.digilibLinkEditor"); | 47 DigilibLinkEditorPart dp = (DigilibLinkEditorPart) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().openEditor(input,"de.mpg.mpiwg.itgroup.digilib.plugin.digilibLinkEditor"); |