Revision f8f2ac3c
ref #6806 Fix session initialization
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java | ||
---|---|---|
76 | 76 |
@Inject |
77 | 77 |
private MDirtyable dirty; |
78 | 78 |
|
79 |
// private FeatureTreeEditorComposite composite; |
|
80 |
|
|
81 | 79 |
@Inject |
82 | 80 |
private MPart thisPart; |
83 | 81 |
|
... | ... | |
112 | 110 |
List<FeatureTree> trees = CdmStore.getService(IFeatureTreeService.class).list(FeatureTree.class, null, null, null, null); |
113 | 111 |
viewer.setInput(trees); |
114 | 112 |
|
115 |
// composite = new FeatureTreeEditorComposite(parent, SWT.NULL); |
|
116 |
// composite.init(new FeatureNodeDragListener(composite.getViewer()), |
|
117 |
// new FeatureNodeDropAdapter(dirty, composite.getViewer()), this, new SelectionAdapter() { |
|
118 |
// @Override |
|
119 |
// public void widgetSelected(SelectionEvent e) { |
|
120 |
// if(isDirty()){ |
|
121 |
// MessageDialog dialog; |
|
122 |
// String[] buttonLables = {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}; |
|
123 |
// dialog = new MessageDialog(null, "Unsaved changes", null, "You have unsaved changes. Do you want to save?", |
|
124 |
// MessageDialog.QUESTION_WITH_CANCEL, 0, buttonLables); |
|
125 |
// int returnCode = dialog.open(); |
|
126 |
// |
|
127 |
// if (returnCode == 0){ |
|
128 |
// //YES |
|
129 |
// save(new NullProgressMonitor()); |
|
130 |
// } else if (returnCode == 1){ |
|
131 |
// //NO |
|
132 |
// if(CdmStore.isActive()){ |
|
133 |
// clearSession(); |
|
134 |
// initSession(); |
|
135 |
// composite.setSelectedTree(null); |
|
136 |
// } |
|
137 |
// } else if (returnCode == 2){ |
|
138 |
// //CANCEL |
|
139 |
// return; |
|
140 |
// } |
|
141 |
// } |
|
142 |
// FeatureTree tree = FeatureTreeSelectionDialog.select(composite.getDisplay().getActiveShell(), //conversation, |
|
143 |
// null); |
|
144 |
// if (tree != null) { |
|
145 |
// composite.setSelectedTree(tree); |
|
146 |
// } |
|
147 |
// } |
|
148 |
// }, this); |
|
149 |
|
|
150 | 113 |
//create context menu |
151 | 114 |
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.store.popupmenu.featureTreeEditor"); |
152 | 115 |
} |
... | ... | |
155 | 118 |
if(conversation == null){ |
156 | 119 |
conversation = CdmStore.createConversation(); |
157 | 120 |
} |
158 |
if(cdmEntitySession!=null){
|
|
121 |
if(cdmEntitySession==null){
|
|
159 | 122 |
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true); |
160 | 123 |
} |
161 | 124 |
} |
... | ... | |
265 | 228 |
return propertyPathMap; |
266 | 229 |
} |
267 | 230 |
|
268 |
/** |
|
269 |
* {@inheritDoc} |
|
270 |
*/ |
|
271 | 231 |
@Override |
272 | 232 |
public List<FeatureTree> getRootEntities() { |
273 | 233 |
return (List<FeatureTree>) viewer.getInput(); |
274 | 234 |
} |
275 | 235 |
|
276 |
/** |
|
277 |
* {@inheritDoc} |
|
278 |
*/ |
|
279 | 236 |
@Override |
280 | 237 |
public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) { |
281 | 238 |
} |
282 | 239 |
|
283 |
/** |
|
284 |
* {@inheritDoc} |
|
285 |
*/ |
|
286 | 240 |
@Override |
287 | 241 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
288 | 242 |
//close view when workbench closes |
... | ... | |
294 | 248 |
} |
295 | 249 |
} |
296 | 250 |
|
297 |
/** |
|
298 |
* {@inheritDoc} |
|
299 |
*/ |
|
300 | 251 |
@Override |
301 | 252 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
302 | 253 |
} |
303 | 254 |
|
304 |
/** |
|
305 |
* {@inheritDoc} |
|
306 |
*/ |
|
307 | 255 |
@Override |
308 | 256 |
public void contextRefresh(IProgressMonitor monitor) { |
309 | 257 |
} |
310 | 258 |
|
311 |
/** |
|
312 |
* {@inheritDoc} |
|
313 |
*/ |
|
314 | 259 |
@Override |
315 | 260 |
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) { |
316 | 261 |
} |
317 | 262 |
|
318 |
/** |
|
319 |
* {@inheritDoc} |
|
320 |
*/ |
|
321 | 263 |
@Override |
322 | 264 |
public void update(CdmDataChangeMap arg0) { |
323 | 265 |
} |
324 | 266 |
|
325 |
/** |
|
326 |
* {@inheritDoc} |
|
327 |
*/ |
|
328 | 267 |
@Override |
329 | 268 |
public void changed(Object element) { |
330 | 269 |
dirty.setDirty(true); |
331 | 270 |
viewer.refresh(); |
332 | 271 |
} |
333 | 272 |
|
334 |
/** |
|
335 |
* {@inheritDoc} |
|
336 |
*/ |
|
337 | 273 |
@Override |
338 | 274 |
public void forceDirty() { |
339 | 275 |
dirty.setDirty(true); |
Also available in: Unified diff