mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug #223062 : ManageConfigRunner runs in display thread locking UI for a long time
This commit is contained in:
parent
df5acf9f9c
commit
a95edcdcdf
1 changed files with 31 additions and 9 deletions
|
@ -11,9 +11,15 @@
|
|||
|
||||
package org.eclipse.cdt.ui.newui;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
|
@ -24,6 +30,9 @@ public class ManageConfigRunner implements IConfigManager {
|
|||
|
||||
protected static ManageConfigRunner instance = null;
|
||||
|
||||
private ICProjectDescription des = null;
|
||||
private IProject prj = null;
|
||||
|
||||
public static ManageConfigRunner getDefault() {
|
||||
if (instance == null)
|
||||
instance = new ManageConfigRunner();
|
||||
|
@ -44,16 +53,13 @@ public class ManageConfigRunner implements IConfigManager {
|
|||
boolean result = false;
|
||||
if (d.open() == Window.OK) {
|
||||
if (doOk) {
|
||||
// CDTPropertyManager.performOk(d.getShell());
|
||||
ICProjectDescription des = d.getProjectDescription();
|
||||
if(des != null){
|
||||
des = d.getProjectDescription();
|
||||
prj = obs[0];
|
||||
if(des != null)
|
||||
try {
|
||||
CoreModel.getDefault().setProjectDescription(obs[0], des);
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
PlatformUI.getWorkbench().getProgressService().run(false, false, getRunnable());
|
||||
} catch (InvocationTargetException e) {}
|
||||
catch (InterruptedException e) {}
|
||||
}
|
||||
AbstractPage.updateViews(obs[0]);
|
||||
result = true;
|
||||
|
@ -62,4 +68,20 @@ public class ManageConfigRunner implements IConfigManager {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public IRunnableWithProgress getRunnable() {
|
||||
return new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||
public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
|
||||
CUIPlugin.getDefault().getShell().getDisplay().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
CoreModel.getDefault().setProjectDescription(prj, des);
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue