diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist deleted file mode 100644 index ed985848da..0000000000 --- a/CVSROOT/checkoutlist +++ /dev/null @@ -1,18 +0,0 @@ -# The "checkoutlist" file is used to support additional version controlled -# administrative files in $CVSROOT/CVSROOT, such as template files. -# -# The first entry on a line is a filename which will be checked out from -# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -# The remainder of the line is an error message to use if the file cannot -# be checked out. -# -# File format: -# -# [] -# -# comment lines begin with '#' -passwd -log_accum.conf -dctrigger.rbdctrigger.rb -dctrigger.rb -dctrigger.rb diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo deleted file mode 100644 index b19e7b7a63..0000000000 --- a/CVSROOT/commitinfo +++ /dev/null @@ -1,15 +0,0 @@ -# The "commitinfo" file is used to control pre-commit checks. -# The filter on the right is invoked with the repository and a list -# of files to check. A non-zero exit of the filter program will -# cause the commit to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/damagecontrol-groovy.conf b/CVSROOT/damagecontrol-groovy.conf deleted file mode 100644 index 623fc62272..0000000000 --- a/CVSROOT/damagecontrol-groovy.conf +++ /dev/null @@ -1,5 +0,0 @@ -project_name: Groovy -scm_spec: ":ext:dcontrol@localhost:/home/projects/groovy/scm:groovy/groovy-core" -build_command_line: "maven dc" -nag_email: groovy-dev@groovy.codehaus.org -... \ No newline at end of file diff --git a/CVSROOT/dctrigger.rb b/CVSROOT/dctrigger.rb deleted file mode 100644 index a6545a5cf9..0000000000 --- a/CVSROOT/dctrigger.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'xmlrpc/client' - -url = ARGV[0] -project_name = ARGV[1] - -puts "Nudging DamageControl on #{url} to build project #{project_name}" -client = XMLRPC::Client.new2(url) -build = client.proxy("build") -result = build.trig(project_name, Time.now.utc.strftime("%Y%m%d%H%M%S")) -puts result diff --git a/CVSROOT/editinfo b/CVSROOT/editinfo deleted file mode 100644 index d78886c152..0000000000 --- a/CVSROOT/editinfo +++ /dev/null @@ -1,21 +0,0 @@ -# The "editinfo" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/CVSROOT/log_accum.conf b/CVSROOT/log_accum.conf deleted file mode 100644 index 6343eb0eb9..0000000000 --- a/CVSROOT/log_accum.conf +++ /dev/null @@ -1,83 +0,0 @@ -# The "log_accum.conf" file overrides the the defaults hard-coded in -# the "log_accum.pl" script allowing admins to setup the log_accum.pl -# once as executable, but not writable. Each project can then have -# it's own "log_accum.conf" to configure the behaviour of their own -# cvs commit messages. - - -# MAIL TO -# -# When set, specifies the email address(es) to -# receive commit messages. When left unset, the -# script will attempt to guess the correct -# mailing list using the repository name and -# the MLISTHOST option. -# -MAIL_TO = scm@groovy.codehaus.org - -# MAIL FROM -# -# When set, specifies the email address that -# all commit messages will be sent from. -# Very usefull for setting up a "no reply" -# address for commit messages. -# -# When not set, the script will guess the sender's -# address by prefixing the cvs user's name to the -# MLISTHOST option. -# -#MAIL_FROM = noreply@codehaus.org - -# MAIL HOST ADDRESS -# -# The host address to use when guessing either -# the TO or FROM addresses. -#MLISTHOST = codehaus.org - -# X-SENDER EMAIL HEADER -# -# When specified, adds an X-Sender header to the -# emails sent so that users can use it to more -# easily filter out cvs messages. This is very -# nice for when there is no mailing list -# dedicated to cvs commit messages. -# -XSENDER = Groovy-CVS - -# REPLY-TO EMAIL ADDRESS -# -# When REPLYTO is set an SMTP "Reply-To" email -# header will be added. This is very useful -# for keeping development discussion on a -# dev list even when cvs messages go a cvs list. -# -REPLYTO = dev@groovy.codehaus.org - -# SUBJECT PREFIX -# -# This text, plus a space, will be prepended -# to the subject line of the commit message. -# When the option specified with no value, no -# prefix will be used. -# -SUBJECT_PREFIX = - -# MESSAGE SIZE LIMIT -# -# If the delta info exceeds this threshold, no diff will be -# mailed/logged; as a replacement for this, URLs pointing -# to the corresponding ViewCVS diffs will be constructed and -# included in the mail/log message. -# -# 0 = no treshold, unlimited diffs -# x = maximum size of the diff in kb -# -#SIZELIMIT = 100; - -# VIEWCVS URL -# -# Specify here the URL to ViewCVS (without trailing slash!) -# If left unset, the script will attempt to guess the correct -# value. -# -VIEWCVS = "http://cvs.groovy.codehaus.org/groovy"; diff --git a/CVSROOT/modules b/CVSROOT/modules deleted file mode 100644 index cb9e9efc94..0000000000 --- a/CVSROOT/modules +++ /dev/null @@ -1,26 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. diff --git a/CVSROOT/notify b/CVSROOT/notify deleted file mode 100644 index 74ae6f9e9a..0000000000 --- a/CVSROOT/notify +++ /dev/null @@ -1,12 +0,0 @@ -# The "notify" file controls where notifications from watches set by -# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -# a regular expression which is tested against the directory that the -# change is being made to, relative to the $CVSROOT. If it matches, -# then the remainder of the line is a filter program that should contain -# one occurrence of %s for the user to notify, and information on its -# standard input. -# -# "ALL" or "DEFAULT" can be used in place of the regular expression. -# -# For example: -#ALL mail -s "CVS notification" %s diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo deleted file mode 100644 index 49e59f4d0d..0000000000 --- a/CVSROOT/rcsinfo +++ /dev/null @@ -1,13 +0,0 @@ -# The "rcsinfo" file is used to control templates with which the editor -# is invoked on commit and import. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being made to, relative to the -# $CVSROOT. For the first match that is found, then the remainder of the -# line is the name of the file that contains the template. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo deleted file mode 100644 index 274a46dd5b..0000000000 --- a/CVSROOT/taginfo +++ /dev/null @@ -1,20 +0,0 @@ -# The "taginfo" file is used to control pre-tag checks. -# The filter on the right is invoked with the following arguments: -# -# $1 -- tagname -# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -# $3 -- repository -# $4-> file revision [file revision ...] -# -# A non-zero exit of the filter program will cause the tag to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg deleted file mode 100644 index 86f747ce22..0000000000 --- a/CVSROOT/verifymsg +++ /dev/null @@ -1,21 +0,0 @@ -# The "verifymsg" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/groovy/groovy-native/README b/groovy/groovy-native/README deleted file mode 100644 index 9049c270e7..0000000000 --- a/groovy/groovy-native/README +++ /dev/null @@ -1,120 +0,0 @@ -This is a proof-of-concept for compiling Groovy to native code. - -Goals: - - Better performance / reduced overheads (cpu, memory, start-up time). - - Appealing alternative to Perl/Python/Ruby/shell-scripts. - - Simple install (src tarball, RPM, dpkg, windows installer, OS-X whatever). - - No JVM required. - - Ability to use Groovy to access less Javaish libraries (POSIXy stuff, MFC, .NET). - - Ability to use Groovy (and Java) objects from other languages (C, C++, Perl, Python, Ruby, .NET, etc) - -WARNING: This is an experiment. It's a proof-of-concept. It probably won't work. But maybe it will. - -The first attempt at this package uses the GNU GCJ compiler. This is built on top of GCC and is -available for UNIXy platforms (including Linux and OS-X) and Windows (with Cygwin). - -These are the first set of goals for the experiment. - - - -*** Goal 1 : Native standalone executable of .groovy file. -[Complete] - -The existing Groovy compiler (running on a JVM) can compile .groovy files to .class files. -GCJ can then compile these .class files to .o binary objects. -GCJ can link these objects (together with a native version of the Groovy runtime library) into a -native executable. - -The challenge is building the native runtime library. In particular, identifying if the runtime -byte-code generation, custom class-loaders and dynamic proxies will cause problems when moved to -native code. - -Certain features of the Groovy language may be excluded to meet this goal and a JVM is still -required at build time. - - - -*** Goal 2 : Native Groovy libraries. -[In progress] - -Compile a collection of .groovy files into a .so that can be linked to from other Groovy or native -libraries. - -Provide samples for Groovy, C and C++ apps all linking to another Groovy library. - - - -*** Goal 3 : Native .groovy compiler. -[Not started] - -The actual Groovy compiler should be native (as well as the runtime) allowing Groovy to be developed -entirely without a JVM present. - - - -*** Goal 4 : Usable tool set. -[In progress] - -A set of simple wrapper tools should be provided for common features: - - Compiling and linking a Groovy library or standalone executable. - - JIT style interpreter (like Python) that runs a Groovy script directly by recompiling if necessary. - - #!/usr/local/bin/groovy style declaration for scripts allowing direct invocation. - - - -*** Goal 5 : Runtime interpreter. -[Not started] - -Allow Groovy snippets to be evaluated dynamically at runtime (the functionality of GroovyClassLoader). -This could get tricky. - - - -*** Goal 6 : Complete language features. -[Not started] - -Get all the unit tests running on the native Groovy. This excludes Java specific extras such as JMS -and Servlets. - - - -*** Goal 7 : Installation bundle. -[Not started] - -Provide a UNIX installation bundle that contains scripts and instructions for getting native Groovy -running on a machine. - - - -*** Goal 8 : Optimizations. -[Not started] - -Profile code to see how it can be made snappier. Especially important is the startup time. A plain -GCJ compiled Java file starts within <50ms, whereas Groovy is taking much longer. - - - -*** Goal 9 : Provide Groovy with simple access to native libraries. -[Not started] - -Extend the Groovy library and build tools to allow easy access to code outside of Groovy/Java from -Groovy classes. - -Something like: - -import ncurses // use libncurses/ncurses.h -class Thingy { - void doStuff(name) { - ncurses.printw("Hello ${name}") // print string - ncurses.refresh() // display it on screen - ncurses.getch() // wait for key press - } -} - - - - - - - -- Joe Walnes diff --git a/groovy/groovy-native/examples/001-standalone-executable/README b/groovy/groovy-native/examples/001-standalone-executable/README deleted file mode 100644 index fefdd4d018..0000000000 --- a/groovy/groovy-native/examples/001-standalone-executable/README +++ /dev/null @@ -1,15 +0,0 @@ -Read README in parent directory first. And read the README in the grand-parent directory -before that! Seriously, it's important! - - - -This demo simply compiles a single Simple.groovy class into a native executable that can -be invoked using ./Simple - -Steps: - * Read the other README files. - * ./build.sh - * ./Simple - - -- Joe Walnes diff --git a/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy b/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy deleted file mode 100644 index b67e0d3e04..0000000000 --- a/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy +++ /dev/null @@ -1,19 +0,0 @@ -class Simple { - doSomething() { - data = ["name": "James", "location": "London"] - for (e in data) { - println("entry ${e.key} is ${e.value}") - } - } - - closureExample(collection) { - collection.each { println("value ${it}") } - } - - static void main(args) { - values = [1, 2, 3, "abc", "moo"] - foo = new Simple() - foo.closureExample(values) - foo.doSomething() - } -} diff --git a/groovy/groovy-native/examples/001-standalone-executable/build.sh b/groovy/groovy-native/examples/001-standalone-executable/build.sh deleted file mode 100644 index e1ca0b147a..0000000000 --- a/groovy/groovy-native/examples/001-standalone-executable/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -$GROOVY_HOME/bin/groovyc Simple.groovy -CLASSPATH=../../libgroovy/libgroovy.jar gcj --main=Simple -o Simple -L../../libgroovy -lgroovy *.class -rm -rf *.class - diff --git a/groovy/groovy-native/examples/README b/groovy/groovy-native/examples/README deleted file mode 100644 index a01ddda7dd..0000000000 --- a/groovy/groovy-native/examples/README +++ /dev/null @@ -1,16 +0,0 @@ -These are the examples for libgroovy. If you don't know what I'm talking about, read -the README in the parent directory. - -Before running any of the examples: - * Build libgroovy (instructions in libgroovy directory). - * Set GROOVY_HOME to wherever Groovy may reside. - * Append the libgroovy directory to LD_LIBRARY_PATH if not already present. - - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/groovy-native/libgroovy - -The example directory names are prefixed with a number so you can step through the -examples in a logical order. - - -- Joe Walnes - diff --git a/groovy/groovy-native/libgroovy/README b/groovy/groovy-native/libgroovy/README deleted file mode 100644 index 0314b9d48f..0000000000 --- a/groovy/groovy-native/libgroovy/README +++ /dev/null @@ -1,59 +0,0 @@ -See README in parent directory before reading on. - -Okay, so now you know what this is all about. - - - -*** Introduction - -libgroovy is the core native Groovy library for runtime use. Any Groovy application -requires this library (and the standard libgcj libraries) to run. - -libgroovy only contains a subset of the standard Groovy library. Currently it only -runs basic Groovy scripts. - -You may notice that there are no actual source files here. This is because libgroovy -is built from the Java source files from Groovy. The source files for the Java ASM -library are also required. - - - -*** Building the library. - -This library currently only compiles on UNIX. - -You need: - - JDK. - - GCJ. - - The Java source for Groovy and ASM. - - Bash. - -Edit build.sh and set the appropriate variables at the top of the script. - -./build.sh -(may take some time and generate a collection of warnings - but hopefully no errors). - -If all goes to plan, you should end up with libgroovy.so and libgroovy.jar in the current -directory. - - - -*** Notes on how the library is built. - -The stripped down library only tries to compile the classes listed in groovy-src and asm-src. - -Certain tweaks needed to be made to get the source to compile as GCJ only partially supports -the J2SE1.4 library. Rather than modify the Groovy source, build.sh patches the source using -patch.diff to get the code to compile (although nobbling some features in doing so). - - - -*** How to use the library. - -Coming soon. In the mean time, look at one of the examples. - - - -- Joe Walnes - - diff --git a/groovy/groovy-native/libgroovy/asm-src b/groovy/groovy-native/libgroovy/asm-src deleted file mode 100644 index e89f128638..0000000000 --- a/groovy/groovy-native/libgroovy/asm-src +++ /dev/null @@ -1,10 +0,0 @@ -org/objectweb/asm/ClassVisitor.java -org/objectweb/asm/ClassWriter.java -org/objectweb/asm/CodeVisitor.java -org/objectweb/asm/Constants.java -org/objectweb/asm/CodeWriter.java -org/objectweb/asm/Edge.java -org/objectweb/asm/Item.java -org/objectweb/asm/Label.java -org/objectweb/asm/Type.java -org/objectweb/asm/ByteVector.java diff --git a/groovy/groovy-native/libgroovy/build.sh b/groovy/groovy-native/libgroovy/build.sh deleted file mode 100644 index fd1be84e63..0000000000 --- a/groovy/groovy-native/libgroovy/build.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# Ensure these paths are correct - -#JAVA_HOME=/usr/local/java -GROOVY_HOME=~/groovy-1.0-beta-2 -GROOVY_SRC=$GROOVY_HOME/src/main -ASM_SRC=~/ASM/dev/src - -# End of paths - - - - -BUILD_DIR=build -LIB_NAME=groovy - -rm -rf $BUILD_DIR lib$LIB_NAME.{jar,so} -mkdir -p $BUILD_DIR - -BASE_DIR=`pwd` -cd $BUILD_DIR -BUILD_DIR=`pwd` -cd $BASE_DIR - -# Copy mimimum required source files to temp directory -(cd $GROOVY_SRC && cp --parents `grep -v '#' $BASE_DIR/groovy-src` $BUILD_DIR) -(cd $ASM_SRC && cp --parents `grep -v '#' $BASE_DIR/asm-src` $BUILD_DIR) - -# Patch the source files -patch --silent -f -p0 -d $BUILD_DIR < patch.diff - -# .java -> .class -find $BUILD_DIR -name \*.java | xargs gcj -C - -# .class -> .jar -jar -cf lib$LIB_NAME.jar -C $BUILD_DIR . - -# .class -> .so -gcj -shared -o lib$LIB_NAME.so lib$LIB_NAME.jar - -# clean up -rm -rf $BUILD_DIR - diff --git a/groovy/groovy-native/libgroovy/groovy-src b/groovy/groovy-native/libgroovy/groovy-src deleted file mode 100644 index 0030e97725..0000000000 --- a/groovy/groovy-native/libgroovy/groovy-src +++ /dev/null @@ -1,128 +0,0 @@ -groovy/lang/Closure.java -groovy/lang/ClosureException.java -groovy/lang/GString.java -groovy/lang/GroovyClassLoader.java -groovy/lang/GroovyLog.java -groovy/lang/GroovyObject.java -groovy/lang/GroovyObjectSupport.java -groovy/lang/GroovyShell.java -groovy/lang/IntRange.java -groovy/lang/MetaClass.java -groovy/lang/MetaClassRegistry.java -groovy/lang/NonEmptySequence.java -groovy/lang/ObjectRange.java -groovy/lang/Range.java -groovy/lang/Reference.java -groovy/lang/Script.java -groovy/lang/ScriptContext.java -groovy/lang/Sequence.java -groovy/lang/Tuple.java -groovy/util/Bitwise.java -groovy/util/BuilderSupport.java -groovy/util/ClosureComparator.java -groovy/util/IndentPrinter.java -groovy/util/MapEntry.java -groovy/util/Node.java -groovy/util/NodeBuilder.java -groovy/util/NodePrinter.java -groovy/util/OrderBy.java -org/codehaus/groovy/GroovyException.java -org/codehaus/groovy/ast/ASTNode.java -org/codehaus/groovy/ast/ClassNode.java -org/codehaus/groovy/ast/CodeVisitorSupport.java -org/codehaus/groovy/ast/CompileUnit.java -org/codehaus/groovy/ast/ConstructorNode.java -org/codehaus/groovy/ast/FieldNode.java -org/codehaus/groovy/ast/GroovyClassVisitor.java -org/codehaus/groovy/ast/GroovyCodeVisitor.java -org/codehaus/groovy/ast/InnerClassNode.java -org/codehaus/groovy/ast/MetadataNode.java -org/codehaus/groovy/ast/MethodNode.java -org/codehaus/groovy/ast/MixinNode.java -org/codehaus/groovy/ast/ModuleNode.java -org/codehaus/groovy/ast/Parameter.java -org/codehaus/groovy/ast/PropertyNode.java -org/codehaus/groovy/ast/expr/ArgumentListExpression.java -org/codehaus/groovy/ast/expr/ArrayExpression.java -org/codehaus/groovy/ast/expr/BinaryExpression.java -org/codehaus/groovy/ast/expr/BooleanExpression.java -org/codehaus/groovy/ast/expr/ClassExpression.java -org/codehaus/groovy/ast/expr/ClosureExpression.java -org/codehaus/groovy/ast/expr/ConstantExpression.java -org/codehaus/groovy/ast/expr/ConstructorCallExpression.java -org/codehaus/groovy/ast/expr/Expression.java -org/codehaus/groovy/ast/expr/FieldExpression.java -org/codehaus/groovy/ast/expr/GStringExpression.java -org/codehaus/groovy/ast/expr/ListExpression.java -org/codehaus/groovy/ast/expr/MapEntryExpression.java -org/codehaus/groovy/ast/expr/MapExpression.java -org/codehaus/groovy/ast/expr/MethodCallExpression.java -org/codehaus/groovy/ast/expr/NamedArgumentListExpression.java -org/codehaus/groovy/ast/expr/NotExpression.java -org/codehaus/groovy/ast/expr/PostfixExpression.java -org/codehaus/groovy/ast/expr/PrefixExpression.java -org/codehaus/groovy/ast/expr/PropertyExpression.java -org/codehaus/groovy/ast/expr/RangeExpression.java -org/codehaus/groovy/ast/expr/RegexExpression.java -org/codehaus/groovy/ast/expr/StaticMethodCallExpression.java -org/codehaus/groovy/ast/expr/TupleExpression.java -org/codehaus/groovy/ast/expr/VariableExpression.java -org/codehaus/groovy/ast/stmt/AssertStatement.java -org/codehaus/groovy/ast/stmt/BlockStatement.java -org/codehaus/groovy/ast/stmt/BreakStatement.java -org/codehaus/groovy/ast/stmt/CaseStatement.java -org/codehaus/groovy/ast/stmt/CatchStatement.java -org/codehaus/groovy/ast/stmt/ContinueStatement.java -org/codehaus/groovy/ast/stmt/DoWhileStatement.java -org/codehaus/groovy/ast/stmt/EmptyStatement.java -org/codehaus/groovy/ast/stmt/ExpressionStatement.java -org/codehaus/groovy/ast/stmt/ForStatement.java -org/codehaus/groovy/ast/stmt/IfStatement.java -org/codehaus/groovy/ast/stmt/ReturnStatement.java -org/codehaus/groovy/ast/stmt/Statement.java -org/codehaus/groovy/ast/stmt/SwitchStatement.java -org/codehaus/groovy/ast/stmt/SynchronizedStatement.java -org/codehaus/groovy/ast/stmt/ThrowStatement.java -org/codehaus/groovy/ast/stmt/TryCatchStatement.java -org/codehaus/groovy/ast/stmt/WhileStatement.java -org/codehaus/groovy/classgen/ClassGenerator.java -org/codehaus/groovy/classgen/ClassGeneratorException.java -org/codehaus/groovy/classgen/VariableScopeCodeVisitor.java -org/codehaus/groovy/classgen/CompilerFacade.java -org/codehaus/groovy/classgen/GeneratorContext.java -org/codehaus/groovy/classgen/MethodCaller.java -org/codehaus/groovy/classgen/Variable.java -org/codehaus/groovy/classgen/Verifier.java -org/codehaus/groovy/classgen/VerifierCodeVisitor.java -org/codehaus/groovy/runtime/ClassExtender.java -org/codehaus/groovy/runtime/DefaultGroovyMethods.java -org/codehaus/groovy/runtime/Invoker.java -org/codehaus/groovy/runtime/InvokerException.java -org/codehaus/groovy/runtime/InvokerHelper.java -org/codehaus/groovy/runtime/InvokerInvocationException.java -org/codehaus/groovy/runtime/IteratorClosureAdapter.java -org/codehaus/groovy/runtime/MethodClosure.java -org/codehaus/groovy/runtime/MethodHelper.java -org/codehaus/groovy/runtime/NoSuchClassException.java -org/codehaus/groovy/runtime/NoSuchMethodException.java -org/codehaus/groovy/runtime/NoSuchPropertyException.java -org/codehaus/groovy/syntax/AbstractTokenStream.java -org/codehaus/groovy/syntax/LookAheadExhaustionException.java -org/codehaus/groovy/syntax/SyntaxException.java -org/codehaus/groovy/syntax/Token.java -org/codehaus/groovy/syntax/TokenStream.java -org/codehaus/groovy/syntax/TokenMismatchException.java -org/codehaus/groovy/syntax/lexer/AbstractCharStream.java -org/codehaus/groovy/syntax/lexer/CharStream.java -org/codehaus/groovy/syntax/lexer/InputStreamCharStream.java -org/codehaus/groovy/syntax/lexer/Lexer.java -org/codehaus/groovy/syntax/lexer/LexerTokenStream.java -org/codehaus/groovy/syntax/lexer/UnexpectedCharacterException.java -org/codehaus/groovy/syntax/lexer/LexerException.java -org/codehaus/groovy/syntax/lexer/UnterminatedStringLiteralException.java -org/codehaus/groovy/syntax/parser/ASTBuilder.java -org/codehaus/groovy/syntax/parser/CSTNode.java -org/codehaus/groovy/syntax/parser/UnexpectedTokenException.java -org/codehaus/groovy/syntax/parser/ParserException.java -org/codehaus/groovy/syntax/parser/Parser.java -org/codehaus/groovy/syntax/lexer/StringCharStream.java diff --git a/groovy/groovy-native/libgroovy/patch.diff b/groovy/groovy-native/libgroovy/patch.diff deleted file mode 100644 index 68b0bce4bd..0000000000 --- a/groovy/groovy-native/libgroovy/patch.diff +++ /dev/null @@ -1,82 +0,0 @@ ---- org/codehaus/groovy/runtime/Invoker.java 2004-01-06 16:37:49.000000000 +0000 -+++ org/codehaus/groovy/runtime/Invoker.java 2004-01-06 16:38:46.000000000 +0000 -@@ -62,8 +62,6 @@ - import java.util.regex.Matcher; - import java.util.regex.Pattern; - --import com.mockobjects.util.NotImplementedException; -- - /** - * A helper class to invoke methods or extract properties on arbitrary Java objects dynamically - * -@@ -244,7 +242,7 @@ - return matcher.group(); - } - public void remove() { -- throw new NotImplementedException(); -+ throw new UnsupportedOperationException(); - } - }; - } ---- ./org/codehaus/groovy/runtime/InvokerHelper.java.orig 2004-01-06 17:13:41.000000000 +0000 -+++ ./org/codehaus/groovy/runtime/InvokerHelper.java 2004-01-06 17:14:24.000000000 +0000 -@@ -170,7 +170,7 @@ - } - else if (object instanceof Matcher) { - Matcher matcher = (Matcher) object; -- return matcher.find(); -+ throw new UnsupportedOperationException("Matcher.find()"); - } - else if (object instanceof Collection) { - Collection collection = (Collection) object; ---- ./org/codehaus/groovy/runtime/Invoker.java.orig 2004-01-06 17:14:52.000000000 +0000 -+++ ./org/codehaus/groovy/runtime/Invoker.java 2004-01-06 17:17:41.000000000 +0000 -@@ -227,8 +227,7 @@ - public boolean hasNext() { - if (done) return false; - if (!found) { -- found = matcher.find(); -- if (!found) done = true; -+ throw new UnsupportedOperationException("Matcher.find()"); - } - return found; - } -@@ -239,7 +238,7 @@ - } - } - found = false; -- return matcher.group(); -+ throw new UnsupportedOperationException("Matcher.group()"); - } - public void remove() { - throw new UnsupportedOperationException(); -@@ -485,7 +484,7 @@ - pattern = Pattern.compile(toString(right)); - } - String stringToCompare = toString(left); -- return pattern.matcher(stringToCompare).matches(); -+ throw new UnsupportedOperationException("Matcher"); - } - - /** ---- ./org/codehaus/groovy/runtime/DefaultGroovyMethods.java.orig 2004-01-06 17:18:17.000000000 +0000 -+++ ./org/codehaus/groovy/runtime/DefaultGroovyMethods.java 2004-01-06 17:19:36.000000000 +0000 -@@ -221,7 +221,7 @@ - } - - public static boolean isCase(Pattern caseValue, Object switchValue) { -- return caseValue.matcher(switchValue.toString()).matches(); -+ throw new UnsupportedOperationException("Matcher.matches()"); - } - - // Collection based methods -@@ -850,8 +850,7 @@ - } - - public static String minus(String left, Object value) { -- String text = toString(value); -- return left.replaceFirst(text, ""); -+ throw new UnsupportedOperationException("String.replaceFirst()"); - } - - public static String multiply(String self, Number factor) { diff --git a/groovy/modules/groovy-swt/.classpath b/groovy/modules/groovy-swt/.classpath deleted file mode 100644 index 59b1a8c9f3..0000000000 --- a/groovy/modules/groovy-swt/.classpath +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/groovy/modules/groovy-swt/.cvsignore b/groovy/modules/groovy-swt/.cvsignore deleted file mode 100644 index 4e1b955ef8..0000000000 --- a/groovy/modules/groovy-swt/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.log -target diff --git a/groovy/modules/groovy-swt/.project b/groovy/modules/groovy-swt/.project deleted file mode 100644 index 3842927fb4..0000000000 --- a/groovy/modules/groovy-swt/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - groovy-swt - groovy-swt - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/groovy/modules/groovy-swt/LICENSE.txt b/groovy/modules/groovy-swt/LICENSE.txt deleted file mode 100644 index 0f6cb237e1..0000000000 --- a/groovy/modules/groovy-swt/LICENSE.txt +++ /dev/null @@ -1,47 +0,0 @@ - - -/* - $Id$ - - Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved. - - Redistribution and use of this software and associated documentation - ("Software"), with or without modification, are permitted provided - that the following conditions are met: - - 1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - - 2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - - 3. The name "groovy" must not be used to endorse or promote - products derived from this Software without prior written - permission of The Codehaus. For written permission, - please contact info@codehaus.org. - - 4. Products derived from this Software may not be called "groovy" - nor may "groovy" appear in their names without prior written - permission of The Codehaus. "groovy" is a registered - trademark of The Codehaus. - - 5. Due credit should be given to The Codehaus - - http://groovy.codehaus.org/ - - THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OF THE POSSIBILITY OF SUCH DAMAGE. - - */ diff --git a/groovy/modules/groovy-swt/README.txt b/groovy/modules/groovy-swt/README.txt deleted file mode 100644 index 38b191df10..0000000000 --- a/groovy/modules/groovy-swt/README.txt +++ /dev/null @@ -1 +0,0 @@ -swt 3.0 libs are currently not on ibiblio. \ No newline at end of file diff --git a/groovy/modules/groovy-swt/maven.xml b/groovy/modules/groovy-swt/maven.xml deleted file mode 100644 index 21e448232f..0000000000 --- a/groovy/modules/groovy-swt/maven.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/groovy/modules/groovy-swt/project.properties b/groovy/modules/groovy-swt/project.properties deleted file mode 100644 index 9f423d2918..0000000000 --- a/groovy/modules/groovy-swt/project.properties +++ /dev/null @@ -1,46 +0,0 @@ -maven.compile.source=1.4 -maven.compile.target=1.4 -maven.test.source=1.4 -maven.compile.deprecation=true -maven.compile.debug=true -maven.compile.optimize=true - -maven.javadoc.links=http://java.sun.com/j2se/1.4.1/docs/api/ -maven.javadoc.source=1.4 - -maven.test.search.classdir = true - -maven.junit.fork=true -maven.junit.usefile=true - -groovy.install.staging.dest=${maven.build.dir}/install/ -maven.html2xdoc.dir=${maven.build.dir}/html - -maven.xdoc.date = left - -##################################################### -# codehaus theme -##################################################### -maven.xdoc.theme.url=http://codehaus.org/codehaus-style.css - -##################################################### -# Where the jars are uploaded -##################################################### -maven.repo.central = dist.codehaus.org -maven.repo.central.directory = /www/dist.codehaus.org - -#maven.repo.remote=http://www.ibiblio.org/maven -maven.repo.remote=http://dist.codehaus.org - - -##################################################### -# swt platform -# possible values, win32, linux-gtk, macosx -# -# for linux-gtk enable gtk deps in project.xml -##################################################### -platform=win32 -#platform=linux-gtk -#platform=macosx - - diff --git a/groovy/modules/groovy-swt/project.xml b/groovy/modules/groovy-swt/project.xml deleted file mode 100644 index acb831f99d..0000000000 --- a/groovy/modules/groovy-swt/project.xml +++ /dev/null @@ -1,175 +0,0 @@ - - 3 - groovy-swt - groovy-swt - groovy-swt - 0.2 - - The Codehaus - http://codehaus.org - http://codehaus.org/codehaus-small.gif - - 2004 - groovy.swt, groovy.jface - groovy-swt - http://groovy.codehaus.org/ - http://jira.codehaus.org/secure/BrowseProject.jspa?id=10242&report=roadmap - groovy.codehaus.org - /www/groovy.codehaus.org - - scm:cvs:pserver:anonymous@cvs.codehaus.org:/scm/cvspublic:groovy/modules/groovy-swt - scm:cvs:ext:${maven.username}@cvs.codehaus.org:/scm/cvspublic:groovy/modules/groovy-swt - http://cvs.groovy.codehaus.org/viewcvs.cgi/groovy/modules/groovy-swt - - - - - - - Christiaan ten Klooster - ckl - ckl@dacelo.nl - Dacelo WebDevelopment - - Developer - Founder - - - - - - asm - asm - 1.4.1 - jar - http://asm.objectweb.org/ - - - - asm - asm-util - 1.4.1 - jar - http://asm.objectweb.org/ - - - - asm - asm-attrs - 1.4.1 - jar - http://asm.objectweb.org/ - - - - commons-collections - commons-collections - 3.0 - jar - - - - commons-logging - commons-logging - 1.0.3 - jar - - - - groovy - groovy - 1.0-beta-5 - jar - - - - swt - swt-${platform} - 3.0 - jar - - - - swt - jface - 3.0 - jar - - - - swt - forms - 3.0 - jar - - - - swt - runtime - 3.0 - jar - - - - swt - osgi - 3.0 - jar - - - - junit - junit - 3.8.1 - jar - - - - - groovy-scm@lists.codehaus.org - src/main - src/test - - - **/*Test.* - **/*Bug.* - - - - src/test - - **/*.properties - **/*.xml - - false - - - - - - src/main - - **/*.properties - **/*.xml - - false - - - - - maven-license-plugin - maven-checkstyle-plugin - maven-pmd-plugin - maven-jdepend-plugin - maven-changelog-plugin - maven-file-activity-plugin - maven-developer-activity-plugin - maven-jxr-plugin - maven-javadoc-plugin - maven-junit-report-plugin - maven-faq-plugin - maven-clover-plugin - maven-changes-plugin - - - \ No newline at end of file diff --git a/groovy/modules/groovy-swt/settings.props b/groovy/modules/groovy-swt/settings.props deleted file mode 100644 index 3a9cf66140..0000000000 --- a/groovy/modules/groovy-swt/settings.props +++ /dev/null @@ -1,2 +0,0 @@ -#Fri Feb 20 19:43:20 CET 2004 -var1=true diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/ApplicationWindowDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/jface/ApplicationWindowDemo.groovy deleted file mode 100644 index becbae0201..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/jface/ApplicationWindowDemo.groovy +++ /dev/null @@ -1,36 +0,0 @@ -package groovy.jface.examples - -import groovy.jface.JFaceBuilder - -class ApplicationWindowDemo { - property mainapp - - void run() { - swt = new JFaceBuilder() - - mainapp = swt.applicationWindow() { - - menuManager( text:"File" ) { - action ( text:"Very Nice", closure:{ println "Very Nice !!!" } ) - separator() - action ( text:"Check me", checked:true, closure:{ println "I've been checked" } ) - } - - menuManager( text:"Edit" ) { - action ( text:"Say Hi Statusbar", closure:{ mainapp.setStatus('Hello ...') } ) - } - - fillLayout ( type:"vertical" ) - - label( text:"A big red label", background:[204, 0, 0] ) - label( text:"I can barelly read this", foreground:[0,200,0] ) - label( text:"It sure looks like the dutch flag", foreground:[0,0,150], background:[0, 0, 153] ) - - } - - mainapp.MenuBarManager.updateAll( true ) - mainapp.getShell().layout() - mainapp.open() - - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/PreferencesDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/jface/PreferencesDemo.groovy deleted file mode 100644 index 9a24661c77..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/jface/PreferencesDemo.groovy +++ /dev/null @@ -1,39 +0,0 @@ -package groovy.jface.examples - -import groovy.jface.JFaceBuilder - -class PreferencesDemo { - property pd - - void run() { - jface = new JFaceBuilder() - mainapp = jface.applicationWindow() { - - pd = preferenceDialog() { - - preferencePage( title:"General settings", filename:"settings.props" ) { - booleanFieldEditor (propertyName:"var1", title:"It's boolean" ) - colorFieldEditor( propertyName:"var2", title:"MainColor" ) - directoryFieldEditor(propertyName:"var3", title:"Directory" ) - fileFieldEditor( propertyName:"var4", title:"File" ) - fontFieldEditor( propertyName:"var5", title:"Font" ) - integerFieldEditor( propertyName:"var6", title:"Integer" ) - stringFieldEditor( propertyName:"var7", title:"String" ) - } - - preferencePage( title:"Personal settings", filename:"settings.props" ) { - booleanFieldEditor( propertyName:"var8", title:"It's boolean" ) - colorFieldEditor( propertyName:"var2", title:"MainColor" ) - directoryFieldEditor( propertyName:"var9", title:"Directory" ) - fileFieldEditor( propertyName:"var10", title:"File" ) - fontFieldEditor( propertyName:"var11", title:"Font" ) - integerFieldEditor( propertyName:"var12", title:"Integer" ) - stringFieldEditor( propertyName:"var13", title:"String" ) - } - } - } - - pd.open() - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoApplicationWindow.java b/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoApplicationWindow.java deleted file mode 100644 index 1bfe148042..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoApplicationWindow.java +++ /dev/null @@ -1,18 +0,0 @@ -package groovy.jface; - -import groovy.lang.GroovyObject; -import groovy.swt.SwtTest; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunDemoApplicationWindow extends SwtTest { - - public static void main(String[] args) throws Exception { - RunDemoApplicationWindow demo = new RunDemoApplicationWindow(); - GroovyObject object = demo.compile("src/examples/groovy/jface/ApplicationWindowDemo.groovy"); - object.invokeMethod("run", null); - } - -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoPreferences.java b/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoPreferences.java deleted file mode 100644 index b6c59700fc..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoPreferences.java +++ /dev/null @@ -1,18 +0,0 @@ -package groovy.jface; - -import groovy.lang.GroovyObject; -import groovy.swt.SwtTest; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunDemoPreferences extends SwtTest { - - public static void main(String[] args) throws Exception { - RunDemoPreferences demo = new RunDemoPreferences(); - GroovyObject object = demo.compile("src/examples/groovy/jface/PreferencesDemo.groovy"); - object.invokeMethod("run", null); - } - -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoWizard.java b/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoWizard.java deleted file mode 100644 index 4e0fd34018..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoWizard.java +++ /dev/null @@ -1,18 +0,0 @@ -package groovy.jface; - -import groovy.lang.GroovyObject; -import groovy.swt.SwtTest; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunDemoWizard extends SwtTest { - - public static void main(String[] args) throws Exception { - RunDemoWizard demo = new RunDemoWizard(); - GroovyObject object = demo.compile("src/examples/groovy/jface/WizardDemo.groovy"); - object.invokeMethod("run", null); - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/WizardDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/jface/WizardDemo.groovy deleted file mode 100644 index 60401acdaf..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/jface/WizardDemo.groovy +++ /dev/null @@ -1,87 +0,0 @@ -package groovy.jface.examples - -import groovy.jface.JFaceBuilder - -class WizardDemo extends Script { - property mainapp - property wizardPage1 - property text - property wizardDialog1 - - run() { - jface = new JFaceBuilder() - - mainapp = jface.applicationWindow() { - - wizardDialog1 = wizardDialog() { - - wizardPage1 = wizardPage( title:"Step 1", description:"Step 1", closure: { parent | - jface.composite( parent ) { - gridLayout( numColumns:2 ) - label( text:"Some input" ) - - text = text() - label( text:"Label 1" ) - - button( text:"Set Message") { - onEvent( type:"Selection" , closure: { - wizardPage1.setMessage( text.getText() ) - }) - } - - label( text:"Label 2" ) - button( text:"Set Error Message" ) { - onEvent( type:"Selection", closure: { - wizardPage1.setErrorMessage('ErrorMessage: This step is not complete') - }) - } - - label( text:"Label 3" ) - button ( text:"Set Page Complete" ) { - onEvent ( type:"Selection", closure: { - wizardPage1.setPageComplete(true) - }) - } - } - - }) - - wizardPage2 = wizardPage( title:"Step 2", description:"Step 2", closure: { parent | - jface.composite( parent ) { - gridLayout( numColumns:"2" ) - label( text:"Label 3" ) - button( text:"Do nothing" ) - } - }) - - wizardPage3 = wizardPage( title:"Step 3", description:"Step 3", closure: { parent | - jface.composite( parent ) { - gridLayout( numColumns:"2" ) - label( text:"Label 4" ) - button( text:"Do nothing" ) - } - }) - - } - - } - - wizardPage1.setPageComplete(false) - wizardDialog1.open() - - } - - void onPerformFinish() { - println "onPerformFinish called ..." - } - - void onPerformCancel() { - println "onPerformCancel called ......" - } - -} - - - - - diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/AwtSwtDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/AwtSwtDemo.groovy deleted file mode 100644 index 00e70a3f50..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/AwtSwtDemo.groovy +++ /dev/null @@ -1,31 +0,0 @@ -package groovy.swt.examples - -import groovy.swt.SwtBuilder -import groovy.swing.SwingBuilder - - -class AwtSwtDemo { - property swt - - void run() { - swt = new SwtBuilder() - swing = new SwingBuilder() - - shell = swt.shell ( text:'The AwtSwt Demo' ) { - fillLayout() - - swing.current = awtFrame() - swing.tree() - } - - shell.open() - - while(! shell.isDisposed()) { - if (! shell.display.readAndDispatch()) { - shell.display.sleep(); - } - } - - shell.display.dispose() - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/BrowserDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/BrowserDemo.groovy deleted file mode 100644 index f5c3bf031f..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/BrowserDemo.groovy +++ /dev/null @@ -1,96 +0,0 @@ -package groovy.swt.examples - -import groovy.swt.SwtBuilder - -class BrowserSwtDemo extends Script { - property swt - property shell - property browser - property location - property status - property progressBar - - void run() { - swt = new SwtBuilder() - - shell = swt.shell( text:"The Browser Test", location:[100,100], size:[700,600] ) { - gridLayout(numColumns:3) - - toolBar( style:"none" ) { - gridData( horizontalSpan:3 ) - - toolItem(style:"push", text:"Back") { - onEvent(type:"Selection", closure:{ browser.back() }) - } - - toolItem(style:"push", text:"Forward") { - onEvent(type:"Selection", closure:{ browser.forward() } ) - } - - toolItem(style:"push", text:"Stop") { - onEvent(type:"Selection", closure:{ browser.stop() } ) - } - - toolItem(style:"push", text:"Refresh") { - onEvent(type:"Selection", closure:{ browser.refresh() } ) - } - - toolItem(style:"push", text:"Go") { - onEvent(type:"Selection", closure:{ - browser.setUrl( location.getText() ) - }) - } - } - - label( style:"none", text:"Address" ) - location = text( style:"Border" ) { - gridData( horizontalAlignment:"fill", horizontalSpan:2, grabExcessHorizontalSpace:true ) - } - - - browser = browser( style:"border" ) { - gridData( horizontalAlignment:"fill", verticalAlignment:"fill", horizontalSpan:3, grabExcessHorizontalSpace:true, grabExcessVerticalSpace:true) - - locationListener(type:"changed", closure: { event | - location.setText( event.location ) - }) - - progressListener(type:"changed", closure: { event | - if (event.total != 0) { - ratio = event.current * 100 / event.total - progressBar.setSelection( Integer.parseInt("" + Math.round(Double.parseDouble("" + ratio))) ) - } - }) - - progressListener(type:"completed", closure: { - progressBar.setSelection(0) - }) - - statusTextListener( closure: { event | - status.setText(event.text) - }) - - } - - status = label( style:"none", text:"" ) { - gridData( style:"fill_horizontal", horizontalSpan:2) - } - - progressBar = progressBar () { - gridData( horizontalAlignment:"end" ) - } - - } - - browser.setUrl( "http://feeds.codehaus.org/" ) - shell.open() - - while(! shell.isDisposed()) { - if (! shell.display.readAndDispatch()) { - shell.display.sleep(); - } - } - - shell.display.dispose() - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/FormDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/FormDemo.groovy deleted file mode 100644 index 56043041b0..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/FormDemo.groovy +++ /dev/null @@ -1,97 +0,0 @@ -package groovy.swt.examples - -import groovy.jface.JFaceBuilder - -class ApplicationDemo { - property mainapp - - void run() { - jface = new JFaceBuilder() - - mainapp = jface.applicationWindow( title:"The forms demo", size:[700,800], location:[0,0] ) { - gridLayout ( numColumns:2 ) - form( text:"Hello, Eclipse Forms" ) { - gridData( style:"fill_both" ) - tableWrapLayout() - - formSection( text:"section1", description:"description of section1", style:"description, twistie" ) { - tableWrapData( style:"fill" ) - - expansionListener( type:"expansionStateChanging", closure: { println "expansionStateChanging ... " + it } ) - expansionListener( type:"expansionStateChanged", closure: { println "expansionStateChanged ... " + it } ) - - htmlText = "
" - htmlText += "
  • list item
  • " - htmlText += "

    this html code with an url: http://groovy.codehaus.org

    " - htmlText += "
  • list item 2
  • " - htmlText += "
  • list item 3
  • " - htmlText += "
    " - - formFormattedText( text:htmlText, parseTags:true, expandURLs:true ) - - formButton ( text:"This is radiobutton1", style:"radio" ) - formButton ( text:"This is radiobutton2", style:"radio" ) - - formButton ( text:"This is a ARROW button", style:"arrow" ) { - onEvent(type:"Selection", closure:{ println "stop selecting me !!!" }) - } - formButton ( text:"This is a PUSH button", style:"push" ) { - onEvent(type:"Selection", closure:{ println "stop pushing me !!!" }) - } - formButton ( text:"This is a TOGGLE button", style:"TOGGLE" ) { - onEvent(type:"Selection", closure:{ println it.event }) - } - - } - - formSection( text:"section2", description:"description of section2", style:"description, twistie" ) { - tableWrapData( style:"fill" ) - formLabel( text:"This is a label in section 2" ) - formExpandableComposite( text:"formExpandableComposite" ) - } - - formSection( text:"section3", description:"description of section3", style:"description, twistie" ) { - tableWrapData( style:"fill" ) - formLabel( text:"Below me is a tree" ) - formTree() - } - - formSeparator( style:"separator, horizontal" ) { - tableWrapData( style:"fill" ) - } - - formButton( text:"This is a formButton" ) - - formCompositeSeparator() - - formHyperlink( text:"this is a hyperlink" ) { - hyperlinkListener( type:"hyperlinkUpdate", closure: { println "hyperlinkUpdate ... " + it } ) - hyperlinkListener( type:"linkEntered", closure: { println "linkEntered ... " + it } ) - hyperlinkListener( type:"linkExited", closure: { println "linkExited ... " + it } ) - hyperlinkListener( type:"linkActivated", closure: { println "linkActivated ... " + it } ) - } - - formLabel( text:"This is a formLabel, folowed by a formTable" ) - formTable() { - tableWrapData( style:"fill" ) - } - - - - // NOT FULLY IMPLEMENTED YET: - // formImageHyperlink( text:"formImageHyperlink" ) - // formPageBook( text:"formPageBook" ) - - } - - form( text:"hello formScrolledForm" ) { - gridData( style:"fill_both" ) - formLabel( text:"my parent is a scrolledForm" ) - formButton( text:"formButton" ) - } - } - - mainapp.getShell().pack() - mainapp.open() - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunAwtSwtDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunAwtSwtDemo.java deleted file mode 100644 index 01b829fc32..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunAwtSwtDemo.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Created on Apr 19, 2004 - * - */ -package groovy.swt; - -import groovy.lang.GroovyObject; - -/** - * @author Christiaan ten Klooster $Id$ - */ -public class RunAwtSwtDemo { - public static void main(String[] args) throws Exception { - RunDemoBrowser demo = new RunDemoBrowser(); - GroovyObject object = demo.compile("src/examples/groovy/swt/AwtSwtDemo.groovy"); - object.invokeMethod("run", null); - } - -// public static void main(String[] args) { -// Display display = new Display(); -// Shell shell = new Shell(display); -// Composite locationComp = new Composite(shell, SWT.DEFAULT); -// shell.setLayout(new FillLayout()); -// -// java.awt.Frame locationFrame = SWT_AWT.new_Frame(locationComp); -// -// locationFrame.add(new JTree()); -// -// shell.open(); -// while (!shell.isDisposed()) { -// if (!display.readAndDispatch()) display.sleep(); -// } -// display.dispose(); -// -// } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoBrowser.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoBrowser.java deleted file mode 100644 index 6f70ad2de5..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoBrowser.java +++ /dev/null @@ -1,16 +0,0 @@ -package groovy.swt; - -import groovy.lang.GroovyObject; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunDemoBrowser extends SwtTest { - - public static void main(String[] args) throws Exception { - RunDemoBrowser demo = new RunDemoBrowser(); - GroovyObject object = demo.compile("src/examples/groovy/swt/BrowserDemo.groovy"); - object.invokeMethod("run", null); - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTableTree.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTableTree.java deleted file mode 100644 index 3484fa82f2..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTableTree.java +++ /dev/null @@ -1,17 +0,0 @@ -package groovy.swt; - -import groovy.lang.GroovyObject; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunDemoTableTree extends SwtTest { - - public static void main(String[] args) throws Exception { - RunDemoTableTree demo = new RunDemoTableTree(); - GroovyObject object = demo.compile("src/examples/groovy/swt/TableTreeDemo.groovy"); - object.invokeMethod("run", null); - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTree.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTree.java deleted file mode 100644 index 7206371fd0..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTree.java +++ /dev/null @@ -1,17 +0,0 @@ -package groovy.swt; - -import groovy.lang.GroovyObject; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunDemoTree extends SwtTest { - - public static void main(String[] args) throws Exception { - RunDemoTree demo = new RunDemoTree(); - GroovyObject object = demo.compile("src/examples/groovy/swt/TreeDemo.groovy"); - object.invokeMethod("run", null); - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunFormDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunFormDemo.java deleted file mode 100644 index d55f2d6f96..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunFormDemo.java +++ /dev/null @@ -1,17 +0,0 @@ -package groovy.swt; - -import groovy.lang.GroovyObject; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunFormDemo extends SwtTest { - - public static void main(String[] args) throws Exception { - RunFormDemo demo = new RunFormDemo(); - GroovyObject object = demo.compile("src/examples/groovy/swt/FormDemo.groovy"); - object.invokeMethod("run", null); - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunSashFormDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunSashFormDemo.java deleted file mode 100644 index 34f6a7e8cc..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunSashFormDemo.java +++ /dev/null @@ -1,18 +0,0 @@ -package groovy.swt; - -import groovy.lang.GroovyObject; -import groovy.swt.SwtTest; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunSashFormDemo extends SwtTest { - - public static void main(String[] args) throws Exception { - RunSashFormDemo demo = new RunSashFormDemo(); - GroovyObject object = demo.compile("src/examples/groovy/swt/SashFormDemo.groovy"); - object.invokeMethod("run", null); - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTabDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTabDemo.java deleted file mode 100644 index c74c836a48..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTabDemo.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Created on Apr 19, 2004 - * - */ -package groovy.swt; - -import groovy.lang.GroovyObject; - -/** - * @author Christiaan ten Klooster - * $Id$ - */ -public class RunTabDemo { - public static void main(String[] args) throws Exception { - RunDemoBrowser demo = new RunDemoBrowser(); - GroovyObject object = demo.compile("src/examples/groovy/swt/TabDemo.groovy"); - object.invokeMethod("run", null); - } - -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTrayDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTrayDemo.java deleted file mode 100644 index 50a5509340..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTrayDemo.java +++ /dev/null @@ -1,18 +0,0 @@ -package groovy.swt; - -import groovy.lang.GroovyObject; -import groovy.swt.SwtTest; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunTrayDemo extends SwtTest { - - public static void main(String[] args) throws Exception { - RunTrayDemo demo = new RunTrayDemo(); - GroovyObject object = demo.compile("src/examples/groovy/swt/TrayDemo.groovy"); - object.invokeMethod("run", null); - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/SashFormDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/SashFormDemo.groovy deleted file mode 100644 index b35fded136..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/SashFormDemo.groovy +++ /dev/null @@ -1,54 +0,0 @@ -package groovy.swt.examples - -import groovy.swt.SwtBuilder -import org.eclipse.swt.layout.FormAttachment -import org.eclipse.swt.graphics.Rectangle - -/* -* java version: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/snippits/snippet109.html -*/ - -class SwtDemo { - property shell - property sashForm1 - - void run() { - builder = new SwtBuilder() - shell = builder.shell ( text:'The SashForm Demo' ) { - fillLayout() - - sashForm1 = sashForm( style:"horizontal" ) { - fillLayout() - - composite( style:"none" ) { - fillLayout() - label( text:"Label in pane 1" ) - } - - composite( style:"none" ) { - fillLayout() - button( text:"Button in pane2", style:"push" ) - } - - composite( style:"none" ) { - fillLayout() - label( text:"Label in pane3" ) - } - } - - sashForm1.weights = [30,40,30] - - } - - - shell.open() - - while(! shell.isDisposed()) { - if (! shell.display.readAndDispatch()) { - shell.display.sleep(); - } - } - - } -} - diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TabDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TabDemo.groovy deleted file mode 100644 index f3f8a6c8c8..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TabDemo.groovy +++ /dev/null @@ -1,52 +0,0 @@ -package groovy.swt.examples - -import groovy.swt.SwtBuilder - - -class TabDemo { - property swt - - void run() { - swt = new SwtBuilder() - - shell = swt.shell ( text:'The Tab Demo', size:[500,400] ) { - gridLayout() - - cTabFolder( style:"flat" ) { - gridData( style:"fill_both" ) - cTabItem( style:"none", text:"Item1" ) { - text( style:"border, multi", text:"Content for Item1" ) - } - cTabItem( style:"none", text:"Item2" ) { - text( style:"border, multi", text:"Content for Item2" ) - } - cTabItem( style:"none", text:"Item3" ) { - text( style:"border, multi", text:"Content for Item3" ) - } - } - - tabFolder( style:"none" ) { - gridData( style:"fill_both" ) - tabItem( style:"none", text:"Item4" ) { - text( style:"border, multi", text:"Content for Item4" ) - } - tabItem( style:"none", text:"Item5" ) { - text( style:"border, multi", text:"Content for Item5" ) - } - tabItem( style:"none", text:"Item6" ) { - text( style:"border, multi", text:"Content for Item6" ) - } - } - - } - - shell.open() - - while(! shell.isDisposed()) { - if (! shell.display.readAndDispatch()) { - shell.display.sleep(); - } - } - - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TableTreeDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TableTreeDemo.groovy deleted file mode 100644 index 80f29f7501..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TableTreeDemo.groovy +++ /dev/null @@ -1,43 +0,0 @@ -package groovy.swt.examples - -import groovy.swt.SwtBuilder - -class TableTreeDemo { - property swt - - void run() { - swt = new SwtBuilder() - - shell = swt.shell ( text:'The TableTree Test1', location:[100,100], size:[700,600] ) { - gridLayout(numColumns:3) - - tableTree( toolTipText:"This is a table tree!", style:"multi, full_selection" ) { - - gridData( style:"fill_both" ) - - tableTreeItem ( text:"root1" ) { - tableTreeItem ( text:"child 1-1" ) - tableTreeItem ( text:"child 1-2" ) - tableTreeItem ( text:"child 1-3" ) - } - - tableTreeItem ( text:"root2" ) { - tableTreeItem ( text:"child 2-1" ) - tableTreeItem ( text:"child 2-2" ) - tableTreeItem ( text:"child 2-3" ) - } - - } - } - - shell.open() - - while(! shell.isDisposed()) { - if (! shell.display.readAndDispatch()) { - shell.display.sleep(); - } - } - - shell.display.dispose() - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TrayDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TrayDemo.groovy deleted file mode 100644 index 112d3b909e..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TrayDemo.groovy +++ /dev/null @@ -1,53 +0,0 @@ -package groovy.swt.examples - -import groovy.swt.SwtBuilder - -class TrayDemo { - property swt - - void run() { - swt = new SwtBuilder() - - shell = swt.shell ( text:'The tray Demo' ) { - - trayMenu = menu { - menuItem( text:"menuItem1" ) - menuItem( text:"menuItem2" ) - } - - tray() { - - trayItem( text:"trayItem1" ) { - image( src:"src/test/groovy/swt/groovy-logo.png" ) - - onEvent( type:"Selection", closure:{ - println "Selection event ..." - }) - onEvent( type:"Hide", closure:{ - println "Hide event ..." - }) - onEvent( type:"DefaultSelection", closure:{ - println "DefaultSelection event ..." - }) - onEvent( type:"Show", closure:{ - println "Show event ..." - }) - onEvent( type:"MenuDetect", closure:{ - println "MenuDetect event ..." - trayMenu.visible = true - }) - } - } - } - - shell.open() - - while(! shell.isDisposed()) { - if (! shell.display.readAndDispatch()) { - shell.display.sleep(); - } - } - - shell.display.dispose() - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TreeDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TreeDemo.groovy deleted file mode 100644 index 99910354c8..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TreeDemo.groovy +++ /dev/null @@ -1,49 +0,0 @@ -package groovy.swt.examples - -import groovy.swt.SwtBuilder - -class SwtDemo { - property swt - - void run() { - swt = new SwtBuilder() - - shell = swt.shell ( text:'The Swt Demo #1', location:[100,100], size:[700,600] ) { - gridLayout(numColumns:3) - - tree( toolTipText:"This is a tree!", style:"multi" ) { - - gridData( style:"fill_both" ) - - treeItem( text:"A" ) { - treeItem( text:"A/A" ) - treeItem( text:"A/B" ) - treeItem( text:"A/C" ) - } - - treeItem( text:"B" ) { - treeItem( text:"B/A" ) - treeItem( text:"B/B" ) - treeItem( text:"B/C" ) - } - - menu( style:"pop_up" ) { - menuItem( text:"do something!" ) - menuItem( text:"do something else" ) - } - - } - - } - - shell.open() - - while(! shell.isDisposed()) { - if (! shell.display.readAndDispatch()) { - shell.display.sleep(); - } - } - - shell.display.dispose() - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/GuiBuilderDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/GuiBuilderDemo.groovy deleted file mode 100644 index 74dde02d16..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/GuiBuilderDemo.groovy +++ /dev/null @@ -1,66 +0,0 @@ -package groovy.swt.guibuilder - -import groovy.swt.guibuilder.ApplicationGuiBuilder - -class ApplicationGuiDemo { - property comp - property builder - property mainapp - property guiBuilder - property comp1 - - main( args ) { - - mainapp = guiBuilder.applicationWindow( title:"The ApplicationGuiDemo", size:[700,400] ) { - fillLayout( ) - - menuManager( text:"Screens" ) { - action( text:"Screen1", closure:{ - guiBuilder.runScript( src:"Screen1.groovy", parent:mainapp, rebuild:true ) - }) - action( text:"Screen2", closure:{ - guiBuilder.runScript( src:"Screen2.groovy", parent:mainapp, rebuild:true ) - }) - } - - toolBar( style:"horizontal" ){ - toolItem( text:"Blue" ) { - onEvent( type:"Selection", closure:{ - guiBuilder.rebuild( parent:comp1, closure:{ - guiBuilder.composite( it ) { - fillLayout() - label( text:"This is fresh new blue label ...", background:[0, 0, 255] ) - } - }) - }) - } - - toolItem( text:"Red" ) { - onEvent( type:"Selection", closure:{ - guiBuilder.rebuild( parent:comp1, closure:{ - guiBuilder.composite( it ) { - fillLayout() - label( text:"This is fresh new red label ...", background:[255, 0, 0] ) - } - }) - }) - } - - } - - composite() { - - fillLayout() - - comp1 = composite() { - fillLayout() - label( text:"This is green label", background:[0, 255, 0] ) - } - } - - } - - mainapp.MenuBarManager.updateAll(true) - mainapp.open() - } -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/RunGuiBuilderDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/RunGuiBuilderDemo.java deleted file mode 100644 index 721a05d9fa..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/RunGuiBuilderDemo.java +++ /dev/null @@ -1,23 +0,0 @@ -package groovy.swt.guibuilder; - -import groovy.lang.Binding; -import groovy.util.GroovyScriptEngine; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class RunGuiBuilderDemo { - - public static void main(String[] args) throws Exception { - String basePath = "src/examples/groovy/swt/guibuilder"; - GroovyScriptEngine scriptEngine = new GroovyScriptEngine(basePath); - - Binding binding = new Binding(); - ApplicationGuiBuilder guiBuilder = new ApplicationGuiBuilder(basePath); - binding.setVariable("guiBuilder", guiBuilder); - - scriptEngine.run("GuiBuilderDemo.groovy", binding); - } - -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen1.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen1.groovy deleted file mode 100644 index 9efbc45a7a..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen1.groovy +++ /dev/null @@ -1,18 +0,0 @@ -package groovy.swt.guibuilder - -class Screen1 extends Script { - - run() { - guiBuilder.composite { - fillLayout() - - group( text:"This is Screen1.groovy" ) { - gridLayout() - button( text:"the hardest", background:[0, 255, 255] ) - button( text:"button", background:[0, 255, 255] ) - button( text:"to button", background:[0, 255, 255] ) - } - } - } - -} diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen2.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen2.groovy deleted file mode 100644 index c928efe5ea..0000000000 --- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen2.groovy +++ /dev/null @@ -1,17 +0,0 @@ -package groovy.swt.guibuilder - -class Screen2 extends Script { - - run() { - guiBuilder.composite { - fillLayout( type:"vertical") - group( text:"This is Screen2.groovy", background:[255, 255, 255] ) { - fillLayout( type:"vertical") - label( text:"A big red label", background:[204, 0, 0] ) - label( text:"I can barelly read this", foreground:[0,200,0] ) - label( text:"It sure looks like the dutch flag", foreground:[0,0,150], background:[0, 0, 153] ) - } - } - } - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/JFaceBuilder.java b/groovy/modules/groovy-swt/src/main/groovy/jface/JFaceBuilder.java deleted file mode 100644 index 0c07d8144d..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/JFaceBuilder.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Created on Feb 25, 2004 - * - */ -package groovy.jface; - -import groovy.jface.factory.ContributionManagerFactory; -import groovy.jface.factory.DoubleClickListenerFactory; -import groovy.jface.factory.MenuManagerFactory; -import groovy.jface.factory.PreferencesDialogFactory; -import groovy.jface.factory.PreferencesFieldEditorFactory; -import groovy.jface.factory.PreferencesPageFactory; -import groovy.jface.factory.SelectionChangedListenerFactory; -import groovy.jface.factory.WindowFactory; -import groovy.jface.factory.WizardDialogFactory; -import groovy.jface.factory.WizardPageFactory; -import groovy.jface.impl.ActionImpl; -import groovy.jface.impl.ApplicationWindowImpl; -import groovy.swt.SwtBuilder; -import groovy.swt.factory.ImageFactory; - -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.ColorFieldEditor; -import org.eclipse.jface.preference.DirectoryFieldEditor; -import org.eclipse.jface.preference.FileFieldEditor; -import org.eclipse.jface.preference.FontFieldEditor; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.TableTreeViewer; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class JFaceBuilder extends SwtBuilder { - - protected void registerWidgets() { - super.registerWidgets(); - - // Viewer - registerBeanFactory("tableViewer", TableViewer.class); - registerBeanFactory("tableTreeViewer", TableTreeViewer.class); - registerBeanFactory("treeViewer", TreeViewer.class); - registerBeanFactory("checkboxTreeViewer", CheckboxTreeViewer.class); - - // Event - registerFactory("doubleClickListener", new DoubleClickListenerFactory()); - registerFactory("selectionChangedListener", - new SelectionChangedListenerFactory()); - - // Window - registerFactory("applicationWindow", new WindowFactory( - ApplicationWindowImpl.class)); -// registerFactory("window", new WindowFactory( -// WindowImpl.class)); - - // ContributionManager - registerFactory("menuManager", new MenuManagerFactory()); - - // Action tags - registerFactory("action", new ContributionManagerFactory( - ActionImpl.class)); - - // ContributionItem - registerFactory("separator", new ContributionManagerFactory( - Separator.class)); - - // Wizard - registerFactory("wizardDialog", new WizardDialogFactory()); - registerFactory("wizardPage", new WizardPageFactory()); - - // Preference - registerFactory("preferenceDialog", new PreferencesDialogFactory()); - registerFactory("preferencePage", new PreferencesPageFactory()); - registerFactory("booleanFieldEditor", - new PreferencesFieldEditorFactory(BooleanFieldEditor.class)); - registerFactory("colorFieldEditor", new PreferencesFieldEditorFactory( - ColorFieldEditor.class)); - registerFactory("directoryFieldEditor", - new PreferencesFieldEditorFactory(DirectoryFieldEditor.class)); - registerFactory("fileFieldEditor", new PreferencesFieldEditorFactory( - FileFieldEditor.class)); - registerFactory("fontFieldEditor", new PreferencesFieldEditorFactory( - FontFieldEditor.class)); - registerFactory("integerFieldEditor", - new PreferencesFieldEditorFactory(IntegerFieldEditor.class)); - //registerBeanFactory("radioGroupFieldEditor", - // RadioGroupFieldEditor.class); - //registerBeanFactory("stringButtonFieldEditor", - // StringButtonFieldEditor.class); - registerFactory("stringFieldEditor", new PreferencesFieldEditorFactory( - StringFieldEditor.class)); - - // other - registerFactory("image", new ImageFactory()); - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ActionImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ActionImpl.java deleted file mode 100644 index 7c5cb730b3..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ActionImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Created on Feb 28, 2004 - * - */ -package groovy.jface.factory; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; -import org.eclipse.jface.action.Action; -import org.eclipse.swt.widgets.Event; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class ActionImpl extends Action implements ClosureSupport { - private Closure closure; - private Event event; - - public void runWithEvent(Event event) { - if (closure == null) { - throw new NullPointerException( - "No closure has been configured for this Listener"); - } - this.event = event; - closure.call(this); - } - - public Closure getClosure() { - return closure; - } - - public void setClosure(Closure closure) { - this.closure = closure; - } - - public Event getEvent() { - return event; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ContributionManagerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ContributionManagerFactory.java deleted file mode 100644 index ab561774cd..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ContributionManagerFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -package groovy.jface.factory; - -import groovy.swt.factory.SwtFactory; -import groovy.swt.factory.WidgetFactory; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IContributionManager; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class ContributionManagerFactory extends WidgetFactory implements - SwtFactory { - - public ContributionManagerFactory(Class beanClass) { - super(beanClass); - } - - /* - * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - Object bean = createWidget(parent); - - setBeanProperties(bean, properties); - - if (parent instanceof IContributionManager) { - IContributionManager contributionManager = (IContributionManager) parent; - - if (bean instanceof IAction) { - contributionManager.add((IAction)bean); - } - - if (bean instanceof IContributionItem) { - contributionManager.add((IContributionItem)bean); - } - } - return bean; - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/DoubleClickListenerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/DoubleClickListenerFactory.java deleted file mode 100644 index 36ca504455..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/DoubleClickListenerFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Created on Feb 25, 2004 - * - */ -package groovy.jface.factory; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; -import groovy.swt.InvalidParentException; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; -import java.util.Map; -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.StructuredViewer; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class DoubleClickListenerFactory extends AbstractSwtFactory implements SwtFactory, - IDoubleClickListener, ClosureSupport { - private Closure closure; - - /* - * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) throws GroovyException { - if (parent instanceof StructuredViewer) { - StructuredViewer viewer = (StructuredViewer) parent; - viewer.addDoubleClickListener(this); - } else { - throw new InvalidParentException("structuredViewer"); - } - return this; - } - - /* - * @see groovy.swt.ClosureSupport#getClosure() - */ - public Closure getClosure() { - return closure; - } - - /* - * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure) - */ - public void setClosure(Closure closure) { - this.closure = closure; - } - - /* - * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) - */ - public void doubleClick(DoubleClickEvent event) { - closure.call(this); - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/MenuManagerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/MenuManagerFactory.java deleted file mode 100644 index 72e2959600..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/MenuManagerFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -package groovy.jface.factory; - -import groovy.lang.MissingPropertyException; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; -import java.util.Map; -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.window.ApplicationWindow; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class MenuManagerFactory extends AbstractSwtFactory implements SwtFactory { - - /* - * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - String text = (String) properties.remove("text"); - if (text == null) { - throw new MissingPropertyException("text", - String.class); - } - - MenuManager menuManager = new MenuManager(text); - if (parent instanceof ApplicationWindow) { - ApplicationWindow window = (ApplicationWindow) parent; - if (window != null) { - window.getMenuBarManager().add(menuManager); - } - } - - return menuManager; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesDialogFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesDialogFactory.java deleted file mode 100644 index 06764b75b0..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesDialogFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -package groovy.jface.factory; - -import groovy.jface.impl.PreferenceDialogImpl; -import groovy.swt.InvalidParentException; -import groovy.swt.SwtUtils; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.preference.PreferenceManager; -import org.eclipse.swt.widgets.Shell; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class PreferencesDialogFactory extends AbstractSwtFactory implements - SwtFactory { - - /* - * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - Shell parentShell = SwtUtils.getParentShell(parent); - if (parent != null) { - PreferenceManager pm = new PreferenceManager(); - return new PreferenceDialogImpl(parentShell, pm); - } else { - throw new InvalidParentException("applicationWindow or shell"); - } - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesFieldEditorFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesFieldEditorFactory.java deleted file mode 100644 index d33429c380..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesFieldEditorFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -package groovy.jface.factory; - -import groovy.jface.impl.PreferencePageFieldEditorImpl; -import groovy.lang.MissingPropertyException; -import groovy.swt.InvalidParentException; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.preference.PreferencePage; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class PreferencesFieldEditorFactory extends AbstractSwtFactory implements - SwtFactory { - - private Class beanClass; - - public PreferencesFieldEditorFactory(Class beanClass) { - this.beanClass = beanClass; - } - - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - if (beanClass == null) { throw new GroovyException( - "No Class available to create the FieldEditor"); } - - // check location - if (!(parent instanceof PreferencePage)) { throw new InvalidParentException( - "preferencePage"); } - - String name = (String) properties.get("propertyName"); - if (name == null) { throw new MissingPropertyException("propertyName", - FieldEditor.class); } - - String labelText = (String) properties.get("title"); - if (labelText == null) { throw new MissingPropertyException("title", - FieldEditor.class); } - - PreferencePageFieldEditorImpl preferencePageImpl = (PreferencePageFieldEditorImpl) parent; - preferencePageImpl.addFieldCreator(beanClass, name, labelText); - - return preferencePageImpl; - } - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesPageFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesPageFactory.java deleted file mode 100644 index 3a4cf6f7f0..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesPageFactory.java +++ /dev/null @@ -1,76 +0,0 @@ -package groovy.jface.factory; - -import groovy.jface.impl.PreferenceDialogImpl; -import groovy.jface.impl.PreferencePageFieldEditorImpl; -import groovy.lang.MissingPropertyException; -import groovy.swt.InvalidParentException; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; - -import java.io.IOException; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.preference.PreferenceNode; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.preference.PreferenceStore; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class PreferencesPageFactory extends AbstractSwtFactory implements - SwtFactory { - - /** The Log to which logging calls will be made. */ - private static final Log log = LogFactory - .getLog(PreferencesPageFactory.class); - - /* - * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - // check location - if (!(parent instanceof PreferenceDialog)) { throw new InvalidParentException( - "preferenceDialog"); } - - PreferenceDialogImpl preferenceDialogImpl = (PreferenceDialogImpl) parent; - - String filename = (String) properties.remove("filename"); - if (filename == null) { throw new MissingPropertyException("filename", - PreferencePage.class); } - - String title = (String) properties.remove("title"); - if (title == null) { throw new MissingPropertyException("title", - PreferencePage.class); } - - // build new PreferenceNode with same title as the PreferencePage - PreferenceNode node = new PreferenceNode(title); - - // build new PreferencePage - FieldEditorPreferencePage page = new PreferencePageFieldEditorImpl( - title); - PreferenceStore preferenceStore = new PreferenceStore(filename); - - try { - preferenceStore.load(); - } catch (IOException e) { - log.error(e); - } - page.setPreferenceStore(preferenceStore); - - // add node to PreferenceManager - node.setPage(page); - preferenceDialogImpl.getPreferenceManager().addToRoot(node); - - return page; - } - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/SelectionChangedListenerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/SelectionChangedListenerFactory.java deleted file mode 100644 index 6ac5b39789..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/SelectionChangedListenerFactory.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Created on Feb 25, 2004 - * - */ -package groovy.jface.factory; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; -import groovy.swt.InvalidParentException; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class SelectionChangedListenerFactory extends AbstractSwtFactory - implements SwtFactory, ISelectionChangedListener, ClosureSupport { - - private Closure closure; - - /* - * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - if (parent instanceof Viewer) { - Viewer viewer = (Viewer) parent; - viewer.addSelectionChangedListener(this); - } else { - throw new InvalidParentException("viewer"); - } - - return this; - } - - /* - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ - public void selectionChanged(SelectionChangedEvent event) { - closure.call(event); - } - - /* - * @see groovy.swt.ClosureSupport#getClosure() - */ - public Closure getClosure() { - return closure; - } - - /* - * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure) - */ - public void setClosure(Closure closure) { - this.closure = closure; - } - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WindowFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WindowFactory.java deleted file mode 100644 index 1f2d45dea2..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WindowFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Created on Feb 28, 2004 - * - */ -package groovy.jface.factory; - -import groovy.swt.InvalidParentException; -import groovy.swt.convertor.PointConverter; -import groovy.swt.factory.SwtFactory; -import groovy.swt.factory.WidgetFactory; - -import java.util.List; -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Shell; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class WindowFactory extends WidgetFactory implements SwtFactory { - - /** - * @param beanClass - */ - public WindowFactory(Class beanClass) { - super(beanClass); - } - - /* - * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) throws GroovyException { - if (parent == null){ - parent = new Shell(); - } - if (!(parent instanceof Shell)){ - throw new InvalidParentException("shell"); - } - - Window window = (Window) createWidget(parent); - if (window != null){ - Shell shell = (Shell) parent; - - // set title of Window - String title = (String) properties.remove("title"); - if (title != null){ - window.getShell().setText((String) title); - } - - // set size of Window - List size = (List) properties.remove("size"); - if (size != null){ - Point point = PointConverter.getInstance().parse(size); - window.getShell().setSize(point); - } - - // set location of Window - List location = (List) properties.remove("location"); - if (location != null){ - Point point = PointConverter.getInstance().parse(location); - window.getShell().setLocation(point); - } - } - setBeanProperties(window, properties); - return window; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardDialogFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardDialogFactory.java deleted file mode 100644 index 7509d58009..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardDialogFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Created on Feb 20, 2004 - * - */ -package groovy.jface.factory; - -import groovy.jface.impl.WizardDialogImpl; -import groovy.jface.impl.WizardImpl; -import groovy.swt.SwtUtils; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class WizardDialogFactory extends AbstractSwtFactory implements SwtFactory { - - /* - * @see groovy.swt.factory.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - Shell parentShell = SwtUtils.getParentShell(parent); - Wizard wizard = new WizardImpl(); - WizardDialog wizardDialog = new WizardDialogImpl(parentShell, wizard); - return wizardDialog; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardPageFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardPageFactory.java deleted file mode 100644 index 89694cf79d..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardPageFactory.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Created on Feb 20, 2004 - * - */ -package groovy.jface.factory; - -import groovy.jface.impl.WizardDialogImpl; -import groovy.jface.impl.WizardPageImpl; -import groovy.lang.MissingPropertyException; -import groovy.swt.InvalidParentException; -import groovy.swt.factory.AbstractSwtFactory; -import groovy.swt.factory.SwtFactory; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jface.wizard.WizardPage; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class WizardPageFactory extends AbstractSwtFactory implements SwtFactory { - - /* - * @see groovy.swt.factory.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - // check location - if (!(parent instanceof WizardDialog)) { - throw new InvalidParentException("wizardDialog"); - } - WizardDialogImpl wizardDialog = (WizardDialogImpl) parent; - - // check for missing attributes - String title = (String) properties.get("title"); - if (title == null) { - throw new MissingPropertyException("title", - WizardPage.class); - } - - // get WizardPageImpl - WizardPageImpl page = new WizardPageImpl(title); - setBeanProperties(page, properties); - - // get Wizard - WizardDialogImpl dialog = (WizardDialogImpl) parent; - Wizard wizard = (Wizard) dialog.getWizard(); - - // add WizardPage to the Wizard - wizard.addPage(page); - return page; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ActionImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ActionImpl.java deleted file mode 100644 index 4d5c8a707e..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ActionImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Created on Feb 28, 2004 - * - */ -package groovy.jface.impl; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; -import org.eclipse.jface.action.Action; -import org.eclipse.swt.widgets.Event; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class ActionImpl extends Action implements ClosureSupport { - private Closure closure; - private Event event; - - public void runWithEvent(Event event) { - if (closure == null) { - throw new NullPointerException( - "No closure has been configured for this Listener"); - } - this.event = event; - closure.call(this); - } - - public Closure getClosure() { - return closure; - } - - public void setClosure(Closure closure) { - this.closure = closure; - } - - public Event getEvent() { - return event; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ApplicationWindowImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ApplicationWindowImpl.java deleted file mode 100644 index dc51245cee..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ApplicationWindowImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package groovy.jface.impl; - -import org.eclipse.jface.action.StatusLineManager; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -/** - * This is the default implementation for a ApplicationWindow - * - * @author Christiaan ten Klooster - */ -public class ApplicationWindowImpl extends ApplicationWindow { - - /** - * @param shell - */ - public ApplicationWindowImpl(Shell parentShell) { - super(null); - - // default at all - addMenuBar(); - addStatusLine(); - addToolBar(SWT.FLAT | SWT.WRAP); - setBlockOnOpen(true); - - // create window - create(); - } - - /* - * override to make public - * - * @see org.eclipse.jface.window.Window#getContents() - */ - public Control getContents() { - return super.getContents(); - } - - /* - * override to make public - * - * @see org.eclipse.jface.window.ApplicationWindow#getStatusLineManager() - */ - public StatusLineManager getStatusLineManager() { - return super.getStatusLineManager(); - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferenceDialogImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferenceDialogImpl.java deleted file mode 100644 index d46e7cf641..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferenceDialogImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Created on Feb 20, 2004 - * - */ -package groovy.jface.impl; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; - -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.preference.PreferenceManager; -import org.eclipse.swt.widgets.Shell; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class PreferenceDialogImpl extends PreferenceDialog implements - ClosureSupport { - - private Closure closure; - - public PreferenceDialogImpl(Shell shell, PreferenceManager pm) { - super(shell, pm); - } - - protected void handleSave() { - super.handleSave(); - closure.call(); - } - - /* - * @see groovy.swt.ClosureSupport#getClosure() - */ - public Closure getClosure() { - return closure; - } - - /* - * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure) - */ - public void setClosure(Closure closure) { - this.closure = closure; - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferencePageFieldEditorImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferencePageFieldEditorImpl.java deleted file mode 100644 index 90d35888c8..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferencePageFieldEditorImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Created on Feb 20, 2004 - * - */ -package groovy.jface.impl; - -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.swt.widgets.Composite; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class PreferencePageFieldEditorImpl extends FieldEditorPreferencePage { - - public class FieldEditorCreator { - - private Class beanClass; - - private String propertyName; - - private String title; - - public FieldEditorCreator(Class beanClass, String propertyName, - String title) { - this.beanClass = beanClass; - this.propertyName = propertyName; - this.title = title; - } - - public FieldEditor createField(Composite parent) { - - FieldEditor fieldEditor = null; - - try { - Class[] types = { String.class, String.class, Composite.class}; - Constructor constructor = beanClass.getConstructor(types); - if (constructor != null) { - Object[] arguments = { propertyName, title, parent}; - fieldEditor = (FieldEditor) constructor - .newInstance(arguments); - } - } catch (Exception e) { - } - - return fieldEditor; - } - } - - private List creatorFieldsfields = new ArrayList(); - - public PreferencePageFieldEditorImpl(String title) { - super(title, FieldEditorPreferencePage.GRID); - } - - public void addFieldCreator(Class beanClass, String propertyName, - String title) { - creatorFieldsfields.add(new FieldEditorCreator(beanClass, propertyName, - title)); - } - - protected void createFieldEditors() { - Iterator i = creatorFieldsfields.iterator(); - while (i.hasNext()) { - FieldEditorCreator creator = (FieldEditorCreator) i.next(); - FieldEditor fieldEditor = creator - .createField(getFieldEditorParent()); - addField(fieldEditor); - } - } - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardDialogImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardDialogImpl.java deleted file mode 100644 index ad78f9272b..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardDialogImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created on Feb 20, 2004 - * - */ -package groovy.jface.impl; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; - -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * Provide a public method getWizard and provide access to parentShell - * - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class WizardDialogImpl extends WizardDialog implements ClosureSupport { - private Closure closure; - private Shell parentShell; - - public WizardDialogImpl(Shell parentShell, IWizard newWizard) { - super(parentShell, newWizard); - this.parentShell = parentShell; - } - - public IWizard getWizard() { - return super.getWizard(); - } - - public Shell getParentShell() { - return parentShell; - } - - /* - * @see groovy.swt.ClosureSupport#getClosure() - */ - public Closure getClosure() { - return closure; - } - - /* - * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure) - */ - public void setClosure(Closure closure) { - this.closure = closure; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardImpl.java deleted file mode 100644 index 7dac1f87c6..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Created on Feb 20, 2004 - * - */ -package groovy.jface.impl; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; - -import org.eclipse.jface.wizard.Wizard; - -/** - * Provides a Wizard implementation - * - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class WizardImpl extends Wizard implements ClosureSupport{ - private Closure closure; - public WizardImpl() { - super(); - setNeedsProgressMonitor(true); - } - - /* - * TODO implements this - * - * @see org.eclipse.jface.wizard.IWizard#performCancel() - */ - public boolean performCancel() { - System.out.println("performCancel ..."); - return true; - } - - /* - * TODO implements this - * - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() { - System.out.println("performFinish ..."); - return true; - } - - /* - * @see groovy.swt.ClosureSupport#getClosure() - */ - public Closure getClosure() { - return closure; - } - - /* - * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure) - */ - public void setClosure(Closure closure) { - this.closure = closure; - } - - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardPageImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardPageImpl.java deleted file mode 100644 index 90be86e9f3..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardPageImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Created on Feb 21, 2004 - * - */ -package groovy.jface.impl; - -import groovy.lang.Closure; -import groovy.swt.ClosureSupport; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.widgets.Composite; - -/** - * Implementation of a WizardPage method createControl is called on - * Dialog.open() - * - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class WizardPageImpl extends WizardPage implements ClosureSupport { - private Closure closure; - - public WizardPageImpl(String title) { - super(title); - } - - public void createControl(Composite parent) { - if (closure == null) { - throw new NullPointerException( - "No closure has been configured for this WizardPage"); - } - Composite composite = (Composite) closure.call(parent); - setControl(composite); - } - - public Closure getClosure() { - return closure; - } - - public void setClosure(Closure closure) { - this.closure = closure; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/ClosureSupport.java b/groovy/modules/groovy-swt/src/main/groovy/swt/ClosureSupport.java deleted file mode 100644 index 22d885676e..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/ClosureSupport.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Created on Feb 16, 2004 - * - */ -package groovy.swt; - -import groovy.lang.Closure; - - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public interface ClosureSupport { - public Closure getClosure(); - - public void setClosure(Closure closure); -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidChildException.java b/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidChildException.java deleted file mode 100644 index df53b76cf9..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidChildException.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Created on Feb 16, 2004 - * - */ -package groovy.swt; - -import org.codehaus.groovy.GroovyException; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class InvalidChildException extends GroovyException { - - public InvalidChildException(String parent, String child) { - super("first child of " + parent + " should be " + child); - } - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidParentException.java b/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidParentException.java deleted file mode 100644 index 9ec9691038..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidParentException.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Created on Feb 16, 2004 - * - */ -package groovy.swt; - -import org.codehaus.groovy.GroovyException; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class InvalidParentException extends GroovyException { - - /** - * @param message - */ - public InvalidParentException(String property) { - super("parent should be: " + property); - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtBuilder.java b/groovy/modules/groovy-swt/src/main/groovy/swt/SwtBuilder.java deleted file mode 100644 index 170a761549..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtBuilder.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Created on Feb 15, 2004 - * - */ -package groovy.swt; - -import groovy.lang.Closure; -import groovy.swt.factory.AwtSwtFactory; -import groovy.swt.factory.Fontfactory; -import groovy.swt.factory.FormFactory; -import groovy.swt.factory.FormLayoutDataFactory; -import groovy.swt.factory.ImageFactory; -import groovy.swt.factory.LayoutDataFactory; -import groovy.swt.factory.LayoutFactory; -import groovy.swt.factory.ListenerFactory; -import groovy.swt.factory.SwtFactory; -import groovy.swt.factory.TrayFactory; -import groovy.swt.factory.WidgetFactory; -import groovy.util.BuilderSupport; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.browser.Browser; -import org.eclipse.swt.browser.LocationListener; -import org.eclipse.swt.browser.ProgressListener; -import org.eclipse.swt.browser.StatusTextListener; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.custom.TableTree; -import org.eclipse.swt.custom.TableTreeItem; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowData; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Canvas; -import org.eclipse.swt.widgets.Caret; -import org.eclipse.swt.widgets.ColorDialog; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.CoolBar; -import org.eclipse.swt.widgets.CoolItem; -import org.eclipse.swt.widgets.Decorations; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.FontDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.swt.widgets.ProgressBar; -import org.eclipse.swt.widgets.Sash; -import org.eclipse.swt.widgets.Scale; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Slider; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.swt.widgets.Tracker; -import org.eclipse.swt.widgets.TrayItem; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.forms.events.IExpansionListener; -import org.eclipse.ui.forms.events.IHyperlinkListener; -import org.eclipse.ui.forms.widgets.ColumnLayout; -import org.eclipse.ui.forms.widgets.ColumnLayoutData; -import org.eclipse.ui.forms.widgets.TableWrapData; -import org.eclipse.ui.forms.widgets.TableWrapLayout; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class SwtBuilder extends BuilderSupport { - - private Map factories = new HashMap(); - - private Logger log = Logger.getLogger(getClass().getName()); - - public SwtBuilder() { - registerWidgets(); - } - - /* - * @see groovy.util.BuilderSupport#createNode(java.lang.Object) - */ - protected Object createNode(Object name) { - return createNode(name, Collections.EMPTY_MAP); - } - - /* - * @see groovy.util.BuilderSupport#createNode(java.lang.Object, java.util.Map, java.lang.Object) - */ - protected Object createNode(Object name, Map attributes, Object value) { - return createNode(name, attributes); - } - - /* - * @see groovy.util.BuilderSupport#createNode(java.lang.Object, - * java.util.Map) - */ - protected Object createNode(Object name, Map attributes) { - - Closure closure = (Closure) attributes.get("closure"); - - Object widget = createWidget(name, attributes, getCurrent()); - - if (widget != null) { - if (widget instanceof ClosureSupport) { - if (closure != null) { - ClosureSupport closureSupport = (ClosureSupport) widget; - closureSupport.setClosure(closure); - } - } - } - - return widget; - } - - /** - * @param name - * @param attributes - * @return - */ - protected Object createWidget(Object name, Map attributes, Object current) { - Object widget = null; - SwtFactory factory = (SwtFactory) factories.get(name); - if (factory != null) { - try { - widget = factory.newInstance(attributes, current); - } catch (Exception e) { - log.log(Level.WARNING, e.toString()); - } - } else { - log.log(Level.WARNING, "Could not find match for name: " + name); - } - return widget; - } - - /* - * @see groovy.util.BuilderSupport#createNode(java.lang.Object, - * java.lang.Object) - */ - protected Object createNode(Object name, Object parent) { - return createWidget(name, Collections.EMPTY_MAP, parent); - } - - protected void registerBeanFactory(String name, final Class beanClass) { - registerFactory(name, new WidgetFactory(beanClass)); - } - - protected void registerBeanFactory(String name, final Class beanClass, - final int style) { - registerFactory(name, new WidgetFactory(beanClass, style)); - } - - protected void registerFactory(String name, SwtFactory factory) { - factories.put(name, factory); - } - - protected void registerWidgets() { - - // widgets - registerFactory("awtFrame", new AwtSwtFactory()); - registerBeanFactory("button", Button.class, SWT.BORDER | SWT.PUSH - | SWT.CENTER); - registerBeanFactory("canvas", Canvas.class); - registerBeanFactory("caret", Caret.class); - registerBeanFactory("combo", Combo.class, SWT.DROP_DOWN); - registerBeanFactory("composite", Composite.class); - registerBeanFactory("scrolledComposite", ScrolledComposite.class, - SWT.H_SCROLL | SWT.V_SCROLL); - registerBeanFactory("coolBar", CoolBar.class, SWT.VERTICAL); - registerBeanFactory("coolItem", CoolItem.class); - registerBeanFactory("decorations", Decorations.class); - registerFactory("font", new Fontfactory()); - registerBeanFactory("group", Group.class); - registerBeanFactory("label", Label.class, SWT.HORIZONTAL - | SWT.SHADOW_IN); - registerBeanFactory("list", List.class); - registerBeanFactory("menu", Menu.class, SWT.DEFAULT); - // registerMenuTag("menuBar", SWT.BAR); - - registerBeanFactory("menuSeparator", MenuItem.class, SWT.SEPARATOR); - registerBeanFactory("menuItem", MenuItem.class); - registerBeanFactory("messageBox", MessageBox.class); - registerBeanFactory("progressBar", ProgressBar.class, SWT.HORIZONTAL); - registerBeanFactory("sash", Sash.class); - registerBeanFactory("scale", Scale.class); - registerBeanFactory("shell", Shell.class, SWT.BORDER | SWT.CLOSE - | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.TITLE); - registerBeanFactory("slider", Slider.class); - registerBeanFactory("tabFolder", TabFolder.class); - registerBeanFactory("tabItem", TabItem.class); - registerBeanFactory("table", Table.class, SWT.MULTI | SWT.BORDER - | SWT.FULL_SELECTION); - registerBeanFactory("tableColumn", TableColumn.class); - registerBeanFactory("tableItem", TableItem.class); - registerBeanFactory("text", Text.class); - registerBeanFactory("toolBar", ToolBar.class, SWT.VERTICAL); - registerBeanFactory("toolItem", ToolItem.class); - registerBeanFactory("tracker", Tracker.class); - registerFactory("tray", new TrayFactory()); - registerBeanFactory("trayItem", TrayItem.class); - registerBeanFactory("tree", Tree.class, SWT.MULTI); - registerBeanFactory("treeItem", TreeItem.class); - - // custom widgets - registerBeanFactory("cTabFolder", CTabFolder.class); - registerBeanFactory("cTabItem", CTabItem.class); - registerBeanFactory("sashForm", SashForm.class); - registerBeanFactory("tableTree", TableTree.class); - registerBeanFactory("tableTreeItem", TableTreeItem.class); - - // layouts - registerFactory("fillLayout", new LayoutFactory(FillLayout.class)); - registerFactory("gridLayout", new LayoutFactory(GridLayout.class)); - registerFactory("rowLayout", new LayoutFactory(RowLayout.class)); - registerFactory("formLayout", new LayoutFactory(FormLayout.class)); - - // layout data objects - registerFactory("gridData", new LayoutDataFactory(GridData.class)); - registerFactory("rowData", new LayoutDataFactory(RowData.class)); - registerFactory("formData", new FormLayoutDataFactory()); - - // dialogs - registerBeanFactory("colorDialog", ColorDialog.class); - registerBeanFactory("directoryDialog", DirectoryDialog.class); - registerBeanFactory("fileDialog", FileDialog.class); - registerBeanFactory("fontDialog", FontDialog.class); - - // events - registerFactory("onEvent", new ListenerFactory(Listener.class)); - - // other tags - registerFactory("image", new ImageFactory()); - - // browser tags - registerBeanFactory("browser", Browser.class, SWT.NONE); - registerFactory("locationListener", new ListenerFactory( - LocationListener.class)); - registerFactory("progressListener", new ListenerFactory( - ProgressListener.class)); - registerFactory("statusTextListener", new ListenerFactory( - StatusTextListener.class)); - - // forms api - registerFactory("form", new FormFactory("form")); - registerFactory("scrolledForm", new FormFactory("scrolledForm")); - registerFactory("formButton", new FormFactory("formButton")); - registerFactory("formColors", new FormFactory("formColors")); - registerFactory("formComposite", new FormFactory("formComposite")); - registerFactory("formCompositeSeparator", new FormFactory( - "formCompositeSeparator")); - registerFactory("formExpandableComposite", - new FormFactory("formButton")); - registerFactory("formText", new FormFactory("formText")); - registerFactory("formHyperlink", new FormFactory("formHyperlink")); - registerFactory("formImageHyperlink", new FormFactory( - "formImageHyperlink")); - registerFactory("formLabel", new FormFactory("formLabel")); - registerFactory("formPageBook", new FormFactory("formPageBook")); - registerFactory("formPageBookPage", new FormFactory("formPageBookPage")); - registerFactory("formSection", new FormFactory("formSection")); - registerFactory("formSeparator", new FormFactory("formSeparator")); - registerFactory("formTable", new FormFactory("formTable")); - registerFactory("formToolkit", new FormFactory("formToolkit")); - registerFactory("formFormattedText", new FormFactory( - "formFormattedText")); - registerFactory("formTree", new FormFactory("formTree")); - - // forms layout - registerFactory("tableWrapLayout", new LayoutFactory( - TableWrapLayout.class)); - registerFactory("tableWrapData", new LayoutDataFactory( - TableWrapData.class)); - registerFactory("columnLayout", new LayoutFactory( - ColumnLayout.class)); - registerFactory("columnLayoutData", new LayoutDataFactory( - ColumnLayoutData.class)); - - // forms listeners - registerFactory("hyperlinkListener", new ListenerFactory( - IHyperlinkListener.class)); - registerFactory("expansionListener", new ListenerFactory( - IExpansionListener.class)); - - // none eclipse widgets - // registerBeanFactory("tDateText", TDateText.class); - // registerBeanFactory("tCalendar", TCalendar.class); - // registerBeanFactory("textEditor", TextEditor.class); - } /* - * @see groovy.util.BuilderSupport#setParent(java.lang.Object, - * java.lang.Object) - */ - - protected void setParent(Object parent, Object child) { - - // TODO implement this - // - // if (parent instanceof ScrolledComposite && widget instanceof Control) - // { - // ScrolledComposite scrolledComposite = (ScrolledComposite) parent; - // scrolledComposite.setContent((Control) widget); - // } - - } - - /* - * override to make public - * - * @see groovy.util.BuilderSupport#setCurrent(java.lang.Object) - */ - public void setCurrent(Object current) { - super.setCurrent(current); - } - - /* - * override to make public - * - * @see groovy.util.BuilderSupport#getCurrent() - */ - public Object getCurrent() { - return super.getCurrent(); - } - - - -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtUtils.java b/groovy/modules/groovy-swt/src/main/groovy/swt/SwtUtils.java deleted file mode 100644 index 356ed820b4..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package groovy.swt; - -import groovy.jface.impl.ApplicationWindowImpl; - -import java.lang.reflect.Field; -import java.util.StringTokenizer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.forms.widgets.Form; -import org.eclipse.ui.forms.widgets.ScrolledForm; -import org.eclipse.ui.forms.widgets.Section; - -/** - * A helper class for working with SWT. - * - * @author James Strachan - * @author Christiaan ten Klooster - * - * @version 1.1 - */ -public class SwtUtils { - - /** The Log to which logging calls will be made. */ - private static final Log log = LogFactory.getLog(SwtUtils.class); - - - /** - * Parses the comma delimited String of style codes which are or'd - * together. The given class describes the integer static constants - * - * @param constantClass is the type to look for static fields - * @param text is a comma delimited text value such as "border, resize" - * @return the int code - */ - public static int parseStyle(Class constantClass, String text) throws GroovyException { - return parseStyle(constantClass, text, true); - } - - /** - * Parses the comma delimited String of style codes which are or'd - * together. The given class describes the integer static constants - * - * @param constantClass is the type to look for static fields - * @param text is a comma delimited text value such as "border, resize" - * @param toUpperCase is whether the text should be converted to upper case - * before its compared against the reflection fields - * - * @return the int code - */ - public static int parseStyle(Class constantClass, String text, boolean toUpperCase) throws GroovyException{ - int answer = 0; - if (text != null) { - if (toUpperCase) { - text = text.toUpperCase(); - } - StringTokenizer enum = new StringTokenizer(text, ","); - while (enum.hasMoreTokens()) { - String token = enum.nextToken().trim(); - answer |= getStyleCode(constantClass, token); - } - } - return answer; - } - - /** - * @return the code for the given word or zero if the word doesn't match a - * valid style - */ - public static int getStyleCode(Class constantClass,String text) throws GroovyException { - try { - Field field = constantClass.getField(text); - if (field == null) { - log.warn( "Unknown style code: " + text +" will be ignored"); - return 0; - } - return field.getInt(null); - } catch (NoSuchFieldException e) { - throw new GroovyException("The value: " + text + " is not understood "); - } catch (IllegalAccessException e) { - throw new GroovyException("The value: " + text + " is not understood"); - } - } - - /** - * dispose all children - * - * @param parent - */ - public static void disposeChildren(Composite parent) { - Control[] children = parent.getChildren(); - for (int i = 0; i < children.length; i++) { - Control control = children[i]; - control.dispose(); - } - System.out.println(); - } - - /** - * return the parent shell - * - * @param parent - * @return - */ - public static Shell getParentShell(Object parent) { - if (parent instanceof ApplicationWindow) { - return ((ApplicationWindowImpl) parent).getShell(); - } - else if (parent instanceof Shell) { - return (Shell) parent; - } - else { - return null; - } - } - - /** - * return the parent widget - * - * @param parent - * @return - */ - public static Object getParentWidget(Object parent) { - if (parent instanceof ApplicationWindow) { - return (Composite) ((ApplicationWindowImpl) parent).getContents(); - } - else if (parent instanceof Form) { - return ((Form) parent).getBody(); - } - else if (parent instanceof ScrolledForm) { - return ((ScrolledForm) parent).getBody(); - } - else if (parent instanceof Section) { - return ((Section) parent).getClient(); - } - else if (parent instanceof CTabItem) { - return ((CTabItem) parent).getParent(); - } - else if (parent instanceof TabItem) { - return ((TabItem) parent).getParent(); - } - else if (parent instanceof Widget) { - return (Widget) parent; - } - else if (parent instanceof TableViewer) { - return ((TableViewer) parent).getTable(); - } - else { - return parent; - } - } - - -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/UnKnownStyleException.java b/groovy/modules/groovy-swt/src/main/groovy/swt/UnKnownStyleException.java deleted file mode 100644 index d0c6e6d9ff..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/UnKnownStyleException.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Created on Jun 15, 2004 - * - */ -package groovy.swt; - -import org.codehaus.groovy.GroovyException; - - -/** - * @author Christiaan ten Klooster - * $Id$ - */ -public class UnKnownStyleException extends GroovyException { - - /** - * @param message - */ - public UnKnownStyleException(String style) { - super("Unknow SWT style: " + style); - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/ColorConverter.java b/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/ColorConverter.java deleted file mode 100644 index c7926c919e..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/ColorConverter.java +++ /dev/null @@ -1,115 +0,0 @@ -package groovy.swt.convertor; - -import java.util.List; -import java.util.StringTokenizer; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.eclipse.swt.graphics.RGB; - -/** - * A Converter that converts Strings in the form "#uuuuuu" or "x,y,z" into a - * RGB object - * - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class ColorConverter { - private Logger log = Logger.getLogger(getClass().getName()); - private static final ColorConverter instance = new ColorConverter(); - private static String usageText = "Color value should be in the form of '#xxxxxx' or 'x,y,z'"; - - public static ColorConverter getInstance() { - return instance; - } - - /** - * Parsers a String in the form "x, y, z" into an SWT RGB class - * - * @param value - * @return RGB - */ - protected RGB parseRGB(String value) { - StringTokenizer enum = new StringTokenizer(value, ","); - int red = 0; - int green = 0; - int blue = 0; - if (enum.hasMoreTokens()) { - red = parseNumber(enum.nextToken()); - } - if (enum.hasMoreTokens()) { - green = parseNumber(enum.nextToken()); - } - if (enum.hasMoreTokens()) { - blue = parseNumber(enum.nextToken()); - } - return new RGB(red, green, blue); - } - - /** - * Parsers a String in the form "#xxxxxx" into an SWT RGB class - * - * @param value - * @return RGB - */ - protected RGB parseHtml(String value) { - if (value.length() != 7) { - throw new IllegalArgumentException(usageText); - } - int colorValue = 0; - try { - colorValue = Integer.parseInt(value.substring(1), 16); - java.awt.Color swingColor = new java.awt.Color(colorValue); - return new RGB(swingColor.getRed(), swingColor.getGreen(), swingColor.getBlue()); - } - catch (NumberFormatException ex) { - throw new IllegalArgumentException(value + "is not a valid Html color\n " + ex); - } - } - - /** - * Parse a String - */ - public RGB parse(String value) { - if (value.length() <= 1) { - throw new IllegalArgumentException(usageText); - } - if (value.startsWith("[") && value.endsWith("]")) { - value = value.substring(1, value.length() - 1); - } - if (value.charAt(0) == '#') { - return parseHtml(value); - } - else if (value.indexOf(',') != -1) { - return parseRGB(value); - } - else { - throw new IllegalArgumentException(usageText); - } - } - - public RGB parse(List list) { - if (list.size() != 3) { - log.log(Level.WARNING, "color attribute must [x,y,z]"); - return null; - } - int red = parseNumber("" + list.get(0)); - int green = parseNumber("" + list.get(1)); - int blue = parseNumber("" + list.get(2)); - return new RGB(red, green, blue); - } - - public Object convert(Class type, Object value) { - Object answer = null; - if (value != null) { - String text = value.toString(); - answer = parse(text); - } - return answer; - } - - protected int parseNumber(String text) { - text = text.trim(); - return Integer.parseInt(text); - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/PointConverter.java b/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/PointConverter.java deleted file mode 100644 index fec26c679a..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/PointConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -package groovy.swt.convertor; - -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.eclipse.swt.graphics.Point; - -/** - * A Converter that turns a List in the form [x, y] into a Point object - * - * @author Christiaan ten Klooster - * $Id$ - */ -public class PointConverter { - private Logger log = Logger.getLogger(getClass().getName()); - - private static final PointConverter instance = new PointConverter(); - - public static PointConverter getInstance() { - return instance; - } - - public Point parse(List list) { - if (list.size() != 2) { - log.log(Level.WARNING, "size attribute must [x,y]"); - return null; - } - int x = parseNumber("" + list.get(0)); - int y = parseNumber("" + list.get(1)); - return new Point(x, y); - } - - protected int parseNumber(String text) { - return Integer.parseInt(text.trim()); - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AbstractSwtFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AbstractSwtFactory.java deleted file mode 100644 index 36579a37b2..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AbstractSwtFactory.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Created on Feb 15, 2004 - * - */ -package groovy.swt.factory; - -import groovy.swt.convertor.ColorConverter; -import groovy.swt.convertor.PointConverter; - -import java.lang.reflect.Field; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.codehaus.groovy.runtime.InvokerHelper; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Control; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public abstract class AbstractSwtFactory { - - public abstract Object newInstance(Map properties, Object parent) - throws GroovyException; - - /** - * set the properties - * - * @param bean - * @param properties - */ - protected void setBeanProperties(Object bean, Map properties) { - if (bean instanceof Control) { - Control control = (Control) bean; - - // set size of widget - Object size = properties.remove("size"); - if (size != null) { - setSize(control, size); - } - - // set background of widget - Object colorValue = properties.remove("background"); - if (colorValue != null) { - Color background = getColor(control, colorValue); - control.setBackground(background); - } - - // set foreground of widget - colorValue = properties.remove("foreground"); - if (colorValue != null) { - Color foreground = getColor(control, colorValue); - control.setForeground(foreground); - } - } - - for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { - Map.Entry entry = (Map.Entry) iter.next(); - String property = entry.getKey().toString(); - Object value = entry.getValue(); - Field field = null; - try { - field = bean.getClass().getDeclaredField(property); - if (value instanceof Boolean) { - field.setBoolean(bean, ((Boolean) value).booleanValue()); - } else if (value instanceof Integer) { - field.setInt(bean, ((Integer) value).intValue()); - } else if (value instanceof Double) { - field.setDouble(bean, ((Double) value).doubleValue()); - } else if (value instanceof Float) { - field.setFloat(bean, ((Float) value).floatValue()); - } else { - InvokerHelper.setProperty(bean, property, value); - } - - } catch (Exception e) { - } - if (field == null) { - InvokerHelper.setProperty(bean, property, value); - } - } - } - - protected Color getColor(Control control, Object colorValue) { - Color color = null; - if (colorValue != null) { - RGB rgb = null; - if (colorValue instanceof Color) { - color = (Color) colorValue; - } else if (colorValue instanceof List) { - rgb = ColorConverter.getInstance().parse((List) colorValue); - color = new Color(control.getDisplay(), rgb); - } else { - rgb = ColorConverter.getInstance().parse(colorValue.toString()); - color = new Color(control.getDisplay(), rgb); - } - } - return color; - } - - protected void setSize(Control control, Object size) { - Point point = null; - if (size != null) { - if (size instanceof Point) { - point = (Point) size; - } else if (size instanceof List) { - point = PointConverter.getInstance().parse((List) size); - } - control.setSize(point); - } - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ActionFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ActionFactory.java deleted file mode 100644 index d9b1b1330e..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ActionFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -package groovy.swt.factory; - -import groovy.jface.factory.ActionImpl; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IContributionManager; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class ActionFactory extends AbstractSwtFactory implements SwtFactory { - - - /* - * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - Action action = new ActionImpl(); - setBeanProperties(action, properties); - if (parent instanceof IContributionManager){ - IContributionManager contributionManager = (IContributionManager) parent; - contributionManager.add(action); - } - return action; - } -} diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AwtSwtFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AwtSwtFactory.java deleted file mode 100644 index b3066307aa..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AwtSwtFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Created on Feb 15, 2004 - * - */ -package groovy.swt.factory; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.swt.awt.SWT_AWT; -import org.eclipse.swt.widgets.Composite; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class AwtSwtFactory extends AbstractSwtFactory implements SwtFactory { - - /* - * @see groovy.swt.impl.Factory#newInstance(java.util.Map, java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - if (parent instanceof Composite) { - return SWT_AWT.new_Frame((Composite) parent); - } - - return null; - } - -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/Fontfactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/Fontfactory.java deleted file mode 100644 index a116961033..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/Fontfactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Created on Jun 15, 2004 - * - */ -package groovy.swt.factory; - -import groovy.swt.InvalidParentException; -import groovy.swt.SwtUtils; -import groovy.swt.UnKnownStyleException; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.widgets.Control; - -/** - * @author Christiaan ten Klooster - * $Id$ - */ -public class Fontfactory extends AbstractSwtFactory implements SwtFactory { - - /* - * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - - Object parentWidget = SwtUtils.getParentWidget(parent); - if (! (parentWidget instanceof Control)) { - throw new InvalidParentException("control"); - } - - Control parentControl = (Control) parentWidget; - - String styleProperty = (String) properties.remove("style"); - - if (styleProperty != null) { - int style; - try { - style = SwtUtils.parseStyle(SWT.class, styleProperty); - } catch (GroovyException e) { - throw new UnKnownStyleException(styleProperty); - } - - Font initialFont = parentControl.getFont(); - FontData[] fontData = initialFont.getFontData(); - for (int i = 0; i < fontData.length; i++) { - fontData[i].setStyle(style); - } - - Font newFont = new Font(parentControl.getDisplay(), fontData); - parentControl.setFont(newFont); - } - - return parentControl; - } - -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormFactory.java deleted file mode 100644 index e9c1ab068f..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormFactory.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Created on Feb 27, 2004 - * - */ -package groovy.swt.factory; - -import groovy.swt.InvalidParentException; -import groovy.swt.SwtUtils; - -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.FormColors; -import org.eclipse.ui.forms.HyperlinkSettings; -import org.eclipse.ui.forms.widgets.Form; -import org.eclipse.ui.forms.widgets.FormText; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.ScrolledForm; -import org.eclipse.ui.forms.widgets.ScrolledPageBook; -import org.eclipse.ui.forms.widgets.Section; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class FormFactory extends AbstractSwtFactory implements SwtFactory { - - /** static is evil, too many toolkits is evil */ - protected static FormToolkit toolkit; - - /** type of */ - private String type; - - /** - * @param string - */ - public FormFactory(String type) { - this.type = type; - } - - /* - * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - Composite parentComposite = (Composite) SwtUtils - .getParentWidget(parent); - if (toolkit == null) { - FormColors formColors = new FormColors(Display.getCurrent()); - toolkit = new FormToolkit(formColors); - toolkit.setBorderStyle(SWT.BORDER); - } - String styleProperty = (String) properties.remove("style"); - String text = (String) properties.remove("text"); - int style = SWT.NULL; - if (styleProperty != null) { - if (type.equals("formSection")) { - style = SwtUtils.parseStyle(Section.class, styleProperty); - } else { - style = SwtUtils.parseStyle(SWT.class, styleProperty); - } - } - if (parentComposite != null) { - Object formWidget = getFormWidget(parentComposite, properties, - style, text); - setBeanProperties(formWidget, properties); - - // if (formWidget instanceof Control) { - // Control control = (Control) parent; - // control.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - // } - - // if (parent instanceof Composite) { - // Composite parentComp = (Composite) parent; - // toolkit.paintBordersFor(parentComp); - // } - - return formWidget; - } else { - throw new InvalidParentException("composite instance"); - } - } - - /** - * @param parentComposite - * @param style - * @param text - * @return - */ - private Object getFormWidget(final Composite parentComposite, - Map properties, int style, String text) throws GroovyException { - if ("form".equals(type)) { - Form form = toolkit.createForm(parentComposite); - form.setText(text); - return form; - } - if ("scrolledForm".equals(type)) { - ScrolledForm scrolledForm = toolkit - .createScrolledForm(parentComposite); - scrolledForm.setText(text); - return scrolledForm; - } - if ("formButton".equals(type)) { return toolkit.createButton( - parentComposite, text, style); } - if ("formColors".equals(type)) { return toolkit.getColors(); } - if ("formComposite".equals(type)) { return toolkit.createComposite( - parentComposite, style); } - if ("formCompositeSeparator".equals(type)) { return toolkit - .createCompositeSeparator(parentComposite); } - if ("formExpandableComposite".equals(type)) { return toolkit - .createExpandableComposite(parentComposite, style); } - if ("formText".equals(type)) { - Text text2 = toolkit.createText(parentComposite, text, style); - toolkit.paintBordersFor(parentComposite); - return text2; - } - if ("formHyperlink".equals(type)) { return toolkit.createHyperlink( - parentComposite, text, style); } - if ("formImageHyperlink".equals(type)) { return toolkit - .createImageHyperlink(parentComposite, style); } - if ("formLabel".equals(type)) { return toolkit.createLabel( - parentComposite, text, style); } - if ("formPageBook".equals(type)) { return toolkit.createPageBook( - parentComposite, style); } - if ("formPageBookPage".equals(type)) { - if (parentComposite instanceof ScrolledPageBook) { - ScrolledPageBook pageBook = (ScrolledPageBook) parentComposite; - String key = (String) properties.remove("key"); - if (key != null) { - Composite page = pageBook.createPage(key); - pageBook.registerPage(key, page); - return page; - } - } else { - throw new InvalidParentException("formPageBook"); - } - } - if ("formSection".equals(type)) { - Section section = toolkit.createSection(parentComposite, style); - if (text != null) { - section.setText(text); - } - section.setSeparatorControl(toolkit - .createCompositeSeparator(section)); - String description = (String) properties.remove("description"); - if (description != null) { - section.setDescription(description); - } - Composite client = toolkit.createComposite(section); - client.setLayout(new GridLayout()); - section.setClient(client); - return section; - } - if ("formSeparator".equals(type)) { return toolkit.createSeparator( - parentComposite, style); } - if ("formTable".equals(type)) { return toolkit.createTable( - parentComposite, style); } - if ("formToolkit".equals(type)) { return toolkit; } - if ("formFormattedText".equals(type)) { - boolean parseTags = false; - boolean expandURLs = false; - if (properties.get("parseTags") != null) { - parseTags = ((Boolean) properties.remove("parseTags")) - .booleanValue(); - } - if (properties.get("expandURLs") != null) { - expandURLs = ((Boolean) properties.remove("expandURLs")) - .booleanValue(); - } - - FormText formText = toolkit.createFormText(parentComposite, true); - HyperlinkSettings hyperlinkSettings = new HyperlinkSettings(Display.getCurrent()); - hyperlinkSettings.setBackground(toolkit.getColors().getBackground()); - hyperlinkSettings.setActiveBackground(toolkit.getColors().getBackground()); - hyperlinkSettings.setForeground(toolkit.getColors().getForeground()); - hyperlinkSettings.setActiveForeground(toolkit.getColors().getBackground()); - formText.setHyperlinkSettings(hyperlinkSettings); - - formText.setText(text, parseTags, expandURLs); - - return formText; - } - if ("formTree".equals(type)) { return toolkit.createTree( - parentComposite, style); } - return null; - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormLayoutDataFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormLayoutDataFactory.java deleted file mode 100644 index 8866f74962..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormLayoutDataFactory.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Created on Feb 16, 2004 - * - */ -package groovy.swt.factory; - -import java.lang.reflect.Constructor; -import java.util.List; -import java.util.Map; -import org.codehaus.groovy.GroovyException; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Control; - -/** - * @author Christiaan ten Klooster $Id - * LayoutDataFactory.java,v 1.2 2004/03/18 08:51:47 ckl Exp $ - */ -public class FormLayoutDataFactory extends AbstractSwtFactory implements - SwtFactory { - - /* - * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map, - * java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) - throws GroovyException { - // get attachment properties - List left = (List) properties.remove("left"); - List right = (List) properties.remove("right"); - List top = (List) properties.remove("top"); - List bottom = (List) properties.remove("bottom"); - - // build new formdata - FormData formData = new FormData(); - if (left != null) { - formData.left = getFormAttachment(left); - } - if (right != null) { - formData.right = getFormAttachment(right); - } - if (top != null) { - formData.top = getFormAttachment(top); - } - if (bottom != null) { - formData.bottom = getFormAttachment(bottom); - } - - // set layout data - if (parent instanceof Control) { - Control control = (Control) parent; - control.setLayoutData(formData); - } - - // set remaining properties - setBeanProperties(formData, properties); - - // return formdata - return formData; - } - - /** - * @param list - * @return @throws - * GroovyException - */ - private FormAttachment getFormAttachment(List list) throws GroovyException { - FormAttachment formAttachment = null; - try { - // get constructor - Class[] types = new Class[list.size()]; - for (int i = 0; i < list.size(); i++) { - if (list.get(i).getClass() == Integer.class) { - types[i] = int.class; - } else if (list.get(i) instanceof Control) { - types[i] = Control.class; - } else { - throw new GroovyException( - "list element must be of type 'int' or 'Control': " - + list.get(i)); - } - } - Constructor constructor = FormAttachment.class - .getConstructor(types); - - // invoke constructor - if (constructor != null) { - Object[] values = new Object[list.size()]; - for (int i = 0; i < list.size(); i++) { - values[i] = list.get(i); - } - formAttachment = (FormAttachment) constructor - .newInstance(values); - } - } catch (Exception e) { - throw new GroovyException(e.getMessage()); - } - return formAttachment; - } -} \ No newline at end of file diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ImageFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ImageFactory.java deleted file mode 100644 index 565675a750..0000000000 --- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ImageFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Created on Feb 15, 2004 - * - */ -package groovy.swt.factory; - -import groovy.lang.MissingPropertyException; -import groovy.swt.InvalidParentException; - -import java.io.File; -import java.util.Map; - -import org.codehaus.groovy.GroovyException; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Decorations; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Item; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.forms.widgets.Form; -import org.eclipse.ui.forms.widgets.ScrolledForm; - -/** - * @author Christiaan ten Klooster - * @version $Revision$ - */ -public class ImageFactory extends AbstractSwtFactory implements SwtFactory { - - /* - * @see groovy.swt.impl.Factory#newInstance(java.util.Map, java.lang.Object) - */ - public Object newInstance(Map properties, Object parent) throws GroovyException { - String src = (String) properties.remove("src"); - if (src == null) { - throw new MissingPropertyException("src", Image.class); - } - - if (parent == null) { - throw new InvalidParentException("Widget or a Window"); - } - - Image image = null; - File imageFile = new File(src); - if (imageFile.exists()) { - image = new Image(Display.getCurrent(), src); - } else { - image = new Image(Display.getCurrent(), ImageFactory.class.getClassLoader() - .getResourceAsStream(src)); - } - - setImage(parent, image); - - return image; - } - - /** - * Add image to a widget or window - * - * @param parent - * @param image - * @throws JellyTagException - */ - protected void setImage(Object parent, Image image) throws GroovyException { - if (parent instanceof Label) { - Label label = (Label) parent; - label.setImage(image); - - } else if (parent instanceof Button) { - Button button = (Button) parent; - button.setImage(image); - - } else if (parent instanceof Item) { - Item item = (Item) parent; - item.setImage(image); - - } else if (parent instanceof Decorations) { - Decorations item = (Decorations) parent; - item.setImage(image); - - } else if (parent instanceof Form) { - Form form = (Form) parent; - form.setBackgroundImage(image); - - } else if (parent instanceof ScrolledForm) { - ScrolledForm form = (ScrolledForm) parent; - form.setBackgroundImage(image); - - } else if (parent instanceof Window) { - Window window = (Window) parent; - window.getShell().setImage(image); - - } else { - throw new GroovyException( - "This tag must be nested inside a