com.intellij.usageView.UsageViewUtil Java Examples

The following examples show how to use com.intellij.usageView.UsageViewUtil. 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: LSPReferencesAction.java    From lsp4intellij with Apache License 2.0 6 votes vote down vote up
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 #2
Source File: CSharpClassesViewDescriptor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
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 #3
Source File: MoveMultipleElementsViewDescriptor.java    From consulo with Apache License 2.0 6 votes vote down vote up
public MoveMultipleElementsViewDescriptor(PsiElement[] psiElements,
                                          String targetName) {
  myPsiElements = psiElements;
  if (psiElements.length == 1) {
    myProcessedElementsHeader = StringUtil.capitalize(
      RefactoringBundle.message("move.single.element.elements.header", UsageViewUtil.getType(psiElements[0]), targetName));
    myCodeReferencesText = RefactoringBundle
      .message("references.in.code.to.0.1", UsageViewUtil.getType(psiElements[0]), UsageViewUtil.getLongName(psiElements[0]));
  }
  else {
    if (psiElements.length > 0) {
      myProcessedElementsHeader = StringUtil.capitalize(
        RefactoringBundle
          .message("move.single.element.elements.header", StringUtil.pluralize(UsageViewUtil.getType(psiElements[0])), targetName));
    }
    myCodeReferencesText = RefactoringBundle.message("references.found.in.code");
  }
}
 
Example #4
Source File: ExtractSuperBaseProcessor.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
@NotNull
protected UsageInfo[] findUsages() {
  PsiReference[] refs = ReferencesSearch.search(myClass, GlobalSearchScope.projectScope(myProject), false).toArray(new PsiReference[0]);
  final ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();
  detectTurnToSuperRefs(refs, result);
  final PsiPackage originalPackage = JavaDirectoryService.getInstance().getPackage(myClass.getContainingFile().getContainingDirectory());
  if (Comparing.equal(JavaDirectoryService.getInstance().getPackage(myTargetDirectory), originalPackage)) {
    result.clear();
  }
  for (final PsiReference ref : refs) {
    final PsiElement element = ref.getElement();
    if (!canTurnToSuper(element) && !RefactoringUtil.inImportStatement(ref, element)) {
      result.add(new BindToOldUsageInfo(element, ref, myClass));
    }
  }
  UsageInfo[] usageInfos = result.toArray(new UsageInfo[result.size()]);
  return UsageViewUtil.removeDuplicatedUsages(usageInfos);
}
 
Example #5
Source File: MoveFilesOrDirectoriesViewDescriptor.java    From consulo with Apache License 2.0 6 votes vote down vote up
public MoveFilesOrDirectoriesViewDescriptor(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 #6
Source File: PsiElement2UsageTargetAdapter.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void update(PsiElement element) {
  if (element != null && element.isValid()) {
    final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
    myIcon = presentation == null ? null : presentation.getIcon();
    myPresentableText = presentation == null ? UsageViewUtil.createNodeText(element) : presentation.getPresentableText();
    if (myIcon == null) {
      if (element instanceof PsiMetaOwner) {
        final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
        final PsiMetaData metaData = psiMetaOwner.getMetaData();
        if (metaData instanceof PsiPresentableMetaData) {
          final PsiPresentableMetaData psiPresentableMetaData = (PsiPresentableMetaData)metaData;
          if (myIcon == null) myIcon = psiPresentableMetaData.getIcon();
        }
      }
      else if (element instanceof PsiFile) {
        final PsiFile psiFile = (PsiFile)element;
        final VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile != null) {
          myIcon = VirtualFilePresentation.getIcon(virtualFile);
        }
      }
    }
  }
}
 
Example #7
Source File: BaseRefactoringProcessor.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected void customizeUsagesView(@Nonnull final UsageViewDescriptor viewDescriptor, @Nonnull final UsageView usageView) {
  Runnable refactoringRunnable = () -> {
    Set<UsageInfo> usagesToRefactor = UsageViewUtil.getNotExcludedUsageInfos(usageView);
    final UsageInfo[] infos = usagesToRefactor.toArray(UsageInfo.EMPTY_ARRAY);
    TransactionGuard.getInstance().submitTransactionAndWait(() -> {
      if (ensureElementsWritable(infos, viewDescriptor)) {
        execute(infos);
      }
    });
  };

  String canNotMakeString = RefactoringBundle.message("usageView.need.reRun");

  addDoRefactoringAction(usageView, refactoringRunnable, canNotMakeString);
  usageView.setRerunAction(new AbstractAction() {
    @Override
    public void actionPerformed(ActionEvent e) {
      doRun();
    }
  });
}
 
Example #8
Source File: SafeDeleteProcessor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nonnull
protected UsageInfo[] findUsages() {
  List<UsageInfo> usages = Collections.synchronizedList(new ArrayList<UsageInfo>());
  for (PsiElement element : myElements) {
    boolean handled = false;
    for (SafeDeleteProcessorDelegate delegate : Extensions.getExtensions(SafeDeleteProcessorDelegate.EP_NAME)) {
      if (delegate.handlesElement(element)) {
        final NonCodeUsageSearchInfo filter = delegate.findUsages(element, myElements, usages);
        if (filter != null) {
          for (PsiElement nonCodeUsageElement : filter.getElementsToSearch()) {
            addNonCodeUsages(nonCodeUsageElement, usages, filter.getInsideDeletedCondition(), mySearchNonJava, mySearchInCommentsAndStrings);
          }
        }
        handled = true;
        break;
      }
    }
    if (!handled && element instanceof PsiNamedElement) {
      findGenericElementUsages(element, usages, myElements);
      addNonCodeUsages(element, usages, getDefaultInsideDeletedCondition(myElements), mySearchNonJava, mySearchInCommentsAndStrings);
    }
  }
  final UsageInfo[] result = usages.toArray(new UsageInfo[usages.size()]);
  return UsageViewUtil.removeDuplicatedUsages(result);
}
 
Example #9
Source File: RenameDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
public String[] getSuggestedNames() {
  final LinkedHashSet<String> result = new LinkedHashSet<String>();
  final String initialName = VariableInplaceRenameHandler.getInitialName();
  if (initialName != null) {
    result.add(initialName);
  }
  result.add(UsageViewUtil.getShortName(myPsiElement));
  final NameSuggestionProvider[] providers = Extensions.getExtensions(NameSuggestionProvider.EP_NAME);
  for(NameSuggestionProvider provider: providers) {
    SuggestedNameInfo info = provider.getSuggestedNames(myPsiElement, myNameSuggestionContext, result);
    if (info != null) {
      mySuggestedNameInfo = info;
      if (provider instanceof PreferrableNameSuggestionProvider && !((PreferrableNameSuggestionProvider)provider).shouldCheckOthers()) break;
    }
  }
  return ArrayUtil.toStringArray(result);
}
 
Example #10
Source File: RenameDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected void createNewNameComponent() {
  String[] suggestedNames = getSuggestedNames();
  myOldName = UsageViewUtil.getShortName(myPsiElement);
  myNameSuggestionsField = new NameSuggestionsField(suggestedNames, myProject, PlainTextFileType.INSTANCE, myEditor) {
    @Override
    protected boolean shouldSelectAll() {
      return myEditor == null || myEditor.getSettings().isPreselectRename();
    }
  };
  if (myPsiElement instanceof PsiFile && myEditor == null) {
    myNameSuggestionsField.selectNameWithoutExtension();
  }
  myNameChangedListener = new NameSuggestionsField.DataChanged() {
    @Override
    public void dataChanged() {
      processNewNameChanged();
    }
  };
  myNameSuggestionsField.addDataChangedListener(myNameChangedListener);

}
 
Example #11
Source File: MoveDirectoryWithClassesProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public UsageInfo[] findUsages() {
  final List<UsageInfo> usages = new ArrayList<UsageInfo>();
  for (MoveDirectoryWithClassesHelper helper : MoveDirectoryWithClassesHelper.findAll()) {
    helper.findUsages(myFilesToMove.keySet(), myDirectories, usages, mySearchInComments, mySearchInNonJavaFiles, myProject);
  }
  return UsageViewUtil.removeDuplicatedUsages(usages.toArray(new UsageInfo[usages.size()]));
}
 
Example #12
Source File: RenameProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isPreviewUsages(@Nonnull UsageInfo[] usages) {
  if (myForceShowPreview) return true;
  if (super.isPreviewUsages(usages)) return true;
  if (UsageViewUtil.reportNonRegularUsages(usages, myProject)) return true;
  return false;
}
 
Example #13
Source File: MemberInplaceRenamer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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 #14
Source File: RefactoringUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
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 #15
Source File: RenameViewDescriptor.java    From consulo with Apache License 2.0 5 votes vote down vote up
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 #16
Source File: FindUsagesManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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 #17
Source File: PsiElement2UsageTargetAdapter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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 #18
Source File: SafeDeleteProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void showUsages(final UsageInfo[] usages) {
  UsageViewPresentation presentation = new UsageViewPresentation();
  presentation.setTabText(RefactoringBundle.message("safe.delete.title"));
  presentation.setTargetsNodeText(RefactoringBundle.message("attempting.to.delete.targets.node.text"));
  presentation.setShowReadOnlyStatusAsRed(true);
  presentation.setShowCancelButton(true);
  presentation.setCodeUsagesString(RefactoringBundle.message("references.found.in.code"));
  presentation.setUsagesInGeneratedCodeString(RefactoringBundle.message("references.found.in.generated.code"));
  presentation.setNonCodeUsagesString(RefactoringBundle.message("occurrences.found.in.comments.strings.and.non.java.files"));
  presentation.setUsagesString(RefactoringBundle.message("usageView.usagesText"));

  UsageViewManager manager = UsageViewManager.getInstance(myProject);
  final UsageView usageView = showUsages(usages, presentation, manager);
  usageView.addPerformOperationAction(new RerunSafeDelete(myProject, myElements, usageView), RefactoringBundle.message("retry.command"), null,
                                      RefactoringBundle.message("rerun.safe.delete"));
  usageView.addPerformOperationAction(new Runnable() {
    @Override
    public void run() {
      UsageInfo[] preprocessedUsages = usages;
      for (SafeDeleteProcessorDelegate delegate : Extensions.getExtensions(SafeDeleteProcessorDelegate.EP_NAME)) {
        preprocessedUsages = delegate.preprocessUsages(myProject, preprocessedUsages);
        if (preprocessedUsages == null) return;
      }
      final UsageInfo[] filteredUsages = UsageViewUtil.removeDuplicatedUsages(preprocessedUsages);
      execute(filteredUsages);
    }
  }, "Delete Anyway", RefactoringBundle.message("usageView.need.reRun"), RefactoringBundle.message("usageView.doAction"));
}
 
Example #19
Source File: SafeDeleteProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isPreviewUsages(@Nonnull UsageInfo[] usages) {
  if (myPreviewNonCodeUsages && UsageViewUtil.reportNonRegularUsages(usages, myProject)) {
    return true;
  }

  return super.isPreviewUsages(filterToBeDeleted(usages));
}
 
Example #20
Source File: DefaultRefactoringElementDescriptionProvider.java    From consulo with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example #21
Source File: PullUpDialogBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected JComponent createNorthPanel() {
  JPanel panel = new JPanel();

  panel.setLayout(new GridBagLayout());
  GridBagConstraints gbConstraints = new GridBagConstraints();

  gbConstraints.insets = new Insets(4, 0, 4, 8);
  gbConstraints.weighty = 1;
  gbConstraints.weightx = 1;
  gbConstraints.gridy = 0;
  gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
  gbConstraints.fill = GridBagConstraints.BOTH;
  gbConstraints.anchor = GridBagConstraints.WEST;
  final JLabel classComboLabel = new JLabel();
  panel.add(classComboLabel, gbConstraints);

  myClassCombo = new JComboBox(mySuperClasses.toArray());
  initClassCombo(myClassCombo);
  classComboLabel.setText(RefactoringBundle.message("pull.up.members.to", UsageViewUtil.getLongName(myClass)));
  classComboLabel.setLabelFor(myClassCombo);
  final Class preselection = getPreselection();
  int indexToSelect = 0;
  if (preselection != null) {
    indexToSelect = mySuperClasses.indexOf(preselection);
  }
  myClassCombo.setSelectedIndex(indexToSelect);
  myClassCombo.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent e) {
      if (e.getStateChange() == ItemEvent.SELECTED) {
        updateMemberInfo();
      }
    }
  });
  updateMemberInfo();
  gbConstraints.gridy++;
  panel.add(myClassCombo, gbConstraints);

  return panel;
}
 
Example #22
Source File: RenameProcessor.java    From consulo with Apache License 2.0 4 votes vote down vote up
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 #23
Source File: RenameDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected String getFullName() {
  final String name = DescriptiveNameUtil.getDescriptiveName(myPsiElement);
  return (UsageViewUtil.getType(myPsiElement) + " " + name).trim();
}
 
Example #24
Source File: UsageProjectTreeNode.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void navigate(boolean requestFocus) {
  UsageViewUtil.navigateTo(getValue(), requestFocus);
}
 
Example #25
Source File: FindUsagesManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
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 #26
Source File: CommonFindUsagesDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
@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 #27
Source File: ChangeSignatureViewDescriptor.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public ChangeSignatureViewDescriptor(PsiElement method)
{
	myMethod = method;
	myProcessedElementsHeader = StringUtil.capitalize(RefactoringBundle.message("0.to.change.signature", UsageViewUtil.getType(method)));
}
 
Example #28
Source File: FlowRenameDialog.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
private static String getFullName(@NotNull XmlTag tag) {
    String name = DescriptiveNameUtil.getDescriptiveName(tag.getAttribute("name"));
    return (UsageViewUtil.getType(tag) + " " + name).trim();
}