17 |
17 |
import javax.annotation.PreDestroy;
|
18 |
18 |
import javax.inject.Inject;
|
19 |
19 |
|
|
20 |
import org.eclipse.core.runtime.IProgressMonitor;
|
20 |
21 |
import org.eclipse.e4.ui.di.Focus;
|
21 |
22 |
import org.eclipse.e4.ui.model.application.MApplication;
|
22 |
23 |
import org.eclipse.e4.ui.services.EMenuService;
|
... | ... | |
31 |
32 |
import org.eclipse.jface.viewers.IStructuredSelection;
|
32 |
33 |
import org.eclipse.jface.viewers.ListViewer;
|
33 |
34 |
import org.eclipse.swt.widgets.Composite;
|
|
35 |
import org.eclipse.ui.IMemento;
|
34 |
36 |
|
35 |
37 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
36 |
38 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
|
... | ... | |
41 |
43 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
|
42 |
44 |
import eu.etaxonomy.taxeditor.editor.EditorUtil;
|
43 |
45 |
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
|
46 |
import eu.etaxonomy.taxeditor.model.IContextListener;
|
44 |
47 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
|
45 |
48 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
|
46 |
49 |
import eu.etaxonomy.taxeditor.store.CdmStore;
|
... | ... | |
51 |
54 |
* @date 12.12.2017
|
52 |
55 |
*
|
53 |
56 |
*/
|
54 |
|
public class WorkingSetNavigator implements IConversationEnabled, ICdmEntitySessionEnabled{
|
|
57 |
public class WorkingSetNavigator implements IConversationEnabled, ICdmEntitySessionEnabled, IContextListener{
|
55 |
58 |
|
56 |
59 |
private ListViewer viewer;
|
57 |
60 |
|
... | ... | |
66 |
69 |
|
67 |
70 |
private List<UuidAndTitleCache<WorkingSet>> workingSets;
|
68 |
71 |
|
|
72 |
public WorkingSetNavigator() {
|
|
73 |
CdmStore.getContextManager().addContextListener(this);
|
|
74 |
}
|
|
75 |
|
69 |
76 |
@PostConstruct
|
70 |
77 |
public void create(Composite parent, EPartService partService, EModelService modelService, MApplication application,
|
71 |
78 |
EMenuService menuService){
|
72 |
|
if (CdmStore.isActive()){
|
73 |
|
if(conversation == null){
|
74 |
|
conversation = CdmStore.createConversation();
|
75 |
|
}
|
76 |
|
if(cdmEntitySession == null){
|
77 |
|
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
|
78 |
|
}
|
79 |
|
}
|
80 |
|
else{
|
81 |
|
return;
|
82 |
|
}
|
83 |
79 |
viewer = new ListViewer(parent);
|
84 |
80 |
viewer.setContentProvider(new ArrayContentProvider());
|
85 |
81 |
viewer.setLabelProvider(new UuidAndTitleCacheLabelProvider());
|
86 |
|
workingSets = CdmStore.getService(IWorkingSetService.class).getUuidAndTitleCache(null, null);
|
87 |
|
viewer.setInput(workingSets);
|
88 |
82 |
|
89 |
83 |
viewer.addDoubleClickListener(new IDoubleClickListener() {
|
90 |
84 |
|
... | ... | |
104 |
98 |
|
105 |
99 |
//create context menu
|
106 |
100 |
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.workingSetNavigator");
|
|
101 |
|
|
102 |
init();
|
|
103 |
}
|
|
104 |
|
|
105 |
public void init(){
|
|
106 |
if (CdmStore.isActive()){
|
|
107 |
if(conversation == null) {
|
|
108 |
conversation = CdmStore.createConversation();
|
|
109 |
}
|
|
110 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
|
|
111 |
workingSets = CdmStore.getService(IWorkingSetService.class).getUuidAndTitleCache(null, null);
|
|
112 |
viewer.setInput(workingSets);
|
|
113 |
}
|
107 |
114 |
}
|
108 |
115 |
|
109 |
116 |
public void addWorkingSet(WorkingSet workingSet){
|
... | ... | |
184 |
191 |
}
|
185 |
192 |
}
|
186 |
193 |
|
|
194 |
/**
|
|
195 |
* {@inheritDoc}
|
|
196 |
*/
|
|
197 |
@Override
|
|
198 |
public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
|
|
199 |
// TODO Auto-generated method stub
|
|
200 |
|
|
201 |
}
|
|
202 |
|
|
203 |
/**
|
|
204 |
* {@inheritDoc}
|
|
205 |
*/
|
|
206 |
@Override
|
|
207 |
public void contextStop(IMemento memento, IProgressMonitor monitor) {
|
|
208 |
}
|
|
209 |
|
|
210 |
/**
|
|
211 |
* {@inheritDoc}
|
|
212 |
*/
|
|
213 |
@Override
|
|
214 |
public void contextStart(IMemento memento, IProgressMonitor monitor) {
|
|
215 |
if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
|
|
216 |
init();
|
|
217 |
}
|
|
218 |
}
|
|
219 |
|
|
220 |
/**
|
|
221 |
* {@inheritDoc}
|
|
222 |
*/
|
|
223 |
@Override
|
|
224 |
public void contextRefresh(IProgressMonitor monitor) {
|
|
225 |
}
|
|
226 |
|
|
227 |
/**
|
|
228 |
* {@inheritDoc}
|
|
229 |
*/
|
|
230 |
@Override
|
|
231 |
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
|
|
232 |
}
|
|
233 |
|
187 |
234 |
}
|
ref #7086, #7095 Add WS perspective