Revision eb15e6db
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java | ||
---|---|---|
33 | 33 |
import org.eclipse.e4.ui.di.UIEventTopic; |
34 | 34 |
import org.eclipse.e4.ui.di.UISynchronize; |
35 | 35 |
import org.eclipse.e4.ui.model.application.MApplication; |
36 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
37 |
import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; |
|
38 |
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; |
|
39 |
import org.eclipse.e4.ui.model.application.ui.menu.impl.HandledToolItemImpl; |
|
36 | 40 |
import org.eclipse.e4.ui.services.EMenuService; |
37 | 41 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
38 | 42 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
... | ... | |
178 | 182 |
viewer.addDragSupport(dndOperations, transfers, new TreeNodeDragListenerE4(viewer)); |
179 | 183 |
viewer.addDropSupport(dndOperations, transfers, new TreeNodeDropAdapterE4(this)); |
180 | 184 |
|
181 |
//add toolbar |
|
182 |
// MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar(); |
|
183 |
// MHandledToolItem linkWithEditor = MMenuFactory.INSTANCE.createHandledToolItem(); |
|
184 |
// linkWithEditor.setIconURI("platform:/plugin/eu.etaxonomy.taxeditor.store/icons/synced.gif"); |
|
185 |
// Command command = commandService.getCommand("eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon"); |
|
186 |
// MCommand mCommand = MCommandsFactory.INSTANCE.createCommand(); |
|
187 |
// mCommand.setElementId(command.getId()); |
|
188 |
// try { |
|
189 |
// mCommand.setCommandName(command.getName()); |
|
190 |
// } catch (NotDefinedException e) { |
|
191 |
// e.printStackTrace(); |
|
192 |
// } |
|
193 |
// linkWithEditor.setCommand(mCommand); |
|
194 |
// linkWithEditor.setType(ItemType.CHECK); |
|
195 |
// toolBar.getChildren().add(linkWithEditor); |
|
196 |
// thisPart.setToolbar(toolBar); |
|
185 |
updateSyncButton(); |
|
186 |
|
|
187 |
|
|
197 | 188 |
|
198 | 189 |
init(); |
199 | 190 |
} |
200 | 191 |
|
192 |
protected void updateSyncButton() { |
|
193 |
MPart viewPart = partService.findPart("eu.etaxonomy.taxeditor.navigation.navigator"); |
|
194 |
|
|
195 |
MToolBar toolBar = viewPart.getToolbar(); |
|
196 |
|
|
197 |
List<MToolBarElement> toolBarElements = toolBar.getChildren(); |
|
198 |
|
|
199 |
|
|
200 |
MToolBarElement upperHandledMenuItem = toolBarElements.get(1); |
|
201 |
if (upperHandledMenuItem instanceof HandledToolItemImpl){ |
|
202 |
((HandledToolItemImpl)upperHandledMenuItem).setSelected(linkWithTaxon); |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
201 | 206 |
/** {@inheritDoc} */ |
202 | 207 |
protected IAdaptable getInitialInput() { |
203 | 208 |
Comparator<TaxonNode> comparator; |
... | ... | |
274 | 279 |
if(!viewer.getTree().isDisposed()){ |
275 | 280 |
viewer.refresh(); |
276 | 281 |
} |
282 |
updateSyncButton(); |
|
277 | 283 |
} |
278 | 284 |
|
279 | 285 |
/** |
... | ... | |
283 | 289 |
for(Object obj : objects) { |
284 | 290 |
viewer.refresh(obj); |
285 | 291 |
} |
292 |
updateSyncButton(); |
|
286 | 293 |
} |
287 | 294 |
|
288 | 295 |
/** |
... | ... | |
450 | 457 |
public void update(Observable o, Object arg) { |
451 | 458 |
if(o instanceof LoginManager){ |
452 | 459 |
refresh(); |
460 |
updateSyncButton(); |
|
453 | 461 |
} |
462 |
|
|
454 | 463 |
} |
455 | 464 |
/** {@inheritDoc} */ |
456 | 465 |
@Override |
... | ... | |
460 | 469 |
} |
461 | 470 |
|
462 | 471 |
DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior); |
472 |
updateSyncButton(); |
|
473 |
|
|
463 | 474 |
} |
464 | 475 |
|
465 | 476 |
@Override |
... | ... | |
490 | 501 |
viewer.refresh(); |
491 | 502 |
} |
492 | 503 |
} |
504 |
updateSyncButton(); |
|
493 | 505 |
} |
494 | 506 |
|
495 | 507 |
@Override |
Also available in: Unified diff
fix #7111: synchronize sync butoon of navigator with attribute linkWithTaxon