private static ClassPath getCompileClasspath(Project project) { ClassPathProvider cpp = project.getLookup().lookup(ClassPathProvider.class); Sources sources = ProjectUtils.getSources(project); if (sources == null) { return null; } SourceGroup[] sourceGroups = sources.getSourceGroups("java"); //NOII18N if (sourceGroups.length > 0) { return cpp.findClassPath(sourceGroups[0].getRootFolder(), ClassPath.COMPILE); } return null; }
void setProject(Project project) { // initialize visual components //#118047 avoid using the EarProject instance directly to allow for alternate implementations. EarImplementation projectEar = project.getLookup().lookup(EarImplementation.class); fileNameText.setText(FILE_DD); projectText.setText(ProjectUtils.getInformation(project).getDisplayName()); // a nasty fallback to getProjectDirectory if the metainf folder doesn't exist. // not sure if there are ways of checking for the right location and creating it upon request. FileObject docBase = projectEar != null ? projectEar.getMetaInf() : project.getProjectDirectory(); locationText.setText(FileUtil.getFileDisplayName(docBase)); refreshLocation(); locationText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { refreshLocation(); } }); }
static Preferences getPreferencesForProject(Project project) { Preferences prefs = ProjectUtils.getPreferences(project, WebClientToolsProjectUtils.class, false); assert prefs != null; return prefs; }
protected String getProjectDisplayName(Project project) { String name = ProjectUtils.getInformation(project).getDisplayName(); RemoteProject remoteProject = project.getLookup().lookup(RemoteProject.class); if (remoteProject != null) { final ExecutionEnvironment env = remoteProject.getSourceFileSystemHost(); if (env.isRemote()) { name += " [" + env.getDisplayName() + ']'; // NOI18N //name = "<html>" + name + "<font color='!controlShadow'>" + env.getDisplayName() + "</html>"; } } return name; }
private void computeAndSetDisplayName(final List<? extends RakeTask> tasks) { ProjectInformation info = ProjectUtils.getInformation(project); String baseDisplayName = info == null ? NbBundle.getMessage(RakeRunnerAction.class, "RakeRunnerAction.Rake") : info.getDisplayName(); StringBuilder displayNameSB = new StringBuilder(baseDisplayName).append(" ("); // NOI18N for (int i = 0; i < tasks.size(); i++) { displayNameSB.append(tasks.get(i).getTask()); if (i != tasks.size() - 1) { displayNameSB.append(", "); // NOI18N } } displayNameSB.append(')'); setDisplayName(displayNameSB.toString()); // NOI18N }
public static void actionPerformed(Node[] e) { if (e != null) { for (Node node : e) { Project prj = node.getLookup().lookup(Project.class); if (prj != null) { File file = FileUtil.toFile(prj.getProjectDirectory()); if (VersioningSupport.getOwner(file) != null) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(ShareAction.class, "NameAndLicenseWizardPanelGUI.versioningNotSupported", ProjectUtils.getInformation(prj).getDisplayName())); return; } } } } if (Subversion.isClientAvailable(true)) { WizardDescriptor wizardDescriptor = new WizardDescriptor(new NewKenaiProjectWizardIterator(e,Utilities.getPreferredKenai())); // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName() wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N wizardDescriptor.setTitle(NbBundle.getMessage(NewKenaiProjectAction.class, "NewKenaiProjectAction.dialogTitle")); // NOI18N DialogDisplayer.getDefault().notify(wizardDescriptor); boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { Set<CreatedProjectInfo> createdProjects = wizardDescriptor.getInstantiatedObjects(); showDashboard(createdProjects); } } }
void setProject(final Project project) { this.project = project; // get j2ee module provider // get list of config files for this module type // figure out which ones exist already // Lookup lookup = project.getLookup(); J2eeModuleProvider provider = (J2eeModuleProvider) lookup.lookup(J2eeModuleProvider.class); J2eeModule j2eeModule = provider.getJ2eeModule(); sunDDFileName = getConfigFileName(j2eeModule,provider.getServerInstanceID()); // Calculate location: sunDDFile = (sunDDFileName != null) ? j2eeModule.getDeploymentConfigurationFile(sunDDFileName) : null; sunDDLocation = (sunDDFile != null) ? sunDDFile.getParentFile() : null; // initialize visual components textFileName.setText(sunDDFileName); // NOI18N textProjectName.setText(ProjectUtils.getInformation(project).getDisplayName()); File projectFolder = FileUtil.toFile(project.getProjectDirectory()); textLocation.setText((sunDDLocation != null) ? getRelativePath(sunDDLocation, projectFolder) : null); // only fill 'created file' in if location is valid. textCreatedFile.setText((sunDDLocation != null) ? getRelativePath(sunDDFile, projectFolder) : null); }
DocBaseNodeList(WebProject proj) { project = proj; evaluator = project.evaluator(); helper = project.getUpdateHelper(); Sources s = project.getLookup().lookup(Sources.class); assert s != null; // assert s.getSourceGroups(WebProjectConstants.TYPE_DOC_ROOT).length > 0; if(s.getSourceGroups(WebProjectConstants.TYPE_DOC_ROOT).length > 0) { webDocRoot = s.getSourceGroups(WebProjectConstants.TYPE_DOC_ROOT)[0]; } else { String name = ProjectUtils.getInformation( proj ).getDisplayName(); NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(DocBaseNodeList.class, "LBL_No_Source_Groups_Found", name), NotifyDescriptor.INFORMATION_MESSAGE); DialogDisplayer.getDefault().notify(nd); } }
/** Creates a new instance of NewFileDescriptorData */ public BasicDataModel(WizardDescriptor wiz) { Project tmpProject = Templates.getProject(wiz); if (tmpProject == null) { throw new IllegalArgumentException(); } module = tmpProject.getLookup().lookup(NbModuleProvider.class); if (module == null) { throw new IllegalArgumentException(tmpProject.getClass().toString()); } project = tmpProject; // #66339 need to prefetch the packagename and populate data with it.. FileObject fo = Templates.getTargetFolder(wiz); if (fo != null) { Sources srcs = ProjectUtils.getSources(project); // #63247: don't use lookup directly SourceGroup[] grps = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (int i = 0; i < grps.length; i++) { if (FileUtil.isParentOf(grps[i].getRootFolder(), fo)) { String relPath = FileUtil.getRelativePath(grps[i].getRootFolder(), fo); relPath = relPath.replace('/', '.'); setPackageName(relPath); break; } } } }
private void selectProject(final Project p) { final ExplorerManager em = ((ExplorerManager.Provider) WindowManager.getDefault().findTopComponent("projectTabLogical_tc")).getExplorerManager(); // NOI18N Node root = em.getRootContext(); // Node projNode = root.getChildren ().findChild( p.getProjectDirectory().getName () ); Node projNode = null; for (Node n : root.getChildren().getNodes()) { Project prj = n.getLookup().lookup(Project.class); if (prj != null && prj.getProjectDirectory().equals(p.getProjectDirectory())) { projNode = n; break; } } if (projNode == null) { // fallback.. projNode = root.getChildren().findChild(ProjectUtils.getInformation(p).getName()); } if (projNode != null) { try { em.setSelectedNodes(new Node[]{projNode}); } catch (Exception ignore) { // may ignore it } } } };
public static File browseTestSources(JTextField textField, PhpProject phpProject) { File selectedFile = new FileChooserBuilder(LastUsedFolders.TEST_DIR) .setTitle(NbBundle.getMessage(Utils.class, "LBL_SelectUnitTestFolder", ProjectUtils.getInformation(phpProject).getDisplayName())) .setDirectoriesOnly(true) .setDefaultWorkingDirectory(FileUtil.toFile(phpProject.getProjectDirectory())) .forceUseOfDefaultWorkingDirectory(true) .showOpenDialog(); if (selectedFile != null) { selectedFile = FileUtil.normalizeFile(selectedFile); if (textField != null) { textField.setText(selectedFile.getAbsolutePath()); } } return selectedFile; }
private String getPackageName(FileObject file){ FileObject parent = file.getParent(); Sources sources = ProjectUtils.getSources(project); SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); String packageName = null; for (int i = 0; i < groups.length && packageName == null; i++) { packageName = FileUtil.getRelativePath(groups[i].getRootFolder(), parent); if (packageName != null) { packageName = groups[i].getName() + "/" + packageName; // NOI18N } } return packageName + ""; // NOI18N }
public GizmoProjectOptions(Project project, boolean shared) { this.shared = shared; aux = ProjectUtils.getAuxiliaryConfiguration(project); NativeProjectType antPrj = (project.getLookup().lookup(NativeProjectType.class)); namespace = antPrj.getPrimaryConfigurationDataElementNamespace(shared); }
public static void fillProjectsCombo(javax.swing.JComboBox comboBox, Project selectedProject) { if (selectedProject == null) { selectedProject = OpenProjects.getDefault().getMainProject(); } for (Project proj : OpenProjects.getDefault().getOpenProjects()) { // include only cnd projects (see IZ 164690) if (proj.getLookup().lookup(ConfigurationDescriptorProvider.class) != null) { ProjectInformation pinfo = ProjectUtils.getInformation(proj); ProjectCBItem pi = new ProjectCBItem(pinfo); comboBox.addItem(pi); if (selectedProject != null && proj == selectedProject) { comboBox.setSelectedItem(pi); } } } }
void setProject(Project project) { // initialize visual components fileNameText.setText(WEB_FRAGMENT_XML); projectText.setText(ProjectUtils.getInformation(project).getDisplayName()); FileObject srcRoot = Utils.getSourceRoot(project); try { if (srcRoot != null) { targetFolder = srcRoot; locationText.setText(FileUtil.getFileDisplayName(targetFolder)+File.separator+META_INF); } } catch(NullPointerException npe) { locationText.setText(""); Logger.global.log(Level.WARNING, NbBundle.getMessage(WebFragmentXmlVisualPanel1.class, "NO_SOURCES_FOUND"), npe); } refreshLocation(); }
/** */ static SourceGroup getSourceGroup(FileObject file, Project prj) { Sources src = ProjectUtils.getSources(prj); SourceGroup[] srcGrps = src.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (SourceGroup srcGrp : srcGrps) { FileObject rootFolder = srcGrp.getRootFolder(); if (((file == rootFolder) || FileUtil.isParentOf(rootFolder, file)) && srcGrp.contains(file)) { return srcGrp; } } return null; }
if (isMaven!=null && isMaven.booleanValue()) { Project prj = FileOwnerQuery.getOwner(webModule.getDocumentBase()); J2eeModuleProvider provider = prj.getLookup().lookup(J2eeModuleProvider.class); if (provider != null) { String serverInstanceId = provider.getServerInstanceID(); webInf = FileUtil.createFolder(webModule.getDocumentBase(), "WEB-INF"); //NOI18N if (prj != null) { String libraryName = serverLibrary.getName(); J2eeModuleProvider provider = prj.getLookup().lookup(J2eeModuleProvider.class); if (provider != null && libraryName != null) { provider.getConfigSupport().configureLibrary( serverLibrary.getImplementationVersion())); Preferences prefs = ProjectUtils.getPreferences(prj, ProjectUtils.class, true); prefs.put(BrokenServerLibrarySupport.OFFER_LIBRARY_DEPLOYMENT, Boolean.TRUE.toString());
public void performAction(Node[] activatedNodes) { for (int i = 0; i < activatedNodes.length; i++) { Node n = activatedNodes[i]; Project project = (Project)n.getValue("Project"); // NOI18N Folder folder = (Folder)n.getValue("Folder"); // NOI18N Item item = (Item)n.getValue("Item"); // NOI18N ConfigurationDescriptorProvider pdp = project.getLookup().lookup(ConfigurationDescriptorProvider.class ); MakeConfigurationDescriptor makeConfigurationDescriptor = pdp.getConfigurationDescriptor(); if (!makeConfigurationDescriptor.okToChange()) { return; } folder.removeItemAction(item); makeConfigurationDescriptor.save(); if (CndPathUtilities.isPathAbsolute(item.getPath())) { ((MakeSources)ProjectUtils.getSources(project)).descriptorChanged(); } } }
private PhpLogicalViewRootNode(PhpProject project) { super(createChildren(project), createLookup(project)); this.project = project; projectInfo = ProjectUtils.getInformation(project); projectProblemsProvider = project.getLookup().lookup(ProjectProblemsProvider.class); assert projectProblemsProvider != null : project; // ui setIconBaseWithExtension(PhpProject.PROJECT_ICON); setName(projectInfo.getDisplayName()); }
@Override protected synchronized void projectOpened() { if(!isFXProject(eval)) { final JFXPlatformUpdater updater = prj.getLookup().lookup(JFXPlatformUpdater.class); Preferences prefs = ProjectUtils.getPreferences(prj, Project.class, false); prefs.put("issue214819_fx_enabled", "true"); //NOI18N ProjectConfigurationProvider<?> pcp = prj.getLookup().lookup(ProjectConfigurationProvider.class); assert pcp != null; LOGGER.log(Level.INFO, "FX PCP: " + pcp.toString()); pcp.addPropertyChangeListener(chl); final JFXPlatformUpdater updater = prj.getLookup().lookup(JFXPlatformUpdater.class);