Java Code Examples for org.netbeans.api.project.ProjectInformation#getIcon()
The following examples show how to use
org.netbeans.api.project.ProjectInformation#getIcon() .
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: GroovyTypeSearcher.java From netbeans with Apache License 2.0 | 6 votes |
private void initProjectInfo() { FileObject fo = element.getFileObject(); if (fo != null) { // Findbugs-Removed: File f = FileUtil.toFile(fo); Project p = FileOwnerQuery.getOwner(fo); if (p != null) { ProjectInformation pi = ProjectUtils.getInformation(p); projectName = pi.getDisplayName(); projectIcon = pi.getIcon(); } } else { isLibrary = true; LOGGER.log(Level.FINE, "No fileobject for {0}", element.toString()); } if (projectName == null) { projectName = ""; } }
Example 2
Source File: PHPTypeSearcher.java From netbeans with Apache License 2.0 | 6 votes |
private void initProjectInfo() { FileObject fo = element.getFileObject(); if (fo != null) { Project p = ProjectConvertors.getNonConvertorOwner(fo); if (p != null) { if (PhpProjectUtils.isPhpProject(p)) { projectDirectory = p.getProjectDirectory(); } ProjectInformation pi = ProjectUtils.getInformation(p); projectName = pi.getDisplayName(); projectIcon = pi.getIcon(); } } if (projectName == null) { projectName = ""; } }
Example 3
Source File: JavaTypeProvider.java From netbeans with Apache License 2.0 | 5 votes |
private void initProjectInfo() { Project p = FileOwnerQuery.getOwner(this.rootURI); if (p != null) { final ProjectInformation pi = p.getLookup().lookup(ProjectInformation.class); //Intentionally does not use ProjectUtil.getInformation() as it does slow icon annotation projectName = pi == null ? p.getProjectDirectory().getNameExt() : pi.getDisplayName(); projectIcon = pi == null ? null : pi.getIcon(); } }
Example 4
Source File: AbstractBeanTypeDescriptor.java From netbeans with Apache License 2.0 | 5 votes |
private void initProjectInfo() { Project p = FileOwnerQuery.getOwner(fileObject); if (p != null) { ProjectInformation pi = ProjectUtils.getInformation(p); projectName = pi.getDisplayName(); projectIcon = pi.getIcon(); } }
Example 5
Source File: ProjectNode.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Image getIcon(int type) { if (cachedIcon == null) { ProjectInformation info = getProjectInformation(); if (info != null) { Icon icon = info.getIcon(); cachedIcon = ImageUtilities.icon2Image(icon); } else { cachedIcon = ImageUtilities.loadImage(PROJECT_ICON); } } return cachedIcon; }
Example 6
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 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: 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 9
Source File: FeatureProjectFactory.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Icon getIcon() { ProjectInformation info = delegate.lookup(ProjectInformation.class); if (info != null && info != this) { return info.getIcon(); } return loadIcon(); }
Example 10
Source File: ProjectUtilities.java From netbeans with Apache License 2.0 | 5 votes |
public static Icon getProjectIcon(Lookup.Provider project) { ProjectInformation info = project.getLookup().lookup(ProjectInformation.class); if (info == null) { return new ImageIcon(); } else { return info.getIcon(); } }
Example 11
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 12
Source File: DefaultProjectConvertorServices.java From netbeans with Apache License 2.0 | 5 votes |
@Override @NonNull public Icon getIcon() { final ProjectInformation d = delegate; if (d != null) { return d.getIcon(); } else { Icon res = result.getIcon(); //Todo: Handle null res return res; } }
Example 13
Source File: SearchScopeMainProject.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Icon getIcon() { Project p = OpenProjects.getDefault().getMainProject(); if (p != null) { ProjectInformation pi = ProjectUtils.getInformation(p); if (pi != null) { return pi.getIcon(); } } return null; }
Example 14
Source File: FileDescription.java From netbeans with Apache License 2.0 | 5 votes |
@Override @NonNull public Icon getProjectIcon() { Icon res = projectIcon; if ( res == null ) { final ProjectInformation pi = getProjectInfo(); res = projectIcon = pi == null ? UNKNOWN_PROJECT_ICON : pi.getIcon(); } return res; }
Example 15
Source File: ProjectNode.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@Override public Image getIcon(int type) { if (cachedIcon == null) { ProjectInformation info = getProjectInformation(); if (info != null) { Icon icon = info.getIcon(); cachedIcon = ImageUtilities.icon2Image(icon); } else { cachedIcon = ImageUtilities.loadImage(PROJECT_ICON); } } return cachedIcon; }
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()); }