# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /space/nbsrc/openide/text
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: src/org/netbeans/modules/openide/text/indentEngines.gif
*** /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/indentEngines.gif No Base Revision
--- /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/indentEngines.gif Locally New
***************
*** 1,0 ****
--- 1,1 ----
+ [Binary File Locally New]
Index: src/org/netbeans/modules/openide/text/layer.xml
*** /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/layer.xml No Base Revision
--- /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/layer.xml Locally New
***************
*** 1,0 ****
--- 1,34 ----
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: src/org/netbeans/modules/openide/text/Bundle.properties
*** /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/Bundle.properties No Base Revision
--- /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/Bundle.properties Locally New
***************
*** 1,0 ****
--- 1,22 ----
+ # The contents of this file are subject to the terms of the Common Development
+ # and Distribution License (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.html
+ # or http://www.netbeans.org/cddl.txt.
+ #
+ # When distributing Covered Code, include this CDDL Header Notice in each file
+ # and include the License file at http://www.netbeans.org/cddl.txt.
+ # If applicable, add the following below the CDDL Header, with the fields
+ # enclosed by brackets [] replaced by your own identifying information:
+ # "Portions Copyrighted [year] [name of copyright owner]"
+ #
+ # The Original Software is NetBeans. The Initial Developer of the Original
+ # Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ # Microsystems, Inc. All Rights Reserved.
+ OpenIDE-Module-Name=Indentation Editor Bridge
+ LAB_IndentEngine=Indentation Engines
+ HINT_IndentEngine=All types of indentation engines registered in the system.
+
+ LAB_IndentEngineDefault=No Indentation
+ HINT_IndentEngineDefault=No Indentation
Index: src/org/netbeans/modules/openide/text/IndentEngineEditor.java
*** /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/IndentEngineEditor.java No Base Revision
--- /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/IndentEngineEditor.java Locally New
***************
*** 1,0 ****
--- 1,159 ----
+ /*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (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.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+ package org.netbeans.modules.openide.text;
+
+ import java.awt.Component;
+ import java.awt.Graphics;
+ import java.awt.Rectangle;
+ import java.beans.BeanInfo;
+ import java.beans.IntrospectionException;
+ import java.beans.Introspector;
+ import java.beans.PropertyChangeEvent;
+ import java.beans.PropertyChangeListener;
+ import java.beans.PropertyEditor;
+ import java.util.ArrayList;
+ import java.util.Collection;
+ import java.util.Iterator;
+ import java.util.List;
+ import org.openide.text.IndentEngine;
+ import org.openide.util.Exceptions;
+ import org.openide.util.NbBundle;
+ import org.openide.util.lookup.Lookups;
+
+ /** Support for property editor for indentation engine.
+ *
+ * @author Tim Boudreau
+ */
+ public class IndentEngineEditor implements PropertyEditor {
+ private final List l =
+ new ArrayList (2);
+
+ public IndentEngineEditor() {
+ }
+
+ public void setValue(Object value) {
+ IndentEngine old = this.value;
+ this.value = (IndentEngine) value;
+ fire(old, this.value);
+ }
+
+ private IndentEngine value;
+ public Object getValue() {
+ return value;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics val, Rectangle arg1) {
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ IndentEngine engine = (IndentEngine) getValue();
+ String result = null;
+ if (engine != null) {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(engine.getClass());
+ result = info.getBeanDescriptor().getDisplayName();
+ } catch (IntrospectionException ex) {
+ Exceptions.printStackTrace(ex);
+ result = ex.getMessage();
+ }
+ }
+ if (result == null || "IndentEngine$Default".equals(result)) { //NOI18N
+ result = NbBundle.getMessage (IndentEngineEditor.class,
+ "LAB_IndentEngineDefault"); //NOI18N
+ }
+ return result;
+ }
+
+ public void setAsText(String val) throws IllegalArgumentException {
+ if (NbBundle.getMessage (IndentEngineEditor.class,
+ "LAB_IndentEngineDefault").equals(val)) { //NOI18N
+ val = "IndentEngine$Default"; //NOI18N
+ }
+ Collection extends IndentEngine> engines =
+ Lookups.forPath("Services").lookupAll(IndentEngine.class); //NOI18N
+ for (IndentEngine e : engines) {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(e.getClass());
+ String nm = info.getBeanDescriptor().getDisplayName();
+ if (nm.equals(val)) {
+ setValue(e);
+ break;
+ }
+ } catch (IntrospectionException ex) {
+ Exceptions.printStackTrace (ex);
+ }
+ }
+ }
+
+ public String[] getTags() {
+ Collection extends IndentEngine> engines =
+ Lookups.forPath("Services").lookupAll(IndentEngine.class); //NOI18N
+ String[] names = new String [engines.size()];
+ Iterator extends IndentEngine> it = engines.iterator();
+ for (int i=0; i < names.length; i++) {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(
+ it.next().getClass());
+ names[i] = info.getBeanDescriptor().getDisplayName();
+ if ("IndentEngine$Default".equals(names[i])) { //NOI18N
+ names[i] = NbBundle.getMessage (IndentEngineEditor.class,
+ "LAB_IndentEngineDefault"); //NOI18N
+ }
+ } catch (IntrospectionException ex) {
+ names[i] = ex.getMessage();
+ Exceptions.printStackTrace(ex);
+ }
+ }
+ return names;
+ }
+
+ public Component getCustomEditor() {
+ return null;
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ private void fire(IndentEngine old, IndentEngine nue) {
+ PropertyChangeListener[] pces = new PropertyChangeListener[l.size()];
+ pces = l.toArray(pces);
+ for (int i=0; i < pces.length; i++) {
+ pces[i].propertyChange(new PropertyChangeEvent(this, null, old,
+ nue));
+ }
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener val) {
+ l.add(val);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener val) {
+ l.remove(val);
+ }
+ }
Index: manifest.mf
*** /space/nbsrc/openide/text/manifest.mf Base (1.18)
--- /space/nbsrc/openide/text/manifest.mf Locally Modified (Based On 1.18)
***************
*** 1,9 ****
Manifest-Version: 1.0
OpenIDE-Module: org.openide.text
! OpenIDE-Module-Specification-Version: 6.16
OpenIDE-Module-Localizing-Bundle: org/openide/text/Bundle.properties
--- 1,10 ----
Manifest-Version: 1.0
OpenIDE-Module: org.openide.text
! OpenIDE-Module-Specification-Version: 6.17
OpenIDE-Module-Localizing-Bundle: org/openide/text/Bundle.properties
+ OpenIDE-Module-Layer: org/netbeans/modules/openide/text/layer.xml
Index: src/org/openide/text/IndentEngine.java
*** /space/nbsrc/openide/text/src/org/openide/text/IndentEngine.java Base (1.3)
--- /space/nbsrc/openide/text/src/org/openide/text/IndentEngine.java Locally Modified (Based On 1.3)
***************
*** 13,38 ****
* "Portions Copyrighted [year] [name of copyright owner]"
*
* The Original Software is NetBeans. The Initial Developer of the Original
! * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.openide.text;
import org.openide.ServiceType;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import java.io.Writer;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.swing.text.*;
--- 13,41 ----
* "Portions Copyrighted [year] [name of copyright owner]"
*
* The Original Software is NetBeans. The Initial Developer of the Original
! * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.openide.text;
+ import java.beans.Introspector;
+ import java.beans.PropertyEditorManager;
import org.openide.ServiceType;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import java.io.Writer;
+ import java.util.ArrayList;
+ import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
+ import java.util.List;
import java.util.Map;
import javax.swing.text.*;
+ import org.netbeans.modules.openide.text.IndentEngineEditor;
/** Indentation engine for formating text in documents.
***************
*** 45,50 ****
--- 51,70 ----
private static Map map = new HashMap(7);
private static IndentEngine INSTANCE = null;
+ static {
+ // #106423 - eliminate dep Core -> Text API.
+ // Harmless if text/indentation-bridge is missing
+ String[] s = Introspector.getBeanInfoSearchPath();
+ List nue = new ArrayList (
+ Arrays.asList(s));
+ nue.add ("org/netbeans/modules/openide/text"); //NOI18N
+ s = nue.toArray(new String[s.length + 1]);
+ Introspector.setBeanInfoSearchPath(s);
+
+ PropertyEditorManager.registerEditor(IndentEngine.class,
+ IndentEngineEditor.class);
+ }
+
public HelpCtx getHelpCtx() {
return HelpCtx.DEFAULT_HELP;
}
Index: src/org/netbeans/modules/openide/text/IndentEngineBeanInfo.java
*** /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/IndentEngineBeanInfo.java No Base Revision
--- /space/nbsrc/openide/text/src/org/netbeans/modules/openide/text/IndentEngineBeanInfo.java Locally New
***************
*** 1,0 ****
--- 1,62 ----
+ /*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (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.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+ package org.netbeans.modules.indentationbridge;
+
+ import java.awt.Image;
+
+ import java.beans.*;
+ import java.util.ResourceBundle;
+ import org.openide.util.Exceptions;
+
+ import org.openide.util.NbBundle;
+ import org.openide.util.Utilities;
+
+ /** Object that provides beaninfo for all indentation engines.
+ *
+ * @author Jaroslav Tulach
+ */
+ public class IndentEngineBeanInfo extends SimpleBeanInfo {
+
+ public BeanDescriptor getBeanDescriptor () {
+ BeanDescriptor descr = new BeanDescriptor (org.openide.text.IndentEngine.class);
+ ResourceBundle bundle = NbBundle.getBundle(IndentEngineBeanInfo.class);
+ descr.setDisplayName (bundle.getString ("LAB_IndentEngine")); // NOI18N
+ descr.setShortDescription (bundle.getString ("HINT_IndentEngine")); // NOI18N
+ descr.setValue("global", Boolean.TRUE); // NOI18N
+ return descr;
+ }
+
+ public BeanInfo[] getAdditionalBeanInfo () {
+ try {
+ return new BeanInfo[] { Introspector.getBeanInfo (org.openide.ServiceType.class) };
+ } catch (IntrospectionException ie) {
+ Exceptions.printStackTrace(ie);
+ return null;
+ }
+ }
+
+ /**
+ * Return the icon
+ */
+ public Image getIcon(int type) {
+ return Utilities.loadImage(
+ "org/netbeans/modules/openide/text/indentEngines.gif"); // NOI18N
+ }
+ }