/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user changed the service filter option if (e.getSource() == service_box) { service_list.setEnabled(service_box.isSelected()); service_list.clearSelection(); remove_service_button.setEnabled(false); add_service_field.setEnabled(service_box.isSelected()); add_service_field.setText(""); add_service_button.setEnabled(false); } // Check if the user pressed the add service button if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) { String text = add_service_field.getText(); if ((text != null) && (text.length() > 0)) { service_data.addElement(text); service_list.setListData(service_data); } add_service_field.setText(""); add_service_field.requestFocus(); } // Check if the user pressed the remove service button if (e.getSource() == remove_service_button) { Object[] sels = service_list.getSelectedValues(); for (int i = 0; i < sels.length; i++) { service_data.removeElement(sels[i]); } service_list.setListData(service_data); service_list.clearSelection(); } }
// TODO use annotation to create a guiwrapper so isModified could be simplified public void applyConfigurationData( JenkinsAppSettings jenkinsAppSettings, JenkinsSettings jenkinsSettings) throws ConfigurationException { formValidator.validate(); if (!StringUtils.equals(jenkinsAppSettings.getServerUrl(), serverUrl.getText())) { jenkinsSettings.getFavoriteJobs().clear(); jenkinsSettings.setLastSelectedView(null); } jenkinsAppSettings.setServerUrl(serverUrl.getText()); jenkinsAppSettings.setDelay(getBuildDelay()); jenkinsAppSettings.setJobRefreshPeriod(getJobRefreshPeriod()); jenkinsAppSettings.setRssRefreshPeriod(getRssRefreshPeriod()); jenkinsSettings.setCrumbData(crumbDataField.getText()); jenkinsAppSettings.setIgnoreSuccessOrStable(successOrStableCheckBox.isSelected()); jenkinsAppSettings.setDisplayUnstableOrFail(unstableOrFailCheckBox.isSelected()); jenkinsAppSettings.setDisplayAborted(abortedCheckBox.isSelected()); jenkinsAppSettings.setSuffix(replaceWithSuffix.getText()); if (StringUtils.isNotBlank(username.getText())) { jenkinsSettings.setUsername(username.getText()); } else { jenkinsSettings.setUsername(""); } if (isPasswordModified()) { jenkinsSettings.setPassword(getPassword()); resetPasswordModification(); } }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == imageView) { selectedView = imageView.getSelectedIndex(); owner.viewUpdated(); } else if (e.getSource() == showCorners) { bShowCorners = showCorners.isSelected(); owner.viewUpdated(); } else if (e.getSource() == showLines) { bShowLines = showLines.isSelected(); owner.viewUpdated(); } else if (e.getSource() == showContour) { bShowContour = showContour.isSelected(); owner.viewUpdated(); } else if (e.getSource() == refineChoice) { refineType = PolygonRefineType.values()[refineChoice.getSelectedIndex()]; updateRefineSettings(); owner.configUpdate(); } else if (e.getSource() == setConvex) { config.convex = setConvex.isSelected(); owner.configUpdate(); } else if (e.getSource() == setBorder) { config.convex = setBorder.isSelected(); owner.configUpdate(); } }
/** * The ActionListener implementation * * @param event the event. */ public void actionPerformed(ActionEvent event) { String searchText = textField.getText().trim(); if (searchText.equals("") && !saveAs.isSelected() && (fileLength > 10000000)) { textPane.setText("Blank search text is not allowed for large IdTables."); } else { File outputFile = null; if (saveAs.isSelected()) { outputFile = chooser.getSelectedFile(); if (outputFile != null) { String name = outputFile.getName(); int k = name.lastIndexOf("."); if (k != -1) name = name.substring(0, k); name += ".txt"; File parent = outputFile.getAbsoluteFile().getParentFile(); outputFile = new File(parent, name); chooser.setSelectedFile(outputFile); } if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) System.exit(0); outputFile = chooser.getSelectedFile(); } textPane.setText(""); Searcher searcher = new Searcher(searchText, event.getSource().equals(searchPHI), outputFile); searcher.start(); } }
/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user pressed the ok button if (e.getSource() == ok_button) { filter_include_list = include_panel.getServiceList(); filter_exclude_list = exclude_panel.getServiceList(); if (status_box.isSelected()) { filter_active = status_active.isSelected(); filter_complete = status_complete.isSelected(); } else { filter_active = false; filter_complete = false; } ok_pressed = true; dialog.dispose(); } // Check if the user pressed the cancel button if (e.getSource() == cancel_button) { dialog.dispose(); } // Check if the user changed the status filter option if (e.getSource() == status_box) { status_active.setEnabled(status_box.isSelected()); status_complete.setEnabled(status_box.isSelected()); } }
public boolean isModified() { boolean isModified = false; HttpConfigurable httpConfigurable = myHttpConfigurable; if (!Comparing.equal(myProxyExceptions.getText().trim(), httpConfigurable.PROXY_EXCEPTIONS)) return true; isModified |= httpConfigurable.USE_PROXY_PAC != myAutoDetectProxyRb.isSelected(); isModified |= httpConfigurable.USE_PAC_URL != myPacUrlCheckBox.isSelected(); isModified |= !Comparing.strEqual(httpConfigurable.PAC_URL, myPacUrlTextField.getText()); isModified |= httpConfigurable.USE_HTTP_PROXY != myUseHTTPProxyRb.isSelected(); isModified |= httpConfigurable.PROXY_AUTHENTICATION != myProxyAuthCheckBox.isSelected(); isModified |= httpConfigurable.KEEP_PROXY_PASSWORD != myRememberProxyPasswordCheckBox.isSelected(); isModified |= httpConfigurable.PROXY_TYPE_IS_SOCKS != mySocks.isSelected(); isModified |= !Comparing.strEqual(httpConfigurable.PROXY_LOGIN, myProxyLoginTextField.getText()); isModified |= !Comparing.strEqual( httpConfigurable.getPlainProxyPassword(), new String(myProxyPasswordTextField.getPassword())); try { isModified |= httpConfigurable.PROXY_PORT != Integer.valueOf(myProxyPortTextField.getText()).intValue(); } catch (NumberFormatException e) { isModified = true; } isModified |= !Comparing.strEqual(httpConfigurable.PROXY_HOST, myProxyHostTextField.getText()); return isModified; }
// counts up the score of the user. @SuppressWarnings("unchecked") public int scoreCounter() { if (b1.isSelected()) { score1++; } else if (c1.isSelected()) { score1++; } else if (d1.isSelected()) { score1++; } else if (e1.isSelected()) { score1++; } else if (f1.isSelected()) { score1++; } else if (g1.isSelected()) { score1++; } else if (h1.isSelected()) { score1++; } else if (i1.isSelected()) { score1++; } else if (j1.isSelected()) { score1++; } else if (k1.isSelected()) { score1++; } System.out.println(score1); return score1; }
/* * Gets the user choice for font, style and size and redraws the text * accordingly. */ public void setSampleFont() { // Get the font name from the JComboBox fontName = (String) facenameCombo.getSelectedItem(); sampleField.setText(textField.getText()); // Get the font style from the JCheckBoxes fontStyle = 0; if (italicCheckBox.isSelected()) fontStyle += Font.ITALIC; if (boldCheckBox.isSelected()) fontStyle += Font.BOLD; // Get the font size fontSize = 0; fontSize = Integer.parseInt((String) sizeCombo.getSelectedItem()); // THE FOLLOWING IS NO LONGER NEEDED // if(smallButton.isSelected()) // fontSize=SMALL; // else if(mediumButton.isSelected()) // fontSize=MEDIUM; // else if(largeButton.isSelected()) // fontSize=LARGE; // Set the font of the text field sampleField.setFont(new Font(fontName, fontStyle, fontSize)); sampleField.setForeground(fontColor); sampleField.repaint(); pack(); } // end setSampleFont method
@Override public void apply(@NotNull HttpConfigurable settings) { if (!isValid()) { return; } if (isModified(settings)) { settings.AUTHENTICATION_CANCELLED = false; } settings.USE_PROXY_PAC = myAutoDetectProxyRb.isSelected(); settings.USE_PAC_URL = myPacUrlCheckBox.isSelected(); settings.PAC_URL = getText(myPacUrlTextField); settings.USE_HTTP_PROXY = myUseHTTPProxyRb.isSelected(); settings.PROXY_TYPE_IS_SOCKS = mySocks.isSelected(); settings.PROXY_AUTHENTICATION = myProxyAuthCheckBox.isSelected(); settings.KEEP_PROXY_PASSWORD = myRememberProxyPasswordCheckBox.isSelected(); settings.setProxyLogin(getText(myProxyLoginTextField)); settings.setPlainProxyPassword(new String(myProxyPasswordTextField.getPassword())); settings.PROXY_EXCEPTIONS = StringUtil.nullize(myProxyExceptions.getText(), true); settings.PROXY_PORT = myProxyPortTextField.getNumber(); settings.PROXY_HOST = getText(myProxyHostTextField); }
private void updateControls() { if (myCbReplaceWrite != null) { if (myCbReplaceAll.isSelected()) { myCbReplaceWrite.makeSelectable(); } else { myCbReplaceWrite.makeUnselectable(true); } } if (myCbReplaceAll != null) { myTypeSelectorManager.setAllOccurrences(myCbReplaceAll.isSelected()); } else { myTypeSelectorManager.setAllOccurrences(false); } if (myDeclareFinalIfAll && myCbReplaceAll != null && myCbReplaceAll.isSelected()) { myCbFinal.setEnabled(false); myCbFinal.setSelected(true); } else if (myCbReplaceWrite != null && myCbReplaceWrite.isEnabled() && myCbReplaceWrite.isSelected()) { myCbFinal.setEnabled(false); myCbFinal.setSelected(false); } else { myCbFinal.setEnabled(true); myCbFinal.setSelected(myCbFinalState); } }
public void apply(CodeStyleSettings settings) { stopTableEditing(); settings.LAYOUT_STATIC_IMPORTS_SEPARATELY = myImportLayoutPanel.areStaticImportsEnabled(); settings.USE_FQ_CLASS_NAMES = myCbUseFQClassNames.isSelected(); settings.USE_SINGLE_CLASS_IMPORTS = myCbUseSingleClassImports.isSelected(); settings.INSERT_INNER_CLASS_IMPORTS = myCbInsertInnerClassImports.isSelected(); try { settings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = Integer.parseInt(myClassCountField.getText()); } catch (NumberFormatException e) { // just a bad number } try { settings.NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND = Integer.parseInt(myNamesCountField.getText()); } catch (NumberFormatException e) { // just a bad number } final PackageEntryTable list = myImportLayoutPanel.getImportLayoutList(); list.removeEmptyPackages(); settings.IMPORT_LAYOUT_TABLE.copyFrom(list); myPackageList.removeEmptyPackages(); settings.PACKAGES_TO_USE_IMPORT_ON_DEMAND.copyFrom(myPackageList); myFqnInJavadocOption.apply(settings); }
public void actionPerformed(ActionEvent ae) { String cname = nameF.getText().trim(); int state = conditions[stateC.getSelectedIndex()]; try { if (isSpecialCase(cname)) { handleSpecialCase(cname, state); } else { JComponent comp = (JComponent) Class.forName(cname).newInstance(); ComponentUI cui = UIManager.getUI(comp); cui.installUI(comp); results.setText("Map entries for " + cname + ":\n\n"); if (inputB.isSelected()) { loadInputMap(comp.getInputMap(state), ""); results.append("\n"); } if (actionB.isSelected()) { loadActionMap(comp.getActionMap(), ""); results.append("\n"); } if (bindingB.isSelected()) { loadBindingMap(comp, state); } } } catch (ClassCastException cce) { results.setText(cname + " is not a subclass of JComponent."); } catch (ClassNotFoundException cnfe) { results.setText(cname + " was not found."); } catch (InstantiationException ie) { results.setText(cname + " could not be instantiated."); } catch (Exception e) { results.setText("Exception found:\n" + e); e.printStackTrace(); } }
@Override public void onExit() { // save all painters for (EntryListPanel panel : listPanelSet) { myjava.gui.syntax.Painter painter = panel.getPainter(); if (!painter.equals(myjava.gui.syntax.Painter.getDefaultInstance())) { myjava.gui.syntax.Painter.add(painter); setConfig("painter.userDefined." + painter.getName(), painter.toWritableString()); } if (painter.equals(painterComboBox.getSelectedItem())) { // selected painter setConfig("syntax.selectedPainter", painter.getName()); myjava.gui.syntax.Painter.setCurrentInstance(painter); } } // remove "removed painters" for (myjava.gui.syntax.Painter removed : removedPainters) { removeConfig0("painter.userDefined." + removed.getName()); myjava.gui.syntax.Painter.remove(removed); } // highlight? boolean _highlightSyntax = highlightSyntax.isSelected(); boolean _matchBracket = matchBracket.isSelected(); MyUmbrellaLayerUI.setHighlightingStatus(_highlightSyntax, _matchBracket); setConfig("syntax.highlight", _highlightSyntax + ""); setConfig("syntax.matchBrackets", _matchBracket + ""); }
/* * Checks if the preferences have changed from the cached preferences. */ private boolean prefsChanged() { return (prefs.getResolution() != resolution.getSelectedItem()) || (prefs.getFullscreen() != fullscreen.isSelected()) || (prefs.getBitrate() != bitrate.getValue()) || (prefs.getUseOpenGlRenderer() != openGlRenderer.isSelected()) || (prefs.getLocalAudio() != localAudio.isSelected()); }
/* * Writes the preferences to the disk. */ private void writePreferences() { prefs.setFullscreen(fullscreen.isSelected()); prefs.setBitrate(bitrate.getValue()); prefs.setResolution((Resolution) resolution.getSelectedItem()); prefs.setUseOpenGlRenderer(openGlRenderer.isSelected()); prefs.setLocalAudio(localAudio.isSelected()); PreferencesManager.writePreferences(prefs); }
private void prepocitej() { filex = new Filex( new File(jtext.getText()), jRelativneKProgramu.isSelected(), jActive.isSelected()); jCurrVal.setText(filex.getEffectiveFile().getPath()); jtext.setEnabled(jActive.isSelected()); jRelativneKProgramu.setEnabled(jActive.isSelected()); }
private void updateSoftWrapSettingsRepresentation() { boolean softWrapsEnabled = myCbUseSoftWrapsAtEditor.isSelected(); myCbUseCustomSoftWrapIndent.setEnabled(softWrapsEnabled); myCustomSoftWrapIndent.setEnabled( myCbUseCustomSoftWrapIndent.isEnabled() && myCbUseCustomSoftWrapIndent.isSelected()); myCustomSoftWrapIndentLabel.setEnabled(myCustomSoftWrapIndent.isEnabled()); myCbShowSoftWrapsOnlyOnCaretLine.setEnabled(softWrapsEnabled); }
@Override public void process() { // put all the edits together CompoundEdit edit = new CompoundEdit(); boolean removeAnnotation = removeMatched.isSelected(); Pattern pattern = caseInsensitive.isSelected() ? Pattern.compile(patternField.getText(), Pattern.CASE_INSENSITIVE) : Pattern.compile(patternField.getText()); BasicPatternMatcher<Note> matcher = new BasicPatternMatcher<Note>(Note.class, pattern); Annotation target = (Annotation) annotationComboBox.getSelectedItem(); List<Annotation> createdAnnotations = new ArrayList<Annotation>(); List<Annotation> removedAnnotations = new ArrayList<Annotation>(); for (AnnotatedEntity entity : getSelectionController().getSelection().getEntities()) { for (Annotation annotation : entity.getAnnotations()) { String matched = annotation.accept(matcher); if (!matched.isEmpty()) { if (target instanceof StringAnnotation) { createdAnnotations.add(((StringAnnotation) target).getInstance(matched)); if (removeAnnotation) { removedAnnotations.add(annotation); } } else if (target.getClass().equals(Charge.class)) { Charge charge = (Charge) target.newInstance(); charge.setValue(Double.parseDouble(matched)); createdAnnotations.add(charge); if (removeAnnotation) { removedAnnotations.add(annotation); } } } } edit.addEdit(new AddAnnotationEdit(entity, createdAnnotations)); for (Annotation a : removedAnnotations) { edit.addEdit(new RemoveAnnotationEdit(entity, a)); entity.removeAnnotation(a); } entity.addAnnotations(createdAnnotations); createdAnnotations.clear(); removedAnnotations.clear(); } // inform the compound edit that we've finished editing edit.end(); addEdit(edit); }
private void updateOtherFileNames(BeautiOptions options) { if (options.fileNameStem != null) { // fileNameStemField.setText(options.fileNameStem); options.logFileName = options.fileNameStem + ".log"; if (addTxt.isSelected()) options.logFileName = options.logFileName + ".txt"; logFileNameField.setText(options.logFileName); // if (options.mapTreeFileName == null) { // mapTreeFileNameField.setText(options.fileNameStem + ".MAP.tree"); // } else { // mapTreeFileNameField.setText(options.mapTreeFileName); // } updateTreeFileNameList(); treeFileNameField.setText(displayTreeList(options.treeFileName)); if (options.substTreeLog) { substTreeFileNameField.setText(displayTreeList(options.substTreeFileName)); } else { substTreeFileNameField.setText(""); } options.operatorAnalysisFileName = options.fileNameStem + ".ops"; if (addTxt.isSelected()) { options.operatorAnalysisFileName = options.operatorAnalysisFileName + ".txt"; } operatorAnalaysisFileNameField.setEnabled(options.operatorAnalysis); if (options.operatorAnalysis) { operatorAnalaysisFileNameField.setText(options.operatorAnalysisFileName); } else { operatorAnalaysisFileNameField.setText(""); } // mapTreeLogCheck.setEnabled(true); // mapTreeLogCheck.setSelected(options.mapTreeLog); // mapTreeFileNameField.setEnabled(options.mapTreeLog); substTreeLogCheck.setEnabled(true); substTreeLogCheck.setSelected(options.substTreeLog); } else { // fileNameStemField.setText(fileNameStem); // fileNameStemField.setEnabled(false); logFileNameField.setText(DEFAULT_FILE_NAME_STEM + ".log"); treeFileNameField.setText(DEFAULT_FILE_NAME_STEM + "." + STARBEASTOptions.TREE_FILE_NAME); // mapTreeLogCheck.setEnabled(false); // mapTreeFileNameField.setEnabled(false); // mapTreeFileNameField.setText("untitled"); substTreeLogCheck.setSelected(false); substTreeFileNameField.setEnabled(false); substTreeFileNameField.setText(""); operatorAnalaysisCheck.setSelected(false); operatorAnalaysisFileNameField.setText(""); } }
public boolean isModified() { boolean modified; modified = myEnabledCheckBox.isSelected() != myManager.isEnabled(); modified |= myTabsEnabledCheckBox.isSelected() != myManager.isEnabledForTabs(); modified |= myProjectViewEnabledCheckBox.isSelected() != myManager.isEnabledForProjectView(); modified |= myLocalTable.isModified() || mySharedTable.isModified(); return modified; }
/** * getToppingCost method * * @return The cost of the selected toppings. */ public double getToppingCost() { double toppingCost = 0.0; if (creamCheese.isSelected()) toppingCost += CREAM_CHEESE; if (butter.isSelected()) toppingCost += BUTTER; if (peachJelly.isSelected()) toppingCost += PEACH_JELLY; if (blueberryJam.isSelected()) toppingCost += BLUEBERRY_JAM; return toppingCost; }
public void apply() { myManager.setEnabled(myEnabledCheckBox.isSelected()); myManager.setEnabledForTabs(myTabsEnabledCheckBox.isSelected()); FileColorManagerImpl.setEnabledForProjectView(myProjectViewEnabledCheckBox.isSelected()); myLocalTable.apply(); mySharedTable.apply(); UISettings.getInstance().fireUISettingsChanged(); }
private void saveSettings() { final JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance(); settings.INTRODUCE_PARAMETER_CREATE_FINALS = myDeclareFinalCheckBox.isSelected(); if (myGetterPanel.isVisible()) { settings.INTRODUCE_PARAMETER_REPLACE_FIELDS_WITH_GETTERS = getReplaceFieldsWithGetter(); } if (myForceReturnCheckBox.isEnabled() && mySignaturePanel.isVisible()) { GroovyApplicationSettings.getInstance().FORCE_RETURN = myForceReturnCheckBox.isSelected(); } }
private boolean areAll(boolean selected) { final Set<Map.Entry<SearchEngine, JCheckBox>> entries = engineCheckboxes.entrySet(); for (Map.Entry<SearchEngine, JCheckBox> entry : entries) { final JCheckBox cBox = entry.getValue(); if (selected && !cBox.isSelected() || !selected && cBox.isSelected()) { return false; } } return true; }
/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user pressed the remove button if (e.getSource() == remove_button) { int row = table.getSelectedRow(); model.removeRow(row); table.clearSelection(); table.repaint(); valueChanged(null); } // Check if the user pressed the remove all button if (e.getSource() == remove_all_button) { model.clearAll(); table.setRowSelectionInterval(0, 0); table.repaint(); valueChanged(null); } // Check if the user pressed the filter button if (e.getSource() == filter_button) { filter.showDialog(); if (filter.okPressed()) { // Update the display with new filter model.setFilter(filter); table.repaint(); } } // Check if the user pressed the start button if (e.getSource() == start_button) { start(); } // Check if the user pressed the stop button if (e.getSource() == stop_button) { stop(); } // Check if the user wants to switch layout if (e.getSource() == layout_button) { details_panel.remove(details_soap); details_soap.removeAll(); if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT); } else { details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); } details_soap.setTopComponent(request_panel); details_soap.setRightComponent(response_panel); details_soap.setResizeWeight(.5); details_panel.add(details_soap, BorderLayout.CENTER); details_panel.validate(); details_panel.repaint(); } // Check if the user is changing the reflow option if (e.getSource() == reflow_xml) { request_text.setReflowXML(reflow_xml.isSelected()); response_text.setReflowXML(reflow_xml.isSelected()); } }
public void saveTo(CvsApplicationLevelConfiguration config) { myPServerSettingsPanel.saveTo(config); String oldEncoding = config.ENCODING; config.ENCODING = myCharset.getSelectedItem().toString(); if (!Comparing.equal(oldEncoding, config.ENCODING)) { CvsEntriesManager.getInstance().encodingChanged(); } config.USE_GZIP = myUseGZIPCompression.isSelected(); config.DO_OUTPUT = myLogOutput.isSelected(); config.SEND_ENVIRONMENT_VARIABLES_TO_SERVER = mySendEnvironment.isSelected(); }
/** Save the settings of this panel */ private void saveSettings() { settings.setValue(SettingsClass.JUNK_HIDE_JUNK_MESSAGES, hideJunkMessagesCheckBox.isSelected()); settings.setValue( SettingsClass.JUNK_MARK_JUNK_IDENTITY_BAD, markJunkIdentityBadCheckBox.isSelected()); settings.setValue( SettingsClass.DOS_STOP_BOARD_UPDATES_WHEN_DOSED, stopBoardUpdatesWhenDosedCheckBox.isSelected()); settings.setValue( SettingsClass.DOS_INVALID_SUBSEQUENT_MSGS_THRESHOLD, TfInvalidSubsequentMessagesThreshold.getText()); }
/** * Saves the user input when the "Next" wizard buttons is clicked. * * @param registration the SIPAccountRegistration * @return */ public boolean commitPanel(SecurityAccountRegistration registration) { registration.setDefaultEncryption(enableDefaultEncryption.isSelected()); registration.setEncryptionProtocols(encryptionConfigurationTableModel.getEncryptionProtocols()); registration.setEncryptionProtocolStatus( encryptionConfigurationTableModel.getEncryptionProtocolStatus()); registration.setSipZrtpAttribute(enableSipZrtpAttribute.isSelected()); registration.setSavpOption(((SavpOption) cboSavpOption.getSelectedItem()).option); registration.setSDesCipherSuites(cipherModel.getEnabledCiphers()); return true; }
private void updateCurrentRule() { if (myLastSelected >= 0 && myLastSelected < myRulesModel.getSize()) { LibraryBundlificationRule newRule = new LibraryBundlificationRule(); newRule.setRuleRegex(myLibraryRegex.getText().trim()); newRule.setAdditionalProperties(myManifestEditor.getText().trim()); newRule.setDoNotBundle(myNeverBundle.isSelected()); newRule.setStopAfterThisRule(myStopAfterThisRule.isSelected()); if (!newRule.equals(myRulesModel.getElementAt(myLastSelected))) { myRulesModel.setElementAt(newRule, myLastSelected); } } }
/** Returns false if Exception is thrown. */ private boolean setDirectory() { String pathStr = dirTF.getText().trim(); if (pathStr.equals("")) pathStr = System.getProperty("user.dir"); try { File dirPath = new File(pathStr); if (!dirPath.isDirectory()) { if (!dirPath.exists()) { if (recursiveCheckBox.isSelected()) throw new NotDirectoryException(dirPath.getAbsolutePath()); else throw new NotFileException(dirPath.getAbsolutePath()); } else { convertSet.setFile(dirPath); convertSet.setDestinationPath(dirPath.getParentFile()); } } else { // Set the descriptors setMatchingFileNames(); FlexFilter flexFilter = new FlexFilter(); flexFilter.addDescriptors(descriptors); flexFilter.setFilesOnly(!recursiveCheckBox.isSelected()); convertSet.setSourcePath(dirPath, flexFilter); convertSet.setDestinationPath(dirPath); } } catch (NotDirectoryException e1) { final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption1"); MessageFormat formatter; String info_msg; if (pathStr.equals("")) { info_msg = ResourceHandler.getMessage("notdirectory_dialog.info5"); } else { formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info0")); info_msg = formatter.format(new Object[] {pathStr}); } final String info = info_msg; JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE); return false; } catch (NotFileException e2) { final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption0"); MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info1")); final String info = formatter.format(new Object[] {pathStr}); JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE); return false; } return true; // no exception thrown }