1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.taxeditor.store;
|
5
|
|
6
|
import java.util.HashMap;
|
7
|
import java.util.Map;
|
8
|
import java.util.UUID;
|
9
|
|
10
|
import org.eclipse.ui.IEditorInput;
|
11
|
|
12
|
import eu.etaxonomy.taxeditor.model.ICdmEditorHandle;
|
13
|
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
14
|
|
15
|
/**
|
16
|
*
|
17
|
*
|
18
|
* @author n.hoffmann
|
19
|
*
|
20
|
*/
|
21
|
public class EditorManager {
|
22
|
|
23
|
Map<Class<? extends IEditorInput>, ICdmEditorHandle> editors = new HashMap<Class<? extends IEditorInput>, ICdmEditorHandle>();
|
24
|
|
25
|
public void openEditor(Class<? extends IEditorInput> inputType, UUID uuid){
|
26
|
ICdmEditorHandle editor = editors.get(inputType);
|
27
|
|
28
|
if(editor == null){
|
29
|
MessagingUtils.warningDialog("No editor", getClass(), "No editor was registered for the given type.");
|
30
|
}else{
|
31
|
editor.open(uuid);
|
32
|
}
|
33
|
}
|
34
|
|
35
|
public ICdmEditorHandle add(ICdmEditorHandle editor){
|
36
|
return editors.put(editor.getInputType(), editor);
|
37
|
}
|
38
|
|
39
|
public ICdmEditorHandle remove(ICdmEditorHandle editor){
|
40
|
return editors.remove(editor);
|
41
|
}
|
42
|
}
|