Index: manifest.mf =================================================================== RCS file: /cvs/utilities/manifest.mf,v --- manifest.mf 7 Aug 2002 11:33:34 -0000 1.39 +++ manifest.mf 3 Oct 2002 09:12:46 -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/META-INF/netbeans/translate.names =================================================================== RCS file: src/META-INF/netbeans/translate.names --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/META-INF/netbeans/translate.names 3 Oct 2002 09:12:46 -0000 @@ -0,0 +1,13 @@ +# 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 2002 Sun +# Microsystems, Inc. All Rights Reserved. + + +org.netbeans.modules.pdf.PDFSettings=org.netbeans.modules.pdf.Settings Index: src/org/netbeans/modules/openfile/Settings.java =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/openfile/Settings.java,v --- src/org/netbeans/modules/openfile/Settings.java 15 Sep 2002 20:23:58 -0000 1.25 +++ src/org/netbeans/modules/openfile/Settings.java 3 Oct 2002 09:12:46 -0000 @@ -106,6 +106,8 @@ /** Gets whether the server is running. If it's not inited yet. Inits it and * in case running on Windows(is running as default on Windows only) starts server. */ public boolean isRunning () { + System.out.println ("pdf.Settings.getDefault(): " + org.netbeans.modules.pdf.Settings.getDefault()); + synchronized(this) { if (!inited) { inited = true; Index: src/org/netbeans/modules/pdf/Bundle.properties =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/pdf/Bundle.properties,v --- src/org/netbeans/modules/pdf/Bundle.properties 7 Nov 2001 14:37:01 -0000 1.9 +++ src/org/netbeans/modules/pdf/Bundle.properties 3 Oct 2002 09:12:46 -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. Index: src/org/netbeans/modules/pdf/PDF.settings =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/pdf/PDF.settings,v --- src/org/netbeans/modules/pdf/PDF.settings 1 Aug 2001 12:46:28 -0000 1.1 +++ src/org/netbeans/modules/pdf/PDF.settings 3 Oct 2002 09:12:46 -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 --- src/org/netbeans/modules/pdf/PDFOpenSupport.java 11 Oct 2000 18:17:44 -0000 1.1 +++ src/org/netbeans/modules/pdf/PDFOpenSupport.java 3 Oct 2002 09:12:47 -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 --- src/org/netbeans/modules/pdf/PDFSettings.java 22 Apr 2002 10:39:38 -0000 1.2 +++ src/org/netbeans/modules/pdf/PDFSettings.java 3 Oct 2002 09:12:47 -0000 @@ -14,13 +14,12 @@ package org.netbeans.modules.pdf; import java.io.File; +import java.io.ObjectStreamException; 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,22 +27,9 @@ 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 () { @@ -53,5 +39,21 @@ public void setPDFViewer (File viewer) { putProperty (PROP_PDF_VIEWER, viewer, true); } + + + /** Delegate old settings to new one. + */ + private synchronized Object readResolve () throws ObjectStreamException { + Settings settings = new Settings(); + + File viewer = this.getPDFViewer(); + if ( viewer != null ) { + settings.setPDFViewer (viewer); + } + + System.out.println ("[old]PDFSettings.readResolve: settings= " + settings); + + return settings; + } } Index: src/org/netbeans/modules/pdf/PDFSettingsBeanInfo.java =================================================================== RCS file: 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 --- src/org/netbeans/modules/pdf/ReconfigureReaderPanel.java 7 Nov 2001 14:37:01 -0000 1.4 +++ src/org/netbeans/modules/pdf/ReconfigureReaderPanel.java 3 Oct 2002 09:12:47 -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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/modules/pdf/Settings.java 3 Oct 2002 09:12:47 -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.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) { + System.out.println ("Settings.addPropertyChangeListener: " + l); + + supp.addPropertyChangeListener (l); + } + + public void removePropertyChangeListener (PropertyChangeListener l) { + System.out.println ("Settings.removePropertyChangeListener: " + l); + + supp.removePropertyChangeListener (l); + } + +} Index: src/org/netbeans/modules/pdf/SettingsBeanInfo.java =================================================================== RCS file: src/org/netbeans/modules/pdf/SettingsBeanInfo.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/modules/pdf/SettingsBeanInfo.java 3 Oct 2002 09:12:47 -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 --- src/org/netbeans/modules/utilities/Layer.xml 26 Jul 2002 10:20:24 -0000 1.39 +++ src/org/netbeans/modules/utilities/Layer.xml 3 Oct 2002 09:12:47 -0000 @@ -161,29 +161,65 @@ - + + + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + +