mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Error handling
This commit is contained in:
+15
-2
@@ -18,12 +18,13 @@ package com.intellij.android.designer.designSurface;
|
||||
import com.android.ide.common.rendering.api.RenderSession;
|
||||
import com.android.ide.common.rendering.api.Result;
|
||||
import com.android.ide.common.resources.configuration.*;
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
import com.intellij.android.designer.actions.ProfileAction;
|
||||
import com.intellij.android.designer.componentTree.AndroidTreeDecorator;
|
||||
import com.intellij.android.designer.model.ModelParser;
|
||||
import com.intellij.android.designer.model.PropertyParser;
|
||||
import com.intellij.android.designer.model.viewAnimator.RadViewAnimatorLayout;
|
||||
import com.intellij.android.designer.model.RadViewComponent;
|
||||
import com.intellij.android.designer.model.viewAnimator.RadViewAnimatorLayout;
|
||||
import com.intellij.android.designer.profile.ProfileManager;
|
||||
import com.intellij.designer.DesignerToolWindowManager;
|
||||
import com.intellij.designer.componentTree.TreeComponentDecorator;
|
||||
@@ -368,13 +369,25 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
@Override
|
||||
protected void configureError(ErrorInfo info) {
|
||||
if (info.throwable instanceof AndroidSdkNotConfiguredException) {
|
||||
info.message = "Please configure Android SDK";
|
||||
info.displayMessage = "Please configure Android SDK";
|
||||
info.stack = false;
|
||||
}
|
||||
else if (!(info.throwable instanceof RenderingException)) {
|
||||
info.show = myParseTime;
|
||||
info.log = true;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder(info.message);
|
||||
|
||||
try {
|
||||
AndroidPlatform platform = AndroidPlatform.getInstance(myModule);
|
||||
IAndroidTarget target = platform.getTarget();
|
||||
builder.append("\nSDK: ").append(target.getFullName()).append(" - ").append(target.getVersion()).append("\n");
|
||||
}
|
||||
catch (Throwable e) {
|
||||
}
|
||||
|
||||
info.message = builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-3
@@ -330,7 +330,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
}
|
||||
|
||||
ErrorInfo info = new ErrorInfo();
|
||||
info.message = message;
|
||||
info.message = info.displayMessage = message;
|
||||
info.throwable = e;
|
||||
configureError(info);
|
||||
|
||||
@@ -338,7 +338,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
showErrorPage(info);
|
||||
}
|
||||
if (info.log || ApplicationManagerEx.getApplicationEx().isInternal()) {
|
||||
LOG.error(message, e);
|
||||
LOG.error(info.message, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
hideProgress();
|
||||
myRootComponent = null;
|
||||
|
||||
myErrorMessage.setText(info.message);
|
||||
myErrorMessage.setText(info.displayMessage);
|
||||
|
||||
if (info.stack) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
@@ -691,6 +691,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
|
||||
|
||||
public static final class ErrorInfo {
|
||||
public String message;
|
||||
public String displayMessage;
|
||||
public Throwable throwable;
|
||||
public boolean show = true;
|
||||
public boolean stack = true;
|
||||
|
||||
Reference in New Issue
Block a user