diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index e68c07edb48..dd50a0274df 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -135,11 +135,10 @@ - - + diff --git a/idea/src/org/jetbrains/jet/plugin/internal/KotlinInternalToolWindowFactory.java b/idea/src/org/jetbrains/jet/plugin/internal/KotlinInternalToolWindowFactory.java new file mode 100644 index 00000000000..6fb9a162ec9 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/internal/KotlinInternalToolWindowFactory.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.plugin.internal; + +import com.intellij.openapi.project.Project; +import com.intellij.openapi.wm.ToolWindow; +import com.intellij.openapi.wm.ToolWindowFactory; +import com.intellij.ui.content.ContentFactory; +import com.intellij.ui.content.ContentManager; +import org.jetbrains.jet.plugin.internal.codewindow.BytecodeToolwindow; +import org.jetbrains.jet.plugin.internal.resolvewindow.ResolveToolwindow; + +/** + * @author Evgeny Gerashchenko + * @since 2/20/12 + */ +public class KotlinInternalToolWindowFactory implements ToolWindowFactory { + @Override + public void createToolWindowContent(Project project, ToolWindow toolWindow) { + ContentManager contentManager = toolWindow.getContentManager(); + ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); + contentManager.addContent(contentFactory.createContent(new ResolveToolwindow(project), "Resolve", false)); + contentManager.addContent(contentFactory.createContent(new BytecodeToolwindow(project), "Bytecode", false)); + } +} diff --git a/idea/src/org/jetbrains/jet/plugin/internal/codewindow/BytecodeToolwindow.java b/idea/src/org/jetbrains/jet/plugin/internal/codewindow/BytecodeToolwindow.java index 9b0252eef04..dc6283938dd 100644 --- a/idea/src/org/jetbrains/jet/plugin/internal/codewindow/BytecodeToolwindow.java +++ b/idea/src/org/jetbrains/jet/plugin/internal/codewindow/BytecodeToolwindow.java @@ -32,11 +32,8 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.wm.ToolWindow; -import com.intellij.openapi.wm.ToolWindowFactory; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; -import com.intellij.ui.content.ContentFactory; import com.intellij.util.Alarm; import org.jetbrains.jet.codegen.ClassBuilderFactory; import org.jetbrains.jet.codegen.ClassFileFactory; @@ -57,6 +54,11 @@ import java.util.Scanner; public class BytecodeToolwindow extends JPanel { private static final int UPDATE_DELAY = 500; + private static final String DEFAULT_TEXT = "/*\n" + + "Generated bytecode for Kotlin source file.\n" + + "No Kotlin source file is opened.\n" + + "*/"; + private final Editor myEditor; private final Alarm myUpdateAlarm; private Location myCurrentLocation; @@ -86,18 +88,18 @@ public class BytecodeToolwindow extends JPanel { Editor editor = location.editor; if (editor == null) { - setText(""); + setText(DEFAULT_TEXT); } else { VirtualFile vFile = ((EditorEx) editor).getVirtualFile(); if (vFile == null) { - setText(""); + setText(DEFAULT_TEXT); return; } PsiFile psiFile = PsiManager.getInstance(myProject).findFile(vFile); if (!(psiFile instanceof JetFile)) { - setText(""); + setText(DEFAULT_TEXT); return; } @@ -220,15 +222,7 @@ public class BytecodeToolwindow extends JPanel { return answer.toString(); } - - public static class Factory implements ToolWindowFactory { - @Override - public void createToolWindowContent(Project project, ToolWindow toolWindow) { - toolWindow.getContentManager().addContent(ContentFactory.SERVICE.getInstance().createContent(new BytecodeToolwindow(project), "", false)); - } - } - public static class Location { final Editor editor; final long modificationStamp; diff --git a/idea/src/org/jetbrains/jet/plugin/internal/resolvewindow/ResolveToolwindow.java b/idea/src/org/jetbrains/jet/plugin/internal/resolvewindow/ResolveToolwindow.java index 47109123d09..92fc98f0dfa 100644 --- a/idea/src/org/jetbrains/jet/plugin/internal/resolvewindow/ResolveToolwindow.java +++ b/idea/src/org/jetbrains/jet/plugin/internal/resolvewindow/ResolveToolwindow.java @@ -28,14 +28,11 @@ import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.wm.ToolWindow; -import com.intellij.openapi.wm.ToolWindowFactory; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtilCore; -import com.intellij.ui.content.ContentFactory; import com.intellij.util.Alarm; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.*; @@ -69,14 +66,11 @@ public class ResolveToolwindow extends JPanel { public static final String BAR = "\n\n===\n\n"; - public static class Factory implements ToolWindowFactory { - @Override - public void createToolWindowContent(Project project, ToolWindow toolWindow) { - toolWindow.getContentManager().addContent(ContentFactory.SERVICE.getInstance().createContent(new ResolveToolwindow(project), "", false)); - } - } - private static final int UPDATE_DELAY = 500; + private static final String DEFAULT_TEXT = "/*\n" + + "Information about symbols resolved by\nKotlin compiler.\n" + + "No Kotlin source file is opened.\n" + + "*/"; private final Editor myEditor; private final Alarm myUpdateAlarm; private BytecodeToolwindow.Location myCurrentLocation; @@ -105,18 +99,18 @@ public class ResolveToolwindow extends JPanel { private void render(BytecodeToolwindow.Location location, BytecodeToolwindow.Location oldLocation) { Editor editor = location.getEditor(); if (editor == null) { - setText("No editor"); + setText(DEFAULT_TEXT); } else { VirtualFile vFile = ((EditorEx) editor).getVirtualFile(); if (vFile == null) { - setText(""); + setText(DEFAULT_TEXT); return; } PsiFile psiFile = PsiManager.getInstance(myProject).findFile(vFile); if (!(psiFile instanceof JetFile)) { - setText(""); + setText(DEFAULT_TEXT); return; }