mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Check project disposed state
This commit is contained in:
+6
-4
@@ -193,7 +193,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
myPSIChangeListener.clear();
|
||||
showError("Parsing error", e.getCause());
|
||||
showError("Parsing error", e.getCause() == null ? e : e.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
RenderUtil.renderLayout(myModule, layoutXmlText, myFile, null, target, facet, config, xdpi, ydpi, theme, 10000, true);
|
||||
|
||||
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
|
||||
System.out.println("Render time: " + (System.currentTimeMillis() - time));
|
||||
System.out.println("Render time: " + (System.currentTimeMillis() - time)); // XXX
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
@@ -303,8 +303,10 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
hideProgress();
|
||||
runnable.run();
|
||||
if (!getProject().isDisposed()) {
|
||||
hideProgress();
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
myPSIChangeListener.clear();
|
||||
|
||||
+3
-3
@@ -54,14 +54,14 @@ public class ExternalPSIChangeListener extends PsiTreeChangeAdapter {
|
||||
public void start() {
|
||||
if (!myRunState) {
|
||||
myRunState = true;
|
||||
PsiManager.getInstance(myFile.getProject()).addPsiTreeChangeListener(this);
|
||||
PsiManager.getInstance(myDesigner.getProject()).addPsiTreeChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (myRunState) {
|
||||
myRunState = false;
|
||||
PsiManager.getInstance(myFile.getProject()).removePsiTreeChangeListener(this);
|
||||
PsiManager.getInstance(myDesigner.getProject()).removePsiTreeChangeListener(this);
|
||||
clear();
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class ExternalPSIChangeListener extends PsiTreeChangeAdapter {
|
||||
myAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myRunState && myInitialize) {
|
||||
if (myRunState && myInitialize && !myDesigner.getProject().isDisposed()) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -316,6 +316,10 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
}
|
||||
|
||||
public final void showError(@NotNull String message, @NotNull Throwable e) {
|
||||
if (getProject().isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (e instanceof InvocationTargetException) {
|
||||
if (e.getCause() == null) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user