Java Code Examples for org.netbeans.spi.project.ui.support.ProjectChooser#getProjectsFolder()

The following examples show how to use org.netbeans.spi.project.ui.support.ProjectChooser#getProjectsFolder() . 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: BasicGamePanelVisual.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = (String) settings.getProperty("name");
    if (projectName == null) {
        projectName = "BasicGame";
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}
 
Example 2
Source File: PanelProjectLocationVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
void read (WizardDescriptor d) {
    File projectLocation = (File) d.getProperty ("projectFolder");  //NOI18N
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory ()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    
    Integer count = (Integer) d.getProperty("WizardPanel_GrailsProjectCounter");
    String formater = NbBundle.getMessage(PanelProjectLocationVisual.class, "TXT_GrailsApplication");
    
    int baseCount = count.intValue();
    
    String newPrjName = (String) d.getProperty ("name"); //NOI18N
    if (newPrjName == null) {        
        while ((newPrjName = validFreeProjectName(projectLocation, formater, baseCount)) == null) {
            baseCount++;
        }
    }
    
    projectLocationTextField.setText(projectLocation.getAbsolutePath());
    projectFolderTextField.setText( projectLocation.getAbsolutePath() + File.separatorChar + projectNameTextField.getText().trim() );
    projectNameTextField.setText(newPrjName);
}
 
Example 3
Source File: subnodesPanelVisual.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = (String) settings.getProperty("name");
    if (projectName == null) {
        projectName = "subnodes";
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}
 
Example 4
Source File: JmeTestsPanelVisual.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = (String) settings.getProperty("name");
    if (projectName == null) {
        projectName = "JmeTests";
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}
 
Example 5
Source File: jvmcapsPanelVisual.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = (String) settings.getProperty("name");
    if (projectName == null) {
        projectName = "jvmcaps";
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}
 
Example 6
Source File: SampleVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    File workDir = null;
    String projectLocation = getProjectLocation();
    if (projectLocation != null && !projectLocation.isEmpty()) {
        File projDir = new File(projectLocation);
        if (projDir.isDirectory()) {
            workDir = projDir;
        }
    }
    if (workDir == null) {
        workDir = ProjectChooser.getProjectsFolder();
    }
    File projectDir = new FileChooserBuilder(SampleVisualPanel.class)
            .setTitle(NbBundle.getMessage(SampleVisualPanel.class, "TTL_DialogLocation"))   // NOI18N
            .setDirectoriesOnly(true)
            .setDefaultWorkingDirectory(workDir)
            .forceUseOfDefaultWorkingDirectory(true)
            .showOpenDialog();
    if (projectDir != null) {
        projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
    }
}
 
Example 7
Source File: SampleVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initProjectNameAndLocation(WizardDescriptor descriptor) {
    // default name & location
    File projectLocation = ProjectChooser.getProjectsFolder();
    projectLocationTextField.setText(projectLocation.getAbsolutePath());

    FileObject template = Templates.getTemplate(descriptor);
    String projectName = template.getName();
    String templateName = projectName;
    int index = 0;
    while ((new File(projectLocation, projectName)).exists()) {
        index++;
        projectName = templateName + index;
    }
    projectNameTextField.setText(projectName);
    projectNameTextField.selectAll();
    updateProjectFolder();

    // listeners
    DocumentListener documentListener = new DefaultDocumentListener();
    projectNameTextField.getDocument().addDocumentListener(documentListener);
    projectLocationTextField.getDocument().addDocumentListener(documentListener);
    setName(NbBundle.getMessage(SampleVisualPanel.class, "LBL_NameAndLocation"));// NOI18N
    
}
 
Example 8
Source File: NewClientSideProject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NbBundle.Messages("ClientSideProject.dialog.location.title=Select Project Location")
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    File workDir = null;
    String projectLocation = getProjectLocation();
    if (projectLocation != null && !projectLocation.isEmpty()) {
        File projDir = new File(projectLocation);
        if (projDir.isDirectory()) {
            workDir = projDir;
        }
    }
    if (workDir == null) {
        workDir = ProjectChooser.getProjectsFolder();
    }
    File projectDir = new FileChooserBuilder(NewClientSideProject.class)
            .setTitle(Bundle.ClientSideProject_dialog_location_title())
            .setDirectoriesOnly(true)
            .setDefaultWorkingDirectory(workDir)
            .forceUseOfDefaultWorkingDirectory(true)
            .showOpenDialog();
    if (projectDir != null) {
        projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
    }
}
 
Example 9
Source File: NewClientSideProject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initProjectNameAndLocation() {
    // default name & location
    File projectLocation = ProjectChooser.getProjectsFolder();
    projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = projectNameTemplate;
    int index = 0;
    while ((new File(projectLocation, projectName)).exists()) {
        index++;
        projectName = projectNameTemplate + index;
    }
    projectNameTextField.setText(projectName);
    projectNameTextField.selectAll();
    updateProjectFolder();

    // listeners
    DocumentListener documentListener = new DefaultDocumentListener();
    projectNameTextField.getDocument().addDocumentListener(documentListener);
    projectLocationTextField.getDocument().addDocumentListener(documentListener);
}
 
Example 10
Source File: hellovvmPanelVisual.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = (String) settings.getProperty("name");
    if (projectName == null) {
        projectName = "hellovvm";
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}
 
Example 11
Source File: SampleVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initProjectNameAndLocation(WizardDescriptor descriptor) {
    // default name & location
    File projectLocation = ProjectChooser.getProjectsFolder();
    projectLocationTextField.setText(projectLocation.getAbsolutePath());

    FileObject template = Templates.getTemplate(descriptor);
    String projectName = template.getName();
    String templateName = projectName;
    int index = 0;
    while ((new File(projectLocation, projectName)).exists()) {
        index++;
        projectName = templateName + index;
    }
    projectNameTextField.setText(projectName);
    projectNameTextField.selectAll();
    updateProjectFolder();

    // listeners
    DocumentListener documentListener = new DefaultDocumentListener();
    projectNameTextField.getDocument().addDocumentListener(documentListener);
    projectLocationTextField.getDocument().addDocumentListener(documentListener);
    setName(NbBundle.getMessage(OnlineSampleVisualPanel.class, "LBL_NameAndLocation"));// NOI18N
    
}
 
Example 12
Source File: OnlineSampleVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    File workDir = null;
    String projectLocation = getProjectLocation();
    if (projectLocation != null && !projectLocation.isEmpty()) {
        File projDir = new File(projectLocation);
        if (projDir.isDirectory()) {
            workDir = projDir;
        }
    }
    if (workDir == null) {
        workDir = ProjectChooser.getProjectsFolder();
    }
    File projectDir = new FileChooserBuilder(SampleVisualPanel.class)
    .setTitle(NbBundle.getMessage(SampleVisualPanel.class, "TTL_DialogLocation"))   // NOI18N
    .setDirectoriesOnly(true)
    .setDefaultWorkingDirectory(workDir)
    .forceUseOfDefaultWorkingDirectory(true)
    .showOpenDialog();
    if (projectDir != null) {
        projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
    }
}
 
Example 13
Source File: OnlineSampleVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initFields() {
    final String projectName = (String) descriptor.getProperty(WizardConstants.SAMPLE_PROJECT_NAME);
    final String projectURL = (String) descriptor.getProperty(WizardConstants.SAMPLE_PROJECT_URL);

    templateUrlTextField.setText(projectURL);

    // default name & location
    File projectLocation = ProjectChooser.getProjectsFolder();
    projectLocationTextField.setText(projectLocation.getAbsolutePath());

    projectNameTextField.setText(findName(projectLocation, projectName));
    projectNameTextField.selectAll();
    createdFolderTextField.setText(getProjectLocation() + File.separatorChar + getProjectName());

    // listeners
    DocumentListener documentListener = new DefaultDocumentListener();
    projectNameTextField.getDocument().addDocumentListener(documentListener);
    projectLocationTextField.getDocument().addDocumentListener(documentListener);
    setName(NbBundle.getMessage(OnlineSampleVisualPanel.class, "LBL_NameAndLocation"));
}
 
Example 14
Source File: hostviewPanelVisual.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = (String) settings.getProperty("name");
    if (projectName == null) {
        projectName = "hostview";
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}
 
Example 15
Source File: PanelProjectLocationVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
void read (WizardDescriptor settings) {
        File projectLocation = (File) settings.getProperty(WizardProperties.PROJECT_DIR);
        if (projectLocation == null)
            projectLocation = ProjectChooser.getProjectsFolder();
        else
            projectLocation = projectLocation.getParentFile();
        
        projectLocationTextField.setText(projectLocation.getAbsolutePath());
        
        String formater = null;
        String projectName = (String) settings.getProperty(WizardProperties.NAME);
        
        if (projectName == null) {
            formater = NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NPW1_DefaultProjectName"); //NOI18N
        } else {
            formater = projectName + "{0}"; //NOI18N
        }
        if ((projectName == null) || (validFreeProjectName(projectLocation, projectName) == null)) {
            int baseCount = FoldersListSettings.getDefault().getNewProjectCount() + 1;
            while ((projectName = validFreeProjectName(projectLocation, formater, baseCount)) == null)
                baseCount++;
//            settings.putProperty(NewWebProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
        }
        projectNameTextField.setText(projectName);
        projectNameTextField.selectAll();
    }
 
Example 16
Source File: BasicProjectPanelVisual.java    From nb-springboot with Apache License 2.0 5 votes vote down vote up
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
    String projectName = (String) settings.getProperty("name");
    if (projectName == null) {
        projectName = "BasicSpringbootProject";
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}
 
Example 17
Source File: PanelProjectLocationVisual.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void read (WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty ("projdir");  //NOI18N
    if (projectLocation == null || projectLocation.getParentFile() == null ||
        (projectLocation.getParentFile().exists() && !projectLocation.getParentFile().isDirectory ())) {
        projectLocation = ProjectChooser.getProjectsFolder();
    }
    else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText (projectLocation.getAbsolutePath());
    
    String projectName = (String) settings.getProperty ("name"); //NOI18N
    if (projectName == null) {
        switch (type) {
        case APP:
            int baseCount = WizardSettings.getNewApplicationCount() + 1;
            String formatter = NbBundle.getMessage(PanelSourceFolders.class,"TXT_JavaApplication");
            while ((projectName=validFreeProjectName(projectLocation, formatter, baseCount))==null)
                baseCount++;                
            settings.putProperty (NewJ2SEProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
            break;
        default:
            baseCount = WizardSettings.getNewLibraryCount() + 1;
            formatter = NbBundle.getMessage(PanelSourceFolders.class,"TXT_JavaLibrary");
            while ((projectName=validFreeProjectName(projectLocation, formatter, baseCount))==null)
                baseCount++;                
            settings.putProperty (NewJ2SEProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
        }            
    }
    this.projectNameTextField.setText (projectName);                
    this.projectNameTextField.selectAll();
}
 
Example 18
Source File: PanelProjectLocationExtSrc.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private synchronized void calculateProjectFolder() {
    if (this.calculatePF) {
        File f = ProjectChooser.getProjectsFolder();
        this.projectLocation.setText(f.getAbsolutePath() + File.separator + this.projectName.getText());
        this.calculatePF = true;
    }
}
 
Example 19
Source File: BasicPanelVisual.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Messages({
    "# {0} - project count", "TXT_MavenProjectName=mavenproject{0}",
    "TXT_Checking1=Checking additional creation properties..."
})
void read(WizardDescriptor settings, Map<String,String> defaultProps) {
    synchronized (HANDLE_LOCK) {
        if (handle != null) {
            handle.finish();
            handle = null;
        }
    }        
    // PROJECT_PARENT_FOLDER usage is confusing. Sometimes it's the
    // parent directory, sometimes it's the project directory.
    // Maybe introduce PROJECT_BASE_FOLDER, to clarify and differentiate.
    // But for local fix [NETBEANS-4206] keep track of whether
    // these properties have been read before.
    boolean haveRead =  Boolean.parseBoolean((String)settings.getProperty(SETTINGS_HAVE_READ)); //NOI18N
    File projectFolder = (File) settings.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER); //NOI18N
    File projectLocation;
    if(!haveRead && projectFolder != null) {
        // First time in here, dialog was started with project folder;
        // example is creating a project from pom parent
        projectLocation = projectFolder;
    } else {
        if (projectFolder == null || projectFolder.getParentFile() == null || !projectFolder.getParentFile().isDirectory()) {
            projectLocation = ProjectChooser.getProjectsFolder();
        } else {
            projectLocation = projectFolder.getParentFile();
        }
    }
    if(!haveRead) {
        settings.putProperty(SETTINGS_HAVE_READ, "true"); //NOI18N
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
    
    String projectName = (String) settings.getProperty("name"); //NOI18N

    if(projectName == null) {
        int baseCount = 1;
        while ((projectName = validFreeProjectName(projectLocation, TXT_MavenProjectName(baseCount))) == null) {
            baseCount++;                
        }
    }
    
    String gr = (String) settings.getProperty("groupId");
    if (gr != null) {
        txtGroupId.setText(gr);
    }
    String ver = (String) settings.getProperty("version");
    if (ver != null) {
        txtVersion.setText(ver);
    }
    
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
    // skip additional properties if direct known archetypes without additional props used
    if (panel.areAdditional()) {
        final Archetype archet = getArchetype(settings);
        this.currentArchetype = archet;
        lblAdditionalProps.setText(TXT_Checking1());
        lblAdditionalProps.setVisible(true);
        tblAdditionalProps.setVisible(false);
        jScrollPane1.setVisible(false);
        RPprep.post(new Runnable() {
            @Override
            public void run() {
                prepareAdditionalProperties(archet, defaultProps);
            }
        });
    }
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            panel.getValidationGroup().addItem(vg, true);
        }
    });
}
 
Example 20
Source File: PanelProjectLocationVisual.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
void read(WizardDescriptor settings) {
    File projectLocation = (File) settings.getProperty("projdir");  //NOI18N
    if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
        projectLocation = ProjectChooser.getProjectsFolder();
    } else {
        projectLocation = projectLocation.getParentFile();
    }
    this.projectLocationTextField.setText(projectLocation.getAbsolutePath());

    String projectName = (String) settings.getProperty("name"); //NOI18N
    if (projectName == null) {
        switch (type) {
            case APPLICATION:
            case FXML:
                int baseCount = WizardSettings.getNewApplicationCount() + 1;
                String formatter = NbBundle.getMessage(PanelSourceFolders.class, "TXT_JavaFXApplication"); // NOI18N
                while ((projectName = validFreeProjectName(projectLocation, formatter, baseCount)) == null) {
                    baseCount++;
                }
                settings.putProperty(JavaFXProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
                break;
            case PRELOADER:
                baseCount = WizardSettings.getNewPreloaderCount() + 1;
                formatter = NbBundle.getMessage(PanelSourceFolders.class, "TXT_JavaFXPreloaderApplication"); // NOI18N
                while ((projectName = validFreeProjectName(projectLocation, formatter, baseCount)) == null) {
                    baseCount++;
                }
                settings.putProperty(JavaFXProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
                break;
            case SWING:
                baseCount = WizardSettings.getNewFxSwingCount() + 1;
                formatter = NbBundle.getMessage(PanelSourceFolders.class, "TXT_JavaFXSwingApplication"); // NOI18N
                while ((projectName = validFreeProjectName(projectLocation, formatter, baseCount)) == null) {
                    baseCount++;
                }
                settings.putProperty(JavaFXProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
                break;
            default:
                baseCount = WizardSettings.getNewLibraryCount() + 1;
                formatter = NbBundle.getMessage(PanelSourceFolders.class, "TXT_JavaLibrary"); // NOI18N
                while ((projectName = validFreeProjectName(projectLocation, formatter, baseCount)) == null) {
                    baseCount++;
                }
                settings.putProperty(JavaFXProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
        }
    }
    this.projectNameTextField.setText(projectName);
    this.projectNameTextField.selectAll();
}