List of usage examples for com.intellij.openapi.fileEditor OpenFileDescriptor OpenFileDescriptor
public OpenFileDescriptor(@NotNull Project project, @NotNull VirtualFile file, int logicalLine, int logicalColumn, boolean persistent)
From source file:com.android.tools.idea.gradle.project.sync.hyperlink.OpenFileHyperlink.java
License:Apache License
@Override protected void execute(@NotNull Project project) { VirtualFile projectFile = project.getProjectFile(); if (projectFile == null) { // This is the default project. This will NEVER happen. return;//from w ww.j av a 2 s . c om } VirtualFile file = projectFile.getParent().getFileSystem().findFileByPath(myFilePath); if (file != null) { Navigatable openFile = new OpenFileDescriptor(project, file, myLineNumber, myColumn, false); if (openFile.canNavigate()) { openFile.navigate(true); } } }
From source file:com.android.tools.idea.gradle.service.notification.GradleNotificationExtension.java
License:Apache License
@NotNull private static CustomizationResult createGoToFileNotification(@NotNull final Project project, @NotNull final String errorMsg, @NotNull final String filePath, final int line) { NotificationListener notificationListener = new NotificationListener() { @Override// w w w .ja va 2 s. co m public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) { return; } VirtualFile projectFile = project.getProjectFile(); if (projectFile == null) { // This is the default project. This will NEVER happen. return; } VirtualFile file = projectFile.getParent().getFileSystem().findFileByPath(filePath); if (file != null) { Navigatable openFile = new OpenFileDescriptor(project, file, line, -1, false); if (openFile.canNavigate()) { openFile.navigate(true); } } } }; String title = createNotificationTitle(project); String messageToShow = errorMsg + "<br><a href=\"openFile\">Open file</a>"; return new CustomizationResult(title, messageToShow, NotificationType.ERROR, notificationListener); }
From source file:com.android.tools.idea.gradle.service.notification.OpenFileHyperlink.java
License:Apache License
@Override protected void execute(@NotNull Project project) { VirtualFile projectFile = project.getProjectFile(); if (projectFile == null) { // This is the default project. This will NEVER happen. return;// ww w. j a va2 s. c o m } VirtualFile file = projectFile.getParent().getFileSystem().findFileByPath(myFilePath); if (file != null) { Navigatable openFile = new OpenFileDescriptor(project, file, myLine, -1, false); if (openFile.canNavigate()) { openFile.navigate(true); } } }
From source file:com.intellij.ide.bookmarks.Bookmark.java
License:Apache License
public Bookmark(@NotNull Project project, @NotNull VirtualFile file, int line, @NotNull String description) { myFile = file;//w w w . j a v a2s . c om myProject = project; myDescription = description; myTarget = new OpenFileDescriptor(project, file, line, -1, true); addHighlighter(); }