diff options
Diffstat (limited to 'plugins/ByteCodeViewer')
5 files changed, 80 insertions, 17 deletions
diff --git a/plugins/ByteCodeViewer/src/META-INF/plugin.xml b/plugins/ByteCodeViewer/src/META-INF/plugin.xml index e9c6e32b977d..23e7fcd3059b 100644 --- a/plugins/ByteCodeViewer/src/META-INF/plugin.xml +++ b/plugins/ByteCodeViewer/src/META-INF/plugin.xml @@ -8,11 +8,13 @@ <extensionPoints> <extensionPoint name="classSearcher" interface="com.intellij.byteCodeViewer.ClassSearcher"/> </extensionPoints> + <extensions defaultExtensionNs="com.intellij"> <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/> <projectService serviceInterface="com.intellij.byteCodeViewer.ByteCodeViewerManager" serviceImplementation="com.intellij.byteCodeViewer.ByteCodeViewerManager"/> </extensions> + <actions> <group> <action id="ByteCodeViewer" class="com.intellij.byteCodeViewer.ShowByteCodeAction" text="Show Byte Code"/> diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java index c0a742447c67..12d336d32139 100644 --- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java +++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-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 com.intellij.byteCodeViewer; import com.intellij.codeInsight.hint.EditorFragmentComponent; @@ -25,8 +40,8 @@ import javax.swing.*; import java.awt.*; /** - * User: anna - * Date: 5/7/12 + * @author anna + * @since 5/7/12 */ public class ByteCodeViewerComponent extends JPanel implements Disposable { @@ -66,7 +81,7 @@ public class ByteCodeViewerComponent extends JPanel implements Disposable { public void setText(final String bytecode) { setText(bytecode, 0); } - + public void setText(final String bytecode, PsiElement element) { int offset = 0; final Document document = PsiDocumentManager.getInstance(element.getProject()).getDocument(element.getContainingFile()); @@ -100,7 +115,7 @@ public class ByteCodeViewerComponent extends JPanel implements Disposable { public String getText() { return myEditor.getDocument().getText(); } - + @Override public void dispose() { EditorFactory.getInstance().releaseEditor(myEditor); diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.java b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.java index 7d958bb61b32..db04a80a7862 100644 --- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.java +++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-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 com.intellij.byteCodeViewer; import com.intellij.codeInsight.documentation.DockablePopupManager; @@ -32,8 +47,8 @@ import java.io.PrintWriter; import java.io.StringWriter; /** - * User: anna - * Date: 5/7/12 + * @author anna + * @since 5/7/12 */ public class ByteCodeViewerManager extends DockablePopupManager<ByteCodeViewerComponent> { private static final ExtensionPointName<ClassSearcher> CLASS_SEARCHER_EP = ExtensionPointName.create("ByteCodeViewer.classSearcher"); @@ -43,7 +58,7 @@ public class ByteCodeViewerManager extends DockablePopupManager<ByteCodeViewerCo public static final String TOOLWINDOW_ID = "Byte Code Viewer"; private static final String SHOW_BYTECODE_IN_TOOL_WINDOW = "BYTE_CODE_TOOL_WINDOW"; private static final String BYTECODE_AUTO_UPDATE_ENABLED = "BYTE_CODE_AUTO_UPDATE_ENABLED"; - + public static ByteCodeViewerManager getInstance(Project project) { return ServiceManager.getService(project, ByteCodeViewerManager.class); } @@ -129,7 +144,7 @@ public class ByteCodeViewerManager extends DockablePopupManager<ByteCodeViewerCo } } - + @Override protected void doUpdateComponent(Editor editor, PsiFile psiFile) { final Content content = myToolWindow.getContentManager().getSelectedContent(); @@ -229,7 +244,7 @@ public class ByteCodeViewerManager extends DockablePopupManager<ByteCodeViewerCo @Nullable private static String getClassVMName(PsiClass containingClass) { if (containingClass instanceof PsiAnonymousClass) { - return getClassVMName(PsiTreeUtil.getParentOfType(containingClass, PsiClass.class)) + + return getClassVMName(PsiTreeUtil.getParentOfType(containingClass, PsiClass.class)) + JavaAnonymousClassesHelper.getName((PsiAnonymousClass)containingClass); } return ClassUtil.getJVMClassName(containingClass); diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.java b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.java index 9a778d1470c2..93fc876e551b 100644 --- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.java +++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-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 com.intellij.byteCodeViewer; import com.intellij.psi.PsiClass; @@ -6,7 +21,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** - * Created by Max Medvedev on 8/23/13 + * @author Max Medvedev + * @since 8/23/13 */ public interface ClassSearcher { @Nullable diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java index 76cf133e7a33..6d455d30d661 100644 --- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java +++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-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 com.intellij.byteCodeViewer; import com.intellij.codeInsight.documentation.DocumentationManager; @@ -29,17 +44,17 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** - * User: anna - * Date: 5/4/12 + * @author anna + * @since 5/4/12 */ public class ShowByteCodeAction extends AnAction { @Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(false); e.getPresentation().setIcon(AllIcons.Toolwindows.Documentation); - final Project project = e.getData(PlatformDataKeys.PROJECT); + final Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { - final PsiElement psiElement = getPsiElement(e.getDataContext(), project, e.getData(PlatformDataKeys.EDITOR)); + final PsiElement psiElement = getPsiElement(e.getDataContext(), project, e.getData(CommonDataKeys.EDITOR)); if (psiElement != null) { if (psiElement.getContainingFile() instanceof PsiClassOwner && ByteCodeViewerManager.getContainingClass(psiElement) != null) { @@ -52,9 +67,9 @@ public class ShowByteCodeAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { final DataContext dataContext = e.getDataContext(); - final Project project = PlatformDataKeys.PROJECT.getData(dataContext); + final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) return; - final Editor editor = PlatformDataKeys.EDITOR.getData(dataContext); + final Editor editor = CommonDataKeys.EDITOR.getData(dataContext); final PsiElement psiElement = getPsiElement(dataContext, project, editor); if (psiElement == null) return; @@ -140,7 +155,7 @@ public class ShowByteCodeAction extends AnAction { private static PsiElement getPsiElement(DataContext dataContext, Project project, Editor editor) { PsiElement psiElement = null; if (editor == null) { - psiElement = LangDataKeys.PSI_ELEMENT.getData(dataContext); + psiElement = CommonDataKeys.PSI_ELEMENT.getData(dataContext); } else { final PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project); final Editor injectedEditor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file); |