From 304edc4e19402d3ef5727409d774d5a2a7072acf Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Fri, 6 Jul 2018 09:54:02 +0200 Subject: [PATCH] extract method object: reuse component with highlighting for signature preview (IDEA-195081) --- .../ExtractMethodObjectDialog.java | 12 ++++++++++-- .../ExtractMethodObjectPanel.form | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java index 79105ae09450..39b2892fae3c 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java @@ -15,6 +15,7 @@ */ package com.intellij.refactoring.extractMethodObject; +import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.help.HelpManager; @@ -28,11 +29,13 @@ import com.intellij.refactoring.HelpID; import com.intellij.refactoring.extractMethod.AbstractExtractDialog; import com.intellij.refactoring.extractMethod.InputVariables; import com.intellij.refactoring.ui.ConflictsDialog; +import com.intellij.refactoring.ui.MethodSignatureComponent; import com.intellij.refactoring.util.ParameterTablePanel; import com.intellij.refactoring.util.VariableData; import com.intellij.ui.EditorTextField; import com.intellij.util.VisibilityUtil; import com.intellij.util.containers.MultiMap; +import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -61,7 +64,7 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract private JRadioButton myCreateInnerClassRb; private JRadioButton myCreateAnonymousClassWrapperRb; - private JTextArea mySignatureArea; + private MethodSignatureComponent mySignatureArea; private JCheckBox myCbMakeStatic; private JCheckBox myCbMakeVarargs; private JCheckBox myCbMakeVarargsAnonymous; @@ -224,7 +227,6 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract @Override protected JComponent createCenterPanel() { - mySignatureArea.setEditable(false); myCreateInnerClassRb.setSelected(true); final ActionListener enableDisableListener = new ActionListener() { @@ -429,4 +431,10 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract public boolean createInnerClass() { return myCreateInnerClassRb.isSelected(); } + + private void createUIComponents() { + mySignatureArea = new MethodSignatureComponent("", myProject, JavaFileType.INSTANCE); + mySignatureArea.setPreferredSize(JBUI.size(500, 100)); + mySignatureArea.setMinimumSize(JBUI.size(500, 100)); + } } diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectPanel.form b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectPanel.form index e1bd920291e5..15c71fdf5bc2 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectPanel.form +++ b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectPanel.form @@ -3,7 +3,7 @@ - + @@ -149,7 +149,7 @@ - +