@Override public void run() { VirtualFile virtualFile = createFile(project, fileType, rootVirtualFile, fileName, this.content); if(virtualFile != null) { new OpenFileDescriptor(project, virtualFile, 0).navigate(true); } } }
@Override protected void run(@NotNull Result result) throws Throwable { PsiElement file = null; try { file = PhpBundleFileFactory.createBundleFile(phpClass, "web_test_case", className, new HashMap<>()); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error:" + e.getMessage()); } if(file != null) { new OpenFileDescriptor(getProject(), file.getContainingFile().getVirtualFile(), 0).navigate(true); } }
@Override protected void run(@NotNull Result result) throws Throwable { PsiElement bundleFile = null; try { bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, "controller", "Controller\\" + finalClassName, new HashMap<>()); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error:" + e.getMessage()); return; } if(bundleFile != null) { new OpenFileDescriptor(getProject(), bundleFile.getContainingFile().getVirtualFile(), 0).navigate(true); } }
@Override protected void run(@NotNull Result result) throws Throwable { PsiElement bundleFile = null; try { String name = className; if(name.endsWith("Extension")) { name = name.substring(0, name.length() - "Extension".length()); } final String finalName = name; bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, "twig_extension", "Twig\\Extension\\" + className, new HashMap<String, String>() {{ put("name", fr.adrienbrault.idea.symfony2plugin.util.StringUtils.underscore(finalName)); }}); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error:" + e.getMessage()); return; } if(bundleFile != null) { new OpenFileDescriptor(getProject(), bundleFile.getContainingFile().getVirtualFile(), 0).navigate(true); } }
@Override protected void run(@NotNull Result result) throws Throwable { PsiElement bundleFile = null; try { bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, "command", "Command\\" + finalClassName, new HashMap<String, String>() {{ String name = phpClass.getName(); if(name.endsWith("Bundle")) { name = name.substring(0, name.length() - "Bundle".length()); } put("name", StringUtils.underscore(name) + ":" + StringUtils.underscore(finalClassName)); }}); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error:" + e.getMessage()); return; } new OpenFileDescriptor(getProject(), bundleFile.getContainingFile().getVirtualFile(), 0).navigate(true); }
@Override protected void run(@NotNull Result result) throws Throwable { PsiElement psiFile = PhpBundleFileFactory.invokeCreateCompilerPass(phpClass, null); if(psiFile != null) { new OpenFileDescriptor(getProject(), psiFile.getContainingFile().getVirtualFile(), 0).navigate(true); } }
@Override protected void run(@NotNull Result result) throws Throwable { String fileTemplate = "form_type_defaults"; if(PhpElementsUtil.getClassMethod(project, "\\Symfony\\Component\\Form\\AbstractType", "configureOptions") != null) { fileTemplate = "form_type_configure"; } PsiElement bundleFile = null; try { bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, fileTemplate, "Form\\" + className, new HashMap<String, String>() {{ put("name", fr.adrienbrault.idea.symfony2plugin.util.StringUtils.underscore(phpClass.getName() + className)); }}); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error:" + e.getMessage()); return; } if(bundleFile != null) { new OpenFileDescriptor(getProject(), bundleFile.getContainingFile().getVirtualFile(), 0).navigate(true); } }
@Override public void run() { VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(filePath); if (file != null && file.isValid()) { FileEditorProvider[] providers = FileEditorProviderManager.getInstance() .getProviders(project, file); if (providers.length != 0) { OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file); FileEditorManager.getInstance(project).openTextEditor(descriptor, true); } } } });
final Editor editor = FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, phpClass.getContainingFile().getVirtualFile()), true); if(editor == null) { return;
@Override public void line(int line) { VirtualFile source = fileForClass(); if (source != null) { FileEditorManager.getInstance(project).openEditor(new OpenFileDescriptor(project, source, line - 1, 0), true); } }
private void loadBucketContents(@NotNull Bucket bucket) { FileEditorManager editorManager = FileEditorManager.getInstance(project); editorManager.openEditor( new OpenFileDescriptor( project, findOpenGcsVirtualFile(bucket).orElseGet(() -> new GcsBucketVirtualFile(bucket)), 1 /*offset*/), true /*focusEditor*/); }
@CheckForNull private OccurenceNavigator.OccurenceInfo occurrence(@Nullable IssueNode node) { if (node == null) { return null; } TreePath path = new TreePath(node.getPath()); tree.getSelectionModel().setSelectionPath(path); tree.scrollPathToVisible(path); RangeMarker range = node.issue().getRange(); int startOffset = (range != null) ? range.getStartOffset() : 0; return new OccurenceNavigator.OccurenceInfo( new OpenFileDescriptor(project, node.issue().psiFile().getVirtualFile(), startOffset), -1, -1); }
@CheckForNull private OpenFileDescriptor navigate() { LiveIssue issue = getSelectedIssue(); if (issue == null || !issue.isValid()) { return null; } int offset; RangeMarker range = issue.getRange(); if (range != null) { offset = range.getStartOffset(); } else { offset = 0; } return new OpenFileDescriptor(project, issue.psiFile().getVirtualFile(), offset); }
public Editor openInEditor(PsiElement element) { PsiFile psiFile; int i; if (element instanceof PsiFile) { psiFile = (PsiFile) element; i = -1; } else { psiFile = PluginPsiUtil.getContainingFile(element); i = element.getTextOffset(); } if (psiFile == null) return null; final VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile == null) return null; OpenFileDescriptor fileDesc = new OpenFileDescriptor(_project, virtualFile, i); // 20050826 IDEA 5.0.1 #3461 disableMovementOneTime(); return FileEditorManager.getInstance(_project).openTextEditor(fileDesc, false); }
private void switchFile(String currentFilePath, String newFilePath) { Project project = this.latestEvent.getProject(); if (project == null) return; VirtualFile currentFile = this.getFileByPath(currentFilePath); VirtualFile newFile = this.getFileByPath(newFilePath); if (!currentFile.exists() || !newFile.exists()) return; FileEditorManager.getInstance(project).closeFile(currentFile); new OpenFileDescriptor(project, newFile).navigate(true); }
@Override public void linkSelected(LinkLabel linkLabel, Object o) { FileEditorManager.getInstance(csvTableEditor.getProject()).openTextEditor(new OpenFileDescriptor(csvTableEditor.getProject(), csvTableEditor.getFile()), true); // this line is for legacy reasons (https://youtrack.jetbrains.com/issue/IDEA-199790) FileEditorManager.getInstance(csvTableEditor.getProject()).setSelectedEditor(csvTableEditor.getFile(), CsvFileEditorProvider.EDITOR_TYPE_ID); } }
new OpenFileDescriptor(project, realPsiFile.getVirtualFile()).navigateInEditor(project, true);
private void navigateToSelected() { DefaultMutableTreeNode node = getSelectedNode(); if (!(node instanceof LocationNode)) { return; } RangeMarker rangeMarker = ((LocationNode) node).rangeMarker(); if (rangeMarker == null || !rangeMarker.isValid()) { return; } PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(rangeMarker.getDocument()); if (psiFile != null) { new OpenFileDescriptor(project, psiFile.getVirtualFile(), rangeMarker.getStartOffset()).navigate(false); } }