@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); } }
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); }
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); } }