List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_DELETE
String ACTION_DELETE
To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_DELETE.
Click Source Link
From source file:com.android.tools.idea.uibuilder.editor.NlActionManager.java
License:Apache License
@NotNull private DefaultActionGroup createPopupMenu(@NotNull ActionManager actionManager, @Nullable ScreenView screenView, @Nullable NlComponent leafComponent) { DefaultActionGroup group = new DefaultActionGroup(); if (screenView != null) { if (leafComponent != null) { addViewHandlerActions(group, leafComponent, screenView.getSelectionModel().getSelection()); }// ww w . j a v a2 s. c o m group.add(createSelectActionGroup(screenView.getSelectionModel())); group.addSeparator(); } group.add(new MockupEditAction(mySurface)); if (leafComponent != null && Mockup.hasMockupAttribute(leafComponent)) { group.add(new MockupDeleteAction(leafComponent)); } group.addSeparator(); group.add(actionManager.getAction(IdeActions.ACTION_CUT)); group.add(actionManager.getAction(IdeActions.ACTION_COPY)); group.add(actionManager.getAction(IdeActions.ACTION_PASTE)); group.addSeparator(); group.add(actionManager.getAction(IdeActions.ACTION_DELETE)); group.addSeparator(); group.add(myGotoComponentAction); group.add(createRefactoringMenu()); group.add(new SaveScreenshotAction(mySurface)); if (ConvertToConstraintLayoutAction.ENABLED) { group.addSeparator(); group.add(new ConvertToConstraintLayoutAction(mySurface)); } return group; }
From source file:com.vladsch.MissingInActions.actions.MultiplePasteActionBase.java
License:Apache License
@Override final public void actionPerformed(final AnActionEvent e) { Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT); if (!(component instanceof JComponent)) return;/*from w w w. jav a 2 s . c o m*/ final ApplicationSettings settings = ApplicationSettings.getInstance(); final DataContext dataContext = e.getDataContext(); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final Editor editor = CommonDataKeys.EDITOR.getData(dataContext); final JComponent focusedComponent = (JComponent) component; final CopyPasteManagerEx copyPasteManager = CopyPasteManagerEx.getInstanceEx(); final HashMap<Transferable, ClipboardCaretContent> listEntryCarets = new HashMap<>(); final boolean canCreateMultiCarets = editor != null && editor.getCaretModel().supportsMultipleCarets() && getCreateWithCaretsName(editor.getCaretModel().getCaretCount()) != null; final MultiPasteOptionsPane myEmptyContentDescription = new MultiPasteOptionsPane(); final Shortcut[] moveLineUp = CommonUIShortcuts.getMoveLineUp().getShortcuts(); final Shortcut[] moveLineDown = CommonUIShortcuts.getMoveLineDown().getShortcuts(); final boolean[] inContentManipulation = new boolean[] { false }; final boolean[] recreateCarets = new boolean[] { false }; final HashMap<Transferable, String> stringTooLongSuffix = new HashMap<>(); final DelayedRunner delayedRunner = new DelayedRunner(); // Can change according to settings later // myEolText = "?"; //noinspection unchecked final ContentChooser<Transferable>[] choosers = new ContentChooser[] { null }; AwtRunnable listUpdater = new AwtRunnable(true, () -> { if (choosers[0] != null) choosers[0].updateListContents(); }); choosers[0] = new ContentChooser<Transferable>(project, getContentChooserTitle(editor, focusedComponent), true, true) { @Override protected String getStringRepresentationFor(final Transferable content) { //return (String) content.getTransferData(DataFlavor.stringFlavor); return getStringRep(editor, content, settings.isMultiPasteShowEolInViewer(), false, true); } @NotNull @Override protected String getShortStringFor(final Transferable content, final String fullString) { ClipboardCaretContent caretContent = getCaretContent(content); final int caretCount = caretContent == null ? 1 : caretContent.getCaretCount(); String contentText = getStringRep(editor, content, false, false, false); String eolText = settings.isMultiPasteShowEolInList() && contentText.endsWith("\n") && (caretCount == 1 || caretContent.allFullLines()) ? myEolText : ""; stringTooLongSuffix.put(content, eolText); return String.format("[%d] %s", caretCount, super.getShortStringFor(content, contentText)); } @NotNull @Override protected String getShortStringTooLongSuffix(Transferable content) { final String s = stringTooLongSuffix.get(content); return super.getShortStringTooLongSuffix(content) + (s == null ? "" : s); } @Override protected Editor createIdeaEditor(final String text) { delayedRunner.runAll(); final Editor viewer = super.createIdeaEditor(text); final EditorSettings settings = viewer.getSettings(); settings.setFoldingOutlineShown(false); settings.setIndentGuidesShown(false); settings.setLeadingWhitespaceShown(true); settings.setLineMarkerAreaShown(true); settings.setLineNumbersShown(true); settings.setTrailingWhitespaceShown(true); return viewer; } @Override protected void updateViewerForSelection(@NotNull final Editor viewer, @NotNull List<Transferable> allContents, @NotNull int[] selectedIndices) { if (viewer.getDocument().getTextLength() > 0) { // can create highlights in the editor to separate carets final ClipboardCaretContent caretContent; final Transferable content; if (selectedIndices.length > 1) { // combine indices content = EditHelpers.getMergedTransferable(editor, allContents, selectedIndices, true); caretContent = ClipboardCaretContent.studyTransferable(editor, content); } else { int index = selectedIndices[0]; content = allContents.get(index); caretContent = getCaretContent(content); } assert caretContent != null; // convert multi caret text to \n separated ranges final String[] texts = caretContent.getTexts(); if (texts != null) { updateEditorHighlightRegions(viewer, caretContent, settings.isMultiPasteShowEolInViewer()); final FocusAdapter focusAdapter = new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { WriteCommandAction.runWriteCommandAction(viewer.getProject(), () -> { final Document document = viewer.getDocument(); document.setReadOnly(false); document.replaceString(0, document.getTextLength(), getStringRep(editor, content, false, true, false)); document.setReadOnly(true); updateEditorHighlightRegions(viewer, caretContent, false); }); } @Override public void focusLost(final FocusEvent e) { final Document document = viewer.getDocument(); final int textLength = document.getTextLength(); if (textLength > 0) { WriteCommandAction.runWriteCommandAction(viewer.getProject(), () -> { document.setReadOnly(false); document.replaceString(0, document.getTextLength(), getStringRep(editor, content, settings.isMultiPasteShowEolInViewer(), false, true)); document.setReadOnly(true); updateEditorHighlightRegions(viewer, caretContent, settings.isMultiPasteShowEolInViewer()); }); } } }; viewer.getContentComponent().addFocusListener(focusAdapter); delayedRunner.addRunnable(() -> { viewer.getContentComponent().removeFocusListener(focusAdapter); }); } } } private void updateEditorHighlightRegions(@NotNull Editor viewer, ClipboardCaretContent caretContent, boolean multiPasteShowEolInViewer) { final TextRange[] textRanges = caretContent.getTextRanges(); final int iMax = textRanges.length; MarkupModelEx markupModel = (MarkupModelEx) DocumentMarkupModel.forDocument(viewer.getDocument(), project, true); final GutterIconRenderer charLinesSelection = new CaretIconRenderer( PluginIcons.Clipboard_char_lines_caret); final GutterIconRenderer charSelection = new CaretIconRenderer(PluginIcons.Clipboard_char_caret); final GutterIconRenderer lineSelection = new CaretIconRenderer(PluginIcons.Clipboard_line_caret); int offset = 0; markupModel.removeAllHighlighters(); for (int i = 0; i < iMax; i++) { final TextRange range = textRanges[i]; final int startOffset = range.getStartOffset() + offset; offset += caretContent.isFullLine(i) && !multiPasteShowEolInViewer && i == iMax - 1 ? 0 : 1; RangeHighlighter highlighter = markupModel .addLineHighlighter(viewer.offsetToLogicalPosition(startOffset).line, 1, null); highlighter.setGutterIconRenderer(caretContent.isFullLine(i) ? lineSelection : caretContent.isCharLine(i) ? charLinesSelection : charSelection); } } @Override protected List<Transferable> getContents() { final Transferable[] contents = copyPasteManager.getAllContents(); final ArrayList<Transferable> list = new ArrayList<>(); list.addAll(Arrays.asList(contents)); list.removeIf(content -> { if (content instanceof StringSelection) { try { final String data = (String) content.getTransferData(DataFlavor.stringFlavor); return data.isEmpty(); } catch (UnsupportedFlavorException e1) { LOG.error("", e1); } catch (IOException e1) { LOG.error("", e1); } } return false; }); return list; } @NotNull @Override public String getSelectedText() { if (choosers[0] == null) { return super.getSelectedText(); } else { final int[] selectedIndices = choosers[0].getSelectedIndices(); if (selectedIndices.length > 1) { // combine indices Transferable content = EditHelpers.getMergedTransferable(editor, choosers[0].getAllContents(), selectedIndices, true); return getStringRep(editor, content, settings.isMultiPasteShowEolInViewer(), false, true); } else { return super.getSelectedText(); } } } @Override protected void removeContentAt(final Transferable content) { copyPasteManager.removeContent(content); listEntryCarets.remove(content); } @Override protected void listKeyPressed(final KeyEvent event) { ContentChooser<Transferable> chooser = choosers[0]; if (event.getKeyCode() != 0 && chooser != null) { if (event.getKeyCode() == KeyEvent.VK_UP && (event.getModifiers() & KeyEvent.ALT_MASK) != 0) { // move selection up moveSelections(chooser, true); event.consume(); } else if (event.getKeyCode() == KeyEvent.VK_DOWN && (event.getModifiers() & KeyEvent.ALT_MASK) != 0) { moveSelections(chooser, false); event.consume(); } } } @NotNull @Override protected Action[] createActions() { Action[] actions = super.createActions(); if (canCreateMultiCarets) { Action[] multiCaretActions = new Action[actions.length + 1]; System.arraycopy(actions, 0, multiCaretActions, 0, actions.length); Action createWithMultiCarets = new OkAction() { @Override protected void doAction(final ActionEvent e) { recreateCarets[0] = true; super.doAction(e); } }; final String name = getCreateWithCaretsName(editor.getCaretModel().getCaretCount()); createWithMultiCarets.putValue(Action.NAME, name == null ? Bundle.message("content-chooser.add-with-carets.label") : name); multiCaretActions[actions.length] = createWithMultiCarets; return multiCaretActions; } return actions; } @NotNull @Override protected Action[] createLeftSideActions() { Action showOptionsAction = new OkAction() { @Override protected void doAction(final ActionEvent e) { final boolean showOptions = !settings.isMultiPasteShowOptions(); settings.setMultiPasteShowOptions(showOptions); putValue(Action.NAME, showOptions ? Bundle.message("content-chooser.hide-options.label") : Bundle.message("content-chooser.show-options.label")); myEmptyContentDescription.myPanel.setVisible(showOptions); } }; final boolean showOptions = settings.isMultiPasteShowOptions(); showOptionsAction.putValue(Action.NAME, showOptions ? Bundle.message("content-chooser.hide-options.label") : Bundle.message("content-chooser.show-options.label")); return new Action[] { showOptionsAction }; } @Nullable @Override protected JComponent getAboveEditorComponent() { String copyShortcut = CommonUIShortcuts .getNthShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY), 1); String deleteShortcut = CommonUIShortcuts .getNthShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_DELETE), 1); String moveLineUpShortcut = CommonUIShortcuts.getNthShortcutText( ActionManager.getInstance().getAction(CommonUIShortcuts.ACTION_MOVE_LINE_UP_ACTION), 2); String moveLineDownShortcut = CommonUIShortcuts.getNthShortcutText( ActionManager.getInstance().getAction(CommonUIShortcuts.ACTION_MOVE_LINE_DOWN_ACTION), 2); if (!copyShortcut.isEmpty()) copyShortcut = String.format(" (%s)", copyShortcut); if (!deleteShortcut.isEmpty()) deleteShortcut = String.format(" (%s)", deleteShortcut); if (!moveLineUpShortcut.isEmpty()) moveLineUpShortcut = String.format(" (%s)", moveLineUpShortcut); if (!moveLineDownShortcut.isEmpty()) moveLineDownShortcut = String.format(" (%s)", moveLineDownShortcut); String bannerSlogan = Bundle.indexedMessage("content-chooser.above-editor.description", copyShortcut, deleteShortcut, moveLineUpShortcut, moveLineDownShortcut); myEmptyContentDescription.setContentBody( Utils.join(bannerSlogan.split("\n"), "<ul align='left'>", "</ul>", "<li>", "</li>")); myEmptyContentDescription.setSettingsChangedRunnable(() -> { if (choosers[0] != null) { final int[] indices = choosers[0].getSelectedIndices(); choosers[0].updateListContents(); choosers[0].setSelectedIndices(indices); } }); myEmptyContentDescription.myPanel.setVisible(settings.isMultiPasteShowOptions()); return myEmptyContentDescription.myPanel; } private void moveSelections(final ContentChooser<Transferable> chooser, boolean moveUp) { final int[] indices = chooser.getSelectedIndices(); final List<Transferable> allContents = new ArrayList<>(chooser.getAllContents()); boolean allConsecutive = true; int firstIndex = -1; int lastIndex = -1; for (int index : indices) { if (firstIndex == -1) { firstIndex = index; lastIndex = index; } else { if (lastIndex + 1 != index) { allConsecutive = false; } lastIndex = index; } } List<Transferable> moved = new ArrayList<>(); int anchorIndex = moveUp ? firstIndex : lastIndex; for (int index : indices) { if (allConsecutive || index != anchorIndex) { moved.add(allContents.get(index)); } } if (!allConsecutive) { allContents.removeAll(moved); allContents.addAll(anchorIndex + (moveUp ? 1 : 0), moved); reOrderContentList(allContents); } else { final int size = lastIndex - firstIndex + 1; final int halfSize = size / 2; if (moveUp) { if (firstIndex <= 0) { // reverse if (halfSize > 0) { for (int i = 0; i < halfSize; i++) { Transferable first = allContents.get(firstIndex + i); Transferable last = allContents.get(lastIndex - i); allContents.set(firstIndex + i, last); allContents.set(lastIndex - i, first); } reOrderContentList(allContents); } } else { allContents.removeAll(moved); allContents.addAll(firstIndex - 1, moved); reOrderContentList(allContents); anchorIndex = firstIndex - 1; } } else { if (lastIndex + 1 >= allContents.size()) { // reverse order if (halfSize > 0) { for (int i = 0; i < halfSize; i++) { Transferable first = allContents.get(firstIndex + i); Transferable last = allContents.get(lastIndex - i); allContents.set(firstIndex + i, last); allContents.set(lastIndex - i, first); } reOrderContentList(allContents); } } else { allContents.removeAll(moved); allContents.addAll(lastIndex + 2 - moved.size(), moved); reOrderContentList(allContents); anchorIndex = lastIndex + 1; } } } chooser.updateListContents(); int index = 0; if (moveUp) { for (int i = anchorIndex; index < indices.length; i++) indices[index++] = i; } else { for (int i = anchorIndex; index < indices.length; i--) indices[index++] = i; } chooser.setSelectedIndices(indices); } private void reOrderContentList(@NotNull List<Transferable> allContents) { inContentManipulation[0] = true; try { int iMax = allContents.size(); Transferable[] currentOrder = copyPasteManager.getAllContents(); int i; for (i = iMax; i-- > 0;) { if (currentOrder[i] != allContents.get(i)) break; } for (i++; i-- > 0;) { copyPasteManager.moveContentToStackTop(allContents.get(i)); } } finally { inContentManipulation[0] = false; } } @Override protected Icon getListEntryIcon(@NotNull final Transferable content) { final ClipboardCaretContent caretContent = getCaretContent(content); return caretContent != null && caretContent.getCaretCount() > 1 ? PluginIcons.Clipboard_carets : PluginIcons.Clipboard_text; } @Nullable private ClipboardCaretContent getCaretContent(final @NotNull Transferable content) { ClipboardCaretContent caretContent = listEntryCarets.get(content); if (!listEntryCarets.containsKey(content)) { caretContent = ClipboardCaretContent.studyTransferable(editor, content); listEntryCarets.put(content, caretContent); } return caretContent; } }; final ContentChooser<Transferable> chooser = choosers[0]; final CopyPasteManager.ContentChangedListener contentChangedListener = new CopyPasteManager.ContentChangedListener() { @Override public void contentChanged(@Nullable final Transferable oldTransferable, final Transferable newTransferable) { if (!inContentManipulation[0]) { listUpdater.run(); } } }; try { copyPasteManager.addContentChangedListener(contentChangedListener); if (!chooser.getAllContents().isEmpty()) { chooser.show(); } else { chooser.close(DialogWrapper.CANCEL_EXIT_CODE); } } finally { copyPasteManager.removeContentChangedListener(contentChangedListener); } if (chooser.isOK()) { final int[] selectedIndices = chooser.getSelectedIndices(); if (selectedIndices.length == 1) { copyPasteManager.moveContentToStackTop(chooser.getAllContents().get(selectedIndices[0])); } else { copyPasteManager.setContents( EditHelpers.getMergedTransferable(editor, chooser.getAllContents(), selectedIndices, true)); } if (editor != null) { if (editor.isViewer()) return; final AnAction pasteAction = getPasteAction(editor, recreateCarets[0]); AnActionEvent newEvent = new AnActionEvent(e.getInputEvent(), DataManager.getInstance().getDataContext(focusedComponent), e.getPlace(), e.getPresentation(), ActionManager.getInstance(), e.getModifiers()); pasteAction.actionPerformed(newEvent); } else { final Action pasteAction = getPasteAction(focusedComponent); if (pasteAction != null) { pasteAction .actionPerformed(new ActionEvent(focusedComponent, ActionEvent.ACTION_PERFORMED, "")); } } } }
From source file:org.cordovastudio.editors.designer.actions.DesignerActionPanel.java
License:Apache License
public DesignerActionPanel(CordovaDesignerEditorPanel designer, JComponent shortcuts) { myDesigner = designer;/*from w w w. j a v a2s. co m*/ myCommonEditActionsProvider = new CommonEditActionsProvider(designer); myShortcuts = shortcuts; createInplaceEditingAction(myShortcuts).setDesignerPanel(designer); myActionGroup = createActionGroup(); myToolbar = createToolbar(); ActionManager actionManager = ActionManager.getInstance(); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_CUT)); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_COPY)); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_PASTE)); myPopupGroup.addSeparator(); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_DELETE)); myPopupGroup.addSeparator(); myPopupGroup.add(createSelectActionGroup(designer)); myPopupGroup.addSeparator(); myPopupGroup.add(myDynamicPopupGroup); designer.getSurfaceArea().addSelectionListener(new ComponentSelectionListener() { @Override public void selectionChanged(IEditableArea area) { updateSelectionActions(area.getSelection()); } }); }
From source file:org.cordovastudio.editors.designer.CordovaDesignerActionPanel.java
License:Apache License
public CordovaDesignerActionPanel(CordovaDesignerEditorPanel designer, JComponent shortcuts) { myDesigner = designer;//w ww. j a v a 2 s. c o m myCommonEditActionsProvider = new CommonEditActionsProvider(designer); myShortcuts = shortcuts; createInplaceEditingAction(myShortcuts).setDesignerPanel(designer); myActionGroup = createActionGroup(); myToolbar = createToolbar(); ActionManager actionManager = ActionManager.getInstance(); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_CUT)); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_COPY)); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_PASTE)); myPopupGroup.addSeparator(); myPopupGroup.add(actionManager.getAction(IdeActions.ACTION_DELETE)); myPopupGroup.addSeparator(); myPopupGroup.add(createSelectActionGroup(designer)); myPopupGroup.addSeparator(); myPopupGroup.add(myDynamicPopupGroup); designer.getSurfaceArea().addSelectionListener(new ComponentSelectionListener() { @Override public void selectionChanged(IEditableArea area) { updateSelectionActions(area.getSelection()); } }); }
From source file:org.cordovastudio.editors.designer.designSurface.CaptionPanel.java
License:Apache License
public CaptionPanel(CordovaDesignerEditorPanel designer, boolean horizontal, boolean addBorder) { if (addBorder) { setBorder(IdeBorderFactory.createBorder(horizontal ? SideBorder.BOTTOM : SideBorder.RIGHT)); }//ww w .j av a 2s .c om setFocusable(true); myHorizontal = horizontal; myMainArea = designer.getSurfaceArea(); myRootComponent = new RadVisualComponent() { @Override public List<RadComponent> getChildren() { return myRootChildren; } @Override public boolean canDelete() { return false; } }; myRootComponent.setNativeComponent(this); if (horizontal) { myRootComponent.setBounds(0, 0, 100000, SIZE); } else { myRootComponent.setBounds(0, 0, SIZE, 100000); } myArea = new ComponentEditableArea(this) { @Override protected void fireSelectionChanged() { super.fireSelectionChanged(); revalidate(); repaint(); } @Override public RadComponent findTarget(int x, int y, @Nullable ComponentTargetFilter filter) { FindComponentVisitor visitor = new FindComponentVisitor(CaptionPanel.this, filter, x, y); myRootComponent.accept(visitor, false); return visitor.getResult(); } @Override public InputTool findTargetTool(int x, int y) { return myDecorationLayer.findTargetTool(x, y); } @Override public void showSelection(boolean value) { myDecorationLayer.showSelection(value); } @Override public ComponentDecorator getRootSelectionDecorator() { return EmptyComponentDecorator.INSTANCE; } @Override public EditOperation processRootOperation(OperationContext context) { return null; } @Override public FeedbackLayer getFeedbackLayer() { return myFeedbackLayer; } @Override public RadComponent getRootComponent() { return myRootComponent; } @Override public ActionGroup getPopupActions() { if (myActionGroup == null) { myActionGroup = new DefaultActionGroup(); myActionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_DELETE)); } return myActionGroup; } @Override public String getPopupPlace() { return "UIDesigner.CaptionPanel"; } }; add(new GlassLayer(designer.getToolProvider(), myArea), CordovaDesignerEditorPanel.LAYER_GLASS); myDecorationLayer = new DecorationLayer(designer, myArea); add(myDecorationLayer, CordovaDesignerEditorPanel.LAYER_DECORATION); myFeedbackLayer = new FeedbackLayer(); add(myFeedbackLayer, CordovaDesignerEditorPanel.LAYER_FEEDBACK); myActionsProvider = new CommonEditActionsProvider(designer) { @Override protected IEditableArea getArea(DataContext dataContext) { return myArea; } }; myMainArea.addSelectionListener(new ComponentSelectionListener() { @Override public void selectionChanged(IEditableArea area) { update(); } }); }
From source file:org.cordovastudio.editors.designer.propertyTable.PropertyTablePanel.java
License:Apache License
public PropertyTablePanel(final Project project) { myPropertyTable = new RadPropertyTable(project) { protected void updateEditActions() { updateActions();//from www .j a v a2 s . com } }; setLayout(new GridBagLayout()); int gridX = 0; myTitleLabel = new JLabel(CordovaDesignerBundle.message("designer.properties.title")); myTitleLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL)); add(myTitleLabel, new GridBagConstraints(gridX++, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 10), 0, 0)); ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup actionGroup = new DefaultActionGroup(); //TODO: remove JavaDoc as it's not needed for Cordova projects! ShowJavadoc showJavadoc = new ShowJavadoc(myPropertyTable); showJavadoc.registerCustomShortcutSet( actionManager.getAction(IdeActions.ACTION_QUICK_JAVADOC).getShortcutSet(), myPropertyTable); actionGroup.add(showJavadoc); actionGroup.addSeparator(); RestoreDefault restoreDefault = new RestoreDefault(myPropertyTable); // Don't register ACTION_DELETE on Mac; on Mac, the default delete key is VK_DELETE rather than VK_BACK_SPACE // which means users end up accidentally restoring to default when trying to edit inside property editors. if (!SystemInfo.isMac) { restoreDefault.registerCustomShortcutSet( actionManager.getAction(IdeActions.ACTION_DELETE).getShortcutSet(), myPropertyTable); } actionGroup.add(restoreDefault); actionGroup.add(new ShowExpert(myPropertyTable)); myTabPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0)); add(myTabPanel, new GridBagConstraints(gridX++, 0, 1, 1, 1, 0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); myActionPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0)); add(myActionPanel, new GridBagConstraints(gridX++, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 0, 2, 2), 0, 0)); myActions = actionGroup.getChildren(null); for (AnAction action : myActions) { if (action instanceof Separator) { continue; } Presentation presentation = action.getTemplatePresentation(); ActionButton button = new ActionButton(action, presentation, ActionPlaces.UNKNOWN, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE); myActionPanel.add(button); presentation.putClientProperty(BUTTON_KEY, button); } actionGroup.add(new ShowColumns(myPropertyTable)); PopupHandler.installPopupHandler(myPropertyTable, actionGroup, ActionPlaces.GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP, actionManager); myPropertyTable.getSelectionModel().addListSelectionListener(this); valueChanged(null); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myPropertyTable); scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP)); myPropertyTable.initQuickFixManager(scrollPane.getViewport()); add(scrollPane, new GridBagConstraints(0, 1, gridX, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); myPropertyTable.setPropertyTablePanel(this); addMouseListener(new MouseAdapter() { public void mouseReleased(final MouseEvent e) { IdeFocusManager.getInstance(project).requestFocus(myPropertyTable, true); } }); }