Project

General

Profile

Download (921 Bytes) Statistics
| Branch: | Tag: | Revision:
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

    
14
/**
15
 * 
16
 * 
17
 * @author n.hoffmann
18
 *
19
 */
20
public class EditorManager {
21
	
22
	Map<Class<? extends IEditorInput>, ICdmEditorHandle> editors = new HashMap<Class<? extends IEditorInput>, ICdmEditorHandle>();
23
	
24
	public void openEditor(Class<? extends IEditorInput> inputType, UUID uuid){
25
		ICdmEditorHandle editor = editors.get(inputType);
26
		
27
		if(editor == null){
28
			StoreUtil.warningDialog("No editor", getClass(), "No editor was registered for the given type.");
29
		}else{
30
			editor.open(uuid);
31
		}
32
	}
33
	
34
	public ICdmEditorHandle add(ICdmEditorHandle editor){
35
		return editors.put(editor.getInputType(), editor);
36
	}
37
	
38
	public ICdmEditorHandle remove(ICdmEditorHandle editor){
39
		return editors.remove(editor);
40
	}
41
}
(4-4/9)