Index: manifest.mf =================================================================== RCS file: /cvs/utilities/manifest.mf,v retrieving revision 1.39 diff -u -r1.39 manifest.mf --- manifest.mf 7 Aug 2002 11:33:34 -0000 1.39 +++ manifest.mf 25 Sep 2002 08:39:13 -0000 @@ -5,7 +5,9 @@ OpenIDE-Module-Install: org/netbeans/modules/utilities/Installer.class OpenIDE-Module-Layer: org/netbeans/modules/utilities/Layer.xml OpenIDE-Module-IDE-Dependencies: IDE/1 > 2.23 -OpenIDE-Module-Module-Dependencies: org.openidex.util/2 +OpenIDE-Module-Module-Dependencies: + org.openidex.util/2, + org.netbeans.modules.settings/1 > 1.0 OpenIDE-Module-Package-Dependencies: org.apache.regexp[RE] Main-Class: org.netbeans.modules.openfile.Main Index: src/org/netbeans/modules/pdf/Bundle.properties =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/pdf/Bundle.properties,v retrieving revision 1.9 diff -u -r1.9 Bundle.properties --- src/org/netbeans/modules/pdf/Bundle.properties 7 Nov 2001 14:37:01 -0000 1.9 +++ src/org/netbeans/modules/pdf/Bundle.properties 25 Sep 2002 08:39:13 -0000 @@ -12,9 +12,6 @@ # PDFDataLoader LBL_loaderName=PDF Document Objects -# PDFSettings -LBL_settings=PDF Settings - # PDFSettingsBeanInfo PROP_pdfviewer=Path to PDF Viewer HINT_pdfviewer=Should be an executable path to the PDF viewer you wish to use. @@ -39,4 +36,4 @@ ACS_LBL_choose=N/A # filenames -Services/org-netbeans-modules-pdf-PDFSettings.settings=PDF Settings +Services/org-netbeans-modules-pdf-Settings.settings=PDF Settings Index: src/org/netbeans/modules/pdf/PDF.settings =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/pdf/PDF.settings,v retrieving revision 1.1 diff -u -r1.1 PDF.settings --- src/org/netbeans/modules/pdf/PDF.settings 1 Aug 2001 12:46:28 -0000 1.1 +++ src/org/netbeans/modules/pdf/PDF.settings 25 Sep 2002 08:39:13 -0000 @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + Index: src/org/netbeans/modules/pdf/PDFOpenSupport.java =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/pdf/PDFOpenSupport.java,v retrieving revision 1.1 diff -u -r1.1 PDFOpenSupport.java --- src/org/netbeans/modules/pdf/PDFOpenSupport.java 11 Oct 2000 18:17:44 -0000 1.1 +++ src/org/netbeans/modules/pdf/PDFOpenSupport.java 25 Sep 2002 08:39:13 -0000 @@ -41,7 +41,7 @@ } public void open () { - PDFSettings sett = PDFSettings.getDefault (); + Settings sett = Settings.getDefault (); try { Process p = Runtime.getRuntime ().exec (new String[] { sett.getPDFViewer ().getAbsolutePath (), f.getAbsolutePath () Index: src/org/netbeans/modules/pdf/PDFSettings.java =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/pdf/PDFSettings.java,v retrieving revision 1.2 diff -u -r1.2 PDFSettings.java --- src/org/netbeans/modules/pdf/PDFSettings.java 22 Apr 2002 10:39:38 -0000 1.2 +++ src/org/netbeans/modules/pdf/PDFSettings.java 25 Sep 2002 08:39:13 -0000 @@ -16,11 +16,9 @@ import java.io.File; import org.openide.options.SystemOption; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -/** PDF viewing options. - * @author Jesse Glick +/** + * @deprecated Old settings class, use Settings class instead. */ public class PDFSettings extends SystemOption { @@ -28,25 +26,12 @@ private static final long serialVersionUID = -4792208769849769376L; - protected void initialize () { - super.initialize(); - - setPDFViewer (new File ("acroread")); // NOI18N - } - + /** */ public String displayName () { - return NbBundle.getMessage (PDFSettings.class, "LBL_settings"); - } - - public HelpCtx getHelpCtx () { - return new HelpCtx (PDFSettings.class); - } - - public static PDFSettings getDefault () { - return (PDFSettings) findObject (PDFSettings.class, true); + return "Old PDF Settings"; //NOI18N } - public File getPDFViewer () { + private File getPDFViewer () { return (File) getProperty (PROP_PDF_VIEWER); } Index: src/org/netbeans/modules/pdf/PDFSettingsBeanInfo.java =================================================================== RCS file: src/org/netbeans/modules/pdf/PDFSettingsBeanInfo.java diff -N src/org/netbeans/modules/pdf/PDFSettingsBeanInfo.java --- src/org/netbeans/modules/pdf/PDFSettingsBeanInfo.java 30 Aug 2001 15:15:58 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,76 +0,0 @@ -/* - * Sun Public License Notice - * - * The contents of this file are subject to the Sun Public License - * Version 1.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://www.sun.com/ - * - * The Original Code is NetBeans. The Initial Developer of the Original - * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun - * Microsystems, Inc. All Rights Reserved. - */ - - -package org.netbeans.modules.pdf; - - -import java.awt.Image; -import java.beans.BeanInfo; -import java.beans.BeanDescriptor; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; - -import org.openide.TopManager; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - - -/** BeanInfo for PDF viewer settings. - * - * @author Jesse Glick - */ -public class PDFSettingsBeanInfo extends SimpleBeanInfo { - - /** Gets property descriptors. */ - public PropertyDescriptor[] getPropertyDescriptors () { - try { - PropertyDescriptor pdfviewer = new PropertyDescriptor ("PDFViewer", PDFSettings.class); - pdfviewer.setDisplayName (NbBundle.getMessage (PDFSettingsBeanInfo.class, "PROP_pdfviewer")); - pdfviewer.setShortDescription (NbBundle.getMessage (PDFSettingsBeanInfo.class, "HINT_pdfviewer")); - return new PropertyDescriptor[] { pdfviewer }; - } catch (IntrospectionException ie) { - TopManager.getDefault().getErrorManager().notify(ie); - - return null; - } - } - - /** Gets the bean descriptor, hiding it. - * Users probably do not want to change this setting - * except once, which is why they are prompted to set it - * if their current setting does not work. - * - * Note: The above is changed now due to bug #12015, - * maybe that's not the right way since there - * is a need to have less options than now. - * - * @return descriptor - */ - public BeanDescriptor getBeanDescriptor () { - BeanDescriptor desc = new BeanDescriptor (PDFSettings.class); - - return desc; - } - - /** Gets icon. */ - public Image getIcon (int type) { - if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { - return Utilities.loadImage("org/netbeans/modules/pdf/PDFDataIcon.gif"); // NOI18N - } else { - return Utilities.loadImage("org/netbeans/modules/pdf/PDFDataIcon32.gif"); // NOI18N - } - } - -} Index: src/org/netbeans/modules/pdf/ReconfigureReaderPanel.java =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/pdf/ReconfigureReaderPanel.java,v retrieving revision 1.4 diff -u -r1.4 ReconfigureReaderPanel.java --- src/org/netbeans/modules/pdf/ReconfigureReaderPanel.java 7 Nov 2001 14:37:01 -0000 1.4 +++ src/org/netbeans/modules/pdf/ReconfigureReaderPanel.java 25 Sep 2002 08:39:13 -0000 @@ -26,13 +26,13 @@ public class ReconfigureReaderPanel extends javax.swing.JPanel { private String exceptionType, exceptionMessage; - private PDFSettings settings; + private Settings settings; private ResourceBundle bundle = NbBundle.getBundle (ReconfigureReaderPanel.class); public ReconfigureReaderPanel (String exceptionType, String exceptionMessage) { this.exceptionType = exceptionType; this.exceptionMessage = exceptionMessage; - settings = PDFSettings.getDefault (); + settings = Settings.getDefault (); initComponents (); initAccessibility (); } Index: src/org/netbeans/modules/pdf/Settings.java =================================================================== RCS file: src/org/netbeans/modules/pdf/Settings.java diff -N src/org/netbeans/modules/pdf/Settings.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/modules/pdf/Settings.java 25 Sep 2002 08:39:13 -0000 @@ -0,0 +1,72 @@ +/* + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License + * Version 1.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.sun.com/ + * + * The Original Code is NetBeans. The Initial Developer of the Original + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun + * Microsystems, Inc. All Rights Reserved. + */ +package org.netbeans.modules.pdf; + +import java.io.File; +import java.util.Properties; +import java.beans.PropertyChangeSupport; +import java.beans.PropertyChangeListener; + +import org.openide.util.Lookup; + + +/** New PDF settings. + * + * @author Libor Kramolis + */ +public class Settings { + public static final String PROP_PDF_VIEWER = "PDFViewer"; // NOI18N + private File viewer = new File ("acroread"); + private PropertyChangeSupport supp = new PropertyChangeSupport (this); + + + public static Settings getDefault () { + return (Settings) Lookup.getDefault().lookup (Settings.class); + } + + + public File getPDFViewer () { + return viewer; + } + + public void setPDFViewer (File viewer) { + File old = this.viewer; + this.viewer = viewer; + supp.firePropertyChange (PROP_PDF_VIEWER, old, viewer); + } + + + /** + * @see http://www.netbeans.org/download/dev/javadoc/SettingsAPIs/org/netbeans/spi/settings/doc-files/api.html#xmlprops + */ + private void readProperties (Properties p) { + viewer = new File (p.getProperty (PROP_PDF_VIEWER, viewer.toString())); + } + + /** + * @see http://www.netbeans.org/download/dev/javadoc/SettingsAPIs/org/netbeans/spi/settings/doc-files/api.html#xmlprops + */ + private void writeProperties (Properties p) { + p.setProperty (PROP_PDF_VIEWER, viewer.toString()); + } + + + public void addPropertyChangeListener (PropertyChangeListener l) { + supp.addPropertyChangeListener (l); + } + + public void removePropertyChangeListener (PropertyChangeListener l) { + supp.removePropertyChangeListener (l); + } + +} Index: src/org/netbeans/modules/pdf/SettingsBeanInfo.java =================================================================== RCS file: src/org/netbeans/modules/pdf/SettingsBeanInfo.java diff -N src/org/netbeans/modules/pdf/SettingsBeanInfo.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/modules/pdf/SettingsBeanInfo.java 25 Sep 2002 08:39:13 -0000 @@ -0,0 +1,76 @@ +/* + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License + * Version 1.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.sun.com/ + * + * The Original Code is NetBeans. The Initial Developer of the Original + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + +package org.netbeans.modules.pdf; + + +import java.awt.Image; +import java.beans.BeanInfo; +import java.beans.BeanDescriptor; +import java.beans.IntrospectionException; +import java.beans.PropertyDescriptor; +import java.beans.SimpleBeanInfo; + +import org.openide.TopManager; +import org.openide.util.NbBundle; +import org.openide.util.Utilities; + + +/** BeanInfo for PDF viewer settings. + * + * @author Jesse Glick + */ +public class SettingsBeanInfo extends SimpleBeanInfo { + + /** Gets property descriptors. */ + public PropertyDescriptor[] getPropertyDescriptors () { + try { + PropertyDescriptor pdfviewer = new PropertyDescriptor ("PDFViewer", Settings.class); + pdfviewer.setDisplayName (NbBundle.getMessage (SettingsBeanInfo.class, "PROP_pdfviewer")); + pdfviewer.setShortDescription (NbBundle.getMessage (SettingsBeanInfo.class, "HINT_pdfviewer")); + return new PropertyDescriptor[] { pdfviewer }; + } catch (IntrospectionException ie) { + TopManager.getDefault().getErrorManager().notify(ie); + + return null; + } + } + + /** Gets the bean descriptor, hiding it. + * Users probably do not want to change this setting + * except once, which is why they are prompted to set it + * if their current setting does not work. + * + * Note: The above is changed now due to bug #12015, + * maybe that's not the right way since there + * is a need to have less options than now. + * + * @return descriptor + */ + public BeanDescriptor getBeanDescriptor () { + BeanDescriptor desc = new BeanDescriptor (Settings.class); + + return desc; + } + + /** Gets icon. */ + public Image getIcon (int type) { + if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { + return Utilities.loadImage("org/netbeans/modules/pdf/PDFDataIcon.gif"); // NOI18N + } else { + return Utilities.loadImage("org/netbeans/modules/pdf/PDFDataIcon32.gif"); // NOI18N + } + } + +} Index: src/org/netbeans/modules/utilities/Layer.xml =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/utilities/Layer.xml,v retrieving revision 1.39 diff -u -r1.39 Layer.xml --- src/org/netbeans/modules/utilities/Layer.xml 26 Jul 2002 10:20:24 -0000 1.39 +++ src/org/netbeans/modules/utilities/Layer.xml 25 Sep 2002 08:39:13 -0000 @@ -161,15 +161,50 @@ - + + + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -180,10 +215,11 @@ - + + @@ -235,8 +271,8 @@ - - + +