displaying a dialog in IMoveDeleteHook? [message #156038] |
Wed, 12 November 2003 17:05  |
Eclipse User |
|
|
|
Originally posted by: mharp.seapine.com
I can't seem to find anyway to display a dialog from within one of the
MoveDeleteHook methods.
I've tried Display.getCurrent() and that's null.
AbstractUIPlugin.getWorkbench().getActiveWorkbench() is null, and if I do
getActiveWorkbenchs[0].getShell() I get a Shell, but the dialog throws an
exception when I'm creating it.
I guess the delete at that point is running on a seperate, non-ui thread?
Shouldn't I still be able to somehow display a dialog? Can I get access to
that thread somehow since it's not being passed into the overrides?
Any help would be greatly appreciated.
Thanks,
harpstein
|
|
|
Re: displaying a dialog in IMoveDeleteHook? [message #156949 is a reply to message #156038] |
Fri, 14 November 2003 12:10  |
Eclipse User |
|
|
|
Originally posted by: Michael_Valenta.oti.com
It is odd that Display.getCurrent() is returning null. This and your
other problem possibly indicate that you are not properly set up for
self hosting (i.e. when you run the Eclipse containing you plugin, it
seems that othe plugins are missing). You may want to check the PDE doc
on setting up a workspace for self-hosting.
Here is one way to get a Shell to display a dialog (assuming your plugin
references the org.eclipse.ui.workbench plugin):
Display.getDefault().syncExec(
new Runnable() {
public void run() {
Shell shell;
IWorkbenchWindow window =
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
Display display = Display.getDefault();
shell = new Shell(display);
} else {
shell = window.getShell();
}
// Use shell to open dialog
}
});
Harpstein wrote:
> I can't seem to find anyway to display a dialog from within one of the
> MoveDeleteHook methods.
>
> I've tried Display.getCurrent() and that's null.
> AbstractUIPlugin.getWorkbench().getActiveWorkbench() is null, and if I do
> getActiveWorkbenchs[0].getShell() I get a Shell, but the dialog throws an
> exception when I'm creating it.
>
> I guess the delete at that point is running on a seperate, non-ui thread?
> Shouldn't I still be able to somehow display a dialog? Can I get access to
> that thread somehow since it's not being passed into the overrides?
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> harpstein
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03752 seconds