当前位置: 首页>>代码示例>>Java>>正文


Java Navigatable类代码示例

本文整理汇总了Java中com.intellij.pom.Navigatable的典型用法代码示例。如果您正苦于以下问题:Java Navigatable类的具体用法?Java Navigatable怎么用?Java Navigatable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Navigatable类属于com.intellij.pom包,在下文中一共展示了Navigatable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addMessage

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Override
public void addMessage(int type,
                       @NotNull String[] text,
                       @Nullable String groupName,
                       @NotNull Navigatable navigatable,
                       @Nullable String exportTextPrefix,
                       @Nullable String rendererTextPrefix,
                       @Nullable Object data) {
  if (myDisposed) {
    return;
  }
  VirtualFile file = data instanceof VirtualFile ? (VirtualFile)data : null;
  if (file == null && navigatable instanceof OpenFileDescriptor) {
    file = ((OpenFileDescriptor)navigatable).getFile();
  }
  ErrorTreeElementKind kind = ErrorTreeElementKind.convertMessageFromCompilerErrorType(type);
  myTreeStructure.addNavigatableMessage(groupName, navigatable, kind, text, data, nullToEmpty(exportTextPrefix),
                                        nullToEmpty(rendererTextPrefix), file);
  myBuilder.updateTree();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GradleBuildTreeViewPanel.java

示例2: getData

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Override
public Object getData(DataProvider dataProvider) {
  final Navigatable navigatable = CommonDataKeys.NAVIGATABLE.getData(dataProvider);
  if (navigatable != null && navigatable instanceof OpenFileDescriptor) {
    final OpenFileDescriptor openFileDescriptor = (OpenFileDescriptor)navigatable;

    if (openFileDescriptor.getFile().isValid()) {
      return openFileDescriptor;
    }
  }
  final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataProvider);
  if (element instanceof Navigatable) {
    return element;
  }
  if (element != null) {
    return EditSourceUtil.getDescriptor(element);
  }

  final Object selection = PlatformDataKeys.SELECTED_ITEM.getData(dataProvider);
  if (selection instanceof Navigatable) {
    return selection;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NavigatableRule.java

示例3: resolve

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Nullable
public PsiElement resolve() {
  PsiElement result = doResolve();
  if (result == null) {
    if (MavenDomUtil.isMavenFile(getElement())) {
      result = tryResolveToActivationSection();
      if (result == null) return null;
    }
  }

  if (result instanceof XmlTag) {
    XmlTagChild[] children = ((XmlTag)result).getValue().getChildren();
    if (children.length != 1 || !(children[0] instanceof Navigatable)) return result;
    return new MavenPsiElementWrapper(result, (Navigatable)children[0]);
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenPropertyPsiReference.java

示例4: getNavigatableInTemplateLanguageFile

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Nullable
private Navigatable getNavigatableInTemplateLanguageFile() {
  PsiElement element = (PsiElement)myTreeElement.getValue();
  if (element == null) return null;

  int offset = element.getTextRange().getStartOffset();
  final Language dataLanguage = ((TemplateLanguageFileViewProvider)myMainFile.getViewProvider()).getTemplateDataLanguage();
  final PsiFile dataFile = myMainFile.getViewProvider().getPsi(dataLanguage);
  if (dataFile == null) return null;

  PsiElement tlElement = dataFile.findElementAt(offset);
  while(true) {
    if (tlElement == null || tlElement.getTextRange().getStartOffset() != offset) break;
    if (tlElement instanceof Navigatable) {
      return (Navigatable)tlElement;
    }
    tlElement = tlElement.getParent();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:StructureViewElementWrapper.java

示例5: getData

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Override
@Nullable
public Object getData(String dataId) {
  if (DATA_KEY.is(dataId)) {
    return this;
  }
  final SimpleNode simpleNode = getTree().getSelectedNode();
  if (simpleNode instanceof AbstractDomElementNode) {
    final DomElement domElement = ((AbstractDomElementNode)simpleNode).getDomElement();
    if (domElement != null && domElement.isValid()) {
      if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
        final XmlElement tag = domElement.getXmlElement();
        if (tag instanceof Navigatable) {
          return tag;
        }
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DomModelTreeView.java

示例6: addNavigatableMessage

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Override
public void addNavigatableMessage(@Nullable String groupName,
                                  @Nullable Navigatable navigatable,
                                  @NotNull ErrorTreeElementKind kind,
                                  @NotNull String[] message,
                                  @Nullable Object data,
                                  @NotNull String exportText,
                                  @NotNull String rendererTextPrefix,
                                  @Nullable VirtualFile file) {
  if (groupName != null) {
    //noinspection ConstantConditions
    GroupingElement grouping = getGroupingElement(groupName, data, file);
    //noinspection ConstantConditions

    NavigatableMessageElement e = new NavigatableMessageElement(kind, grouping, message, navigatable, exportText, rendererTextPrefix);
    myMessagesByType.put(kind, e);
    myGroupNameToMessagesMap.put(groupName, e);

    myMessages.add(grouping);
    return;
  }
  //noinspection ConstantConditions

  myMessages.add(new NavigatableMessageElement(kind, null, message, navigatable, exportText, rendererTextPrefix));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:GradleBuildTreeStructure.java

示例7: getOpenFileDescriptor

import com.intellij.pom.Navigatable; //导入依赖的package包/类
private static Navigatable getOpenFileDescriptor(final AbstractTestProxy proxy,
                                                 final TestConsoleProperties testConsoleProperties,
                                                 final boolean openFailureLine) {
  final Project project = testConsoleProperties.getProject();

  if (proxy != null) {
    final Location location = proxy.getLocation(project, testConsoleProperties.getScope());
    if (openFailureLine) {
      return proxy.getDescriptor(location, testConsoleProperties);
    }
    final OpenFileDescriptor openFileDescriptor = location == null ? null : location.getOpenFileDescriptor();
    if (openFileDescriptor != null && openFileDescriptor.getFile().isValid()) {
      return openFileDescriptor;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TestsUIUtil.java

示例8: doubleClick

import com.intellij.pom.Navigatable; //导入依赖的package包/类
private void doubleClick(final Object object) {
  if (object instanceof Navigatable) {
    Navigatable navigatable = (Navigatable)object;
    if (navigatable.canNavigate()) {
      navigatable.navigate(true);
    }
  }
  else if (object instanceof Module) {
    ProjectView projectView = ProjectView.getInstance(myProject);
    AbstractProjectViewPane projectViewPane = projectView.getProjectViewPaneById(projectView.getCurrentViewId());
    if (projectViewPane != null) {
      projectViewPane.selectModule((Module)object, true);
    }
  }
  else if (object instanceof Project) {
    return;
  }
  hideHint(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:NavBarPanel.java

示例9: getData

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Nullable
@Override
public Object getData(@NonNls String dataId) {
  Object selectedValue = getSelectedValue();
  if (selectedValue == null) return null;

  if (CommonDataKeys.PSI_ELEMENT.is(dataId) && selectedValue instanceof PsiElement) {
    return selectedValue;
  }
  if (CommonDataKeys.NAVIGATABLE.is(dataId) && selectedValue instanceof Navigatable) {
    return selectedValue;
  }
  if (selectedValue instanceof DataProvider) {
    return ((DataProvider)selectedValue).getData(dataId);
  }
  if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
    return myCopyProvider;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:FinderRecursivePanel.java

示例10: addNavigatableMessage

import com.intellij.pom.Navigatable; //导入依赖的package包/类
public void addNavigatableMessage(@Nullable String groupName,
                                  Navigatable navigatable,
                                  @NotNull ErrorTreeElementKind kind,
                                  final String[] message,
                                  final Object data,
                                  String exportText,
                                  String rendererTextPrefix,
                                  VirtualFile file) {
  if (groupName == null) {
    addSimpleMessageElement(new NavigatableMessageElement(kind, null, message, navigatable, exportText, rendererTextPrefix));
  }
  else {
    synchronized (myLock) {
      List<NavigatableMessageElement> elements = myGroupNameToMessagesMap.get(groupName);
      if (elements == null) {
        elements = new ArrayList<NavigatableMessageElement>();
        myGroupNameToMessagesMap.put(groupName, elements);
      }
      elements.add(new NavigatableMessageElement(kind, getGroupingElement(groupName, data, file), message, navigatable, exportText, rendererTextPrefix));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ErrorViewStructure.java

示例11: addMessage

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Override
public void addMessage(int type,
                       @NotNull String[] text,
                       @Nullable String groupName,
                       @NotNull Navigatable navigatable,
                       @Nullable String exportTextPrefix,
                       @Nullable String rendererTextPrefix,
                       @Nullable Object data) {
  if (myIsDisposed) {
    return;
  }
  VirtualFile file = data instanceof VirtualFile ? (VirtualFile)data : null;
  if (file == null && navigatable instanceof OpenFileDescriptor) {
    file = ((OpenFileDescriptor)navigatable).getFile();
  }
  final String exportPrefix = exportTextPrefix == null ? "" : exportTextPrefix;
  final String renderPrefix = rendererTextPrefix == null ? "" : rendererTextPrefix;
  final ErrorTreeElementKind kind = ErrorTreeElementKind.convertMessageFromCompilerErrorType(type);
  myErrorViewStructure.addNavigatableMessage(groupName, navigatable, kind, text, data, exportPrefix, renderPrefix, file);
  myBuilder.updateTree();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:NewErrorTreeViewPanel.java

示例12: navigate

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Override
public void navigate(final boolean requestFocus) {
  if (isPhysical()) {
    super.navigate(requestFocus);
    return;
  }
  final PsiNamedElement psiNamedElement = XmlUtil.findRealNamedElement(this);
  Navigatable navigatable = PsiNavigationSupport.getInstance().getDescriptor(psiNamedElement);

  if (psiNamedElement instanceof XmlEntityDecl) {
    navigatable = PsiNavigationSupport.getInstance().createNavigatable(
      psiNamedElement.getProject(),
      psiNamedElement.getContainingFile().getVirtualFile(),
      psiNamedElement.getTextRange().getStartOffset() + psiNamedElement.getText().indexOf(getName())
    );
  }
  if (navigatable != null) {
    navigatable.navigate(requestFocus);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:XmlAttributeDeclImpl.java

示例13: update

import com.intellij.pom.Navigatable; //导入依赖的package包/类
public void update(AnActionEvent e) {
  boolean inPopup = ActionPlaces.isPopupPlace(e.getPlace());
  Navigatable target = findTargetForUpdate(e.getDataContext());
  boolean enabled = target != null;
  if (inPopup && !(this instanceof OpenModuleSettingsAction) && OpenModuleSettingsAction.isModuleInProjectViewPopup(e)) {
    e.getPresentation().setVisible(false);
    return;
  }
  //as myFocusEditor is always ignored - Main Menu|View always contains 2 actions with the same name and actually same behaviour
  e.getPresentation().setVisible((enabled || !inPopup) &&
                                 (myFocusEditor || !(target instanceof NavigatableWithText)));
  e.getPresentation().setEnabled(enabled);

  String navigateActionText = myFocusEditor && target instanceof NavigatableWithText?
                              ((NavigatableWithText)target).getNavigateActionText(true) : null;
  e.getPresentation().setText(navigateActionText == null ? getTemplatePresentation().getText() : navigateActionText);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BaseNavigateToSourceAction.java

示例14: actionPerformed

import com.intellij.pom.Navigatable; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  if (project == null) return;

  OccurenceNavigator navigator = getNavigator(e.getDataContext());
  if (navigator == null) {
    return;
  }
  if (!hasOccurenceToGo(navigator)) {
    return;
  }
  OccurenceNavigator.OccurenceInfo occurenceInfo = go(navigator);
  if (occurenceInfo == null) {
    return;
  }
  Navigatable descriptor = occurenceInfo.getNavigateable();
  if (descriptor != null && descriptor.canNavigate()) {
    descriptor.navigate(false);
  }
  if(occurenceInfo.getOccurenceNumber()==-1||occurenceInfo.getOccurencesCount()==-1){
    return;
  }
  WindowManager.getInstance().getStatusBar(project).setInfo(
    IdeBundle.message("message.occurrence.N.of.M", occurenceInfo.getOccurenceNumber(), occurenceInfo.getOccurencesCount()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:OccurenceNavigatorActionBase.java

示例15: getDescriptor

import com.intellij.pom.Navigatable; //导入依赖的package包/类
@Nullable
public static Navigatable getDescriptor(@NotNull PsiElement element) {
  PsiElement original = getNavigatableOriginalElement(element);
  if (original != null) {
    element = original;
  }
  else if (!canNavigate(element)) {
    return null;
  }
  if (element instanceof PomTargetPsiElement) {
    return ((PomTargetPsiElement)element).getTarget();
  }
  final PsiElement navigationElement = element.getNavigationElement();
  if (navigationElement instanceof PomTargetPsiElement) {
    return ((PomTargetPsiElement)navigationElement).getTarget();
  }
  final int offset = navigationElement instanceof PsiFile ? -1 : navigationElement.getTextOffset();
  final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(navigationElement);
  if (virtualFile == null || !virtualFile.isValid()) {
    return null;
  }
  OpenFileDescriptor desc = new OpenFileDescriptor(navigationElement.getProject(), virtualFile, offset);
  desc.setUseCurrentWindow(FileEditorManager.USE_CURRENT_WINDOW.isIn(navigationElement));
  return desc;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:EditSourceUtil.java


注:本文中的com.intellij.pom.Navigatable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。