1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2013 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.dataimport;
|
11
|
|
12
|
import org.eclipse.core.runtime.CoreException;
|
13
|
import org.eclipse.core.runtime.IProgressMonitor;
|
14
|
import org.eclipse.jface.text.source.AnnotationModel;
|
15
|
import org.eclipse.ui.IEditorInput;
|
16
|
import org.eclipse.ui.IMemento;
|
17
|
|
18
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
19
|
import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor;
|
20
|
import eu.etaxonomy.taxeditor.model.IContextListener;
|
21
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
22
|
|
23
|
/**
|
24
|
* @author pplitzner
|
25
|
* @date 20.09.2013
|
26
|
*
|
27
|
*/
|
28
|
public class DataImportEditor extends AnnotatedLineEditor implements IContextListener {
|
29
|
|
30
|
/** Constant <code>ID="bulkeditor.input.nameRelationship"</code> */
|
31
|
public static final String ID = "eu.etaxonomy.taxeditor.dataimport.DataImportEditor";
|
32
|
|
33
|
/**
|
34
|
* Constructs a new DataImportEditor with a new {@link ConversationHolder}
|
35
|
*/
|
36
|
public DataImportEditor() {
|
37
|
super(null);
|
38
|
CdmStore.getContextManager().addContextListener(this);
|
39
|
}
|
40
|
|
41
|
/* (non-Javadoc)
|
42
|
* @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
|
43
|
*/
|
44
|
/** {@inheritDoc} */
|
45
|
@Override
|
46
|
protected void initializeEditor() {
|
47
|
super.initializeEditor();
|
48
|
setLineDisplayStrategy(new DataImportEditorLineDisplayStrategy());
|
49
|
}
|
50
|
|
51
|
/* (non-Javadoc)
|
52
|
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor#dispose()
|
53
|
*/
|
54
|
@Override
|
55
|
public void dispose() {
|
56
|
// super.dispose();
|
57
|
CdmStore.getContextManager().removeContextListener(this);
|
58
|
}
|
59
|
|
60
|
/* (non-Javadoc)
|
61
|
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor#doSetInput(org.eclipse.ui.IEditorInput)
|
62
|
*/
|
63
|
@Override
|
64
|
protected void doSetInput(IEditorInput input) throws CoreException {
|
65
|
super.doSetInput(input);
|
66
|
setPartName(input.getName());
|
67
|
setTitleToolTip(input.getName());
|
68
|
}
|
69
|
|
70
|
/* (non-Javadoc)
|
71
|
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextAboutToStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
|
72
|
*/
|
73
|
@Override
|
74
|
public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
|
75
|
// TODO Auto-generated method stub
|
76
|
System.out.println();
|
77
|
}
|
78
|
|
79
|
/* (non-Javadoc)
|
80
|
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
|
81
|
*/
|
82
|
@Override
|
83
|
public void contextStop(IMemento memento, IProgressMonitor monitor) {
|
84
|
// TODO Auto-generated method stub
|
85
|
System.out.println();
|
86
|
|
87
|
}
|
88
|
|
89
|
/* (non-Javadoc)
|
90
|
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextStart(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
|
91
|
*/
|
92
|
@Override
|
93
|
public void contextStart(IMemento memento, IProgressMonitor monitor) {
|
94
|
// TODO Auto-generated method stub
|
95
|
System.out.println();
|
96
|
}
|
97
|
|
98
|
/* (non-Javadoc)
|
99
|
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextRefresh(org.eclipse.core.runtime.IProgressMonitor)
|
100
|
*/
|
101
|
@Override
|
102
|
public void contextRefresh(IProgressMonitor monitor) {
|
103
|
if(getDocumentProvider().getAnnotationModel(getEditorInput()) != null){
|
104
|
((AnnotationModel) getDocumentProvider().getAnnotationModel(getEditorInput())).removeAllAnnotations();
|
105
|
}
|
106
|
setInput(getEditorInput());
|
107
|
}
|
108
|
|
109
|
/* (non-Javadoc)
|
110
|
* @see eu.etaxonomy.taxeditor.model.IContextListener#workbenchShutdown(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
|
111
|
*/
|
112
|
@Override
|
113
|
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
|
114
|
// TODO Auto-generated method stub
|
115
|
System.out.println();
|
116
|
}
|
117
|
|
118
|
}
|