Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2012-01-20 12:44:24 +04:00
4 changed files with 35 additions and 44 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* 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.
@@ -19,6 +19,7 @@ import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiFormatUtil;
@@ -338,8 +339,12 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
protected JComponent createCenterPanel() {
myCenterPanel = new JPanel(new BorderLayout());
createParametersPanel();
myCenterPanel.add(createSignaturePanel(), BorderLayout.SOUTH);
return myCenterPanel;
final Splitter splitter = new Splitter(true);
splitter.setShowDividerIcon(false);
splitter.setFirstComponent(myCenterPanel);
splitter.setSecondComponent(createSignaturePanel());
return splitter;
}
protected boolean isOutputVariable(PsiVariable var) {
@@ -352,6 +357,7 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
}
myParamTable = createParameterTableComponent();
myParamTable.setMinimumSize(new Dimension(500, 100));
myCenterPanel.add(myParamTable, BorderLayout.CENTER);
final JTable table = UIUtil.findComponentOfType(myParamTable, JTable.class);
myCenterPanel.add(SeparatorFactory.createSeparator("&Parameters", table), BorderLayout.NORTH);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* 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.
@@ -45,8 +45,6 @@ public class MethodSignatureComponent extends EditorTextField {
setText(signature);
final EditorEx editor = (EditorEx)getEditor();
if (editor != null) {
editor.setHorizontalScrollbarVisible(true);
editor.setVerticalScrollbarVisible(true);
editor.getScrollingModel().scrollVertically(0);
editor.getScrollingModel().scrollHorizontally(0);
}
@@ -60,6 +58,8 @@ public class MethodSignatureComponent extends EditorTextField {
editor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(getProject(), fileName));
}
editor.getSettings().setWhitespacesShown(false);
editor.setHorizontalScrollbarVisible(true);
editor.setVerticalScrollbarVisible(true);
return editor;
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.refactoring.extract.method.GroovyExtractMethodDialog">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" 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="48" y="54" width="555" height="380"/>
@@ -8,43 +8,6 @@
<properties/>
<border type="none"/>
<children>
<grid id="181d3" layout-manager="GridLayoutManager" row-count="1" 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>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringBundle" title-key="signature.preview.border.title"/>
<children>
<component id="703ba" class="com.intellij.refactoring.ui.MethodSignatureComponent" binding="mySignature" custom-create="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
<grid id="de338" layout-manager="GridLayoutManager" row-count="1" 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>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="17c7e" class="org.jetbrains.plugins.groovy.refactoring.extract.ParameterTablePanel" binding="myParameterTablePanel" custom-create="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
<component id="26cfa" class="javax.swing.JCheckBox" binding="myCbSpecifyType">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@@ -100,6 +63,12 @@
</grid>
</children>
</grid>
<component id="f6553" class="com.intellij.openapi.ui.Splitter" binding="mySplitter">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>
@@ -21,17 +21,20 @@ import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.help.HelpManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Splitter;
import com.intellij.psi.PsiModifier;
import com.intellij.refactoring.HelpID;
import com.intellij.refactoring.ui.ComboBoxVisibilityPanel;
import com.intellij.refactoring.ui.MethodSignatureComponent;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.IdeBorderFactory;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
import org.jetbrains.plugins.groovy.refactoring.GroovyNamesUtil;
import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringBundle;
import org.jetbrains.plugins.groovy.refactoring.extract.ExtractUtil;
import org.jetbrains.plugins.groovy.refactoring.extract.InitialInfo;
import org.jetbrains.plugins.groovy.refactoring.extract.ParameterTablePanel;
@@ -64,6 +67,7 @@ public class GroovyExtractMethodDialog extends DialogWrapper {
private JLabel myNameLabel;
private MethodSignatureComponent mySignature;
private ComboBoxVisibilityPanel myVisibilityPanel;
private Splitter mySplitter;
private ParameterTablePanel myParameterTablePanel;
private final Project myProject;
@@ -82,6 +86,15 @@ public class GroovyExtractMethodDialog extends DialogWrapper {
update();
}
@Override
protected void init() {
super.init();
mySplitter.setOrientation(true);
mySplitter.setShowDividerIcon(false);
mySplitter.setFirstComponent(myParameterTablePanel);
mySplitter.setSecondComponent(mySignature);
}
protected void doOKAction() {
String name = getEnteredName();
if (name == null) return;
@@ -184,6 +197,9 @@ public class GroovyExtractMethodDialog extends DialogWrapper {
mySignature = new GrMethodSignatureComponent("", myProject);
mySignature.setPreferredSize(new Dimension(500, 100));
mySignature.setMinimumSize(new Dimension(500, 100));
mySignature.setBorder(
IdeBorderFactory.createTitledBorder(GroovyRefactoringBundle.message("signature.preview.border.title"), false, false, true));
mySignature.setFocusable(false);
myNameField = new EditorTextField("", myProject, GroovyFileType.GROOVY_FILE_TYPE);
myVisibilityPanel = new GroovyComboboxVisibilityPanel();