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;
|
package org.eclipse.cdt.ui.newui;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
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.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.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
@ -24,6 +30,9 @@ public class ManageConfigRunner implements IConfigManager {
|
||||||
|
|
||||||
protected static ManageConfigRunner instance = null;
|
protected static ManageConfigRunner instance = null;
|
||||||
|
|
||||||
|
private ICProjectDescription des = null;
|
||||||
|
private IProject prj = null;
|
||||||
|
|
||||||
public static ManageConfigRunner getDefault() {
|
public static ManageConfigRunner getDefault() {
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new ManageConfigRunner();
|
instance = new ManageConfigRunner();
|
||||||
|
@ -44,16 +53,13 @@ public class ManageConfigRunner implements IConfigManager {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (d.open() == Window.OK) {
|
if (d.open() == Window.OK) {
|
||||||
if (doOk) {
|
if (doOk) {
|
||||||
// CDTPropertyManager.performOk(d.getShell());
|
des = d.getProjectDescription();
|
||||||
ICProjectDescription des = d.getProjectDescription();
|
prj = obs[0];
|
||||||
if(des != null){
|
if(des != null)
|
||||||
try {
|
try {
|
||||||
CoreModel.getDefault().setProjectDescription(obs[0], des);
|
PlatformUI.getWorkbench().getProgressService().run(false, false, getRunnable());
|
||||||
} catch (CoreException e) {
|
} catch (InvocationTargetException e) {}
|
||||||
// TODO Auto-generated catch block
|
catch (InterruptedException e) {}
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AbstractPage.updateViews(obs[0]);
|
AbstractPage.updateViews(obs[0]);
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -62,4 +68,20 @@ public class ManageConfigRunner implements IConfigManager {
|
||||||
}
|
}
|
||||||
return result;
|
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