Java Code Examples for org.openide.NotifyDescriptor#OK_CANCEL_OPTION
The following examples show how to use
org.openide.NotifyDescriptor#OK_CANCEL_OPTION .
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: MethodExceptionDialog.java From netbeans with Apache License 2.0 | 6 votes |
public void showDialog(JComponent invoker) { DialogDescriptor dlg = new DialogDescriptor( this, NbBundle.getMessage(this.getClass(), "CLIENT_EXCEPTION"), // NOI18N false, NotifyDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, null); dlg.setOptions(new Object[] { okButton }); Dialog dialog = DialogDisplayer.getDefault().createDialog(dlg); dialog.setPreferredSize(new Dimension(500,300)); dialog.setLocationRelativeTo(invoker); dialog.setVisible(true); }
Example 2
Source File: IDEServicesImpl.java From netbeans with Apache License 2.0 | 6 votes |
private File selectPatchContext() { PatchContextChooser chooser = new PatchContextChooser(); ResourceBundle bundle = NbBundle.getBundle(IDEServicesImpl.class); JButton ok = new JButton(bundle.getString("LBL_Apply")); // NOI18N JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N DialogDescriptor descriptor = new DialogDescriptor( chooser, bundle.getString("LBL_ApplyPatch"), // NOI18N true, NotifyDescriptor.OK_CANCEL_OPTION, ok, null); descriptor.setOptions(new Object [] {ok, cancel}); descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.bugtracking.patchContextChooser")); // NOI18N File context = null; DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true); if (descriptor.getValue() == ok) { context = chooser.getSelectedFile(); } return context; }
Example 3
Source File: AdbConnectionsNode.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@Override protected void performAction(Node[] activatedNodes) { List<String> connections = getConnections(); do { NotifyDescriptor.InputLine inputLine = new NotifyDescriptor.InputLine("Please enter IP:Port", "Add ADB connection", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE); Object notify = DialogDisplayer.getDefault().notify(inputLine); if (NotifyDescriptor.OK_OPTION.equals(notify)) { String inputText = inputLine.getInputText(); if (DevicesNode.validate(inputText)) { connections.add(inputText); saveConnections(connections); return; } } else { return; } } while (true); }
Example 4
Source File: EditPanelHeaders.java From netbeans with Apache License 2.0 | 6 votes |
void showConfirmDialog(String msg) { Object[] options = { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION }; NotifyDescriptor confirmDialog = new NotifyDescriptor((Object)msg, NbBundle.getBundle(EditPanelHeaders.class).getString("MON_Confirmation_Required"), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE, options, NotifyDescriptor.CANCEL_OPTION); DialogDisplayer.getDefault().notify(confirmDialog); if(confirmDialog.getValue().equals(NotifyDescriptor.OK_OPTION)) setParams = true; else setParams = false; }
Example 5
Source File: EditPanelQuery.java From netbeans with Apache License 2.0 | 6 votes |
void showConfirmDialog(String msg) { Object[] options = { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION }; NotifyDescriptor confirmDialog = new NotifyDescriptor((Object)msg, NbBundle.getBundle(EditPanelQuery.class).getString("MON_Confirmation_Required"), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE, options, NotifyDescriptor.CANCEL_OPTION); DialogDisplayer.getDefault().notify(confirmDialog); if(confirmDialog.getValue().equals(NotifyDescriptor.OK_OPTION)) setParams = true; else setParams = false; }
Example 6
Source File: SetLocationAction.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@Override protected void performAction(Node[] activatedNodes) { EmulatorControlSupport emulatorControl = activatedNodes[0].getLookup().lookup(EmulatorControlSupport.class); if (emulatorControl != null) { GpsPanel gpsPanel = new GpsPanel(); NotifyDescriptor nd = new NotifyDescriptor.Confirmation(gpsPanel, "Set GPS Location", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE); Object notify = DialogDisplayer.getDefault().notify(nd); if (NotifyDescriptor.OK_OPTION.equals(notify)) { String ok = emulatorControl.getConsole().sendLocation(gpsPanel.getLo(), gpsPanel.getLa(), gpsPanel.getAl()); if (ok != null) { NotifyDescriptor nd1 = new NotifyDescriptor.Message(ok, NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(nd1); } } } }
Example 7
Source File: AddServerLocationVisualPanel.java From netbeans with Apache License 2.0 | 6 votes |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String newLoc = browseInstallLocation(); if (newLoc != null && !"".equals(newLoc)) { locationTextField.setText(newLoc); String configurationFilePath = newLoc + File.separatorChar + "standalone" + File.separatorChar + "configuration" + File.separatorChar + "standalone-full.xml"; if (configurationTextField.getText() == null || configurationTextField.getText().isEmpty()) { if (new File(configurationFilePath).exists()) { configurationTextField.setText(configurationFilePath); } } else if (!configurationTextField.getText().startsWith(newLoc)) { NotifyDescriptor d = new NotifyDescriptor.Confirmation( NbBundle.getMessage(AddServerLocationVisualPanel.class, "MSG_WARN_INSTALLATION_DIFFERS_CONFIGURATION", configurationFilePath), NotifyDescriptor.OK_CANCEL_OPTION); Object result = DialogDisplayer.getDefault().notify(d); if (result == NotifyDescriptor.CANCEL_OPTION) { // keep the old content return; } else { configurationTextField.setText(configurationFilePath); } } } }
Example 8
Source File: IncomingCallAction.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@Override protected void performAction(Node[] activatedNodes) { EmulatorControlSupport emulatorControl = activatedNodes[0].getLookup().lookup(EmulatorControlSupport.class); if (emulatorControl != null) { NotifyDescriptor.InputLine inputLine = new NotifyDescriptor.InputLine("Phone number:", "Incoming call", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE); Object notify = DialogDisplayer.getDefault().notify(inputLine); if (NotifyDescriptor.OK_OPTION.equals(notify)) { String phoneNo = inputLine.getInputText(); String ok = emulatorControl.getConsole().call(phoneNo); if (ok == null) { CancelIncomingCallAction.addCalledNumber(emulatorControl.getDevice().getSerialNumber(), phoneNo); } else { NotifyDescriptor nd = new NotifyDescriptor.Message(ok, NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(nd); } } } }
Example 9
Source File: Utils.java From netbeans with Apache License 2.0 | 5 votes |
/** * Pop up a confirmation dialog * * @param message * The message to display * * @return true if the user pressed [OK], false if they pressed [CANCEL] */ public static boolean displayConfirmDialog(String message) { NotifyDescriptor ndesc = new NotifyDescriptor.Confirmation( message, NotifyDescriptor.OK_CANCEL_OPTION); Object result = DialogDisplayer.getDefault().notify(ndesc); return ( result == NotifyDescriptor.OK_OPTION ); }
Example 10
Source File: TerrainEditorTopComponent.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void addSpatial(final String name) { if (selectedSpat == null) { Confirmation msg = new NotifyDescriptor.Confirmation( "You must select a Node to add the " + name + " to in the Scene Explorer window", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notify(msg); return; } final Spatial node = selectedSpat.getLookup().lookup(Spatial.class); if (node != null) { if ("Terrain".equals(name)) { if (terrainWizard == null) { terrainWizard = new CreateTerrainWizardAction(this); } terrainWizard.performAction(); } else if ("Skybox".equals(name)) { if (skyboxWizard == null) { skyboxWizard = new SkyboxWizardAction(this); } skyboxWizard.performAction(); } else if ("Ocean".equals(name)) { } } }
Example 11
Source File: VersioningMainMenu.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void actionPerformed (ActionEvent e) { NotifyDescriptor nd = new NotifyDescriptor.Confirmation( NbBundle.getMessage(VersioningMainMenu.class, "MSG_ConnectAction.confirmation.text", new Object[] { root.getName(), vs.getDisplayName() }), //NOI18N NbBundle.getMessage(VersioningMainMenu.class, "LBL_ConnectAction.confirmation.title"), //NOI18N NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE); if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) { VersioningConfig.getDefault().disconnectRepository(vs, root); VersioningManager.getInstance().versionedRootsChanged(); } }
Example 12
Source File: ResultCellEditor.java From netbeans with Apache License 2.0 | 5 votes |
@Override public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, Object value, boolean isSelected, int row, int column) { saveValue = value; DefaultMutableTreeNode node = (DefaultMutableTreeNode)table.getModel(). getValueAt(row, 0); /** * Now depending on the type, create a component to edit/display the type. */ viewerDialog = new ResultViewerDialog(); if(null == node.getUserObject()) { viewerDialog.setText((String)value); } else { TypeNodeData data = (TypeNodeData)node.getUserObject(); viewerDialog.setText((value == null) ? "null" : value.toString()); // NOI18N dlg = new DialogDescriptor(viewerDialog, data.getRealTypeName(), true, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION, DialogDescriptor.DEFAULT_ALIGN, viewerDialog.getHelpCtx(), null); dlg.setOptions(new Object[] { viewerDialog.getOkButton() }); dialog = DialogDisplayer.getDefault().createDialog(dlg); dialog.setSize(300,300); dialog.setVisible(true); } return null; }
Example 13
Source File: Actions.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { SortPanel panel = new SortPanel(); NotifyDescriptor categoryNameDialog = new NotifyDescriptor( panel, NbBundle.getMessage(Actions.class, "MSG_SortDialog"), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE, null, NotifyDescriptor.OK_OPTION); if (DialogDisplayer.getDefault().notify(categoryNameDialog) == NotifyDescriptor.OK_OPTION) { panel.saveAttributes(); } }
Example 14
Source File: QueryController.java From netbeans with Apache License 2.0 | 5 votes |
private void onRemove() { NotifyDescriptor nd = new NotifyDescriptor.Confirmation( NbBundle.getMessage(QueryController.class, "MSG_RemoveQuery", new Object[] { query.getDisplayName() }), // NOI18N NbBundle.getMessage(QueryController.class, "CTL_RemoveQuery"), // NOI18N NotifyDescriptor.OK_CANCEL_OPTION); if(DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) { Bugzilla.getInstance().getRequestProcessor().post(new Runnable() { @Override public void run() { remove(); } }); } }
Example 15
Source File: PhpExecutable.java From netbeans with Apache License 2.0 | 4 votes |
@NbBundle.Messages("PhpExecutable.debug.noMoreSessions=Debugger session is already running. Restart?") private static boolean warnNoMoreDebugSession() { NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(Bundle.PhpExecutable_debug_noMoreSessions(), NotifyDescriptor.OK_CANCEL_OPTION); return DialogDisplayer.getDefault().notify(descriptor) == NotifyDescriptor.OK_OPTION; }
Example 16
Source File: ApisupportAntUIUtils.java From netbeans with Apache License 2.0 | 4 votes |
public static NbModuleProject chooseSuiteComponent(Component parent, SuiteProject suite) { Project project = chooseProject(parent); if (project == null) { return null; } if (!(project instanceof NbModuleProject)) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( NbBundle.getMessage(ApisupportAntUIUtils.class, "MSG_TryingToAddNonNBModule", ProjectUtils.getInformation(project).getDisplayName()))); return null; } NbModuleProject p = (NbModuleProject) project; if (SuiteUtils.getSubProjects(suite).contains((NbModuleProject) project)) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( NbBundle.getMessage(ApisupportAntUIUtils.class, "MSG_SuiteAlreadyContainsProject", ProjectUtils.getInformation(suite).getDisplayName(), ProjectUtils.getInformation(project).getDisplayName()))); return null; } switch (p.getModuleType()) { case SUITE_COMPONENT: Object[] params = new Object[] { ProjectUtils.getInformation(project).getDisplayName(), getSuiteProjectName(project), getSuiteProjectDirectory(project), ProjectUtils.getInformation(suite).getDisplayName(),}; NotifyDescriptor.Confirmation confirmation = new NotifyDescriptor.Confirmation( NbBundle.getMessage(ApisupportAntUIUtils.class, "MSG_MoveFromSuiteToSuite", params), NotifyDescriptor.OK_CANCEL_OPTION); DialogDisplayer.getDefault().notify(confirmation); if (confirmation.getValue() == NotifyDescriptor.OK_OPTION) { return p; } else { return null; } case STANDALONE: return p; case NETBEANS_ORG: DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( NbBundle.getMessage(ApisupportAntUIUtils.class, "MSG_TryingToAddNBORGModule", ProjectUtils.getInformation(project).getDisplayName()))); return null; default: throw new AssertionError(); } }
Example 17
Source File: CategoryArchiveFiles.java From nb-ci-plugin with GNU General Public License v2.0 | 4 votes |
private void addZipButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addZipButtonActionPerformed final CIEntry entry = new CIEntry(); final CIEntryEditPanel panel = new CIEntryEditPanel(); panel.load(entry); panel.setFileEntryMap(model.getEntryMap()); final DialogDescriptor descriptor = new DialogDescriptor( panel, getMessage("CTL_AddArchiveFile"), // NOI18N true, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION, null); descriptor.setClosingOptions(new Object[]{}); NotificationLineSupport notificationLineSupport = descriptor.createNotificationLineSupport(); panel.setValidityObjects(descriptor, notificationLineSupport); final Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.getAccessibleContext().setAccessibleName(getMessage("ACSN_Dialog")); // NOI18N dialog.getAccessibleContext().setAccessibleDescription(getMessage("ACSD_Dialog")); // NOI18N dialog.setResizable(false); descriptor.setButtonListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (DialogDescriptor.OK_OPTION.equals(e.getSource())) { } dialog.setVisible(false); } }); dialog.setVisible(true); if (NotifyDescriptor.OK_OPTION.equals(descriptor.getValue())) { panel.store(entry); model.addEntry(entry); int rowIndex = entryTable.getRowCount() - 1; entryTable.setRowSelectionInterval(rowIndex, rowIndex); } dialog.dispose(); }
Example 18
Source File: QuickSearchComboBar.java From netbeans with Apache License 2.0 | 4 votes |
public static Issue selectIssue(String message, Repository repository, JPanel caller, HelpCtx helpCtx) { QuickSearchComboBar bar = new QuickSearchComboBar(caller); bar.setRepository(repository); bar.setAlignmentX(0f); bar.setMaximumSize(new Dimension(Short.MAX_VALUE, bar.getPreferredSize().height)); JPanel panel = new JPanel(); BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS); panel.setLayout(layout); JLabel label = new JLabel(); Mnemonics.setLocalizedText(label, message); panel.add(label); label.setLabelFor(bar.getIssueComponent()); LayoutStyle layoutStyle = LayoutStyle.getInstance(); int gap = layoutStyle.getPreferredGap(label, bar, LayoutStyle.ComponentPlacement.RELATED, SwingConstants.SOUTH, panel); panel.add(Box.createVerticalStrut(gap)); panel.add(bar); panel.add(Box.createVerticalStrut(gap)); ResourceBundle bundle = NbBundle.getBundle(QuickSearchComboBar.class); JLabel hintLabel = new JLabel(bundle.getString("MSG_SelectIssueHint")); // NOI18N hintLabel.setEnabled(false); panel.add(hintLabel); panel.add(Box.createVerticalStrut(80)); panel.setBorder(BorderFactory.createEmptyBorder( layoutStyle.getContainerGap(panel, SwingConstants.NORTH, null), layoutStyle.getContainerGap(panel, SwingConstants.WEST, null), 0, layoutStyle.getContainerGap(panel, SwingConstants.EAST, null))); panel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_IssueSelector")); Issue issue = null; JButton ok = new JButton(bundle.getString("LBL_Select")); // NOI18N ok.getAccessibleContext().setAccessibleDescription(ok.getText()); JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N cancel.getAccessibleContext().setAccessibleDescription(cancel.getText()); DialogDescriptor descriptor = new DialogDescriptor( panel, bundle.getString("LBL_Issues"), // NOI18N true, NotifyDescriptor.OK_CANCEL_OPTION, ok, null); descriptor.setOptions(new Object [] {ok, cancel}); descriptor.setHelpCtx(helpCtx); DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true); if (descriptor.getValue() == ok) { issue = bar.getIssue(); } return issue; }
Example 19
Source File: CommandUtils.java From netbeans with Apache License 2.0 | 4 votes |
/** Return <code>true</code> if user wants to restart the current debug session. */ public static boolean warnNoMoreDebugSession() { String message = NbBundle.getMessage(CommandUtils.class, "MSG_NoMoreDebugSession"); NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(message, NotifyDescriptor.OK_CANCEL_OPTION); return DialogDisplayer.getDefault().notify(descriptor) == NotifyDescriptor.OK_OPTION; }
Example 20
Source File: CategoryArchiveFiles.java From nb-ci-plugin with GNU General Public License v2.0 | 4 votes |
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed int rowIndex = entryTable.getSelectedRow(); if (rowIndex >= 0) { final CIEntry entry = model.getEntry(rowIndex); final CIEntryEditPanel panel = new CIEntryEditPanel(); panel.load(entry); panel.setFileEntryMap(model.getEntryMap(entry)); final DialogDescriptor descriptor = new DialogDescriptor( panel, getMessage("CTL_AddArchiveFile"), // NOI18N true, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION, null); descriptor.setClosingOptions(new Object[]{}); NotificationLineSupport notificationLineSupport = descriptor.createNotificationLineSupport(); panel.setValidityObjects(descriptor, notificationLineSupport); final Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.getAccessibleContext().setAccessibleName(getMessage("ACSN_Dialog")); // NOI18N dialog.getAccessibleContext().setAccessibleDescription(getMessage("ACSD_Dialog")); // NOI18N dialog.setResizable(false); descriptor.setButtonListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (DialogDescriptor.OK_OPTION.equals(e.getSource())) { } dialog.setVisible(false); } }); dialog.setVisible(true); if (NotifyDescriptor.OK_OPTION.equals(descriptor.getValue())) { panel.store(entry); model.setEntry(rowIndex, entry); entryTable.setRowSelectionInterval(rowIndex, rowIndex); } dialog.dispose(); } }