List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_QUICK_JAVADOC
String ACTION_QUICK_JAVADOC
To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_QUICK_JAVADOC.
Click Source Link
From source file:com.intellij.codeInsight.completion.DefaultCompletionContributor.java
License:Apache License
static void addDefaultAdvertisements(@NotNull final CompletionParameters parameters, LookupImpl lookup, boolean includePsiFeatures) { if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_DOT_ETC)) { lookup.addAdvertisement(LangBundle.message("completion.dot.etc.ad"), null); }//from ww w . j ava2s . c o m if (!includePsiFeatures) return; if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_SMART_ENTER)) { final String shortcut = getActionShortcut(IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_COMPLETE_STATEMENT); if (shortcut != null) { lookup.addAdvertisement(LangBundle.message("completion.smart.enter.ad", shortcut), null); } } if ((CompletionUtil.shouldShowFeature(parameters, ShowQuickDocInfoAction.CODEASSISTS_QUICKJAVADOC_FEATURE) || CompletionUtil.shouldShowFeature(parameters, ShowQuickDocInfoAction.CODEASSISTS_QUICKJAVADOC_LOOKUP_FEATURE))) { final String shortcut = getActionShortcut(IdeActions.ACTION_QUICK_JAVADOC); if (shortcut != null) { lookup.addAdvertisement(LangBundle.message("completion.quick.javadoc.ad", shortcut), null); } } if (CompletionUtil.shouldShowFeature(parameters, ShowImplementationsAction.CODEASSISTS_QUICKDEFINITION_FEATURE) || CompletionUtil.shouldShowFeature(parameters, ShowImplementationsAction.CODEASSISTS_QUICKDEFINITION_LOOKUP_FEATURE)) { final String shortcut = getActionShortcut(IdeActions.ACTION_QUICK_IMPLEMENTATIONS); if (shortcut != null) { lookup.addAdvertisement(LangBundle.message("completion.quick.implementations.ad", shortcut), null); } } }
From source file:com.intellij.codeInsight.documentation.DocumentationManager.java
License:Apache License
@NotNull @Override/*from w w w .j a v a 2 s . c om*/ protected AnAction createRestorePopupAction() { AnAction restorePopupAction = super.createRestorePopupAction(); ShortcutSet quickDocShortcut = ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC) .getShortcutSet(); restorePopupAction.registerCustomShortcutSet(quickDocShortcut, null); return restorePopupAction; }
From source file:com.intellij.codeInsight.documentation.DocumentationManager.java
License:Apache License
private void showInPopup(@NotNull final PsiElement element, boolean requestFocus, PopupUpdateProcessor updateProcessor, final PsiElement originalElement, @Nullable final Runnable closeCallback) { final DocumentationComponent component = new DocumentationComponent(this); component.setNavigateCallback(new Consumer<PsiElement>() { @Override//from www . j av a 2 s . c om public void consume(PsiElement psiElement) { final AbstractPopup jbPopup = (AbstractPopup) getDocInfoHint(); if (jbPopup != null) { final String title = getTitle(psiElement, false); jbPopup.setCaption(title); } } }); Processor<JBPopup> pinCallback = new Processor<JBPopup>() { @Override public boolean process(JBPopup popup) { createToolWindow(element, originalElement); myToolWindow.setAutoHide(false); popup.cancel(); return false; } }; ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createToolWindow(element, originalElement); final JBPopup hint = getDocInfoHint(); if (hint != null && hint.isVisible()) hint.cancel(); } }; List<Pair<ActionListener, KeyStroke>> actions = ContainerUtil.newSmartList(); AnAction quickDocAction = ActionManagerEx.getInstanceEx().getAction(IdeActions.ACTION_QUICK_JAVADOC); for (Shortcut shortcut : quickDocAction.getShortcutSet().getShortcuts()) { if (!(shortcut instanceof KeyboardShortcut)) continue; actions.add(Pair.create(actionListener, ((KeyboardShortcut) shortcut).getFirstKeyStroke())); } boolean hasLookup = LookupManager.getActiveLookup(myEditor) != null; final JBPopup hint = JBPopupFactory.getInstance().createComponentPopupBuilder(component, component) .setProject(element.getProject()).addListener(updateProcessor).addUserData(updateProcessor) .setKeyboardActions(actions).setDimensionServiceKey(myProject, JAVADOC_LOCATION_AND_SIZE, false) .setResizable(true).setMovable(true).setRequestFocus(requestFocus) .setCancelOnClickOutside(!hasLookup) // otherwise selecting lookup items by mouse would close the doc .setTitle(getTitle(element, false)).setCouldPin(pinCallback).setModalContext(false) .setCancelCallback(new Computable<Boolean>() { @Override public Boolean compute() { myCloseOnSneeze = false; if (closeCallback != null) { closeCallback.run(); } if (fromQuickSearch()) { ((ChooseByNameBase.JPanelProvider) myPreviouslyFocused.getParent()).unregisterHint(); } Disposer.dispose(component); myEditor = null; myPreviouslyFocused = null; return Boolean.TRUE; } }).setKeyEventHandler(new BooleanFunction<KeyEvent>() { @Override public boolean fun(KeyEvent e) { if (myCloseOnSneeze) { closeDocHint(); } if ((AbstractPopup.isCloseRequest(e) && getDocInfoHint() != null)) { closeDocHint(); return true; } return false; } }).createPopup(); component.setHint(hint); if (myEditor == null) { // subsequent invocation of javadoc popup from completion will have myEditor == null because of cancel invoked, // so reevaluate the editor for proper popup placement Lookup lookup = LookupManager.getInstance(myProject).getActiveLookup(); myEditor = lookup != null ? lookup.getEditor() : null; } fetchDocInfo(getDefaultCollector(element, originalElement), component); myDocInfoHintRef = new WeakReference<JBPopup>(hint); if (fromQuickSearch() && myPreviouslyFocused != null) { ((ChooseByNameBase.JPanelProvider) myPreviouslyFocused.getParent()).registerHint(hint); } }
From source file:com.intellij.ui.TextFieldWithAutoCompletionContributor.java
License:Apache License
@Override public void fillCompletionVariants(final CompletionParameters parameters, CompletionResultSet result) { PsiFile file = parameters.getOriginalFile(); final TextFieldWithAutoCompletionListProvider<T> provider = file.getUserData(KEY); if (provider == null) { return;/* www . j ava 2 s. c o m*/ } String adv = provider.getAdvertisement(); if (adv == null) { final String shortcut = getActionShortcut(IdeActions.ACTION_QUICK_JAVADOC); if (shortcut != null) { adv = provider.getQuickDocHotKeyAdvertisement(shortcut); } } if (adv != null) { result.addLookupAdvertisement(adv); } final String prefix = provider.getPrefix(parameters); if (prefix == null) { return; } if (parameters.getInvocationCount() == 0 && !file.getUserData(AUTO_POPUP_KEY)) { // is autopopup return; } final PrefixMatcher prefixMatcher = provider.createPrefixMatcher(prefix); if (prefixMatcher != null) { result = result.withPrefixMatcher(prefixMatcher); } Collection<T> items = provider.getItems(prefix, true, parameters); addCompletionElements(result, provider, items, -10000); Future<Collection<T>> future = ApplicationManager.getApplication() .executeOnPooledThread(new Callable<Collection<T>>() { @Override public Collection<T> call() { return provider.getItems(prefix, false, parameters); } }); while (true) { try { Collection<T> tasks = future.get(100, TimeUnit.MILLISECONDS); if (tasks != null) { addCompletionElements(result, provider, tasks, 0); return; } } catch (ProcessCanceledException e) { throw e; } catch (Exception ignore) { } ProgressManager.checkCanceled(); } }
From source file:com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable.java
License:Apache License
PropertyInspectorTable(Project project, @NotNull final ComponentTree componentTree) { myProject = project;//from www .j a v a 2 s.c o m myClassToBindProperty = new ClassToBindProperty(project); myBindingProperty = new BindingProperty(project); myBorderProperty = new BorderProperty(project); myPropertyEditorListener = new MyPropertyEditorListener(); myLafManagerListener = new MyLafManagerListener(); myComponentTree = componentTree; myProperties = new ArrayList<Property>(); myExpandedProperties = new HashSet<String>(); myModel = new MyModel(); setModel(myModel); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myCellRenderer = new MyCompositeTableCellRenderer(); myCellEditor = new MyCellEditor(); addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { final int row = rowAtPoint(e.getPoint()); if (row == -1) { return; } final Property property = myProperties.get(row); int indent = getPropertyIndent(property) * 11; final Rectangle rect = getCellRect(row, convertColumnIndexToView(0), false); if (e.getX() < rect.x + indent || e.getX() > rect.x + 9 + indent || e.getY() < rect.y || e.getY() > rect.y + rect.height) { return; } final Property[] children = getPropChildren(property); if (children.length == 0) { return; } if (isPropertyExpanded(property, property.getParent())) { collapseProperty(row); } else { expandProperty(row); } } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { int row = rowAtPoint(e.getPoint()); int column = columnAtPoint(e.getPoint()); if (row >= 0 && column == 0) { final Property property = myProperties.get(row); if (getPropChildren(property).length == 0) { startEditing(row); return true; } } return false; } }.installOn(this); final AnAction quickJavadocAction = ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC); new ShowJavadocAction().registerCustomShortcutSet(quickJavadocAction.getShortcutSet(), this); // Popup menu PopupHandler.installPopupHandler(this, (ActionGroup) ActionManager.getInstance() .getAction(IdeActions.GROUP_GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP), ActionPlaces.GUI_DESIGNER_PROPERTY_INSPECTOR_POPUP, ActionManager.getInstance()); }
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 ww w .j av a 2 s. c om } }; 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); } }); }
From source file:org.cordovastudio.startup.CordovaStudioInitializer.java
License:Apache License
private void hideIdeaActions() { hideAction("NewPackageInfo", "package-info.java"); hideAction("NewForm", "GUI Form"); hideAction("NewDialog", "Dialog"); hideAction("NewFormSnapshot", "Form Snapshot"); replaceAction("Groovy.NewClass", new EmptyAction()); replaceAction("Groovy.NewScript", new EmptyAction()); hideAction("NewModule", "New Module..."); hideAction("NewModuleInGroup", "Module"); hideAction("CreateLibraryFromFile", "Add As Library..."); hideAction("ImportModule", "Import Module..."); //hideAction(IdeActions.GROUP_MOVE_MODULE_TO_GROUP, "Move Module to Group"); hideAction(IdeActions.MODULE_SETTINGS, "Module Settings"); //hideAction(IdeActions.GROUP_WELCOME_SCREEN_DOC, "Docs and How-Tos"); //hideAction(IdeActions.GROUP_WELCOME_SCREEN_QUICKSTART, "WelcomeScreen.QuickStart"); //TODO: find name hideAction(IdeActions.ACTION_EXTERNAL_JAVADOC, "External Documentation"); hideAction(IdeActions.ACTION_QUICK_JAVADOC, "Quick Documentation"); hideAction("AddFrameworkSupport", "Add Framework Support..."); hideAction(IdeActions.ACTION_GENERATE_ANT_BUILD, "Generate Ant Build..."); hideAction("BuildArtifact", "Build Artifacts..."); hideAction("RunTargetAction", "Run Ant Target"); hideAction(IdeActions.ACTION_MAKE_MODULE, "Make Module"); hideAction(IdeActions.ACTION_GENERATE_ANT_BUILD, "Generate Ant Build..."); hideAction(IdeActions.ACTION_INSPECT_CODE, "Inspect Code..."); //hideAction(IdeActions.GROUP_DEBUGGER, "DebuggerActions"); //TODO: find name hideAction(IdeActions.ACTION_DEFAULT_DEBUGGER, "Debug"); hideAction(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT, "Toggle Line Breakpoint"); //hideAction(IdeActions.GROUP_USAGE_VIEW_POPUP, "UsageView.Popup"); //TODO: find name hideAction(IdeActions.ACTION_GOTO_DECLARATION, "Declaration"); hideAction(IdeActions.ACTION_GOTO_TYPE_DECLARATION, "Type Declaration"); hideAction(IdeActions.ACTION_GOTO_IMPLEMENTATION, "Implementation(s)"); hideAction(IdeActions.ACTION_ANALYZE_DEPENDENCIES, "Analyze Dependencies..."); hideAction(IdeActions.ACTION_ANALYZE_BACK_DEPENDENCIES, "Analyze Backward Dependencies..."); hideAction(IdeActions.ACTION_ANALYZE_CYCLIC_DEPENDENCIES, "Analyze Cyclic Dependencies..."); //hideAction(IdeActions.GROUP_REFACTOR, "Refactor"); hideAction(IdeActions.ACTION_TYPE_HIERARCHY, "Class Hierarchy"); hideAction(IdeActions.ACTION_METHOD_HIERARCHY, "Method Hierarchy"); hideAction(IdeActions.ACTION_CALL_HIERARCHY, "Call Hierarchy"); //hideAction(IdeActions.GROUP_TYPE_HIERARCHY_POPUP, "TypeH ierarchy"); //hideAction(IdeActions.GROUP_METHOD_HIERARCHY_POPUP, "Method Hierarchy"); //hideAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP, "Call Hierarchy"); //hideAction(IdeActions.GROUP_COMMANDER_POPUP, "Commander"); //hideAction(IdeActions.GROUP_TESTTREE_POPUP, "TestTreePopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_TESTSTATISTICS_POPUP, "TestStatisticsTablePopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_J2EE_VIEW_POPUP, "J2EEViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_EJB_TRANSACTION_ATTRIBUTES_VIEW_POPUP, "EjbTransactionAttributesViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_EJB_ENVIRONMENT_ENTRIES_VIEW_POPUP, "EjbEnvironmentEntriesViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_EJB_REFERENCES_VIEW_POPUP, "EjbReferencesViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_SECURITY_ROLES_VIEW_POPUP, "SecurityRolesViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_PARAMETERS_VIEW_POPUP, "ParametersViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_SERVLET_MAPPING_VIEW_POPUP, "ServletMappingViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_EJB_RESOURCE_REFERENCES_VIEW_POPUP, "EjbResourceReferencesViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_EJB_RESOURCE_ENVIRONMENT_REFERENCES_VIEW_POPUP, "EjbResourceEnvironmentReferencesViewPopupMenu"); //TODO: find name //hideAction(IdeActions.GROUP_ADD_SUPPORT, "AddSupportGroup"); hideAction(IdeActions.ACTION_QUICK_IMPLEMENTATIONS, "Quick Definition"); }