Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » execute Command from a Property Page
execute Command from a Property Page [message #327925] Thu, 08 May 2008 14:15 Go to next message
Simon F. Eggler is currently offline Simon F. EgglerFriend
Messages: 7
Registered: July 2009
Junior Member
from a PropertyPage, i'm trying to execute a Command that opens another
Window/Dialog:

What i get is the following Exception:
org.eclipse.core.commands.ExecutionException: No activeWorkbenchWindow
found while executing org.eclipse.ui.help.aboutAction


What is wrong?

Help is greatly appreciated.
Cheers,
Simon


Detailed Code:
============================================================ =============

public class APropertyPage extends PropertyPage {


@Override
protected Control createContents(Composite parent) {

Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, true));

Link link = new Link(composite, SWT.LEFT);
link.setText("<a>Command...</a>");
link.addListener(SWT.Selection, new Listener() {

public void handleEvent(Event event) {
final IHandlerService handlerService = (IHandlerService) PlatformUI
.getWorkbench().getService(IHandlerService.class);

try {

handlerService
.executeCommand(
"org.eclipse.ui.help.aboutAction",
event);
}
catch (Exception e) {
e.printStackTrace();
}
}

});

return composite;
}
}


Stack Trace:
============================================================ =============

org.eclipse.core.commands.ExecutionException: No activeWorkbenchWindow
found while executing org.eclipse.ui.help.aboutAction
at org.eclipse.ui.handlers.HandlerUtil.noVariableFound(HandlerU til.java:38)
at
org.eclipse.ui.handlers.HandlerUtil.getVariableChecked(Handl erUtil.java:86)
at
org.eclipse.ui.handlers.HandlerUtil.getActiveWorkbenchWindow Checked(HandlerUtil.java:188)
at org.eclipse.ui.internal.about.AboutHandler.execute(AboutHand ler.java:34)
at
org.eclipse.ui.internal.handlers.HandlerProxy.execute(Handle rProxy.java:240)
at org.eclipse.core.commands.Command.executeWithChecks(Command. java:475)
at
org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(HandlerService.java:174)
at APropertyPage$1.handleEvent(ZuglaufPropertyPage.java:73)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
at org.eclipse.swt.widgets.Link.wmNotifyChild(Link.java:932)
at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4563)
at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:15 81)
at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4216)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3724 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4364 )
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:217 9)
at org.eclipse.swt.widgets.Link.callWindowProc(Link.java:124)
at org.eclipse.swt.widgets.Widget.wmLButtonUp(Widget.java:1817)
at org.eclipse.swt.widgets.Control.WM_LBUTTONUP(Control.java:40 12)
at org.eclipse.swt.widgets.Link.WM_LBUTTONUP(Link.java:784)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3706 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4364 )
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:22 65)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3291)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820 )
at org.eclipse.jface.window.Window.open(Window.java:796)
at
org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDial ogAction.java:156)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:546)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
ch.sbb.rcsd.client.application.internal.RCSDApplication.star t(RCSDApplication.java:36)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
Re: execute Command from a Property Page [message #328656 is a reply to message #327925] Fri, 30 May 2008 15:06 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Simon Eggler wrote:
> from a PropertyPage, i'm trying to execute a Command that opens another
> Window/Dialog:
>
> What i get is the following Exception:
> org.eclipse.core.commands.ExecutionException: No activeWorkbenchWindow
> found while executing org.eclipse.ui.help.aboutAction
>
>
> What is wrong?

Apparently that command won't run from a dialog. It needs the active
workbench window, and it looks like a dialog window means there's no
active workbench window in the global application context.

What version of eclipse? There were some changes that went into that
code in 3.4 (RC2 is out, we're almost at RC3)

>
> Stack Trace:
> ============================================================ =============
>
> org.eclipse.core.commands.ExecutionException: No activeWorkbenchWindow
> found while executing org.eclipse.ui.help.aboutAction
> at

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:[Accessibility] Decorations in views not read by Windows Eyes
Next Topic:Determining when the project was refreshed the last time
Goto Forum:
  


Current Time: Thu Dec 26 19:50:33 GMT 2024

Powered by FUDForum. Page generated in 0.06433 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top