diff --git a/core.execution/nbproject/project.xml b/core.execution/nbproject/project.xml --- a/core.execution/nbproject/project.xml +++ b/core.execution/nbproject/project.xml @@ -125,6 +125,14 @@ + org.openide.filesystems + + + + 8.0 + + + org.openide.io diff --git a/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbClassPathCustomEditor.java b/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbClassPathCustomEditor.java --- a/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbClassPathCustomEditor.java +++ b/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbClassPathCustomEditor.java @@ -53,8 +53,8 @@ import javax.swing.DefaultListModel; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; -import org.netbeans.beaninfo.editors.FileEditor; import org.openide.execution.NbClassPath; +import org.openide.filesystems.FileChooserBuilder; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.NbCollections; @@ -284,7 +284,7 @@ private void addJarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addJarButtonActionPerformed - JFileChooser chooser = FileEditor.createHackedFileChooser(); + JFileChooser chooser = new FileChooserBuilder(NbClassPathCustomEditor.class).createFileChooser(); chooser.setFileHidingEnabled(false); setHelpToChooser( chooser ); @@ -326,7 +326,7 @@ }//GEN-LAST:event_addJarButtonActionPerformed private void addDirButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addDirButtonActionPerformed - JFileChooser chooser = FileEditor.createHackedFileChooser(); + JFileChooser chooser = new FileChooserBuilder(NbClassPathCustomEditor.class).createFileChooser(); chooser.setFileHidingEnabled(false); setHelpToChooser( chooser ); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); @@ -384,7 +384,7 @@ File selectedF = new File(selectedItem); if (selectedF.isDirectory()) { - JFileChooser chooser = FileEditor.createHackedFileChooser(); + JFileChooser chooser = new FileChooserBuilder(NbClassPathCustomEditor.class).createFileChooser(); setHelpToChooser( chooser ); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setDialogTitle(getString("CTL_Edit_Local_Dialog_Title")); @@ -411,7 +411,7 @@ } } } else if (selectedF.isFile()) { - JFileChooser chooser = FileEditor.createHackedFileChooser(); + JFileChooser chooser = new FileChooserBuilder(NbClassPathCustomEditor.class).createFileChooser(); setHelpToChooser( chooser ); chooser.setFileFilter(new FileFilter() { diff --git a/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbProcessDescriptorCustomEditor.java b/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbProcessDescriptorCustomEditor.java --- a/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbProcessDescriptorCustomEditor.java +++ b/core.execution/src/org/netbeans/core/execution/beaninfo/editors/NbProcessDescriptorCustomEditor.java @@ -52,6 +52,7 @@ import org.openide.execution.NbProcessDescriptor; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.filesystems.FileChooserBuilder; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; @@ -212,7 +213,7 @@ private void jButton1ActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // Add your handling code here: - JFileChooser chooser = org.netbeans.beaninfo.editors.FileEditor.createHackedFileChooser(); + JFileChooser chooser = new FileChooserBuilder(NbProcessDescriptorCustomEditor.class).createFileChooser(); chooser.setMultiSelectionEnabled (false); File init = new File(processField.getText()); // #13372 if (init.isFile()) { diff --git a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.form b/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.form --- a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.form +++ b/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.form @@ -1,4 +1,4 @@ - +
@@ -60,11 +60,13 @@ - - - + + + + + + - diff --git a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.java b/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.java --- a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.java +++ b/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.java @@ -60,14 +60,12 @@ import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import org.netbeans.beaninfo.editors.HtmlBrowser; import org.netbeans.core.ProxySettings; import org.netbeans.spi.options.OptionsPanelController; import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; import org.openide.awt.Mnemonics; import org.openide.util.ImageUtilities; -import org.openide.util.Lookup; import org.openide.util.NbBundle; /** @@ -79,7 +77,7 @@ private boolean changed = false; private GeneralOptionsModel model; - private HtmlBrowser.FactoryEditor editor; + //XXX private HtmlBrowser.FactoryEditor editor; private AdvancedProxyPanel advancedPanel; // private PropertyChangeSupport support = new PropertyChangeSupport(this); private boolean valid = true; @@ -598,6 +596,7 @@ } private void updateWebBrowsers() { + /** XXX: communicate via NbPreferences if (editor == null) { editor = Lookup.getDefault().lookup(HtmlBrowser.FactoryEditor.class); } @@ -619,6 +618,7 @@ editBrowserButton.setVisible(false); jSeparator2.setVisible(false); } + */ } void applyChanges () { @@ -648,12 +648,14 @@ model.setSocksPort (tfProxyPort.getText ()); } + /* XXX: via NbPreferences... // web browser settings if (editor == null) { editor = Lookup.getDefault().lookup(HtmlBrowser.FactoryEditor.class); } editor.setAsText ((String) cbWebBrowser.getSelectedItem ()); - + */ + model.setUsageStatistics(jUsageCheck.isSelected()); } diff --git a/jellytools.platform/nbproject/project.xml b/jellytools.platform/nbproject/project.xml --- a/jellytools.platform/nbproject/project.xml +++ b/jellytools.platform/nbproject/project.xml @@ -23,15 +23,6 @@ - org.netbeans.core - - - - 2 - 3.10 - - - org.netbeans.core.multiview diff --git a/jellytools.platform/src/org/netbeans/jellytools/JellyTestCase.java b/jellytools.platform/src/org/netbeans/jellytools/JellyTestCase.java --- a/jellytools.platform/src/org/netbeans/jellytools/JellyTestCase.java +++ b/jellytools.platform/src/org/netbeans/jellytools/JellyTestCase.java @@ -45,17 +45,13 @@ import java.awt.Component; import java.awt.Window; -import java.beans.PropertyEditor; -import java.beans.PropertyEditorManager; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.lang.reflect.Array; -import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import javax.swing.JDialog; @@ -66,11 +62,10 @@ import org.netbeans.jemmy.EventTool; import org.netbeans.jemmy.JemmyException; import org.netbeans.jemmy.JemmyProperties; -import org.netbeans.jemmy.QueueTool; import org.netbeans.jemmy.TestOut; import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.util.PNGEncoder; import org.netbeans.jemmy.util.Dumper; -import org.netbeans.jemmy.util.PNGEncoder; import org.netbeans.junit.AssertionFailedErrorException; import org.netbeans.junit.NbModuleSuite; import org.netbeans.junit.NbTestCase; @@ -132,39 +127,6 @@ } catch (Exception e) { throw new JemmyException("Initialization of timeouts failed.", e); } - // #210618 - workaround that custom property editors are not properly - // registered when IDE is launched by NbModuleSuite - new QueueTool().invokeSmoothly(new Runnable() { - @Override - public void run() { - try { - PropertyEditor pe = PropertyEditorManager.findEditor(String.class); - if (pe != null && !pe.getClass().getName().equals("sun.beans.editors.StringEditor")) { - // OK - return; - } - // CoreBridgeImpl.editorsRegistered = false; - // CoreBridgeImpl.doRegisterPropertyEditors(); - Class cl = Class.forName("org.netbeans.core.CoreBridgeImpl"); - Field fieldReg = cl.getDeclaredField("editorsRegistered"); - fieldReg.setAccessible(true); - fieldReg.setBoolean(null, false); - Method methodRegisterPE = cl.getDeclaredMethod("doRegisterPropertyEditors"); - methodRegisterPE.setAccessible(true); - methodRegisterPE.invoke(null); - } catch (Exception e) { - throw new JemmyException("Cannot call CoreBridgeImpl.doRegisterPropertyEditors().", e); - } - // Add core.execution property editor search path. - String coreExecutionPath = "org.netbeans.core.execution.beaninfo.editors"; - List paths = Arrays.asList(PropertyEditorManager.getEditorSearchPath()); - if (!paths.contains(coreExecutionPath)) { - paths = new ArrayList(paths); - paths.add(coreExecutionPath); - PropertyEditorManager.setEditorSearchPath(paths.toArray(new String[0])); - } - } - }); } /** Overridden method from JUnit framework execution to perform conditional @@ -528,7 +490,12 @@ } protected static junit.framework.Test createModuleTest(String modules, String clusters, Class testClass, String... testNames) { - return NbModuleSuite.create(testClass, clusters, modules, testNames); + return NbModuleSuite.emptyConfiguration(). + enableModules(modules). + clusters(clusters). + addTest(testClass, testNames). + honorAutoloadEager(true). + suite(); } protected static junit.framework.Test createModuleTest(Class testClass, String... testNames) { diff --git a/nbbuild/cluster.properties b/nbbuild/cluster.properties --- a/nbbuild/cluster.properties +++ b/nbbuild/cluster.properties @@ -212,6 +212,7 @@ options.keymap,\ print,\ progress.ui,\ + propertyeditors,\ queries,\ sampler,\ sendopts,\ diff --git a/o.n.core/manifest.mf b/o.n.core/manifest.mf --- a/o.n.core/manifest.mf +++ b/o.n.core/manifest.mf @@ -1,7 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.core/2 OpenIDE-Module-Localizing-Bundle: org/netbeans/core/Bundle.properties -OpenIDE-Module-Layer: org/netbeans/core/resources/mf-layer.xml AutoUpdate-Show-In-Client: false AutoUpdate-Essential-Module: true OpenIDE-Module-Specification-Version: 3.34 diff --git a/o.n.core/src/org/netbeans/core/CoreBridgeImpl.java b/o.n.core/src/org/netbeans/core/CoreBridgeImpl.java --- a/o.n.core/src/org/netbeans/core/CoreBridgeImpl.java +++ b/o.n.core/src/org/netbeans/core/CoreBridgeImpl.java @@ -159,35 +159,10 @@ } public void registerPropertyEditors() { - doRegisterPropertyEditors(); } /**Flag to avoid multiple adds of the same path to the * of PropertyEditorManager if multiple tests call * registerPropertyEditors() */ private static boolean editorsRegistered=false; - /** Register NB specific property editors. - * Allows property editor unit tests to work correctly without - * initializing full NetBeans environment. - * @since 1.98 */ - private static final void doRegisterPropertyEditors() { - //issue 31879 - if (editorsRegistered) return; - String[] syspesp = PropertyEditorManager.getEditorSearchPath(); - String[] nbpesp = new String[] { - "org.netbeans.beaninfo.editors", // NOI18N - "org.openide.explorer.propertysheet.editors", // NOI18N - }; - String[] allpesp = new String[syspesp.length + nbpesp.length]; - System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length); - System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length); - PropertyEditorManager.setEditorSearchPath(allpesp); - PropertyEditorManager.registerEditor (java.lang.Character.TYPE, org.netbeans.beaninfo.editors.CharEditor.class); - PropertyEditorManager.registerEditor(String[].class, org.netbeans.beaninfo.editors.StringArrayEditor.class); - // use replacement hintable/internationalizable primitive editors - issues 20376, 5278 - PropertyEditorManager.registerEditor (Integer.TYPE, org.netbeans.beaninfo.editors.IntEditor.class); - PropertyEditorManager.registerEditor (Boolean.TYPE, org.netbeans.beaninfo.editors.BoolEditor.class); - editorsRegistered = true; - } - } diff --git a/o.n.core/src/org/netbeans/core/IDESettings.java b/o.n.core/src/org/netbeans/core/IDESettings.java --- a/o.n.core/src/org/netbeans/core/IDESettings.java +++ b/o.n.core/src/org/netbeans/core/IDESettings.java @@ -228,17 +228,4 @@ } return false; } - - /** Used in layer xml to register FactoryEditor. */ - private static org.netbeans.beaninfo.editors.HtmlBrowser.FactoryEditor createHtmlBrowserFactoryEditor() { - return new org.netbeans.beaninfo.editors.HtmlBrowser.FactoryEditor(){ - public void setValue(Object value) { - setWWWBrowser((HtmlBrowser.Factory)value); - } - - public Object getValue() { - return getWWWBrowser(); - } - }; - } } diff --git a/options.api/nbproject/project.xml b/options.api/nbproject/project.xml --- a/options.api/nbproject/project.xml +++ b/options.api/nbproject/project.xml @@ -59,15 +59,6 @@ - org.netbeans.core - - - - 2 - 3.11 - - - org.netbeans.core.startup diff --git a/options.api/src/org/netbeans/modules/options/classic/FileStateEditor.java b/options.api/src/org/netbeans/modules/options/classic/FileStateEditor.java --- a/options.api/src/org/netbeans/modules/options/classic/FileStateEditor.java +++ b/options.api/src/org/netbeans/modules/options/classic/FileStateEditor.java @@ -44,7 +44,6 @@ package org.netbeans.modules.options.classic; -import org.netbeans.beaninfo.editors.ListImageEditor; import org.openide.util.NbBundle; import org.openide.nodes.Node; import org.openide.explorer.propertysheet.PropertyEnv; @@ -54,10 +53,10 @@ import org.netbeans.modules.options.classic.SettingChildren.FileStateProperty; /** - * + * XXX: Should rather communicate with ListImageEditor or some other editor via properties... * @author Vitezslav Stejskal */ -class FileStateEditor extends ListImageEditor { +class FileStateEditor {/* extends ListImageEditor { private String action_define = null; private String action_revert = null; @@ -65,7 +64,6 @@ private Node.Property prop = null; - /** Creates new FileStatePropertyEditor */ public FileStateEditor () { super (); @@ -137,5 +135,5 @@ return new String [] { action_define }; - } + }*/ } diff --git a/options.api/src/org/netbeans/modules/options/classic/SettingChildren.java b/options.api/src/org/netbeans/modules/options/classic/SettingChildren.java --- a/options.api/src/org/netbeans/modules/options/classic/SettingChildren.java +++ b/options.api/src/org/netbeans/modules/options/classic/SettingChildren.java @@ -54,7 +54,6 @@ import org.openide.filesystems.FileStateInvalidException; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; -import org.netbeans.beaninfo.editors.ListImageEditor; import java.awt.Image; import java.beans.PropertyEditor; import java.lang.reflect.InvocationTargetException; @@ -164,7 +163,7 @@ this.primaryFile = primaryFile; this.layer = layer; - +/* setValue (ListImageEditor.PROP_VALUES, new Integer [] { FileStateManager.FSTATE_DEFINED, FileStateManager.FSTATE_IGNORED, @@ -178,6 +177,7 @@ ImageUtilities.loadImage ("org/netbeans/core/resources/setting-inherited.gif"), // NOI18N ImageUtilities.loadImage ("org/openide/resources/actions/empty.gif") // NOI18N }); + */ } public boolean canWrite () { @@ -245,7 +245,8 @@ } public PropertyEditor getPropertyEditor () { - return new FileStateEditor (); + // XXX: return new FileStateEditor (); + return null; } public String getShortDescription () { diff --git a/propertyeditors/build.xml b/propertyeditors/build.xml new file mode 100644 --- /dev/null +++ b/propertyeditors/build.xml @@ -0,0 +1,5 @@ + + + Builds, tests, and runs the project org.netbeans.modules.propertyeditors + + diff --git a/propertyeditors/manifest.mf b/propertyeditors/manifest.mf new file mode 100644 --- /dev/null +++ b/propertyeditors/manifest.mf @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +OpenIDE-Module: org.netbeans.modules.propertyeditors +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/propertyeditors/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 +OpenIDE-Module-Layer: org/netbeans/modules/propertyeditors/mf-layer.xml diff --git a/propertyeditors/nbproject/project.properties b/propertyeditors/nbproject/project.properties new file mode 100644 --- /dev/null +++ b/propertyeditors/nbproject/project.properties @@ -0,0 +1,2 @@ +javac.source=1.6 +javac.compilerargs=-Xlint -Xlint:-serial diff --git a/propertyeditors/nbproject/project.xml b/propertyeditors/nbproject/project.xml new file mode 100644 --- /dev/null +++ b/propertyeditors/nbproject/project.xml @@ -0,0 +1,98 @@ + + + org.netbeans.modules.apisupport.project + + + org.netbeans.modules.propertyeditors + + + org.openide.awt + + + + 7.45 + + + + org.openide.dialogs + + + + 6.2 + + + + org.openide.explorer + + + + 6.23 + + + + org.openide.filesystems + + + + 8.0 + + + + org.openide.loaders + + + + 7.13 + + + + org.openide.modules + + + + 7.25 + + + + org.openide.nodes + + + + 7.23 + + + + org.openide.util + + + + 8.25 + + + + org.openide.util.lookup + + + + 8.0 + + + + + + unit + + org.netbeans.libs.junit4 + + + + org.netbeans.modules.nbjunit + + + + + + + + + diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ArrayOfIntSupport.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ArrayOfIntSupport.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ArrayOfIntSupport.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ArrayOfIntSupport.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/ArrayOfIntSupport.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/ArrayOfIntSupport.java @@ -46,10 +46,10 @@ import java.util.StringTokenizer; import java.text.MessageFormat; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.PropertyEnv; import org.openide.explorer.propertysheet.editors.XMLPropertyEditor; +import org.openide.util.Exceptions; /** Support for property editors for several integers. * for example: Point - [2,4], Insets [2,3,4,4],... @@ -199,9 +199,7 @@ String msg = new MessageFormat(VALUE_FORMAT).format(new Object[] { className , getHintFormat() } ); IllegalArgumentException iae = new IllegalArgumentException(msg); - UIExceptions.annotateUser(iae, e == null ? "" - : e.getMessage(), msg, e, - new java.util.Date()); //NOI18N + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/BoolEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/BoolEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/BoolEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/BoolEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/BooleanEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/BooleanEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/BooleanEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/BooleanEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/Bundle.properties b/propertyeditors/src/org/netbeans/beaninfo/editors/Bundle.properties rename from o.n.core/src/org/netbeans/beaninfo/editors/Bundle.properties rename to propertyeditors/src/org/netbeans/beaninfo/editors/Bundle.properties diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ByteEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ByteEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ByteEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ByteEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/CharEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/CharEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/CharEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/CharEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/CharacterEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/CharacterEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/CharacterEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/CharacterEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ClassEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ClassEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ClassEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ClassEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/ClassEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/ClassEditor.java @@ -45,7 +45,7 @@ package org.netbeans.beaninfo.editors; import java.text.MessageFormat; -import org.netbeans.core.UIExceptions; +import org.openide.util.Exceptions; import org.openide.util.Lookup; import org.openide.util.NbBundle; @@ -101,8 +101,7 @@ String msg = MessageFormat.format( NbBundle.getMessage( ClassEditor.class, "FMT_EXC_CANT_LOAD_CLASS"), new Object[] {text}); //NOI18N - UIExceptions.annotateUser(iae, e.getMessage(), msg, e, - new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ColorEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ColorEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ColorEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ColorEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/ColorEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/ColorEditor.java @@ -78,8 +78,8 @@ import javax.swing.ListCellRenderer; import javax.swing.UIDefaults; import javax.swing.UIManager; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.editors.XMLPropertyEditor; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; @@ -322,9 +322,7 @@ new Color(red, green, blue))); return; } catch( IllegalArgumentException iaE ) { - UIExceptions.annotateUser(iaE, null, - iaE.getLocalizedMessage(), - null, null); + Exceptions.attachLocalizedMessage(iaE, iaE.getLocalizedMessage()); throw iaE; } } @@ -361,7 +359,7 @@ NbBundle.getMessage (ColorEditor.class, "FMT_IllegalEntry"), new Object[]{text}); IllegalArgumentException iae = new IllegalArgumentException (text); - UIExceptions.annotateUser(iae, text, msg, null, null); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/DateEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/DateEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/DateEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/DateEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.form b/propertyeditors/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.form rename from o.n.core/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.form rename to propertyeditors/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.form diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/DimensionCustomEditor.java @@ -48,10 +48,10 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ResourceBundle; -import org.netbeans.core.UIExceptions; import org.openide.awt.Mnemonics; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** @@ -104,15 +104,14 @@ int height = Integer.parseInt (heightField.getText ()); if ((width < 0) || (height < 0)) { IllegalStateException ise = new IllegalStateException(); - UIExceptions.annotateUser(ise, null, - NbBundle.getMessage(DimensionCustomEditor.class, "CTL_NegativeSize"), null, null); + Exceptions.attachLocalizedMessage(ise, NbBundle.getMessage(DimensionCustomEditor.class, "CTL_NegativeSize")); throw ise; } return new Dimension (width, height); } catch (NumberFormatException e) { IllegalStateException ise = new IllegalStateException(); - UIExceptions.annotateUser(ise, null, - NbBundle.getMessage(DimensionCustomEditor.class, "CTL_InvalidValue"), null, null); + Exceptions.attachLocalizedMessage(ise, + NbBundle.getMessage(DimensionCustomEditor.class, "CTL_InvalidValue")); throw ise; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/DimensionEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/DimensionEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/DimensionEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/DimensionEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/DimensionEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/DimensionEditor.java @@ -45,8 +45,8 @@ package org.netbeans.beaninfo.editors; import java.awt.Dimension; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.ExPropertyEditor; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** A property editor for Dimension class. @@ -89,8 +89,7 @@ "CTL_NegativeSize"); //NOI18N IllegalArgumentException iae = new IllegalArgumentException ( "Negative value"); //NOI18N - UIExceptions.annotateUser(iae, iae.getMessage(), msg, null, - new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } else diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/DoubleEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/DoubleEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/DoubleEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/DoubleEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ExPropertyEditorSupport.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ExPropertyEditorSupport.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ExPropertyEditorSupport.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ExPropertyEditorSupport.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/FileArrayEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/FileArrayEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/FileArrayEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/FileArrayEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/FileArrayEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/FileArrayEditor.java @@ -59,6 +59,7 @@ import org.openide.nodes.Node; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.filesystems.FileChooserBuilder; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; @@ -210,7 +211,7 @@ return new StringCustomEditor(getAsText(), false); } if (chooser == null) { - chooser = FileEditor.createHackedFileChooser(); + chooser = new FileChooserBuilder(FileArrayEditor.class).createFileChooser(); chooser.setMultiSelectionEnabled(true); Object vv = getValue (); diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/FileEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/FileEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/FileEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/FileEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/FileEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/FileEditor.java @@ -68,6 +68,7 @@ import org.openide.nodes.Node; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.filesystems.FileChooserBuilder; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; @@ -241,7 +242,7 @@ return new StringCustomEditor(info, false, true, null, this, env); } if (chooser == null) { - chooser = createHackedFileChooser(); + chooser = new FileChooserBuilder(FileEditor.class).createFileChooser(); File originalFile = (File)getValue (); if (originalFile != null && ! originalFile.isAbsolute() && baseDirectory != null) { @@ -392,16 +393,6 @@ lastCurrentDir = chooser.getCurrentDirectory(); } - // XXX #18270. Enter doesn't work when expecting folder change, - // Accessibility problem. We hack default behaviour here. - /** Creates hacked fileChooser, responding on Enter the way it - * performs folder change. */ - public static JFileChooser createHackedFileChooser() { - JFileChooser chooser = new JFileChooser(); - hackFileChooser(chooser); - return chooser; - } - /** Hacks fileChooser, responding on Enter the way it * performs folder change. */ public static void hackFileChooser(final JFileChooser chooser) { diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/FloatEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/FloatEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/FloatEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/FloatEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/FontEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/FontEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/FontEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/FontEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/FontEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/FontEditor.java @@ -51,7 +51,6 @@ import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; -import org.netbeans.core.UIExceptions; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; @@ -461,18 +460,18 @@ size = Integer.parseInt (tfSize.getText ()); if (size <= 0) { IllegalArgumentException iae = new IllegalArgumentException (); - UIExceptions.annotateUser (iae, null, + Exceptions.attachLocalizedMessage (iae, size == 0 ? NbBundle.getMessage (FontEditor.class, "CTL_InvalidValueWithParam", tfSize.getText ()) : // NOI18N - NbBundle.getMessage (FontEditor.class, "CTL_NegativeSize"), // NOI18N - null, null); + NbBundle.getMessage (FontEditor.class, "CTL_NegativeSize") // NOI18N + ); tfSize.setText (String.valueOf (font.getSize ())); throw iae; } updateSizeList(size); } catch (NumberFormatException e) { - UIExceptions.annotateUser (e, null, - NbBundle.getMessage (FontEditor.class, "CTL_InvalidValueWithExc", e), // NOI18N - null, null); + Exceptions.attachLocalizedMessage (e, + NbBundle.getMessage (FontEditor.class, "CTL_InvalidValueWithExc", e) // NOI18N + ); tfSize.setText (String.valueOf (font.getSize ())); throw e; } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/HtmlBrowser.java b/propertyeditors/src/org/netbeans/beaninfo/editors/HtmlBrowser.java rename from o.n.core/src/org/netbeans/beaninfo/editors/HtmlBrowser.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/HtmlBrowser.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/HtmlBrowser.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/HtmlBrowser.java @@ -47,7 +47,6 @@ import java.beans.PropertyEditorSupport; import java.text.MessageFormat; import java.util.ArrayList; -import org.netbeans.core.UIExceptions; import org.openide.cookies.InstanceCookie; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileStateInvalidException; @@ -116,7 +115,7 @@ HtmlBrowser.class, "FMT_EXC_GENERIC_BAD_VALUE"), //NOI18N new Object[] {str}); } - UIExceptions.annotateUser(iae, str, msg, e, new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/InsetsCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/InsetsCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/InsetsCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/InsetsCustomEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/InsetsCustomEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/InsetsCustomEditor.java @@ -54,9 +54,9 @@ import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.UIManager; -import org.netbeans.core.UIExceptions; import org.openide.awt.Mnemonics; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** @@ -131,7 +131,7 @@ int height = Integer.parseInt (heightField.getText ()); // if ((x < 0) || (y < 0) || (width < 0) || (height < 0)) { // IllegalStateException ise = new IllegalStateException(); -// UIExceptions.annotateUser(ise, null, +// Exceptions.attachLocalizedMessage(ise, null, // NbBundle.getMessage(InsetsCustomEditor.class, // "CTL_NegativeSize"), // null, null); @@ -140,10 +140,9 @@ return new Insets (x, y, width, height); } catch (NumberFormatException e) { IllegalStateException ise = new IllegalStateException(); - UIExceptions.annotateUser(ise, null, + Exceptions.attachLocalizedMessage(ise, NbBundle.getMessage(InsetsCustomEditor.class, - "CTL_InvalidValue"), - null, null); + "CTL_InvalidValue")); throw ise; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/InsetsEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/InsetsEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/InsetsEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/InsetsEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/InsetsEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/InsetsEditor.java @@ -45,7 +45,6 @@ package org.netbeans.beaninfo.editors; import java.awt.Insets; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.PropertyEnv; import org.openide.util.NbBundle; diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/IntEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/IntEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/IntEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/IntEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/IntEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/IntEditor.java @@ -50,8 +50,8 @@ package org.netbeans.beaninfo.editors; import java.util.Arrays; import org.netbeans.beaninfo.editors.ExPropertyEditorSupport.EnvException; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.*; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** An editor for primitive integer types which allows hinting of tag * values and handles whitespace in setAsText better than the default @@ -184,7 +184,7 @@ String msg = NbBundle.getMessage( IntEditor.class, "EXC_ILLEGAL_VALUE_TEXT") + s; //NOI18N RuntimeException iae = new IllegalArgumentException(msg); //NOI18N - UIExceptions.annotateUser(iae, msg, msg, nfe, new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } } @@ -206,8 +206,7 @@ msg.append(arrToStr(keys)); String message = msg.toString(); RuntimeException iae = new IllegalArgumentException(message); - UIExceptions.annotateUser(iae, message, message, iae, - new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, message); throw iae; } else { setValue(Integer.valueOf(idx)); diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/IntegerCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/IntegerCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/IntegerCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/IntegerCustomEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/IntegerEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/IntegerEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/IntegerEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/IntegerEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ListImageEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ListImageEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ListImageEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ListImageEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/ListImageEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/ListImageEditor.java @@ -47,11 +47,11 @@ import java.awt.Image; import java.beans.PropertyEditorSupport; import java.beans.FeatureDescriptor; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.PropertyEnv; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.nodes.Node; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; @@ -142,8 +142,7 @@ "negative: " + str); //NOI18N String msg = NbBundle.getMessage(ListImageEditor.class, "CTL_NegativeSize"); //NOI18N - UIExceptions.annotateUser(iae, iae.getMessage(), msg, null, - new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } setValue (findObject (values, i)); diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/LongEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/LongEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/LongEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/LongEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ObjectEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ObjectEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ObjectEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ObjectEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/ObjectEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/ObjectEditor.java @@ -57,15 +57,14 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; -import java.util.Date; import java.util.Iterator; import javax.swing.ButtonGroup; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.Lookup; import org.openide.util.Utilities; @@ -209,7 +208,7 @@ NbBundle.getMessage( ObjectEditor.class, "FMT_EXC_GENERIC_BAD_VALUE"), //NOI18N new Object[] {str}); - UIExceptions.annotateUser(iae, str, msg, null, new Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/PointCustomEditor.form b/propertyeditors/src/org/netbeans/beaninfo/editors/PointCustomEditor.form rename from o.n.core/src/org/netbeans/beaninfo/editors/PointCustomEditor.form rename to propertyeditors/src/org/netbeans/beaninfo/editors/PointCustomEditor.form diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/PointCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/PointCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/PointCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/PointCustomEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/PointCustomEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/PointCustomEditor.java @@ -47,10 +47,9 @@ import java.awt.Point; import java.awt.Dimension; import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import org.netbeans.core.UIExceptions; import org.openide.awt.Mnemonics; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** Custom property editor for Point and Dimension @@ -136,10 +135,9 @@ if ( dimensionMode ) { if ((x < 0) || (y < 0)) { IllegalStateException ise = new IllegalStateException(); - UIExceptions.annotateUser(ise, null, + Exceptions.attachLocalizedMessage(ise, NbBundle.getMessage(PointCustomEditor.class, - "CTL_NegativeSize"), - null, null); + "CTL_NegativeSize")); throw ise; } return new Dimension (x, y); @@ -148,10 +146,9 @@ } } catch (NumberFormatException e) { IllegalStateException ise = new IllegalStateException(); - UIExceptions.annotateUser(ise, null, + Exceptions.attachLocalizedMessage(ise, NbBundle.getMessage(PointCustomEditor.class, - "CTL_InvalidValue"), - null, null); + "CTL_InvalidValue")); throw ise; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/PointEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/PointEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/PointEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/PointEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/PropertiesCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/PropertiesCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/PropertiesCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/PropertiesCustomEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/PropertiesEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/PropertiesEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/PropertiesEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/PropertiesEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/PropertiesEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/PropertiesEditor.java @@ -52,7 +52,7 @@ import java.util.Date; import java.util.Enumeration; import java.util.Properties; -import org.netbeans.core.UIExceptions; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; @@ -108,7 +108,7 @@ NbBundle.getMessage( PropertiesEditor.class, "FMT_EXC_GENERIC_BAD_VALUE"), new Object[] {text}); //NOI18N } - UIExceptions.annotateUser(iae, iae.getMessage(), msg, ioe, new Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/RectangleCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/RectangleCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/RectangleCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/RectangleCustomEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/RectangleCustomEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/RectangleCustomEditor.java @@ -44,20 +44,14 @@ package org.netbeans.beaninfo.editors; -import java.awt.Color; -import java.awt.Component; import java.awt.Rectangle; -import java.awt.event.KeyListener; import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.HashMap; import java.util.ResourceBundle; import javax.swing.JLabel; import javax.swing.JTextField; -import javax.swing.UIManager; -import org.netbeans.core.UIExceptions; import org.openide.awt.Mnemonics; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** @@ -126,19 +120,17 @@ int height = Integer.parseInt (heightField.getText ()); if ((x < 0) || (y < 0) || (width < 0) || (height < 0)) { IllegalStateException ise = new IllegalStateException(); - UIExceptions.annotateUser(ise, null, + Exceptions.attachLocalizedMessage(ise, NbBundle.getMessage(RectangleCustomEditor.class, - "CTL_NegativeSize"), - null, null); + "CTL_NegativeSize")); throw ise; } return new Rectangle (x, y, width, height); } catch (NumberFormatException e) { IllegalStateException ise = new IllegalStateException(); - UIExceptions.annotateUser(ise, null, + Exceptions.attachLocalizedMessage(ise, NbBundle.getMessage(RectangleCustomEditor.class, - "CTL_InvalidValue"), - null, null); + "CTL_InvalidValue")); throw ise; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/RectangleEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/RectangleEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/RectangleEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/RectangleEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/RectangleEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/RectangleEditor.java @@ -45,9 +45,8 @@ package org.netbeans.beaninfo.editors; import java.awt.Rectangle; -import org.netbeans.core.UIExceptions; -import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** A property editor for Rectangle class. @@ -74,8 +73,7 @@ "CTL_NegativeSize"); //NOI18N IllegalArgumentException iae = new IllegalArgumentException ( "Negative value"); //NOI18N - UIExceptions.annotateUser(iae, iae.getMessage(), msg, null, - new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } diff --git a/propertyeditors/src/org/netbeans/beaninfo/editors/RegisterEditors.java b/propertyeditors/src/org/netbeans/beaninfo/editors/RegisterEditors.java new file mode 100644 --- /dev/null +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/RegisterEditors.java @@ -0,0 +1,99 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ +package org.netbeans.beaninfo.editors; + +import java.beans.PropertyEditorManager; +import org.openide.modules.OnStart; + +/** + * + * @author Jaroslav Tulach + */ +@OnStart +public class RegisterEditors implements Runnable { + private static boolean editorsRegistered; + + @Override + public void run() { + registerPropertyEditors(); + } + /** + * Register NB specific property editors. Allows property editor unit tests + * to work correctly without initializing full NetBeans environment. + */ + public static void registerPropertyEditors() { + //issue 31879 + if (editorsRegistered) { + return; + } + String[] syspesp = PropertyEditorManager.getEditorSearchPath(); + String[] nbpesp = new String[]{ + "org.netbeans.beaninfo.editors", // NOI18N + "org.openide.explorer.propertysheet.editors", // NOI18N + }; + String[] allpesp = new String[syspesp.length + nbpesp.length]; + System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length); + System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length); + PropertyEditorManager.setEditorSearchPath(allpesp); + PropertyEditorManager.registerEditor(java.lang.Character.TYPE, org.netbeans.beaninfo.editors.CharEditor.class); + PropertyEditorManager.registerEditor(String[].class, org.netbeans.beaninfo.editors.StringArrayEditor.class); + // use replacement hintable/internationalizable primitive editors - issues 20376, 5278 + PropertyEditorManager.registerEditor(Integer.TYPE, org.netbeans.beaninfo.editors.IntEditor.class); + PropertyEditorManager.registerEditor(Boolean.TYPE, org.netbeans.beaninfo.editors.BoolEditor.class); + editorsRegistered = true; + } + + /** Used in layer xml to register FactoryEditor. */ + private static org.netbeans.beaninfo.editors.HtmlBrowser.FactoryEditor createHtmlBrowserFactoryEditor() { + return new org.netbeans.beaninfo.editors.HtmlBrowser.FactoryEditor(){ + public void setValue(Object value) { +// XXX setWWWBrowser((org.openide.awt.HtmlBrowser.Factory)value); + } + + public Object getValue() { +// XXX return getWWWBrowser(); + return null; + } + }; + } + +} diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/ShortEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/ShortEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/ShortEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/ShortEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.form b/propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.form rename from o.n.core/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.form rename to propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.form diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayCustomEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/StringArrayCustomizable.java b/propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayCustomizable.java rename from o.n.core/src/org/netbeans/beaninfo/editors/StringArrayCustomizable.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayCustomizable.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/StringArrayEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/StringArrayEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/StringArrayEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/StringCustomEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/StringCustomEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/StringCustomEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/StringCustomEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/StringEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/StringEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/StringEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/StringEditor.java diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/URLEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/URLEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/URLEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/URLEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/URLEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/URLEditor.java @@ -48,7 +48,7 @@ import java.net.URL; import java.net.MalformedURLException; import java.text.MessageFormat; -import org.netbeans.core.UIExceptions; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** A property editor for java.net.URL class. @@ -72,8 +72,7 @@ String msg = MessageFormat.format( NbBundle.getMessage( URLEditor.class, "FMT_EXC_BAD_URL"), new Object[] {s}); //NOI18N - UIExceptions.annotateUser(iae, e.getMessage(), msg, e, - new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } } diff --git a/o.n.core/src/org/netbeans/beaninfo/editors/WrappersEditor.java b/propertyeditors/src/org/netbeans/beaninfo/editors/WrappersEditor.java rename from o.n.core/src/org/netbeans/beaninfo/editors/WrappersEditor.java rename to propertyeditors/src/org/netbeans/beaninfo/editors/WrappersEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/WrappersEditor.java +++ b/propertyeditors/src/org/netbeans/beaninfo/editors/WrappersEditor.java @@ -46,9 +46,9 @@ import java.beans.*; import java.text.MessageFormat; -import org.netbeans.core.UIExceptions; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.PropertyEnv; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** @@ -102,8 +102,7 @@ NbBundle.getMessage( WrappersEditor.class, "FMT_EXC_GENERIC_BAD_VALUE"), text); //NOI18N } - UIExceptions.annotateUser(iae, iae.getMessage(), msg, e, - new java.util.Date()); + Exceptions.attachLocalizedMessage(iae, msg); throw iae; } } diff --git a/propertyeditors/src/org/netbeans/modules/propertyeditors/Bundle.properties b/propertyeditors/src/org/netbeans/modules/propertyeditors/Bundle.properties new file mode 100644 --- /dev/null +++ b/propertyeditors/src/org/netbeans/modules/propertyeditors/Bundle.properties @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=Platform Property Editors diff --git a/o.n.core/src/org/netbeans/core/resources/mf-layer.xml b/propertyeditors/src/org/netbeans/modules/propertyeditors/mf-layer.xml rename from o.n.core/src/org/netbeans/core/resources/mf-layer.xml rename to propertyeditors/src/org/netbeans/modules/propertyeditors/mf-layer.xml diff --git a/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/Bundle_cs.properties b/propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/Bundle_cs.properties rename from o.n.core/test/unit/src/org/netbeans/beaninfo/editors/Bundle_cs.properties rename to propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/Bundle_cs.properties diff --git a/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/ColorEditorTest.java b/propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/ColorEditorTest.java rename from o.n.core/test/unit/src/org/netbeans/beaninfo/editors/ColorEditorTest.java rename to propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/ColorEditorTest.java diff --git a/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java b/propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java rename from o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java rename to propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/FileArrayEditorTest.java diff --git a/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java b/propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java rename from o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java rename to propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java --- a/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java +++ b/propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java @@ -47,7 +47,6 @@ import java.beans.PropertyEditorManager; import junit.textui.TestRunner; import org.netbeans.junit.*; -import org.openide.filesystems.FileUtil; /** Test finding of property editors registred by core. * @author Jiri Rechtacek @@ -55,9 +54,7 @@ public class FindEditorTest extends NbTestCase { static { - //issue 31879, force registration of NB editors so this - //test can pass when editor tests are run standalone - org.netbeans.core.CoreBridgeImpl.getDefault().registerPropertyEditors(); + RegisterEditors.registerPropertyEditors(); } public FindEditorTest(String name) { diff --git a/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/StringArrayEditorTest.java b/propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/StringArrayEditorTest.java rename from o.n.core/test/unit/src/org/netbeans/beaninfo/editors/StringArrayEditorTest.java rename to propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/StringArrayEditorTest.java diff --git a/o.n.core/test/unit/src/org/netbeans/beaninfo/editors/StringEditorTest.java b/propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/StringEditorTest.java rename from o.n.core/test/unit/src/org/netbeans/beaninfo/editors/StringEditorTest.java rename to propertyeditors/test/unit/src/org/netbeans/beaninfo/editors/StringEditorTest.java