com.intellij.find.FindBundle Java Examples
The following examples show how to use
com.intellij.find.FindBundle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractFindUsagesDialog.java From consulo with Apache License 2.0 | 6 votes |
protected AbstractFindUsagesDialog(@Nonnull Project project, @Nonnull FindUsagesOptions findUsagesOptions, boolean toShowInNewTab, boolean mustOpenInNewTab, boolean isSingleFile, boolean searchForTextOccurrencesAvailable, boolean searchInLibrariesAvailable) { super(project, true); myProject = project; myFindUsagesOptions = findUsagesOptions; myToShowInNewTab = toShowInNewTab; myIsShowInNewTabEnabled = !mustOpenInNewTab && UsageViewContentManager.getInstance(myProject).getReusableContentsCount() > 0; myIsShowInNewTabVisible = !isSingleFile; mySearchForTextOccurrencesAvailable = searchForTextOccurrencesAvailable; mySearchInLibrariesAvailable = searchInLibrariesAvailable; myUpdateAction = new ActionListener() { @Override public void actionPerformed(ActionEvent event) { update(); } }; setOKButtonText(FindBundle.message("find.dialog.find.button")); setTitle(isSingleFile ? FindBundle.message("find.usages.in.file.dialog.title") : FindBundle.message("find.usages.dialog.title")); }
Example #2
Source File: ShowUsagesAction.java From otto-intellij-plugin with Apache License 2.0 | 6 votes |
static void chooseAmbiguousTargetAndPerform(@NotNull final Project project, final Editor editor, @NotNull PsiElementProcessor<PsiElement> processor) { if (editor == null) { Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); } else { int offset = editor.getCaretModel().getOffset(); boolean chosen = GotoDeclarationAction.chooseAmbiguousTarget(editor, offset, processor, FindBundle.message("find.usages.ambiguous.title", "crap"), null); if (!chosen) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (editor.isDisposed() || !editor.getComponent().isShowing()) return; HintManager.getInstance().showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error")); } }, project.getDisposed()); } } }
Example #3
Source File: FindUsagesManager.java From consulo with Apache License 2.0 | 6 votes |
private boolean findUsageInFile(@Nonnull FileEditor editor, @Nonnull FileSearchScope direction) { ApplicationManager.getApplication().assertIsDispatchThread(); if (myLastSearchInFileData == null) return false; PsiElement[] primaryElements = myLastSearchInFileData.getPrimaryElements(); PsiElement[] secondaryElements = myLastSearchInFileData.getSecondaryElements(); if (primaryElements.length == 0) {//all elements have been invalidated Messages.showMessageDialog(myProject, FindBundle.message("find.searched.elements.have.been.changed.error"), FindBundle.message("cannot.search.for.usages.title"), Messages.getInformationIcon()); // SCR #10022 //clearFindingNextUsageInFile(); return false; } //todo TextEditor textEditor = (TextEditor)editor; Document document = textEditor.getEditor().getDocument(); PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document); if (psiFile == null) return false; final FindUsagesHandler handler = getFindUsagesHandler(primaryElements[0], false); if (handler == null) return false; findUsagesInEditor(primaryElements, secondaryElements, handler, psiFile, direction, myLastSearchInFileData.myOptions, textEditor); return true; }
Example #4
Source File: AbstractFindUsagesDialog.java From consulo with Apache License 2.0 | 6 votes |
@Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); JPanel _panel = new JPanel(new BorderLayout()); panel.add(_panel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); if (myIsShowInNewTabVisible) { myCbToOpenInNewTab = new JCheckBox(FindBundle.message("find.open.in.new.tab.checkbox")); myCbToOpenInNewTab.setSelected(myToShowInNewTab); myCbToOpenInNewTab.setEnabled(myIsShowInNewTabEnabled); _panel.add(myCbToOpenInNewTab, BorderLayout.EAST); } JPanel allOptionsPanel = createAllOptionsPanel(); if (allOptionsPanel != null) { panel.add(allOptionsPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } return panel; }
Example #5
Source File: LSPReferencesAction.java From lsp4intellij with Apache License 2.0 | 6 votes |
private UsageViewPresentation createPresentation(PsiElement psiElement, FindUsagesOptions options, boolean toOpenInNewTab) { UsageViewPresentation presentation = new UsageViewPresentation(); String scopeString = options.searchScope.getDisplayName(); presentation.setScopeText(scopeString); String usagesString = options.generateUsagesString(); presentation.setUsagesString(usagesString); String title = FindBundle.message("find.usages.of.element.in.scope.panel.title", usagesString, UsageViewUtil.getLongName(psiElement), scopeString); presentation.setTabText(title); presentation.setTabName(FindBundle .message("find.usages.of.element.tab.name", usagesString, UsageViewUtil.getShortName(psiElement))); presentation.setTargetsNodeText(StringUtil.capitalize(UsageViewUtil.getType(psiElement))); presentation.setOpenInNewTab(toOpenInNewTab); presentation.setShowCancelButton(true); return presentation; }
Example #6
Source File: FindUsagesAction.java From consulo with Apache License 2.0 | 6 votes |
static void chooseAmbiguousTargetAndPerform(@Nonnull final Project project, final Editor editor, @Nonnull PsiElementProcessor<PsiElement> processor) { if (editor == null) { Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); } else { int offset = editor.getCaretModel().getOffset(); boolean chosen = GotoDeclarationAction.chooseAmbiguousTarget(editor, offset, processor, FindBundle.message("find.usages.ambiguous.title"), null); if (!chosen) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (editor.isDisposed() || !editor.getComponent().isShowing()) return; HintManager.getInstance().showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error")); } }, project.getDisposed()); } } }
Example #7
Source File: ShowUsagesAction.java From dagger-intellij-plugin with Apache License 2.0 | 6 votes |
static void chooseAmbiguousTargetAndPerform(@NotNull final Project project, final Editor editor, @NotNull PsiElementProcessor<PsiElement> processor) { if (editor == null) { Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); } else { int offset = editor.getCaretModel().getOffset(); boolean chosen = GotoDeclarationAction.chooseAmbiguousTarget(editor, offset, processor, FindBundle.message("find.usages.ambiguous.title", "crap"), null); if (!chosen) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (editor.isDisposed() || !editor.getComponent().isShowing()) return; HintManager.getInstance() .showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error")); } }, project.getDisposed()); } } }
Example #8
Source File: AbstractFindUsagesDialog.java From consulo with Apache License 2.0 | 5 votes |
@Nullable protected JPanel createUsagesOptionsPanel() { JPanel optionsPanel = new JPanel(); optionsPanel.setBorder(IdeBorderFactory.createTitledBorder(FindBundle.message("find.options.group"), true)); optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS)); addUsagesOptions(optionsPanel); return optionsPanel.getComponents().length == 0 ? null : optionsPanel; }
Example #9
Source File: FindPopupDirectoryChooser.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public ValidationInfo validate(@Nonnull FindModel model) { VirtualFile directory = FindInProjectUtil.getDirectory(model); if (directory == null) { return new ValidationInfo(FindBundle.message("find.directory.not.found.error", getDirectory()), myDirectoryComboBox); } return null; }
Example #10
Source File: FindUsagesManager.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static UsageViewPresentation createPresentation(@Nonnull PsiElement psiElement, @Nonnull FindUsagesOptions options, boolean toOpenInNewTab) { UsageViewPresentation presentation = new UsageViewPresentation(); String scopeString = options.searchScope.getDisplayName(); presentation.setScopeText(scopeString); String usagesString = generateUsagesString(options); presentation.setUsagesString(usagesString); String title = FindBundle.message("find.usages.of.element.in.scope.panel.title", usagesString, UsageViewUtil.getLongName(psiElement), scopeString); presentation.setTabText(title); presentation.setTabName(FindBundle.message("find.usages.of.element.tab.name", usagesString, UsageViewUtil.getShortName(psiElement))); presentation.setTargetsNodeText(StringUtil.capitalize(UsageViewUtil.getType(psiElement))); presentation.setOpenInNewTab(toOpenInNewTab); return presentation; }
Example #11
Source File: ClasspathPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { final OrderEntry selectedEntry = getSelectedEntry(); GlobalSearchScope targetScope; if (selectedEntry instanceof ModuleOrderEntry) { final Module module = ((ModuleOrderEntry)selectedEntry).getModule(); LOG.assertTrue(module != null); targetScope = GlobalSearchScope.moduleScope(module); } else { Library library = ((LibraryOrderEntry)selectedEntry).getLibrary(); LOG.assertTrue(library != null); targetScope = new LibraryScope(getProject(), library); } new AnalyzeDependenciesOnSpecifiedTargetHandler(getProject(), new AnalysisScope(myState.getRootModel().getModule()), targetScope) { @Override protected boolean canStartInBackground() { return false; } @Override protected boolean shouldShowDependenciesPanel(List<DependenciesBuilder> builders) { for (DependenciesBuilder builder : builders) { for (Set<PsiFile> files : builder.getDependencies().values()) { if (!files.isEmpty()) { Messages.showInfoMessage(myEntryTable, "Dependencies were successfully collected in \"" + ToolWindowId.DEPENDENCIES + "\" toolwindow", FindBundle.message("find.pointcut.applications.not.found.title")); return true; } } } if (Messages.showOkCancelDialog(myEntryTable, "No code dependencies were found. Would you like to remove the dependency?", CommonBundle.getWarningTitle(), Messages.getWarningIcon()) == DialogWrapper.OK_EXIT_CODE) { removeSelectedItems(TableUtil.removeSelectedItems(myEntryTable)); } return false; } }.analyze(); }
Example #12
Source File: AbstractFindUsagesDialog.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private JComponent createSearchScopePanel() { if (isInFileOnly()) return null; JPanel optionsPanel = new JPanel(new BorderLayout()); String scope = myFindUsagesOptions.searchScope.getDisplayName(); myScopeCombo = new ScopeChooserCombo(myProject, mySearchInLibrariesAvailable, true, scope); Disposer.register(myDisposable, myScopeCombo); optionsPanel.add(myScopeCombo, BorderLayout.CENTER); JComponent separator = SeparatorFactory.createSeparator(FindBundle.message("find.scope.label"), myScopeCombo.getComboBox()); optionsPanel.add(separator, BorderLayout.NORTH); return optionsPanel; }
Example #13
Source File: AbstractFindUsagesDialog.java From consulo with Apache License 2.0 | 5 votes |
protected void addUsagesOptions(JPanel optionsPanel) { if (mySearchForTextOccurrencesAvailable) { myCbToSearchForTextOccurrences = addCheckboxToPanel(FindBundle.message("find.options.search.for.text.occurences.checkbox"), myFindUsagesOptions.isSearchForTextOccurrences, optionsPanel, false); } if (myIsShowInNewTabVisible) { myCbToSkipResultsWhenOneUsage = addCheckboxToPanel(FindBundle.message("find.options.skip.results.tab.with.one.usage.checkbox"), FindSettings.getInstance().isSkipResultsWithOneUsage(), optionsPanel, false); } }
Example #14
Source File: SelectOccurrencesActionHandler.java From consulo with Apache License 2.0 | 5 votes |
protected static void showHint(final Editor editor) { String message = FindBundle.message("select.next.occurence.not.found.message"); final LightweightHint hint = new LightweightHint(HintUtil.createInformationLabel(message)); HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, HintManager.UNDER, HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING, 0, false); }
Example #15
Source File: PsiElement2UsageTargetAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public String getLongDescriptiveName() { SearchScope searchScope = myOptions.searchScope; String scopeString = searchScope.getDisplayName(); PsiElement psiElement = getElement(); return psiElement == null ? UsageViewBundle.message("node.invalid") : FindBundle.message("recent.find.usages.action.popup", StringUtil.capitalize(UsageViewUtil.getType(psiElement)), DescriptiveNameUtil.getDescriptiveName(psiElement), scopeString); }
Example #16
Source File: FindUsagesInFileAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { DataContext dataContext = e.getDataContext(); final Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) return; PsiDocumentManager.getInstance(project).commitAllDocuments(); Editor editor = dataContext.getData(PlatformDataKeys.EDITOR); UsageTarget[] usageTargets = dataContext.getData(UsageView.USAGE_TARGETS_KEY); if (usageTargets != null) { FileEditor fileEditor = dataContext.getData(PlatformDataKeys.FILE_EDITOR); if (fileEditor != null) { usageTargets[0].findUsagesInEditor(fileEditor); } } else if (editor == null) { Messages.showMessageDialog( project, FindBundle.message("find.no.usages.at.cursor.error"), CommonBundle.getErrorTitle(), Messages.getErrorIcon() ); } else { HintManager.getInstance().showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error")); } }
Example #17
Source File: TogglePreserveCaseAction.java From consulo with Apache License 2.0 | 4 votes |
public TogglePreserveCaseAction() { super(FindBundle.message("find.options.replace.preserve.case"), AllIcons.Actions.PreserveCase, AllIcons.Actions.PreserveCaseHover, AllIcons.Actions.PreserveCaseSelected); }
Example #18
Source File: ToggleWholeWordsOnlyAction.java From consulo with Apache License 2.0 | 4 votes |
public ToggleWholeWordsOnlyAction() { super(FindBundle.message("find.whole.words"), AllIcons.Actions.Words, AllIcons.Actions.WordsHovered, AllIcons.Actions.WordsSelected); }
Example #19
Source File: FindUsagesManager.java From consulo with Apache License 2.0 | 4 votes |
private static String getNoUsagesFoundMessage(PsiElement psiElement) { String elementType = UsageViewUtil.getType(psiElement); String elementName = UsageViewUtil.getShortName(psiElement); return FindBundle.message("find.usages.of.element_type.element_name.not.found.message", elementType, elementName); }
Example #20
Source File: FindInProjectTask.java From consulo with Apache License 2.0 | 4 votes |
public void findUsages(@Nonnull FindUsagesProcessPresentation processPresentation, @Nonnull Processor<? super UsageInfo> consumer) { try { myProgress.setIndeterminate(true); myProgress.setText("Scanning indexed files..."); Set<VirtualFile> filesForFastWordSearch = ReadAction.compute(this::getFilesForFastWordSearch); myProgress.setIndeterminate(false); if (LOG.isDebugEnabled()) { LOG.debug("Searching for " + myFindModel.getStringToFind() + " in " + filesForFastWordSearch.size() + " indexed files"); } searchInFiles(filesForFastWordSearch, processPresentation, consumer); myProgress.setIndeterminate(true); myProgress.setText("Scanning non-indexed files..."); boolean canRelyOnIndices = canRelyOnIndices(); final Collection<VirtualFile> otherFiles = collectFilesInScope(filesForFastWordSearch, canRelyOnIndices); myProgress.setIndeterminate(false); if (LOG.isDebugEnabled()) { LOG.debug("Searching for " + myFindModel.getStringToFind() + " in " + otherFiles.size() + " non-indexed files"); } myProgress.checkCanceled(); long start = System.currentTimeMillis(); searchInFiles(otherFiles, processPresentation, consumer); if (canRelyOnIndices && otherFiles.size() > 1000) { long time = System.currentTimeMillis() - start; logStats(otherFiles, time); } } catch (ProcessCanceledException e) { processPresentation.setCanceled(true); if (LOG.isDebugEnabled()) { LOG.debug("Usage search canceled", e); } } if (!myLargeFiles.isEmpty()) { processPresentation.setLargeFilesWereNotScanned(myLargeFiles); } if (!myProgress.isCanceled()) { myProgress.setText(FindBundle.message("find.progress.search.completed")); } }
Example #21
Source File: ToggleMatchCase.java From consulo with Apache License 2.0 | 4 votes |
public ToggleMatchCase() { super(FindBundle.message("find.case.sensitive"), AllIcons.Actions.MatchCase, AllIcons.Actions.MatchCaseHovered, AllIcons.Actions.MatchCaseSelected); }
Example #22
Source File: FindPopupDirectoryChooser.java From consulo with Apache License 2.0 | 4 votes |
MyRecursiveDirectoryAction() { super(FindBundle.message("find.scope.directory.recursive.checkbox"), "Recursively", AllIcons.General.Recursive); }
Example #23
Source File: ToggleRegex.java From consulo with Apache License 2.0 | 4 votes |
public ToggleRegex() { super(FindBundle.message("find.regex"), AllIcons.Actions.Regex, AllIcons.Actions.RegexHovered, AllIcons.Actions.RegexSelected); }