Java Code Examples for org.netbeans.api.project.ProjectInformation#getDisplayName()
The following examples show how to use
org.netbeans.api.project.ProjectInformation#getDisplayName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassPathFileChooser.java From netbeans with Apache License 2.0 | 6 votes |
private Node createPackageRootNode(FileObject rootFO, Project project, Filter filter) { Node origNode; try { origNode = DataObject.find(rootFO).getNodeDelegate(); } catch (DataObjectNotFoundException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); return null; } String displayName; Project owner = FileOwnerQuery.getOwner(rootFO); if (owner != null) { SourceGroup g = getSourceGroup(rootFO, owner); displayName = g != null ? g.getDisplayName() : FileUtil.getFileDisplayName(rootFO); if (project != owner) { ProjectInformation pi = ProjectUtils.getInformation(owner); displayName += " [" + pi.getDisplayName() + "]"; // NOI18N } } else displayName = FileUtil.getFileDisplayName(rootFO); return new FilteredNode(origNode, displayName, filter); }
Example 2
Source File: SourceRootsUi.java From netbeans with Apache License 2.0 | 6 votes |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (" ".equals(value)) { // NOI18N return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); } File f = (File) value; String message = f.getAbsolutePath(); if (projectConflict) { Project p = FileOwnerQuery.getOwner(Utilities.toURI(f)); if (p!=null) { ProjectInformation pi = ProjectUtils.getInformation(p); String projectName = pi.getDisplayName(); message = MessageFormat.format (NbBundle.getMessage(SourceRootsUi.class,"TXT_RootOwnedByProject"), new Object[] { message, projectName}); } } return super.getListCellRendererComponent(list, message, index, isSelected, cellHasFocus); }
Example 3
Source File: WebServicesClientSupport.java From netbeans with Apache License 2.0 | 5 votes |
public static void showBrokenAlert(Project project) { ProjectInformation pi = ProjectUtils.getInformation(project); String projectName = null; if(pi !=null) projectName = pi.getDisplayName(); NotifyDescriptor alert = new NotifyDescriptor.Message( NbBundle.getMessage(WebServicesClientSupport.class, "ERR_NoJaxrpcPluginFound", projectName), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notifyLater(alert); }
Example 4
Source File: ProjectRenderer.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value == null || value instanceof String) { return super.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus); } ProjectInformation info = ProjectUtils.getInformation((Project) value); JLabel label = (JLabel) super.getListCellRendererComponent(list, info.getDisplayName(), index, isSelected, cellHasFocus); label.setIcon(info.getIcon()); return label; }
Example 5
Source File: FeatureProjectFactory.java From netbeans with Apache License 2.0 | 5 votes |
@Override public String getDisplayName() { ProjectInformation info = delegate.lookup(ProjectInformation.class); if (info != null && info != this) { return info.getDisplayName(); } return getName(); }
Example 6
Source File: JsIndexSearcher.java From netbeans with Apache License 2.0 | 5 votes |
private void initProjectInfo() { FileObject fo = element.getFileObject(); if (fo != null) { Project p = ProjectConvertors.getNonConvertorOwner(fo); if (p != null) { ProjectInformation pi = ProjectUtils.getInformation(p); projectName = pi.getDisplayName(); projectIcon = pi.getIcon(); } } if (projectName == null) { projectName = ""; } }
Example 7
Source File: CurrentJavaProjectScopeProvider.java From netbeans with Apache License 2.0 | 5 votes |
@Override public boolean initialize(Lookup context, AtomicBoolean cancel) { FileObject file = context.lookup(FileObject.class); Project selected = null; if (file != null) { selected = FileOwnerQuery.getOwner(file); } if (selected == null) { selected = context.lookup(Project.class); if (selected == null) { SourceGroup sg = context.lookup(SourceGroup.class); if (sg != null) { selected = FileOwnerQuery.getOwner(sg.getRootFolder()); } } if (selected == null) { DataFolder df = context.lookup(DataFolder.class); if (df != null) { selected = FileOwnerQuery.getOwner(df.getPrimaryFile()); } } } if (selected == null || !OpenProjects.getDefault().isProjectOpen(selected)) { return false; } ProjectInformation pi = ProjectUtils.getInformation(selected); final SourceGroup[] sourceGroups = ProjectUtils.getSources(pi.getProject()).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); FileObject[] projectSources = new FileObject[sourceGroups.length]; for (int i = 0; i < sourceGroups.length; i++) { projectSources[i] = sourceGroups[i].getRootFolder(); } scope = Scope.create(Arrays.asList(projectSources), null, null); detail = pi.getDisplayName(); icon = pi.getIcon(); return true; }
Example 8
Source File: ProjectTreeElement.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates a new instance of ProjectTreeElement */ public ProjectTreeElement(Project prj) { ProjectInformation pi = ProjectUtils.getInformation(prj); name = pi.getDisplayName(); icon = pi.getIcon(); this.prj = new WeakReference<Project>(prj); prjDir = prj.getProjectDirectory(); }
Example 9
Source File: DefaultProjectConvertorServices.java From netbeans with Apache License 2.0 | 5 votes |
@Override @NonNull public String getDisplayName() { final ProjectInformation d = delegate; if (d != null) { return d.getDisplayName(); } else { String res = result.getDisplayName(); if (res == null) { res = getName(); } return res; } }
Example 10
Source File: ProjectTreeElement.java From netbeans with Apache License 2.0 | 5 votes |
public ProjectTreeElement(Project project) { ProjectInformation projectInformation = ProjectUtils.getInformation(project); name = projectInformation.getDisplayName(); icon = projectInformation.getIcon(); projectReference = new WeakReference<>(project); projectDirectory = project.getProjectDirectory(); }
Example 11
Source File: WebServicesSupport.java From netbeans with Apache License 2.0 | 5 votes |
public void showBrokenAlert(Project project) { ProjectInformation pi = ProjectUtils.getInformation(project); String projectName = null; if(pi !=null) projectName = pi.getDisplayName(); NotifyDescriptor alert = new NotifyDescriptor.Message( NbBundle.getMessage(WebServicesSupport.class, "ERR_NoJaxrpcPluginFound", projectName), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notifyLater(alert); }
Example 12
Source File: FileDescription.java From netbeans with Apache License 2.0 | 5 votes |
@Override @NonNull public String getProjectName() { String res = projectName; if (res == null) { final ProjectInformation pi = getProjectInfo(); res = projectName = pi == null ? "" : //NOI18N pi.getDisplayName(); } return res; }
Example 13
Source File: HgProjectUtils.java From netbeans with Apache License 2.0 | 4 votes |
public static String getProjectName( final Project p ) { if( p == null) return null; ProjectInformation pi = ProjectUtils.getInformation(p); return pi == null ? null : pi.getDisplayName(); }
Example 14
Source File: CurrentJavaProjectDependenciesScopeProvider.java From netbeans with Apache License 2.0 | 4 votes |
@Override public boolean initialize(Lookup context, AtomicBoolean cancel) { if(!JavaWhereUsedQueryPlugin.DEPENDENCIES) { return false; } FileObject file = context.lookup(FileObject.class); Project selected = null; if (file != null) { selected = FileOwnerQuery.getOwner(file); } if (selected == null) { selected = context.lookup(Project.class); if (selected == null) { SourceGroup sg = context.lookup(SourceGroup.class); if (sg != null) { selected = FileOwnerQuery.getOwner(sg.getRootFolder()); } } if (selected == null) { DataFolder df = context.lookup(DataFolder.class); if (df != null) { selected = FileOwnerQuery.getOwner(df.getPrimaryFile()); } } } if (selected == null || !OpenProjects.getDefault().isProjectOpen(selected)) { return false; } ProjectInformation pi = ProjectUtils.getInformation(selected); final SourceGroup[] sourceGroups = ProjectUtils.getSources(pi.getProject()).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); FileObject[] projectSources = new FileObject[sourceGroups.length]; for (int i = 0; i < sourceGroups.length; i++) { projectSources[i] = sourceGroups[i].getRootFolder(); } scope = Scope.create(Arrays.asList(projectSources), null, null, true); detail = pi.getDisplayName(); icon = new ImageIcon(ImageUtilities.mergeImages( ImageUtilities.icon2Image(pi.getIcon()), ImageUtilities.loadImage("org/netbeans/modules/refactoring/java/resources/binary_badge.gif"), 10, 10)); return true; }
Example 15
Source File: JavaEEProjectSettings.java From netbeans with Apache License 2.0 | 4 votes |
@Override public String getMessage() { ProjectInformation information = ProjectUtils.getInformation(project); return "Project " + information.getDisplayName() + " doesn't support JavaEEProjectSettings. " //NOI18N + "Add implementation of JavaEEProjectSettingsImplementation into its Project Type lookup."; //NOI18N }
Example 16
Source File: ProjectServicesImpl.java From netbeans with Apache License 2.0 | 4 votes |
private static IDEProject createIDEProject(Project p) { ProjectInformation pi = ProjectUtils.getInformation(p); return new NbProject(pi.getDisplayName(), pi.getIcon(), p.getProjectDirectory().toURL()); }
Example 17
Source File: ProjectUtilities.java From netbeans with Apache License 2.0 | 4 votes |
public static String getProjectName(Lookup.Provider project) { ProjectInformation info = project.getLookup().lookup(ProjectInformation.class); return (info != null) ? info.getDisplayName() : "UNKNOWN"; }
Example 18
Source File: GradleDaemonExecutor.java From netbeans with Apache License 2.0 | 4 votes |
private String getProjectName() { ProjectInformation info = ProjectUtils.getInformation(config.getProject()); return info.getDisplayName(); }
Example 19
Source File: GrailsCommandAction.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void performAction() { final GrailsPlatform runtime = GrailsPlatform.getDefault(); if (!runtime.isConfigured()) { ConfigurationSupport.showConfigurationWarning(runtime); return; } final GrailsProject project = inferGrailsProject(); if (project == null) { return; } GrailsCommandChooser.CommandDescriptor commandDescriptor = GrailsCommandChooser.select(project); if (commandDescriptor == null) { return; } ProjectInformation inf = ProjectUtils.getInformation(project); String displayName = inf.getDisplayName() + " (" + commandDescriptor.getGrailsCommand().getCommand() + ")"; // NOI18N final String[] params; // FIXME all parameters in one String should we split it ? if (commandDescriptor.getCommandParams() != null && !"".equals(commandDescriptor.getCommandParams().trim())) { params = new String[] {commandDescriptor.getCommandParams()}; } else { params = new String[] {}; } Callable<Process> callable; ExecutionDescriptor descriptor; final boolean debug = commandDescriptor.isDebug(); if (GrailsPlatform.IDE_RUN_COMMAND.equals(commandDescriptor.getGrailsCommand().getCommand())) { final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.class); Process process = null; if (serverState != null && serverState.isRunning()) { if (!debug /*|| debug == serverState.isDebug()*/) { URL url = serverState.getRunningUrl(); if (url != null) { GrailsCommandSupport.showURL(url, debug, project); } return; } else { process = serverState.getProcess(); if (process != null) { process.destroy(); } } } final Process oldProcess = process; callable = new Callable<Process>() { public Process call() throws Exception { if (oldProcess != null) { oldProcess.waitFor(); } Callable<Process> inner = ExecutionSupport.getInstance().createRunApp( GrailsProjectConfig.forProject(project), debug, params); Process process = inner.call(); final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.class); if (serverState != null) { serverState.setProcess(process); serverState.setDebug(debug); } return process; } }; descriptor = project.getCommandSupport().getRunDescriptor(debug); } else { callable = ExecutionSupport.getInstance().createSimpleCommand( commandDescriptor.getGrailsCommand().getCommand(), debug, GrailsProjectConfig.forProject(project), params); descriptor = project.getCommandSupport().getDescriptor( commandDescriptor.getGrailsCommand().getCommand(), debug); } ExecutionService service = ExecutionService.newService(callable, descriptor, displayName); service.run(); }
Example 20
Source File: ProjectSupportImpl.java From netbeans with Apache License 2.0 | 4 votes |
private static ProjectProxy createProxy( Project p ) { ProjectInformation info = ProjectUtils.getInformation( p ); FileObject projectDir = p.getProjectDirectory(); return new ProjectProxy( p, info.getDisplayName(), projectDir.getPath() ); }