List of usage examples for javax.swing JOptionPane YES_OPTION
int YES_OPTION
To view the source code for javax.swing JOptionPane YES_OPTION.
Click Source Link
From source file:net.sf.jabref.gui.exporter.SaveDatabaseAction.java
/** * Check whether or not the external database has been modified. If so need to alert the user to accept external updates prior to * saving the database. This is necessary to avoid overwriting other users work when using a multiuser database file. * * @return true if the external database file has been modified and the user must choose to accept the changes and false if no modifications * were found or there is no requested protection for the database file. */// w w w .j av a2 s. c o m private boolean checkExternalModification() { // Check for external modifications: if (panel.isUpdatedExternally() || Globals.getFileUpdateMonitor().hasBeenModified(panel.getFileMonitorHandle())) { String[] opts = new String[] { Localization.lang("Review changes"), Localization.lang("Save"), Localization.lang("Cancel") }; int answer = JOptionPane.showOptionDialog(panel.frame(), Localization.lang("File has been updated externally. " + "What do you want to do?"), Localization.lang("File updated externally"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, opts, opts[0]); if (answer == JOptionPane.CANCEL_OPTION) { canceled = true; return true; } else if (answer == JOptionPane.YES_OPTION) { canceled = true; JabRefExecutorService.INSTANCE.execute(() -> { if (!FileBasedLock.waitForFileLock(panel.getBibDatabaseContext().getDatabaseFile().toPath(), 10)) { // TODO: GUI handling of the situation when the externally modified file keeps being locked. LOGGER.error("File locked, this will be trouble."); } ChangeScanner scanner = new ChangeScanner(panel.frame(), panel, panel.getBibDatabaseContext().getDatabaseFile()); JabRefExecutorService.INSTANCE.executeWithLowPriorityInOwnThreadAndWait(scanner); if (scanner.changesFound()) { scanner.displayResult(resolved -> { if (resolved) { panel.setUpdatedExternally(false); SwingUtilities.invokeLater(() -> panel.getSidePaneManager().hide("fileUpdate")); } else { canceled = true; } }); } }); return true; } else { // User indicated to store anyway. if (panel.getBibDatabaseContext().getMetaData().isProtected()) { JOptionPane.showMessageDialog(frame, Localization .lang("Database is protected. Cannot save until external changes have been reviewed."), Localization.lang("Protected database"), JOptionPane.ERROR_MESSAGE); canceled = true; } else { panel.setUpdatedExternally(false); panel.getSidePaneManager().hide("fileUpdate"); } } } // Return false as either no external database file modifications have been found or overwrite is requested any way return false; }
From source file:com.projity.pm.graphic.frames.StartupFactory.java
public static Boolean verifyOpenWritable(Long projectId) { if (projectId == null || projectId == 0) return null; if (ProjectFactory.getInstance().isResourcePoolOpenAndWritable()) { Alert.warn(Messages.getString("Warn.resourcePoolOpen")); return null; }/*from w w w .j a v a2 s . com*/ String locker = getLockerName(projectId); boolean openAs = false; if (locker != null) { openAs = (JOptionPane.YES_OPTION == Alert .confirmYesNo(Messages.getStringWithParam("Warn.lockMessage", locker))); if (openAs == false) return null; } return !openAs; }
From source file:com.biosis.biosislite.vistas.inventario.MantenimientoTipo.java
private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed // TODO add your handling code here: List<Integer> array = new ArrayList(); array.add(FormularioUtil.Validar(FormularioUtil.TipoValidacion.NUMERO, this.nombreField, "Nombre")); FormularioUtil.validar2(array);/*from w w w .j a v a2 s . com*/ if (FormularioUtil.error) { JOptionPane.showMessageDialog(null, FormularioUtil.mensaje, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); FormularioUtil.mensaje = ""; FormularioUtil.error = false; } else { String palabra = ""; String palabra2 = ""; if (accion == 1) { palabra = "registrar"; palabra2 = "registrado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Tipo?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { tipoControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase()); tipoControlador.accion(accion); lista.add(tipoControlador.getSeleccionado()); if (accion == 1) { JOptionPane.showMessageDialog(null, "Tipo " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Tipo no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Tipo no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else if (accion == 2) { palabra = "modificar"; palabra2 = "modificado"; if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Tipo?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { if (accion == 2) { JOptionPane.showMessageDialog(null, "Tipo " + palabra2 + " correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); lista.clear(); tipoControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase()); tipoControlador.accion(accion); listar(); FormularioUtil.limpiarComponente(panelDatos); } else { JOptionPane.showMessageDialog(null, "Tipo no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { FormularioUtil.limpiarComponente(panelDatos); JOptionPane.showMessageDialog(null, "Tipo no " + palabra2, "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } FormularioUtil.limpiarComponente(panelDatos); FormularioUtil.activarComponente(panelOpciones, true); FormularioUtil.activarComponente(panelGuardar, false); FormularioUtil.activarComponente(panelDatos, false); } }
From source file:de.tor.tribes.ui.views.DSWorkbenchReTimerFrame.java
private void removeSelection(boolean ask) { jideRetimeTabbedPane.setSelectedIndex(1); int[] selectedRows = jResultTable.getSelectedRows(); if (selectedRows == null || selectedRows.length < 1) { showInfo("Keine Eintrge ausgewhlt"); return;//from www .ja v a 2s .c om } if (!ask || JOptionPaneHelper.showQuestionConfirmBox(this, "Willst du " + ((selectedRows.length == 1) ? "den gewhlten Eintrag " : "die gewhlten Eintrge ") + "wirklich lschen?", "Lschen", "Nein", "Ja") == JOptionPane.YES_OPTION) { DefaultTableModel model = (DefaultTableModel) jResultTable.getModel(); int numRows = selectedRows.length; for (int i = 0; i < numRows; i++) { model.removeRow(jResultTable.convertRowIndexToModel(jResultTable.getSelectedRow())); } showSuccess("Eintrge gelscht"); } }
From source file:com.qawaa.gui.EventWebScanGUI.java
/** * ???//w w w . j a va2 s. co m */ private void windowsClosed() { if (RUNNING) { int response = JOptionPane.showConfirmDialog(null, CONTEXT.getMessage("gobal.quit.dialog.msg", null, Locale.CHINA), CONTEXT.getMessage("gobal.quit.dialog.title", null, Locale.CHINA), JOptionPane.YES_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { System.exit(0); } } else { System.exit(0); } }
From source file:com.t3.client.TabletopTool.java
/** * This method is specific to deleting a token, but it can be used as a * basis for any other method which wants to be turned off via a property. * // w w w . j av a 2s .co m * @return true if the token should be deleted. */ public static boolean confirmTokenDelete() { if (!AppPreferences.getTokensWarnWhenDeleted()) { return true; } String msg = I18N.getText("msg.confirm.deleteToken"); log.debug(msg); Object[] options = { I18N.getText("msg.title.messageDialog.yes"), I18N.getText("msg.title.messageDialog.no"), I18N.getText("msg.title.messageDialog.dontAskAgain") }; String title = I18N.getText("msg.title.messageDialogConfirm"); int val = JOptionPane.showOptionDialog(clientFrame, msg, title, JOptionPane.NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); // "Yes, don't show again" Button if (val == 2) { showInformation("msg.confirm.deleteToken.removed"); AppPreferences.setTokensWarnWhenDeleted(false); } // Any version of 'Yes'... if (val == JOptionPane.YES_OPTION || val == 2) { return true; } // Assume 'No' response return false; }
From source file:com.proyecto.vista.MantenimientoTipo.java
private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed // TODO add your handling code here: accion = Controlador.ELIMINAR;//from w w w . ja v a 2s . c om if (tbltipo.getSelectedRow() != -1) { Integer codigo = tbltipo.getSelectedRow(); Tipo tipo = tipoControlador.buscarPorId(lista.get(codigo).getId()); if (tipo != null) { if (JOptionPane.showConfirmDialog(null, "Desea Eliminar el Tipo?", "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { int[] filas = tbltipo.getSelectedRows(); for (int i = 0; i < filas.length; i++) { Tipo empleado2 = lista.get(filas[0]); lista.remove(empleado2); tipoControlador.setSeleccionado(empleado2); tipoControlador.accion(accion); } if (tipoControlador.accion(accion) == 3) { JOptionPane.showMessageDialog(null, "Tipo eliminado correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "Tipo no eliminada", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Tipo no eliminada", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } } } else { JOptionPane.showMessageDialog(null, "Debe seleccionar un Tipo", "Mensaje del Sistema", JOptionPane.ERROR_MESSAGE); } }
From source file:com.floreantpos.bo.ui.explorer.MenuItemExplorer.java
private TransparentPanel createButtonPanel() { ExplorerButtonPanel explorerButton = new ExplorerButtonPanel(); JButton editButton = explorerButton.getEditButton(); JButton addButton = explorerButton.getAddButton(); JButton deleteButton = explorerButton.getDeleteButton(); JButton duplicateButton = new JButton(POSConstants.DUPLICATE); JButton updateStockAmount = new JButton(Messages.getString("MenuItemExplorer.6")); //$NON-NLS-1$ JButton btnChangeMenuGroup = new JButton("Change Menu Group"); JButton btnChangeOrderType = new JButton("Change Order Type"); updateStockAmount.addActionListener(new ActionListener() { @Override/*from www . j a v a 2 s . c om*/ public void actionPerformed(ActionEvent e) { try { int index = table.getSelectedRow(); if (index < 0) { POSMessageDialog.showMessage(MenuItemExplorer.this, Messages.getString("MenuItemExplorer.7")); //$NON-NLS-1$ return; } MenuItem menuItem = tableModel.getRow(index); String amountString = JOptionPane.showInputDialog(MenuItemExplorer.this, Messages.getString("MenuItemExplorer.8"), menuItem.getStockAmount()); //$NON-NLS-1$ if (amountString == null || amountString.equals("")) { //$NON-NLS-1$ return; } double stockAmount = Double.parseDouble(amountString); if (stockAmount < 0) { POSMessageDialog.showError(MenuItemExplorer.this, Messages.getString("MenuItemExplorer.10")); //$NON-NLS-1$ return; } menuItem.setStockAmount(stockAmount); MenuItemDAO.getInstance().saveOrUpdate(menuItem); table.repaint(); } catch (NumberFormatException e1) { POSMessageDialog.showError(MenuItemExplorer.this, Messages.getString("MenuItemExplorer.11")); //$NON-NLS-1$ return; } catch (Exception e2) { BOMessageDialog.showError(MenuItemExplorer.this, POSConstants.ERROR_MESSAGE, e2); return; } } }); editButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doEditSelectedMenuItem(); } }); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { MenuItem menuItem = new MenuItem(); Object group = cbGroup.getSelectedItem(); if (group instanceof MenuGroup) { menuItem.setParent((MenuGroup) group); } Object selectedType = cbOrderTypes.getSelectedItem(); if (selectedType instanceof OrderType) { List types = new ArrayList(); types.add((OrderType) selectedType); menuItem.setOrderTypeList(types); } MenuItemForm editor = new MenuItemForm(menuItem); BeanEditorDialog dialog = new BeanEditorDialog(POSUtil.getBackOfficeWindow(), editor); dialog.open(); if (dialog.isCanceled()) return; MenuItem foodItem = (MenuItem) editor.getBean(); tableModel.addRow(foodItem); } catch (Throwable x) { BOMessageDialog.showError(POSConstants.ERROR_MESSAGE, x); } } }); duplicateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { int index = table.getSelectedRow(); if (index < 0) return; index = table.convertRowIndexToModel(index); MenuItem existingItem = tableModel.getRow(index); existingItem = MenuItemDAO.getInstance().initialize(existingItem); MenuItem newMenuItem = new MenuItem(); PropertyUtils.copyProperties(newMenuItem, existingItem); newMenuItem.setId(null); String newName = doDuplicateName(existingItem); newMenuItem.setName(newName); newMenuItem.setFractionalUnit(existingItem.isFractionalUnit()); newMenuItem.setDisableWhenStockAmountIsZero(existingItem.isDisableWhenStockAmountIsZero()); newMenuItem.setShowImageOnly(existingItem.isShowImageOnly()); MenuItemForm editor = new MenuItemForm(newMenuItem); BeanEditorDialog dialog = new BeanEditorDialog(POSUtil.getBackOfficeWindow(), editor); dialog.open(); if (dialog.isCanceled()) return; MenuItem foodItem = (MenuItem) editor.getBean(); tableModel.addRow(foodItem); table.getSelectionModel().addSelectionInterval(tableModel.getRowCount() - 1, tableModel.getRowCount() - 1); table.scrollRowToVisible(tableModel.getRowCount() - 1); } catch (Throwable x) { BOMessageDialog.showError(POSConstants.ERROR_MESSAGE, x); } } }); btnChangeMenuGroup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { int[] rows = table.getSelectedRows(); if (rows.length < 1) return; MenuGroup group = getSelectedMenuGroup(null); if (group == null) return; List<MenuItem> menuItems = new ArrayList<>(); for (int i = 0; i < rows.length; i++) { int index = table.convertRowIndexToModel(rows[i]); MenuItem menuItem = tableModel.getRow(index); menuItem.setParent(group); menuItems.add(menuItem); } MenuItemDAO.getInstance().saveAll(menuItems); searchItem(); } catch (Throwable x) { BOMessageDialog.showError(POSConstants.ERROR_MESSAGE, x); } } }); btnChangeOrderType.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { int[] rows = table.getSelectedRows(); if (rows.length < 1) return; List<OrderType> orderTypes = getSelectedOrderTypes(new ArrayList<>()); if (orderTypes == null) return; List<MenuItem> menuItems = new ArrayList<>(); for (int i = 0; i < rows.length; i++) { int index = table.convertRowIndexToModel(rows[i]); MenuItem menuItem = tableModel.getRow(index); menuItem.setOrderTypeList(orderTypes); menuItems.add(menuItem); } MenuItemDAO.getInstance().saveAll(menuItems); searchItem(); } catch (Throwable x) { BOMessageDialog.showError(POSConstants.ERROR_MESSAGE, x); } } }); deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { int index = table.getSelectedRow(); if (index < 0) return; index = table.convertRowIndexToModel(index); if (POSMessageDialog.showYesNoQuestionDialog(MenuItemExplorer.this, POSConstants.CONFIRM_DELETE, POSConstants.DELETE) != JOptionPane.YES_OPTION) { return; } MenuItem item = tableModel.getRow(index); MenuItemDAO foodItemDAO = new MenuItemDAO(); if (item.getDiscounts() != null && item.getDiscounts().size() > 0) { foodItemDAO.releaseParentAndDelete(item); } else { foodItemDAO.delete(item); } tableModel.removeRow(index); } catch (Throwable x) { BOMessageDialog.showError(POSConstants.ERROR_MESSAGE, x); } } }); TransparentPanel panel = new TransparentPanel(); panel.add(addButton); panel.add(editButton); panel.add(updateStockAmount); panel.add(deleteButton); panel.add(duplicateButton); panel.add(btnChangeMenuGroup); panel.add(btnChangeOrderType); return panel; }
From source file:gdt.jgui.entity.edge.JBondsPanel.java
/** * Get the context menu.//w w w . j a v a2s .com * @return the context menu. */ @Override public JMenu getContextMenu() { menu = super.getContextMenu(); int cnt = menu.getItemCount(); mia = new JMenuItem[cnt]; for (int i = 0; i < cnt; i++) mia[i] = menu.getItem(i); menu.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { //System.out.println("WeblinkPanel:getConextMenu:menu selected"); menu.removeAll(); if (mia != null) { for (JMenuItem mi : mia) menu.add(mi); menu.addSeparator(); } if (hasSelectedItems()) { JMenuItem deleteItem = new JMenuItem("Delete"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { String[] sa = JBondsPanel.this.listSelectedItems(); if (sa == null) return; for (String s : sa) { // System.out.println("JBondsPanel:delete:s="+s); if (isGraphEntity()) removeBondEntry(s); else if (isEdgeEntity()) removeBond(console, s); else if (isDetailEntity()) { System.out.println("JBondsPanel:delete detail:"); Entigrator entigrator = console.getEntigrator(entihome$); BondDetailHandler.deleteDetail(entigrator, s); } } close(); JBondsPanel bp = new JBondsPanel(); String bpLocator$ = bp.getLocator(); bpLocator$ = Locator.append(bpLocator$, Entigrator.ENTIHOME, entihome$); bpLocator$ = Locator.append(bpLocator$, EntityHandler.ENTITY_KEY, entityKey$); JConsoleHandler.execute(console, bpLocator$); } } }); menu.add(deleteItem); JMenuItem copyItem = new JMenuItem("Copy"); copyItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String[] sa = JBondsPanel.this.listSelectedItems(); if (sa == null) return; for (String s : sa) { console.clipboard.putString(s); } } }); menu.add(copyItem); menu.addSeparator(); } if (isEdgeEntity()) { JMenuItem newItem = new JMenuItem("New"); newItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //System.out.println("JBondsPanel:new:"+locator$); Entigrator entigrator = console.getEntigrator(entihome$); Sack entity = entigrator.getEntityAtKey(entityKey$); if (!entity.existsElement("bond")) entity.createElement("bond"); String bondKey$ = Identity.key(); entity.putElementItem("bond", new Core(null, bondKey$, null)); // String icon$=Support.readHandlerIcon(JEntitiesPanel.class, "globe.png"); entigrator.save(entity); // JBondsPanel.this.getPanel().removeAll(); close(); JBondsPanel bp = new JBondsPanel(); String bpLocator$ = bp.getLocator(); bpLocator$ = Locator.append(bpLocator$, Entigrator.ENTIHOME, entihome$); bpLocator$ = Locator.append(bpLocator$, EntityHandler.ENTITY_KEY, entityKey$); //bpLocator$=Locator.append(bpLocator$, BaseHandler.HANDLER_METHOD,"instantiate"); JConsoleHandler.execute(console, bpLocator$); } }); menu.add(newItem); } if (isGraphEntity()) { JMenuItem showItem = new JMenuItem("Show"); showItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { JGraphRenderer gr = new JGraphRenderer(); String grLocator$ = gr.getLocator(); grLocator$ = Locator.append(grLocator$, Entigrator.ENTIHOME, entihome$); grLocator$ = Locator.append(grLocator$, EntityHandler.ENTITY_KEY, entityKey$); JConsoleHandler.execute(console, grLocator$); } catch (Exception ee) { Logger.getLogger(JGraphRenderer.class.getName()).info(ee.toString()); } } }); menu.add(showItem); if (hasBondsToPaste()) { JMenuItem pasteItem = new JMenuItem("Paste"); pasteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pasteBonds(); JBondsPanel bp = new JBondsPanel(); String bpLocator$ = bp.getLocator(); bpLocator$ = Locator.append(bpLocator$, Entigrator.ENTIHOME, entihome$); bpLocator$ = Locator.append(bpLocator$, EntityHandler.ENTITY_KEY, entityKey$); JConsoleHandler.execute(console, bpLocator$); } }); menu.add(pasteItem); } } JMenuItem doneItem = new JMenuItem("Done"); doneItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (requesterResponseLocator$ != null) { try { byte[] ba = Base64.decodeBase64(requesterResponseLocator$); String responseLocator$ = new String(ba, "UTF-8"); JConsoleHandler.execute(console, responseLocator$); } catch (Exception ee) { Logger.getLogger(JBondsPanel.class.getName()).severe(ee.toString()); } } else console.back(); } }); menu.add(doneItem); menu.addSeparator(); JMenuItem sortInNode = new JMenuItem("Sort in node"); sortInNode.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { selectMode$ = SELECT_MODE_IN; JItemPanel[] ipa = getItems(); Entigrator entigrator = console.getEntigrator(entihome$); InNodeComparator inc = new InNodeComparator(); inc.entigrator = entigrator; ArrayList<JItemPanel> ipl = new ArrayList<JItemPanel>(Arrays.asList(ipa)); Collections.sort(ipl, inc); panel.removeAll(); // System.out.println("JBondsPanel:sort in node:ipl="+ipl.size()); if (ipa != null) for (JItemPanel ip : ipl) { panel.add(ip); } revalidate(); repaint(); Sack entity = entigrator.getEntityAtKey(entityKey$); if (!entity.existsElement("parameter")) entity.createElement("parameter"); entity.putElementItem("parameter", new Core(null, SELECT_MODE, selectMode$)); entigrator.save(entity); } catch (Exception ee) { } } }); menu.add(sortInNode); JMenuItem sortOutNode = new JMenuItem("Sort out node"); sortOutNode.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { selectMode$ = SELECT_MODE_OUT; JItemPanel[] ipa = getItems(); ArrayList<JItemPanel> ipl = new ArrayList<JItemPanel>(Arrays.asList(ipa)); Collections.sort(ipl, new ItemPanelComparator()); panel.removeAll(); System.out.println("JBondsPanel:sort out node:ipl=" + ipl.size()); if (ipa != null) for (JItemPanel ip : ipl) { panel.add(ip); } revalidate(); repaint(); Entigrator entigrator = console.getEntigrator(entihome$); Sack entity = entigrator.getEntityAtKey(entityKey$); if (!entity.existsElement("parameter")) entity.createElement("parameter"); entity.putElementItem("parameter", new Core(null, SELECT_MODE, selectMode$)); entigrator.save(entity); } catch (Exception ee) { } } }); menu.add(sortOutNode); } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); return menu; }
From source file:com.opendoorlogistics.studio.scripts.editor.ScriptEditor.java
public void disposeWithSavePrompt() { String currentXML = getXML(); if (currentXML.equals(lastOutputXML) == false) { if (JOptionPane.showConfirmDialog(ScriptEditor.this, "Script has been modified but not saved, changes will be lost. Really close?", "Really Closing?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { ScriptEditor.this.dispose(); }/*from www . j av a2 s . com*/ } else { ScriptEditor.this.dispose(); } }