com.intellij.lang.findUsages.DescriptiveNameUtil Java Examples
The following examples show how to use
com.intellij.lang.findUsages.DescriptiveNameUtil.
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: UsageViewShortNameLocation.java From consulo with Apache License 2.0 | 5 votes |
@Override public String getElementDescription(@Nonnull final PsiElement element, @Nonnull final ElementDescriptionLocation location) { if (!(location instanceof UsageViewShortNameLocation)) return null; if (element instanceof PsiMetaOwner) { PsiMetaData metaData = ((PsiMetaOwner)element).getMetaData(); if (metaData!=null) return DescriptiveNameUtil.getMetaDataName(metaData); } if (element instanceof PsiNamedElement) { return ((PsiNamedElement)element).getName(); } return ""; }
Example #2
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 #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: InplaceChangeSignature.java From consulo with Apache License 2.0 | 5 votes |
public InplaceChangeSignature(Project project, Editor editor, @Nonnull PsiElement element) { myDocumentManager = PsiDocumentManager.getInstance(project); myProject = project; try { myMarkAction = StartMarkAction.start(editor, project, ChangeSignatureHandler.REFACTORING_NAME); } catch (StartMarkAction.AlreadyStartedException e) { final int exitCode = Messages.showYesNoDialog(myProject, e.getMessage(), ChangeSignatureHandler.REFACTORING_NAME, "Navigate to Started", "Cancel", Messages.getErrorIcon()); if (exitCode == Messages.CANCEL) return; PsiElement method = myStableChange.getMethod(); VirtualFile virtualFile = PsiUtilCore.getVirtualFile(method); new OpenFileDescriptor(project, virtualFile, method.getTextOffset()).navigate(true); return; } myEditor = editor; myDetector = LanguageChangeSignatureDetectors.INSTANCE.forLanguage(element.getLanguage()); myStableChange = myDetector.createInitialChangeInfo(element); myInitialSignature = myDetector.extractSignature(myStableChange); myInitialName = DescriptiveNameUtil.getDescriptiveName(myStableChange.getMethod()); TextRange highlightingRange = myDetector.getHighlightingRange(myStableChange); HighlightManager highlightManager = HighlightManager.getInstance(myProject); TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.LIVE_TEMPLATE_ATTRIBUTES); highlightManager.addRangeHighlight(editor, highlightingRange.getStartOffset(), highlightingRange.getEndOffset(), attributes, false, myHighlighters); for (RangeHighlighter highlighter : myHighlighters) { highlighter.setGreedyToRight(true); highlighter.setGreedyToLeft(true); } myEditor.getDocument().addDocumentListener(this); myEditor.putUserData(INPLACE_CHANGE_SIGNATURE, this); myPreview = InplaceRefactoring.createPreviewComponent(project, myDetector.getFileType()); showBalloon(); }
Example #5
Source File: RefactoringUIUtil.java From consulo with Apache License 2.0 | 5 votes |
public static String calculatePsiElementDescriptionList(PsiElement[] elements) { StringBuilder buffer = new StringBuilder(); for (int i = 0; i < elements.length; i++) { if (i > 0) buffer.append(", "); buffer.append(UsageViewUtil.getType(elements[i])); buffer.append(" "); buffer.append(DescriptiveNameUtil.getDescriptiveName(elements[i])); } return buffer.toString(); }
Example #6
Source File: FlowRenameDialog.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
private static String getFullName(@NotNull XmlTag tag) { String name = DescriptiveNameUtil.getDescriptiveName(tag.getAttribute("name")); return (UsageViewUtil.getType(tag) + " " + name).trim(); }
Example #7
Source File: ExtractSuperclassHandler.java From intellij-haxe with Apache License 2.0 | 4 votes |
private String getCommandName(final PsiClass subclass, String newName) { return RefactoringBundle.message("extract.superclass.command.name", newName, DescriptiveNameUtil.getDescriptiveName(subclass)); }
Example #8
Source File: ExtractInterfaceHandler.java From intellij-haxe with Apache License 2.0 | 4 votes |
private String getCommandName() { return RefactoringBundle.message("extract.interface.command.name", myInterfaceName, DescriptiveNameUtil.getDescriptiveName(myClass)); }
Example #9
Source File: PullUpProcessor.java From intellij-haxe with Apache License 2.0 | 4 votes |
@Override protected String getCommandName() { return RefactoringBundle.message("pullUp.command", DescriptiveNameUtil.getDescriptiveName(mySourceClass)); }
Example #10
Source File: CommonFindUsagesDialog.java From consulo with Apache License 2.0 | 4 votes |
@Override public void configureLabelComponent(@Nonnull SimpleColoredComponent coloredComponent) { coloredComponent.append(StringUtil.capitalize(UsageViewUtil.getType(myPsiElement))); coloredComponent.append(" "); coloredComponent.append(DescriptiveNameUtil.getDescriptiveName(myPsiElement), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); }
Example #11
Source File: RenameDialog.java From consulo with Apache License 2.0 | 4 votes |
protected String getFullName() { final String name = DescriptiveNameUtil.getDescriptiveName(myPsiElement); return (UsageViewUtil.getType(myPsiElement) + " " + name).trim(); }
Example #12
Source File: RenameProcessor.java From consulo with Apache License 2.0 | 4 votes |
private void setNewName(@Nonnull String newName) { myNewName = newName; myAllRenames.put(myPrimaryElement, newName); myCommandName = RefactoringBundle .message("renaming.0.1.to.2", UsageViewUtil.getType(myPrimaryElement), DescriptiveNameUtil.getDescriptiveName(myPrimaryElement), newName); }
Example #13
Source File: ChangeSignatureProcessorBase.java From consulo with Apache License 2.0 | 4 votes |
@Override protected String getCommandName() { return RefactoringBundle.message("changing.signature.of.0", DescriptiveNameUtil.getDescriptiveName(myChangeInfo.getMethod())); }
Example #14
Source File: DefaultRefactoringElementDescriptionProvider.java From consulo with Apache License 2.0 | 4 votes |
@Override public String getElementDescription(@Nonnull final PsiElement element, @Nonnull final ElementDescriptionLocation location) { final String typeString = UsageViewUtil.getType(element); final String name = DescriptiveNameUtil.getDescriptiveName(element); return typeString + " " + CommonRefactoringUtil.htmlEmphasize(name); }