public static String getProjectName(final Project p) { if (p == null) { return null; } ProjectInformation pi = ProjectUtils.getInformation(p); return pi == null ? null : pi.getDisplayName(); }
private File getFileToRender() throws IOException { FileObject render = toRender; if (render == null) { PovrayProject proj = renderService.getProject(); MainFileProvider provider = (MainFileProvider) proj.getLookup().lookup(MainFileProvider.class); if (provider == null) { throw new IllegalStateException("Main file provider missing"); } render = provider.getMainFile(); if (render == null) { ProjectInformation info = (ProjectInformation) proj.getLookup().lookup(ProjectInformation.class); // XXX let the user choose throw new IOException( NbBundle.getMessage(Povray.class, "MSG_NoMainFile", info.getDisplayName())); } } assert render != null; File result = FileUtil.toFile(render); if (result == null) { throw new IOException(NbBundle.getMessage(Povray.class, "MSG_VirtualFile", render.getName())); } assert result.exists(); assert result.isFile(); return result; }
/** * Gets the name of the CASA file in the given project. * * @param project a JBI project * @return CASA file name */ public static String getCasaFileName(Project project) { ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class); String projName = projInfo.getName(); File pf = FileUtil.toFile(project.getProjectDirectory()); return pf.getPath() + CASA_DIR_NAME + projName + CASA_EXT; }
private void initProjectInfo() { Project p = FileOwnerQuery.getOwner(fileObject); if (p != null) { ProjectInformation pi = ProjectUtils.getInformation(p); projectName = pi.getDisplayName(); projectIcon = pi.getIcon(); } }
public static String GetProjectName(Project p) { if (p != null) { ProjectInformation info = p.getLookup().lookup(ProjectInformation.class); return info.getDisplayName(); } return null; }
private static File getCompAppWSDLLockFile(Project project) { ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class); String projName = projInfo.getName(); FileObject srcDirFO = ((JbiProject) project).getSourceDirectory(); if (srcDirFO != null) { // FileObject doesn't work: // srcDirFO.getFileObject( // LOCK_FILE_PREFIX + projName + WSDL_EXT + LOCK_FILE_SUFFIX); File lockFile = new File( FileUtil.toFile(srcDirFO), LOCK_FILE_PREFIX + projName + WSDL_EXT + LOCK_FILE_SUFFIX); return lockFile; } return null; }
private static File getCasaLockFile(Project project) { ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class); assert projInfo != null; String projName = projInfo.getName(); FileObject confFO = project.getProjectDirectory().getFileObject(CASA_DIR_NAME); if (confFO != null) { // FileObject doesn't work: // confFO.getFileObject( // LOCK_FILE_PREFIX + projName + CASA_EXT + LOCK_FILE_SUFFIX); File lockFile = new File( FileUtil.toFile(confFO), LOCK_FILE_PREFIX + projName + CASA_EXT + LOCK_FILE_SUFFIX); return lockFile; } return null; }
/** * Creates the default CASA file object in the JBI project. * * @param project a JBI project * @return the newly created CASA file object */ public static FileObject createDefaultCasaFileObject(JbiProject project) { ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class); assert projInfo != null; String projName = projInfo.getName(); FileObject confFO = project.getProjectDirectory().getFileObject(CASA_DIR_NAME); FileObject casaFO = null; try { FileObject casaTemplateFO = FileUtil.getConfigFile( "org-netbeans-modules-compapp-projects-jbi/project.casa" // NOI18N ); casaFO = FileUtil.copyFile(casaTemplateFO, confFO, projName); // registerCasaFileListener(project); } catch (IOException ex) { ex.printStackTrace(); } return casaFO; }
/** * Gets the CASA file object in the given JBI project. * * @param project a JBI project * @param create if <code>true</code> and the CASA file doesn't exist in the project, then an * empty CASA file will be created * @return CASA file object */ public static FileObject getCasaFileObject(JbiProject project, boolean create) { ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class); assert projInfo != null; String projName = projInfo.getName(); FileObject confFO = project.getProjectDirectory().getFileObject(CASA_DIR_NAME); if (confFO == null) { // This could happen during compapp rename with directory name change. return null; } FileObject casaFO = confFO.getFileObject(projName + CASA_EXT); if (casaFO == null && create) { casaFO = createDefaultCasaFileObject(project); updateCasaWithJBIModules(project); } return casaFO; }
public static FileObject getCompAppWSDLFileObject(Project project) { ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class); String projName = projInfo.getName(); FileObject srcDirFO = ((JbiProject) project).getSourceDirectory(); return srcDirFO == null ? null : srcDirFO.getFileObject(projName + WSDL_EXT); // NOI18N }