Java Code Examples for com.intellij.refactoring.RefactoringBundle#message()
The following examples show how to use
com.intellij.refactoring.RefactoringBundle#message() .
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: CSharpClassesViewDescriptor.java From consulo-csharp with Apache License 2.0 | 6 votes |
public CSharpClassesViewDescriptor(PsiElement[] elementsToMove, PsiDirectory newParent) { myElementsToMove = elementsToMove; if(elementsToMove.length == 1) { myProcessedElementsHeader = StringUtil.capitalize(RefactoringBundle.message("move.single.element.elements.header", UsageViewUtil.getType(elementsToMove[0]), newParent.getVirtualFile().getPresentableUrl())); myCodeReferencesText = RefactoringBundle.message("references.in.code.to.0.1", UsageViewUtil.getType(elementsToMove[0]), UsageViewUtil.getLongName(elementsToMove[0])); } else { if(elementsToMove[0] instanceof PsiFile) { myProcessedElementsHeader = StringUtil.capitalize(RefactoringBundle.message("move.files.elements.header", newParent.getVirtualFile().getPresentableUrl())); } else if(elementsToMove[0] instanceof PsiDirectory) { myProcessedElementsHeader = StringUtil .capitalize(RefactoringBundle.message("move.directories.elements.header", newParent.getVirtualFile().getPresentableUrl())); } myCodeReferencesText = RefactoringBundle.message("references.found.in.code"); } }
Example 2
Source File: RenameViewDescriptor.java From consulo with Apache License 2.0 | 5 votes |
public RenameViewDescriptor(LinkedHashMap<PsiElement, String> renamesMap) { myElements = PsiUtilBase.toPsiElementArray(renamesMap.keySet()); Set<String> processedElementsHeaders = new THashSet<String>(); Set<String> codeReferences = new THashSet<String>(); for (final PsiElement element : myElements) { LOG.assertTrue(element.isValid(), "Invalid element: " + element.toString()); String newName = renamesMap.get(element); String prefix = ""; if (element instanceof PsiDirectory/* || element instanceof PsiClass*/) { String fullName = UsageViewUtil.getLongName(element); int lastDot = fullName.lastIndexOf('.'); if (lastDot >= 0) { prefix = fullName.substring(0, lastDot + 1); } } processedElementsHeaders.add(StringUtil.capitalize( RefactoringBundle.message("0.to.be.renamed.to.1.2", UsageViewUtil.getType(element), prefix, newName))); codeReferences.add(UsageViewUtil.getType(element) + " " + UsageViewUtil.getLongName(element)); } myProcessedElementsHeader = StringUtil.join(ArrayUtil.toStringArray(processedElementsHeaders), ", "); myCodeReferencesText = RefactoringBundle.message("references.in.code.to.0", StringUtil.join(ArrayUtil.toStringArray(codeReferences), ", ")); }
Example 3
Source File: MemberInplaceRenamer.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void performRefactoringRename(final String newName, final StartMarkAction markAction) { try { final PsiNamedElement variable = getVariable(); if (variable != null && !newName.equals(myOldName)) { if (isIdentifier(newName, variable.getLanguage())) { final PsiElement substituted = getSubstituted(); if (substituted == null) { return; } final String commandName = RefactoringBundle .message("renaming.0.1.to.2", UsageViewUtil.getType(variable), DescriptiveNameUtil.getDescriptiveName(variable), newName); CommandProcessor.getInstance().executeCommand(myProject, new Runnable() { @Override public void run() { performRenameInner(substituted, newName); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); } }, commandName, null); } } } finally { try { ((DesktopEditorImpl)InjectedLanguageUtil.getTopLevelEditor(myEditor)).stopDumbLater(); } finally { FinishMarkAction.finish(myProject, myEditor, markAction); } } }
Example 4
Source File: RenameHandlerRegistry.java From consulo with Apache License 2.0 | 5 votes |
@Override protected JComponent createNorthPanel() { final JPanel radioPanel = new JPanel(); radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS)); final JLabel descriptionLabel = new JLabel(RefactoringBundle.message("what.would.you.like.to.do")); descriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); radioPanel.add(descriptionLabel); final ButtonGroup bg = new ButtonGroup(); boolean selected = true; int rIdx = 0; for (final String renamer : myRenamers) { final JRadioButton rb = new JRadioButton(renamer, selected); myRButtons[rIdx++] = rb; final ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (rb.isSelected()) { mySelection = renamer; } } }; rb.addActionListener(listener); selected = false; bg.add(rb); radioPanel.add(rb); } new RadioUpDownListener(myRButtons); return radioPanel; }
Example 5
Source File: ChangeSignatureDialogBase.java From consulo with Apache License 2.0 | 5 votes |
protected JComponent createOptionsPanel() { final JPanel panel = new JPanel(new BorderLayout()); if (myAllowDelegation) { myDelegationPanel = createDelegationPanel(); panel.add(myDelegationPanel, BorderLayout.WEST); } myPropagateParamChangesButton = new AnActionButton(RefactoringBundle.message("changeSignature.propagate.parameters.title"), null, new LayeredIcon(AllIcons.Nodes.Parameter, AllIcons.Actions.New)) { @Override public void actionPerformed(AnActionEvent e) { final Ref<CallerChooserBase<Method>> chooser = new Ref<CallerChooserBase<Method>>(); Consumer<Set<Method>> callback = new Consumer<Set<Method>>() { @Override public void consume(Set<Method> callers) { myMethodsToPropagateParameters = callers; myParameterPropagationTreeToReuse = chooser.get().getTree(); } }; try { String message = RefactoringBundle.message("changeSignature.parameter.caller.chooser"); chooser.set(createCallerChooser(message, myParameterPropagationTreeToReuse, callback)); } catch (ProcessCanceledException ex) { // user cancelled initial callers search, don't show dialog return; } chooser.get().show(); } }; final JPanel result = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP)); result.add(panel); return result; }
Example 6
Source File: ExtractSuperclassDialog.java From intellij-haxe with Apache License 2.0 | 4 votes |
protected String getEntityName() { return RefactoringBundle.message("ExtractSuperClass.superclass"); }
Example 7
Source File: ComboBoxVisibilityPanel.java From consulo with Apache License 2.0 | 4 votes |
public ComboBoxVisibilityPanel(V[] options, String[] presentableNames) { this(RefactoringBundle.message("visibility.combo.title"), options, presentableNames); }
Example 8
Source File: RenameModuleHandler.java From consulo with Apache License 2.0 | 4 votes |
@Override public String getActionTitle() { return RefactoringBundle.message("rename.module.title"); }
Example 9
Source File: ExtractSuperClassViewDescriptor.java From intellij-haxe with Apache License 2.0 | 4 votes |
public String getProcessedElementsHeader() { return RefactoringBundle.message("extract.superclass.elements.header"); }
Example 10
Source File: ExtractSuperclassDialog.java From intellij-haxe with Apache License 2.0 | 4 votes |
@Override protected String getExtractedSuperNameNotSpecifiedMessage() { return RefactoringBundle.message("no.superclass.name.specified"); }
Example 11
Source File: VariableInplaceRenamer.java From consulo with Apache License 2.0 | 4 votes |
@Override protected String getCommandName() { return RefactoringBundle.message("renaming.command.name", myInitialName); }
Example 12
Source File: DirectoryChooser.java From consulo with Apache License 2.0 | 4 votes |
public FilterExistentAction() { super(RefactoringBundle.message("directory.chooser.hide.non.existent.checkBox.text"), UIUtil.removeMnemonic(RefactoringBundle.message("directory.chooser.hide.non.existent.checkBox.text")), AllIcons.General.Filter); }
Example 13
Source File: SafeDeleteUsageViewDescriptor.java From consulo with Apache License 2.0 | 4 votes |
@Override public String getProcessedElementsHeader() { return RefactoringBundle.message("items.to.be.deleted"); }
Example 14
Source File: MoveDirectoryWithClassesProcessor.java From consulo with Apache License 2.0 | 4 votes |
@Override protected String getCommandName() { return RefactoringBundle.message("moving.directories.command"); }
Example 15
Source File: DirectoryAsPackageRenameHandlerBase.java From consulo with Apache License 2.0 | 4 votes |
@Override public String getActionTitle() { return RefactoringBundle.message("rename.directory.title"); }
Example 16
Source File: UnsafeUsagesDialog.java From consulo with Apache License 2.0 | 4 votes |
public ViewUsagesAction() { super(RefactoringBundle.message("view.usages")); putValue(DialogWrapper.DEFAULT_ACTION, Boolean.TRUE); }
Example 17
Source File: MoveFilesOrDirectoriesViewDescriptor.java From consulo with Apache License 2.0 | 4 votes |
@Override public String getCommentReferencesText(int usagesCount, int filesCount) { return RefactoringBundle.message("comments.elements.header", UsageViewBundle.getOccurencesString(usagesCount, filesCount)); }
Example 18
Source File: UsageViewDescriptorAdapter.java From consulo with Apache License 2.0 | 4 votes |
@Override public String getCodeReferencesText(int usagesCount, int filesCount) { return RefactoringBundle.message("references.to.be.changed", UsageViewBundle.getReferencesString(usagesCount, filesCount)); }
Example 19
Source File: CSharpClassesMoveProcessor.java From consulo-csharp with Apache License 2.0 | 4 votes |
@Nonnull @Override protected String getCommandName() { return RefactoringBundle.message("move.title"); }
Example 20
Source File: ExtractMethodHelper.java From consulo with Apache License 2.0 | 4 votes |
/** * Notifies user about found duplicates and then highlights each of them in the editor and asks user how to proceed. * * @param callElement generated expression or statement that contains invocation of the new method * @param editor instance of editor where refactoring is performed * @param replacer strategy of substituting each duplicate occurence with the replacement fragment * @param duplicates discovered duplicates of extracted code fragment * @see #collectDuplicates(SimpleDuplicatesFinder, List, PsiElement) */ public static void replaceDuplicates(@Nonnull PsiElement callElement, @Nonnull Editor editor, @Nonnull Consumer<Pair<SimpleMatch, PsiElement>> replacer, @Nonnull List<SimpleMatch> duplicates) { if (!duplicates.isEmpty()) { final String message = RefactoringBundle .message("0.has.detected.1.code.fragments.in.this.file.that.can.be.replaced.with.a.call.to.extracted.method", ApplicationNamesInfo.getInstance().getProductName(), duplicates.size()); final boolean isUnittest = ApplicationManager.getApplication().isUnitTestMode(); final Project project = callElement.getProject(); final int exitCode = !isUnittest ? Messages.showYesNoDialog(project, message, RefactoringBundle.message("refactoring.extract.method.dialog.title"), Messages.getInformationIcon()) : Messages.YES; if (exitCode == Messages.YES) { boolean replaceAll = false; final Map<SimpleMatch, RangeHighlighter> highlighterMap = new HashMap<>(); for (SimpleMatch match : duplicates) { if (!match.getStartElement().isValid() || !match.getEndElement().isValid()) continue; final Pair<SimpleMatch, PsiElement> replacement = Pair.create(match, callElement); if (!replaceAll) { highlightInEditor(project, match, editor, highlighterMap); int promptResult = FindManager.PromptResult.ALL; //noinspection ConstantConditions if (!isUnittest) { ReplacePromptDialog promptDialog = new ReplacePromptDialog(false, RefactoringBundle.message("replace.fragment"), project); promptDialog.show(); promptResult = promptDialog.getExitCode(); } if (promptResult == FindManager.PromptResult.SKIP) { final HighlightManager highlightManager = HighlightManager.getInstance(project); final RangeHighlighter highlighter = highlighterMap.get(match); if (highlighter != null) highlightManager.removeSegmentHighlighter(editor, highlighter); continue; } if (promptResult == FindManager.PromptResult.CANCEL) break; if (promptResult == FindManager.PromptResult.OK) { replaceDuplicate(project, replacer, replacement); } else if (promptResult == FindManager.PromptResult.ALL) { replaceDuplicate(project, replacer, replacement); replaceAll = true; } } else { replaceDuplicate(project, replacer, replacement); } } } } }