本文整理汇总了Java中org.openide.DialogDescriptor.setOptions方法的典型用法代码示例。如果您正苦于以下问题:Java DialogDescriptor.setOptions方法的具体用法?Java DialogDescriptor.setOptions怎么用?Java DialogDescriptor.setOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.DialogDescriptor
的用法示例。
在下文中一共展示了DialogDescriptor.setOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkLanguageToolchain
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private LanguageToolchain checkLanguageToolchain() {
Optional<LanguageToolchain> opt = new LanguageToolchainLocator().findSuitableLanguageToolchain();
if (!opt.isPresent()) {
LOGGER.log(Level.INFO, "No valid XC32 toolchain found. Asking the user to download one and aborting the procedure");
String messageTemplate = NbBundle.getMessage(getClass(), "LanguageToolchainVersionErrorDialog.message");
String message = MessageFormat.format(messageTemplate, Requirements.MINIMUM_XC_TOOLCHAIN_VERSION);
JEditorPane messagePane = createMessagePane(message);
JPanel contentPane = new JPanel();
contentPane.setLayout(new BorderLayout(5, 5));
contentPane.add(messagePane, BorderLayout.CENTER);
DialogDescriptor dd = new DialogDescriptor(contentPane, NbBundle.getMessage(getClass(), "LanguageToolchainVersionErrorDialog.title"));
dd.setMessageType(DialogDescriptor.ERROR_MESSAGE);
dd.setOptionsAlign(DialogDescriptor.BOTTOM_ALIGN);
dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION});
DialogDisplayer.getDefault().notify(dd);
return null;
} else {
LOGGER.log(Level.INFO, "Found XC32 toolchain. Version: {0}", opt.get().getVersion());
return opt.get();
}
}
示例2: display
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Displays dialog. */
public boolean display() {
String title = NbBundle.getMessage(RunTargetsAction.class, "TITLE_run_advanced");
DialogDescriptor dd = new DialogDescriptor(this, title);
dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
JButton run = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_run"));
run.setDefaultCapable(true);
JButton cancel = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_cancel"));
dd.setOptions(new Object[] {run, cancel});
dd.setModal(true);
Object result = DialogDisplayer.getDefault().notify(dd);
if (result.equals(run)) {
try {
run();
return true;
} catch (IOException x) {
AntModule.err.notify(x);
}
}
return false;
}
示例3: showDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private Variable showDialog() {
JPanel inset = new JPanel(new BorderLayout());
inset.setBorder(new EmptyBorder(12,12,0,12));
inset.add(this);
inset.getAccessibleContext().setAccessibleName(NbBundle.getMessage(VariablesPanel.class, "AN_Manage_Variables"));
inset.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VariablesPanel.class, "AD_Manage_Variables"));
DialogDescriptor dd = new DialogDescriptor(inset, NbBundle.getMessage(VariablesPanel.class, "TITLE_Manage_Variables")); // NOI18N
dd.setModal(true);
final JButton ok = new JButton(NbBundle.getMessage(VariablesPanel.class, "BUTTON_OK")); // NOI18N
ok.setDefaultCapable(true);
explorer.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
removeButton.setEnabled(explorer.getSelectedNodes().length > 0);
editButton.setEnabled(explorer.getSelectedNodes().length == 1);
}
});
dd.setOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
dd.setClosingOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
if (DialogDisplayer.getDefault().notify(dd) == ok) {
model.save();
if (explorer.getSelectedNodes().length == 1) {
return explorer.getSelectedNodes()[0].getLookup().lookup(Variable.class);
}
}
return null;
}
示例4: showInfo
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Shows info about found hard coded string. */
private void showInfo() {
JPanel infoPanel = support.getInfo(hcString);
DialogDescriptor dd = new DialogDescriptor(
infoPanel,
I18nUtil.getBundle().getString("CTL_InfoPanelTitle")); //NOI18N
dd.setModal(true);
dd.setOptionType(DialogDescriptor.DEFAULT_OPTION);
dd.setOptions(new Object[] {DialogDescriptor.OK_OPTION});
dd.setAdditionalOptions(new Object[0]);
Dialog infoDialog = DialogDisplayer.getDefault().createDialog(dd);
infoDialog.setVisible(true);
}
示例5: createDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Constructs managed dialog instance using TopManager.createDialog
* and returnrs it */
private Dialog createDialog () {
ResourceBundle bundle = NbBundle.getBundle (AddBreakpointAction.class);
panel = new AddBreakpointPanel ();
// create dialog descriptor, create & return the dialog
descriptor = new DialogDescriptor (
panel,
bundle.getString ("CTL_Breakpoint_Title"), // NOI18N
true,
this
);
descriptor.setOptions (new JButton[] {
bOk = new JButton (bundle.getString ("CTL_Ok")), // NOI18N
bCancel = new JButton (bundle.getString ("CTL_Cancel")) // NOI18N
});
bOk.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Ok")); // NOI18N
bCancel.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Cancel")); // NOI18N
descriptor.setClosingOptions (new Object [0]);
notificationSupport = descriptor.createNotificationLineSupport();
Dialog d = DialogDisplayer.getDefault ().createDialog (descriptor);
d.pack ();
return d;
}
示例6: actionPerformed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
@Messages("TIT_FindartifactUsages=Usages")
public void actionPerformed(ActionEvent event) {
StringBuilder buffer = new StringBuilder();
buffer.append("<b>"); //NOI18N
buffer.append(artifact.getArtifactId());
buffer.append("</b>"); //NOI18N
buffer.append(":"); //NOI18N
buffer.append("<b>"); //NOI18N
buffer.append(artifact.getVersion().toString());
buffer.append("</b>"); //NOI18N
UsagesUI uI = new UsagesUI(buffer.toString(), artifact);
DialogDescriptor dd = new DialogDescriptor(uI, TIT_FindartifactUsages());
uI.initialize(dd.createNotificationLineSupport());
dd.setClosingOptions(new Object[]{
DialogDescriptor.CLOSED_OPTION
});
dd.setOptions(new Object[]{
DialogDescriptor.CLOSED_OPTION
});
DialogDisplayer.getDefault().notify(dd);
}
示例7: show
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public Object show(String title, HelpCtx helpCtx, Object[] options, boolean setMaxNeededSize, String name) {
RepositoryDialogPanel corectPanel = new RepositoryDialogPanel();
corectPanel.panel.setLayout(new BorderLayout());
corectPanel.panel.add(getPanel(), BorderLayout.NORTH);
DialogDescriptor dialogDescriptor = new DialogDescriptor(corectPanel, title); // NOI18N
JPanel p = getPanel();
if(setMaxNeededSize) {
if(bPushPull){
maxNeededSize.setSize(maxNeededSize.width, maxNeededSize.height + HG_PUSH_PULL_VERT_PADDING);
}
p.setPreferredSize(maxNeededSize);
}
if(options!= null) {
dialogDescriptor.setOptions(options); // NOI18N
}
showDialog(dialogDescriptor, helpCtx, name);
return dialogDescriptor.getValue();
}
示例8: actionPerformed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
String title = NbBundle.getMessage(RunTargetsAction.class, "TITLE_run_advanced");
AdvancedActionPanel panel = new AdvancedActionPanel(project, allTargets);
DialogDescriptor dd = new DialogDescriptor(panel, title);
dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
JButton run = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_run"));
run.setDefaultCapable(true);
JButton cancel = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_cancel"));
dd.setOptions(new Object[] {run, cancel});
dd.setModal(true);
Object result = DialogDisplayer.getDefault().notify(dd);
if (result.equals(run)) {
try {
panel.run();
} catch (IOException x) {
AntModule.err.notify(x);
}
}
}
示例9: btnSelectFontActionPerformed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private void btnSelectFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFontActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
pe.setValue(outputOptions.getFont());
DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(),
NbBundle.getMessage(Controller.class,
"LBL_Font_Chooser_Title")); //NOI18N
String defaultFont = NbBundle.getMessage(Controller.class,
"BTN_Defaul_Font"); //NOI18N
dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
defaultFont, DialogDescriptor.CANCEL_OPTION}); //NOI18N
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font) pe.getValue();
outputOptions.setFont(f);
} else if (dd.getValue() == defaultFont) {
outputOptions.setFont(null);
}
updateFontField();
}
}
示例10: 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);
}
});
}
}
示例11: createSimpleDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/**
* Override this to provide your own implementation of the simple dialog.
* This dialog will be displayed if no registered ExportDiffProvider has been found.
* <strong></strong>
* @param currentFilePath folder location to save diff into as it is present in user configuration
* @return simple export file diff panel
*/
protected AbstractExportDiffPanel createSimpleDialog(final String currentFilePath) {
dd = new DialogDescriptor(createFileChooser(new File(currentFilePath)), NbBundle.getMessage(ExportDiffSupport.class, "CTL_Export_Title"));
dd.setOptions(new Object[0]);
// XXX try better
panel = new ExportDiffPanel(new JPanel());
panel.setOutputFileText("");
return panel;
}
示例12: 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);
}
示例13: askTrustSSLServer
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
public int askTrustSSLServer(String certMessage, boolean allowPermanently) {
if((SvnClientExceptionHandler.EX_NO_CERTIFICATE & handledExceptions) != SvnClientExceptionHandler.EX_NO_CERTIFICATE) {
return -1; // XXX test me
}
AcceptCertificatePanel acceptCertificatePanel = new AcceptCertificatePanel();
acceptCertificatePanel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Error_CertFailed"));
acceptCertificatePanel.certificatePane.setText(certMessage);
DialogDescriptor dialogDescriptor = new DialogDescriptor(acceptCertificatePanel, org.openide.util.NbBundle.getMessage(SvnClientCallback.class, "CTL_Error_CertFailed")); // NOI18N
JButton permanentlyButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Cert_AcceptPermanently")); // NOI18N
JButton temporarilyButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Cert_AcceptTemp")); // NOI18N
JButton rejectButton = new JButton(org.openide.util.NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_Cert_Reject")); // NOI18N
dialogDescriptor.setOptions(new Object[] { permanentlyButton, temporarilyButton, rejectButton });
dialogDescriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.subversion.serverCertificateVerification"));
showDialog(dialogDescriptor);
if(dialogDescriptor.getValue() == permanentlyButton) {
return ISVNPromptUserPassword.AcceptPermanently;
} else if(dialogDescriptor.getValue() == temporarilyButton) {
return ISVNPromptUserPassword.AcceptTemporary;
} else {
return ISVNPromptUserPassword.Reject;
}
}
示例14: parseButtons
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Tries to parse a list of buttons provided by given page.
* @param is the input stream to read the page from
* @param defaultButton the button to add always to the list
*/
static void parseButtons(InputStream is, final Object defaultButton, final DialogDescriptor dd)
throws IOException, ParserConfigurationException, SAXException, InterruptedException, InvocationTargetException {
final ButtonsHTMLParser bp = new ButtonsHTMLParser(is);
final IOException[] ioExPtr = new IOException[] { null };
Runnable buttonsCreation = new Runnable() {
@Override
public void run() {
try {
bp.parse();
} catch (IOException ioex) {
ioExPtr[0] = ioex;
return ;
}
bp.createButtons();
List<Object> options = bp.getOptions();
if (!bp.containsExitButton() && (defaultButton != null)){
options.add(defaultButton);
}
dd.setOptions(options.toArray());
dd.setAdditionalOptions(bp.getAdditionalOptions().toArray());
if (bp.getTitle() != null){
dd.setTitle(bp.getTitle());
}
}
};
if (EventQueue.isDispatchThread()){
buttonsCreation.run();
}else{
EventQueue.invokeAndWait(buttonsCreation);
}
if (ioExPtr[0] != null) {
throw ioExPtr[0];
}
}
示例15: showDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public boolean showDialog() {
DialogDescriptor dialogDescriptor = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(RevertModifications.class, "CTL_RevertDialog")); // NOI18N
dialogDescriptor.setOptions(new Object[] {okButton, cancelButton});
dialogDescriptor.setModal(true);
dialogDescriptor.setHelpCtx(new HelpCtx(this.getClass()));
dialogDescriptor.setValid(false);
Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(RevertModifications.class, "ACSD_RevertDialog")); // NOI18N
dialog.setVisible(true);
dialog.setResizable(false);
boolean ret = dialogDescriptor.getValue() == okButton;
return ret;
}