<fragments xsi:type="fragment:StringModelFragment" xmi:id="_xVa1wCXXEeex9MwMOgUeWw" featurename="descriptors" parentElementId="xpath:/">
<elements xsi:type="basic:PartDescriptor" xmi:id="_2xmxoCXXEeex9MwMOgUeWw" elementId="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart" label="%view.name.SESSIONS" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/applications-office.png" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart">
<tags>nonRestore</tags>
+ <handlers xmi:id="_gbMXAL-rEeegz7IDD8MJaw" elementId="eu.etaxonomy.taxeditor.view.sessions.InspectSessionHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.sessions.InspectSessionHandler" command="_dQ0swL-rEeegz7IDD8MJaw"/>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_J-3UEEqgEeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor" label="%partdescriptor.label.featureTreeEditor" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor">
<tags>nonRestore</tags>
<elements xsi:type="commands:Command" xmi:id="_bfjZwK2fEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler" commandName="%command.name.11"/>
<elements xsi:type="commands:Command" xmi:id="_KQP_sK2gEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.operations.reconnect" commandName="%command.name.RE_CONNECT"/>
<elements xsi:type="commands:Command" xmi:id="_SXZF8K2gEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.openPasswordWizzard" commandName="%command.name.10"/>
+ <elements xsi:type="commands:Command" xmi:id="_dQ0swL-rEeegz7IDD8MJaw" elementId="eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog" commandName="Inspect Session"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
<elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.ui.progress.IProgressService;
}
}
-
- public static void executeCommand(String commandId, Object source, String pluginId) {
- IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
- Exception exception = null;
- try {
- handlerService.executeCommand(commandId, null);
- } catch (ExecutionException e) {
- exception = e;
- } catch (NotDefinedException e) {
- exception = e;
- } catch (NotEnabledException e) {
- exception = e;
- } catch (NotHandledException e) {
- exception = e;
- } finally {
- if(exception != null) {
- MessagingUtils.errorDialog("Error executing command",
- source,
- "Could not execute command with id " + commandId ,
- pluginId,
- exception,
- true);
- }
- }
- }
-
public static Object getElementsFromSelectionChangedEvent(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
Object selectionToSet = selection;
--- /dev/null
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.view.sessions;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author pplitzner
+ * @since Nov 2, 2017
+ *
+ */
+public class InspectSessionHandler {
+
+ @Execute
+ public void canExecute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell){
+ InspectSessionsDialog dialog = new InspectSessionsDialog(shell, SWT.NONE);
+ dialog.open();
+ }
+}
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.e4.core.commands.ECommandService;
+import org.eclipse.e4.core.commands.EHandlerService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wb.swt.SWTResourceManager;
import eu.etaxonomy.cdm.api.cache.CdmCacher;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
private Text txtCdmModelOnDisk;
private Text txtDefaultOnDisk;
+ @Inject
+ private ECommandService commandService;
+
+ @Inject
+ private EHandlerService handlerService;
+
@Inject
public SessionsViewPart() {
this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager();
btnInspectActiveSession.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- AbstractUtility.executeCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID, this, null);
+ Command command = commandService.getCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID);
+ handlerService.executeHandler(ParameterizedCommand.generateCommand(command, null));
}
});
btnInspectActiveSession.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));