1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 265498: LaunchUIPlugin handleDebugEvents(...) launches multiple Project refreshes on launch terminate.

This commit is contained in:
Mikhail Khodjaiants 2009-03-13 12:23:01 +00:00
parent d6c767387c
commit 09d747ca8c
5 changed files with 56 additions and 30 deletions

View file

@ -25,3 +25,4 @@ DebuggerLaunchTab.name=Debugger
SourceLookupLaunchTab.name=Source
CommonLaunchTab.name=Common
CoreFileLaunchTab.name=Debugger
RefreshLaunchTab.name=Refresh

View file

@ -78,13 +78,25 @@
<associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCLaunch"/>
<placement after="org.eclipse.cdt.cdi.launch.debuggerTab"/>
</tab>
<tab
class="org.eclipse.debug.ui.RefreshTab"
group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
id="org.eclipse.cdt.launch.applicationLaunch.refreshTab"
name="%RefreshLaunchTab.name">
<associatedDelegate
delegate="org.eclipse.cdt.cdi.launch.localCLaunch">
</associatedDelegate>
<placement
after="org.eclipse.debug.ui.sourceLookupTab">
</placement>
</tab>
<tab
id="org.eclipse.cdt.cdi.launch.applicationLaunch.commonTab"
group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
name="%CommonLaunchTab.name"
class="org.eclipse.debug.ui.CommonTab">
<associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCLaunch"/>
<placement after="org.eclipse.debug.ui.sourceLookupTab"/>
<placement after="org.eclipse.debug.ui.refreshTab"/>
</tab>
<!-- Attach launch tabs-->
@ -111,13 +123,25 @@
<associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCAttachLaunch"/>
<placement after="org.eclipse.cdt.cdi.launch.debuggerTab"/>
</tab>
<tab
class="org.eclipse.debug.ui.RefreshTab"
group="org.eclipse.cdt.launch.attachLaunchTabGroup"
id="org.eclipse.cdt.cdi.launch.attachLaunch.refreshTab"
name="%RefreshLaunchTab.name">
<associatedDelegate
delegate="org.eclipse.cdt.cdi.launch.localCAttachLaunch">
</associatedDelegate>
<placement
after="org.eclipse.debug.ui.sourceLookupTab">
</placement>
</tab>
<tab
id="org.eclipse.cdt.cdi.launch.attachLaunch.commonTab"
group="org.eclipse.cdt.launch.attachLaunchTabGroup"
name="%CommonLaunchTab.name"
class="org.eclipse.debug.ui.CommonTab">
<associatedDelegate delegate="org.eclipse.cdt.cdi.launch.localCAttachLaunch"/>
<placement after="org.eclipse.debug.ui.sourceLookupTab"/>
<placement after="org.eclipse.debug.ui.refreshTab"/>
</tab>
<!-- Post mortem launch tabs-->

View file

@ -10,11 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@ -25,6 +21,7 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.ui.RefreshTab;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
@ -213,29 +210,30 @@ public class LaunchUIPlugin extends AbstractUIPlugin implements IDebugEventSetLi
if (events[i].getKind() == DebugEvent.TERMINATE) {
Object o = events[i].getSource();
if (o instanceof IProcess) {
IProcess proc = (IProcess)o;
ICProject cproject = null;
IProcess process = (IProcess)o;
final ILaunchConfiguration config = process.getLaunch().getLaunchConfiguration();
try {
ILaunchConfiguration launchConfig = proc.getLaunch().getLaunchConfiguration();
if (launchConfig != null) {
cproject = CDebugUtils.getCProject(launchConfig);
}
} catch (CoreException e) {
}
if (cproject != null) {
final IProject project = cproject.getProject();
Job projectRefreshJob = new Job("Refresh"){
if (RefreshTab.getRefreshScope(config) != null) {
Job refreshJob = new Job("Refresh"){
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
RefreshTab.refreshResources(config, monitor);
} catch (CoreException e) {
return new Status(Status.CANCEL, PLUGIN_ID, 1, e.getLocalizedMessage(), e);
return new Status(IStatus.ERROR, PLUGIN_ID, 1, e.getLocalizedMessage(), e);
}
return Status.OK_STATUS;
}};
projectRefreshJob.schedule();
refreshJob.setSystem(true);
refreshJob.schedule();
}
}
catch(CoreException e) {
LaunchUIPlugin.log( e.getStatus() );
}
}
}

View file

@ -16,6 +16,7 @@ import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.RefreshTab;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
public class LocalAttachLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
@ -28,6 +29,7 @@ public class LocalAttachLaunchConfigurationTabGroup extends AbstractLaunchConfig
new CMainAttachTab(),
new CDebuggerTab(true),
new SourceLookupTab(),
new RefreshTab(),
new CommonTab()
};
setTabs(tabs);

View file

@ -18,6 +18,7 @@ import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.EnvironmentTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.RefreshTab;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
public class LocalRunLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
@ -32,9 +33,9 @@ public class LocalRunLaunchConfigurationTabGroup extends AbstractLaunchConfigura
new EnvironmentTab(),
new CDebuggerTab(false),
new SourceLookupTab(),
new CommonTab()
new RefreshTab(),
new CommonTab(),
};
setTabs(tabs);
}
}