本文整理汇总了Java中com.intellij.ui.AnActionButton类的典型用法代码示例。如果您正苦于以下问题:Java AnActionButton类的具体用法?Java AnActionButton怎么用?Java AnActionButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnActionButton类属于com.intellij.ui包,在下文中一共展示了AnActionButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@Override
public void run(AnActionButton button) {
// 获取选中节点
final DefaultMutableTreeNode selectedNode = getSelectedNode();
if (selectedNode == null) {
return;
}
List<AnAction> actions = getMultipleActions(selectedNode);
if (actions == null || actions.isEmpty()) {
return;
}
// 显示新增按钮
final DefaultActionGroup group = new DefaultActionGroup(actions);
JBPopupFactory.getInstance()
.createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(button.getContextComponent()),
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).show(button.getPreferredPopupPoint());
}
示例2: editAction
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@NotNull
public CheckBoxListModelEditor<T> editAction(final @NotNull Function<T, T> consumer) {
final Runnable action = new Runnable() {
@Override
public void run() {
T item = getSelectedItem();
if (item != null) {
T newItem = consumer.fun(item);
if (newItem != null) {
list.updateItem(item, newItem, StringUtil.notNullize(toNameConverter.fun(newItem)));
}
list.requestFocus();
}
}
};
toolbarDecorator.setEditAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
action.run();
}
});
EditSourceOnDoubleClickHandler.install(list, action);
return this;
}
示例3: getEditActionButtonRunnable
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
private AnActionButtonRunnable getEditActionButtonRunnable(Set<String> patterns) {
return new AnActionButtonRunnable() {
@Override
public void run(AnActionButton anActionButton) {
String oldValue = (String) patternList.getSelectedValue();
String pattern = Messages.showInputDialog(
textEditMessage, textEditTitle, null, oldValue, getRegexInputValidator());
if (pattern != null && !pattern.equals(oldValue)) {
patterns.remove(oldValue);
patternModels.removeElement(oldValue);
if (patterns.add(pattern)) {
patternModels.addElementSorted(pattern);
}
}
}
};
}
示例4: getRemoveAction
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
private AnActionButtonRunnable getRemoveAction(final TableView<XQueryRunVariable> variablesTable) {
return new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
TableUtil.stopEditing(variablesTable);
final int[] selected = variablesTable.getSelectedRows();
if (selected == null || selected.length == 0) return;
for (int i = selected.length - 1; i >= 0; i--) {
variablesModel.removeRow(selected[i]);
}
for (int i = selected.length - 1; i >= 0; i--) {
int idx = selected[i];
variablesModel.fireTableRowsDeleted(idx, idx);
}
int selection = selected[0];
if (selection >= variablesModel.getRowCount()) {
selection = variablesModel.getRowCount() - 1;
}
if (selection >= 0) {
variablesTable.setRowSelectionInterval(selection, selection);
}
variablesTable.requestFocus();
}
};
}
示例5: getAddAction
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
private AnActionButtonRunnable getAddAction(final TableView<XQueryRunVariable> variablesTable) {
return new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
XQueryRunVariable newVariable = new XQueryRunVariable();
if (showEditorDialog(newVariable)) {
ArrayList<XQueryRunVariable> newList = new ArrayList<XQueryRunVariable>(variablesModel
.getItems());
newList.add(newVariable);
variablesModel.setItems(newList);
int index = variablesModel.getRowCount() - 1;
variablesModel.fireTableRowsInserted(index, index);
variablesTable.setRowSelectionInterval(index, index);
}
}
};
}
示例6: shouldRemoveEntryAfterRemoveButtonClicked
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@Test
public void shouldRemoveEntryAfterRemoveButtonClicked() {
panel.populateWithConfigurations(asList(defaultDataSource));
final AnActionButton action = getAnActionButton(REMOVE);
final AnActionEvent event = new TestActionEvent(action);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
action.actionPerformed(event);
}
});
window.list().requireNoSelection();
assertThat(window.list().contents().length, is(0));
}
示例7: addWebDeploymentButton
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
private void addWebDeploymentButton(ToolbarDecorator tablePanel) {
tablePanel.addExtraAction(new AnActionButton("Remote", WebDeploymentIcons.Download) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
UiSettingsUtil.openFileDialogForDefaultWebServerConnection(project, new WebServerFileDialogExtensionCallback("xml") {
@Override
public void success(@NotNull WebServerConfig server, @NotNull WebServerConfig.RemotePath remotePath) {
ContainerSettingsForm.this.tableView.getListTableModel().addRow(
new ContainerFile("remote://" + org.apache.commons.lang.StringUtils.stripStart(remotePath.path, "/"))
);
ContainerSettingsForm.this.changed = true;
}
});
}
});
}
示例8: addWebDeploymentButton
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
private void addWebDeploymentButton(ToolbarDecorator tablePanel) {
tablePanel.addExtraAction(new AnActionButton("Remote", WebDeploymentIcons.Download) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
UiSettingsUtil.openFileDialogForDefaultWebServerConnection(project, new WebServerFileDialogExtensionCallback("php") {
@Override
public void success(@NotNull WebServerConfig server, @NotNull WebServerConfig.RemotePath remotePath) {
RoutingSettingsForm.this.tableView.getListTableModel().addRow(
new RoutingFile("remote://" + org.apache.commons.lang.StringUtils.stripStart(remotePath.path, "/"))
);
RoutingSettingsForm.this.changed = true;
}
});
}
});
}
示例9: createAddRemovePanel
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
public static JPanel createAddRemovePanel(final ListTable table) {
return ToolbarDecorator.createDecorator(table)
.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
final ListWrappingTableModel tableModel = table.getModel();
tableModel.addRow();
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
final int lastRowIndex = tableModel.getRowCount() - 1;
final Rectangle rectangle = table.getCellRect(lastRowIndex, 0, true);
table.scrollRectToVisible(rectangle);
table.editCellAt(lastRowIndex, 0);
final ListSelectionModel selectionModel = table.getSelectionModel();
selectionModel.setSelectionInterval(lastRowIndex, lastRowIndex);
final TableCellEditor editor = table.getCellEditor();
final Component component = editor.getTableCellEditorComponent(table, null, true, lastRowIndex, 0);
component.requestFocus();
}
});
}
}).setRemoveAction(new RemoveAction(table))
.disableUpDownActions().createPanel();
}
示例10: run
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@Override
public void run(AnActionButton button)
{
final int selectedRow = myRendererChooser.getSelectedElementRow();
if(selectedRow < 0)
{
return;
}
int newRow = selectedRow + (myMoveUp ? -1 : 1);
if(newRow < 0)
{
newRow = myRendererChooser.getElementCount() - 1;
}
else if(newRow >= myRendererChooser.getElementCount())
{
newRow = 0;
}
myRendererChooser.moveElement(myRendererChooser.getElementAt(selectedRow), newRow);
}
示例11: run
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@Override
public void run(AnActionButton button) {
DefaultMutableTreeNode selectedNode = getSelectedNode();
if (selectedNode != null && selectedNode.getParent() != null) {
// 删除指定节点
DefaultTreeModel model = (DefaultTreeModel) this.templateTree.getModel();
model.removeNodeFromParent(selectedNode);
}
}
示例12: run
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@Override
public void run(AnActionButton button) {
final NodeRenderer renderer = (NodeRenderer)NodeRendererSettings.getInstance().createRenderer(CompoundNodeRenderer.UNIQUE_ID);
renderer.setEnabled(true);
addRenderer(renderer);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
myNameField.requestFocus();
}
});
}
示例13: addToolbarButtons
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@Override
protected void addToolbarButtons(ToolbarDecorator toolbarDecorator) {
AnActionButton reloadButton = new AnActionButton(PyBundle.message("sdk.paths.dialog.reload.paths"), AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent e) {
onReloadButtonClicked();
}
};
toolbarDecorator.addExtraAction(reloadButton);
}
示例14: showPopupActions
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
/**
* Shows the popup-menu.
*
* @param button The button that was pressed.
*/
private void showPopupActions(final AnActionButton button) {
@Nullable final ActionGroup group = this.addActionPopupGroup;
if (group == null)
return;
JBPopupFactory.getInstance().createActionGroupPopup(null, group,
DataManager.getInstance().getDataContext(button.getContextComponent()),
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true
).show(button.getPreferredPopupPoint());
}
示例15: getRemoveActionButtonRunnable
import com.intellij.ui.AnActionButton; //导入依赖的package包/类
@NotNull
private AnActionButtonRunnable getRemoveActionButtonRunnable(Set<String> patterns) {
return new AnActionButtonRunnable() {
@Override
public void run(AnActionButton anActionButton) {
for (Object object : patternList.getSelectedValues()) {
String selectedValue = (String) object;
patterns.remove(selectedValue);
patternModels.removeElement(selectedValue);
}
}
};
}