Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Some Problem Code in DebugUI Plugins
Some Problem Code in DebugUI Plugins [message #146309] Sat, 18 October 2003 15:59 Go to next message
Eclipse UserFriend
Originally posted by: meek77.chollian.net

Debug or Launch Framework provide us to mamke some work.
below code can make some problems.

DebugUITools.launch methods doing launch something in progress dialog.
but
[ dialog.run(true, true, runnable) ] - 15 line
code is something strange.

this make impossible to interactive with workbenchUI.
falks option true make a new thread and this thread not synched with
workbench thread so exception or error (ex.InvocationException) occur when
we operate workbench window.

this code should change like this :
dialog.run(false, true, runnable)

what do you think of this?

public static void launch(final ILaunchConfiguration configuration, final
String mode) {
if (DebugUIPlugin.preLaunchSave()) {
ProgressMonitorDialog dialog = new
ProgressMonitorDialog(DebugUIPlugin.getShell());
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws
InvocationTargetException, InterruptedException {
try {
buildAndLaunch(configuration, mode, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
try {
dialog.run(true, true, runnable);
} catch (InvocationTargetException e) {
Throwable targetException = e.getTargetException();
Throwable t = e;
if (targetException instanceof CoreException) {
t = targetException;
}
if (t instanceof CoreException) {
CoreException ce = (CoreException)t;
IStatusHandler handler =
DebugPlugin.getDefault().getStatusHandler(ce.getStatus());
if (handler != null) {
LaunchGroupExtension group =
DebugUIPlugin.getDefault().getLaunchConfigurationManager().g etLaunchGroup(co
nfiguration, mode);
if (group != null) {
openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell( ), new
StructuredSelection(configuration), group.getIdentifier(), ce.getStatus());
return;
}
}
}
DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(),
DebugUIMessages.getString("DebugUITools.Error_1"),
DebugUIMessages.getString("DebugUITools.Exception_occurred_during_launch_2 ")
, t); //$NON-NLS-1$ //$NON-NLS-2$
} catch (InterruptedException e) {
// cancelled
}
}
}
Re: Some Problem Code in DebugUI Plugins [message #146326 is a reply to message #146309] Sat, 18 October 2003 18:09 Go to previous message
Eclipse UserFriend
I think you should log a bug report against DebugUI with a failing test
case.

Thanks
Darins

"meeky" <meek77@chollian.net> wrote in message
news:bms608$5k3$1@eclipse.org...
> Debug or Launch Framework provide us to mamke some work.
> below code can make some problems.
>
> DebugUITools.launch methods doing launch something in progress dialog.
> but
> [ dialog.run(true, true, runnable) ] - 15 line
> code is something strange.
>
> this make impossible to interactive with workbenchUI.
> falks option true make a new thread and this thread not synched with
> workbench thread so exception or error (ex.InvocationException) occur when
> we operate workbench window.
>
> this code should change like this :
> dialog.run(false, true, runnable)
>
> what do you think of this?
>
> public static void launch(final ILaunchConfiguration configuration, final
> String mode) {
> if (DebugUIPlugin.preLaunchSave()) {
> ProgressMonitorDialog dialog = new
> ProgressMonitorDialog(DebugUIPlugin.getShell());
> IRunnableWithProgress runnable = new IRunnableWithProgress() {
> public void run(IProgressMonitor monitor) throws
> InvocationTargetException, InterruptedException {
> try {
> buildAndLaunch(configuration, mode, monitor);
> } catch (CoreException e) {
> throw new InvocationTargetException(e);
> }
> }
> };
> try {
> dialog.run(true, true, runnable);
> } catch (InvocationTargetException e) {
> Throwable targetException = e.getTargetException();
> Throwable t = e;
> if (targetException instanceof CoreException) {
> t = targetException;
> }
> if (t instanceof CoreException) {
> CoreException ce = (CoreException)t;
> IStatusHandler handler =
> DebugPlugin.getDefault().getStatusHandler(ce.getStatus());
> if (handler != null) {
> LaunchGroupExtension group =
>
DebugUIPlugin.getDefault().getLaunchConfigurationManager().g etLaunchGroup(co
> nfiguration, mode);
> if (group != null) {
> openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell( ), new
> StructuredSelection(configuration), group.getIdentifier(),
ce.getStatus());
> return;
> }
> }
> }
> DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(),
> DebugUIMessages.getString("DebugUITools.Error_1"),
>
DebugUIMessages.getString("DebugUITools.Exception_occurred_during_launch_2 ")
> , t); //$NON-NLS-1$ //$NON-NLS-2$
> } catch (InterruptedException e) {
> // cancelled
> }
> }
> }
>
>
Previous Topic:Eclipse with DB2
Next Topic:decorating non-resources
Goto Forum:
  


Current Time: Thu May 08 13:02:30 EDT 2025

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

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

Back to the top