mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Some forms refactored
This commit is contained in:
+28
-21
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesDialog">
|
||||
<grid id="1a398" binding="myMainPanel" layout-manager="GridBagLayout">
|
||||
<grid id="1a398" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="10" y="10" width="472" height="210"/>
|
||||
<xy x="10" y="10" width="472" height="414"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none">
|
||||
@@ -11,15 +12,17 @@
|
||||
<children>
|
||||
<component id="ec4f" class="javax.swing.JLabel" binding="myNameLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="6" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<gridbag top="4" left="8" bottom="4" right="8" weightx="1.0" weighty="1.0"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
<font style="1"/>
|
||||
<text value="Move"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="74471" class="com.intellij.ui.NonFocusableCheckBox" binding="myCbSearchInComments">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<gridbag top="4" left="8" bottom="4" right="8" weightx="1.0" weighty="1.0"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
@@ -28,8 +31,7 @@
|
||||
</component>
|
||||
<component id="a7936" class="com.intellij.ui.NonFocusableCheckBox" binding="myCbSearchTextOccurences">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<gridbag top="4" left="8" bottom="4" right="8" weightx="1.0" weighty="1.0"/>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
@@ -39,13 +41,14 @@
|
||||
<grid id="495ba" binding="myCardPanel" custom-create="true" layout-manager="CardLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<gridbag top="4" left="8" bottom="4" right="8" weightx="1.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<border type="none">
|
||||
<size top="8" left="0" bottom="8" right="0"/>
|
||||
</border>
|
||||
<children>
|
||||
<grid id="fced3" binding="myMoveClassPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<grid id="fced3" binding="myMoveClassPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="7" left="0" bottom="7" right="0"/>
|
||||
<constraints>
|
||||
<card name="Class"/>
|
||||
</constraints>
|
||||
@@ -54,7 +57,7 @@
|
||||
<children>
|
||||
<component id="63b06" class="javax.swing.JRadioButton" binding="myToPackageRadioButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
@@ -63,7 +66,7 @@
|
||||
</component>
|
||||
<component id="37e02" class="javax.swing.JRadioButton" binding="myMakeInnerClassOfRadioButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/RefactoringBundle" key="move.classes.destination.make.inner"/>
|
||||
@@ -71,20 +74,20 @@
|
||||
</component>
|
||||
<component id="37672" class="com.intellij.ui.ReferenceEditorComboWithBrowseButton" binding="myClassPackageChooser" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="2" use-parent-layout="false"/>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="797f7" class="com.intellij.ui.ReferenceEditorWithBrowseButton" binding="myInnerClassChooser" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="2" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="82ea2" binding="myMovePackagePanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<margin top="7" left="0" bottom="7" right="0"/>
|
||||
<constraints>
|
||||
<card name="Package"/>
|
||||
</constraints>
|
||||
@@ -112,8 +115,7 @@
|
||||
<grid id="ce694" binding="myTargetPanel" layout-manager="GridLayoutManager" row-count="2" 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="2" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<gridbag top="4" left="8" bottom="4" right="8" weightx="0.0" weighty="0.0"/>
|
||||
<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/>
|
||||
<border type="none"/>
|
||||
@@ -129,12 +131,17 @@
|
||||
</component>
|
||||
<component id="36327" class="com.intellij.ui.ComboboxWithBrowseButton" binding="myDestinationFolderCB" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="fdc31">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<buttonGroups>
|
||||
|
||||
+32
-40
@@ -38,7 +38,9 @@ import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.RecentsManager;
|
||||
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton;
|
||||
import com.intellij.ui.components.JBLabelDecorator;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ui.FormBuilder;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
@@ -49,7 +51,7 @@ import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
class CopyFilesOrDirectoriesDialog extends DialogWrapper {
|
||||
private JLabel myInformationLabel;
|
||||
private TextFieldWithHistoryWithBrowseButton myTargetDirectoryField;
|
||||
private JTextField myNewNameField;
|
||||
@@ -104,7 +106,8 @@ class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
}
|
||||
|
||||
if (myShowDirectoryField) {
|
||||
myTargetDirectoryField.getChildComponent().setText(defaultTargetDirectory == null ? "" : defaultTargetDirectory.getVirtualFile().getPresentableUrl());
|
||||
myTargetDirectoryField.getChildComponent()
|
||||
.setText(defaultTargetDirectory == null ? "" : defaultTargetDirectory.getVirtualFile().getPresentableUrl());
|
||||
}
|
||||
validateOKButton();
|
||||
}
|
||||
@@ -131,8 +134,8 @@ class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
}
|
||||
}
|
||||
|
||||
protected Action[] createActions(){
|
||||
return new Action[]{getOKAction(),getCancelAction(),getHelpAction()};
|
||||
protected Action[] createActions() {
|
||||
return new Action[]{getOKAction(), getCancelAction(), getHelpAction()};
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
@@ -144,63 +147,47 @@ class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
}
|
||||
|
||||
protected JComponent createNorthPanel() {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
|
||||
myInformationLabel = new JLabel();
|
||||
|
||||
panel.add(myInformationLabel, new GridBagConstraints(0,0,2,1,1,0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,8,4,8),0,0));
|
||||
|
||||
myInformationLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
|
||||
final FormBuilder formBuilder = FormBuilder.createFormBuilder().addComponent(myInformationLabel).addVerticalGap(
|
||||
UIUtil.LARGE_VGAP - UIUtil.DEFAULT_VGAP);
|
||||
DocumentListener documentListener = new DocumentAdapter() {
|
||||
public void textChanged(DocumentEvent event) {
|
||||
validateOKButton();
|
||||
}
|
||||
};
|
||||
|
||||
if (myShowNewNameField) {
|
||||
myNewNameField = new JTextField();
|
||||
Dimension size = myNewNameField.getPreferredSize();
|
||||
FontMetrics fontMetrics = myNewNameField.getFontMetrics(myNewNameField.getFont());
|
||||
size.width = fontMetrics.charWidth('a') * 60;
|
||||
myNewNameField.setPreferredSize(size);
|
||||
|
||||
panel.add(new JLabel(RefactoringBundle.message("copy.files.new.name.label")), new GridBagConstraints(0,1,1,1,0,0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,8,4,8),0,0));
|
||||
|
||||
panel.add(myNewNameField, new GridBagConstraints(1,1,1,1,1,0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,0,4,8),0,0));
|
||||
|
||||
myNewNameField = new JTextField(60);
|
||||
myNewNameField.getDocument().addDocumentListener(documentListener);
|
||||
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNewNameField);
|
||||
}
|
||||
|
||||
if (myShowDirectoryField) {
|
||||
panel.add(new JLabel(RefactoringBundle.message("copy.files.to.directory.label")), new GridBagConstraints(0,2,1,1,0,0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,8,4,8),0,0));
|
||||
|
||||
myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
|
||||
final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
|
||||
|
||||
if (recentEntries != null) {
|
||||
myTargetDirectoryField.getChildComponent().setHistory(recentEntries);
|
||||
}
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
|
||||
RefactoringBundle.message("the.file.will.be.copied.to.this.directory"),
|
||||
myProject, descriptor,
|
||||
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
|
||||
|
||||
RefactoringBundle.message("the.file.will.be.copied.to.this.directory"),
|
||||
myProject, descriptor,
|
||||
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
|
||||
myTargetDirectoryField.setTextFieldPreferredWidth(60);
|
||||
panel.add(myTargetDirectoryField, new GridBagConstraints(1,2,1,1,1,0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,0,2,8),0,0));
|
||||
|
||||
myTargetDirectoryField.getChildComponent().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
protected void textChanged(DocumentEvent e) {
|
||||
validateOKButton();
|
||||
}
|
||||
});
|
||||
String shortcutText = KeymapUtil
|
||||
.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
|
||||
final JLabel label = new JLabel(RefactoringBundle.message("path.completion.shortcut", shortcutText));
|
||||
UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, label);
|
||||
panel.add(label, new GridBagConstraints(1,3,2,1,1,0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,6,4,8), 0,0));
|
||||
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.to.directory.label"), myTargetDirectoryField);
|
||||
|
||||
String shortcutText =
|
||||
KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
|
||||
formBuilder.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText));
|
||||
}
|
||||
|
||||
return panel;
|
||||
return formBuilder.getPanel();
|
||||
}
|
||||
|
||||
public PsiDirectory getTargetDirectory() {
|
||||
@@ -211,12 +198,13 @@ class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
return myNewNameField != null ? myNewNameField.getText().trim() : null;
|
||||
}
|
||||
|
||||
protected void doOKAction(){
|
||||
protected void doOKAction() {
|
||||
if (myShowNewNameField) {
|
||||
String newName = getNewName();
|
||||
|
||||
if (newName.length() == 0) {
|
||||
Messages.showMessageDialog(myProject, RefactoringBundle.message("no.new.name.specified"), RefactoringBundle.message("error.title"), Messages.getErrorIcon());
|
||||
Messages.showMessageDialog(myProject, RefactoringBundle.message("no.new.name.specified"), RefactoringBundle.message("error.title"),
|
||||
Messages.getErrorIcon());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +213,8 @@ class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
final String targetDirectoryName = myTargetDirectoryField.getChildComponent().getText();
|
||||
|
||||
if (targetDirectoryName.length() == 0) {
|
||||
Messages.showMessageDialog(myProject, RefactoringBundle.message("no.target.directory.specified"), RefactoringBundle.message("error.title"), Messages.getErrorIcon());
|
||||
Messages.showMessageDialog(myProject, RefactoringBundle.message("no.target.directory.specified"),
|
||||
RefactoringBundle.message("error.title"), Messages.getErrorIcon());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,7 +225,8 @@ class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
myTargetDirectory = DirectoryUtil.mkdirs(PsiManager.getInstance(myProject), targetDirectoryName.replace(File.separatorChar, '/'));
|
||||
myTargetDirectory =
|
||||
DirectoryUtil.mkdirs(PsiManager.getInstance(myProject), targetDirectoryName.replace(File.separatorChar, '/'));
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
}
|
||||
@@ -246,7 +236,9 @@ class CopyFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
}, RefactoringBundle.message("create.directory"), null);
|
||||
|
||||
if (myTargetDirectory == null) {
|
||||
Messages.showMessageDialog(myProject, RefactoringBundle.message("cannot.create.directory"), RefactoringBundle.message("error.title"), Messages.getErrorIcon());
|
||||
Messages
|
||||
.showMessageDialog(myProject, RefactoringBundle.message("cannot.create.directory"), RefactoringBundle.message("error.title"),
|
||||
Messages.getErrorIcon());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+18
-37
@@ -41,17 +41,18 @@ import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.NonFocusableCheckBox;
|
||||
import com.intellij.ui.RecentsManager;
|
||||
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton;
|
||||
import com.intellij.ui.components.JBLabelDecorator;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ui.FormBuilder;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
public class MoveFilesOrDirectoriesDialog extends DialogWrapper {
|
||||
@NonNls private static final String RECENT_KEYS = "MoveFile.RECENT_KEYS";
|
||||
|
||||
public interface Callback {
|
||||
@@ -74,8 +75,8 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
init();
|
||||
}
|
||||
|
||||
protected Action[] createActions(){
|
||||
return new Action[]{getOKAction(),getCancelAction(),getHelpAction()};
|
||||
protected Action[] createActions() {
|
||||
return new Action[]{getOKAction(), getCancelAction(), getHelpAction()};
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
@@ -87,20 +88,8 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
}
|
||||
|
||||
protected JComponent createNorthPanel() {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
final GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.insets = new Insets(0, 2, 0, 0);
|
||||
myNameLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
|
||||
|
||||
myNameLabel = new JLabel();
|
||||
panel.add(myNameLabel, c);
|
||||
c.insets.top = 10;
|
||||
c.gridy++;
|
||||
panel.add(new JLabel(RefactoringBundle.message("move.files.to.directory.label")), c);
|
||||
c.insets.top = 0;
|
||||
|
||||
myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
|
||||
final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
|
||||
if (recentEntries != null) {
|
||||
@@ -114,33 +103,24 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
|
||||
final JTextField textField = myTargetDirectoryField.getChildComponent().getTextEditor();
|
||||
FileChooserFactory.getInstance().installFileCompletion(textField, descriptor, true, getDisposable());
|
||||
myTargetDirectoryField.setTextFieldPreferredWidth(60);
|
||||
c.insets.left = 0;
|
||||
c.gridy++;
|
||||
panel.add(myTargetDirectoryField, c);
|
||||
String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
|
||||
final JLabel label = new JLabel(RefactoringBundle.message("path.completion.shortcut", shortcutText));
|
||||
UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, label);
|
||||
c.insets.left = 6;
|
||||
c.gridy++;
|
||||
panel.add(label, c);
|
||||
|
||||
myCbSearchForReferences = new NonFocusableCheckBox(RefactoringBundle.message("search.for.references"));
|
||||
myCbSearchForReferences.setSelected(RefactoringSettings.getInstance().MOVE_SEARCH_FOR_REFERENCES_FOR_FILE);
|
||||
c.insets.top = 10;
|
||||
c.insets.left = 0;
|
||||
c.gridy++;
|
||||
panel.add(myCbSearchForReferences, c);
|
||||
|
||||
textField.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
protected void textChanged(DocumentEvent e) {
|
||||
validateOKButton();
|
||||
}
|
||||
});
|
||||
myTargetDirectoryField.setTextFieldPreferredWidth(60);
|
||||
Disposer.register(getDisposable(), myTargetDirectoryField);
|
||||
|
||||
return panel;
|
||||
String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
|
||||
|
||||
myCbSearchForReferences = new NonFocusableCheckBox(RefactoringBundle.message("search.for.references"));
|
||||
myCbSearchForReferences.setSelected(RefactoringSettings.getInstance().MOVE_SEARCH_FOR_REFERENCES_FOR_FILE);
|
||||
|
||||
return FormBuilder.createFormBuilder().addComponent(myNameLabel)
|
||||
.addLabeledComponent(RefactoringBundle.message("move.files.to.directory.label"), myTargetDirectoryField, UIUtil.LARGE_VGAP)
|
||||
.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText))
|
||||
.addComponentToRightColumn(myCbSearchForReferences, UIUtil.LARGE_VGAP).getPanel();
|
||||
}
|
||||
|
||||
public void setData(PsiElement[] psiElements, PsiDirectory initialTargetDirectory, @NonNls String helpID) {
|
||||
@@ -170,7 +150,8 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
RefactoringBundle.message("move.specified.elements"));
|
||||
}
|
||||
|
||||
myTargetDirectoryField.getChildComponent().setText(initialTargetDirectory == null ? "" : initialTargetDirectory.getVirtualFile().getPresentableUrl());
|
||||
myTargetDirectoryField.getChildComponent()
|
||||
.setText(initialTargetDirectory == null ? "" : initialTargetDirectory.getVirtualFile().getPresentableUrl());
|
||||
|
||||
validateOKButton();
|
||||
myHelpID = helpID;
|
||||
|
||||
+16
@@ -19,10 +19,12 @@
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
|
||||
import static com.intellij.util.ui.UIUtil.DEFAULT_HGAP;
|
||||
@@ -109,6 +111,20 @@ public class FormBuilder {
|
||||
new Box.Filler(new Dimension(0, height), new Dimension(0, height), new Dimension(Short.MAX_VALUE, height)));
|
||||
}
|
||||
|
||||
public FormBuilder addTooltip(final String text) {
|
||||
final JBLabel label = new JBLabel(text, UIUtil.ComponentStyle.SMALL, UIUtil.FontColor.BRIGHTER);
|
||||
label.setBorder(new EmptyBorder(0, 10, 0, 0));
|
||||
return addComponentToRightColumn(label, 1);
|
||||
}
|
||||
|
||||
public FormBuilder addComponentToRightColumn(@NotNull final JComponent component) {
|
||||
return addComponentToRightColumn(component, myVerticalGap);
|
||||
}
|
||||
|
||||
public FormBuilder addComponentToRightColumn(@NotNull final JComponent component, final int topInset) {
|
||||
return addLabeledComponent(new JLabel(), component, topInset);
|
||||
}
|
||||
|
||||
public FormBuilder addLabeledComponent(@Nullable JComponent label, @NotNull JComponent component, int topInset, boolean labelOnTop) {
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
topInset = myLineCount > 0 ? topInset : 0;
|
||||
@@ -7,9 +7,6 @@ import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ui.FormBuilder;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.github.tasks.GitHubRepository;
|
||||
import com.intellij.util.ui.FormBuilder;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.intellij.tasks.config.BaseRepositoryEditor;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ui.FormBuilder;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -54,15 +53,12 @@ public class WebRepositoryEditor extends BaseRepositoryEditor<WebRepository> {
|
||||
return FormBuilder.createFormBuilder().setAlignLabelOnRight(true)
|
||||
.addVerticalGap(8)
|
||||
.addLabeledComponent(myTasksListURLLabel, myTasksListURLText)
|
||||
.addLabeledComponent(new JLabel(), new JBLabel("Available placeholders: " + WebRepository.SERVER_URL_PLACEHOLDER, UIUtil.ComponentStyle.SMALL,
|
||||
UIUtil.FontColor.BRIGHTER), 1)
|
||||
.addTooltip("Available placeholders: " + WebRepository.SERVER_URL_PLACEHOLDER)
|
||||
.addLabeledComponent(myTaskPatternLabel, myTaskPatternText, 8)
|
||||
.addLabeledComponent(new JLabel(), new JBLabel("Task pattern should be a regexp with two matching group: ({id}.+?) and ({summary}.+?)",
|
||||
UIUtil.ComponentStyle.SMALL, UIUtil.FontColor.BRIGHTER), 1)
|
||||
.addTooltip("Task pattern should be a regexp with two matching group: ({id}.+?) and ({summary}.+?)")
|
||||
.addLabeledComponent(myLoginURLLabel, myLoginURLText, 8)
|
||||
.addLabeledComponent(new JLabel(), new JBLabel("Available placeholders: " + WebRepository.SERVER_URL_PLACEHOLDER + ", " +
|
||||
WebRepository.USERNAME_PLACEHOLDER + ", " + WebRepository.PASSWORD_PLACEHOLDER, UIUtil.ComponentStyle.SMALL,
|
||||
UIUtil.FontColor.BRIGHTER), 1)
|
||||
.addTooltip("Available placeholders: " + WebRepository.SERVER_URL_PLACEHOLDER + ", " +
|
||||
WebRepository.USERNAME_PLACEHOLDER + ", " + WebRepository.PASSWORD_PLACEHOLDER)
|
||||
.addVerticalGap(8)
|
||||
.getPanel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user