home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-10-08 | 2.6 KB | 64 lines | [TEXT/ALFA] |
- ##
- # This file will be sourced automatically, immediately after
- # the _first_ time the file which defines its mode is sourced.
- # Use this file to declare completion items and procedures
- # for this mode.
- #
- # Some common defaults are included below.
- ##
-
- ##
- # These declare, in order, the names of the completion
- # procedures for this mode. The actual procedure
- # must be named '${mode}Completion::${listItem}', unless
- # the item is 'completion::*' in which case that actual
- # procedure is called. The procedure 'modeALike' will
- # map modes to similar modes so procs don't need to be
- # repeated. However each mode requires its own array entry
- # here.
- ##
- set completions(Java) {completion::cmd completion::electric Class completion::word}
-
- # Declare some items to add to the elec menu
- lunion "JavaTemplates" createNewClass newFunction
-
- # ◊◊◊◊ Completions ◊◊◊◊ #
-
- set Javacmds {
- abstract boolean break byvalue catch class const continue
- default double extends false final finally float future generic
- implements import inner instanceof interface native operator outer
- package private protected public return short static super switch
- synchronized throw throws transient volatile while
- }
-
- # NOTE FROM VINCE: I just copied these from C++ mode, I'm not sure if
- # some ought to be a bit different for Java.
- set Javaelectrics(for) " (•init•;•test•;•increment•)\{\n\t•loop body•\n\}\n••"
- set Javaelectrics(while) " (•test•)\{\n\t•loop body•\n\}\n••"
- set Javaelectrics(switch) " (•value•)\{\n…case •item•:\n\t•case body•\n…default:\n\t•default body•\n\}\n••"
- set Javaelectrics(case) " •item•:\n…•case body•\ncase"
- set Javaelectrics(do) " \{••\n\t••\n\} while (•test•);\n••"
- set Javaelectrics(if) "(•condition•)\{\n\t•if body•\n\} ••"
- set Javaelectrics(else) " \{\n\t•else body•\n\} ••"
- set Javaelectrics(class) " •object name• extends •super-class name• implements •interface-names• \{\n…public:\n\t•object name•(•args•);\n\n\};\n••"
- set Javaelectrics(try) " \{\r\t•try body•\r\}\rcatch (•...•) \{\r\t•catch body•\r\}\r••"
-
- ##
- # -------------------------------------------------------------------------
- #
- # "Java::Completion::Class" --
- #
- # If we've just typed the name of a class, struct or union, we can
- # automatically fill in all occurrences of that name in the rest of
- # the class. (e.g. in constructors, destructors etc.)
- # -------------------------------------------------------------------------
- ##
- proc Java::Completion::Class { {cmd ""}} {
- set cl [completion::lastTwoWords prev]
- if {[lsearch "class struct union" [string trim $prev]] == -1} {
- return 0
- }
- if [ring::type] {ring::replaceStopMatches "object name" $cl}
- }
-