本文整理汇总了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);
}
}
}
示例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);
}
}
}
}
}
示例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);
}