GEN-LAST:event_showActiveCertificateButtonActionPerformed
540874
private void addPkcs11ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPkcs11ButtonActionPerformed
		String name = null;
		try {
			final int indexSelectedDriver = driverComboBox.getSelectedIndex();
			name = driverConfig.getNames().get(indexSelectedDriver);
			if (name.equals("")) {
				return;
			}

			String library = driverConfig.getPaths().get(indexSelectedDriver);
			if (library.equals("")) {
				return;
			}
			
			int slot = driverConfig.getSlots().get(indexSelectedDriver);
			if (slot < 0) {
				return;
			}
			
			int slotListIndex = driverConfig.getSlotIndexes().get(indexSelectedDriver);
			if (slotListIndex < 0) {
				return;
			}
			
			String kspass = new String(pkcs11PasswordField.getPassword());
			if (kspass.equals("")){
				kspass = null;
			}
			
			PCKS11ConfigurationBuilder confBuilder = PKCS11Configuration.builder();
			confBuilder.setName(name).setLibrary(library);
			if (usePkcs11ExperimentalSliSupportCheckBox.isSelected()) {
				confBuilder.setSlotListIndex(slotListIndex);
			} else {
				confBuilder.setSlotId(slot);
			}
			
			int ksIndex = contextManager.initPKCS11(confBuilder.build(), kspass);
			
			if (ksIndex == -1) {
				logger.error("The required PKCS#11 provider is not available ("
						+ SSLContextManager.SUN_PKCS11_CANONICAL_CLASS_NAME + " or "
						+ SSLContextManager.IBM_PKCS11_CONONICAL_CLASS_NAME + ").");
				showErrorMessageSunPkcs11ProviderNotAvailable();
				return;
			}
			
			// The PCKS11 driver/smartcard was initialized properly: reset login attempts
			login_attempts = 0;
			keyStoreListModel.insertElementAt(contextManager.getKeyStoreDescription(ksIndex), ksIndex);
			// Issue 182
			retry = true;

			certificatejTabbedPane.setSelectedIndex(0);
			activateFirstOnlyAliasOfKeyStore(ksIndex);

			driverComboBox.setSelectedIndex(-1);
			pkcs11PasswordField.setText("");
			
		} catch (InvocationTargetException e) {
			if (e.getCause() instanceof ProviderException) {
				if ("Error parsing configuration".equals(e.getCause().getMessage())) {
					// There was a problem with the configuration provided:
					//   - Missing library.
					//   - Malformed configuration.
					//   - ...
					logAndShowGenericErrorMessagePkcs11CouldNotBeAdded(false, name, e);
				} else if ("Initialization failed".equals(e.getCause().getMessage())) {
					// The initialisation may fail because of:
					//   - no smart card reader or smart card detected.
					//   - smart card is in use by other application.
					//   - ...
					
					// Issue 182: Try to instantiate the PKCS11 provider twice if there are
					// conflicts with other software (eg. Firefox), that is accessing it too.
					if (retry) {
						// Try two times only
						retry = false;
						addPkcs11ButtonActionPerformed(evt);
					} else {
						JOptionPane.showMessageDialog(null, new String[] {
								Constant.messages.getString("options.cert.error"),
								Constant.messages.getString("options.cert.error.pkcs11")}, 
								Constant.messages.getString("options.cert.label.client.cert"), JOptionPane.ERROR_MESSAGE);
						// Error message changed to explain that user should try to add it again... 
						retry = true;
						logger.warn("Couldn't add key from "+name, e);
					}
				} else {
					logAndShowGenericErrorMessagePkcs11CouldNotBeAdded(false, name, e);
				}
			} else {
				logAndShowGenericErrorMessagePkcs11CouldNotBeAdded(false, name, e);
			}
		} catch (java.io.IOException e) {
			if (e.getMessage().equals("load failed") && e.getCause().getClass().getName().equals("javax.security.auth.login.FailedLoginException")) {
				// Exception due to a failed login attempt: BAD PIN or password
				login_attempts++;
				String attempts = " ("+login_attempts+"/"+MAX_LOGIN_ATTEMPTS+") ";
				if (login_attempts == (MAX_LOGIN_ATTEMPTS-1)) {
					// Last attempt before blocking the smartcard
					JOptionPane.showMessageDialog(null, new String[] {
							Constant.messages.getString("options.cert.error"),
							Constant.messages.getString("options.cert.error.wrongpassword"), 
							Constant.messages.getString("options.cert.error.wrongpasswordlast"), attempts},
							Constant.messages.getString("options.cert.label.client.cert"), JOptionPane.ERROR_MESSAGE);
					logger.warn("PKCS#11: Incorrect PIN or password"+attempts+": "+name+" *LAST TRY BEFORE BLOCKING*");
				} else { 
					JOptionPane.showMessageDialog(null, new String[] {
							Constant.messages.getString("options.cert.error"),
							Constant.messages.getString("options.cert.error.wrongpassword"), attempts}, 
							Constant.messages.getString("options.cert.label.client.cert"), JOptionPane.ERROR_MESSAGE);
					logger.warn("PKCS#11: Incorrect PIN or password"+attempts+": "+name);
				}
			}else{
				logAndShowGenericErrorMessagePkcs11CouldNotBeAdded(false, name, e);
			}
		} catch (KeyStoreException e) {
			logAndShowGenericErrorMessagePkcs11CouldNotBeAdded(false, name, e);
		} catch (Exception e) {
			logAndShowGenericErrorMessagePkcs11CouldNotBeAdded(true, name, e);
		}


	}
931401
private void cmdAttachPrefixActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_buttonAdvancedPropertiesActionPerformed
		SelectPrefixPanel dialog = new SelectPrefixPanel(apic.getMutablePrefixManager(), queryTextPane);
		dialog.show();
	}
890601
private void resetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetButtonActionPerformed
        properties = new Hashtable<String,Object>();
        lookAndFeelComboBox.setSelectedItem(this.getDefaultText());
        sizeComboBox.setSelectedItem(this.getDefaultText());
        fontComboBox.setSelectedItem(this.getDefaultText());
        themeComboBox.setSelectedItem(this.getDefaultText());

        ScreenUtil.updateLookAndFeel(this, null, properties);
        this.setSampleStyle();
    }
642907
private void buttonOpenShortcutEditorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenShortcutEditorActionPerformed
    final List<KeyShortcut> list = new ArrayList<KeyShortcut>();
    for (final Map.Entry<String, KeyShortcut> e : this.mapKeyShortCuts.entrySet()) {
      list.add(e.getValue());
    }
    final KeyShortCutEditPanel panel = new KeyShortCutEditPanel(list);
    if (NbUtils.plainMessageOkCancel(null, "Edit shortcuts", panel)) {
      for (final KeyShortcut s : panel.getResult()) {
        this.mapKeyShortCuts.put(s.getID(), s);
      }
      this.controller.changed();
    }
  }
845947
private void jButtonAceptGnuPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAceptGnuPActionPerformed

        if (!this.jTextFieldResultPath.getText().equals("")) {
            String outPath = getDirectory("open", JFileChooser.DIRECTORIES_ONLY);
            if(!outPath.equals("")){
                
            File resultFile = new File(this.jTextFieldResultPath.getText());
            String resultDirectory = resultFile.getAbsolutePath();
            String gnuPlotPath = this.jTextFieldGNUPath.getText();
            String gnuplotScriptPath = null;
            File gnuplotDir = new File(gnuPlotPath);
            if (!gnuplotDir.exists()) {
                JOptionPane.showMessageDialog(this, "Gnuplot directory not found: " + gnuPlotPath, "Error", JOptionPane.ERROR_MESSAGE);
                return;
            }
            String algShortName[] = new String[this.jTableAlgoritms.getRowCount()];
            String algName[] = new String[this.jTableAlgoritms.getRowCount()];
            for (int i = 0; i < this.jTableStreams.getRowCount(); i++) {
                String streamName = this.jTableStreams.getModel().getValueAt(i, 0).toString();
                String streamShortName = this.jTableStreams.getModel().getValueAt(i, 1).toString();
                for (int j = 0; j < this.jTableAlgoritms.getRowCount(); j++) {
                    algName[j] = this.jTableAlgoritms.getModel().getValueAt(j, 0).toString();
                    algShortName[j] = this.jTableAlgoritms.getModel().getValueAt(j, 1).toString();
                    File inputFile = new File(FilenameUtils.separatorsToSystem(
                            this.path + "\\" + streamName + "\\" + algName[j]));

                    if (!inputFile.exists()) {
                        JOptionPane.showMessageDialog(this, "File not found: "
                                + inputFile.getAbsolutePath(),
                                "Error", JOptionPane.ERROR_MESSAGE);
                        return;
                    }

                }

                gnuplotScriptPath = resultDirectory + File.separator
                        + resultFile.getName() + ".plt";
                String script = createScript(streamName, algName, algShortName, outPath);
                File scriptFile = writeScriptToFile(gnuplotScriptPath, script);
                String gnuplotCommand = gnuPlotPath + File.separator + "gnuplot \""
                        + gnuplotScriptPath + "\"";
                String line, gnuplotOutput = "";
                try {
                    Process p = Runtime.getRuntime().exec(gnuplotCommand);

                    BufferedReader err = new BufferedReader(new InputStreamReader(p
                            .getErrorStream()));
                    while ((line = err.readLine()) != null) {
                        gnuplotOutput += line + System.getProperty("line.separator");
                    }
                    err.close();
                } catch (IOException ex) {
                    JOptionPane.showMessageDialog(this, "Error while executing gnuplot script",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    throw new RuntimeException("Error while executing gnuplot script:"
                            + scriptFile, ex);

                }
                if (this.jCheckBoxDeleteScript.isSelected()) {
                    scriptFile.delete();
                }
            }

            //Completed
            JOptionPane.showMessageDialog(this, "Figures created at " + (new File(resultFile.getAbsolutePath())).getParent(),
                    "", JOptionPane.INFORMATION_MESSAGE);
        }
        } else {
            JOptionPane.showMessageDialog(this, "Plot output file option not set!",
                    "Error", JOptionPane.ERROR_MESSAGE);
        }

    }
224830
private void menuEditCopyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuEditCopyActionPerformed
    final TabTitle title = this.getFocusedTab();
    if (title != null && title.getProvider().doesSupportCutCopyPaste()) {
      title.getProvider().doCopy();
    }
    updateMenuItemsForProvider(title == null ? null : title.getProvider());
  }
206052
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
        feedback = UserFeedback.Ok;
        synchronized (WAITER_LOCK) {
            okButton.setEnabled(false);
            cancelButton.setEnabled(false);
            WAITER_LOCK.notifyAll();
        }
    }
762790
private void cmdCancelOperationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdCancelOperationActionPerformed
		try {
			monitor.cancel();
		} 
		catch (Exception e) {
            OptionPaneUtils.showPrettyMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
		}
	}
956694
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
        // Save the current barcode
        JFileChooser fileChooser = new JFileChooser();
        if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
            File file = fileChooser.getSelectedFile();
            SaveSymbol saveSymbol = new SaveSymbol();

            saveSymbol.removeAll();

            saveSymbol.setSize(saveSymbol.getPreferredSize());
            saveSymbol.setBorder(BorderFactory.createEmptyBorder());
            saveSymbol.setBackground(paperColour);
            try {
                SaveImage saveImage = new SaveImage();
                saveImage.save(file, saveSymbol);
            } catch (IOException e) {
                System.out.println("Cannot write to file " + fileChooser.getSelectedFile().toString() + ": " + e.getMessage());
            }
        }
    }
326672
private void _saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__saveActionPerformed
        JFileChooser fc = new JFileChooser(new File("R.log"));
        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION && fc.getSelectedFile() != null) {
            FileOutputStream os = null;
            try {
                os = new FileOutputStream(fc.getSelectedFile());
                os.write(jTextPane1.getText().getBytes());
                os.flush();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    os.close();
                } catch (Exception ee) {
                    ee.printStackTrace();
                }
            }
        }
}
161414
private void colorChooserPaperColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_colorChooserPaperColorActionPerformed
    if (this.colorChooserPaperColor.isLastOkPressed() && changeNotificationAllowed) {
      this.controller.changed();
    }
  }
501700
private void buttonExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExportActionPerformed
    final File toSave = DialogProviderManager.getInstance().getDialogProvider().msgSaveFileDialog(null, "note-editor", UiUtils.BUNDLE.getString("PlainTextEditor.buttonSaveActionPerformed.saveTitle"), null, true, TEXT_FILE_FILTER, "Save"); //NOI18N
    if (toSave != null) {
      try {
        final String text = getText();
        FileUtils.writeStringToFile(toSave, text, "UTF-8"); //NOI18N
      } catch (Exception ex) {
        LOGGER.error("Error during text file saving", ex); //NOI18N
        DialogProviderManager.getInstance().getDialogProvider().msgError(Main.getApplicationFrame(), UiUtils.BUNDLE.getString("PlainTextEditor.buttonSaveActionPerformed.msgError"));
      }
    }

  }
605293
private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        char[] rgchPassword = passwordField.getPassword();
        char[] rgchRePassword = rePasswordField.getPassword();
        if (new String(rgchPassword).length() > 0)
        	if (!new String(rgchPassword).equalsIgnoreCase(new String(rgchRePassword)))
        	{
        		userMessage.setText("Passwords do not match - try again");
        		return;		// Try again
        	}
        loginDialog.setPassword(new String(rgchPassword));
        loginDialog.setUserName(userField.getText());
        loginDialog.setSaveInfo(saveInfoCheckbox.isSelected());
        returnStatus = LoginDialog.NEW_USER_OPTION;
        
        doClose(LoginDialog.NEW_USER_OPTION);
    }
739107
private void buttonExportSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExportSettingsActionPerformed
        StringBuffer sb = new StringBuffer();
        sb.append(clusteringAlgoPanel0.getStreamValueAsCLIString()+"\n");
        sb.append(clusteringAlgoPanel0.getAlgorithm0ValueAsCLIString()+"\n");
        sb.append(clusteringAlgoPanel0.getAlgorithm1ValueAsCLIString()+"\n");
        
        System.out.println(sb);
        logPanel.addText(sb.toString());
        
    }
88255
private void cmdCancelActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cmdCancelActionPerformed
		parent.setVisible(false);
		parent.dispose();
		releaseResultset();
	}
1184847
private void finshButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_finshButtonActionPerformed
        if (parentGUI != null) {
            parentGUI.setSourceDirecs(foundModel);
        }
        if (discover != null && discover.isAlive()) {
            discover.stop();
        }
        dispose();
    }
435099
private void buttonAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAboutActionPerformed
    NbUtils.plainMessageOk(null, java.util.ResourceBundle.getBundle("com/igormaznitsa/nbmindmap/i18n/Bundle").getString("MMDCfgPanel.buttonAbout.Text"), new AboutPanel());
  }