diff --git a/jdk/make/tools/Makefile b/jdk/make/tools/Makefile index be1c59a7cfa..c396097c086 100644 --- a/jdk/make/tools/Makefile +++ b/jdk/make/tools/Makefile @@ -32,7 +32,6 @@ include $(BUILDDIR)/common/Defs.gmk SUBDIRS = \ addjsum \ - auto_multi \ buildmetaindex \ commentchecker \ compile_font_config \ diff --git a/jdk/make/tools/auto_multi/Makefile b/jdk/make/tools/auto_multi/Makefile deleted file mode 100644 index f5db35099ad..00000000000 --- a/jdk/make/tools/auto_multi/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -# -# Makefile for building the automulti tool -# - -BUILDDIR = ../.. -PACKAGE = build.tools.automulti -PRODUCT = tools -PROGRAM = automulti -include $(BUILDDIR)/common/Defs.gmk - -BUILDTOOL_SOURCE_ROOT = $(BUILDDIR)/tools/src -BUILDTOOL_MAIN = $(PKGDIR)/AutoMulti.java - -# -# Build tool jar rules. -# -include $(BUILDDIR)/common/BuildToolJar.gmk - diff --git a/jdk/make/tools/src/build/tools/automulti/AutoMulti.java b/jdk/make/tools/src/build/tools/automulti/AutoMulti.java deleted file mode 100644 index a59edc856ca..00000000000 --- a/jdk/make/tools/src/build/tools/automulti/AutoMulti.java +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package build.tools.automulti; - -import java.lang.reflect.*; -import java.util.*; -import java.io.*; - -/** - * Automatically generates the Multiplexing UI classes - * for Swing. - *
- * To use, type 'java AutoMulti
- * NOTE: This tool depends upon the existence of This file was automatically generated by AutoMulti.\n");
- s.append(" *\n");
- s.append(" * @author Otto Multey\n"); // Get it? I crack myself up.
- s.append(" */\n");
- s.append("public class Multi" + className + " extends " + className + " {\n");
- s.append("\n");
- s.append(" /**\n");
- s.append(" * The vector containing the real UIs. This is populated \n");
- s.append(" * in the call to
- * To use, type 'java TestALFGenerator
- * NOTE: This tool depends upon the existence of This file was automatically generated by TestALFGenerator.\n");
- s.append(" *\n");
- s.append(" * @author Otto Multey\n"); // Get it? I crack myself up.
- s.append(" */\n");
- s.append("public class " + classPrefix + className + " extends " + className + " {\n");
- s.append("\n");
- }
-
- /**
- * Prints out the code for a method.
- */
- public static void addMethod(StringBuffer s, Method m, String origName, String className) {
-
- // Get the method name and the return type. Be a little careful about arrays.
- //
- String methodName = unqualifyName(m.getName());
- String returnType;
-
- if (!m.getReturnType().isArray()) {
- returnType = unqualifyName(m.getReturnType().toString());
- addImport(importLines,m.getReturnType());
- } else {
- returnType = unqualifyName(m.getReturnType().getComponentType().toString())
- + "[]";
- addImport(importLines,m.getReturnType().getComponentType());
- }
-
- // Print the javadoc
- //
- s.append("\n");
-
- if (methodName.equals("createUI")) {
- s.append(" /**\n");
- s.append(" * Returns a UI object for this component.\n");
- s.append(" */\n");
- } else {
- s.append(" /**\n");
- s.append(" * Prints a message saying this method has been invoked.\n");
- s.append(" */\n");
- }
-
- // Print the method signature
- //
- s.append(" public");
- if (Modifier.isStatic(m.getModifiers())) {
- s.append(" static");
- }
- s.append(" " + returnType);
- s.append(" " + methodName);
- s.append("(");
-
- Class[] params = m.getParameterTypes();
- Class temp;
- String braces;
- for (int i = 0; i < params.length; i++) {
- if (i > 0) {
- s.append(", ");
- }
- temp = params[i];
- braces = new String("");
- while (temp.isArray()) {
- braces += "[]";
- temp = temp.getComponentType();
- }
- s.append(unqualifyName(temp.getName()) + braces + " " + paramNames[i]);
- addImport(importLines,temp);
- }
- s.append(")");
-
- // Don't forget about exceptions
- //
- Class exceptions[] = m.getExceptionTypes();
- String throwsString = new String("");
-
- if (exceptions.length > 0) {
- s.append("\n");
- indent(s,12);
- s.append("throws ");
- for (int i = 0; i < exceptions.length; i++) {
- if (i > 0) {
- s.append(", ");
- }
- s.append(unqualifyName(exceptions[i].getName()));
- addImport(importLines,exceptions[i]);
- }
- }
- s.append(throwsString + " {\n");
-
- // Now print out the contents of the method.
- indent(s,8);
- s.append("System.out.println(\"In the " + methodName
- + " method of the "
- + classPrefix + origName + " class.\");\n");
- if (methodName.equals("createUI")) {
- indent(s,8);
- s.append("return ui;\n");
- } else {
- // If we have to return something, do so.
- if (!returnType.equals("void")) {
- Class rType = m.getReturnType();
- indent(s,8);
- if (!rType.isPrimitive()) {
- s.append("return null;\n");
- } else if (rType == Boolean.TYPE) {
- s.append("return false;\n");
- } else if (rType == Character.TYPE) {
- s.append("return '0';\n");
- } else { // byte, short, int, long, float, or double
- s.append("return 0;\n");
- }
- }
- }
-
- indent(s,4);
- s.append("}\n");
- }
-
- /**
- * Takes a plaf class name (e.g., "MenuUI") and generates the corresponding
- * TestALF UI Java source code (e.g., "TestALFMenuUI.java").
- */
- public static void generateFile(String prefixName, String className) {
- try {
- FileOutputStream fos;
- PrintWriter outFile;
-
- importLines = new String();
- importLines += new String("import java.util.Vector;\n");
-
- StringBuffer body = new StringBuffer();
- Class wee = Class.forName(prefixName + ".swing.plaf." + className);
- String weeName = unqualifyName(wee.getName());
- String thisClassName = classPrefix + className;
- addImport(importLines,wee);
-
- // Declare and initialize the shared UI object.
- body.append("\n");
- body.append("////////////////////\n");
- body.append("// Shared UI object\n");
- body.append("////////////////////\n");
- body.append("private final static " + thisClassName
- + " ui = new " + thisClassName + "();\n");
-
- while (!weeName.equals("Object")) {
- body.append("\n");
- body.append("////////////////////\n");
- body.append("// " + weeName + " methods\n");
- body.append("////////////////////\n");
- Method[] methods = wee.getDeclaredMethods();
- for (int i=0; i < methods.length; i++) {
- if (Modifier.isPublic(methods[i].getModifiers())) {
- addMethod(body,methods[i],className,weeName);
- }
- }
- wee = wee.getSuperclass();
- weeName = unqualifyName(wee.getName());
- addImport(importLines,wee);
- }
-
- fos = new FileOutputStream(classPrefix + className + ".java");
- outFile = new PrintWriter(fos);
- StringBuffer outText = createPreamble(prefixName);
- outText.append(importLines.toString() + "\n");
- addHeader(outText,className);
- outText.append(body.toString());
- outText.append("}\n");
- outFile.write(outText.toString());
- outFile.flush();
- outFile.close();
- } catch (Exception e) {
- System.err.println(e);
- }
- }
-
- /**
- * D'Oh! Something bad happened.
- */
- public static void usage(String s) throws IOException {
- System.err.println("Usage: java TestALFGenerator An auxiliary look and feel used for testing the Multiplexing
- * look and feel.
- *
- *
- * @see UIManager#addAuxiliaryLookAndFeel
- * @see javax.swing.plaf.multi
- *
- * @author Kathy Walrath
- * @author Will Walker
- */
-public class TestALFLookAndFeel extends LookAndFeel {
-
-//////////////////////////////
-// LookAndFeel methods
-//////////////////////////////
-
- /**
- * Returns a string, suitable for use in menus,
- * that identifies this look and feel.
- *
- * @return a string such as "Test Auxiliary Look and Feel"
- */
- public String getName() {
- return "Test Auxiliary Look and Feel";
- }
-
- /**
- * Returns a string, suitable for use by applications/services,
- * that identifies this look and feel.
- *
- * @return "TestALF"
- */
- public String getID() {
- return "TestALF";
- }
-
- /**
- * Returns a one-line description of this look and feel.
- *
- * @return a descriptive string such as "Allows multiple UI instances per component instance"
- */
- public String getDescription() {
- return "Allows multiple UI instances per component instance";
- }
-
- /**
- * Returns
- * cd TEST
- * ../../../../build/solaris-sparc/bin/java AutoMulti ../../../../src/share/classes/javax/swing/plaf javax
- *
- *
- * AutoMulti will scour the plaf directory for *UI.java files and
- * generate Multi*UI.java files that do the multiplexing thing.
- * " + className + "s.\n");
- s.append(" * \n");
- s.append(" * createUI, and can be obtained by calling\n");
- s.append(" * the getUIs method. The first element is guaranteed to be the real UI \n");
- s.append(" * obtained from the default look and feel.\n");
- s.append(" */\n");
- s.append(" protected Vector uis = new Vector();\n");
- s.append("\n");
- s.append("////////////////////\n");
- s.append("// Common UI methods\n");
- s.append("////////////////////\n");
- s.append("\n");
- s.append(" /**\n");
- s.append(" * Returns the list of UIs associated with this multiplexing UI. This \n");
- s.append(" * allows processing of the UIs by an application aware of multiplexing \n");
- s.append(" * UIs on components.\n");
- s.append(" */\n");
- s.append(" public ComponentUI[] getUIs() {\n");
- s.append(" return MultiLookAndFeel.uisToArray(uis);\n");
- s.append(" }\n");
- }
-
- /**
- * Prints out the code for a method. This is pretty specific to the
- * Multiplexing UI code, so don't get any fancy ideas.
- */
- public static void addMethod(StringBuffer s, Method m, String origName, String className) {
-
- // Get the method name and the return type. Be a little careful about arrays.
- //
- String methodName = unqualifyName(m.getName());
- String returnType;
- if (!m.getReturnType().isArray()) {
- returnType = unqualifyName(m.getReturnType().toString());
- addImport(importLines,m.getReturnType());
- } else {
- returnType = unqualifyName(m.getReturnType().getComponentType().toString())
- + "[]";
- addImport(importLines,m.getReturnType().getComponentType());
- }
-
- // Print the javadoc
- //
- s.append("\n");
- if (methodName.equals("createUI")) {
- s.append(" /**\n");
- s.append(" * Returns a multiplexing UI instance if any of the auxiliary\n");
- s.append(" * LookAndFeels supports this UI. Otherwise, just returns the \n");
- s.append(" * UI object obtained from the default LookAndFeel.\n");
- s.append(" */\n");
- } else if (!returnType.equals("void")) {
- s.append(" /**\n");
- s.append(" * Invokes the " + methodName + " method on each UI handled by this object.\n");
- s.append(" * \n");
- s.append(" * @return the value obtained from the first UI, which is\n");
- s.append(" * the UI obtained from the default LookAndFeel\n");
- s.append(" */\n");
- } else {
- s.append(" /**\n");
- s.append(" * Invokes the " + methodName
- + " method on each UI handled by this object.\n");
- s.append(" */\n");
- }
-
- // Print the method signature
- //
- s.append(" public");
- if (Modifier.isStatic(m.getModifiers())) {
- s.append(" static");
- }
- s.append(" " + returnType);
- s.append(" " + methodName);
- s.append("(");
-
- Class[] params = m.getParameterTypes();
- Class temp;
- String braces;
- for (int i = 0; i < params.length; i++) {
- if (i > 0) {
- s.append(", ");
- }
- temp = params[i];
- braces = new String("");
- while (temp.isArray()) {
- braces += "[]";
- temp = temp.getComponentType();
- }
- s.append(unqualifyName(temp.getName()) + braces + " " + paramNames[i]);
- addImport(importLines,temp);
- }
- s.append(")");
-
- // Don't forget about exceptions
- //
- Class exceptions[] = m.getExceptionTypes();
- String throwsString = new String("");
-
- if (exceptions.length > 0) {
- s.append("\n");
- indent(s,12);
- s.append("throws ");
- for (int i = 0; i < exceptions.length; i++) {
- if (i > 0) {
- s.append(", ");
- }
- s.append(unqualifyName(exceptions[i].getName()));
- addImport(importLines,exceptions[i]);
- }
- }
- s.append(throwsString + " {\n");
-
- // Now print out the contents of the method. We do a special thing
- // for the createUI method, another thing if the method returns 'void'
- // and a third thing if we don't do either of the first two. If
- // you want to squash this down, feel free.
- //
- if (methodName.equals("createUI")) {
- indent(s,8);
- s.append("ComponentUI mui = new Multi" + origName + "();\n");
- indent(s,8);
- s.append("return MultiLookAndFeel.createUIs(mui,\n");
- indent(s,42);
- s.append("((Multi" + origName +") mui).uis,\n");
- indent(s,42);
- for (int i = 0; i < params.length; i++) {
- if (i > 0) {
- s.append(",");
- }
- s.append(paramNames[i]);
- }
- s.append(");\n");
- } else if (!returnType.equals("void")) {
- indent(s,8);
- s.append(returnType + " returnValue = \n");
- indent(s,12);
- s.append("((" + className + ") (uis.elementAt(0)))."
- + methodName + "(");
- for (int i = 0; i < params.length; i++) {
- if (i > 0) {
- s.append(",");
- }
- s.append(paramNames[i]);
- }
- s.append(");\n");
- indent(s,8);
- s.append("for (int i = 1; i < uis.size(); i++) {\n");
- indent(s,12);
- s.append("((" + className + ") (uis.elementAt(i)))."
- + methodName + "(");
- for (int i = 0; i < params.length; i++) {
- if (i > 0) {
- s.append(",");
- }
- s.append(paramNames[i]);
- }
- s.append(");\n");
- indent(s,8);
- s.append("}\n");
- indent(s,8);
- s.append("return returnValue;\n");
- } else {
- indent(s,8);
- s.append("for (int i = 0; i < uis.size(); i++) {\n");
- indent(s,12);
- s.append("((" + className + ") (uis.elementAt(i)))."
- + methodName + "(");
- for (int i = 0; i < params.length; i++) {
- if (i > 0) {
- s.append(",");
- }
- s.append(paramNames[i]);
- }
- s.append(");\n");
- indent(s,8);
- s.append("}\n");
- }
- indent(s,4);
- s.append("}\n");
- }
-
- /**
- * Takes a plaf class name (e.g., "MenuUI") and generates the corresponding
- * Multiplexing UI Java source code (e.g., "MultiMenuUI.java").
- */
- public static void generateFile(String prefixName, String className) {
- try {
- FileOutputStream fos;
- PrintWriter outFile;
-
- importLines = new String();
- importLines += new String("import java.util.Vector;\n");
-
- StringBuffer body = new StringBuffer();
- Class wee = Class.forName(prefixName + ".swing.plaf." + className);
- String weeName = unqualifyName(wee.getName());
- addImport(importLines,wee);
- while (!weeName.equals("Object")) {
- body.append("\n");
- body.append("////////////////////\n");
- body.append("// " + weeName + " methods\n");
- body.append("////////////////////\n");
- Method[] methods = wee.getDeclaredMethods();
- for (int i=0; i < methods.length; i++) {
- if (Modifier.isPublic(methods[i].getModifiers())) {
- addMethod(body,methods[i],className,weeName);
- }
- }
- wee = wee.getSuperclass();
- weeName = unqualifyName(wee.getName());
- addImport(importLines,wee);
- }
-
- fos = new FileOutputStream("Multi" + className + ".java");
- outFile = new PrintWriter(fos);
- StringBuffer outText = createPreamble(prefixName);
- outText.append(importLines.toString() + "\n");
- addHeader(outText,className);
- outText.append(body.toString());
- outText.append("}\n");
- outFile.write(outText.toString());
- outFile.flush();
- outFile.close();
- } catch (Exception e) {
- System.err.println(e);
- }
- }
-
- /**
- * D'Oh! Something bad happened.
- */
- public static void usage(String s) throws IOException {
- System.err.println("Usage: AutoMulti
- * ../../../../build/solaris-sparc/bin/java TestALFGenerator ../../../../src/share/classes/javax/swing/plaf com.myco.myalaf
- *
- *
- * TestALFGenerator will scour the plaf directory for *UI.java files and
- * generate TestALF*UI.java files.
- * " + className + "s.\n");
- s.append(" * \n");
- s.append(" * false;
- * this look and feel is not native to any platform.
- *
- * @return false
- */
- public boolean isNativeLookAndFeel() {
- return false;
- }
-
- /**
- * Returns true;
- * every platform permits this look and feel.
- *
- * @return true
- */
- public boolean isSupportedLookAndFeel() {
- return true;
- }
-
- /**
- * Creates, initializes, and returns
- * the look and feel specific defaults.
- * For this look and feel,
- * the defaults consist solely of
- * mappings of UI class IDs
- * (such as "ButtonUI")
- * to ComponentUI class names
- * (such as "com.myco.myalaf.MultiButtonUI").
- *
- * @return an initialized UIDefaults object
- * @see javax.swing.JComponent#getUIClassID
- */
- public UIDefaults getDefaults() {
- System.out.println("In the TestALFLookAndFeel getDefaults method.");
- UIDefaults table = new TestALFUIDefaults();
- //String prefix = "com.myco.myalaf.TestALF";
- String prefix = "TestALF";
- Object[] uiDefaults = {
- "ButtonUI", prefix + "ButtonUI",
- "CheckBoxMenuItemUI", prefix + "MenuItemUI",
- "CheckBoxUI", prefix + "ButtonUI",
- "ColorChooserUI", prefix + "ColorChooserUI",
- "ComboBoxUI", prefix + "ComboBoxUI",
- "DesktopIconUI", prefix + "DesktopIconUI",
- "DesktopPaneUI", prefix + "DesktopPaneUI",
- "EditorPaneUI", prefix + "TextUI",
- "FileChooserUI", prefix + "FileChooserUI",
- "FormattedTextFieldUI", prefix + "TextUI",
- "InternalFrameUI", prefix + "InternalFrameUI",
- "LabelUI", prefix + "LabelUI",
- "ListUI", prefix + "ListUI",
- "MenuBarUI", prefix + "MenuBarUI",
- "MenuItemUI", prefix + "MenuItemUI",
- "MenuUI", prefix + "MenuItemUI",
- "OptionPaneUI", prefix + "OptionPaneUI",
- "PanelUI", prefix + "PanelUI",
- "PasswordFieldUI", prefix + "TextUI",
- "PopupMenuSeparatorUI", prefix + "SeparatorUI",
- "PopupMenuUI", prefix + "PopupMenuUI",
- "ProgressBarUI", prefix + "ProgressBarUI",
- "RadioButtonMenuItemUI", prefix + "MenuItemUI",
- "RadioButtonUI", prefix + "ButtonUI",
- "RootPaneUI", prefix + "RootPaneUI",
- "ScrollBarUI", prefix + "ScrollBarUI",
- "ScrollPaneUI", prefix + "ScrollPaneUI",
- "SeparatorUI", prefix + "SeparatorUI",
- "SliderUI", prefix + "SliderUI",
- "SpinnerUI", prefix + "SpinnerUI",
- "SplitPaneUI", prefix + "SplitPaneUI",
- "TabbedPaneUI", prefix + "TabbedPaneUI",
- "TableHeaderUI", prefix + "TableHeaderUI",
- "TableUI", prefix + "TableUI",
- "TextAreaUI", prefix + "TextUI",
- "TextFieldUI", prefix + "TextUI",
- "TextPaneUI", prefix + "TextUI",
- "ToggleButtonUI", prefix + "ButtonUI",
- "ToolBarSeparatorUI", prefix + "SeparatorUI",
- "ToolBarUI", prefix + "ToolBarUI",
- "ToolTipUI", prefix + "ToolTipUI",
- "TreeUI", prefix + "TreeUI",
- "ViewportUI", prefix + "ViewportUI",
- };
-
- table.putDefaults(uiDefaults);
- return table;
- }
-
-}
-
-/**
- * We want the Test auxiliary look and feel to be quiet and fallback
- * gracefully if it cannot find a UI. This class overrides the
- * getUIError method of UIDefaults, which is the method that
- * emits error messages when it cannot find a UI class in the
- * LAF.
- */
-class TestALFUIDefaults extends UIDefaults {
- protected void getUIError(String msg) {
- System.err.println("Test auxiliary L&F: " + msg);
- }
-}