Moved tool window factory into tool window class.
This commit is contained in:
@@ -375,10 +375,11 @@
|
||||
|
||||
<exceptionFilter implementation="org.jetbrains.jet.plugin.filters.JetExceptionFilterFactory" order="first"/>
|
||||
|
||||
<toolWindow id="Kotlin"
|
||||
factoryClass="org.jetbrains.jet.plugin.internal.KotlinInternalToolWindowFactory"
|
||||
<toolWindow id="Kotlin Bytecode"
|
||||
factoryClass="org.jetbrains.jet.plugin.internal.KotlinBytecodeToolWindow$Factory"
|
||||
anchor="right"
|
||||
icon="/org/jetbrains/jet/plugin/icons/kotlin13.png"
|
||||
canCloseContents="true"
|
||||
/>
|
||||
|
||||
<applicationService serviceInterface="org.jetbrains.jet.plugin.editor.JetEditorOptions"
|
||||
|
||||
+15
-3
@@ -30,6 +30,9 @@ import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
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 com.intellij.util.Alarm;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.OutputFile;
|
||||
@@ -43,7 +46,6 @@ import org.jetbrains.jet.codegen.state.Progress;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.plugin.JetPluginUtil;
|
||||
import org.jetbrains.jet.plugin.caches.resolve.ResolvePackage;
|
||||
import org.jetbrains.jet.plugin.internal.Location;
|
||||
import org.jetbrains.jet.plugin.util.InfinitePeriodicalTask;
|
||||
import org.jetbrains.jet.plugin.util.LongRunningReadTask;
|
||||
|
||||
@@ -56,7 +58,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class BytecodeToolWindow extends JPanel implements Disposable {
|
||||
public class KotlinBytecodeToolWindow extends JPanel implements Disposable {
|
||||
private static final int UPDATE_DELAY = 1000;
|
||||
private static final String DEFAULT_TEXT = "/*\n" +
|
||||
"Generated bytecode for Kotlin source file.\n" +
|
||||
@@ -178,7 +180,7 @@ public class BytecodeToolWindow extends JPanel implements Disposable {
|
||||
private final ToolWindow toolWindow;
|
||||
private final JCheckBox enableInline;
|
||||
|
||||
public BytecodeToolWindow(Project project, ToolWindow toolWindow) {
|
||||
public KotlinBytecodeToolWindow(Project project, ToolWindow toolWindow) {
|
||||
super(new BorderLayout());
|
||||
myProject = project;
|
||||
this.toolWindow = toolWindow;
|
||||
@@ -285,4 +287,14 @@ public class BytecodeToolWindow extends JPanel implements Disposable {
|
||||
public void dispose() {
|
||||
EditorFactory.getInstance().releaseEditor(myEditor);
|
||||
}
|
||||
|
||||
public static class Factory implements ToolWindowFactory {
|
||||
@Override
|
||||
public void createToolWindowContent(Project project, ToolWindow toolWindow) {
|
||||
ContentManager contentManager = toolWindow.getContentManager();
|
||||
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
|
||||
contentManager.addContent(contentFactory.createContent(
|
||||
new KotlinBytecodeToolWindow(project, toolWindow), "", false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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;
|
||||
|
||||
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 BytecodeToolWindow(project, toolWindow), "Bytecode", false));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user