本文整理汇总了Java中org.netbeans.spi.project.ui.support.ProjectChooser.projectChooser方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectChooser.projectChooser方法的具体用法?Java ProjectChooser.projectChooser怎么用?Java ProjectChooser.projectChooser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.spi.project.ui.support.ProjectChooser
的用法示例。
在下文中一共展示了ProjectChooser.projectChooser方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
示例2: 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;
}
示例3: 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);
}
}
}
}
示例4: 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);
}
}
}
}
示例5: browseModuleSuite
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入方法依赖的package包/类
private void browseModuleSuite(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseModuleSuite
JFileChooser chooser = ProjectChooser.projectChooser();
int option = chooser.showOpenDialog(this);
if (option == JFileChooser.APPROVE_OPTION) {
File projectDir = chooser.getSelectedFile();
ApisupportAntUIUtils.setProjectChooserDirParent(projectDir);
try {
Project suite = ProjectManager.getDefault().findProject(
FileUtil.toFileObject(projectDir));
if (suite != null) {
String suiteDir = SuiteUtils.getSuiteDirectoryPath(suite);
if (suiteDir != null) {
// register for this session
PlatformComponentFactory.addUserSuite(suiteDir);
// add to current combobox
moduleSuiteValue.addItem(suiteDir);
moduleSuiteValue.setSelectedItem(suiteDir);
} else {
DialogDisplayer.getDefault().notify(new DialogDescriptor.Message(
NbBundle.getMessage(BasicInfoVisualPanel.class, "MSG_NotRegularSuite",
ProjectUtils.getInformation(suite).getDisplayName())));
}
}
} catch (IOException e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
}
示例6: masterProjectButtonActionPerformed
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入方法依赖的package包/类
private void masterProjectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_masterProjectButtonActionPerformed
JFileChooser chooser = ProjectChooser.projectChooser();
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
if (f != null) {
masterProjectField.setText(f.getAbsolutePath());
//firePropertyChange(PROP_READY, null, null);
}
}
}
示例7: masterProjectButtonActionPerformed
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入方法依赖的package包/类
private void masterProjectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_masterProjectButtonActionPerformed
JFileChooser chooser = ProjectChooser.projectChooser();
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
if (f != null) {
masterProjectField.setText(f.getAbsolutePath());
updateNameField();
firePropertyChange(PROP_READY, null, null);
}
}
}
示例8: getComponent
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入方法依赖的package包/类
@Override
public java.awt.Component getComponent() {
if (projectChooser == null) { // create the UI component for the wizard step
projectChooser = ProjectChooser.projectChooser();
projectChooser.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
// wizard API: set the caption and index of this panel
projectChooser.setName(PaletteUtils.getBundleString("CTL_SelectProject_Caption")); // NOI18N
projectChooser.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, // NOI18N
Integer.valueOf(0));
if (lastDirectoryUsed != null)
projectChooser.setCurrentDirectory(new File(lastDirectoryUsed));
projectChooser.setControlButtonsAreShown(false);
projectChooser.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent ev) {
String propName = ev.getPropertyName();
if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(propName)
|| JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(propName))
cs.fireChange();
}
});
}
return projectChooser;
}
示例9: showDialog
import org.netbeans.spi.project.ui.support.ProjectChooser; //导入方法依赖的package包/类
/** Shows dialog with the artifact chooser
* @return null if canceled selected jars if some jars selected
*/
static AntArtifactItem[] showDialog( String[] artifactTypes, Project master, Component parent ) {
JFileChooser chooser = ProjectChooser.projectChooser();
chooser.setDialogTitle( NbBundle.getMessage( AntArtifactChooser.class, "LBL_AACH_Title" ) ); // NOI18N
chooser.setApproveButtonText( NbBundle.getMessage( AntArtifactChooser.class, "LBL_AACH_SelectProject" ) ); // NOI18N
chooser.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage (AntArtifactChooser.class,"AD_AACH_SelectProject"));
AntArtifactChooser accessory = new AntArtifactChooser( artifactTypes, chooser );
chooser.setAccessory( accessory );
chooser.setPreferredSize( new Dimension( 650, 380 ) );
File defaultFolder = null;
FileObject defFo = master.getProjectDirectory();
if (defFo != null) {
defFo = defFo.getParent();
if (defFo != null) {
defaultFolder = FileUtil.toFile(defFo);
}
}
chooser.setCurrentDirectory (getLastUsedArtifactFolder(defaultFolder));
int option = chooser.showOpenDialog( parent ); // Show the chooser
if ( option == JFileChooser.APPROVE_OPTION ) {
File dir = chooser.getSelectedFile();
dir = FileUtil.normalizeFile (dir);
Project selectedProject = accessory.getProject( dir );
if ( selectedProject == null ) {
return null;
}
if ( selectedProject.getProjectDirectory().equals( master.getProjectDirectory() ) ) {
DialogDisplayer.getDefault().notify( new NotifyDescriptor.Message(
NbBundle.getMessage( AntArtifactChooser.class, "MSG_AACH_RefToItself" ),
NotifyDescriptor.INFORMATION_MESSAGE ) );
return null;
}
if ( ProjectUtils.hasSubprojectCycles( master, selectedProject ) ) {
DialogDisplayer.getDefault().notify( new NotifyDescriptor.Message(
NbBundle.getMessage( AntArtifactChooser.class, "MSG_AACH_Cycles" ),
NotifyDescriptor.INFORMATION_MESSAGE ) );
return null;
}
boolean noSuitableOutput = true;
for (String type : artifactTypes) {
if (AntArtifactQuery.findArtifactsByType(selectedProject, type).length > 0) {
noSuitableOutput = false;
break;
}
}
if (noSuitableOutput) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
NbBundle.getMessage (AntArtifactChooser.class,"MSG_NO_JAR_OUTPUT")));
return null;
}
setLastUsedArtifactFolder (FileUtil.normalizeFile(chooser.getCurrentDirectory()));
Object[] tmp = new Object[accessory.jListArtifacts.getModel().getSize()];
int count = 0;
for(int i = 0; i < tmp.length; i++) {
if (accessory.jListArtifacts.isSelectedIndex(i)) {
tmp[count] = accessory.jListArtifacts.getModel().getElementAt(i);
count++;
}
}
AntArtifactItem artifactItems[] = new AntArtifactItem[count];
System.arraycopy(tmp, 0, artifactItems, 0, count);
return artifactItems;
}
else {
return null;
}
}