org.netbeans.api.project.ProjectUtils Java Examples

The following examples show how to use org.netbeans.api.project.ProjectUtils. 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: ClassSetupPanelVisual.java    From jeddict with Apache License 2.0 6 votes vote down vote up
void read(WizardDescriptor settings) {
    FileObject targetFolder = Templates.getTargetFolder(settings);
    projectTextField.setText(ProjectUtils.getInformation(project).getDisplayName());
    SourceGroup[] sourceGroups = getJavaSourceGroups(project);
    SourceGroupUISupport.connect(locationComboBox, sourceGroups);
    packageComboBox.setRenderer(PackageView.listRenderer());
    updateSourceGroupPackages();

    // set default source group and package cf. targetFolder
    if (targetFolder != null) {
        SourceGroup targetSourceGroup = getFolderSourceGroup(sourceGroups, targetFolder);
        if (targetSourceGroup != null) {
            locationComboBox.setSelectedItem(targetSourceGroup);
            String targetPackage = getPackageForFolder(targetSourceGroup, targetFolder);
            if (targetPackage != null) {
                packageComboBoxEditor.setText(targetPackage);
            }
        }
    }
}
 
Example #2
Source File: MavenSourcesImplTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testNewlyCreatedSourceGroup() throws Exception { // #200969
    TestFileUtils.writeFile(d, "pom.xml", "<project><modelVersion>4.0.0</modelVersion><groupId>g</groupId><artifactId>a</artifactId><version>0</version></project>");
    FileObject main = FileUtil.createFolder(d, "src/main/java");
    Project p = ProjectManager.getDefault().findProject(d);
    Sources s = ProjectUtils.getSources(p);
    SourceGroup[] grps = s.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    assertEquals(1, grps.length);
    assertEquals(main, grps[0].getRootFolder());
    MockChangeListener l = new MockChangeListener();
    s.addChangeListener(l);
    SourceGroup g2 = SourceGroupModifier.createSourceGroup(p, JavaProjectConstants.SOURCES_TYPE_JAVA, JavaProjectConstants.SOURCES_HINT_TEST);
    l.assertEvent();
    grps = s.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    assertEquals(2, grps.length);
    assertEquals(main, grps[0].getRootFolder());
    assertEquals(g2, grps[1]);
}
 
Example #3
Source File: WizardUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: ProjectOperations.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void clean() throws IOException {
    final Properties p = new Properties();
    final String buildXmlName = CommonProjectUtils.getBuildXmlName(eval, buildScriptProperty);
    final FileObject buildXML = project.getProjectDirectory().getFileObject(buildXmlName);
    if (buildXML != null) {
        ActionUtils.runTarget(
            buildXML,
            cleanTargets.toArray(new String[cleanTargets.size()]),
            p).waitFinished();
    } else {
        LOG.log(
            Level.INFO,
            "Not cleaning the project: {0}, the build file: {1} does not exist.", //NOI18N
            new Object[] {
                ProjectUtils.getInformation(project).getDisplayName(),
                buildXmlName
            });
    }
}
 
Example #5
Source File: PayaraDDVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
void setProject(final Project project) {
    this.project = project;

    // get list of config files for this module type
    // figure out which ones exist already
    // 
    Lookup lookup = project.getLookup();
    J2eeModuleProvider provider = lookup.lookup(J2eeModuleProvider.class);
    J2eeModule j2eeModule = provider.getJ2eeModule();
    payaraDDFileName = getConfigFileName(j2eeModule,provider.getServerInstanceID());

    // Calculate location:
    payaraDDLocation = j2eeModule.getDeploymentConfigurationFile(WEB_XML).getParentFile();
    payaraDDFile = new File(payaraDDLocation, payaraDDFileName);
    
    // initialize visual components
    textFileName.setText(payaraDDFileName); // NOI18N
    textProjectName.setText(ProjectUtils.getInformation(project).getDisplayName());

    File projectFolder = FileUtil.toFile(project.getProjectDirectory());
    textLocation.setText((payaraDDLocation != null) ? getRelativePath(payaraDDLocation, projectFolder) : null);
    // only fill 'created file' in if location is valid.
    textCreatedFile.setText((payaraDDLocation != null) ? getRelativePath(payaraDDFile, projectFolder) : null);
}
 
Example #6
Source File: TaskProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void setScope(TaskScanningScope scope, Callback callback) {
    //cancel all current operations:
    cancelAllCurrent();
    
    this.scope = scope;
    this.callback = callback;
    
    if (scope == null || callback == null)
        return ;
    
    for (FileObject file : scope.getLookup().lookupAll(FileObject.class)) {
        enqueue(new Work(file, callback));
    }
    
    for (Project p : scope.getLookup().lookupAll(Project.class)) {
        for (SourceGroup generic : ProjectUtils.getSources(p).getSourceGroups(Sources.TYPE_GENERIC)) {
            for (FileObject root : Utilities.findIndexedRootsUnderDirectory(p, generic.getRootFolder())) {
                enqueue(new Work(root, callback));
            }
        }
    }
}
 
Example #7
Source File: CdiUtil.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static boolean hasResource(Project project, String resource) {
    SourceGroup[] sgs = ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    if (sgs.length < 1) {
        return false;
    }
    FileObject sourceRoot = sgs[0].getRootFolder();
    ClassPath classPath = ClassPath.getClassPath(sourceRoot, ClassPath.COMPILE);
    if (classPath == null) {
        return false;
    }
    FileObject resourceFile = classPath.findResource(resource);
    if (resourceFile != null) {
        return true;
    }
    return false;
}
 
Example #8
Source File: ProjectCellRenderer.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
  if (!(value instanceof Project)){
    return this;
  }
  
  setName("ComboBox.listRenderer");
  
  final ProjectInformation info = ProjectUtils.getInformation((Project)value);
  setText(info.getDisplayName());
  setIcon(info.getIcon());
  
  if (isSelected){
    setBackground(list.getSelectionBackground());
    setForeground(list.getSelectionForeground());
  }else{
    setBackground(list.getBackground());
    setForeground(list.getForeground());
  }
  
  return this;
}
 
Example #9
Source File: BrokenReferencesModel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
String getDisplayName() {
    final String displayName = problem.getDisplayName();
    String message;
    if (global) {
        final String projectName = ProjectUtils.getInformation(project).getDisplayName();
        message = NbBundle.getMessage(
                BrokenReferencesModel.class,
                "FMT_ProblemInProject",
                projectName,
                displayName);

    } else {
        message = displayName;
    }
    return message;
}
 
Example #10
Source File: MavenSourcesImplTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testGeneratedSources() throws Exception { // #187595
    TestFileUtils.writeFile(d,
            "pom.xml",
            "<project xmlns='http://maven.apache.org/POM/4.0.0'>" +
            "<modelVersion>4.0.0</modelVersion>" +
            "<groupId>grp</groupId>" +
            "<artifactId>art</artifactId>" +
            "<packaging>jar</packaging>" +
            "<version>0</version>" +
            "</project>");
    FileObject src = FileUtil.createFolder(d, "src/main/java");
    FileObject gsrc = FileUtil.createFolder(d, "target/generated-sources/xjc");
    gsrc.createData("Whatever.class");
    FileObject tsrc = FileUtil.createFolder(d, "src/test/java");
    FileObject gtsrc = FileUtil.createFolder(d, "target/generated-test-sources/jaxb");
    gtsrc.createData("Whatever.class");
    SourceGroup[] grps = ProjectUtils.getSources(ProjectManager.getDefault().findProject(d)).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    assertEquals(2, grps.length);
    assertEquals(src, grps[0].getRootFolder());
    assertEquals(tsrc, grps[1].getRootFolder());
    grps = ProjectUtils.getSources(ProjectManager.getDefault().findProject(d)).getSourceGroups(MavenSourcesImpl.TYPE_GEN_SOURCES);
    assertEquals(2, grps.length);
    assertEquals(gsrc, grps[0].getRootFolder());
    assertEquals(gtsrc, grps[1].getRootFolder());
}
 
Example #11
Source File: RemoteGeneratedFilesInterceptor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void fileGenerated(@NonNull final Project project, @NonNull final String path) {
    if (GeneratedFilesHelper.BUILD_IMPL_XML_PATH.equals(path)) {
        final AntBuildExtender extender = prj.getLookup().lookup(AntBuildExtender.class);
        if (extender == null) {
            LOG.log(
                Level.WARNING,
                "The project: {0} ({1}) has no AntBuildExtender.",   //NOI18N
                new Object[] {
                    ProjectUtils.getInformation(prj).getDisplayName(),
                    FileUtil.getFileDisplayName(prj.getProjectDirectory())
                });
            return;
        }
        runDeferred(new Runnable() {
            @Override
            public void run() {
                try {
                    updateBuildScript();
                } catch (IOException ioe) {
                    Exceptions.printStackTrace(ioe);
                }
            }
        });
    }
}
 
Example #12
Source File: AddDependencyAction.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
private void findCompileTimeDependencies(NbAndroidProject project, List<ArtifactData> compileDependecies) {
    final ClassPathProvider cpProvider = project.getLookup().lookup(ClassPathProvider.class);
    if (cpProvider != null) {
        Sources srcs = ProjectUtils.getSources(project);
        SourceGroup[] sourceGroups = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
        Set<FileObject> roots = Sets.newHashSet();
        for (SourceGroup sg : sourceGroups) {
            roots.add(sg.getRootFolder());
        }
        Iterable<ClassPath> compileCPs = Iterables.transform(roots, new Function<FileObject, ClassPath>() {

            @Override
            public ClassPath apply(FileObject f) {
                return cpProvider.findClassPath(f, ClassPath.COMPILE);
            }
        });
        ClassPath compileCP
                = ClassPathSupport.createProxyClassPath(Lists.newArrayList(compileCPs).toArray(new ClassPath[0]));
        if (cpProvider instanceof AndroidClassPath) {
            for (FileObject cpRoot : compileCP.getRoots()) {
                ArtifactData lib = ((AndroidClassPath) cpProvider).getArtifactData(cpRoot.toURL());
                compileDependecies.add(lib);
            }
        }
    }
}
 
Example #13
Source File: PersistenceEnvironmentImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the project classpath including project build paths.
 * Can be used to set classpath for custom classloader.
 * 
 * @param projectFile may not be used in method realization
 * @return List of java.io.File objects representing each entry on the classpath.
 */
@Override
public List<URL> getProjectClassPath(FileObject projectFile) {
    List<URL> projectClassPathEntries = new ArrayList<URL>();
    SourceGroup[] sgs = ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    if (sgs.length < 1) {
        return projectClassPathEntries;
    }
    FileObject sourceRoot = sgs[0].getRootFolder();
    ClassPathProvider cpProv = project.getLookup().lookup(ClassPathProvider.class);
    ClassPath cp = cpProv.findClassPath(sourceRoot, ClassPath.EXECUTE);
    if(cp == null){
        cp = cpProv.findClassPath(sourceRoot, ClassPath.COMPILE);
    }
    for (ClassPath.Entry cpEntry : cp.entries()) {
        if(cpEntry.isValid()){
            //if project isn't build, there may be number of invalid entries and may be in some other cases
            projectClassPathEntries.add(cpEntry.getURL());
        }
    }

    return projectClassPathEntries;
}
 
Example #14
Source File: AbstractJaxRsFeatureIterator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize( WizardDescriptor wizard ) {
    myWizard = wizard;
    Project project = Templates.getProject(wizard);
    SourceGroup[] sourceGroups = SourceGroupSupport.getJavaSourceGroups(project);    
    
    Panel<?> panel ;
    myPanel = createPanel(wizard);
    if (sourceGroups.length == 0) {
        SourceGroup[] genericSourceGroups = ProjectUtils.
                getSources(project).getSourceGroups(Sources.TYPE_GENERIC);
        panel = Templates.buildSimpleTargetChooser(project,  genericSourceGroups).
                    bottomPanel( myPanel).create();
    } else {
        panel = JavaTemplates.createPackageChooser(project, sourceGroups, 
                        myPanel, true);
    }
    myPanels = new Panel[]{ panel };
    setSteps();        
}
 
Example #15
Source File: GroovyTypeSearcher.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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 #16
Source File: AbstractLogicalViewProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean isVisualWebLegacyProject() {
    boolean isLegacyProject = false;

    // Check if Web module is a visualweb 5.5.x or Creator project
    AuxiliaryConfiguration ac = ProjectUtils.getAuxiliaryConfiguration(project);
    Element auxElement = ac.getConfigurationFragment("creator-data", "http://www.sun.com/creator/ns", true); //NOI18N

    // if project is a visualweb or creator project then find out whether it is a legacy project
    if (auxElement != null) {
        String version = auxElement.getAttribute("jsf.project.version"); //NOI18N
        if (version != null) {
            if (!version.equals("4.0")) { //NOI18N
                isLegacyProject = true;
            }
        }
    }

    return isLegacyProject;
}
 
Example #17
Source File: ArtifactTreeElement.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override public Icon getIcon() {
    if (!art.getVersion().isEmpty()) {
        try {
            Project p = FileOwnerQuery.getOwner(RepositoryUtil.downloadArtifact(art).toURI());
            if (p != null) {
                return ProjectUtils.getInformation(p).getIcon();
            }
        } catch (Exception x) {
            LOG.log(Level.FINE, null, "could not check project icon for " + art);
        }
        return ImageUtilities.loadImageIcon(IconResources.ICON_DEPENDENCY_JAR, true);
    } else if (!art.getArtifactId().isEmpty()) {
        // XXX should probably be moved into NodeUtils
        return ImageUtilities.loadImageIcon("org/netbeans/modules/maven/repository/ArtifactBadge.png", true);
    } else {
        return ImageUtilities.image2Icon(NodeUtils.getTreeFolderIcon(false));
    }
}
 
Example #18
Source File: CordovaPerformer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean hasOtherBuildTool(Project project, String toolfile, String toolName, Runnable r) {
    if(project.getProjectDirectory().getFileObject(toolfile) != null) {
        ProjectInformation info = ProjectUtils.getInformation(project);
        String name = info != null ? info.getDisplayName() : project.getProjectDirectory().getNameExt();
        JButton tool = new JButton(toolName);
        NotifyDescriptor desc = new NotifyDescriptor(
            Bundle.MSG_SelectBuildTool(name, toolfile, toolName),
            Bundle.CTL_SelectBuildTool(),
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.QUESTION_MESSAGE,
            new Object[] {tool, new JButton("Ant"), NotifyDescriptor.CANCEL_OPTION},
            NotifyDescriptor.OK_OPTION);
        DialogDisplayer.getDefault().notify(desc);
        if(desc.getValue() == tool) {
            r.run();
            return true;
        } else if (desc.getValue() == NotifyDescriptor.CANCEL_OPTION) {
            return true;
        }
    }
    return false;
}
 
Example #19
Source File: WebXmlVisualPanel1.java    From netbeans with Apache License 2.0 6 votes vote down vote up
void setProject(Project project) {
    // initialize visual components
    fileNameText.setText(WEB_XML);
    projectText.setText(ProjectUtils.getInformation(project).getDisplayName());
    WebModule wm = WebModule.getWebModule(project.getProjectDirectory());
    if (wm != null) {
        FileObject webInf = wm.getWebInf();
        try {
            if (webInf !=null) {
                targetFolder = webInf;
                locationText.setText(FileUtil.getFileDisplayName(webInf));
            } else {
                FileObject docBase = wm.getDocumentBase();
                if (docBase != null) {
                    targetFolder = docBase;
                    locationText.setText(FileUtil.getFileDisplayName(docBase)+File.separator+"WEB-INF");  //NOI18N
                }
            }
        } catch (NullPointerException npe ) {
            locationText.setText("");   //NOI18N
            Logger.global.log(Level.WARNING, NbBundle.getMessage(WebXmlVisualPanel1.class, "NO_SOURCES_FOUND"), npe);
        }
    }
    refreshLocation();
}
 
Example #20
Source File: ProjectWebModule.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public FileObject[] getSourceRoots() {
    Sources sources = ProjectUtils.getSources(project);
    SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    
    List<FileObject> roots = new LinkedList<FileObject>();
    FileObject documentBase = getDocumentBase();
    if (documentBase != null)
        roots.add(documentBase);
    
    for (int i = 0; i < groups.length; i++) {
        roots.add(groups[i].getRootFolder());
    }
    
    FileObject[] rootArray = new FileObject[roots.size()];
    return roots.toArray(rootArray);
}
 
Example #21
Source File: J2SEDeployProjectOpenHook.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected void projectOpened() {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.log(
            Level.FINE,
            "Project opened {0} ({1}).",  //NOI18N
            new Object[] {
                ProjectUtils.getInformation(prj).getDisplayName(),
                FileUtil.getFileDisplayName(prj.getProjectDirectory())
            });
    }
    ProjectManager.mutex().writeAccess(new Runnable() {
        @Override
        public void run() {
            updateBuildScript();
        }
    });
}
 
Example #22
Source File: ClientSideProject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NbBundle.Messages({
    "# {0} - project name",
    "OpenHookImpl.notification.autoconfigured.title=Project {0} automatically configured",
    "OpenHookImpl.notification.autoconfigured.details=Review and correct important project settings detected by the IDE.",
})
private void checkAutoconfigured() {
    ClientSideProjectProperties projectProperties = new ClientSideProjectProperties(project);
    if (projectProperties.isAutoconfigured()) {
        NotificationDisplayer.getDefault().notify(
                Bundle.OpenHookImpl_notification_autoconfigured_title(ProjectUtils.getInformation(project).getDisplayName()),
                NotificationDisplayer.Priority.LOW.getIcon(),
                Bundle.OpenHookImpl_notification_autoconfigured_details(),
                new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        project.getLookup().lookup(CustomizerProviderImpl.class)
                                .showCustomizer(CompositePanelProviderImpl.SOURCES);
                    }
                },
                NotificationDisplayer.Priority.LOW);
        projectProperties.setAutoconfigured(false);
        projectProperties.save();
    }
}
 
Example #23
Source File: ProjectsRootNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static Union2<LogicalViewProvider,org.openide.util.Pair<Sources,SourceGroup[]>> createData(
        final Project p,
        final int type) {
    switch (type) {
        case LOGICAL_VIEW:
            final LogicalViewProvider lvp = p.getLookup().lookup(LogicalViewProvider.class);
            if (lvp != null) {
                return Union2.createFirst(lvp);
            }
        case PHYSICAL_VIEW:
            final Sources s = ProjectUtils.getSources(p);
            final SourceGroup[] groups = s.getSourceGroups(Sources.TYPE_GENERIC);                
            return Union2.createSecond(org.openide.util.Pair.of(s, groups));
        default:
            throw new IllegalArgumentException(Integer.toString(type));
    }
}
 
Example #24
Source File: JavaUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static JavaSource getJavaSource(FileObject fileObject) {
    if (fileObject == null) {
        return null;
    }
    Project project = FileOwnerQuery.getOwner(fileObject);
    if (project == null) {
        return null;
    }
    // XXX this only works correctly with projects with a single sourcepath,
    // but we don't plan to support another kind of projects anyway (what about Maven?).
    SourceGroup[] sourceGroups = ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    for (SourceGroup sourceGroup : sourceGroups) {
        return JavaSource.create(ClasspathInfo.create(sourceGroup.getRootFolder()));
    }
    return null;
}
 
Example #25
Source File: WebLogicDDVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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 = lookup.lookup(J2eeModuleProvider.class);
    J2eeModule j2eeModule = provider.getJ2eeModule();
    sunDDFileName = getConfigFileName(j2eeModule,
            org.netbeans.modules.glassfish.eecommon.api.Utils.getInstanceReleaseID(provider));

    // 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);
}
 
Example #26
Source File: MavenProjectRestSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void removeProjectProperties(String[] propertyNames) {
    Preferences prefs = ProjectUtils.getPreferences(getProject(), MavenProjectRestSupport.class, true);
    if (prefs != null) {
        for (String p : propertyNames) {
            prefs.remove(p);
        }
    }
}
 
Example #27
Source File: BrokenReferencesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "LBL_BrokenLinksCustomizer_Close=Close",
    "ACSD_BrokenLinksCustomizer_Close=N/A",
    "LBL_BrokenLinksCustomizer_Title=Resolve Project Problems - \"{0}\" Project"
})
@Override
public void showCustomizer(@NonNull Project project) {
    Parameters.notNull("project", project); //NOI18N
    BrokenReferencesModel model = new BrokenReferencesModel(project);
    BrokenReferencesCustomizer customizer = new BrokenReferencesCustomizer(model);
    JButton close = new JButton (LBL_BrokenLinksCustomizer_Close()); // NOI18N
    close.getAccessibleContext ().setAccessibleDescription (ACSD_BrokenLinksCustomizer_Close()); // NOI18N
    String projectDisplayName = ProjectUtils.getInformation(project).getDisplayName();
    DialogDescriptor dd = new DialogDescriptor(customizer,
        LBL_BrokenLinksCustomizer_Title(projectDisplayName), // NOI18N
        true, new Object[] {close}, close, DialogDescriptor.DEFAULT_ALIGN, null, null);
    customizer.setNotificationLineSupport(dd.createNotificationLineSupport());
    Dialog dlg = null;
    try {
        dlg = DialogDisplayer.getDefault().createDialog(dd);
        dlg.setVisible(true);
    } finally {
        if (dlg != null) {
            dlg.dispose();
        }
    }
}
 
Example #28
Source File: J2seJaxWsOpenHook.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void addJaxWsApiEndorsed(Project prj) throws IOException {
    SourceGroup[] sourceGroups = ProjectUtils.getSources(prj).getSourceGroups(
    JavaProjectConstants.SOURCES_TYPE_JAVA);
    if (sourceGroups!=null && sourceGroups.length>0) {
        WSUtils.addJaxWsApiEndorsed(prj, sourceGroups[0].getRootFolder());
    }
}
 
Example #29
Source File: SuiteCustomizerLibraries.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public SuiteComponentNode(NbModuleProject prj, boolean enabled) {
    super(Children.LEAF, enabled);
    this.project = prj;
    final String cnb = prj.getCodeNameBase();
    setName(cnb);
    setDisplayName(ProjectUtils.getInformation(prj).getDisplayName());
    Provider provider = prj.getLookup().lookup(LocalizedBundleInfo.Provider.class);
    if (provider != null) {
        LocalizedBundleInfo bundleInfo = provider.getLocalizedBundleInfo();
        if (bundleInfo != null) {
            setShortDescription(formatEntryDesc(cnb, bundleInfo.getShortDescription()));
        }
    }
}
 
Example #30
Source File: OpenProjectList.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private String getDisplayName(Project p) {
    String n = names.get(p);
    if (n == null) {
        n = ProjectUtils.getInformation(p).getDisplayName();
        names.put(p, n);
    }
    return n;
}