当前位置: 首页>>代码示例>>Java>>正文


Java ProjectInformation类代码示例

本文整理汇总了Java中org.netbeans.api.project.ProjectInformation的典型用法代码示例。如果您正苦于以下问题:Java ProjectInformation类的具体用法?Java ProjectInformation怎么用?Java ProjectInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectInformation类属于org.netbeans.api.project包,在下文中一共展示了ProjectInformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SuiteComponentNode

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
public SuiteComponentNode(final NbModuleProject suiteComponent) {
    super(Children.LEAF, Lookups.fixed(new Object[] {suiteComponent}));
    ProjectInformation info = ProjectUtils.getInformation(suiteComponent);
    setName(info.getName());
    setDisplayName(info.getDisplayName());
    setIconBaseWithExtension(NbModuleProject.NB_PROJECT_ICON_PATH);
    info.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(final PropertyChangeEvent evt) {
            ImportantFilesNodeFactory.getNodesSyncRP().post(new Runnable() {

                public void run() {
                    if (ProjectInformation.PROP_DISPLAY_NAME.equals(evt.getPropertyName())) {
                        SuiteComponentNode.this.setDisplayName((String) evt.getNewValue());
                    } else if (ProjectInformation.PROP_NAME.equals(evt.getPropertyName())) {
                        SuiteComponentNode.this.setName((String) evt.getNewValue());
                    }
                }
            });
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ModulesNodeFactory.java

示例2: testProjectInformation

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
public void testProjectInformation() throws Exception {
    SuiteProject p = TestBase.generateSuite(getWorkDir(), "Sweet Stuff");
    ProjectInformation i = ProjectUtils.getInformation(p);
    assertEquals("Sweet_Stuff", i.getName());
    assertEquals("Sweet Stuff", i.getDisplayName());
    BrandingModel model = new SuiteBrandingModel(new SuiteProperties(p, p.getHelper(), p.getEvaluator(), Collections.<NbModuleProject>emptySet()));
    model.init();
    assertEquals("sweet_stuff", model.getName());
    assertEquals("Sweet Stuff", model.getTitle());
    TestBase.TestPCL l = new TestBase.TestPCL();
    i.addPropertyChangeListener(l);
    EditableProperties ep = p.getHelper().getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
    ep.setProperty("app.name", "sweetness");
    ep.setProperty("app.title", "Sweetness is Now!");
    p.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
    assertEquals(new HashSet<String>(Arrays.asList(ProjectInformation.PROP_NAME, ProjectInformation.PROP_DISPLAY_NAME)), l.changed);
    assertEquals("Sweet_Stuff", i.getName());
    assertEquals("Sweetness is Now!", i.getDisplayName());
    model = new SuiteBrandingModel(new SuiteProperties(p, p.getHelper(), p.getEvaluator(), Collections.<NbModuleProject>emptySet()));
    model.init();
    assertEquals("sweetness", model.getName());
    assertEquals("Sweetness is Now!", model.getTitle());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:SuiteProjectTest.java

示例3: testBundleKeyDefaultBundle

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
@RandomlyFails // NB-Core-Build #4355: display name after from bundle expected:<[Much Better Nam]e> but was:<[Testing Modul]e>
public void testBundleKeyDefaultBundle() throws Exception {
    NbModuleProject project = TestBase.generateStandaloneModule(getWorkDir(), "module1");
    ProjectInformation pi = ProjectUtils.getInformation(project);
    assertEquals("display name before from bundle", "Testing Module", pi.getDisplayName());
    assertEquals("display name before from project", "Testing Module", project.getBundleInfo().getDisplayName());
    
    CreatedModifiedFiles cmf = new CreatedModifiedFiles(project);
    Operation op = cmf.bundleKeyDefaultBundle(LocalizedBundleInfo.NAME, "Much Better Name");
    assertRelativePath("src/org/example/module1/resources/Bundle.properties",
            op.getModifiedPaths());
    op.run();
    
    pi = ProjectUtils.getInformation(project);
    assertEquals("display name after from bundle", "Much Better Name", pi.getDisplayName());
    assertEquals("display name after from project", "Much Better Name", project.getBundleInfo().getDisplayName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:CreatedModifiedFilesTest.java

示例4: createPackageRootNode

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
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);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ClassPathFileChooser.java

示例5: projectDisplayNameComparator

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
/**
 * Order projects by display name.
 */
public static Comparator<Project> projectDisplayNameComparator() {
    return new Comparator<Project>() {
        private final Collator LOC_COLLATOR = Collator.getInstance();
        public int compare(Project o1, Project o2) {
            ProjectInformation i1 = ProjectUtils.getInformation(o1);
            ProjectInformation i2 = ProjectUtils.getInformation(o2);
            int result = LOC_COLLATOR.compare(i1.getDisplayName(), i2.getDisplayName());
            if (result != 0) {
                return result;
            } else {
                result = i1.getName().compareTo(i2.getName());
                if (result != 0) {
                    return result;
                } else {
                    return System.identityHashCode(o1) - System.identityHashCode(o2);
                }
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:Util.java

示例6: getListCellRendererComponent

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    // #89393: GTK needs name to render cell renderer "natively"
    setName("ComboBox.listRenderer"); // NOI18N
    if (value instanceof Project) {
        ProjectInformation pi = ProjectUtils.getInformation((Project) value);
        setText(pi.getDisplayName());
        setIcon(pi.getIcon());
    } else {
        setText(value == null ? "" : value.toString()); // NOI18N
        setIcon(null);
    }
    if (isSelected) {
        setBackground(list.getSelectionBackground());
        setForeground(list.getSelectionForeground());
    } else {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
    }
    return this;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ProjectCellRenderer.java

示例7: run

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
@Override
public void run() {
    try {
        final NbMavenProject nb = project.getLookup().lookup(NbMavenProject.class);
        if (!nb.isMavenProjectLoaded()) {                    
            nb.getMavenProject();
        }
        String s = getDisplayName(nb);            
        if(!s.equals(displayName)) {
            displayName = s;
            pcs.firePropertyChange(ProjectInformation.PROP_DISPLAY_NAME, null, null);
        }
    } finally {
        displayNameRunning = false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:Info.java

示例8: getIcon

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
@Override public Icon getIcon() {
    final NbMavenProject nb = project.getLookup().lookup(NbMavenProject.class);
    if (SwingUtilities.isEventDispatchThread() && !nb.isMavenProjectLoaded()) {
        RP.post(new Runnable() {
            @Override
            public void run() {
                //assuming this takes long and hangs in sync.
                nb.getMavenProject();
                pcs.firePropertyChange(ProjectInformation.PROP_ICON, null, null);
            }
        });
        return ImageUtilities.loadImageIcon("org/netbeans/modules/maven/resources/Maven2Icon.gif", true);
    }
    SpecialIcon special = project.getLookup().lookup(SpecialIcon.class);
    if (special != null) {
        Icon icon = special.getIcon();
        if (icon != null) {
            return icon;
        } else {
            LOG.log(Level.WARNING, "No icon provided by {0}", special);
        }
    }
    return ImageUtilities.loadImageIcon("org/netbeans/modules/maven/resources/Maven2Icon.gif", true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:Info.java

示例9: getListCellRendererComponent

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SourceRootsUi.java

示例10: showJavadoc

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
@Override
public void showJavadoc() {
    Set<URL> us = findJavadoc();
    URL[] urls = us.toArray(new URL[us.size()]);
    URL pageURL = ShowJavadocAction.findJavadoc("overview-summary.html",urls);
    if (pageURL == null) {
        pageURL = ShowJavadocAction.findJavadoc("index.html",urls);
    }
    ProjectInformation info = null;
    Project p = this.antArtifact.getProject ();
    if (p != null) {
        info = ProjectUtils.getInformation(p);
    }
    ShowJavadocAction.showJavaDoc (pageURL, info == null ?
        NbBundle.getMessage (ProjectNode.class,"TXT_UnknownProjectName") : info.getDisplayName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ProjectNode.java

示例11: configurationXmlChanged

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
@Override
public void configurationXmlChanged(AntProjectEvent ev) {
    // only interested in changes to nbproject/project.xml
    if (AntProjectHelper.PROJECT_XML_PATH.equals(ev.getPath())) {
        // Could be various kinds of changes, but name & displayName might have changed.
        String oldName;
        String oldDisplayName;
        String newName;
        String newDisplayName;

        synchronized (guard) {
            oldName = name;
            oldDisplayName = displayName;
            // reset so they are re-read
            name = null;
            displayName = null;
            newName = getName();
            newDisplayName = getDisplayName();
        }

        firePropertyChange(ProjectInformation.PROP_NAME, oldName, newName);
        firePropertyChange(ProjectInformation.PROP_DISPLAY_NAME, oldDisplayName, newDisplayName);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ProjectInfoImpl.java

示例12: testAntHelperProject

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
public void testAntHelperProject() throws IOException {
    AntProjectHelper h = ProjectGenerator.createProject(projdir, "test");
    Project p = ProjectManager.getDefault().findProject(projdir);

    ProjectInformation pi = QuerySupport.createProjectInformation(h, p, null);
    assertEquals("???", pi.getDisplayName());
    assertEquals("___", pi.getName());
    Element data = h.getPrimaryConfigurationData(true);
    Element name = data.getOwnerDocument().createElementNS("urn:test:shared", "name");
    name.setTextContent("Test AntProjectHelper");
    data.appendChild(name);
    h.putPrimaryConfigurationData(data, true);

    assertEquals("Test AntProjectHelper", pi.getDisplayName());
    assertEquals("Test_AntProjectHelper", pi.getName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:QuerySupportTest.java

示例13: testAntUpdateHelperProject

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
public void testAntUpdateHelperProject() throws IOException {
    AntProjectHelper ah = ProjectGenerator.createProject(projdir, "test");
    Project p = ProjectManager.getDefault().findProject(projdir);
    UpdateImplementation upi = createUpdateImpl(ah);
    UpdateHelper uh = new UpdateHelper(upi, ah);

    ProjectInformation pi = QuerySupport.createProjectInformation(uh, p, null);
    assertEquals("???", pi.getDisplayName());
    assertEquals("___", pi.getName());
    Element data = uh.getPrimaryConfigurationData(true);
    Element name = data.getOwnerDocument().createElementNS("urn:test:shared", "name");
    name.setTextContent("Test UpdateHelper");
    data.appendChild(name);
    uh.putPrimaryConfigurationData(data, true);

    assertEquals("Test UpdateHelper", pi.getDisplayName());
    assertEquals("Test_UpdateHelper", pi.getName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:QuerySupportTest.java

示例14: getProjectInfo

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
@CheckForNull
private ProjectInformation getProjectInfo() {
    // Issue #167198: A file may not belong to any project.
    // Hence, FileOwnerQuery.getOwner(file) can return null as a project,
    // and fileDescription.project will be null too.
    // But! We should not call ProjectUtils.getInformation(null).
    if(project == null) {
        return null;
    }
    ProjectInformation res = projectInfo;
    if (res == null) {
        //Don't use slow ProjectUtils.getInformation
        res = projectInfo = project.getLookup().lookup(ProjectInformation.class);
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:FileDescription.java

示例15: getListCellRendererComponent

import org.netbeans.api.project.ProjectInformation; //导入依赖的package包/类
public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    // #93658: GTK needs name to render cell renderer "natively"
    setName("ComboBox.listRenderer"); // NOI18N

    String text = null;
    if (!(value instanceof Project)) {
        text = value.toString();
    } else {
        ProjectInformation pi = ProjectUtils.getInformation((Project) value);
        text = pi.getDisplayName();
        setIcon(pi.getIcon());
    }
    setText(text);

    if ( isSelected ) {
        setBackground(list.getSelectionBackground());
        setForeground(list.getSelectionForeground());
    }
    else {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
    }

    return this;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:WizardUtils.java


注:本文中的org.netbeans.api.project.ProjectInformation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。