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


Java OpenFileDescriptor.navigate方法代码示例

本文整理汇总了Java中com.intellij.openapi.fileEditor.OpenFileDescriptor.navigate方法的典型用法代码示例。如果您正苦于以下问题:Java OpenFileDescriptor.navigate方法的具体用法?Java OpenFileDescriptor.navigate怎么用?Java OpenFileDescriptor.navigate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.fileEditor.OpenFileDescriptor的用法示例。


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

示例1: mouseClicked

import com.intellij.openapi.fileEditor.OpenFileDescriptor; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
    Project project = ProjectManagerImpl.getInstance().getOpenProjects()[0];
    if(project.getBasePath() == null) {
        return;
    }

    if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
        JTree tree = (JTree) e.getSource();
        TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY());
        if (path != null) {
            DefaultMutableTreeNode comp = (DefaultMutableTreeNode) path.getLastPathComponent();
            TestNode node = (TestNode) (comp.getUserObject());
            if(node.getPayload() == null || (File)node.getPayload() == null) {
                return;
            }
            VirtualFile fileToOpen = VfsUtil.findFileByIoFile((File)node.getPayload(), true);
            if(fileToOpen == null) {
                return;
            }
            OpenFileDescriptor d = new OpenFileDescriptor(project, fileToOpen, 0);
            d.navigate(true);
        }
    }
}
 
开发者ID:sh4d0w28,项目名称:intellij-codeception-integration,代码行数:26,代码来源:MyMouseAdapter.java

示例2: doActionPerformed

import com.intellij.openapi.fileEditor.OpenFileDescriptor; //导入方法依赖的package包/类
@Override
protected void doActionPerformed(@NotNull GradleEditorEntity entity, AnActionEvent event) {
  if (entity instanceof GradleEntityDefinitionValueLocationAware) {
    GradleEditorSourceBinding location = ((GradleEntityDefinitionValueLocationAware)entity).getDefinitionValueLocation();
    if (location != null) {
      RangeMarker marker = location.getRangeMarker();
      if (marker.isValid()) {
        OpenFileDescriptor descriptor = new OpenFileDescriptor(location.getProject(), location.getFile(), marker.getStartOffset());
        if (descriptor.canNavigate()) {
          descriptor.navigate(true);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GradleEntityNavigateAction.java

示例3: navigate

import com.intellij.openapi.fileEditor.OpenFileDescriptor; //导入方法依赖的package包/类
@Override
public void navigate(boolean requestFocus) {
  OpenFileDescriptor fileDescriptor = openFileDescriptor;
  if (fileDescriptor == null) {
    final VirtualFile virtualFile = ExternalSystemUtil.findLocalFileByPath(myFile.getPath());
    if (virtualFile != null) {
      openFileDescriptor = fileDescriptor = new OpenFileDescriptor(myProject, virtualFile);
    }
  }
  if (fileDescriptor != null && fileDescriptor.canNavigate()) {
    fileDescriptor.navigate(requestFocus);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GradleProjectImportNotificationListener.java

示例4: navigate

import com.intellij.openapi.fileEditor.OpenFileDescriptor; //导入方法依赖的package包/类
@Override
public void navigate(boolean requestFocus) {
  OpenFileDescriptor fileDescriptor = new OpenFileDescriptor(myPsiFile.getProject(), myPsiFile.getVirtualFile(), myLineNumber);
  fileDescriptor.navigate(requestFocus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:PsiFileAndLineNavigation.java


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