Skip to content

Commit dedd262

Browse files
committed
Show error message when no class find is found
1 parent ef20939 commit dedd262

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/org/objectweb/asm/idea/ShowBytecodeOutlineAction.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
*/
6060
public class ShowBytecodeOutlineAction extends AnAction {
6161

62+
private final static String NO_CLASS_FOUND = "// couldn't generate bytecode view, no .class file found";
63+
6264
@Override
6365
public void update(final AnActionEvent e) {
6466
final Editor editor = e.getData(PlatformDataKeys.EDITOR);
@@ -137,7 +139,7 @@ public void finished(boolean aborted, int errors, int warnings, final CompileCon
137139
result[0] = null;
138140
}
139141
}
140-
if (result[0] != null) application.invokeLater(new Runnable() {
142+
application.invokeLater(new Runnable() {
141143
public void run() {
142144
updateToolWindowContents(project, result[0]);
143145
}
@@ -182,9 +184,14 @@ public VirtualFile compute() {
182184
* @param file the class file
183185
*/
184186
private void updateToolWindowContents(final Project project, final VirtualFile file) {
185-
if (file == null) return;
186187
ApplicationManager.getApplication().runWriteAction(new Runnable() {
187188
public void run() {
189+
if (file==null) {
190+
BytecodeOutline.getInstance(project).setCode(NO_CLASS_FOUND);
191+
BytecodeASMified.getInstance(project).setCode(NO_CLASS_FOUND);
192+
ToolWindowManager.getInstance(project).getToolWindow("ASM").activate(null);
193+
return;
194+
}
188195
StringWriter stringWriter = new StringWriter();
189196
ClassVisitor visitor = new TraceClassVisitor(new PrintWriter(stringWriter));
190197
ClassReader reader = null;

0 commit comments

Comments
 (0)