Revert "Bug 353372 - UI Hangs after model crash Turned all Display.syncExec() methods into Display.asyncExec() methods. This should prevent GUI freezes if calls come from the main Thread."
This reverts commit 151575a70b9f809fdd2d7bb0362ed78f5a7f4dc0.
diff --git a/org.eclipse.amp.axf/plugins/org.eclipse.amp.axf.ide/src/org/eclipse/amp/axf/ide/ModelViewManager.java b/org.eclipse.amp.axf/plugins/org.eclipse.amp.axf.ide/src/org/eclipse/amp/axf/ide/ModelViewManager.java
index b8a44d7..9f6a357 100644
--- a/org.eclipse.amp.axf/plugins/org.eclipse.amp.axf.ide/src/org/eclipse/amp/axf/ide/ModelViewManager.java
+++ b/org.eclipse.amp.axf/plugins/org.eclipse.amp.axf.ide/src/org/eclipse/amp/axf/ide/ModelViewManager.java
@@ -30,7 +30,6 @@
import org.eclipse.amp.axf.view.ModelViewPart;
import org.eclipse.amp.axf.view.SelectionSynchronizer;
import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IPartListener;
@@ -111,13 +110,12 @@
*
* @return
*/
- public static ModelViewManager createNewInstance() {
+ static ModelViewManager createNewInstance() {
instance = null;
return getInstance();
}
private final class PartCreator implements Runnable {
-
private final String name;
private final ModelInput editorInput;
@@ -153,7 +151,6 @@
((ModelViewPart) part).createModelListeners();
getViews(editorInput.getModel()).add(part);
new Thread() {
-
@Override
public void run() {
managerListeners.notifyViewAdded(part);
@@ -179,11 +176,9 @@
* @author mparker
*/
final class ActivationListener implements IPartListener {
-
private void assignPart(final IWorkbenchPart part) {
if (part instanceof IModelPart && ((IModelPart) part).getAdapter(IModel.class) != null) {
new Thread() {
-
@Override
public void run() {
IModel model = (IModel) ((IModelPart) part).getAdapter(IModel.class);
@@ -204,7 +199,6 @@
public void partClosed(final IWorkbenchPart part) {
if (part instanceof IModelPart && ((IModelPart) part).getAdapter(IModel.class) != null) {
new Thread() {
-
@Override
public void run() {
removed((IViewPart) part);
@@ -299,9 +293,7 @@
}
i++;
}
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, "org.eclipse.amp.axf.ui", "Currently, the execution engine only supports "
- + modelSlots.length + " slots. The UI may not perform properly."));
+ StatusManager.getManager().handle(new Status(Status.WARNING, "org.eclipse.amp.axf.ui", "Currently, the execution engine only supports " + modelSlots.length + " slots. The UI may not perform properly."));
return -1;
}
@@ -410,7 +402,7 @@
*/
public IViewPart createViewPart(final String id, final ModelInput editorInput, final String name) {
PartCreator creator = new PartCreator(name, editorInput, id);
- PlatformUI.getWorkbench().getDisplay().asyncExec(creator);
+ PlatformUI.getWorkbench().getDisplay().syncExec(creator);
return creator.getPart();
}
@@ -425,7 +417,6 @@
Display display = PlatformUI.getWorkbench().getDisplay();
if (!display.isDisposed()) {
display.asyncExec(new Runnable() {
-
public void run() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
@@ -437,7 +428,6 @@
}
} else {
new Thread() {
-
@Override
public void run() {
removed(part);
@@ -481,9 +471,7 @@
deactivate();
}
} else {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, "org.eclipse.amp.axf.ui", "Removing a model that no longer exists:" + model,
- new Exception()));
+ StatusManager.getManager().handle(new Status(Status.WARNING, "org.eclipse.amp.axf.ui", "Removing a model that no longer exists:" + model, new Exception()));
}
}
@@ -498,7 +486,6 @@
final IWorkbench wb = AXFWorkbenchPlugin.getDefault().getWorkbench();
wb.addWorkbenchListener(new IWorkbenchListener() {
-
public void postShutdown(IWorkbench workbench) {
//
}
@@ -526,8 +513,7 @@
getActiveModelListeners().addListener(statusLineView);
activatePerspective(wb, executionPerspective, false);
- wb.getDisplay().asyncExec(new Runnable() {
-
+ wb.getDisplay().syncExec(new Runnable() {
public void run() {
try {
contextService = (IContextService) wb.getService(IContextService.class);
@@ -542,13 +528,11 @@
}
private void activatePerspective(final IWorkbench wb, final String perspectiveID, final boolean editors) {
- wb.getDisplay().asyncExec(new Runnable() {
-
+ wb.getDisplay().syncExec(new Runnable() {
public void run() {
IPerspectiveDescriptor perspective = wb.getPerspectiveRegistry().findPerspectiveWithId(perspectiveID);
if (perspective != null) {
- IWorkbenchPage activePage = wb.getActiveWorkbenchWindow() != null ? wb.getActiveWorkbenchWindow()
- .getActivePage() : null;
+ IWorkbenchPage activePage = wb.getActiveWorkbenchWindow() != null ? wb.getActiveWorkbenchWindow().getActivePage() : null;
if (activePage != null) {
if (priorPerspectiveID == null || !activePage.getPerspective().getId().equals(executionPerspective)) {
priorPerspectiveID = activePage.getPerspective().getId();
@@ -558,7 +542,6 @@
}
}
}
-
});
}
@@ -566,7 +549,6 @@
final IWorkbench wb = AXFWorkbenchPlugin.getDefault().getWorkbench();
if (wb != null) {
wb.getDisplay().asyncExec(new Runnable() {
-
public void run() {
if (contextService != null) {
contextService.deactivateContext(ideContext);
@@ -591,7 +573,8 @@
* @param adaptableObject
* @param adapterType
* @return
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object,
+ * java.lang.Class)
*/
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adapterType == IEngine.class && adaptableObject instanceof IModel) {