mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Copy button in ConfigurationArgumentsHelpArea (see Run Configurations -> Remote for example)
This commit is contained in:
+6
-8
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.ui.ConfigurationArgumentsHelpArea">
|
||||
<grid id="f0e0b" binding="myPanel" layout-manager="GridBagLayout">
|
||||
<grid id="f0e0b" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" 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="47" y="46" width="482" height="239"/>
|
||||
<xy x="47" y="46" width="488" height="239"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="25a8e" class="javax.swing.JLabel" binding="myLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<labelFor value="9e177"/>
|
||||
@@ -19,8 +19,7 @@
|
||||
</component>
|
||||
<scrollpane id="f35c0" class="com.intellij.ui.components.JBScrollPane">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="1.0" weighty="1.0"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -38,8 +37,7 @@
|
||||
</scrollpane>
|
||||
<grid id="f141e" binding="myToolbarPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="1.0" weighty="0.0"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
|
||||
+17
-4
@@ -18,11 +18,15 @@ package com.intellij.execution.ui;
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.ui.FixedSizeButton;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class ConfigurationArgumentsHelpArea extends JPanel {
|
||||
private JTextArea myHelpArea;
|
||||
@@ -32,6 +36,8 @@ public class ConfigurationArgumentsHelpArea extends JPanel {
|
||||
|
||||
public ConfigurationArgumentsHelpArea() {
|
||||
super(new BorderLayout());
|
||||
add(myPanel);
|
||||
|
||||
final DefaultActionGroup group = new DefaultActionGroup();
|
||||
group.add(new MyCopyAction());
|
||||
myHelpArea.addMouseListener(
|
||||
@@ -41,10 +47,17 @@ public class ConfigurationArgumentsHelpArea extends JPanel {
|
||||
}
|
||||
}
|
||||
);
|
||||
add(myPanel);
|
||||
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
|
||||
toolbar.setMiniMode(true);
|
||||
myToolbarPanel.add(toolbar.getComponent(), BorderLayout.SOUTH);
|
||||
|
||||
FixedSizeButton copyButton = new FixedSizeButton(22);
|
||||
copyButton.setIcon(PlatformIcons.DUPLICATE_ICON);
|
||||
copyButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final StringSelection contents = new StringSelection(myHelpArea.getText().trim());
|
||||
CopyPasteManager.getInstance().setContents(contents);
|
||||
}
|
||||
});
|
||||
myToolbarPanel.add(copyButton, BorderLayout.CENTER);
|
||||
myToolbarPanel.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user