diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java | 91 |
1 files changed, 1 insertions, 90 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java index 2bb37639a..7ffacde55 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java @@ -9,20 +9,12 @@ *******************************************************************************/ package org.eclipse.tcf.te.ui.views.editor.pages; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.ParameterizedCommand; -import org.eclipse.core.expressions.EvaluationContext; import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ContributionManager; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.te.ui.forms.CustomFormToolkit; @@ -30,12 +22,9 @@ import org.eclipse.tcf.te.ui.forms.FormLayoutFactory; import org.eclipse.tcf.te.ui.views.activator.UIPlugin; import org.eclipse.tcf.te.ui.views.interfaces.ImageConsts; import org.eclipse.tcf.te.ui.views.nls.Messages; -import org.eclipse.ui.ISources; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.forms.IManagedForm; -import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.menus.IMenuService; /** @@ -79,58 +68,6 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor } } - // The default "Show In System Management" view action - static protected class ShowInSystemManagementAction extends Action { - private final AbstractCustomFormToolkitEditorPage parentPage; - - /** - * Constructor. - */ - public ShowInSystemManagementAction(AbstractCustomFormToolkitEditorPage parentPage) { - super(Messages.AbstractCustomFormToolkitEditorPage_ShowInSystemManagementCommandAction_label, IAction.AS_PUSH_BUTTON); - setToolTipText(Messages.AbstractCustomFormToolkitEditorPage_ShowInSystemManagementCommandAction_tooltip); - setImageDescriptor(UIPlugin.getImageDescriptor(ImageConsts.VIEW)); - - Assert.isNotNull(parentPage); - this.parentPage = parentPage; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.Action#run() - */ - @Override - public void run() { - ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class); - Command command = service != null ? service.getCommand("org.eclipse.tcf.te.ui.command.showIn.systemManagement") : null; //$NON-NLS-1$ - if (command != null && command.isDefined() && command.isEnabled()) { - try { - ISelection selection = new StructuredSelection(parentPage.getEditorInputNode()); - EvaluationContext ctx = new EvaluationContext(null, selection); - ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection); - ctx.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection); - ctx.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, parentPage.getSite().getWorkbenchWindow()); - ctx.addVariable(ISources.ACTIVE_PART_ID_NAME, parentPage.getSite().getId()); - ctx.addVariable(ISources.ACTIVE_PART_NAME, parentPage.getSite().getPart()); - ctx.addVariable(ISources.ACTIVE_SITE_NAME, parentPage.getSite()); - ctx.addVariable(ISources.ACTIVE_SHELL_NAME, parentPage.getSite().getShell()); - ctx.setAllowPluginActivation(true); - - ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null); - Assert.isNotNull(pCmd); - IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); - Assert.isNotNull(handlerSvc); - handlerSvc.executeCommandInContext(pCmd, null, ctx); - } catch (Exception e) { - // If the platform is in debug mode, we print the exception to the log view - if (Platform.inDebugMode()) { - IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), e.getLocalizedMessage(), e); - UIPlugin.getDefault().getLog().log(status); - } - } - } - } - } - /** * Returns the custom form toolkit instance. * @@ -262,16 +199,10 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor protected void createToolbarContributionItems(IToolBarManager manager) { Assert.isNotNull(manager); - // If the page does have "Show In System Management", add the action into the toolbar - if (hasShowInSystemMangementAction()) { - Action showInAction = doCreateShowInSystemManagementAction(); - if (showInAction != null) manager.add(showInAction); - } - // If the page is associated with a context help id, add a default // help action button into the toolbar if (getContextHelpId() != null) { - if (hasShowInSystemMangementAction()) manager.add(new Separator()); + manager.add(new Separator()); Action helpAction = doCreateHelpAction(getContextHelpId()); if(helpAction != null) manager.add(helpAction); } @@ -289,26 +220,6 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor } /** - * Returns if or if not the page has the "Show In System Management" action. - * <p> - * The default implementation returns <code>false</code>. - * - * @return <code>True</code> if the action is visible in the form toolbar, <code>false</code> otherwise. - */ - protected boolean hasShowInSystemMangementAction() { - return false; - } - - /** - * Creates the "Show In System Management" action. - * - * @return The action or <code>null</code>. - */ - protected Action doCreateShowInSystemManagementAction() { - return new ShowInSystemManagementAction(this); - } - - /** * Do create the managed form content. * * @param parent The parent composite. Must not be <code>null</code> |