本文整理汇总了Java中org.netbeans.spi.project.ui.support.ProjectChooser类的典型用法代码示例。如果您正苦于以下问题:Java ProjectChooser类的具体用法?Java ProjectChooser怎么用?Java ProjectChooser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectChooser类属于org.netbeans.spi.project.ui.support包,在下文中一共展示了ProjectChooser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFromArchetype
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
public static void createFromArchetype(File projDir, ProjectInfo vi, Archetype arch, @NullAllowed Map<String,String> additional, boolean updateLastUsedProjectDir) throws IOException {
final File parent = projDir.getParentFile();
if (parent == null) {
throw new IOException("no parent of " + projDir);
}
if (updateLastUsedProjectDir && parent != null && parent.exists()) {
ProjectChooser.setProjectsFolder(parent);
}
if (!parent.isDirectory() && !parent.mkdirs()) {
throw new IOException("could not create " + parent);
}
runArchetype(parent, vi, arch, additional);
}
示例2: resolve
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
@Override
@NonNull
@NbBundle.Messages({
"LBL_BrokenLinksCustomizer_Resolve_Project=Browse Project \"{0}\""
})
public Future<ProjectProblemsProvider.Result> resolve() {
ProjectProblemsProvider.Status result = ProjectProblemsProvider.Status.UNRESOLVED;
final JFileChooser chooser = ProjectChooser.projectChooser();
chooser.setDialogTitle(LBL_BrokenLinksCustomizer_Resolve_Project(getDisplayId(type, id)));
if (lastSelectedFile != null) {
chooser.setSelectedFile(lastSelectedFile);
}
int option = chooser.showOpenDialog(null);
if (option == JFileChooser.APPROVE_OPTION) {
updateReference(chooser.getSelectedFile());
lastSelectedFile = chooser.getSelectedFile();
result = ProjectProblemsProvider.Status.RESOLVED;
}
return new Done(ProjectProblemsProvider.Result.create(result));
}
示例3: chooseProject
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
public static Project chooseProject(Component parent) {
JFileChooser chooser = ProjectChooser.projectChooser();
int option = chooser.showOpenDialog(parent);
Project project = null;
if (option == JFileChooser.APPROVE_OPTION) {
File projectDir = chooser.getSelectedFile();
ApisupportAntUIUtils.setProjectChooserDirParent(projectDir);
try {
project = ProjectManager.getDefault().findProject(
FileUtil.toFileObject(projectDir));
} catch (IOException e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
return project;
}
示例4: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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) {
int baseCount = WizardSettings.getNewProjectCount() + 1;
String formatter = NbBundle.getMessage(PanelProjectLocationVisual.class, "TXT_JavaModuleApplication");
while ((projectName=validFreeProjectName(projectLocation, formatter, baseCount))==null)
baseCount++;
settings.putProperty (NewJ2SEModularProjectWizardIterator.PROP_NAME_INDEX, new Integer(baseCount));
}
this.projectNameTextField.setText (projectName);
this.projectNameTextField.selectAll();
}
示例5: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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();
}
示例6: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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 = 1;
while ((projectName = validFreeProjectName(projectLocation, formater, baseCount)) == null) {
baseCount++;
}
}
projectNameTextField.setText(projectName);
projectNameTextField.selectAll();
}
示例7: browseProjectFolderActionPerformed
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
private void browseProjectFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseProjectFolderActionPerformed
JFileChooser chooser = new JFileChooser();
FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
chooser.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
if (projectFolder.getText().length() > 0 && getProjectFolder().exists()) {
chooser.setSelectedFile(getProjectFolder());
} else if (projectLocation.getText().length() > 0 && getProjectLocation().exists()) {
chooser.setSelectedFile(getProjectLocation());
} else {
chooser.setSelectedFile(ProjectChooser.getProjectsFolder());
}
chooser.setDialogTitle(NbBundle.getMessage(BasicProjectInfoPanel.class, "LBL_Browse_Project_Folder")); //NOI18N
if ( JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
File projectDir = FileUtil.normalizeFile(chooser.getSelectedFile());
projectFolder.setText(projectDir.getAbsolutePath());
}
}
示例8: browseAntScriptActionPerformed
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
private void browseAntScriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseAntScriptActionPerformed
JFileChooser chooser = new JFileChooser();
FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
chooser.setFileSelectionMode (JFileChooser.FILES_ONLY);
if (antScript.getText().length() > 0 && getAntScript().exists()) {
chooser.setSelectedFile(getAntScript());
} else if (projectLocation.getText().length() > 0 && getProjectLocation().exists()) {
chooser.setSelectedFile(getProjectLocation());
} else {
chooser.setSelectedFile(ProjectChooser.getProjectsFolder());
}
chooser.setDialogTitle(NbBundle.getMessage(BasicProjectInfoPanel.class, "LBL_Browse_Build_Script")); //NOI18N
if ( JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
File script = FileUtil.normalizeFile(chooser.getSelectedFile());
antScript.setText(script.getAbsolutePath());
}
}
示例9: btnProjectActionPerformed
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
private void btnProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProjectActionPerformed
JFileChooser chooser = ProjectChooser.projectChooser();
int res = chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this));
if (res == JFileChooser.APPROVE_OPTION) {
File fil = chooser.getSelectedFile();
FileObject fo = FileUtil.toFileObject(fil);
if (fo != null) {
try {
Project p = ProjectManager.getDefault().findProject(fo);
DefaultComboBoxModel model = (DefaultComboBoxModel)comProject.getModel();
model.addElement(p);
model.setSelectedItem(p);
if (EMPTY == model.getElementAt(0)) {
model.removeElement(EMPTY);
}
} catch (IOException exc) {
ErrorManager.getDefault().notify(exc);
}
}
}
}
示例10: browseActionPerformed
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed
JFileChooser chooser = ProjectChooser.projectChooser();
chooser.showOpenDialog(this);
File dir = chooser.getSelectedFile();
if (dir != null) {
FileObject d = FileUtil.toFileObject(dir);
if (d != null) {
try {
Project p = ProjectManager.getDefault().findProject(d);
if (p != null) {
manuallyAddedProjects.add(p);
updateProjectModel();
project.setSelectedItem(p);
}
} catch (IOException x) {
Exceptions.printStackTrace(x);
}
}
}
}
示例11: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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 = "JavaBot";
}
this.projectNameTextField.setText(projectName);
this.projectNameTextField.selectAll();
}
示例12: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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 = "ClojureProjectTemplate";
}
this.projectNameTextField.setText(projectName);
this.projectNameTextField.selectAll();
}
示例13: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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 = "FreeMarkerProject";
}
this.projectNameTextField.setText(projectName);
this.projectNameTextField.selectAll();
}
示例14: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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 = "GroovyProject";
}
this.projectNameTextField.setText(projectName);
this.projectNameTextField.selectAll();
}
示例15: read
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入依赖的package包/类
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 = "ThymeleafProject";
}
this.projectNameTextField.setText(projectName);
this.projectNameTextField.selectAll();
}