use of com.intellij.openapi.vfs.VirtualFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoPathLibraryTest method createGoPath.
private VirtualFile createGoPath() throws IOException {
VirtualFile goPath = VfsUtil.findFileByIoFile(FileUtil.createTempDirectory("go", "path"), true);
tempRootsToClean.add(goPath);
return goPath;
}
use of com.intellij.openapi.vfs.VirtualFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoConsoleFilterTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
VirtualFile workingDirectory = createTestRoot("workingDirectory");
VirtualFile goPath = createTestRoot("goPath");
GoApplicationLibrariesService.getInstance().setLibraryRootUrls(goPath.getUrl());
myFilter = new GoConsoleFilter(myFixture.getProject(), myFixture.getModule(), workingDirectory.getUrl());
}
use of com.intellij.openapi.vfs.VirtualFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoCreateFileAction method postProcess.
@Override
protected void postProcess(PsiFile createdElement, String templateName, Map<String, String> customProperties) {
if (createdElement instanceof GoFile) {
GoPackageClause packageClause = ((GoFile) createdElement).getPackage();
if (packageClause == null) {
return;
}
Project project = createdElement.getProject();
Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (editor == null) {
return;
}
VirtualFile virtualFile = createdElement.getContainingFile().getVirtualFile();
if (virtualFile == null) {
return;
}
if (FileDocumentManager.getInstance().getDocument(virtualFile) == editor.getDocument()) {
editor.getCaretModel().moveToOffset(packageClause.getTextRange().getEndOffset());
}
}
}
use of com.intellij.openapi.vfs.VirtualFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoDownloadableFileAction method doSomething.
@Override
protected boolean doSomething(@NotNull VirtualFile virtualFile, @Nullable Module module, @NotNull Project project, @NotNull String title) throws ExecutionException {
VirtualFile executable = getExecutable(project, module);
if (executable == null) {
String message = "Can't find `" + myExecutableName + "` in GOPATH. Try to invoke <a href=\"" + GO_GET_LINK + "\">go get " + myExecutableName + "</a>";
NotificationListener listener = new MyNotificationListener(project, module);
Notifications.Bus.notify(GoConstants.GO_NOTIFICATION_GROUP.createNotification(title, message, NotificationType.WARNING, listener), project);
return false;
}
return super.doSomething(virtualFile, module, project, title);
}
use of com.intellij.openapi.vfs.VirtualFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoExternalToolsAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
VirtualFile file = e.getRequiredData(CommonDataKeys.VIRTUAL_FILE);
assert project != null;
String title = StringUtil.notNullize(e.getPresentation().getText());
Module module = ModuleUtilCore.findModuleForFile(file, project);
try {
doSomething(file, module, project, title);
} catch (ExecutionException ex) {
error(title, project, ex);
LOG.error(ex);
}
}
Aggregations