extract method object: reuse component with highlighting for signature preview (IDEA-195081)

This commit is contained in:
Anna.Kozlova
2018-07-06 11:58:07 +02:00
parent 31775c5fdd
commit 304edc4e19
2 changed files with 12 additions and 4 deletions
@@ -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));
}
}
@@ -3,7 +3,7 @@
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="9" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="35" y="92" width="544" height="396"/>
<xy x="35" y="92" width="799" height="590"/>
</constraints>
<properties/>
<border type="none"/>
@@ -149,7 +149,7 @@
</properties>
<border type="none"/>
<children>
<component id="6c27c" class="javax.swing.JTextArea" binding="mySignatureArea">
<component id="6c27c" class="com.intellij.refactoring.ui.MethodSignatureComponent" binding="mySignatureArea" custom-create="true">
<constraints/>
<properties>
<minimumSize width="0" height="64"/>