ErrorDialog.openError() doesn't do anythiing in ActionDelegate class [message #463857] |
Fri, 16 February 2007 19:45  |
Eclipse User |
|
|
|
In my CleanActionDelegate class (see below) I am opening an ErrorDialog.
When I debug my code I can see that the execution goes through the
ErrorDialog.openError line but no ErrorDialog pops up. Also, there are
no error messages in the log file.
Would appreciate any help. Thanks.
-sud
public class CleanActionDelegate implements IWorkbenchWindowActionDelegate {
IWorkbenchWindow window;
public void init(IWorkbenchWindow window) {
this.window = window;
}
public void run(IAction action) {
if (window == null) {
// action has been disposed
return;
}
String adminPassword = Activator.getDefault().getPluginPreferences()
.getString("admin.password");
if (adminPassword.compareTo("password") == 0) {
// process all
} else {
ErrorDialog.openError(window.getShell(), "Administrator privileges
required", "The administrator password is missing or is incorrect. You
can set this password in the applications preference
page.",Status.OK_STATUS);
}
}
}
|
|
|
Re: ErrorDialog.openError() doesn't do anythiing in ActionDelegate class [message #463866 is a reply to message #463857] |
Sun, 18 February 2007 18:37  |
Eclipse User |
|
|
|
Try to create some error status.
For example, you can use
IStatus status = new Status(IStatus.ERROR, ....);
instead of
Status.OK_STATUS
The ErrorDialog isn't shown when getting "OK" status.
Snjeza
sudhakar wrote:
> In my CleanActionDelegate class (see below) I am opening an ErrorDialog.
> When I debug my code I can see that the execution goes through the
> ErrorDialog.openError line but no ErrorDialog pops up. Also, there are
> no error messages in the log file.
>
> Would appreciate any help. Thanks.
> -sud
>
>
> public class CleanActionDelegate implements IWorkbenchWindowActionDelegate {
>
> IWorkbenchWindow window;
>
> public void init(IWorkbenchWindow window) {
> this.window = window;
> }
>
> public void run(IAction action) {
> if (window == null) {
> // action has been disposed
> return;
> }
> String adminPassword = Activator.getDefault().getPluginPreferences()
> .getString("admin.password");
>
> if (adminPassword.compareTo("password") == 0) {
> // process all
> } else {
> ErrorDialog.openError(window.getShell(), "Administrator privileges
> required", "The administrator password is missing or is incorrect. You
> can set this password in the applications preference
> page.",Status.OK_STATUS);
> }
> }
> }
|
|
|
Powered by
FUDForum. Page generated in 0.07535 seconds