import javax.annotation.PreDestroy;
import javax.inject.Inject;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.UndoContext;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.di.UISynchronize;
-import org.eclipse.e4.ui.model.application.commands.MCommand;
-import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
+import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem;
-import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
-import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.LoginManager;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
/**
*
*/
public class TaxonNavigatorE4 implements
IPostOperationEnabled, IConversationEnabled, Observer,
- ICdmEntitySessionEnabled, ICdmChangeListener, IContextListener {
+ ICdmEntitySessionEnabled, ICdmChangeListener, IContextListener,
+ ICollapsableExpandable {
private static final String RESTORING_TAXON_NAVIGATOR = Messages.TaxonNavigator_RESTORE;
@Inject
private MPart thisPart;
+ @Inject
+ private MApplication application;
+
+ @Inject
+ private EModelService modelService;
+
+ @Inject
+ private EPartService partService;
+
private boolean linkWithTaxon = false;
@Inject
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if(firstElement instanceof ICdmBase){
- NavigationUtil.openEditor((ICdmBase) firstElement, viewer.getControl().getShell());
+ NavigationUtil.openEditor((ICdmBase) firstElement, viewer.getControl().getShell(), modelService, partService, application);
}
}
});
viewer.addDropSupport(dndOperations, transfers, new TreeNodeDropAdapterE4(this));
//add toolbar
- MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
- MHandledToolItem linkWithEditor = MMenuFactory.INSTANCE.createHandledToolItem();
- linkWithEditor.setIconURI("platform:/plugin/eu.etaxonomy.taxeditor.store/icons/synced.gif");
- Command command = commandService.getCommand("eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon");
- MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
- mCommand.setElementId(command.getId());
- try {
- mCommand.setCommandName(command.getName());
- } catch (NotDefinedException e) {
- e.printStackTrace();
- }
- linkWithEditor.setCommand(mCommand);
- linkWithEditor.setType(ItemType.CHECK);
- toolBar.getChildren().add(linkWithEditor);
- thisPart.setToolbar(toolBar);
+// MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
+// MHandledToolItem linkWithEditor = MMenuFactory.INSTANCE.createHandledToolItem();
+// linkWithEditor.setIconURI("platform:/plugin/eu.etaxonomy.taxeditor.store/icons/synced.gif");
+// Command command = commandService.getCommand("eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon");
+// MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
+// mCommand.setElementId(command.getId());
+// try {
+// mCommand.setCommandName(command.getName());
+// } catch (NotDefinedException e) {
+// e.printStackTrace();
+// }
+// linkWithEditor.setCommand(mCommand);
+// linkWithEditor.setType(ItemType.CHECK);
+// toolBar.getChildren().add(linkWithEditor);
+// thisPart.setToolbar(toolBar);
init();
}
return new TreePath(pathList.toArray());
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void collapse() {
+ viewer.collapseAll();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void expand() {
+ viewer.expandAll();
+ }
+
@Override
public ConversationHolder getConversationHolder() {
return conversation;