本文整理汇总了Java中org.openide.DialogDescriptor.setClosingOptions方法的典型用法代码示例。如果您正苦于以下问题:Java DialogDescriptor.setClosingOptions方法的具体用法?Java DialogDescriptor.setClosingOptions怎么用?Java DialogDescriptor.setClosingOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.DialogDescriptor
的用法示例。
在下文中一共展示了DialogDescriptor.setClosingOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ViewerChangeDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private ViewerChangeDialog(String title, ElementValue value, ViewerPanel viewerpanel, ChangePanel panel) {
this.value = value;
this.panel = panel;
this.viewerpanel = viewerpanel;
panel.setText(value.getText());
dd = new DialogDescriptor(
panel,
title,
false, //isModal,
DialogDescriptor.OK_CANCEL_OPTION,
DialogDescriptor.OK_OPTION,
new DialogDoneListener()
);
dd.setClosingOptions(new Object[]{});
dd.addPropertyChangeListener(dcl);
DialogDisplayer.getDefault().notifyLater(dd);
}
示例2: createDescriptor
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
protected DialogDescriptor createDescriptor() {
myDescriptor = new DialogDescriptor(
getResizableX(createPanel()),
i18n("LBL_Print_Options"), // NOI18N
true,
getButtons(),
DialogDescriptor.OK_OPTION,
DialogDescriptor.DEFAULT_ALIGN,
null,
new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (DialogDescriptor.OK_OPTION == event.getSource()) {
if (updatePreview()) {
myDescriptor.setClosingOptions(new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION });
}
else {
myDescriptor.setClosingOptions(new Object[] { DialogDescriptor.CANCEL_OPTION });
}
}
}
}
);
return myDescriptor;
}
示例3: createDescriptor
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
protected DialogDescriptor createDescriptor() {
Object[] rightButtons = getRightButtons();
Object[] leftButtons = getLeftButtons();
DialogDescriptor descriptor = new DialogDescriptor(
getResizableXY(createPanel()),
i18n("LBL_Print_Preview"), // NOI18N
true,
rightButtons,
myPrintButton,
DialogDescriptor.DEFAULT_ALIGN,
null,
null
);
descriptor.setClosingOptions(new Object[] { myPrintButton, myCloseButton });
descriptor.setAdditionalOptions(leftButtons);
return descriptor;
}
示例4: handleSaveAllFailed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
protected void handleSaveAllFailed(Collection<String> errMsgs) {
JButton btnShowMoreInfo = new JButton();
DialogDescriptor errDescr = new DialogDescriptor(
new ExpandableMessage(
"MSG_ExceptionWhileSavingMoreFiles_Intro", //NOI18N
errMsgs,
null,
btnShowMoreInfo),
getMessage("MSG_Title_SavingError"), //NOI18N
true, //modal
DEFAULT_OPTION,
OK_OPTION,
null); //no button listener
errDescr.setMessageType(ERROR_MESSAGE);
errDescr.setOptions(new Object[] { OK_OPTION });
errDescr.setAdditionalOptions(new Object[] { btnShowMoreInfo });
errDescr.setClosingOptions(new Object[] { OK_OPTION });
DialogDisplayer.getDefault().notify(errDescr);
closeDialog(btnSaveAll);
}
示例5: actionPerformed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override public void actionPerformed(ActionEvent e) {
final RepositoryRegisterUI rrui = new RepositoryRegisterUI();
rrui.getAccessibleContext().setAccessibleDescription(LBL_Add_Repo());
DialogDescriptor dd = new DialogDescriptor(rrui, LBL_Add_Repo());
dd.setClosingOptions(new Object[]{
rrui.getButton(),
DialogDescriptor.CANCEL_OPTION
});
dd.setOptions(new Object[]{
rrui.getButton(),
DialogDescriptor.CANCEL_OPTION
});
Object ret = DialogDisplayer.getDefault().notify(dd);
if (rrui.getButton() == ret) {
final RepositoryInfo info;
try {
info = rrui.getRepositoryInfo();
} catch (URISyntaxException x) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(x.getLocalizedMessage(), NotifyDescriptor.ERROR_MESSAGE));
return;
}
RepositoryPreferences.getInstance().addOrModifyRepositoryInfo(info);
RP.post(new Runnable() {
@Override public void run() {
RepositoryIndexer.indexRepo(info);
}
});
}
}
示例6: actionPerformed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
StringBuffer buffer = new StringBuffer();
buffer.append("<b>"); //NOI18N
buffer.append(record.getArtifactId());
buffer.append("</b>");//NOI18N
buffer.append(":");//NOI18N
buffer.append("<b>");//NOI18N
buffer.append(record.getVersion().toString());
buffer.append("</b>");//NOI18N
AddDependencyUI adui = new AddDependencyUI(buffer.toString());
DialogDescriptor dd = new DialogDescriptor(adui, NbBundle.getMessage(AddAsDependencyAction.class, "TIT_Add_Dependency"));
dd.setClosingOptions(new Object[]{
adui.getAddButton(),
DialogDescriptor.CANCEL_OPTION
});
dd.setOptions(new Object[]{
adui.getAddButton(),
DialogDescriptor.CANCEL_OPTION
});
Object ret = DialogDisplayer.getDefault().notify(dd);
if (adui.getAddButton() == ret) {
List<Project> nmps = adui.getSelectedMavenProjects();
for (Project project : nmps) {
ModelUtils.addDependency(project.getProjectDirectory().getFileObject("pom.xml") /*NOI18N*/,
record.getGroupId(), record.getArtifactId(),
record.getVersion(), record.getType(), null, null,false);
}
}
}
示例7: actionPerformed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
if (root == null) {
return; //#238704 not clear when this would happen for an enabled action.
}
ShowExecutionPanel panel = new ShowExecutionPanel();
panel.setTreeToDisplay(root, executor != null ? executor.config : null);
DialogDescriptor dd = new DialogDescriptor(panel, "Build execution overview");
dd.setOptions(new Object[] {"Close"});
dd.setClosingOptions(new Object[] {"Close"});
d = DialogDisplayer.getDefault().createDialog(dd);
d.setModal(false);
d.setVisible(true);
}
示例8: selectDependencies
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/**
*
* @param props
* @param initialFilterText initial filter text or null if not given
* @return
*/
public static ModuleDependency[] selectDependencies(final SingleModuleProperties props, final String initialFilterText) {
final AddModulePanel addPanel;
if (null != initialFilterText) {
// init dialog with filter text
addPanel = new AddModulePanel(props, initialFilterText);
}
else{
// keep backwards compatibility
addPanel = new AddModulePanel(props);
}
final DialogDescriptor descriptor = new DialogDescriptor(addPanel,
getMessage("CTL_AddModuleDependencyTitle"));
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.AddModulePanel"));
descriptor.setClosingOptions(new Object[0]);
final Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
descriptor.setButtonListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (DialogDescriptor.OK_OPTION.equals(e.getSource()) && addPanel.getSelectedDependencies().length == 0) {
return;
}
d.setVisible(false);
d.dispose();
}
});
if (lastSize != null) {
d.setBounds(lastSize);
}
d.setVisible(true);
lastSize = d.getBounds();
d.dispose();
if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
return addPanel.getSelectedDependencies();
} else {
return new ModuleDependency[0]; // #114932
}
}
示例9: showAddDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/**
* Displays Add Cluster dialog and lets user select path to external cluster.
*
* @param prj Project into which the path will be stored. Returned path is relative to the project dir if possible.
* @return Info for newly added cluster or null if user cancelled the dialog.
*/
static ClusterInfo showAddDialog(Project prj) {
EditClusterPanel panel = new EditClusterPanel();
panel.prjDir = FileUtil.toFile(prj.getProjectDirectory());
panel.prj = prj;
SourceRootsSupport srs = new SourceRootsSupport(new URL[0], null);
panel.sourcesPanel.setSourceRootsProvider(srs);
JavadocRootsSupport jrs = new JavadocRootsSupport(new URL[0], null);
panel.javadocPanel.setJavadocRootsProvider(jrs);
DialogDescriptor descriptor = new DialogDescriptor(
panel,
NbBundle.getMessage(EditClusterPanel.class, "CTL_AddCluster_Title"), // NOI18N
true,
new Object[] { panel.okButton, NotifyDescriptor.CANCEL_OPTION },
panel.okButton,
DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditClusterPanel"),
null);
descriptor.setClosingOptions(null);
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
panel.updateDialog();
dlg.setVisible(true);
ClusterInfo retVal = null;
if (descriptor.getValue() == panel.okButton) {
retVal = ClusterInfo.createExternal(panel.getAbsoluteClusterPath(),
srs.getSourceRoots(), jrs.getJavadocRoots(), true);
}
dlg.dispose();
return retVal;
}
示例10: showWritePermissionDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Messages({"cancel=Cancel", "installAnyway=Install anyway", "warning=Write permission problem",
"writePermissionDetails=<html>You don't have permission to install JUnit Library into the installation directory which is recommened.<br><br>"
+ "To perform installation into the shared directory, you should run IDE as a user with administrative<br>"
+ "privilege, or install the JUnit Library into your user directory."})
private static void showWritePermissionDialog(Runnable installAnyway) {
JButton cancel = new JButton();
Mnemonics.setLocalizedText(cancel, cancel());
JButton install = new JButton();
Mnemonics.setLocalizedText(install, installAnyway());
DialogDescriptor descriptor = new DialogDescriptor(
new JLabel(writePermissionDetails()),
warning(),
true, // Modal
new JButton[]{install, cancel}, // Option list
null, // Default
DialogDescriptor.DEFAULT_ALIGN, // Align
null, // Help
null);
descriptor.setMessageType(NotifyDescriptor.QUESTION_MESSAGE);
descriptor.setClosingOptions(null);
DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
if (install.equals(descriptor.getValue())) {
// install anyway
LOG.info("user install JUnit into userdir anyway");
InstallLibraryTask.RP.post(installAnyway);
} else {
LOG.info("user canceled install JUnit into userdir");
}
}
示例11: confirmContinueCommit
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private boolean confirmContinueCommit(Collection<String> errMsgs) {
if ((errMsgs == null) || errMsgs.isEmpty()) {
return true;
}
JButton btnShowMoreInfo = new JButton();
JComponent info = new ExpandableMessage(
"MSG_ExceptionWhileSavingMoreFiles_Intro", //NOI18N
errMsgs,
"MSG_ExceptionWhileSavingMoreFiles_Question", //NOI18N
btnShowMoreInfo);
String commitLbl = getMessage("LBL_ProceedWithCommit"); //NOI18N
DialogDescriptor errDialog = new DialogDescriptor(
info,
getMessage("MSG_Title_SavingError"), //title //NOI18N
true, //modal
OK_CANCEL_OPTION,
WARNING_MESSAGE,
null); //button listener
errDialog.setOptions(new Object[] {commitLbl, CANCEL_OPTION});
errDialog.setAdditionalOptions(new Object[] {btnShowMoreInfo});
errDialog.setValue(CANCEL_OPTION); //default option
errDialog.setClosingOptions(new Object[] {commitLbl, CANCEL_OPTION});
Object value = DialogDisplayer.getDefault().notify(errDialog);
return (value == commitLbl);
}
示例12: showInWindow
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public static URL showInWindow() {
JButton openBtn = new JButton();
Mnemonics.setLocalizedText(openBtn, NbBundle.getMessage(ReferencesPanel.class, "ReferencesPanel.ok.text"));
openBtn.getAccessibleContext().setAccessibleDescription(openBtn.getText());
openBtn.setEnabled(false);
final Object[] buttons = new Object[] { openBtn, DialogDescriptor.CANCEL_OPTION };
ReferencesPanel panel = new ReferencesPanel(openBtn);
DialogDescriptor desc = new DialogDescriptor(
panel,
NbBundle.getMessage(ReferencesPanel.class, "ReferencesPanel.title"),
true,
buttons,
openBtn,
DialogDescriptor.DEFAULT_ALIGN,
HelpCtx.DEFAULT_HELP,
null);
desc.setClosingOptions(buttons);
Dialog dialog = DialogDisplayer.getDefault().createDialog(desc);
dialog.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ReferencesPanel.class, "AN_ReferencesDialog"));
dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ReferencesPanel.class, "AD_ReferencesDialog"));
// schedule computing indices
RP.post(panel);
dialog.setVisible(true);
dialog.dispose();
return desc.getValue() == openBtn
? panel.getSelectedItem()
: null;
}
示例13: actionPerformed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public @Override void actionPerformed(ActionEvent e) {
Dialog dialog = dialogWRef.get ();
if (dialog == null || ! dialog.isShowing ()) {
final CatalogPanel cp = new CatalogPanel ();
JButton closeButton = new JButton ();
Mnemonics.setLocalizedText (closeButton,NbBundle.getMessage (CatalogAction.class, "BTN_CatalogPanel_CloseButton")); // NOI18N
JButton openInEditor = new JButton ();
openInEditor.setEnabled (false);
OpenInEditorListener l = new OpenInEditorListener (cp, openInEditor);
openInEditor.addActionListener (l);
cp.getExplorerManager ().addPropertyChangeListener (l);
Mnemonics.setLocalizedText (openInEditor,NbBundle.getMessage (CatalogAction.class, "BTN_CatalogPanel_OpenInEditorButton")); // NOI18N
DialogDescriptor dd = new DialogDescriptor (cp,NbBundle.getMessage (CatalogAction.class, "LBL_CatalogPanel_Title"), // NOI18N
false, // modal
new Object [] { openInEditor, closeButton },
closeButton,
DialogDescriptor.DEFAULT_ALIGN,
null,
null);
dd.setClosingOptions (null);
// set helpctx to null again, DialogDescriptor replaces null with HelpCtx.DEFAULT_HELP
dd.setHelpCtx (null);
dialog = DialogDisplayer.getDefault ().createDialog (dd);
dialog.setVisible (true);
dialogWRef = new WeakReference<Dialog> (dialog);
} else {
dialog.toFront ();
}
}
示例14: showDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public static void showDialog( DataObject template, DataFolder targetFolder ) {
int type;
if ( template.getPrimaryFile().getName().equals( "file") ) {
type = TYPE_FILE;
}
else {
type = TYPE_FOLDER;
}
JButton options[] = new JButton[] {
new JButton( NbBundle.getMessage( NoProjectNew.class, "LBL_NonProject_OK_Button") ), // NOI18N
new JButton( NbBundle.getMessage( NoProjectNew.class, "LBL_NonProject_Cancel_Button") ), // NOI18N
};
NoProjectNew npn = new NoProjectNew( type, targetFolder, options[0] );
options[ 0 ].setActionCommand( COMMAND_OK );
options[ 0 ].addActionListener( npn );
options[ 1 ].setActionCommand( COMMAND_CANCEL );
options[ 1 ].addActionListener( npn );
DialogDescriptor dialogDescriptor = new DialogDescriptor(
npn, // innerPane
type == TYPE_FILE ? FILE_TITLE : FOLDER_TITLE, // displayName
true, // modal
options, // options
options[ 0 ], // initial value
DialogDescriptor.BOTTOM_ALIGN, // options align
null, // helpCtx
null ); // listener
dialogDescriptor.setClosingOptions( new Object[] { options[ 0 ], options[ 1 ] } );
Dialog dialog = DialogDisplayer.getDefault().createDialog( dialogDescriptor );
dialog.setVisible(true);
npn.createFile();
}
示例15: showDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public static FileObject showDialog( SourceGroup[] folders, Project project, String preselectedFileName ) {
BrowseFolders bf = new BrowseFolders( folders, project, preselectedFileName );
JButton options[] = new JButton[] {
new JButton(),
new JButton( NbBundle.getMessage( BrowseFolders.class, "BTN_BrowseFolders_Cancel_Option") ), // NOI18N
};
OptionsListener optionsListener = new OptionsListener( bf );
options[ 0 ].setActionCommand( OptionsListener.COMMAND_SELECT );
options[ 0 ].addActionListener( optionsListener );
Mnemonics.setLocalizedText(options[0], NbBundle.getMessage( BrowseFolders.class, "BTN_BrowseFolders_Select_Option") );
options[ 0 ].getAccessibleContext ().setAccessibleName (NbBundle.getMessage( BrowseFolders.class, "ACSN_BrowseFolders_Select_Option"));
options[ 0 ].getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage( BrowseFolders.class, "ACSD_BrowseFolders_Select_Option"));
options[ 1 ].setActionCommand( OptionsListener.COMMAND_CANCEL );
options[ 1 ].addActionListener( optionsListener );
options[ 1 ].getAccessibleContext ().setAccessibleName (NbBundle.getMessage( BrowseFolders.class, "ACSN_BrowseFolders_Cancel_Option"));
options[ 1 ].getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage( BrowseFolders.class, "ACSD_BrowseFolders_Cancel_Option"));
DialogDescriptor dialogDescriptor = new DialogDescriptor(
bf, // innerPane
NbBundle.getMessage( BrowseFolders.class, "LBL_BrowseFolders_Dialog"), // displayName
true, // modal
options, // options
options[ 0 ], // initial value
DialogDescriptor.BOTTOM_ALIGN, // options align
null, // helpCtx
null ); // listener
dialogDescriptor.setClosingOptions( new Object[] { options[ 0 ], options[ 1 ] } );
Dialog dialog = DialogDisplayer.getDefault().createDialog( dialogDescriptor );
dialog.setVisible(true);
return optionsListener.getResult();
}