merged
authorwenzelm
Wed, 08 Jun 2011 22:13:49 +0200
changeset 44168e77baf329f48
parent 44154 755e3d5ea3f2
parent 44167 acc680ab6204
child 44169 82d4874757df
merged
src/HOL/Tools/ATP/atp_translate.ML
src/HOL/Tools/Metis/metis_reconstruct.ML
src/Tools/jEdit/build.xml
src/Tools/jEdit/contrib/jEdit/build-nb.xml
src/Tools/jEdit/contrib/jEdit/nbproject/project.xml
src/Tools/jEdit/dist-template/README.html
src/Tools/jEdit/dist-template/etc/isabelle-jedit.css
src/Tools/jEdit/dist-template/etc/settings
src/Tools/jEdit/dist-template/lib/Tools/jedit
src/Tools/jEdit/dist-template/modes/isabelle-session.xml
src/Tools/jEdit/dist-template/modes/isabelle.xml
src/Tools/jEdit/dist-template/properties/jedit.props
src/Tools/jEdit/jedit_build/Tools/jedit
src/Tools/jEdit/makedist
src/Tools/jEdit/manifest.mf
src/Tools/jEdit/nbproject/build-impl.xml
src/Tools/jEdit/nbproject/genfiles.properties
src/Tools/jEdit/nbproject/project.properties
src/Tools/jEdit/nbproject/project.xml
src/Tools/jEdit/plugin/Isabelle.props
src/Tools/jEdit/plugin/actions.xml
src/Tools/jEdit/plugin/dockables.xml
src/Tools/jEdit/plugin/services.xml
src/Tools/jEdit/src/Dummy.java
src/Tools/jEdit/src/jedit/dockable.scala
src/Tools/jEdit/src/jedit/document_model.scala
src/Tools/jEdit/src/jedit/document_view.scala
src/Tools/jEdit/src/jedit/html_panel.scala
src/Tools/jEdit/src/jedit/isabelle_encoding.scala
src/Tools/jEdit/src/jedit/isabelle_hyperlinks.scala
src/Tools/jEdit/src/jedit/isabelle_markup.scala
src/Tools/jEdit/src/jedit/isabelle_options.scala
src/Tools/jEdit/src/jedit/isabelle_sidekick.scala
src/Tools/jEdit/src/jedit/output_dockable.scala
src/Tools/jEdit/src/jedit/plugin.scala
src/Tools/jEdit/src/jedit/protocol_dockable.scala
src/Tools/jEdit/src/jedit/raw_output_dockable.scala
src/Tools/jEdit/src/jedit/scala_console.scala
src/Tools/jEdit/src/jedit/session_dockable.scala
     1.1 --- a/.hgignore	Wed Jun 08 17:01:07 2011 +0200
     1.2 +++ b/.hgignore	Wed Jun 08 22:13:49 2011 +0200
     1.3 @@ -21,8 +21,4 @@
     1.4  ^doc-src/.*\.log
     1.5  ^doc-src/.*\.out
     1.6  ^doc-src/.*\.toc
     1.7 -
     1.8 -^src/Tools/jEdit/nbproject/private/
     1.9 -^src/Tools/jEdit/build/
    1.10  ^src/Tools/jEdit/dist/
    1.11 -^src/Tools/jEdit/contrib/
     2.1 --- a/Admin/build	Wed Jun 08 17:01:07 2011 +0200
     2.2 +++ b/Admin/build	Wed Jun 08 22:13:49 2011 +0200
     2.3 @@ -27,6 +27,7 @@
     2.4      browser         graph browser (requires jdk)
     2.5      doc             documentation (requires latex and rail)
     2.6      jars            Isabelle/Scala layer (requires Scala in \$SCALA_HOME)
     2.7 +    jars_fresh      fresh build of jars
     2.8  
     2.9  EOF
    2.10    exit 1
    2.11 @@ -84,7 +85,7 @@
    2.12  function build_jars ()
    2.13  {
    2.14    pushd "$ISABELLE_HOME/src/Pure" >/dev/null
    2.15 -  "$ISABELLE_TOOL" env ./build-jars || exit $?
    2.16 +  "$ISABELLE_TOOL" env ./build-jars "$@" || exit $?
    2.17    popd >/dev/null
    2.18  }
    2.19  
    2.20 @@ -98,6 +99,7 @@
    2.21      browser) build_browser;;
    2.22      doc) build_doc;;
    2.23      jars) build_jars;;
    2.24 +    jars_fresh) build_jars -f;;
    2.25      *) fail "Bad module $MODULE"
    2.26    esac
    2.27  done
     3.1 --- a/etc/components	Wed Jun 08 17:01:07 2011 +0200
     3.2 +++ b/etc/components	Wed Jun 08 22:13:49 2011 +0200
     3.3 @@ -11,6 +11,7 @@
     3.4  src/Sequents
     3.5  #misc components
     3.6  src/Tools/Code
     3.7 +src/Tools/jEdit
     3.8  src/Tools/WWW_Find
     3.9  src/HOL/Tools/ATP
    3.10  src/HOL/Mirabelle
     4.1 --- a/src/HOL/Mutabelle/mutabelle_extra.ML	Wed Jun 08 17:01:07 2011 +0200
     4.2 +++ b/src/HOL/Mutabelle/mutabelle_extra.ML	Wed Jun 08 22:13:49 2011 +0200
     4.3 @@ -389,7 +389,7 @@
     4.4  fun mutate_theorem create_entry thy mtds thm =
     4.5    let
     4.6      val exec = is_executable_thm thy thm
     4.7 -    val _ = Output.tracing (if exec then "EXEC" else "NOEXEC")
     4.8 +    val _ = tracing (if exec then "EXEC" else "NOEXEC")
     4.9      val mutants =
    4.10            (if num_mutations = 0 then
    4.11               [Thm.prop_of thm]
     5.1 --- a/src/HOL/Nominal/nominal_fresh_fun.ML	Wed Jun 08 17:01:07 2011 +0200
     5.2 +++ b/src/HOL/Nominal/nominal_fresh_fun.ML	Wed Jun 08 22:13:49 2011 +0200
     5.3 @@ -5,8 +5,13 @@
     5.4  a tactic to analyse instances of the fresh_fun.
     5.5  *)
     5.6  
     5.7 -(* First some functions that should be in the library *)
     5.8 +(* First some functions that should be in the library *)  (* FIXME really?? *)
     5.9  
    5.10 +(* FIXME proper ML structure *)
    5.11 +
    5.12 +(* FIXME res_inst_tac mostly obsolete, cf. Subgoal.FOCUS *)
    5.13 +
    5.14 +(* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
    5.15  fun gen_res_inst_tac_term instf tyinst tinst elim th i st =
    5.16    let
    5.17      val thy = theory_of_thm st;
    5.18 @@ -25,7 +30,8 @@
    5.19        (Thm.lift_rule cgoal th)
    5.20    in
    5.21      compose_tac (elim, th', nprems_of th) i st
    5.22 -  end handle Subscript => Seq.empty;
    5.23 +  end handle General.Subscript => Seq.empty;
    5.24 +(* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
    5.25  
    5.26  val res_inst_tac_term =
    5.27    gen_res_inst_tac_term (curry Thm.instantiate);
     6.1 --- a/src/HOL/Nominal/nominal_permeq.ML	Wed Jun 08 17:01:07 2011 +0200
     6.2 +++ b/src/HOL/Nominal/nominal_permeq.ML	Wed Jun 08 22:13:49 2011 +0200
     6.3 @@ -287,6 +287,7 @@
     6.4    | collect_vars i (Abs (_, _, t)) vs = collect_vars (i+1) t vs
     6.5    | collect_vars i (t $ u) vs = collect_vars i u (collect_vars i t vs);
     6.6  
     6.7 +(* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
     6.8  fun finite_guess_tac_i tactical ss i st =
     6.9      let val goal = nth (cprems_of st) (i - 1)
    6.10      in
    6.11 @@ -318,12 +319,14 @@
    6.12            end
    6.13          | _ => Seq.empty
    6.14      end
    6.15 -    handle Subscript => Seq.empty
    6.16 +    handle General.Subscript => Seq.empty
    6.17 +(* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
    6.18  
    6.19  
    6.20  (* tactic that guesses whether an atom is fresh for an expression  *)
    6.21  (* it first collects all free variables and tries to show that the *) 
    6.22  (* support of these free variables (op supports) the goal          *)
    6.23 +(* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
    6.24  fun fresh_guess_tac_i tactical ss i st =
    6.25      let 
    6.26          val goal = nth (cprems_of st) (i - 1)
    6.27 @@ -361,7 +364,8 @@
    6.28          | _ => (tactical ("if it is not of the form _\<sharp>_, then try the simplifier",   
    6.29                            (asm_full_simp_tac (HOL_ss addsimps [fresh_prod]@fresh_atm) i))) st
    6.30      end
    6.31 -    handle Subscript => Seq.empty;
    6.32 +    handle General.Subscript => Seq.empty;
    6.33 +(* FIXME proper SUBGOAL/CSUBGOAL instead of cprems_of etc. *)
    6.34  
    6.35  val eqvt_simp_tac        = eqvt_asm_full_simp_tac_i NO_DEBUG_tac;
    6.36  
     7.1 --- a/src/HOL/Statespace/state_space.ML	Wed Jun 08 17:01:07 2011 +0200
     7.2 +++ b/src/HOL/Statespace/state_space.ML	Wed Jun 08 22:13:49 2011 +0200
     7.3 @@ -360,7 +360,7 @@
     7.4      val all_comps = rename renaming (parent_comps @ map (apsnd subst) components);
     7.5    in all_comps end;
     7.6  
     7.7 -fun take_upto i xs = List.take(xs,i) handle Subscript => xs;
     7.8 +fun take_upto i xs = List.take(xs,i) handle General.Subscript => xs;
     7.9  
    7.10  fun statespace_definition state_type args name parents parent_comps components thy =
    7.11    let
     8.1 --- a/src/HOL/Tools/ATP/atp_translate.ML	Wed Jun 08 17:01:07 2011 +0200
     8.2 +++ b/src/HOL/Tools/ATP/atp_translate.ML	Wed Jun 08 22:13:49 2011 +0200
     8.3 @@ -1,4 +1,4 @@
     8.4 -(*  Title:      HOL/Tools/Sledgehammer/sledgehammer_atp_translate.ML
     8.5 +(*  Title:      HOL/Tools/ATP/atp_translate.ML
     8.6      Author:     Fabian Immler, TU Muenchen
     8.7      Author:     Makarius
     8.8      Author:     Jasmin Blanchette, TU Muenchen
     8.9 @@ -239,7 +239,7 @@
    8.10            (* translation of #" " to #"/" *)
    8.11            un (Char.chr (Char.ord c - upper_a_minus_space) :: rcs) cs
    8.12          else
    8.13 -          let val digits = List.take (c::cs, 3) handle Subscript => [] in
    8.14 +          let val digits = List.take (c::cs, 3) handle General.Subscript => [] in
    8.15              case Int.fromString (String.implode digits) of
    8.16                SOME n => un (Char.chr n :: rcs) (List.drop (cs, 2))
    8.17              | NONE => un (c:: #"_"::rcs) cs (* ERROR *)
     9.1 --- a/src/HOL/Tools/Function/fun.ML	Wed Jun 08 17:01:07 2011 +0200
     9.2 +++ b/src/HOL/Tools/Function/fun.ML	Wed Jun 08 22:13:49 2011 +0200
     9.3 @@ -86,9 +86,9 @@
     9.4  fun warnings ctxt origs tss =
     9.5    let
     9.6      fun warn_redundant t =
     9.7 -      Output.warning ("Ignoring redundant equation: " ^ quote (Syntax.string_of_term ctxt t))
     9.8 +      warning ("Ignoring redundant equation: " ^ quote (Syntax.string_of_term ctxt t))
     9.9      fun warn_missing strs =
    9.10 -      Output.warning (cat_lines ("Missing patterns in function definition:" :: strs))
    9.11 +      warning (cat_lines ("Missing patterns in function definition:" :: strs))
    9.12  
    9.13      val (tss', added) = chop (length origs) tss
    9.14  
    10.1 --- a/src/HOL/Tools/Function/function.ML	Wed Jun 08 17:01:07 2011 +0200
    10.2 +++ b/src/HOL/Tools/Function/function.ML	Wed Jun 08 22:13:49 2011 +0200
    10.3 @@ -87,8 +87,7 @@
    10.4      val defname = mk_defname fixes
    10.5      val FunctionConfig {partials, default, ...} = config
    10.6      val _ =
    10.7 -      if is_some default then Output.legacy_feature
    10.8 -        "'function (default)'. Use 'partial_function'."
    10.9 +      if is_some default then legacy_feature "'function (default)'. Use 'partial_function'."
   10.10        else ()
   10.11  
   10.12      val ((goal_state, cont), lthy') =
    11.1 --- a/src/HOL/Tools/Metis/metis_reconstruct.ML	Wed Jun 08 17:01:07 2011 +0200
    11.2 +++ b/src/HOL/Tools/Metis/metis_reconstruct.ML	Wed Jun 08 22:13:49 2011 +0200
    11.3 @@ -377,7 +377,7 @@
    11.4                  val p' = if adjustment > p then p else p - adjustment
    11.5                  val tm_p =
    11.6                    nth args p'
    11.7 -                  handle Subscript => path_finder_fail tm (p :: ps) (SOME t)
    11.8 +                  handle General.Subscript => path_finder_fail tm (p :: ps) (SOME t)
    11.9                  val _ = trace_msg ctxt (fn () =>
   11.10                      "path_finder: " ^ string_of_int p ^ "  " ^
   11.11                      Syntax.string_of_term ctxt tm_p)
    12.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Wed Jun 08 17:01:07 2011 +0200
    12.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML	Wed Jun 08 22:13:49 2011 +0200
    12.3 @@ -211,7 +211,7 @@
    12.4      | ths => rev ths
    12.5      val _ =
    12.6        if show_intermediate_results options then
    12.7 -        Output.tracing ("Specification for " ^ (Syntax.string_of_term_global thy t) ^ ":\n" ^
    12.8 +        tracing ("Specification for " ^ (Syntax.string_of_term_global thy t) ^ ":\n" ^
    12.9            commas (map (Display.string_of_thm_global thy) spec))
   12.10        else ()
   12.11    in
    13.1 --- a/src/HOL/Tools/inductive_set.ML	Wed Jun 08 17:01:07 2011 +0200
    13.2 +++ b/src/HOL/Tools/inductive_set.ML	Wed Jun 08 22:13:49 2011 +0200
    13.3 @@ -206,7 +206,7 @@
    13.4    | (u, ts) => (case Option.map (lookup_arity thy arities) (name_type_of u) of
    13.5        SOME (SOME (_, (arity, _))) =>
    13.6          (fold (infer_arities thy arities) (arity ~~ List.take (ts, length arity)) fs
    13.7 -           handle Subscript => error "infer_arities: bad term")
    13.8 +           handle General.Subscript => error "infer_arities: bad term")
    13.9      | _ => fold (infer_arities thy arities) (map (pair NONE) ts)
   13.10        (case optf of
   13.11           NONE => fs
    14.1 --- a/src/HOL/Tools/recdef.ML	Wed Jun 08 17:01:07 2011 +0200
    14.2 +++ b/src/HOL/Tools/recdef.ML	Wed Jun 08 22:13:49 2011 +0200
    14.3 @@ -261,7 +261,7 @@
    14.4          NONE => error ("No recdef definition of constant: " ^ quote name)
    14.5        | SOME {tcs, ...} => tcs);
    14.6      val i = the_default 1 opt_i;
    14.7 -    val tc = nth tcs (i - 1) handle Subscript =>
    14.8 +    val tc = nth tcs (i - 1) handle General.Subscript =>
    14.9        error ("No termination condition #" ^ string_of_int i ^
   14.10          " in recdef definition of " ^ quote name);
   14.11    in
    15.1 --- a/src/HOL/ex/atp_export.ML	Wed Jun 08 17:01:07 2011 +0200
    15.2 +++ b/src/HOL/ex/atp_export.ML	Wed Jun 08 22:13:49 2011 +0200
    15.3 @@ -22,7 +22,7 @@
    15.4  val fact_name_of = prefix ATP_Translate.fact_prefix o ascii_of
    15.5  
    15.6  fun facts_of thy =
    15.7 -  Sledgehammer_Filter.all_facts (ProofContext.init_global thy) Symtab.empty
    15.8 +  Sledgehammer_Filter.all_facts (Proof_Context.init_global thy) Symtab.empty
    15.9                                  true (K true) [] []
   15.10  
   15.11  fun fold_body_thms f =
   15.12 @@ -44,7 +44,7 @@
   15.13    in names end
   15.14  
   15.15  fun interesting_const_names ctxt =
   15.16 -  let val thy = ProofContext.theory_of ctxt in
   15.17 +  let val thy = Proof_Context.theory_of ctxt in
   15.18      Sledgehammer_Filter.const_names_in_fact thy
   15.19          (Sledgehammer_Provers.is_built_in_const_for_prover ctxt ATP_Systems.eN)
   15.20    end
    16.1 --- a/src/Provers/order.ML	Wed Jun 08 17:01:07 2011 +0200
    16.2 +++ b/src/Provers/order.ML	Wed Jun 08 22:13:49 2011 +0200
    16.3 @@ -1247,9 +1247,9 @@
    16.4    end
    16.5    handle Contr p =>
    16.6        (Subgoal.FOCUS (fn {prems = asms, ...} => rtac (prove asms p) 1) ctxt n st
    16.7 -        handle Subscript => Seq.empty)
    16.8 +        handle General.Subscript => Seq.empty)
    16.9     | Cannot => Seq.empty
   16.10 -   | Subscript => Seq.empty)
   16.11 +   | General.Subscript => Seq.empty)
   16.12  end;
   16.13  
   16.14  (* partial_tac - solves partial orders *)
    17.1 --- a/src/Provers/quasi.ML	Wed Jun 08 17:01:07 2011 +0200
    17.2 +++ b/src/Provers/quasi.ML	Wed Jun 08 22:13:49 2011 +0200
    17.3 @@ -589,8 +589,8 @@
    17.4   end
    17.5   handle Contr p =>
    17.6      (Subgoal.FOCUS (fn {prems, ...} => rtac (prove prems p) 1) ctxt n st
    17.7 -      handle Subscript => Seq.empty)
    17.8 +      handle General.Subscript => Seq.empty)
    17.9    | Cannot => Seq.empty
   17.10 -  | Subscript => Seq.empty);
   17.11 +  | General.Subscript => Seq.empty);
   17.12  
   17.13  end;
    18.1 --- a/src/Provers/trancl.ML	Wed Jun 08 17:01:07 2011 +0200
    18.2 +++ b/src/Provers/trancl.ML	Wed Jun 08 22:13:49 2011 +0200
    18.3 @@ -567,6 +567,6 @@
    18.4        val thms = map (prove thy rel' prems) prfs
    18.5      in rtac (prove thy rel' thms prf) 1 end) ctxt n st
    18.6   end
    18.7 - handle Cannot => Seq.empty | Subscript => Seq.empty);
    18.8 + handle Cannot => Seq.empty | General.Subscript => Seq.empty);
    18.9  
   18.10  end;
    19.1 --- a/src/Pure/Isar/parse.scala	Wed Jun 08 17:01:07 2011 +0200
    19.2 +++ b/src/Pure/Isar/parse.scala	Wed Jun 08 22:13:49 2011 +0200
    19.3 @@ -1,4 +1,4 @@
    19.4 -/*  Title:      Pure/Isar/outer_parse.scala
    19.5 +/*  Title:      Pure/Isar/parse.scala
    19.6      Author:     Makarius
    19.7  
    19.8  Generic parsers for Isabelle/Isar outer syntax.
    20.1 --- a/src/Pure/Proof/reconstruct.ML	Wed Jun 08 17:01:07 2011 +0200
    20.2 +++ b/src/Pure/Proof/reconstruct.ML	Wed Jun 08 22:13:49 2011 +0200
    20.3 @@ -88,7 +88,7 @@
    20.4            in (t' $ u', V, vTs2, unifyT thy env3 T (U --> V)) end)
    20.5        end
    20.6    | infer_type thy env Ts vTs (t as Bound i) = ((t, nth Ts i, vTs, env)
    20.7 -      handle Subscript => error ("infer_type: bad variable index " ^ string_of_int i));
    20.8 +      handle General.Subscript => error ("infer_type: bad variable index " ^ string_of_int i));
    20.9  
   20.10  fun cantunify thy (t, u) = error ("Non-unifiable terms:\n" ^
   20.11    Syntax.string_of_term_global thy t ^ "\n\n" ^ Syntax.string_of_term_global thy u);
   20.12 @@ -145,7 +145,7 @@
   20.13        (Envir.head_norm env prop, prf, cnstrts, env, vTs);
   20.14  
   20.15      fun mk_cnstrts env _ Hs vTs (PBound i) = ((nth Hs i, PBound i, [], env, vTs)
   20.16 -          handle Subscript => error ("mk_cnstrts: bad variable index " ^ string_of_int i))
   20.17 +          handle General.Subscript => error ("mk_cnstrts: bad variable index " ^ string_of_int i))
   20.18        | mk_cnstrts env Ts Hs vTs (Abst (s, opT, cprf)) =
   20.19            let
   20.20              val (T, env') =
    21.1 --- a/src/Pure/System/isabelle_process.scala	Wed Jun 08 17:01:07 2011 +0200
    21.2 +++ b/src/Pure/System/isabelle_process.scala	Wed Jun 08 22:13:49 2011 +0200
    21.3 @@ -1,4 +1,4 @@
    21.4 -/*  Title:      Pure/System/isabelle_process.ML
    21.5 +/*  Title:      Pure/System/isabelle_process.scala
    21.6      Author:     Makarius
    21.7      Options:    :folding=explicit:collapseFolds=1:
    21.8  
    22.1 --- a/src/Pure/Thy/term_style.ML	Wed Jun 08 17:01:07 2011 +0200
    22.2 +++ b/src/Pure/Thy/term_style.ML	Wed Jun 08 22:13:49 2011 +0200
    22.3 @@ -53,7 +53,7 @@
    22.4        >> fold I
    22.5    || Scan.succeed I));
    22.6  
    22.7 -val parse_bare = Args.context :|-- (fn ctxt => (Output.legacy_feature "Old-style antiquotation style.";
    22.8 +val parse_bare = Args.context :|-- (fn ctxt => (legacy_feature "Old-style antiquotation style.";
    22.9    Scan.lift Args.liberal_name
   22.10    >> (fn name => fst (Args.context_syntax "style"
   22.11         (Scan.lift (the_style (Proof_Context.theory_of ctxt) name))
   22.12 @@ -84,7 +84,7 @@
   22.13  fun style_parm_premise i = Scan.succeed (fn ctxt => fn t =>
   22.14    let
   22.15      val i_str = string_of_int i;
   22.16 -    val _ = Output.legacy_feature (quote ("prem" ^ i_str)
   22.17 +    val _ = legacy_feature (quote ("prem" ^ i_str)
   22.18        ^ " term style encountered; use explicit argument syntax "
   22.19        ^ quote ("prem " ^ i_str) ^ " instead.");
   22.20      val prems = Logic.strip_imp_prems t;
    23.1 --- a/src/Pure/build-jars	Wed Jun 08 17:01:07 2011 +0200
    23.2 +++ b/src/Pure/build-jars	Wed Jun 08 22:13:49 2011 +0200
    23.3 @@ -9,6 +9,19 @@
    23.4  
    23.5  ## diagnostics
    23.6  
    23.7 +PRG="$(basename "$0")"
    23.8 +
    23.9 +function usage()
   23.10 +{
   23.11 +  echo
   23.12 +  echo "Usage: isabelle $PRG [OPTIONS]"
   23.13 +  echo
   23.14 +  echo "  Options are:"
   23.15 +  echo "    -f           fresh build"
   23.16 +  echo
   23.17 +  exit 1
   23.18 +}
   23.19 +
   23.20  function fail()
   23.21  {
   23.22    echo "$1" >&2
   23.23 @@ -19,6 +32,33 @@
   23.24  [ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
   23.25  
   23.26  
   23.27 +## process command line
   23.28 +
   23.29 +# options
   23.30 +
   23.31 +FRESH=""
   23.32 +
   23.33 +while getopts "f" OPT
   23.34 +do
   23.35 +  case "$OPT" in
   23.36 +    f)
   23.37 +      FRESH=true
   23.38 +      ;;
   23.39 +    \?)
   23.40 +      usage
   23.41 +      ;;
   23.42 +  esac
   23.43 +done
   23.44 +
   23.45 +shift $(($OPTIND - 1))
   23.46 +
   23.47 +
   23.48 +# args
   23.49 +
   23.50 +[ "$#" -ne 0 ] && usage
   23.51 +
   23.52 +
   23.53 +
   23.54  ## dependencies
   23.55  
   23.56  declare -a SOURCES=(
   23.57 @@ -75,16 +115,19 @@
   23.58  
   23.59  ## main
   23.60  
   23.61 -OUTDATED=false
   23.62 -
   23.63 -for SOURCE in "${SOURCES[@]}"
   23.64 -do
   23.65 -  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
   23.66 -  for TARGET in "${TARGETS[@]}"
   23.67 +if [ -n "$FRESH" ]; then
   23.68 +  OUTDATED=true
   23.69 +else
   23.70 +  OUTDATED=false
   23.71 +  for SOURCE in "${SOURCES[@]}"
   23.72    do
   23.73 -    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
   23.74 +    [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
   23.75 +    for TARGET in "${TARGETS[@]}"
   23.76 +    do
   23.77 +      [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
   23.78 +    done
   23.79    done
   23.80 -done
   23.81 +fi
   23.82  
   23.83  if [ "$OUTDATED" = true ]
   23.84  then
   23.85 @@ -96,17 +139,20 @@
   23.86    "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target:jvm-1.5 "${SOURCES[@]}" || \
   23.87      fail "Failed to compile sources"
   23.88    mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
   23.89 -  (
   23.90 -    cd classes
   23.91 -    jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
   23.92 -      fail "Failed to produce $PURE_JAR"
   23.93  
   23.94 -    cp "$SCALA_HOME/lib/scala-swing.jar" .
   23.95 -    jar xf scala-swing.jar
   23.96 +  pushd classes >/dev/null
   23.97  
   23.98 -    cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
   23.99 -    jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
  23.100 -      fail "Failed to produce $FULL_JAR"
  23.101 -  )
  23.102 +  jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
  23.103 +    fail "Failed to produce $PURE_JAR"
  23.104 +
  23.105 +  cp "$SCALA_HOME/lib/scala-swing.jar" .
  23.106 +  jar xf scala-swing.jar
  23.107 +
  23.108 +  cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
  23.109 +  jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
  23.110 +    fail "Failed to produce $FULL_JAR"
  23.111 +
  23.112 +  popd >/dev/null
  23.113 +
  23.114    rm -rf classes
  23.115  fi
    24.1 --- a/src/Pure/envir.ML	Wed Jun 08 17:01:07 2011 +0200
    24.2 +++ b/src/Pure/envir.ML	Wed Jun 08 22:13:49 2011 +0200
    24.3 @@ -289,7 +289,7 @@
    24.4        | fast Ts (Const (_, T)) = T
    24.5        | fast Ts (Free (_, T)) = T
    24.6        | fast Ts (Bound i) =
    24.7 -          (nth Ts i handle Subscript => raise TERM ("fastype: Bound", [Bound i]))
    24.8 +          (nth Ts i handle General.Subscript => raise TERM ("fastype: Bound", [Bound i]))
    24.9        | fast Ts (Var (_, T)) = T
   24.10        | fast Ts (Abs (_, T, u)) = T --> fast (T :: Ts) u;
   24.11    in fast end;
    25.1 --- a/src/Pure/library.ML	Wed Jun 08 17:01:07 2011 +0200
    25.2 +++ b/src/Pure/library.ML	Wed Jun 08 22:13:49 2011 +0200
    25.3 @@ -429,7 +429,7 @@
    25.4    raise Subscript if list too short*)
    25.5  fun nth xs i = List.nth (xs, i);
    25.6  
    25.7 -fun nth_list xss i = nth xss i handle Subscript => [];
    25.8 +fun nth_list xss i = nth xss i handle General.Subscript => [];
    25.9  
   25.10  fun nth_map 0 f (x :: xs) = f x :: xs
   25.11    | nth_map n f (x :: xs) = x :: nth_map (n - 1) f xs
    26.1 --- a/src/Pure/proofterm.ML	Wed Jun 08 17:01:07 2011 +0200
    26.2 +++ b/src/Pure/proofterm.ML	Wed Jun 08 22:13:49 2011 +0200
    26.3 @@ -529,7 +529,7 @@
    26.4      fun subst' lev (Bound i) =
    26.5           (if i<lev then raise Same.SAME    (*var is locally bound*)
    26.6            else  incr_boundvars lev (nth args (i-lev))
    26.7 -                  handle Subscript => Bound (i-n))  (*loose: change it*)
    26.8 +                  handle General.Subscript => Bound (i-n))  (*loose: change it*)
    26.9        | subst' lev (Abs (a, T, body)) = Abs (a, T,  subst' (lev+1) body)
   26.10        | subst' lev (f $ t) = (subst' lev f $ substh' lev t
   26.11            handle Same.SAME => f $ subst' lev t)
   26.12 @@ -554,7 +554,7 @@
   26.13      fun subst (PBound i) Plev tlev =
   26.14           (if i < Plev then raise Same.SAME    (*var is locally bound*)
   26.15            else incr_pboundvars Plev tlev (nth args (i-Plev))
   26.16 -                 handle Subscript => PBound (i-n)  (*loose: change it*))
   26.17 +                 handle General.Subscript => PBound (i-n)  (*loose: change it*))
   26.18        | subst (AbsP (a, t, body)) Plev tlev = AbsP (a, t, subst body (Plev+1) tlev)
   26.19        | subst (Abst (a, T, body)) Plev tlev = Abst (a, T, subst body Plev (tlev+1))
   26.20        | subst (prf %% prf') Plev tlev = (subst prf Plev tlev %% substh prf' Plev tlev
    27.1 --- a/src/Pure/sign.ML	Wed Jun 08 17:01:07 2011 +0200
    27.2 +++ b/src/Pure/sign.ML	Wed Jun 08 22:13:49 2011 +0200
    27.3 @@ -269,7 +269,7 @@
    27.4      fun typ_of (_, Const (_, T)) = T
    27.5        | typ_of (_, Free  (_, T)) = T
    27.6        | typ_of (_, Var (_, T)) = T
    27.7 -      | typ_of (bs, Bound i) = snd (nth bs i handle Subscript =>
    27.8 +      | typ_of (bs, Bound i) = snd (nth bs i handle General.Subscript =>
    27.9            raise TYPE ("Loose bound variable: B." ^ string_of_int i, [], [Bound i]))
   27.10        | typ_of (bs, Abs (x, T, body)) = T --> typ_of ((x, T) :: bs, body)
   27.11        | typ_of (bs, t $ u) =
    28.1 --- a/src/Pure/tactical.ML	Wed Jun 08 17:01:07 2011 +0200
    28.2 +++ b/src/Pure/tactical.ML	Wed Jun 08 22:13:49 2011 +0200
    28.3 @@ -354,7 +354,7 @@
    28.4              orelse
    28.5               not (Pattern.aeconv (t, Thm.term_of (Thm.cprem_of st' (Thm.nprems_of st' - d))))
    28.6      in  Seq.filter diff (tac i st)  end
    28.7 -    handle Subscript => Seq.empty  (*no subgoal i*);
    28.8 +    handle General.Subscript => Seq.empty  (*no subgoal i*);
    28.9  
   28.10  (*Returns all states where some subgoals have been solved.  For
   28.11    subgoal-based tactics this means subgoal i has been solved
    29.1 --- a/src/Pure/term.ML	Wed Jun 08 17:01:07 2011 +0200
    29.2 +++ b/src/Pure/term.ML	Wed Jun 08 22:13:49 2011 +0200
    29.3 @@ -311,7 +311,7 @@
    29.4  fun type_of1 (Ts, Const (_,T)) = T
    29.5    | type_of1 (Ts, Free  (_,T)) = T
    29.6    | type_of1 (Ts, Bound i) = (nth Ts i
    29.7 -        handle Subscript => raise TYPE("type_of: bound variable", [], [Bound i]))
    29.8 +        handle General.Subscript => raise TYPE("type_of: bound variable", [], [Bound i]))
    29.9    | type_of1 (Ts, Var (_,T)) = T
   29.10    | type_of1 (Ts, Abs (_,T,body)) = T --> type_of1(T::Ts, body)
   29.11    | type_of1 (Ts, f$u) =
   29.12 @@ -336,7 +336,7 @@
   29.13    | fastype_of1 (_, Const (_,T)) = T
   29.14    | fastype_of1 (_, Free (_,T)) = T
   29.15    | fastype_of1 (Ts, Bound i) = (nth Ts i
   29.16 -         handle Subscript => raise TERM("fastype_of: Bound", [Bound i]))
   29.17 +         handle General.Subscript => raise TERM("fastype_of: Bound", [Bound i]))
   29.18    | fastype_of1 (_, Var (_,T)) = T
   29.19    | fastype_of1 (Ts, Abs (_,T,u)) = T --> fastype_of1 (T::Ts, u);
   29.20  
   29.21 @@ -668,7 +668,7 @@
   29.22      fun subst (t as Bound i, lev) =
   29.23           (if i < lev then raise Same.SAME   (*var is locally bound*)
   29.24            else incr_boundvars lev (nth args (i - lev))
   29.25 -            handle Subscript => Bound (i - n))  (*loose: change it*)
   29.26 +            handle General.Subscript => Bound (i - n))  (*loose: change it*)
   29.27        | subst (Abs (a, T, body), lev) = Abs (a, T, subst (body, lev + 1))
   29.28        | subst (f $ t, lev) =
   29.29            (subst (f, lev) $ (subst (t, lev) handle Same.SAME => t)
    30.1 --- a/src/Pure/thm.ML	Wed Jun 08 17:01:07 2011 +0200
    30.2 +++ b/src/Pure/thm.ML	Wed Jun 08 22:13:49 2011 +0200
    30.3 @@ -1423,7 +1423,7 @@
    30.4      and concl = Logic.strip_imp_concl prop;
    30.5      val moved_prems = List.drop (prems, j)
    30.6      and fixed_prems = List.take (prems, j)
    30.7 -      handle Subscript => raise THM ("permute_prems: j", j, [rl]);
    30.8 +      handle General.Subscript => raise THM ("permute_prems: j", j, [rl]);
    30.9      val n_j = length moved_prems;
   30.10      val m = if k < 0 then n_j + k else k;
   30.11      val prop' =
    31.1 --- a/src/Pure/type_infer_context.ML	Wed Jun 08 17:01:07 2011 +0200
    31.2 +++ b/src/Pure/type_infer_context.ML	Wed Jun 08 22:13:49 2011 +0200
    31.3 @@ -220,7 +220,7 @@
    31.4        | inf _ (Free (_, T)) tye_idx = (T, tye_idx)
    31.5        | inf _ (Var (_, T)) tye_idx = (T, tye_idx)
    31.6        | inf bs (Bound i) tye_idx =
    31.7 -          (snd (nth bs i handle Subscript => err_loose i), tye_idx)
    31.8 +          (snd (nth bs i handle General.Subscript => err_loose i), tye_idx)
    31.9        | inf bs (Abs (x, T, t)) tye_idx =
   31.10            let val (U, tye_idx') = inf ((x, T) :: bs) t tye_idx
   31.11            in (T --> U, tye_idx') end
    32.1 --- a/src/Tools/WWW_Find/http_util.ML	Wed Jun 08 17:01:07 2011 +0200
    32.2 +++ b/src/Tools/WWW_Find/http_util.ML	Wed Jun 08 22:13:49 2011 +0200
    32.3 @@ -60,7 +60,7 @@
    32.4            then f (Substring.full " "::pre::done, Substring.triml 1 post)
    32.5            else let
    32.6              val (c, rest) = Substring.splitAt (post, 3)
    32.7 -                            handle Subscript =>
    32.8 +                            handle General.Subscript =>
    32.9                                (Substring.full "%25", Substring.triml 1 post);
   32.10            in f (to_char c::pre::done, rest) end
   32.11        end;
    33.1 --- a/src/Tools/WWW_Find/yxml_find_theorems.ML	Wed Jun 08 17:01:07 2011 +0200
    33.2 +++ b/src/Tools/WWW_Find/yxml_find_theorems.ML	Wed Jun 08 22:13:49 2011 +0200
    33.3 @@ -1,7 +1,7 @@
    33.4 -(*  Title:      src/Pure/Tools/yxml_find_theorems.ML
    33.5 +(*  Title:      Tools/WWW_Find/yxml_find_theorems.ML
    33.6      Author:     Sree Harsha Totakura, TUM
    33.7 -                Lars Noschinski, TUM
    33.8 -                Alexander Krauss, TUM
    33.9 +    Author:     Lars Noschinski, TUM
   33.10 +    Author:     Alexander Krauss, TUM
   33.11  
   33.12  Simple find theorems web service with yxml interface for programmatic
   33.13  invocation.
   33.14 @@ -32,7 +32,7 @@
   33.15    Facts.dest_static [] facts
   33.16    |> filter_out (Facts.is_concealed facts o #1);
   33.17  
   33.18 -fun init () = 
   33.19 +fun init () =
   33.20    let
   33.21      val all_facts =
   33.22        maps Facts.selections
    34.1 --- a/src/Tools/induct.ML	Wed Jun 08 17:01:07 2011 +0200
    34.2 +++ b/src/Tools/induct.ML	Wed Jun 08 22:13:49 2011 +0200
    34.3 @@ -590,7 +590,7 @@
    34.4          Unify.smash_unifiers thy [(Thm.concl_of rule', concl)] (Envir.empty (Thm.maxidx_of rule'))
    34.5          |> Seq.map (fn env => Drule.instantiate (dest_env thy env) rule')
    34.6        end
    34.7 -  end handle Subscript => Seq.empty;
    34.8 +  end handle General.Subscript => Seq.empty;
    34.9  
   34.10  end;
   34.11  
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/src/Tools/jEdit/README.html	Wed Jun 08 22:13:49 2011 +0200
    35.3 @@ -0,0 +1,137 @@
    35.4 +<?xml version="1.0" encoding="UTF-8" ?>
    35.5 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    35.6 +<html xmlns="http://www.w3.org/1999/xhtml">
    35.7 +
    35.8 +<head>
    35.9 +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   35.10 +<title>Notes on the Isabelle/jEdit Prover IDE</title>
   35.11 +</head>
   35.12 +
   35.13 +<body>
   35.14 +
   35.15 +<h2>The Isabelle/jEdit Prover IDE</h2>
   35.16 +
   35.17 +<ul>
   35.18 +
   35.19 +<li>The original jEdit look-and-feel is generally preserved, although
   35.20 +  some default properties have been changed to accommodate Isabelle
   35.21 +  (e.g. the text area font).</li>
   35.22 +
   35.23 +<li>Formal Isabelle/Isar text is checked asynchronously while editing.
   35.24 +  The user is in full command of the editor, and the prover refrains
   35.25 +  from locking portions of the buffer etc.</li>
   35.26 +
   35.27 +<li>Prover feedback works via tooltips, syntax highlighting, colors,
   35.28 +  boxes etc. based on semantic markup provided by Isabelle in the
   35.29 +  background.</li>
   35.30 +
   35.31 +<li>Using the mouse together with the modifier key <tt>C</tt>
   35.32 +(<tt>CONTROL</tt> on Linux or Windows,
   35.33 +  <tt>COMMAND</tt> on Mac OS) exposes additional information.</li>
   35.34 +
   35.35 +<li>Dockable panels (e.g. <em>Output</em>) are managed as independent
   35.36 +  windows by jEdit, which also allows multiple instances.</li>
   35.37 +
   35.38 +</ul>
   35.39 +
   35.40 +
   35.41 +<h2>Isabelle symbols and fonts</h2>
   35.42 +
   35.43 +<ul>
   35.44 +
   35.45 +  <li>Isabelle supports infinitely many symbols:<br/>
   35.46 +    &alpha;, &beta;, &gamma;, &hellip;<br/>
   35.47 +    &forall;, &exist;, &or;, &and;, &#10230;, &#10231;, &hellip;<br/>
   35.48 +    &le;, &ge;, &#8851;, &#8852;, &hellip;<br/>
   35.49 +    &#8501;, &#9651;, &#8711;, &hellip;<br/>
   35.50 +    <tt>\&lt;foo&gt;</tt>, <tt>\&lt;bar&gt;</tt>, <tt>\&lt;baz&gt;</tt>, &hellip;<br/>
   35.51 +  </li>
   35.52 +
   35.53 +  <li>A default mapping relates some Isabelle symbols to Unicode points
   35.54 +    (see <tt>$ISABELLE_HOME/etc/symbols</tt> and <tt>$ISABELLE_HOME_USER/etc/symbols</tt>).
   35.55 +  </li>
   35.56 +
   35.57 +  <li>The <em>IsabelleText</em> font ensures that Unicode points are actually
   35.58 +    seen on the screen (or printer).
   35.59 +  </li>
   35.60 +
   35.61 +  <li>Input methods:
   35.62 +    <ul>
   35.63 +      <li>copy/paste from decoded source files</li>
   35.64 +      <li>copy/paste from prover output</li>
   35.65 +      <li>completion provided by Isabelle plugin, e.g.<br/>
   35.66 +
   35.67 +      <table border="1">
   35.68 +      <tr><th><b>name</b></th>    <th><b>abbreviation</b></th>  <th><b>symbol</b></th></tr>
   35.69 +
   35.70 +      <tr><td>lambda</td>         <td></td>                     <td>&lambda;</td></tr>
   35.71 +      <tr><td>Rightarrow</td>     <td><tt>=&gt;</tt></td>       <td>&#8658;</td></tr>
   35.72 +      <tr><td>Longrightarrow</td> <td><tt>==&gt;</tt></td>      <td>&#10233;</td></tr>
   35.73 +
   35.74 +      <tr><td>And</td>            <td><tt>!!</tt></td>          <td>&#8896;</td></tr>
   35.75 +      <tr><td>equiv</td>          <td><tt>==</tt></td>          <td>&equiv;</td></tr>
   35.76 +
   35.77 +      <tr><td>forall</td>         <td><tt>!</tt></td>           <td>&forall;</td></tr>
   35.78 +      <tr><td>exists</td>         <td><tt>?</tt></td>           <td>&exist;</td></tr>
   35.79 +      <tr><td>longrightarrow</td> <td><tt>--&gt;</tt></td>      <td>&#10230;</td></tr>
   35.80 +      <tr><td>and</td>            <td><tt>/\</tt></td>          <td>&and;</td></tr>
   35.81 +      <tr><td>or</td>             <td><tt>\/</tt></td>          <td>&or;</td></tr>
   35.82 +      <tr><td>not</td>            <td><tt>~ </tt></td>          <td>&not;</td></tr>
   35.83 +      <tr><td>noteq</td>          <td><tt>~=</tt></td>          <td>&ne;</td></tr>
   35.84 +      <tr><td>in</td>             <td><tt>:</tt></td>           <td>&isin;</td></tr>
   35.85 +      <tr><td>notin</td>          <td><tt>~:</tt></td>          <td>&notin;</td></tr>
   35.86 +    </table>
   35.87 +    </li>
   35.88 +  </ul>
   35.89 +  </li>
   35.90 +
   35.91 +  <li><b>NOTE:</b> The above abbreviations refer to the input method.
   35.92 +    The logical notation provides ASCII alternatives that often
   35.93 +    coincide, but deviate occasionally.
   35.94 +  </li>
   35.95 +
   35.96 +  <li><b>NOTE:</b> Generic jEdit abbreviations or plugins perform similar
   35.97 +    source replacement operations; this works for Isabelle as long
   35.98 +    as the Unicode sequences coincide with the symbol mapping.
   35.99 +  </li>
  35.100 +
  35.101 +</ul>
  35.102 +
  35.103 +
  35.104 +<h2>Limitations and workrounds (January 2011)</h2>
  35.105 +
  35.106 +<ul>
  35.107 +  <li>No way to start/stop prover or switch to a different logic.<br/>
  35.108 +  <em>Workaround:</em> Change options and restart editor.</li>
  35.109 +
  35.110 +  <li>Multiple theory buffers cannot depend on each other, imports are
  35.111 +  resolved via the file-system.<br/>
  35.112 +  <em>Workaround:</em> Save/reload files manually.</li>
  35.113 +
  35.114 +  <li>No reclaiming of old/unused document versions in prover or
  35.115 +  editor.<br/>
  35.116 +  <em>Workaround:</em> Avoid large files; restart after a few hours of use.</li>
  35.117 +
  35.118 +  <li>Incremental reparsing sometimes produces unexpected command
  35.119 +  spans.<br/>
  35.120 +  <em>Workaround:</em> Cut/paste larger parts or reload buffer.</li>
  35.121 +
  35.122 +  <li>Command execution sometimes gets stuck (purple background).<br/>
  35.123 +  <em>Workaround:</em> Force reparsing as above.</li>
  35.124 +
  35.125 +  <li>Odd behavior of some diagnostic commands, notably those
  35.126 +  starting external processes asynchronously
  35.127 +  (e.g. <tt>thy_deps</tt>, <tt>sledgehammer</tt>).<br/>
  35.128 +  <em>Workaround:</em> Avoid such commands.</li>
  35.129 +
  35.130 +  <li>No support for non-local markup, e.g. commands reporting on
  35.131 +  previous commands (proof end on proof head), or markup produced by
  35.132 +  loading external files.</li>
  35.133 +
  35.134 +  <li>General lack of various conveniences known from Proof
  35.135 +  General.</li>
  35.136 +</ul>
  35.137 +
  35.138 +</body>
  35.139 +</html>
  35.140 +
    36.1 --- a/src/Tools/jEdit/README_BUILD	Wed Jun 08 17:01:07 2011 +0200
    36.2 +++ b/src/Tools/jEdit/README_BUILD	Wed Jun 08 22:13:49 2011 +0200
    36.3 @@ -1,86 +1,29 @@
    36.4 +Requirements for instantaneous build from sources
    36.5 +=================================================
    36.6  
    36.7 -Requirements to build from sources
    36.8 -==================================
    36.9 -
   36.10 -* Proper Java JRE/JDK from Sun, e.g. 1.6.0_24 or 1.6.0_25
   36.11 +* Proper Java JDK from Sun/Oracle/Apple, e.g. 1.6.0_24 or 1.6.0_25
   36.12    http://java.sun.com/javase/downloads/index.jsp
   36.13  
   36.14 -* Netbeans 6.9
   36.15 -  http://www.netbeans.org/downloads/index.html
   36.16 +* Scala Compiler 2.8.1.final
   36.17 +  http://www.scala-lang.org
   36.18  
   36.19 -* Scala for Netbeans: version 6.9v1.1.0
   36.20 -  http://wiki.netbeans.org/Scala
   36.21 -  http://wiki.netbeans.org/Scala68v1
   36.22 -  http://sourceforge.net/projects/erlybird/files/nb-scala/6.9v1.1.0
   36.23 +* Auxiliary jedit_build component
   36.24 +  http://www4.in.tum.de/~wenzelm/test/jedit_build-20110521.tar.gz
   36.25  
   36.26 -* jEdit 4.3.2
   36.27 -  http://www.jedit.org/
   36.28 -  Netbeans Project "jEdit": install official sources as ./contrib/jEdit/.
   36.29  
   36.30 -* jEdit plugins:
   36.31 -  Netbeans Library "Console" = $HOME/.jedit/jars/Console.jar
   36.32 -  Netbeans Library "SideKick" = $HOME/.jedit/jars/SideKick.jar
   36.33 -  Netbeans Library "ErrorList" = $HOME/.jedit/jars/ErrorList.jar
   36.34 -  Netbeans Library "Hyperlinks" = $HOME/.jedit/jars/Hyperlinks.jar
   36.35 +Important settings within Isabelle environment
   36.36 +==============================================
   36.37  
   36.38 -* Cobra Renderer 0.98.4
   36.39 -  http://lobobrowser.org/cobra.jsp
   36.40 -  Netbeans Library "Cobra-Renderer" = .../cobra.jar
   36.41 -  Netbenas Library "Rhino-JavaScript" = .../js.jar
   36.42 +- JAVA_HOME
   36.43 +- SCALA_HOME
   36.44 +- JEDIT_BUILD_HOME (via "init_component .../jedit_build...")
   36.45  
   36.46 -* Isabelle/Pure Scala components
   36.47 -  Netbeans Library "Isabelle-Pure" = ~~/lib/classes/Pure.jar
   36.48  
   36.49 -* Scala Compiler 2.8.1.final or 2.9.0.final
   36.50 -  http://www.scala-lang.org
   36.51 -  Netbeans Library "Scala-compiler" = $SCALA_HOME/lib/scala-compiler.jar
   36.52 +Build and run
   36.53 +=============
   36.54  
   36.55 +isabelle jedit -l HOL Test.thy
   36.56  
   36.57 -Building and running from command line (recommended)
   36.58 -====================================================
   36.59 -
   36.60 -* Manual build:
   36.61 -
   36.62 -  ( cd "$HOME/isabelle/repos/src/Pure" && isabelle env ./build-jars )
   36.63 -  ant jar
   36.64 -  makedist -j "$HOME/lib/jedit-4.3.2"  #location of original jedit distribution
   36.65 -
   36.66 -* Component setup, e.g. in $ISABELLE_HOME_USER/.isabelle/etc/settings:
   36.67 -
   36.68 -  [ -d "$HOME/isabelle/jedit" ] && init_component "$HOME/isabelle/jedit"  #build location
   36.69 -
   36.70 -* Run:
   36.71 -
   36.72 -  isabelle jedit -l HOL Test.thy &
   36.73 -
   36.74 -
   36.75 -Running the application within Netbeans (not recommended)
   36.76 -=========================================================
   36.77 -
   36.78 -* Project properties: add "Run" argument like
   36.79 -    -noserver -nobackground -settings=/home/makarius/isabelle/isabelle-jedit/dist
   36.80 -
   36.81 -* The Isabelle environment is obtained automatically via
   36.82 -  "$ISABELLE_HOME/bin/isabelle getenv", where ISABELLE_HOME is determined as follows:
   36.83 -
   36.84 -    (1) via regular Isabelle settings,
   36.85 -    e.g. "isabelle env netbeans"
   36.86 -
   36.87 -    (2) or via ISABELLE_HOME from raw process environment,
   36.88 -    	e.g. "env ISABELLE_HOME=.../Isabelle netbeans"
   36.89 -
   36.90 -    (3) or via JVM system properties (cf. "Run / VM Options")
   36.91 -    	e.g. -Disabelle.home=.../Isabelle
   36.92 -
   36.93 -
   36.94 -Misc notes
   36.95 -==========
   36.96 -
   36.97 -- Netbeans config/Editors/Preferences/...-CustomPreferences.xml
   36.98 -
   36.99 -    <entry javaType="java.lang.Integer" name="caret-blink-rate" xml:space="preserve">
  36.100 -        <value><![CDATA[0]]></value>
  36.101 -    </entry>
  36.102  
  36.103  -----------------------------------------------------------------------
  36.104  To run jedit with remote debugging enabled, I use the following
    37.1 --- a/src/Tools/jEdit/build.xml	Wed Jun 08 17:01:07 2011 +0200
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,102 +0,0 @@
    37.4 -<?xml version="1.0" encoding="UTF-8"?>
    37.5 -<!-- You may freely edit this file. See commented blocks below for -->
    37.6 -<!-- some examples of how to customize the build. -->
    37.7 -<!-- (If you delete it and reopen the project it will be recreated.) -->
    37.8 -<project name="Isabelle-jEdit" default="default" basedir=".">
    37.9 -    <description>Builds, tests, and runs the project Isabelle-jEdit.</description>
   37.10 -    <import file="nbproject/build-impl.xml"/>
   37.11 -    <!--
   37.12 -
   37.13 -    There exist several targets which are by default empty and which can be 
   37.14 -    used for execution of your tasks. These targets are usually executed 
   37.15 -    before and after some main targets. They are: 
   37.16 -
   37.17 -      -pre-init:                 called before initialization of project properties
   37.18 -      -post-init:                called after initialization of project properties
   37.19 -      -pre-compile:              called before javac compilation
   37.20 -      -post-compile:             called after javac compilation
   37.21 -      -pre-compile-single:       called before javac compilation of single file
   37.22 -      -post-compile-single:      called after javac compilation of single file
   37.23 -      -pre-compile-test:         called before javac compilation of JUnit tests
   37.24 -      -post-compile-test:        called after javac compilation of JUnit tests
   37.25 -      -pre-compile-test-single:  called before javac compilation of single JUnit test
   37.26 -      -post-compile-test-single: called after javac compilation of single JUunit test
   37.27 -      -pre-jar:                  called before JAR building
   37.28 -      -post-jar:                 called after JAR building
   37.29 -      -post-clean:               called after cleaning build products
   37.30 -
   37.31 -    (Targets beginning with '-' are not intended to be called on their own.)
   37.32 -
   37.33 -    Example of inserting an obfuscator after compilation could look like this:
   37.34 -
   37.35 -        <target name="-post-compile">
   37.36 -            <obfuscate>
   37.37 -                <fileset dir="${build.classes.dir}"/>
   37.38 -            </obfuscate>
   37.39 -        </target>
   37.40 -
   37.41 -    For list of available properties check the imported 
   37.42 -    nbproject/build-impl.xml file. 
   37.43 -
   37.44 -
   37.45 -    Another way to customize the build is by overriding existing main targets.
   37.46 -    The targets of interest are: 
   37.47 -
   37.48 -      -init-macrodef-javac:     defines macro for javac compilation
   37.49 -      -init-macrodef-junit:     defines macro for junit execution
   37.50 -      -init-macrodef-debug:     defines macro for class debugging
   37.51 -      -init-macrodef-java:      defines macro for class execution
   37.52 -      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   37.53 -      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   37.54 -      run:                      execution of project 
   37.55 -      -javadoc-build:           Javadoc generation
   37.56 -      test-report:              JUnit report generation
   37.57 -
   37.58 -    An example of overriding the target for project execution could look like this:
   37.59 -
   37.60 -        <target name="run" depends="Isabelle-jEdit-impl.jar">
   37.61 -            <exec dir="bin" executable="launcher.exe">
   37.62 -                <arg file="${dist.jar}"/>
   37.63 -            </exec>
   37.64 -        </target>
   37.65 -
   37.66 -    Notice that the overridden target depends on the jar target and not only on 
   37.67 -    the compile target as the regular run target does. Again, for a list of available 
   37.68 -    properties which you can use, check the target you are overriding in the
   37.69 -    nbproject/build-impl.xml file. 
   37.70 -
   37.71 -    -->
   37.72 -    <target name="run" depends="Isabelle-jEdit-impl.jar,Isabelle-jEdit-impl.run">
   37.73 -    </target>
   37.74 -    <target name="debug" depends="Isabelle-jEdit-impl.jar,Isabelle-jEdit-impl.debug">
   37.75 -    </target>
   37.76 -    <target name="-pre-jar">
   37.77 -      <copy file="plugin/services.xml" todir="${build.classes.dir}" />
   37.78 -      <copy file="plugin/dockables.xml" todir="${build.classes.dir}" />
   37.79 -      <copy file="plugin/actions.xml" todir="${build.classes.dir}" />
   37.80 -      <copy file="plugin/Isabelle.props" todir="${build.classes.dir}" />
   37.81 -    </target>
   37.82 -    <target name="-post-jar">
   37.83 -      <!-- jars -->
   37.84 -      <delete file="${dist.dir}/jars/lib/jEdit.jar" />
   37.85 -      <move todir="${dist.dir}/jars">
   37.86 -        <fileset dir="${dist.dir}/jars/lib" />
   37.87 -      </move>
   37.88 -      <copy file="${scala.library}" todir="${dist.dir}/jars" />
   37.89 -      <copy file="${scala.lib}/scala-swing.jar" todir="${dist.dir}/jars" />
   37.90 -      <!-- clean up -->
   37.91 -      <delete dir="{dist.dir}/jars/lib" />
   37.92 -      <!-- dist-template -->
   37.93 -      <copy file="dist-template/properties/jedit.props" tofile="${dist.dir}/properties" />
   37.94 -      <copy todir="${dist.dir}/modes">
   37.95 -        <fileset dir="dist-template/modes" />
   37.96 -      </copy>
   37.97 -      <copy todir="${dist.dir}/modes" overwrite="true">
   37.98 -        <fileset dir="${project.jEdit}/modes" />
   37.99 -      </copy>
  37.100 -      <replaceregexp byline="true" file="${dist.dir}/modes/catalog">
  37.101 -        <regexp pattern='(^.*NAME="javacc".*$)'/>
  37.102 -        <substitution expression="&lt;MODE NAME=&quot;isabelle&quot; FILE=&quot;isabelle.xml&quot; FILE_NAME_GLOB=&quot;*.thy&quot;/&gt;${line.separator}${line.separator}\1"/>
  37.103 -      </replaceregexp>
  37.104 -    </target>
  37.105 -</project>
    38.1 --- a/src/Tools/jEdit/contrib/jEdit/build-nb.xml	Wed Jun 08 17:01:07 2011 +0200
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,41 +0,0 @@
    38.4 -<?xml version="1.0" encoding="UTF-8"?>
    38.5 -<project name="jEdit">
    38.6 -    <import file="./build.xml"/>
    38.7 -    <property environment="env"/>
    38.8 -    
    38.9 -    <target name="run" depends="compile">
   38.10 -        <java classname="org.gjt.sp.jedit.jEdit" classpath="./build/jEdit.jar" dir="./" fork="true">
   38.11 -          <arg value="-noserver"/>
   38.12 -          <arg value="-nobackground"/>
   38.13 -          <arg value="-settings=${env.ISABELLE_HOME_USER}/jedit"/>
   38.14 -        </java>
   38.15 -    </target>
   38.16 -    
   38.17 -    <target name="debug-nb" depends="compile">
   38.18 -        <path id="cp" location="./build/jEdit.jar" />
   38.19 -        
   38.20 -        <nbjpdastart addressproperty="jpda.address" name="jEdit" transport="dt_socket">
   38.21 -            <classpath refid="cp"/>
   38.22 -        </nbjpdastart>
   38.23 -        
   38.24 -        <java classname="org.gjt.sp.jedit.jEdit" classpathref="cp" fork="true" dir="./">
   38.25 -            <jvmarg value="-Xdebug"/>
   38.26 -            <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
   38.27 -        </java>
   38.28 -    </target>
   38.29 -    
   38.30 -    <target name="profile-nb" depends="compile">
   38.31 -        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
   38.32 -        
   38.33 -        <path id="cp" location="./build/jEdit.jar" />
   38.34 -        
   38.35 -        <nbprofiledirect>
   38.36 -            <classpath refid="cp"/>
   38.37 -        </nbprofiledirect>
   38.38 -        
   38.39 -        <java classname="org.gjt.sp.jedit.jEdit" fork="true" logError="yes" dir="." classpathref="cp">
   38.40 -            <classpath refid="cp"/>
   38.41 -            <jvmarg value="${profiler.info.jvmargs.agent}"/>
   38.42 -        </java>
   38.43 -    </target>
   38.44 -</project>
   38.45 \ No newline at end of file
    39.1 --- a/src/Tools/jEdit/contrib/jEdit/nbproject/project.xml	Wed Jun 08 17:01:07 2011 +0200
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,118 +0,0 @@
    39.4 -<?xml version="1.0" encoding="UTF-8"?>
    39.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
    39.6 -    <type>org.netbeans.modules.ant.freeform</type>
    39.7 -    <configuration>
    39.8 -        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
    39.9 -            <name>jEdit</name>
   39.10 -        </general-data>
   39.11 -        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
   39.12 -            <!-- Do not use Project Properties customizer when editing this file manually. -->
   39.13 -            <name>jEdit</name>
   39.14 -            <properties>
   39.15 -                <property name="ant.script">build-nb.xml</property>
   39.16 -            </properties>
   39.17 -            <folders>
   39.18 -                <source-folder>
   39.19 -                    <label>jEdit</label>
   39.20 -                    <location>.</location>
   39.21 -                    <encoding>UTF-8</encoding>
   39.22 -                </source-folder>
   39.23 -                <source-folder>
   39.24 -                    <label>Source Packages</label>
   39.25 -                    <type>java</type>
   39.26 -                    <location>.</location>
   39.27 -                    <excludes>build/** doc/** icons/** macros/** modes/** package-files/**</excludes>
   39.28 -                    <encoding>UTF-8</encoding>
   39.29 -                </source-folder>
   39.30 -            </folders>
   39.31 -            <ide-actions>
   39.32 -                <action name="build">
   39.33 -                    <script>${ant.script}</script>
   39.34 -                    <target>build</target>
   39.35 -                </action>
   39.36 -                <action name="clean">
   39.37 -                    <script>${ant.script}</script>
   39.38 -                    <target>clean</target>
   39.39 -                </action>
   39.40 -                <action name="javadoc">
   39.41 -                    <script>${ant.script}</script>
   39.42 -                    <target>docs-javadoc</target>
   39.43 -                </action>
   39.44 -                <action name="run">
   39.45 -                    <script>${ant.script}</script>
   39.46 -                    <target>run</target>
   39.47 -                </action>
   39.48 -                <action name="rebuild">
   39.49 -                    <script>${ant.script}</script>
   39.50 -                    <target>clean</target>
   39.51 -                    <target>build</target>
   39.52 -                </action>
   39.53 -                <action name="debug">
   39.54 -                    <script>build-nb.xml</script>
   39.55 -                    <target>debug-nb</target>
   39.56 -                </action>
   39.57 -            </ide-actions>
   39.58 -            <export>
   39.59 -                <type>jar</type>
   39.60 -                <location>build/jEdit.jar</location>
   39.61 -                <script>${ant.script}</script>
   39.62 -                <build-target>build</build-target>
   39.63 -            </export>
   39.64 -            <view>
   39.65 -                <items>
   39.66 -                    <source-folder style="packages">
   39.67 -                        <label>Source Packages</label>
   39.68 -                        <location>.</location>
   39.69 -                        <excludes>build/** doc/** icons/** macros/** modes/** package-files/**</excludes>
   39.70 -                    </source-folder>
   39.71 -                    <source-file>
   39.72 -                        <location>${ant.script}</location>
   39.73 -                    </source-file>
   39.74 -                </items>
   39.75 -                <context-menu>
   39.76 -                    <ide-action name="build"/>
   39.77 -                    <ide-action name="rebuild"/>
   39.78 -                    <ide-action name="clean"/>
   39.79 -                    <ide-action name="javadoc"/>
   39.80 -                    <ide-action name="run"/>
   39.81 -                    <ide-action name="debug"/>
   39.82 -                </context-menu>
   39.83 -            </view>
   39.84 -            <subprojects/>
   39.85 -        </general-data>
   39.86 -        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
   39.87 -            <compilation-unit>
   39.88 -                <package-root>.</package-root>
   39.89 -                <classpath mode="compile">.</classpath>
   39.90 -                <built-to>build/jEdit.jar</built-to>
   39.91 -                <source-level>1.5</source-level>
   39.92 -            </compilation-unit>
   39.93 -        </java-data>
   39.94 -        <preferences xmlns="http://www.netbeans.org/ns/auxiliary-configuration-preferences/1">
   39.95 -            <module name="org-netbeans-modules-editor-indent">
   39.96 -                <node name="CodeStyle">
   39.97 -                    <property name="usedProfile" value="default"/>
   39.98 -                    <node name="project">
   39.99 -                        <property name="spaces-per-tab" value="2"/>
  39.100 -                        <property name="tab-size" value="2"/>
  39.101 -                        <property name="indent-shift-width" value="2"/>
  39.102 -                        <property name="text-limit-width" value="100"/>
  39.103 -                        <property name="expand-tabs" value="true"/>
  39.104 -                    </node>
  39.105 -                </node>
  39.106 -                <node name="text">
  39.107 -                    <node name="x-java">
  39.108 -                        <node name="CodeStyle">
  39.109 -                            <node name="project">
  39.110 -                                <property name="tab-size" value="4"/>
  39.111 -                                <property name="text-limit-width" value="100"/>
  39.112 -                                <property name="spaces-per-tab" value="2"/>
  39.113 -                                <property name="indent-shift-width" value="2"/>
  39.114 -                            </node>
  39.115 -                        </node>
  39.116 -                    </node>
  39.117 -                </node>
  39.118 -            </module>
  39.119 -        </preferences>
  39.120 -    </configuration>
  39.121 -</project>
    40.1 --- a/src/Tools/jEdit/dist-template/README.html	Wed Jun 08 17:01:07 2011 +0200
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,137 +0,0 @@
    40.4 -<?xml version="1.0" encoding="UTF-8" ?>
    40.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    40.6 -<html xmlns="http://www.w3.org/1999/xhtml">
    40.7 -
    40.8 -<head>
    40.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   40.10 -<title>Notes on the Isabelle/jEdit Prover IDE</title>
   40.11 -</head>
   40.12 -
   40.13 -<body>
   40.14 -
   40.15 -<h2>The Isabelle/jEdit Prover IDE</h2>
   40.16 -
   40.17 -<ul>
   40.18 -
   40.19 -<li>The original jEdit look-and-feel is generally preserved, although
   40.20 -  some default properties have been changed to accommodate Isabelle
   40.21 -  (e.g. the text area font).</li>
   40.22 -
   40.23 -<li>Formal Isabelle/Isar text is checked asynchronously while editing.
   40.24 -  The user is in full command of the editor, and the prover refrains
   40.25 -  from locking portions of the buffer etc.</li>
   40.26 -
   40.27 -<li>Prover feedback works via tooltips, syntax highlighting, colors,
   40.28 -  boxes etc. based on semantic markup provided by Isabelle in the
   40.29 -  background.</li>
   40.30 -
   40.31 -<li>Using the mouse together with the modifier key <tt>C</tt>
   40.32 -(<tt>CONTROL</tt> on Linux or Windows,
   40.33 -  <tt>COMMAND</tt> on Mac OS) exposes additional information.</li>
   40.34 -
   40.35 -<li>Dockable panels (e.g. <em>Output</em>) are managed as independent
   40.36 -  windows by jEdit, which also allows multiple instances.</li>
   40.37 -
   40.38 -</ul>
   40.39 -
   40.40 -
   40.41 -<h2>Isabelle symbols and fonts</h2>
   40.42 -
   40.43 -<ul>
   40.44 -
   40.45 -  <li>Isabelle supports infinitely many symbols:<br/>
   40.46 -    &alpha;, &beta;, &gamma;, &hellip;<br/>
   40.47 -    &forall;, &exist;, &or;, &and;, &#10230;, &#10231;, &hellip;<br/>
   40.48 -    &le;, &ge;, &#8851;, &#8852;, &hellip;<br/>
   40.49 -    &#8501;, &#9651;, &#8711;, &hellip;<br/>
   40.50 -    <tt>\&lt;foo&gt;</tt>, <tt>\&lt;bar&gt;</tt>, <tt>\&lt;baz&gt;</tt>, &hellip;<br/>
   40.51 -  </li>
   40.52 -
   40.53 -  <li>A default mapping relates some Isabelle symbols to Unicode points
   40.54 -    (see <tt>$ISABELLE_HOME/etc/symbols</tt> and <tt>$ISABELLE_HOME_USER/etc/symbols</tt>).
   40.55 -  </li>
   40.56 -
   40.57 -  <li>The <em>IsabelleText</em> font ensures that Unicode points are actually
   40.58 -    seen on the screen (or printer).
   40.59 -  </li>
   40.60 -
   40.61 -  <li>Input methods:
   40.62 -    <ul>
   40.63 -      <li>copy/paste from decoded source files</li>
   40.64 -      <li>copy/paste from prover output</li>
   40.65 -      <li>completion provided by Isabelle plugin, e.g.<br/>
   40.66 -
   40.67 -      <table border="1">
   40.68 -      <tr><th><b>name</b></th>    <th><b>abbreviation</b></th>  <th><b>symbol</b></th></tr>
   40.69 -
   40.70 -      <tr><td>lambda</td>         <td></td>                     <td>&lambda;</td></tr>
   40.71 -      <tr><td>Rightarrow</td>     <td><tt>=&gt;</tt></td>       <td>&#8658;</td></tr>
   40.72 -      <tr><td>Longrightarrow</td> <td><tt>==&gt;</tt></td>      <td>&#10233;</td></tr>
   40.73 -
   40.74 -      <tr><td>And</td>            <td><tt>!!</tt></td>          <td>&#8896;</td></tr>
   40.75 -      <tr><td>equiv</td>          <td><tt>==</tt></td>          <td>&equiv;</td></tr>
   40.76 -
   40.77 -      <tr><td>forall</td>         <td><tt>!</tt></td>           <td>&forall;</td></tr>
   40.78 -      <tr><td>exists</td>         <td><tt>?</tt></td>           <td>&exist;</td></tr>
   40.79 -      <tr><td>longrightarrow</td> <td><tt>--&gt;</tt></td>      <td>&#10230;</td></tr>
   40.80 -      <tr><td>and</td>            <td><tt>/\</tt></td>          <td>&and;</td></tr>
   40.81 -      <tr><td>or</td>             <td><tt>\/</tt></td>          <td>&or;</td></tr>
   40.82 -      <tr><td>not</td>            <td><tt>~ </tt></td>          <td>&not;</td></tr>
   40.83 -      <tr><td>noteq</td>          <td><tt>~=</tt></td>          <td>&ne;</td></tr>
   40.84 -      <tr><td>in</td>             <td><tt>:</tt></td>           <td>&isin;</td></tr>
   40.85 -      <tr><td>notin</td>          <td><tt>~:</tt></td>          <td>&notin;</td></tr>
   40.86 -    </table>
   40.87 -    </li>
   40.88 -  </ul>
   40.89 -  </li>
   40.90 -
   40.91 -  <li><b>NOTE:</b> The above abbreviations refer to the input method.
   40.92 -    The logical notation provides ASCII alternatives that often
   40.93 -    coincide, but deviate occasionally.
   40.94 -  </li>
   40.95 -
   40.96 -  <li><b>NOTE:</b> Generic jEdit abbreviations or plugins perform similar
   40.97 -    source replacement operations; this works for Isabelle as long
   40.98 -    as the Unicode sequences coincide with the symbol mapping.
   40.99 -  </li>
  40.100 -
  40.101 -</ul>
  40.102 -
  40.103 -
  40.104 -<h2>Limitations and workrounds (January 2011)</h2>
  40.105 -
  40.106 -<ul>
  40.107 -  <li>No way to start/stop prover or switch to a different logic.<br/>
  40.108 -  <em>Workaround:</em> Change options and restart editor.</li>
  40.109 -
  40.110 -  <li>Multiple theory buffers cannot depend on each other, imports are
  40.111 -  resolved via the file-system.<br/>
  40.112 -  <em>Workaround:</em> Save/reload files manually.</li>
  40.113 -
  40.114 -  <li>No reclaiming of old/unused document versions in prover or
  40.115 -  editor.<br/>
  40.116 -  <em>Workaround:</em> Avoid large files; restart after a few hours of use.</li>
  40.117 -
  40.118 -  <li>Incremental reparsing sometimes produces unexpected command
  40.119 -  spans.<br/>
  40.120 -  <em>Workaround:</em> Cut/paste larger parts or reload buffer.</li>
  40.121 -
  40.122 -  <li>Command execution sometimes gets stuck (purple background).<br/>
  40.123 -  <em>Workaround:</em> Force reparsing as above.</li>
  40.124 -
  40.125 -  <li>Odd behavior of some diagnostic commands, notably those
  40.126 -  starting external processes asynchronously
  40.127 -  (e.g. <tt>thy_deps</tt>, <tt>sledgehammer</tt>).<br/>
  40.128 -  <em>Workaround:</em> Avoid such commands.</li>
  40.129 -
  40.130 -  <li>No support for non-local markup, e.g. commands reporting on
  40.131 -  previous commands (proof end on proof head), or markup produced by
  40.132 -  loading external files.</li>
  40.133 -
  40.134 -  <li>General lack of various conveniences known from Proof
  40.135 -  General.</li>
  40.136 -</ul>
  40.137 -
  40.138 -</body>
  40.139 -</html>
  40.140 -
    41.1 --- a/src/Tools/jEdit/dist-template/etc/isabelle-jedit.css	Wed Jun 08 17:01:07 2011 +0200
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,19 +0,0 @@
    41.4 -/* additional style file for Isabelle/jEdit output */
    41.5 -
    41.6 -.message { margin-top: 0.3ex; background-color: #F0F0F0; }
    41.7 -
    41.8 -.writeln { }
    41.9 -.tracing { background-color: #F0F8FF; }
   41.10 -.warning { background-color: #EEE8AA; }
   41.11 -.error { background-color: #FFC1C1; }
   41.12 -
   41.13 -.report { display: none; }
   41.14 -
   41.15 -.hilite { background-color: #FFCC66; }
   41.16 -
   41.17 -.keyword { font-weight: bold; color: #009966; }
   41.18 -.operator { font-weight: bold; }
   41.19 -.command { font-weight: bold; color: #006699; }
   41.20 -
   41.21 -.sendback { text-decoration: underline; }
   41.22 -.sendback:hover { background-color: #FFCC66; }
    42.1 --- a/src/Tools/jEdit/dist-template/etc/settings	Wed Jun 08 17:01:07 2011 +0200
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,16 +0,0 @@
    42.4 -# -*- shell-script -*- :mode=shellscript:
    42.5 -
    42.6 -JEDIT_HOME="$COMPONENT"
    42.7 -JEDIT_SETTINGS="$ISABELLE_HOME_USER/jedit"
    42.8 -
    42.9 -JEDIT_OPTIONS="-reuseview -noserver -nobackground"
   42.10 -JEDIT_JAVA_OPTIONS="-Xms128m -Xmx1024m -Xss4m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
   42.11 -#JEDIT_JAVA_OPTIONS="-Xms128m -Xmx512m -Xss2m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
   42.12 -JEDIT_SYSTEM_OPTIONS="-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=Isabelle/jEdit"
   42.13 -
   42.14 -JEDIT_STYLE_SHEETS="$ISABELLE_HOME/lib/html/isabelle.css:$JEDIT_HOME/etc/isabelle-jedit.css:$ISABELLE_HOME_USER/etc/isabelle.css:$ISABELLE_HOME_USER/etc/isabelle-jedit.css"
   42.15 -
   42.16 -ISABELLE_JEDIT_OPTIONS="-m xsymbols -m no_brackets -m no_type_brackets"
   42.17 -
   42.18 -ISABELLE_TOOLS="$ISABELLE_TOOLS:$JEDIT_HOME/lib/Tools"
   42.19 -
    43.1 --- a/src/Tools/jEdit/dist-template/lib/Tools/jedit	Wed Jun 08 17:01:07 2011 +0200
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,132 +0,0 @@
    43.4 -#!/usr/bin/env bash
    43.5 -#
    43.6 -# Author: Makarius
    43.7 -#
    43.8 -# DESCRIPTION: Isabelle/jEdit interface wrapper
    43.9 -
   43.10 -
   43.11 -## diagnostics
   43.12 -
   43.13 -PRG="$(basename "$0")"
   43.14 -
   43.15 -usage()
   43.16 -{
   43.17 -  echo
   43.18 -  echo "Usage: isabelle $PRG [OPTIONS] [FILES ...]"
   43.19 -  echo
   43.20 -  echo "  Options are:"
   43.21 -  echo "    -J OPTION    add JVM runtime option"
   43.22 -  echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
   43.23 -  echo "    -d           enable debugger"
   43.24 -  echo "    -j OPTION    add jEdit runtime option"
   43.25 -  echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
   43.26 -  echo "    -l NAME      logic image name (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
   43.27 -  echo "    -m MODE      add print mode for output"
   43.28 -  echo
   43.29 -  echo "Start jEdit with Isabelle plugin setup and opens theory FILES"
   43.30 -  echo
   43.31 -  exit 1
   43.32 -}
   43.33 -
   43.34 -fail()
   43.35 -{
   43.36 -  echo "$1" >&2
   43.37 -  exit 2
   43.38 -}
   43.39 -
   43.40 -
   43.41 -## process command line
   43.42 -
   43.43 -# options
   43.44 -
   43.45 -JEDIT_LOGIC="$ISABELLE_LOGIC"
   43.46 -JEDIT_PRINT_MODE=""
   43.47 -
   43.48 -getoptions()
   43.49 -{
   43.50 -  OPTIND=1
   43.51 -  while getopts "J:dj:l:m:" OPT
   43.52 -  do
   43.53 -    case "$OPT" in
   43.54 -      J)
   43.55 -        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
   43.56 -        ;;
   43.57 -      d)
   43.58 -        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xdebug"
   43.59 -        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xrunjdwp:transport=dt_socket,server=y,suspend=n"
   43.60 -        ;;
   43.61 -      j)
   43.62 -        ARGS["${#ARGS[@]}"]="$OPTARG"
   43.63 -        ;;
   43.64 -      l)
   43.65 -        JEDIT_LOGIC="$OPTARG"
   43.66 -        ;;
   43.67 -      m)
   43.68 -        if [ -z "$JEDIT_PRINT_MODE" ]; then
   43.69 -          JEDIT_PRINT_MODE="$OPTARG"
   43.70 -        else
   43.71 -          JEDIT_PRINT_MODE="$JEDIT_PRINT_MODE,$OPTARG"
   43.72 -        fi
   43.73 -        ;;
   43.74 -      \?)
   43.75 -        usage
   43.76 -        ;;
   43.77 -    esac
   43.78 -  done
   43.79 -}
   43.80 -
   43.81 -declare -a JAVA_ARGS; eval "JAVA_ARGS=($JEDIT_JAVA_OPTIONS $JEDIT_SYSTEM_OPTIONS)"
   43.82 -[ -n "$SCALA_HOME" ] && JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Dscala.home=$SCALA_HOME"
   43.83 -
   43.84 -declare -a ARGS; eval "ARGS=($JEDIT_OPTIONS)"
   43.85 -
   43.86 -declare -a OPTIONS; eval "OPTIONS=($ISABELLE_JEDIT_OPTIONS)"
   43.87 -getoptions "${OPTIONS[@]}"
   43.88 -
   43.89 -getoptions "$@"
   43.90 -shift $(($OPTIND - 1))
   43.91 -
   43.92 -
   43.93 -# args
   43.94 -
   43.95 -while [ "$#" -gt 0 ]; do
   43.96 -  ARGS["${#ARGS[@]}"]="$(jvmpath "$1")"
   43.97 -  shift
   43.98 -done
   43.99 -
  43.100 -
  43.101 -## default perspective
  43.102 -
  43.103 -mkdir -p "$JEDIT_SETTINGS/DockableWindowManager"
  43.104 -
  43.105 -if [ ! -e "$JEDIT_SETTINGS/perspective.xml" ]; then
  43.106 -  cat > "$JEDIT_SETTINGS/DockableWindowManager/perspective-view0.xml" <<EOF
  43.107 -<DOCKING LEFT="" TOP="" RIGHT="" BOTTOM="isabelle-session" LEFT_POS="0" TOP_POS="0" RIGHT_POS="250" BOTTOM_POS="250" />
  43.108 -EOF
  43.109 -  cat > "$JEDIT_SETTINGS/perspective.xml" <<EOF
  43.110 -<?xml version="1.0" encoding="UTF-8" ?>
  43.111 -<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd">
  43.112 -<PERSPECTIVE>
  43.113 -<VIEW PLAIN="FALSE">
  43.114 -<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" />
  43.115 -</VIEW>
  43.116 -</PERSPECTIVE>
  43.117 -EOF
  43.118 -fi
  43.119 -
  43.120 -
  43.121 -## main
  43.122 -
  43.123 -case "$JEDIT_LOGIC" in
  43.124 -  /*)
  43.125 -    ;;
  43.126 -  */*)
  43.127 -    JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
  43.128 -    ;;
  43.129 -esac
  43.130 -
  43.131 -export JEDIT_LOGIC JEDIT_PRINT_MODE
  43.132 -
  43.133 -exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
  43.134 -  -jar "$(jvmpath "$JEDIT_HOME/jedit.jar")" \
  43.135 -  "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"
    44.1 --- a/src/Tools/jEdit/dist-template/modes/isabelle-session.xml	Wed Jun 08 17:01:07 2011 +0200
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,41 +0,0 @@
    44.4 -<?xml version="1.0"?>
    44.5 -<!DOCTYPE MODE SYSTEM "xmode.dtd">
    44.6 -
    44.7 -<!-- Isabelle session mode -->
    44.8 -<MODE>
    44.9 -  <PROPS>
   44.10 -    <PROPERTY NAME="commentStart" VALUE="(*"/>
   44.11 -    <PROPERTY NAME="commentEnd" VALUE="*)"/>
   44.12 -    <PROPERTY NAME="noWordSep" VALUE="_'.?"/>
   44.13 -    <PROPERTY NAME="unalignedOpenBrackets" VALUE="(" />
   44.14 -    <PROPERTY NAME="unalignedCloseBrackets" VALUE=")" />
   44.15 -    <PROPERTY NAME="tabSize" VALUE="2" />
   44.16 -    <PROPERTY NAME="indentSize" VALUE="2" />
   44.17 -  </PROPS>
   44.18 -  <RULES IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="FALSE" ESCAPE="\">
   44.19 -    <SPAN TYPE="COMMENT1">
   44.20 -      <BEGIN>(*</BEGIN>
   44.21 -      <END>*)</END>
   44.22 -    </SPAN>
   44.23 -    <SPAN TYPE="COMMENT3">
   44.24 -      <BEGIN>{*</BEGIN>
   44.25 -      <END>*}</END>
   44.26 -    </SPAN>
   44.27 -    <SPAN TYPE="LITERAL1">
   44.28 -      <BEGIN>`</BEGIN>
   44.29 -      <END>`</END>
   44.30 -    </SPAN>
   44.31 -    <SPAN TYPE="LITERAL3">
   44.32 -      <BEGIN>"</BEGIN>
   44.33 -      <END>"</END>
   44.34 -    </SPAN>
   44.35 -    <KEYWORDS>
   44.36 -      <KEYWORD1>session</KEYWORD1>
   44.37 -      <KEYWORD2>parent</KEYWORD2>
   44.38 -      <KEYWORD2>imports</KEYWORD2>
   44.39 -      <KEYWORD2>uses</KEYWORD2>
   44.40 -      <KEYWORD2>options</KEYWORD2>
   44.41 -      <KEYWORD2>dependencies</KEYWORD2>
   44.42 -    </KEYWORDS>
   44.43 -  </RULES>
   44.44 -</MODE>
    45.1 --- a/src/Tools/jEdit/dist-template/modes/isabelle.xml	Wed Jun 08 17:01:07 2011 +0200
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,41 +0,0 @@
    45.4 -<?xml version="1.0"?>
    45.5 -<!DOCTYPE MODE SYSTEM "xmode.dtd">
    45.6 -
    45.7 -<!-- Isabelle theory mode -->
    45.8 -<MODE>
    45.9 -  <PROPS>
   45.10 -    <PROPERTY NAME="commentStart" VALUE="(*"/>
   45.11 -    <PROPERTY NAME="commentEnd" VALUE="*)"/>
   45.12 -    <PROPERTY NAME="noWordSep" VALUE="_'.?"/>
   45.13 -    <PROPERTY NAME="unalignedOpenBrackets" VALUE="{[(" />
   45.14 -    <PROPERTY NAME="unalignedCloseBrackets" VALUE=")]}" />
   45.15 -    <PROPERTY NAME="tabSize" VALUE="2" />
   45.16 -    <PROPERTY NAME="indentSize" VALUE="2" />
   45.17 -  </PROPS>
   45.18 -  <RULES IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="FALSE" ESCAPE="\">
   45.19 -    <SPAN TYPE="COMMENT1">
   45.20 -      <BEGIN>(*</BEGIN>
   45.21 -      <END>*)</END>
   45.22 -    </SPAN>
   45.23 -    <SPAN TYPE="COMMENT3">
   45.24 -      <BEGIN>{*</BEGIN>
   45.25 -      <END>*}</END>
   45.26 -    </SPAN>
   45.27 -    <SPAN TYPE="LITERAL1">
   45.28 -      <BEGIN>`</BEGIN>
   45.29 -      <END>`</END>
   45.30 -    </SPAN>
   45.31 -    <SPAN TYPE="LITERAL3">
   45.32 -      <BEGIN>"</BEGIN>
   45.33 -      <END>"</END>
   45.34 -    </SPAN>
   45.35 -    <KEYWORDS>
   45.36 -      <KEYWORD2>header</KEYWORD2>
   45.37 -      <KEYWORD1>theory</KEYWORD1>
   45.38 -      <KEYWORD2>imports</KEYWORD2>
   45.39 -      <KEYWORD2>uses</KEYWORD2>
   45.40 -      <KEYWORD2>begin</KEYWORD2>
   45.41 -      <KEYWORD2>end</KEYWORD2>
   45.42 -    </KEYWORDS>
   45.43 -  </RULES>
   45.44 -</MODE>
    46.1 --- a/src/Tools/jEdit/dist-template/properties/jedit.props	Wed Jun 08 17:01:07 2011 +0200
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,213 +0,0 @@
    46.4 -#jEdit properties
    46.5 -buffer.deepIndent=false
    46.6 -buffer.encoding=UTF-8-Isabelle
    46.7 -buffer.indentSize=2
    46.8 -buffer.lineSeparator=\n
    46.9 -buffer.maxLineLen=100
   46.10 -buffer.noTabs=true
   46.11 -buffer.sidekick.keystroke-parse=false
   46.12 -buffer.tabSize=2
   46.13 -console.encoding=UTF-8
   46.14 -console.font=IsabelleText
   46.15 -console.fontsize=14
   46.16 -delete-line.shortcut=A+d
   46.17 -delete.shortcut2=C+d
   46.18 -encoding.opt-out.Big5-HKSCS=true
   46.19 -encoding.opt-out.Big5=true
   46.20 -encoding.opt-out.COMPOUND_TEXT=true
   46.21 -encoding.opt-out.EUC-JP=true
   46.22 -encoding.opt-out.EUC-KR=true
   46.23 -encoding.opt-out.GB18030=true
   46.24 -encoding.opt-out.GB2312=true
   46.25 -encoding.opt-out.GBK=true
   46.26 -encoding.opt-out.IBM-Thai=true
   46.27 -encoding.opt-out.IBM00858=true
   46.28 -encoding.opt-out.IBM01140=true
   46.29 -encoding.opt-out.IBM01141=true
   46.30 -encoding.opt-out.IBM01142=true
   46.31 -encoding.opt-out.IBM01143=true
   46.32 -encoding.opt-out.IBM01144=true
   46.33 -encoding.opt-out.IBM01145=true
   46.34 -encoding.opt-out.IBM01146=true
   46.35 -encoding.opt-out.IBM01147=true
   46.36 -encoding.opt-out.IBM01148=true
   46.37 -encoding.opt-out.IBM01149=true
   46.38 -encoding.opt-out.IBM037=true
   46.39 -encoding.opt-out.IBM1026=true
   46.40 -encoding.opt-out.IBM1047=true
   46.41 -encoding.opt-out.IBM273=true
   46.42 -encoding.opt-out.IBM277=true
   46.43 -encoding.opt-out.IBM278=true
   46.44 -encoding.opt-out.IBM280=true
   46.45 -encoding.opt-out.IBM284=true
   46.46 -encoding.opt-out.IBM285=true
   46.47 -encoding.opt-out.IBM297=true
   46.48 -encoding.opt-out.IBM420=true
   46.49 -encoding.opt-out.IBM424=true
   46.50 -encoding.opt-out.IBM437=true
   46.51 -encoding.opt-out.IBM500=true
   46.52 -encoding.opt-out.IBM775=true
   46.53 -encoding.opt-out.IBM850=true
   46.54 -encoding.opt-out.IBM852=true
   46.55 -encoding.opt-out.IBM855=true
   46.56 -encoding.opt-out.IBM857=true
   46.57 -encoding.opt-out.IBM860=true
   46.58 -encoding.opt-out.IBM861=true
   46.59 -encoding.opt-out.IBM862=true
   46.60 -encoding.opt-out.IBM863=true
   46.61 -encoding.opt-out.IBM864=true
   46.62 -encoding.opt-out.IBM865=true
   46.63 -encoding.opt-out.IBM866=true
   46.64 -encoding.opt-out.IBM868=true
   46.65 -encoding.opt-out.IBM869=true
   46.66 -encoding.opt-out.IBM870=true
   46.67 -encoding.opt-out.IBM871=true
   46.68 -encoding.opt-out.IBM918=true
   46.69 -encoding.opt-out.ISO-2022-CN=true
   46.70 -encoding.opt-out.ISO-2022-JP-2=true
   46.71 -encoding.opt-out.ISO-2022-JP=true
   46.72 -encoding.opt-out.ISO-2022-KR=true
   46.73 -encoding.opt-out.ISO-8859-13=true
   46.74 -encoding.opt-out.ISO-8859-2=true
   46.75 -encoding.opt-out.ISO-8859-3=true
   46.76 -encoding.opt-out.ISO-8859-4=true
   46.77 -encoding.opt-out.ISO-8859-5=true
   46.78 -encoding.opt-out.ISO-8859-6=true
   46.79 -encoding.opt-out.ISO-8859-7=true
   46.80 -encoding.opt-out.ISO-8859-8=true
   46.81 -encoding.opt-out.ISO-8859-9=true
   46.82 -encoding.opt-out.JIS_X0201=true
   46.83 -encoding.opt-out.JIS_X0212-1990=true
   46.84 -encoding.opt-out.KOI8-R=true
   46.85 -encoding.opt-out.KOI8-U=true
   46.86 -encoding.opt-out.Shift_JIS=true
   46.87 -encoding.opt-out.TIS-620=true
   46.88 -encoding.opt-out.UTF-16=true
   46.89 -encoding.opt-out.UTF-16BE=true
   46.90 -encoding.opt-out.UTF-16LE=true
   46.91 -encoding.opt-out.UTF-32=true
   46.92 -encoding.opt-out.UTF-32BE=true
   46.93 -encoding.opt-out.UTF-32LE=true
   46.94 -encoding.opt-out.X-UTF-32BE-BOM=true
   46.95 -encoding.opt-out.X-UTF-32LE-BOM=true
   46.96 -encoding.opt-out.windows-1250=true
   46.97 -encoding.opt-out.windows-1251=true
   46.98 -encoding.opt-out.windows-1253=true
   46.99 -encoding.opt-out.windows-1254=true
  46.100 -encoding.opt-out.windows-1255=true
  46.101 -encoding.opt-out.windows-1256=true
  46.102 -encoding.opt-out.windows-1257=true
  46.103 -encoding.opt-out.windows-1258=true
  46.104 -encoding.opt-out.windows-31j=true
  46.105 -encoding.opt-out.x-Big5-Solaris=true
  46.106 -encoding.opt-out.x-EUC-TW=true
  46.107 -encoding.opt-out.x-IBM1006=true
  46.108 -encoding.opt-out.x-IBM1025=true
  46.109 -encoding.opt-out.x-IBM1046=true
  46.110 -encoding.opt-out.x-IBM1097=true
  46.111 -encoding.opt-out.x-IBM1098=true
  46.112 -encoding.opt-out.x-IBM1112=true
  46.113 -encoding.opt-out.x-IBM1122=true
  46.114 -encoding.opt-out.x-IBM1123=true
  46.115 -encoding.opt-out.x-IBM1124=true
  46.116 -encoding.opt-out.x-IBM1381=true
  46.117 -encoding.opt-out.x-IBM1383=true
  46.118 -encoding.opt-out.x-IBM33722=true
  46.119 -encoding.opt-out.x-IBM737=true
  46.120 -encoding.opt-out.x-IBM834=true
  46.121 -encoding.opt-out.x-IBM856=true
  46.122 -encoding.opt-out.x-IBM874=true
  46.123 -encoding.opt-out.x-IBM875=true
  46.124 -encoding.opt-out.x-IBM921=true
  46.125 -encoding.opt-out.x-IBM922=true
  46.126 -encoding.opt-out.x-IBM930=true
  46.127 -encoding.opt-out.x-IBM933=true
  46.128 -encoding.opt-out.x-IBM935=true
  46.129 -encoding.opt-out.x-IBM937=true
  46.130 -encoding.opt-out.x-IBM939=true
  46.131 -encoding.opt-out.x-IBM942=true
  46.132 -encoding.opt-out.x-IBM942C=true
  46.133 -encoding.opt-out.x-IBM943=true
  46.134 -encoding.opt-out.x-IBM943C=true
  46.135 -encoding.opt-out.x-IBM948=true
  46.136 -encoding.opt-out.x-IBM949=true
  46.137 -encoding.opt-out.x-IBM949C=true
  46.138 -encoding.opt-out.x-IBM950=true
  46.139 -encoding.opt-out.x-IBM964=true
  46.140 -encoding.opt-out.x-IBM970=true
  46.141 -encoding.opt-out.x-ISCII91=true
  46.142 -encoding.opt-out.x-ISO-2022-CN-CNS=true
  46.143 -encoding.opt-out.x-ISO-2022-CN-GB=true
  46.144 -encoding.opt-out.x-JIS0208=true
  46.145 -encoding.opt-out.x-JISAutoDetect=true
  46.146 -encoding.opt-out.x-Johab=true
  46.147 -encoding.opt-out.x-MS932_0213=true
  46.148 -encoding.opt-out.x-MS950-HKSCS=true
  46.149 -encoding.opt-out.x-MacArabic=true
  46.150 -encoding.opt-out.x-MacCentralEurope=true
  46.151 -encoding.opt-out.x-MacCroatian=true
  46.152 -encoding.opt-out.x-MacCyrillic=true
  46.153 -encoding.opt-out.x-MacDingbat=true
  46.154 -encoding.opt-out.x-MacGreek=true
  46.155 -encoding.opt-out.x-MacHebrew=true
  46.156 -encoding.opt-out.x-MacIceland=true
  46.157 -encoding.opt-out.x-MacRoman=true
  46.158 -encoding.opt-out.x-MacRomania=true
  46.159 -encoding.opt-out.x-MacSymbol=true
  46.160 -encoding.opt-out.x-MacThai=true
  46.161 -encoding.opt-out.x-MacTurkish=true
  46.162 -encoding.opt-out.x-MacUkraine=true
  46.163 -encoding.opt-out.x-PCK=true
  46.164 -encoding.opt-out.x-SJIS_0213=true
  46.165 -encoding.opt-out.x-UTF-16LE-BOM=true
  46.166 -encoding.opt-out.x-euc-jp-linux=true
  46.167 -encoding.opt-out.x-eucJP-Open=true
  46.168 -encoding.opt-out.x-iso-8859-11=true
  46.169 -encoding.opt-out.x-mswin-936=true
  46.170 -encoding.opt-out.x-windows-50220=true
  46.171 -encoding.opt-out.x-windows-50221=true
  46.172 -encoding.opt-out.x-windows-874=true
  46.173 -encoding.opt-out.x-windows-949=true
  46.174 -encoding.opt-out.x-windows-950=true
  46.175 -encoding.opt-out.x-windows-iso2022jp=true
  46.176 -encodingDetectors=BOM XML-PI buffer-local-property
  46.177 -end.shortcut=
  46.178 -fallbackEncodings=UTF-8 ISO-8859-15 US-ASCII
  46.179 -firstTime=false
  46.180 -home.shortcut=
  46.181 -insert-newline-indent.shortcut=
  46.182 -insert-newline.shortcut=ENTER
  46.183 -isabelle-output.dock-position=bottom
  46.184 -isabelle-output.height=174
  46.185 -isabelle-output.width=412
  46.186 -isabelle-session.dock-position=bottom
  46.187 -line-end.shortcut=END
  46.188 -line-home.shortcut=HOME
  46.189 -lookAndFeel=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
  46.190 -mode.isabelle.customSettings=true
  46.191 -mode.isabelle.folding=sidekick
  46.192 -mode.isabelle.sidekick.showStatusWindow.label=true
  46.193 -print.font=IsabelleText
  46.194 -restore.remote=false
  46.195 -restore=false
  46.196 -sidekick-tree.dock-position=right
  46.197 -sidekick.buffer-save-parse=true
  46.198 -sidekick.complete-delay=300
  46.199 -sidekick.splitter.location=721
  46.200 -tip.show=false
  46.201 -twoStageSave=false
  46.202 -view.antiAlias=standard
  46.203 -view.blockCaret=true
  46.204 -view.caretBlink=false
  46.205 -view.eolMarkers=false
  46.206 -view.extendedState=0
  46.207 -view.font=IsabelleText
  46.208 -view.fontsize=18
  46.209 -view.fracFontMetrics=false
  46.210 -view.gutter.fontsize=12
  46.211 -view.gutter.selectionAreaWidth=18
  46.212 -view.height=787
  46.213 -view.middleMousePaste=true
  46.214 -view.showToolbar=false
  46.215 -view.thickCaret=true
  46.216 -view.width=1072
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/src/Tools/jEdit/etc/isabelle-jedit.css	Wed Jun 08 22:13:49 2011 +0200
    47.3 @@ -0,0 +1,19 @@
    47.4 +/* additional style file for Isabelle/jEdit output */
    47.5 +
    47.6 +.message { margin-top: 0.3ex; background-color: #F0F0F0; }
    47.7 +
    47.8 +.writeln { }
    47.9 +.tracing { background-color: #F0F8FF; }
   47.10 +.warning { background-color: #EEE8AA; }
   47.11 +.error { background-color: #FFC1C1; }
   47.12 +
   47.13 +.report { display: none; }
   47.14 +
   47.15 +.hilite { background-color: #FFCC66; }
   47.16 +
   47.17 +.keyword { font-weight: bold; color: #009966; }
   47.18 +.operator { font-weight: bold; }
   47.19 +.command { font-weight: bold; color: #006699; }
   47.20 +
   47.21 +.sendback { text-decoration: underline; }
   47.22 +.sendback:hover { background-color: #FFCC66; }
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/src/Tools/jEdit/etc/settings	Wed Jun 08 22:13:49 2011 +0200
    48.3 @@ -0,0 +1,16 @@
    48.4 +# -*- shell-script -*- :mode=shellscript:
    48.5 +
    48.6 +JEDIT_HOME="$COMPONENT"
    48.7 +JEDIT_SETTINGS="$ISABELLE_HOME_USER/jedit"
    48.8 +
    48.9 +JEDIT_OPTIONS="-reuseview -noserver -nobackground"
   48.10 +JEDIT_JAVA_OPTIONS="-Xms128m -Xmx1024m -Xss4m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
   48.11 +#JEDIT_JAVA_OPTIONS="-Xms128m -Xmx512m -Xss2m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
   48.12 +JEDIT_SYSTEM_OPTIONS="-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=Isabelle/jEdit"
   48.13 +
   48.14 +JEDIT_STYLE_SHEETS="$ISABELLE_HOME/lib/html/isabelle.css:$JEDIT_HOME/etc/isabelle-jedit.css:$ISABELLE_HOME_USER/etc/isabelle.css:$ISABELLE_HOME_USER/etc/isabelle-jedit.css"
   48.15 +
   48.16 +ISABELLE_JEDIT_OPTIONS="-m xsymbols -m no_brackets -m no_type_brackets"
   48.17 +
   48.18 +ISABELLE_TOOLS="$ISABELLE_TOOLS:$JEDIT_HOME/lib/Tools"
   48.19 +
    49.1 --- a/src/Tools/jEdit/jedit_build/Tools/jedit	Wed Jun 08 17:01:07 2011 +0200
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,141 +0,0 @@
    49.4 -#!/usr/bin/env bash
    49.5 -#
    49.6 -# Author: Makarius
    49.7 -#
    49.8 -# DESCRIPTION: build and run Isabelle/jEdit on the spot
    49.9 -
   49.10 -## diagnostics
   49.11 -
   49.12 -function fail()
   49.13 -{
   49.14 -  echo "$1" >&2
   49.15 -  exit 2
   49.16 -}
   49.17 -
   49.18 -function failed()
   49.19 -{
   49.20 -  fail "Failed!"
   49.21 -}
   49.22 -
   49.23 -
   49.24 -## dependencies
   49.25 -
   49.26 -[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
   49.27 -[ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
   49.28 -
   49.29 -[ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
   49.30 -  fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
   49.31 -
   49.32 -[ -e "$ISABELLE_HOME/Admin/build" ] && \
   49.33 -  { "$ISABELLE_HOME/Admin/build" jars || exit $?; }
   49.34 -
   49.35 -
   49.36 -# sources
   49.37 -
   49.38 -SRC_DIR="$ISABELLE_HOME/src/Tools/jEdit"
   49.39 -
   49.40 -declare -a SOURCES=(
   49.41 -  "$SRC_DIR/src/jedit/dockable.scala"
   49.42 -  "$SRC_DIR/src/jedit/document_model.scala"
   49.43 -  "$SRC_DIR/src/jedit/document_view.scala"
   49.44 -  "$SRC_DIR/src/jedit/html_panel.scala"
   49.45 -  "$SRC_DIR/src/jedit/isabelle_encoding.scala"
   49.46 -  "$SRC_DIR/src/jedit/isabelle_hyperlinks.scala"
   49.47 -  "$SRC_DIR/src/jedit/isabelle_markup.scala"
   49.48 -  "$SRC_DIR/src/jedit/isabelle_options.scala"
   49.49 -  "$SRC_DIR/src/jedit/isabelle_sidekick.scala"
   49.50 -  "$SRC_DIR/src/jedit/output_dockable.scala"
   49.51 -  "$SRC_DIR/src/jedit/plugin.scala"
   49.52 -  "$SRC_DIR/src/jedit/protocol_dockable.scala"
   49.53 -  "$SRC_DIR/src/jedit/raw_output_dockable.scala"
   49.54 -  "$SRC_DIR/src/jedit/scala_console.scala"
   49.55 -  "$SRC_DIR/src/jedit/session_dockable.scala"
   49.56 -)
   49.57 -
   49.58 -declare -a PLUGIN_FILES=(
   49.59 -  "$SRC_DIR/plugin/actions.xml"
   49.60 -  "$SRC_DIR/plugin/dockables.xml"
   49.61 -  "$SRC_DIR/plugin/Isabelle.props"
   49.62 -  "$SRC_DIR/plugin/services.xml"
   49.63 -)
   49.64 -
   49.65 -JEDIT_JAR="$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/jedit.jar"
   49.66 -
   49.67 -JEDIT_JARS=(
   49.68 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Console.jar"
   49.69 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/ErrorList.jar"
   49.70 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Hyperlinks.jar"
   49.71 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/SideKick.jar"
   49.72 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/cobra.jar"
   49.73 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/js.jar"
   49.74 -)
   49.75 -
   49.76 -SCALA_JARS=(
   49.77 -  "$SCALA_HOME/lib/scala-compiler.jar"
   49.78 -  "$SCALA_HOME/lib/scala-library.jar"
   49.79 -  "$SCALA_HOME/lib/scala-swing.jar"
   49.80 -)
   49.81 -
   49.82 -
   49.83 -# target
   49.84 -
   49.85 -TARGET_DIR="$ISABELLE_JEDIT_BUILD_HOME/${ISABELLE_JEDIT_BUILD_VERSION}_Isabelle-$("$ISABELLE_TOOL" version -i)"
   49.86 -TARGET="$TARGET_DIR/jars/Isabelle-jEdit.jar"
   49.87 -
   49.88 -OUTDATED=false
   49.89 -for SOURCE in "${SOURCES[@]}" "${PLUGIN_FILES[@]}" "$JEDIT_JAR" "${JEDIT_JARS[@]}"
   49.90 -do
   49.91 -  [ ! -e "$SOURCE" ] && fail "Missing file: $SOURCE"
   49.92 -  [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
   49.93 -done
   49.94 -
   49.95 -
   49.96 -## main
   49.97 -
   49.98 -if [ "$OUTDATED" = true ]
   49.99 -then
  49.100 -  echo "###"
  49.101 -  echo "### Building Isabelle/jEdit ..."
  49.102 -  echo "###"
  49.103 -
  49.104 -  rm -rf "$TARGET_DIR" || failed
  49.105 -  mkdir -p "$TARGET_DIR" "$TARGET_DIR/classes" || failed
  49.106 -  cp -a "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." "$TARGET_DIR/."
  49.107 -
  49.108 -  cp -a "${PLUGIN_FILES[@]}" "$TARGET_DIR/classes/."
  49.109 -  cp -a "$SRC_DIR/dist-template/." "$TARGET_DIR/."
  49.110 -  cp -a "$SRC_DIR/README" "$TARGET_DIR/."
  49.111 -
  49.112 -  perl -i -e 'while (<>) { if (m/NAME="javacc"/) {
  49.113 -    print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
  49.114 -    print qq,<MODE NAME="isabelle-session" FILE="isabelle-session.xml" FILE_NAME_GLOB="session.root"/>\n\n,; }
  49.115 -    print; }' "$TARGET_DIR/modes/catalog"
  49.116 -
  49.117 -  (
  49.118 -    for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$SCALA_HOME/lib/scala-compiler.jar"
  49.119 -    do
  49.120 -      CLASSPATH="$CLASSPATH:$JAR"
  49.121 -    done
  49.122 -
  49.123 -    cp -a "${JEDIT_JARS[@]}" "${SCALA_JARS[@]}" "$ISABELLE_HOME/lib/classes/Pure.jar" \
  49.124 -      "$TARGET_DIR/jars/." || failed
  49.125 -
  49.126 -    CLASSPATH="$(jvmpath "$CLASSPATH")"
  49.127 -    "$SCALA_HOME/bin/scalac" -unchecked -deprecation \
  49.128 -      -d "$TARGET_DIR/classes" -target:jvm-1.5 "${SOURCES[@]}" || \
  49.129 -      fail "Failed to compile sources"
  49.130 -
  49.131 -    cd "$TARGET_DIR/classes"
  49.132 -    jar cf "../jars/Isabelle-jEdit.jar" * || failed
  49.133 -    cd ..
  49.134 -    rm -rf classes
  49.135 -  )
  49.136 -fi
  49.137 -
  49.138 -set -o allexport
  49.139 -init_component "$TARGET_DIR"
  49.140 -[ -f "$ISABELLE_JEDIT_BUILD_HOME/etc/user-settings" ] && \
  49.141 -  source "$ISABELLE_JEDIT_BUILD_HOME/etc/user-settings"
  49.142 -set +o allexport
  49.143 -
  49.144 -exec "$TARGET_DIR/lib/Tools/jedit" "$@"
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/src/Tools/jEdit/lib/Tools/jedit	Wed Jun 08 22:13:49 2011 +0200
    50.3 @@ -0,0 +1,271 @@
    50.4 +#!/usr/bin/env bash
    50.5 +#
    50.6 +# Author: Makarius
    50.7 +#
    50.8 +# DESCRIPTION: Isabelle/jEdit interface wrapper
    50.9 +
   50.10 +
   50.11 +## sources
   50.12 +
   50.13 +declare -a SOURCE_FILES=(
   50.14 +  "src/dockable.scala"
   50.15 +  "src/document_model.scala"
   50.16 +  "src/document_view.scala"
   50.17 +  "src/html_panel.scala"
   50.18 +  "src/isabelle_encoding.scala"
   50.19 +  "src/isabelle_hyperlinks.scala"
   50.20 +  "src/isabelle_markup.scala"
   50.21 +  "src/isabelle_options.scala"
   50.22 +  "src/isabelle_sidekick.scala"
   50.23 +  "src/output_dockable.scala"
   50.24 +  "src/plugin.scala"
   50.25 +  "src/protocol_dockable.scala"
   50.26 +  "src/raw_output_dockable.scala"
   50.27 +  "src/scala_console.scala"
   50.28 +  "src/session_dockable.scala"
   50.29 +)
   50.30 +
   50.31 +declare -a MORE_FILES=(
   50.32 +  "src/actions.xml"
   50.33 +  "src/dockables.xml"
   50.34 +  "src/Isabelle.props"
   50.35 +  "src/services.xml"
   50.36 +)
   50.37 +
   50.38 +
   50.39 +## diagnostics
   50.40 +
   50.41 +PRG="$(basename "$0")"
   50.42 +
   50.43 +function usage()
   50.44 +{
   50.45 +  echo
   50.46 +  echo "Usage: isabelle $PRG [OPTIONS] [FILES ...]"
   50.47 +  echo
   50.48 +  echo "  Options are:"
   50.49 +  echo "    -J OPTION    add JVM runtime option"
   50.50 +  echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
   50.51 +  echo "    -b           build only"
   50.52 +  echo "    -d           enable debugger"
   50.53 +  echo "    -f           fresh build"
   50.54 +  echo "    -j OPTION    add jEdit runtime option"
   50.55 +  echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
   50.56 +  echo "    -l NAME      logic image name (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
   50.57 +  echo "    -m MODE      add print mode for output"
   50.58 +  echo
   50.59 +  echo "Start jEdit with Isabelle plugin setup and opens theory FILES"
   50.60 +  echo
   50.61 +  exit 1
   50.62 +}
   50.63 +
   50.64 +function fail()
   50.65 +{
   50.66 +  echo "$1" >&2
   50.67 +  exit 2
   50.68 +}
   50.69 +
   50.70 +function failed()
   50.71 +{
   50.72 +  fail "Failed!"
   50.73 +}
   50.74 +
   50.75 +
   50.76 +## process command line
   50.77 +
   50.78 +# options
   50.79 +
   50.80 +BUILD_ONLY=false
   50.81 +BUILD_JARS="jars"
   50.82 +JEDIT_LOGIC="$ISABELLE_LOGIC"
   50.83 +JEDIT_PRINT_MODE=""
   50.84 +
   50.85 +function getoptions()
   50.86 +{
   50.87 +  OPTIND=1
   50.88 +  while getopts "J:bdfj:l:m:" OPT
   50.89 +  do
   50.90 +    case "$OPT" in
   50.91 +      J)
   50.92 +        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
   50.93 +        ;;
   50.94 +      b)
   50.95 +        BUILD_ONLY=true
   50.96 +        ;;
   50.97 +      d)
   50.98 +        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xdebug"
   50.99 +        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xrunjdwp:transport=dt_socket,server=y,suspend=n"
  50.100 +        ;;
  50.101 +      f)
  50.102 +        BUILD_JARS="jars_fresh"
  50.103 +        ;;
  50.104 +      j)
  50.105 +        ARGS["${#ARGS[@]}"]="$OPTARG"
  50.106 +        ;;
  50.107 +      l)
  50.108 +        JEDIT_LOGIC="$OPTARG"
  50.109 +        ;;
  50.110 +      m)
  50.111 +        if [ -z "$JEDIT_PRINT_MODE" ]; then
  50.112 +          JEDIT_PRINT_MODE="$OPTARG"
  50.113 +        else
  50.114 +          JEDIT_PRINT_MODE="$JEDIT_PRINT_MODE,$OPTARG"
  50.115 +        fi
  50.116 +        ;;
  50.117 +      \?)
  50.118 +        usage
  50.119 +        ;;
  50.120 +    esac
  50.121 +  done
  50.122 +}
  50.123 +
  50.124 +declare -a JAVA_ARGS; eval "JAVA_ARGS=($JEDIT_JAVA_OPTIONS $JEDIT_SYSTEM_OPTIONS)"
  50.125 +[ -n "$SCALA_HOME" ] && JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Dscala.home=$SCALA_HOME"
  50.126 +
  50.127 +declare -a ARGS; eval "ARGS=($JEDIT_OPTIONS)"
  50.128 +
  50.129 +declare -a OPTIONS; eval "OPTIONS=($ISABELLE_JEDIT_OPTIONS)"
  50.130 +getoptions "${OPTIONS[@]}"
  50.131 +
  50.132 +getoptions "$@"
  50.133 +shift $(($OPTIND - 1))
  50.134 +
  50.135 +
  50.136 +# args
  50.137 +
  50.138 +while [ "$#" -gt 0 ]
  50.139 +do
  50.140 +  ARGS["${#ARGS[@]}"]="$(jvmpath "$1")"
  50.141 +  shift
  50.142 +done
  50.143 +
  50.144 +
  50.145 +## dependencies
  50.146 +
  50.147 +pushd "$JEDIT_HOME" >/dev/null || failed
  50.148 +
  50.149 +JEDIT_JAR="$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/jedit.jar"
  50.150 +
  50.151 +JEDIT_JARS=(
  50.152 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Console.jar"
  50.153 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/ErrorList.jar"
  50.154 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Hyperlinks.jar"
  50.155 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/SideKick.jar"
  50.156 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/cobra.jar"
  50.157 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/js.jar"
  50.158 +)
  50.159 +
  50.160 +SCALA_JARS=(
  50.161 +  "$SCALA_HOME/lib/scala-compiler.jar"
  50.162 +  "$SCALA_HOME/lib/scala-library.jar"
  50.163 +  "$SCALA_HOME/lib/scala-swing.jar"
  50.164 +)
  50.165 +
  50.166 +
  50.167 +# target
  50.168 +
  50.169 +TARGET="dist/jars/Isabelle-jEdit.jar"
  50.170 +
  50.171 +if [ "$BUILD_JARS" = jars_fresh ]; then
  50.172 +  OUTDATED=true
  50.173 +else
  50.174 +  OUTDATED=false
  50.175 +  for SOURCE in "${SOURCE_FILES[@]}" "${MORE_FILES[@]}" "$JEDIT_JAR" "${JEDIT_JARS[@]}"
  50.176 +  do
  50.177 +    [ ! -e "$SOURCE" ] && fail "Missing file: $SOURCE"
  50.178 +    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
  50.179 +  done
  50.180 +fi
  50.181 +
  50.182 +
  50.183 +# build
  50.184 +
  50.185 +if [ "$OUTDATED" = true ]
  50.186 +then
  50.187 +  [ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
  50.188 +
  50.189 +  [ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
  50.190 +    fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
  50.191 +
  50.192 +  [ -e "$ISABELLE_HOME/Admin/build" ] && \
  50.193 +    { "$ISABELLE_HOME/Admin/build" "$BUILD_JARS" || exit $?; }
  50.194 +
  50.195 +
  50.196 +  echo "###"
  50.197 +  echo "### Building Isabelle/jEdit ..."
  50.198 +  echo "###"
  50.199 +
  50.200 +  rm -rf dist || failed
  50.201 +  mkdir -p dist dist/classes || failed
  50.202 +
  50.203 +  cp -a "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." dist/.
  50.204 +  cp -a "${MORE_FILES[@]}" dist/classes/.
  50.205 +  cp src/jEdit.props dist/properties/.
  50.206 +  cp -a src/modes/. dist/modes/.
  50.207 +
  50.208 +  perl -i -e 'while (<>) { if (m/NAME="javacc"/) {
  50.209 +    print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
  50.210 +    print qq,<MODE NAME="isabelle-session" FILE="isabelle-session.xml" FILE_NAME_GLOB="session.root"/>\n\n,; }
  50.211 +    print; }' dist/modes/catalog
  50.212 +
  50.213 +  cp -a "${JEDIT_JARS[@]}" "${SCALA_JARS[@]}" "$ISABELLE_HOME/lib/classes/Pure.jar" \
  50.214 +    dist/jars/. || failed
  50.215 +
  50.216 +  (
  50.217 +    for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$SCALA_HOME/lib/scala-compiler.jar"
  50.218 +    do
  50.219 +      CLASSPATH="$CLASSPATH:$JAR"
  50.220 +    done
  50.221 +    CLASSPATH="$(jvmpath "$CLASSPATH")"
  50.222 +
  50.223 +    exec "$SCALA_HOME/bin/scalac" -unchecked -deprecation \
  50.224 +      -d dist/classes -target:jvm-1.5 "${SOURCE_FILES[@]}"
  50.225 +  ) || fail "Failed to compile sources"
  50.226 +
  50.227 +  cd dist/classes
  50.228 +  jar cf "../jars/Isabelle-jEdit.jar" * || failed
  50.229 +  cd ../..
  50.230 +  rm -rf dist/classes
  50.231 +fi
  50.232 +
  50.233 +popd >/dev/null
  50.234 +
  50.235 +
  50.236 +## main
  50.237 +
  50.238 +# perspective
  50.239 +
  50.240 +mkdir -p "$JEDIT_SETTINGS/DockableWindowManager"
  50.241 +
  50.242 +if [ ! -e "$JEDIT_SETTINGS/perspective.xml" ]; then
  50.243 +  cat > "$JEDIT_SETTINGS/DockableWindowManager/perspective-view0.xml" <<EOF
  50.244 +<DOCKING LEFT="" TOP="" RIGHT="" BOTTOM="isabelle-session" LEFT_POS="0" TOP_POS="0" RIGHT_POS="250" BOTTOM_POS="250" />
  50.245 +EOF
  50.246 +  cat > "$JEDIT_SETTINGS/perspective.xml" <<EOF
  50.247 +<?xml version="1.0" encoding="UTF-8" ?>
  50.248 +<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd">
  50.249 +<PERSPECTIVE>
  50.250 +<VIEW PLAIN="FALSE">
  50.251 +<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" />
  50.252 +</VIEW>
  50.253 +</PERSPECTIVE>
  50.254 +EOF
  50.255 +fi
  50.256 +
  50.257 +
  50.258 +# run
  50.259 +
  50.260 +[ "$BUILD_ONLY" = true ] || {
  50.261 +  case "$JEDIT_LOGIC" in
  50.262 +    /*)
  50.263 +      ;;
  50.264 +    */*)
  50.265 +      JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
  50.266 +      ;;
  50.267 +  esac
  50.268 +
  50.269 +  export JEDIT_LOGIC JEDIT_PRINT_MODE
  50.270 +
  50.271 +  exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
  50.272 +    -jar "$(jvmpath "$JEDIT_HOME/dist/jedit.jar")" \
  50.273 +    "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"
  50.274 +}
    51.1 --- a/src/Tools/jEdit/makedist	Wed Jun 08 17:01:07 2011 +0200
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,101 +0,0 @@
    51.4 -#!/usr/bin/env bash
    51.5 -#
    51.6 -# makedist -- make Isabelle/jEdit distribution
    51.7 -
    51.8 -## self references
    51.9 -
   51.10 -PRG="$(basename "$0")"
   51.11 -THIS="$(cd "$(dirname "$0")"; pwd)"
   51.12 -SUPER="$(cd "$THIS/.."; pwd)"
   51.13 -
   51.14 -
   51.15 -## diagnostics
   51.16 -
   51.17 -JEDIT_HOME=""
   51.18 -
   51.19 -function usage()
   51.20 -{
   51.21 -  echo
   51.22 -  echo "Usage: $PRG [OPTIONS]"
   51.23 -  echo
   51.24 -  echo "  Options are:"
   51.25 -  echo "    -j DIR       specify original jEdit distribution"
   51.26 -  echo
   51.27 -  echo "  Produce Isabelle/jEdit distribution from Netbeans build"
   51.28 -  echo "  in $THIS/dist"
   51.29 -  echo
   51.30 -  exit 1
   51.31 -}
   51.32 -
   51.33 -fail()
   51.34 -{
   51.35 -  echo "$1" >&2
   51.36 -  exit 2
   51.37 -}
   51.38 -
   51.39 -
   51.40 -## process command line
   51.41 -
   51.42 -# options
   51.43 -
   51.44 -while getopts "j:" OPT
   51.45 -do
   51.46 -  case "$OPT" in
   51.47 -    j)
   51.48 -      JEDIT_HOME="$OPTARG"
   51.49 -      ;;
   51.50 -    \?)
   51.51 -      usage
   51.52 -      ;;
   51.53 -  esac
   51.54 -done
   51.55 -
   51.56 -shift $(($OPTIND - 1))
   51.57 -
   51.58 -
   51.59 -# args
   51.60 -
   51.61 -[ "$#" -ne 0 ] && usage
   51.62 -
   51.63 -
   51.64 -## main
   51.65 -
   51.66 -cd "$THIS/dist" || fail "Bad directory: $THIS/dist"
   51.67 -
   51.68 -
   51.69 -# target name
   51.70 -
   51.71 -[ -z "$JEDIT_HOME" ] && fail "Unknown JEDIT_HOME"
   51.72 -[ -n "$ISABELLE_HOME" ] || fail "Missing Isabelle settings environment"
   51.73 -
   51.74 -VERSION="$(basename "$JEDIT_HOME")_Isabelle-$("$ISABELLE_TOOL" version -i)"
   51.75 -JEDIT="jedit-${VERSION}"
   51.76 -
   51.77 -rm -rf "$JEDIT" jedit
   51.78 -mkdir "$JEDIT"
   51.79 -
   51.80 -rm -f jedit && ln -s "$JEDIT" jedit
   51.81 -
   51.82 -
   51.83 -# copy stuff
   51.84 -
   51.85 -[ "$JEDIT_HOME/jedit.jar" ] || fail "Bad original jEdit directory: $JEDIT_HOME"
   51.86 -cp -R "$JEDIT_HOME/." "$JEDIT/."
   51.87 -rm -rf "$JEDIT/jEdit" "$JEDIT/build-support"
   51.88 -
   51.89 -mkdir -p "$JEDIT/jars"
   51.90 -cp -R jars/. "$JEDIT/jars/."
   51.91 -
   51.92 -cp -R "$THIS/dist-template/." "$JEDIT/."
   51.93 -cp "$THIS/README" "$JEDIT/."
   51.94 -
   51.95 -perl -i -e 'while (<>) { if (m/NAME="javacc"/) {
   51.96 -  print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
   51.97 -  print qq,<MODE NAME="isabelle-session" FILE="isabelle-session.xml" FILE_NAME_GLOB="session.root"/>\n\n,; }
   51.98 -  print; }' "$JEDIT/modes/catalog"
   51.99 -
  51.100 -
  51.101 -# build archive
  51.102 -
  51.103 -echo "${JEDIT}.tar.gz"
  51.104 -tar czf "${JEDIT}.tar.gz" "$JEDIT"
    52.1 --- a/src/Tools/jEdit/manifest.mf	Wed Jun 08 17:01:07 2011 +0200
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,3 +0,0 @@
    52.4 -Manifest-Version: 1.0
    52.5 -X-COMMENT: Main-Class will be added automatically by build
    52.6 -
    53.1 --- a/src/Tools/jEdit/nbproject/build-impl.xml	Wed Jun 08 17:01:07 2011 +0200
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,707 +0,0 @@
    53.4 -<?xml version="1.0" encoding="UTF-8"?>
    53.5 -<!--
    53.6 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
    53.7 -***         EDIT ../build.xml INSTEAD         ***
    53.8 -
    53.9 -For the purpose of easier reading the script
   53.10 -is divided into following sections:
   53.11 -
   53.12 -  - initialization
   53.13 -  - compilation
   53.14 -  - jar
   53.15 -  - execution
   53.16 -  - debugging
   53.17 -  - javadoc
   53.18 -  - junit compilation
   53.19 -  - junit execution
   53.20 -  - junit debugging
   53.21 -  - applet
   53.22 -  - cleanup
   53.23 -
   53.24 -        
   53.25 -        -->
   53.26 -<project xmlns:jaxrpc="http://www.netbeans.org/ns/scala-project/jax-rpc" xmlns:scalaProject1="http://www.netbeans.org/ns/scala-project/1" basedir=".." default="default" name="Isabelle-jEdit-impl">
   53.27 -    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   53.28 -    <!--
   53.29 -                ======================
   53.30 -                INITIALIZATION SECTION
   53.31 -                ======================
   53.32 -            -->
   53.33 -    <target name="-pre-init">
   53.34 -        <!-- Empty placeholder for easier customization. -->
   53.35 -        <!-- You can override this target in the ../build.xml file. -->
   53.36 -    </target>
   53.37 -    <target depends="-pre-init" name="-init-private">
   53.38 -        <property file="nbproject/private/config.properties"/>
   53.39 -        <property file="nbproject/private/configs/${config}.properties"/>
   53.40 -        <property file="nbproject/private/private.properties"/>
   53.41 -        <property environment="env"/>
   53.42 -        <condition property="scala.home" value="${env.SCALA_HOME}">
   53.43 -            <isset property="env.SCALA_HOME"/>
   53.44 -        </condition>
   53.45 -        <fail unless="scala.home">
   53.46 -                    You must set SCALA_HOME or environment property and append "-J-Dscala.home=scalahomepath"
   53.47 -                    property to the end of "netbeans_default_options" in NetBeansInstallationPath/etc/netbeans.conf to point to
   53.48 -                    Scala installation directory.
   53.49 -                </fail>
   53.50 -        <property name="scala.compiler" value="${scala.home}/lib/scala-compiler.jar"/>
   53.51 -        <property name="scala.library" value="${scala.home}/lib/scala-library.jar"/>
   53.52 -        <property name="scala.lib" value="${scala.home}/lib"/>
   53.53 -        <taskdef resource="scala/tools/ant/antlib.xml">
   53.54 -            <classpath>
   53.55 -                <pathelement location="${scala.compiler}"/>
   53.56 -                <pathelement location="${scala.library}"/>
   53.57 -            </classpath>
   53.58 -        </taskdef>
   53.59 -    </target>
   53.60 -    <target depends="-pre-init,-init-private" name="-init-user">
   53.61 -        <property file="${user.properties.file}"/>
   53.62 -        <!-- The two properties below are usually overridden -->
   53.63 -        <!-- by the active platform. Just a fallback. -->
   53.64 -        <property name="default.javac.source" value="1.5"/>
   53.65 -        <property name="default.javac.target" value="1.5"/>
   53.66 -    </target>
   53.67 -    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   53.68 -        <property file="nbproject/configs/${config}.properties"/>
   53.69 -        <property file="nbproject/project.properties"/>
   53.70 -    </target>
   53.71 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   53.72 -        <available file="${manifest.file}" property="manifest.available"/>
   53.73 -        <condition property="manifest.available+main.class">
   53.74 -            <and>
   53.75 -                <isset property="manifest.available"/>
   53.76 -                <isset property="main.class"/>
   53.77 -                <not>
   53.78 -                    <equals arg1="${main.class}" arg2="" trim="true"/>
   53.79 -                </not>
   53.80 -            </and>
   53.81 -        </condition>
   53.82 -        <condition property="manifest.available+main.class+mkdist.available">
   53.83 -            <and>
   53.84 -                <istrue value="${manifest.available+main.class}"/>
   53.85 -                <isset property="libs.CopyLibs.classpath"/>
   53.86 -            </and>
   53.87 -        </condition>
   53.88 -        <condition property="have.tests">
   53.89 -            <or/>
   53.90 -        </condition>
   53.91 -        <condition property="have.sources">
   53.92 -            <or>
   53.93 -                <available file="${src.dir}"/>
   53.94 -            </or>
   53.95 -        </condition>
   53.96 -        <condition property="netbeans.home+have.tests">
   53.97 -            <and>
   53.98 -                <isset property="netbeans.home"/>
   53.99 -                <isset property="have.tests"/>
  53.100 -            </and>
  53.101 -        </condition>
  53.102 -        <condition property="no.javadoc.preview">
  53.103 -            <and>
  53.104 -                <isset property="javadoc.preview"/>
  53.105 -                <isfalse value="${javadoc.preview}"/>
  53.106 -            </and>
  53.107 -        </condition>
  53.108 -        <property name="run.jvmargs" value=""/>
  53.109 -        <property name="javac.compilerargs" value=""/>
  53.110 -        <property name="work.dir" value="${basedir}"/>
  53.111 -        <condition property="no.deps">
  53.112 -            <and>
  53.113 -                <istrue value="${no.dependencies}"/>
  53.114 -            </and>
  53.115 -        </condition>
  53.116 -        <property name="javac.debug" value="true"/>
  53.117 -        <property name="javadoc.preview" value="true"/>
  53.118 -        <property name="application.args" value=""/>
  53.119 -        <property name="source.encoding" value="${file.encoding}"/>
  53.120 -        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  53.121 -            <and>
  53.122 -                <isset property="javadoc.encoding"/>
  53.123 -                <not>
  53.124 -                    <equals arg1="${javadoc.encoding}" arg2=""/>
  53.125 -                </not>
  53.126 -            </and>
  53.127 -        </condition>
  53.128 -        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  53.129 -        <property name="includes" value="**"/>
  53.130 -        <property name="excludes" value=""/>
  53.131 -        <property name="extdirs" value=" "/>
  53.132 -        <property name="do.depend" value="false"/>
  53.133 -        <condition property="do.depend.true">
  53.134 -            <istrue value="${do.depend}"/>
  53.135 -        </condition>
  53.136 -        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  53.137 -            <and>
  53.138 -                <isset property="jaxws.endorsed.dir"/>
  53.139 -                <available file="nbproject/jaxws-build.xml"/>
  53.140 -            </and>
  53.141 -        </condition>
  53.142 -    </target>
  53.143 -    <target name="-post-init">
  53.144 -        <!-- Empty placeholder for easier customization. -->
  53.145 -        <!-- You can override this target in the ../build.xml file. -->
  53.146 -    </target>
  53.147 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  53.148 -        <fail unless="src.dir">Must set src.dir</fail>
  53.149 -        <fail unless="build.dir">Must set build.dir</fail>
  53.150 -        <fail unless="dist.dir">Must set dist.dir</fail>
  53.151 -        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  53.152 -        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  53.153 -        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  53.154 -        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  53.155 -        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  53.156 -        <fail unless="dist.jar">Must set dist.jar</fail>
  53.157 -    </target>
  53.158 -    <target name="-init-macrodef-property">
  53.159 -        <macrodef name="property" uri="http://www.netbeans.org/ns/scala-project/1">
  53.160 -            <attribute name="name"/>
  53.161 -            <attribute name="value"/>
  53.162 -            <sequential>
  53.163 -                <property name="@{name}" value="${@{value}}"/>
  53.164 -            </sequential>
  53.165 -        </macrodef>
  53.166 -    </target>
  53.167 -    <target name="-init-macrodef-javac">
  53.168 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/scala-project/1">
  53.169 -            <attribute default="${src.dir}" name="srcdir"/>
  53.170 -            <attribute default="${build.classes.dir}" name="destdir"/>
  53.171 -            <attribute default="${javac.classpath}" name="classpath"/>
  53.172 -            <attribute default="${includes}" name="includes"/>
  53.173 -            <attribute default="${excludes}" name="excludes"/>
  53.174 -            <attribute default="${javac.debug}" name="debug"/>
  53.175 -            <attribute default="" name="sourcepath"/>
  53.176 -            <element name="customize" optional="true"/>
  53.177 -            <sequential>
  53.178 -                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  53.179 -                    <classpath>
  53.180 -                        <path path="@{classpath}"/>
  53.181 -                        <fileset dir="${scala.lib}">
  53.182 -                            <include name="**/*.jar"/>
  53.183 -                        </fileset>
  53.184 -                    </classpath>
  53.185 -                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  53.186 -                    <customize/>
  53.187 -                </javac>
  53.188 -            </sequential>
  53.189 -        </macrodef>
  53.190 -        <macrodef name="depend" uri="http://www.netbeans.org/ns/scala-project/1">
  53.191 -            <attribute default="${src.dir}" name="srcdir"/>
  53.192 -            <attribute default="${build.classes.dir}" name="destdir"/>
  53.193 -            <attribute default="${javac.classpath}" name="classpath"/>
  53.194 -            <sequential>
  53.195 -                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  53.196 -                    <classpath>
  53.197 -                        <path>
  53.198 -                            <pathelement path="@{classpath}"/>
  53.199 -                            <fileset dir="${scala.lib}">
  53.200 -                                <include name="**/*.jar"/>
  53.201 -                            </fileset>
  53.202 -                            <pathelement location="${build.classes.dir}"/>
  53.203 -                        </path>
  53.204 -                    </classpath>
  53.205 -                </depend>
  53.206 -            </sequential>
  53.207 -        </macrodef>
  53.208 -        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/scala-project/1">
  53.209 -            <attribute default="${build.classes.dir}" name="destdir"/>
  53.210 -            <sequential>
  53.211 -                <fail unless="javac.includes">Must set javac.includes</fail>
  53.212 -                <pathconvert pathsep="," property="javac.includes.binary">
  53.213 -                    <path>
  53.214 -                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  53.215 -                    </path>
  53.216 -                    <globmapper from="*.java" to="*.class"/>
  53.217 -                </pathconvert>
  53.218 -                <delete>
  53.219 -                    <files includes="${javac.includes.binary}"/>
  53.220 -                </delete>
  53.221 -            </sequential>
  53.222 -        </macrodef>
  53.223 -    </target>
  53.224 -    <target name="-init-macrodef-scalac">
  53.225 -        <macrodef name="scalac" uri="http://www.netbeans.org/ns/scala-project/1">
  53.226 -            <attribute default="${src.dir}" name="srcdir"/>
  53.227 -            <attribute default="${build.classes.dir}" name="destdir"/>
  53.228 -            <attribute default="${javac.classpath}" name="classpath"/>
  53.229 -            <attribute default="${extdirs}" name="extdirs"/>
  53.230 -            <attribute default="${includes}" name="includes"/>
  53.231 -            <attribute default="${excludes}" name="excludes"/>
  53.232 -            <attribute default="${scalac.compilerargs}" name="addparams"/>
  53.233 -            <attribute default="" name="sourcepath"/>
  53.234 -            <element name="customize" optional="true"/>
  53.235 -            <sequential>
  53.236 -                <scalac addparams="-make:transitive -dependencyfile &quot;${basedir}/${build.dir}/.scala_dependencies&quot; @{addparams}" deprecation="${scalac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" extdirs="@{extdirs}" force="yes" fork="true" includes="@{includes}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="jvm-${javac.target}" unchecked="${scalac.unchecked}">
  53.237 -                    <classpath>
  53.238 -                        <path>
  53.239 -                            <pathelement path="@{classpath}"/>
  53.240 -                            <fileset dir="${scala.lib}">
  53.241 -                                <include name="**/*.jar"/>
  53.242 -                            </fileset>
  53.243 -                            <pathelement location="${build.classes.dir}"/>
  53.244 -                        </path>
  53.245 -                    </classpath>
  53.246 -                    <customize/>
  53.247 -                </scalac>
  53.248 -            </sequential>
  53.249 -        </macrodef>
  53.250 -        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/scala-project/1">
  53.251 -            <attribute default="${build.classes.dir}" name="destdir"/>
  53.252 -            <sequential>
  53.253 -                <fail unless="javac.includes">Must set javac.includes</fail>
  53.254 -                <pathconvert pathsep="," property="javac.includes.binary">
  53.255 -                    <path>
  53.256 -                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  53.257 -                    </path>
  53.258 -                    <globmapper from="*.scala" to="*.class"/>
  53.259 -                </pathconvert>
  53.260 -                <delete>
  53.261 -                    <files includes="${javac.includes.binary}"/>
  53.262 -                </delete>
  53.263 -            </sequential>
  53.264 -        </macrodef>
  53.265 -    </target>
  53.266 -    <target name="-init-macrodef-junit">
  53.267 -        <macrodef name="junit" uri="http://www.netbeans.org/ns/scala-project/1">
  53.268 -            <attribute default="${includes}" name="includes"/>
  53.269 -            <attribute default="${excludes}" name="excludes"/>
  53.270 -            <attribute default="**" name="testincludes"/>
  53.271 -            <sequential>
  53.272 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  53.273 -                    <batchtest todir="${build.test.results.dir}">
  53.274 -                        <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  53.275 -                            <filename name="@{testincludes}"/>
  53.276 -                        </fileset>
  53.277 -                    </batchtest>
  53.278 -                    <classpath>
  53.279 -                        <path path="${run.test.classpath}"/>
  53.280 -                        <fileset dir="${scala.lib}">
  53.281 -                            <include name="**/*.jar"/>
  53.282 -                        </fileset>
  53.283 -                    </classpath>
  53.284 -                    <syspropertyset>
  53.285 -                        <propertyref prefix="test-sys-prop."/>
  53.286 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  53.287 -                    </syspropertyset>
  53.288 -                    <formatter type="brief" usefile="false"/>
  53.289 -                    <formatter type="xml"/>
  53.290 -                    <jvmarg line="${run.jvmargs}"/>
  53.291 -                </junit>
  53.292 -            </sequential>
  53.293 -        </macrodef>
  53.294 -    </target>
  53.295 -    <target name="-init-macrodef-nbjpda">
  53.296 -        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/scala-project/1">
  53.297 -            <attribute default="${main.class}" name="name"/>
  53.298 -            <attribute default="${debug.classpath}" name="classpath"/>
  53.299 -            <attribute default="" name="stopclassname"/>
  53.300 -            <sequential>
  53.301 -                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
  53.302 -                    <classpath>
  53.303 -                        <path path="@{classpath}"/>
  53.304 -                    </classpath>
  53.305 -                </nbjpdastart>
  53.306 -            </sequential>
  53.307 -        </macrodef>
  53.308 -        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/scala-project/1">
  53.309 -            <attribute default="${build.classes.dir}" name="dir"/>
  53.310 -            <sequential>
  53.311 -                <nbjpdareload>
  53.312 -                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
  53.313 -                </nbjpdareload>
  53.314 -            </sequential>
  53.315 -        </macrodef>
  53.316 -    </target>
  53.317 -    <target name="-init-debug-args">
  53.318 -        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  53.319 -        <condition property="have-jdk-older-than-1.4">
  53.320 -            <or>
  53.321 -                <contains string="${version-output}" substring="java version &quot;1.0"/>
  53.322 -                <contains string="${version-output}" substring="java version &quot;1.1"/>
  53.323 -                <contains string="${version-output}" substring="java version &quot;1.2"/>
  53.324 -                <contains string="${version-output}" substring="java version &quot;1.3"/>
  53.325 -            </or>
  53.326 -        </condition>
  53.327 -        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  53.328 -            <istrue value="${have-jdk-older-than-1.4}"/>
  53.329 -        </condition>
  53.330 -    </target>
  53.331 -    <target depends="-init-debug-args" name="-init-macrodef-debug">
  53.332 -        <macrodef name="debug" uri="http://www.netbeans.org/ns/scala-project/1">
  53.333 -            <attribute default="${main.class}" name="classname"/>
  53.334 -            <attribute default="${debug.classpath}" name="classpath"/>
  53.335 -            <element name="customize" optional="true"/>
  53.336 -            <sequential>
  53.337 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
  53.338 -                    <jvmarg line="${debug-args-line}"/>
  53.339 -                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  53.340 -                    <jvmarg line="${run.jvmargs}"/>
  53.341 -                    <classpath>
  53.342 -                        <path path="@{classpath}"/>
  53.343 -                        <fileset dir="${scala.lib}">
  53.344 -                            <include name="**/*.jar"/>
  53.345 -                        </fileset>
  53.346 -                    </classpath>
  53.347 -                    <syspropertyset>
  53.348 -                        <propertyref prefix="run-sys-prop."/>
  53.349 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  53.350 -                    </syspropertyset>
  53.351 -                    <customize/>
  53.352 -                </java>
  53.353 -            </sequential>
  53.354 -        </macrodef>
  53.355 -    </target>
  53.356 -    <target name="-init-macrodef-java">
  53.357 -        <macrodef name="java" uri="http://www.netbeans.org/ns/scala-project/1">
  53.358 -            <attribute default="${main.class}" name="classname"/>
  53.359 -            <element name="customize" optional="true"/>
  53.360 -            <sequential>
  53.361 -                <java classname="@{classname}" dir="${work.dir}" fork="true">
  53.362 -                    <jvmarg line="${run.jvmargs}"/>
  53.363 -                    <classpath>
  53.364 -                        <path path="${run.classpath}"/>
  53.365 -                        <fileset dir="${scala.lib}">
  53.366 -                            <include name="**/*.jar"/>
  53.367 -                        </fileset>
  53.368 -                    </classpath>
  53.369 -                    <syspropertyset>
  53.370 -                        <propertyref prefix="run-sys-prop."/>
  53.371 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  53.372 -                    </syspropertyset>
  53.373 -                    <customize/>
  53.374 -                </java>
  53.375 -            </sequential>
  53.376 -        </macrodef>
  53.377 -    </target>
  53.378 -    <target name="-init-presetdef-jar">
  53.379 -        <presetdef name="jar" uri="http://www.netbeans.org/ns/scala-project/1">
  53.380 -            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  53.381 -                <scalaProject1:fileset dir="${build.classes.dir}"/>
  53.382 -            </jar>
  53.383 -        </presetdef>
  53.384 -    </target>
  53.385 -    <target depends="-pre-init,-init-private ,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-scalac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  53.386 -    <!--
  53.387 -                ===================
  53.388 -                COMPILATION SECTION
  53.389 -                ===================
  53.390 -            -->
  53.391 -    <target depends="init" name="deps-jar" unless="no.deps">
  53.392 -        <ant antfile="${project.jEdit}/build-nb.xml" inheritall="false" target="build"/>
  53.393 -    </target>
  53.394 -    <target depends="init,deps-jar" name="-pre-pre-compile">
  53.395 -        <mkdir dir="${build.classes.dir}"/>
  53.396 -    </target>
  53.397 -    <target name="-pre-compile">
  53.398 -        <!-- Empty placeholder for easier customization. -->
  53.399 -        <!-- You can override this target in the ../build.xml file. -->
  53.400 -    </target>
  53.401 -    <target if="do.depend.true" name="-compile-depend">
  53.402 -        <scalaProject1:depend/>
  53.403 -    </target>
  53.404 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  53.405 -        <scalaProject1:scalac/>
  53.406 -        <scalaProject1:javac/>
  53.407 -        <copy todir="${build.classes.dir}">
  53.408 -            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}&#10;                        " includes="${includes}"/>
  53.409 -        </copy>
  53.410 -    </target>
  53.411 -    <target name="-post-compile">
  53.412 -        <!-- Empty placeholder for easier customization. -->
  53.413 -        <!-- You can override this target in the ../build.xml file. -->
  53.414 -    </target>
  53.415 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  53.416 -    <target name="-pre-compile-single">
  53.417 -        <!-- Empty placeholder for easier customization. -->
  53.418 -        <!-- You can override this target in the ../build.xml file. -->
  53.419 -    </target>
  53.420 -    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  53.421 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  53.422 -        <scalaProject1:force-recompile/>
  53.423 -        <scalaProject1:scalac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  53.424 -    </target>
  53.425 -    <target name="-post-compile-single">
  53.426 -        <!-- Empty placeholder for easier customization. -->
  53.427 -        <!-- You can override this target in the ../build.xml file. -->
  53.428 -    </target>
  53.429 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  53.430 -    <!--
  53.431 -                ====================
  53.432 -                JAR BUILDING SECTION
  53.433 -                ====================
  53.434 -            -->
  53.435 -    <target depends="init" name="-pre-pre-jar">
  53.436 -        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  53.437 -        <mkdir dir="${dist.jar.dir}"/>
  53.438 -    </target>
  53.439 -    <target name="-pre-jar">
  53.440 -        <!-- Empty placeholder for easier customization. -->
  53.441 -        <!-- You can override this target in the ../build.xml file. -->
  53.442 -    </target>
  53.443 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  53.444 -        <scalaProject1:jar/>
  53.445 -    </target>
  53.446 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  53.447 -        <scalaProject1:jar manifest="${manifest.file}"/>
  53.448 -    </target>
  53.449 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  53.450 -        <scalaProject1:jar manifest="${manifest.file}">
  53.451 -            <scalaProject1:manifest>
  53.452 -                <scalaProject1:attribute name="Main-Class" value="${main.class}"/>
  53.453 -            </scalaProject1:manifest>
  53.454 -        </scalaProject1:jar>
  53.455 -        <echo>To run this application from the command line without Ant, try:</echo>
  53.456 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  53.457 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
  53.458 -        <pathconvert property="run.classpath.with.dist.jar">
  53.459 -            <path path="${run.classpath}"/>
  53.460 -            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  53.461 -        </pathconvert>
  53.462 -        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}
  53.463 -                </echo>
  53.464 -    </target>
  53.465 -    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  53.466 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  53.467 -        <pathconvert property="run.classpath.without.build.classes.dir">
  53.468 -            <path path="${run.classpath}"/>
  53.469 -            <map from="${build.classes.dir.resolved}" to=""/>
  53.470 -        </pathconvert>
  53.471 -        <pathconvert pathsep=" " property="jar.classpath">
  53.472 -            <path path="${run.classpath.without.build.classes.dir}"/>
  53.473 -            <chainedmapper>
  53.474 -                <flattenmapper/>
  53.475 -                <globmapper from="*" to="lib/*"/>
  53.476 -            </chainedmapper>
  53.477 -        </pathconvert>
  53.478 -        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  53.479 -        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  53.480 -            <fileset dir="${build.classes.dir}"/>
  53.481 -            <manifest>
  53.482 -                <attribute name="Main-Class" value="${main.class}"/>
  53.483 -                <attribute name="Class-Path" value="${jar.classpath}"/>
  53.484 -            </manifest>
  53.485 -        </copylibs>
  53.486 -        <echo>To run this application from the command line without Ant, try:</echo>
  53.487 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
  53.488 -        <echo>java -jar "${dist.jar.resolved}"
  53.489 -                </echo>
  53.490 -    </target>
  53.491 -    <target name="-post-jar">
  53.492 -        <!-- Empty placeholder for easier customization. -->
  53.493 -        <!-- You can override this target in the ../build.xml file. -->
  53.494 -    </target>
  53.495 -    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  53.496 -    <!--
  53.497 -                =================
  53.498 -                EXECUTION SECTION
  53.499 -                =================
  53.500 -            -->
  53.501 -    <target depends="init,compile" description="Run a main class." name="run">
  53.502 -        <scalaProject1:java>
  53.503 -            <customize>
  53.504 -                <arg line="${application.args}"/>
  53.505 -            </customize>
  53.506 -        </scalaProject1:java>
  53.507 -    </target>
  53.508 -    <target name="-do-not-recompile">
  53.509 -        <property name="javac.includes.binary" value=""/>
  53.510 -    </target>
  53.511 -    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  53.512 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  53.513 -        <scalaProject1:java classname="${run.class}"/>
  53.514 -    </target>
  53.515 -    <!--
  53.516 -                =================
  53.517 -                DEBUGGING SECTION
  53.518 -                =================
  53.519 -            -->
  53.520 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  53.521 -        <scalaProject1:nbjpdastart name="${debug.class}"/>
  53.522 -    </target>
  53.523 -    <target depends="init,compile" name="-debug-start-debuggee">
  53.524 -        <scalaProject1:debug>
  53.525 -            <customize>
  53.526 -                <arg line="${application.args}"/>
  53.527 -            </customize>
  53.528 -        </scalaProject1:debug>
  53.529 -    </target>
  53.530 -    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  53.531 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  53.532 -        <scalaProject1:nbjpdastart stopclassname="${main.class}"/>
  53.533 -    </target>
  53.534 -    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  53.535 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  53.536 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  53.537 -        <scalaProject1:debug classname="${debug.class}"/>
  53.538 -    </target>
  53.539 -    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  53.540 -    <target depends="init" name="-pre-debug-fix">
  53.541 -        <fail unless="fix.includes">Must set fix.includes</fail>
  53.542 -        <property name="javac.includes" value="${fix.includes}.java"/>
  53.543 -    </target>
  53.544 -    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  53.545 -        <scalaProject1:nbjpdareload/>
  53.546 -    </target>
  53.547 -    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  53.548 -    <!--
  53.549 -                ===============
  53.550 -                JAVADOC SECTION
  53.551 -                ===============
  53.552 -            -->
  53.553 -    <target depends="init" name="-javadoc-build">
  53.554 -        <mkdir dir="${dist.javadoc.dir}"/>
  53.555 -        <scaladoc addparams="${javadoc.additionalparam}" deprecation="yes" destdir="${dist.javadoc.dir}" doctitle="${javadoc.windowtitle}" encoding="${javadoc.encoding.used}" srcdir="${src.dir}" unchecked="yes">
  53.556 -            <classpath>
  53.557 -                <path path="${javac.classpath}"/>
  53.558 -                <fileset dir="${scala.lib}">
  53.559 -                    <include name="**/*.jar"/>
  53.560 -                </fileset>
  53.561 -            </classpath>
  53.562 -        </scaladoc>
  53.563 -    </target>
  53.564 -    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  53.565 -        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  53.566 -    </target>
  53.567 -    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  53.568 -    <!--
  53.569 -                =========================
  53.570 -                JUNIT COMPILATION SECTION
  53.571 -                =========================
  53.572 -            -->
  53.573 -    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  53.574 -        <mkdir dir="${build.test.classes.dir}"/>
  53.575 -    </target>
  53.576 -    <target name="-pre-compile-test">
  53.577 -        <!-- Empty placeholder for easier customization. -->
  53.578 -        <!-- You can override this target in the ../build.xml file. -->
  53.579 -    </target>
  53.580 -    <target if="do.depend.true" name="-compile-test-depend">
  53.581 -        <scalaProject1:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
  53.582 -    </target>
  53.583 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  53.584 -        <scalaProject1:scalac classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
  53.585 -        <copy todir="${build.test.classes.dir}"/>
  53.586 -    </target>
  53.587 -    <target name="-post-compile-test">
  53.588 -        <!-- Empty placeholder for easier customization. -->
  53.589 -        <!-- You can override this target in the ../build.xml file. -->
  53.590 -    </target>
  53.591 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  53.592 -    <target name="-pre-compile-test-single">
  53.593 -        <!-- Empty placeholder for easier customization. -->
  53.594 -        <!-- You can override this target in the ../build.xml file. -->
  53.595 -    </target>
  53.596 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  53.597 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  53.598 -        <scalaProject1:force-recompile destdir="${build.test.classes.dir}"/>
  53.599 -        <scalaProject1:scalac classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="" srcdir=""/>
  53.600 -        <copy todir="${build.test.classes.dir}"/>
  53.601 -    </target>
  53.602 -    <target name="-post-compile-test-single">
  53.603 -        <!-- Empty placeholder for easier customization. -->
  53.604 -        <!-- You can override this target in the ../build.xml file. -->
  53.605 -    </target>
  53.606 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  53.607 -    <!--
  53.608 -                =======================
  53.609 -                JUNIT EXECUTION SECTION
  53.610 -                =======================
  53.611 -            -->
  53.612 -    <target depends="init" if="have.tests" name="-pre-test-run">
  53.613 -        <mkdir dir="${build.test.results.dir}"/>
  53.614 -    </target>
  53.615 -    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  53.616 -        <scalaProject1:junit testincludes="**/*Test.class"/>
  53.617 -    </target>
  53.618 -    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  53.619 -        <fail if="tests.failed">Some tests failed; see details above.</fail>
  53.620 -    </target>
  53.621 -    <target depends="init" if="have.tests" name="test-report"/>
  53.622 -    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  53.623 -    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  53.624 -    <target depends="init" if="have.tests" name="-pre-test-run-single">
  53.625 -        <mkdir dir="${build.test.results.dir}"/>
  53.626 -    </target>
  53.627 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  53.628 -        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  53.629 -        <scalaProject1:junit excludes="" includes="${test.includes}"/>
  53.630 -    </target>
  53.631 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  53.632 -        <fail if="tests.failed">Some tests failed; see details above.</fail>
  53.633 -    </target>
  53.634 -    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  53.635 -    <!--
  53.636 -                =======================
  53.637 -                JUNIT DEBUGGING SECTION
  53.638 -                =======================
  53.639 -            -->
  53.640 -    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  53.641 -        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  53.642 -        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  53.643 -        <delete file="${test.report.file}"/>
  53.644 -        <mkdir dir="${build.test.results.dir}"/>
  53.645 -        <scalaProject1:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  53.646 -            <customize>
  53.647 -                <syspropertyset>
  53.648 -                    <propertyref prefix="test-sys-prop."/>
  53.649 -                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  53.650 -                </syspropertyset>
  53.651 -                <arg value="${test.class}"/>
  53.652 -                <arg value="showoutput=true"/>
  53.653 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  53.654 -                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  53.655 -            </customize>
  53.656 -        </scalaProject1:debug>
  53.657 -    </target>
  53.658 -    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  53.659 -        <scalaProject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  53.660 -    </target>
  53.661 -    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  53.662 -    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  53.663 -        <scalaProject1:nbjpdareload dir="${build.test.classes.dir}"/>
  53.664 -    </target>
  53.665 -    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  53.666 -    <!--
  53.667 -                =========================
  53.668 -                APPLET EXECUTION SECTION
  53.669 -                =========================
  53.670 -            -->
  53.671 -    <target depends="init,compile-single" name="run-applet">
  53.672 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  53.673 -        <scalaProject1:java classname="sun.applet.AppletViewer">
  53.674 -            <customize>
  53.675 -                <arg value="${applet.url}"/>
  53.676 -            </customize>
  53.677 -        </scalaProject1:java>
  53.678 -    </target>
  53.679 -    <!--
  53.680 -                =========================
  53.681 -                APPLET DEBUGGING  SECTION
  53.682 -                =========================
  53.683 -            -->
  53.684 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  53.685 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  53.686 -        <scalaProject1:debug classname="sun.applet.AppletViewer">
  53.687 -            <customize>
  53.688 -                <arg value="${applet.url}"/>
  53.689 -            </customize>
  53.690 -        </scalaProject1:debug>
  53.691 -    </target>
  53.692 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  53.693 -    <!--
  53.694 -                ===============
  53.695 -                CLEANUP SECTION
  53.696 -                ===============
  53.697 -            -->
  53.698 -    <target depends="init" name="deps-clean" unless="no.deps">
  53.699 -        <ant antfile="${project.jEdit}/build-nb.xml" inheritall="false" target="clean"/>
  53.700 -    </target>
  53.701 -    <target depends="init" name="-do-clean">
  53.702 -        <delete dir="${build.dir}"/>
  53.703 -        <delete dir="${dist.dir}"/>
  53.704 -    </target>
  53.705 -    <target name="-post-clean">
  53.706 -        <!-- Empty placeholder for easier customization. -->
  53.707 -        <!-- You can override this target in the ../build.xml file. -->
  53.708 -    </target>
  53.709 -    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  53.710 -</project>
    54.1 --- a/src/Tools/jEdit/nbproject/genfiles.properties	Wed Jun 08 17:01:07 2011 +0200
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,8 +0,0 @@
    54.4 -build.xml.data.CRC32=d2379ac2
    54.5 -build.xml.script.CRC32=2db9d955
    54.6 -build.xml.stylesheet.CRC32=ca9d572e
    54.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    54.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    54.9 -nbproject/build-impl.xml.data.CRC32=8f41dcce
   54.10 -nbproject/build-impl.xml.script.CRC32=e3e2a5d5
   54.11 -nbproject/build-impl.xml.stylesheet.CRC32=5220179f@1.3.5
    55.1 --- a/src/Tools/jEdit/nbproject/project.properties	Wed Jun 08 17:01:07 2011 +0200
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,81 +0,0 @@
    55.4 -application.title=Isabelle-jEdit
    55.5 -application.vendor=makarius
    55.6 -application.args=-noserver -nobackground
    55.7 -build.classes.dir=${build.dir}/classes
    55.8 -build.classes.excludes=**/*.java,**/*.form,**/*.scala
    55.9 -# This directory is removed when the project is cleaned:
   55.10 -build.dir=build
   55.11 -build.generated.dir=${build.dir}/generated
   55.12 -# Only compile against the classpath explicitly listed here:
   55.13 -build.sysclasspath=ignore
   55.14 -build.test.classes.dir=${build.dir}/test/classes
   55.15 -build.test.results.dir=${build.dir}/test/results
   55.16 -debug.classpath=\
   55.17 -    ${run.classpath}
   55.18 -debug.test.classpath=\
   55.19 -    ${run.test.classpath}
   55.20 -# This directory is removed when the project is cleaned:
   55.21 -dist.dir=dist
   55.22 -# dist can be used as jEdits settings-directory;
   55.23 -# jEdit searches for plugins in the 'jars' subdirectory
   55.24 -# must include something like this to private.properties:
   55.25 -# application.args=-noserver -nobackground -settings=/absolute/path/to/project/dist
   55.26 -# 
   55.27 -dist.jar=${dist.dir}/jars/Isabelle-jEdit.jar
   55.28 -dist.javadoc.dir=${dist.dir}/javadoc
   55.29 -excludes=
   55.30 -file.reference.isabelle-jedit-src=src
   55.31 -file.reference.jedit.jar=/home/makarius/lib/jedit/current/jedit.jar
   55.32 -includes=**
   55.33 -jar.compress=false
   55.34 -java.platform.active=java_default_platform
   55.35 -javac.classpath=\
   55.36 -    ${reference.jEdit.build}:\
   55.37 -    ${libs.Isabelle-Pure.classpath}:\
   55.38 -    ${libs.Cobra-Renderer.classpath}:\
   55.39 -    ${libs.Rhino-JavaScript.classpath}:\
   55.40 -    ${libs.ErrorList.classpath}:\
   55.41 -    ${libs.Hyperlinks.classpath}:\
   55.42 -    ${libs.SideKick.classpath}:\
   55.43 -    ${libs.Console.classpath}:\
   55.44 -    ${libs.Scala-compiler.classpath}
   55.45 -# Space-separated list of extra javac options
   55.46 -javac.compilerargs=
   55.47 -javac.deprecation=false
   55.48 -javac.source=1.5
   55.49 -javac.target=1.5
   55.50 -javac.test.classpath=\
   55.51 -    ${javac.classpath}:\
   55.52 -    ${build.classes.dir}:\
   55.53 -    ${libs.junit.classpath}:\
   55.54 -    ${libs.junit_4.classpath}
   55.55 -javadoc.additionalparam=
   55.56 -javadoc.author=false
   55.57 -javadoc.encoding=${source.encoding}
   55.58 -javadoc.noindex=false
   55.59 -javadoc.nonavbar=false
   55.60 -javadoc.notree=false
   55.61 -javadoc.private=false
   55.62 -javadoc.splitindex=true
   55.63 -javadoc.use=true
   55.64 -javadoc.version=false
   55.65 -javadoc.windowtitle=
   55.66 -main.class=org.gjt.sp.jedit.jEdit
   55.67 -manifest.file=manifest.mf
   55.68 -meta.inf.dir=${src.dir}/META-INF
   55.69 -platform.active=default_platform
   55.70 -project.jEdit=contrib/jEdit
   55.71 -reference.jEdit.build=${project.jEdit}/build/jEdit.jar
   55.72 -run.classpath=\
   55.73 -    ${javac.classpath}:\
   55.74 -    ${build.classes.dir}
   55.75 -run.jvmargs=-Xms128m -Xmx512m
   55.76 -run.test.classpath=\
   55.77 -    ${javac.test.classpath}:\
   55.78 -    ${build.test.classes.dir}
   55.79 -source.encoding=UTF-8
   55.80 -src.dir=${file.reference.isabelle-jedit-src}
   55.81 -scalac.compilerargs=
   55.82 -scalac.deprecation=yes
   55.83 -scalac.unchecked=yes
   55.84 -
    56.1 --- a/src/Tools/jEdit/nbproject/project.xml	Wed Jun 08 17:01:07 2011 +0200
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,24 +0,0 @@
    56.4 -<?xml version="1.0" encoding="UTF-8"?>
    56.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
    56.6 -    <type>org.netbeans.modules.scala.project</type>
    56.7 -    <configuration>
    56.8 -        <data xmlns="http://www.netbeans.org/ns/scala-project/1">
    56.9 -            <name>Isabelle-jEdit</name>
   56.10 -            <minimum-ant-version>1.6.5</minimum-ant-version>
   56.11 -            <source-roots>
   56.12 -                <root id="src.dir"/>
   56.13 -            </source-roots>
   56.14 -            <test-roots/>
   56.15 -        </data>
   56.16 -        <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
   56.17 -            <reference>
   56.18 -                <foreign-project>jEdit</foreign-project>
   56.19 -                <artifact-type>jar</artifact-type>
   56.20 -                <script>build-nb.xml</script>
   56.21 -                <target>build</target>
   56.22 -                <clean-target>clean</clean-target>
   56.23 -                <id>build</id>
   56.24 -            </reference>
   56.25 -        </references>
   56.26 -    </configuration>
   56.27 -</project>
    57.1 --- a/src/Tools/jEdit/plugin/Isabelle.props	Wed Jun 08 17:01:07 2011 +0200
    57.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.3 @@ -1,60 +0,0 @@
    57.4 -## Isabelle plugin properties
    57.5 -##
    57.6 -##:encoding=ISO-8859-1:wrap=soft:maxLineLen=100:
    57.7 -
    57.8 -#identification
    57.9 -plugin.isabelle.jedit.Plugin.name=Isabelle
   57.10 -plugin.isabelle.jedit.Plugin.author=Johannes Hölzl, Fabian Immler, Makarius Wenzel
   57.11 -plugin.isabelle.jedit.Plugin.version=0.1.0
   57.12 -plugin.isabelle.jedit.Plugin.description=Isabelle/Isar asynchronous proof document editing
   57.13 -
   57.14 -#system parameters
   57.15 -plugin.isabelle.jedit.Plugin.activate=startup
   57.16 -plugin.isabelle.jedit.Plugin.usePluginHome=false
   57.17 -
   57.18 -#dependencies
   57.19 -plugin.isabelle.jedit.Plugin.depend.0=jdk 1.6
   57.20 -plugin.isabelle.jedit.Plugin.depend.1=jedit 04.03.99.00
   57.21 -plugin.isabelle.jedit.Plugin.depend.2=plugin console.ConsolePlugin 4.4.1
   57.22 -plugin.isabelle.jedit.Plugin.depend.3=plugin errorlist.ErrorListPlugin 1.8
   57.23 -plugin.isabelle.jedit.Plugin.depend.4=plugin sidekick.SideKickPlugin 0.8
   57.24 -plugin.isabelle.jedit.Plugin.depend.5=plugin gatchan.jedit.hyperlinks.HyperlinksPlugin 1.0.1
   57.25 -
   57.26 -#options
   57.27 -plugin.isabelle.jedit.Plugin.option-pane=isabelle
   57.28 -options.isabelle.label=Isabelle
   57.29 -options.isabelle.code=new isabelle.jedit.Isabelle_Options();
   57.30 -options.isabelle.logic.title=Logic
   57.31 -options.isabelle.relative-font-size.title=Relative Font Size
   57.32 -options.isabelle.relative-font-size=100
   57.33 -options.isabelle.tooltip-font-size.title=Tooltip Font Size
   57.34 -options.isabelle.tooltip-font-size=10
   57.35 -options.isabelle.tooltip-margin.title=Tooltip Margin
   57.36 -options.isabelle.tooltip-margin=40
   57.37 -options.isabelle.tooltip-dismiss-delay.title=Tooltip Dismiss Delay (global)
   57.38 -options.isabelle.tooltip-dismiss-delay=8.0
   57.39 -options.isabelle.startup-timeout=25.0
   57.40 -options.isabelle.auto-start.title=Auto Start
   57.41 -options.isabelle.auto-start=true
   57.42 -
   57.43 -#menu actions
   57.44 -plugin.isabelle.jedit.Plugin.menu.label=Isabelle
   57.45 -plugin.isabelle.jedit.Plugin.menu=isabelle.session-panel isabelle.output-panel isabelle.raw-output-panel isabelle.protocol-panel
   57.46 -isabelle.session-panel.label=Prover Session panel
   57.47 -isabelle.output-panel.label=Output panel
   57.48 -isabelle.raw-output-panel.label=Raw Output panel
   57.49 -isabelle.protocol-panel.label=Protocol panel
   57.50 -
   57.51 -#dockables
   57.52 -isabelle-session.title=Prover Session
   57.53 -isabelle-output.title=Output
   57.54 -isabelle-raw-output.title=Raw Output
   57.55 -isabelle-protocol.title=Protocol
   57.56 -
   57.57 -#SideKick
   57.58 -sidekick.parser.isabelle.label=Isabelle
   57.59 -mode.isabelle.sidekick.parser=isabelle
   57.60 -mode.ml.sidekick.parser=isabelle
   57.61 -
   57.62 -#Hyperlinks
   57.63 -mode.isabelle.hyperlink.source=isabelle
    58.1 --- a/src/Tools/jEdit/plugin/actions.xml	Wed Jun 08 17:01:07 2011 +0200
    58.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.3 @@ -1,25 +0,0 @@
    58.4 -<?xml version="1.0"?>
    58.5 -<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
    58.6 -
    58.7 -<ACTIONS>
    58.8 -	<ACTION NAME="isabelle.session-panel">
    58.9 -		<CODE>
   58.10 -			wm.addDockableWindow("isabelle-session");
   58.11 -		</CODE>
   58.12 -	</ACTION>
   58.13 -	<ACTION NAME="isabelle.output-panel">
   58.14 -		<CODE>
   58.15 -			wm.addDockableWindow("isabelle-output");
   58.16 -		</CODE>
   58.17 -	</ACTION>
   58.18 -	<ACTION NAME="isabelle.raw-output-panel">
   58.19 -		<CODE>
   58.20 -			wm.addDockableWindow("isabelle-raw-output");
   58.21 -		</CODE>
   58.22 -	</ACTION>
   58.23 -	<ACTION NAME="isabelle.protocol-panel">
   58.24 -		<CODE>
   58.25 -			wm.addDockableWindow("isabelle-protocol");
   58.26 -		</CODE>
   58.27 -	</ACTION>
   58.28 -</ACTIONS>
   58.29 \ No newline at end of file
    59.1 --- a/src/Tools/jEdit/plugin/dockables.xml	Wed Jun 08 17:01:07 2011 +0200
    59.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.3 @@ -1,17 +0,0 @@
    59.4 -<?xml version="1.0"?>
    59.5 -<!DOCTYPE DOCKABLES SYSTEM "dockables.dtd">
    59.6 -
    59.7 -<DOCKABLES>
    59.8 -	<DOCKABLE NAME="isabelle-session" MOVABLE="TRUE">
    59.9 -		new isabelle.jedit.Session_Dockable(view, position);
   59.10 -	</DOCKABLE>
   59.11 -	<DOCKABLE NAME="isabelle-output" MOVABLE="TRUE">
   59.12 -		new isabelle.jedit.Output_Dockable(view, position);
   59.13 -	</DOCKABLE>
   59.14 -	<DOCKABLE NAME="isabelle-raw-output" MOVABLE="TRUE">
   59.15 -		new isabelle.jedit.Raw_Output_Dockable(view, position);
   59.16 -	</DOCKABLE>
   59.17 -	<DOCKABLE NAME="isabelle-protocol" MOVABLE="TRUE">
   59.18 -		new isabelle.jedit.Protocol_Dockable(view, position);
   59.19 -	</DOCKABLE>
   59.20 -</DOCKABLES>
   59.21 \ No newline at end of file
    60.1 --- a/src/Tools/jEdit/plugin/services.xml	Wed Jun 08 17:01:07 2011 +0200
    60.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.3 @@ -1,20 +0,0 @@
    60.4 -<?xml version="1.0"?>
    60.5 -<!DOCTYPE SERVICES SYSTEM "services.dtd">
    60.6 -
    60.7 -<SERVICES>
    60.8 -	<SERVICE NAME="UTF-8-Isabelle" CLASS="org.gjt.sp.jedit.io.Encoding">
    60.9 -		new isabelle.jedit.Isabelle_Encoding();
   60.10 -	</SERVICE>
   60.11 -	<SERVICE NAME="isabelle" CLASS="sidekick.SideKickParser">
   60.12 -		new isabelle.jedit.Isabelle_Sidekick_Default();
   60.13 -	</SERVICE>
   60.14 -	<SERVICE NAME="isabelle-raw" CLASS="sidekick.SideKickParser">
   60.15 -		new isabelle.jedit.Isabelle_Sidekick_Raw();
   60.16 -	</SERVICE>
   60.17 -  <SERVICE NAME="isabelle" CLASS="gatchan.jedit.hyperlinks.HyperlinkSource">
   60.18 -    new isabelle.jedit.Isabelle_Hyperlinks();
   60.19 -  </SERVICE>
   60.20 - 	<SERVICE CLASS="console.Shell" NAME="Scala">
   60.21 -		new isabelle.jedit.Scala_Console();
   60.22 -	</SERVICE>
   60.23 -</SERVICES>
    61.1 --- a/src/Tools/jEdit/src/Dummy.java	Wed Jun 08 17:01:07 2011 +0200
    61.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.3 @@ -1,3 +0,0 @@
    61.4 -/* dummy class to make ant javadoc work */
    61.5 -package isabelle;
    61.6 -public class Dummy { }
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/src/Tools/jEdit/src/Isabelle.props	Wed Jun 08 22:13:49 2011 +0200
    62.3 @@ -0,0 +1,60 @@
    62.4 +## Isabelle plugin properties
    62.5 +##
    62.6 +##:encoding=ISO-8859-1:wrap=soft:maxLineLen=100:
    62.7 +
    62.8 +#identification
    62.9 +plugin.isabelle.jedit.Plugin.name=Isabelle
   62.10 +plugin.isabelle.jedit.Plugin.author=Johannes Hölzl, Fabian Immler, Makarius Wenzel
   62.11 +plugin.isabelle.jedit.Plugin.version=0.1.0
   62.12 +plugin.isabelle.jedit.Plugin.description=Isabelle/Isar asynchronous proof document editing
   62.13 +
   62.14 +#system parameters
   62.15 +plugin.isabelle.jedit.Plugin.activate=startup
   62.16 +plugin.isabelle.jedit.Plugin.usePluginHome=false
   62.17 +
   62.18 +#dependencies
   62.19 +plugin.isabelle.jedit.Plugin.depend.0=jdk 1.6
   62.20 +plugin.isabelle.jedit.Plugin.depend.1=jedit 04.03.99.00
   62.21 +plugin.isabelle.jedit.Plugin.depend.2=plugin console.ConsolePlugin 4.4.1
   62.22 +plugin.isabelle.jedit.Plugin.depend.3=plugin errorlist.ErrorListPlugin 1.8
   62.23 +plugin.isabelle.jedit.Plugin.depend.4=plugin sidekick.SideKickPlugin 0.8
   62.24 +plugin.isabelle.jedit.Plugin.depend.5=plugin gatchan.jedit.hyperlinks.HyperlinksPlugin 1.0.1
   62.25 +
   62.26 +#options
   62.27 +plugin.isabelle.jedit.Plugin.option-pane=isabelle
   62.28 +options.isabelle.label=Isabelle
   62.29 +options.isabelle.code=new isabelle.jedit.Isabelle_Options();
   62.30 +options.isabelle.logic.title=Logic
   62.31 +options.isabelle.relative-font-size.title=Relative Font Size
   62.32 +options.isabelle.relative-font-size=100
   62.33 +options.isabelle.tooltip-font-size.title=Tooltip Font Size
   62.34 +options.isabelle.tooltip-font-size=10
   62.35 +options.isabelle.tooltip-margin.title=Tooltip Margin
   62.36 +options.isabelle.tooltip-margin=40
   62.37 +options.isabelle.tooltip-dismiss-delay.title=Tooltip Dismiss Delay (global)
   62.38 +options.isabelle.tooltip-dismiss-delay=8.0
   62.39 +options.isabelle.startup-timeout=25.0
   62.40 +options.isabelle.auto-start.title=Auto Start
   62.41 +options.isabelle.auto-start=true
   62.42 +
   62.43 +#menu actions
   62.44 +plugin.isabelle.jedit.Plugin.menu.label=Isabelle
   62.45 +plugin.isabelle.jedit.Plugin.menu=isabelle.session-panel isabelle.output-panel isabelle.raw-output-panel isabelle.protocol-panel
   62.46 +isabelle.session-panel.label=Prover Session panel
   62.47 +isabelle.output-panel.label=Output panel
   62.48 +isabelle.raw-output-panel.label=Raw Output panel
   62.49 +isabelle.protocol-panel.label=Protocol panel
   62.50 +
   62.51 +#dockables
   62.52 +isabelle-session.title=Prover Session
   62.53 +isabelle-output.title=Output
   62.54 +isabelle-raw-output.title=Raw Output
   62.55 +isabelle-protocol.title=Protocol
   62.56 +
   62.57 +#SideKick
   62.58 +sidekick.parser.isabelle.label=Isabelle
   62.59 +mode.isabelle.sidekick.parser=isabelle
   62.60 +mode.ml.sidekick.parser=isabelle
   62.61 +
   62.62 +#Hyperlinks
   62.63 +mode.isabelle.hyperlink.source=isabelle
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/src/Tools/jEdit/src/actions.xml	Wed Jun 08 22:13:49 2011 +0200
    63.3 @@ -0,0 +1,25 @@
    63.4 +<?xml version="1.0"?>
    63.5 +<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
    63.6 +
    63.7 +<ACTIONS>
    63.8 +	<ACTION NAME="isabelle.session-panel">
    63.9 +		<CODE>
   63.10 +			wm.addDockableWindow("isabelle-session");
   63.11 +		</CODE>
   63.12 +	</ACTION>
   63.13 +	<ACTION NAME="isabelle.output-panel">
   63.14 +		<CODE>
   63.15 +			wm.addDockableWindow("isabelle-output");
   63.16 +		</CODE>
   63.17 +	</ACTION>
   63.18 +	<ACTION NAME="isabelle.raw-output-panel">
   63.19 +		<CODE>
   63.20 +			wm.addDockableWindow("isabelle-raw-output");
   63.21 +		</CODE>
   63.22 +	</ACTION>
   63.23 +	<ACTION NAME="isabelle.protocol-panel">
   63.24 +		<CODE>
   63.25 +			wm.addDockableWindow("isabelle-protocol");
   63.26 +		</CODE>
   63.27 +	</ACTION>
   63.28 +</ACTIONS>
   63.29 \ No newline at end of file
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/src/Tools/jEdit/src/dockable.scala	Wed Jun 08 22:13:49 2011 +0200
    64.3 @@ -0,0 +1,41 @@
    64.4 +/*  Title:      Tools/jEdit/src/dockable.scala
    64.5 +    Author:     Makarius
    64.6 +
    64.7 +Generic dockable window.
    64.8 +*/
    64.9 +
   64.10 +package isabelle.jedit
   64.11 +
   64.12 +
   64.13 +import isabelle._
   64.14 +
   64.15 +import java.awt.{Dimension, Component, BorderLayout}
   64.16 +import javax.swing.JPanel
   64.17 +
   64.18 +import org.gjt.sp.jedit.View
   64.19 +import org.gjt.sp.jedit.gui.DockableWindowManager
   64.20 +
   64.21 +
   64.22 +class Dockable(view: View, position: String) extends JPanel(new BorderLayout)
   64.23 +{
   64.24 +  if (position == DockableWindowManager.FLOATING)
   64.25 +    setPreferredSize(new Dimension(500, 250))
   64.26 +
   64.27 +  def set_content(c: Component) { add(c, BorderLayout.CENTER) }
   64.28 +  def set_content(c: scala.swing.Component) { add(c.peer, BorderLayout.CENTER) }
   64.29 +
   64.30 +  protected def init() { }
   64.31 +  protected def exit() { }
   64.32 +
   64.33 +  override def addNotify()
   64.34 +  {
   64.35 +    super.addNotify()
   64.36 +    init()
   64.37 +  }
   64.38 +
   64.39 +  override def removeNotify()
   64.40 +  {
   64.41 +    exit()
   64.42 +    super.removeNotify()
   64.43 +  }
   64.44 +}
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/src/Tools/jEdit/src/dockables.xml	Wed Jun 08 22:13:49 2011 +0200
    65.3 @@ -0,0 +1,17 @@
    65.4 +<?xml version="1.0"?>
    65.5 +<!DOCTYPE DOCKABLES SYSTEM "dockables.dtd">
    65.6 +
    65.7 +<DOCKABLES>
    65.8 +	<DOCKABLE NAME="isabelle-session" MOVABLE="TRUE">
    65.9 +		new isabelle.jedit.Session_Dockable(view, position);
   65.10 +	</DOCKABLE>
   65.11 +	<DOCKABLE NAME="isabelle-output" MOVABLE="TRUE">
   65.12 +		new isabelle.jedit.Output_Dockable(view, position);
   65.13 +	</DOCKABLE>
   65.14 +	<DOCKABLE NAME="isabelle-raw-output" MOVABLE="TRUE">
   65.15 +		new isabelle.jedit.Raw_Output_Dockable(view, position);
   65.16 +	</DOCKABLE>
   65.17 +	<DOCKABLE NAME="isabelle-protocol" MOVABLE="TRUE">
   65.18 +		new isabelle.jedit.Protocol_Dockable(view, position);
   65.19 +	</DOCKABLE>
   65.20 +</DOCKABLES>
   65.21 \ No newline at end of file
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/src/Tools/jEdit/src/document_model.scala	Wed Jun 08 22:13:49 2011 +0200
    66.3 @@ -0,0 +1,252 @@
    66.4 +/*  Title:      Tools/jEdit/src/document_model.scala
    66.5 +    Author:     Fabian Immler, TU Munich
    66.6 +    Author:     Makarius
    66.7 +
    66.8 +Document model connected to jEdit buffer -- single node in theory graph.
    66.9 +*/
   66.10 +
   66.11 +package isabelle.jedit
   66.12 +
   66.13 +
   66.14 +import isabelle._
   66.15 +
   66.16 +import scala.collection.mutable
   66.17 +
   66.18 +import org.gjt.sp.jedit.Buffer
   66.19 +import org.gjt.sp.jedit.buffer.{BufferAdapter, BufferListener, JEditBuffer}
   66.20 +import org.gjt.sp.jedit.syntax.{SyntaxStyle, Token, TokenMarker, TokenHandler, ParserRuleSet}
   66.21 +import org.gjt.sp.jedit.textarea.TextArea
   66.22 +
   66.23 +import java.awt.font.TextAttribute
   66.24 +import javax.swing.text.Segment;
   66.25 +
   66.26 +
   66.27 +object Document_Model
   66.28 +{
   66.29 +  object Token_Markup
   66.30 +  {
   66.31 +    /* extended token styles */
   66.32 +
   66.33 +    private val plain_range: Int = Token.ID_COUNT
   66.34 +    private val full_range: Int = 3 * plain_range
   66.35 +    private def check_range(i: Int) { require(0 <= i && i < plain_range) }
   66.36 +
   66.37 +    def subscript(i: Byte): Byte = { check_range(i); (i + plain_range).toByte }
   66.38 +    def superscript(i: Byte): Byte = { check_range(i); (i + 2 * plain_range).toByte }
   66.39 +
   66.40 +    private def script_style(style: SyntaxStyle, i: Int): SyntaxStyle =
   66.41 +    {
   66.42 +      import scala.collection.JavaConversions._
   66.43 +      val script_font =
   66.44 +        style.getFont.deriveFont(Map(TextAttribute.SUPERSCRIPT -> new java.lang.Integer(i)))
   66.45 +      new SyntaxStyle(style.getForegroundColor, style.getBackgroundColor, script_font)
   66.46 +    }
   66.47 +
   66.48 +    def extend_styles(styles: Array[SyntaxStyle]): Array[SyntaxStyle] =
   66.49 +    {
   66.50 +      val new_styles = new Array[SyntaxStyle](full_range)
   66.51 +      for (i <- 0 until plain_range) {
   66.52 +        val style = styles(i)
   66.53 +        new_styles(i) = style
   66.54 +        new_styles(subscript(i.toByte)) = script_style(style, -1)
   66.55 +        new_styles(superscript(i.toByte)) = script_style(style, 1)
   66.56 +      }
   66.57 +      new_styles
   66.58 +    }
   66.59 +
   66.60 +
   66.61 +    /* line context */
   66.62 +
   66.63 +    private val dummy_rules = new ParserRuleSet("isabelle", "MAIN")
   66.64 +
   66.65 +    class Line_Context(val line: Int, prev: Line_Context)
   66.66 +      extends TokenMarker.LineContext(dummy_rules, prev)
   66.67 +    {
   66.68 +      override def hashCode: Int = line
   66.69 +      override def equals(that: Any): Boolean =
   66.70 +        that match {
   66.71 +          case other: Line_Context => line == other.line
   66.72 +          case _ => false
   66.73 +        }
   66.74 +    }
   66.75 +  }
   66.76 +
   66.77 +
   66.78 +  /* document model of buffer */
   66.79 +
   66.80 +  private val key = "isabelle.document_model"
   66.81 +
   66.82 +  def init(session: Session, buffer: Buffer, thy_name: String): Document_Model =
   66.83 +  {
   66.84 +    Swing_Thread.require()
   66.85 +    val model = new Document_Model(session, buffer, thy_name)
   66.86 +    buffer.setProperty(key, model)
   66.87 +    model.activate()
   66.88 +    model
   66.89 +  }
   66.90 +
   66.91 +  def apply(buffer: Buffer): Option[Document_Model] =
   66.92 +  {
   66.93 +    Swing_Thread.require()
   66.94 +    buffer.getProperty(key) match {
   66.95 +      case model: Document_Model => Some(model)
   66.96 +      case _ => None
   66.97 +    }
   66.98 +  }
   66.99 +
  66.100 +  def exit(buffer: Buffer)
  66.101 +  {
  66.102 +    Swing_Thread.require()
  66.103 +    apply(buffer) match {
  66.104 +      case None =>
  66.105 +      case Some(model) =>
  66.106 +        model.deactivate()
  66.107 +        buffer.unsetProperty(key)
  66.108 +    }
  66.109 +  }
  66.110 +}
  66.111 +
  66.112 +
  66.113 +class Document_Model(val session: Session, val buffer: Buffer, val thy_name: String)
  66.114 +{
  66.115 +  /* pending text edits */
  66.116 +
  66.117 +  object pending_edits  // owned by Swing thread
  66.118 +  {
  66.119 +    private val pending = new mutable.ListBuffer[Text.Edit]
  66.120 +    def snapshot(): List[Text.Edit] = pending.toList
  66.121 +
  66.122 +    def flush(more_edits: Option[List[Text.Edit]]*)
  66.123 +    {
  66.124 +      Swing_Thread.require()
  66.125 +      val edits = snapshot()
  66.126 +      pending.clear
  66.127 +
  66.128 +      val all_edits =
  66.129 +        if (edits.isEmpty) more_edits.toList
  66.130 +        else Some(edits) :: more_edits.toList
  66.131 +      if (!all_edits.isEmpty) session.edit_version(all_edits.map((thy_name, _)))
  66.132 +    }
  66.133 +
  66.134 +    def init()
  66.135 +    {
  66.136 +      Swing_Thread.require()
  66.137 +      flush(None, Some(List(Text.Edit.insert(0, Isabelle.buffer_text(buffer)))))
  66.138 +    }
  66.139 +
  66.140 +    private val delay_flush =
  66.141 +      Swing_Thread.delay_last(session.input_delay) { flush() }
  66.142 +
  66.143 +    def +=(edit: Text.Edit)
  66.144 +    {
  66.145 +      Swing_Thread.require()
  66.146 +      pending += edit
  66.147 +      delay_flush()
  66.148 +    }
  66.149 +  }
  66.150 +
  66.151 +
  66.152 +  /* snapshot */
  66.153 +
  66.154 +  def snapshot(): Document.Snapshot =
  66.155 +  {
  66.156 +    Swing_Thread.require()
  66.157 +    session.snapshot(thy_name, pending_edits.snapshot())
  66.158 +  }
  66.159 +
  66.160 +
  66.161 +  /* buffer listener */
  66.162 +
  66.163 +  private val buffer_listener: BufferListener = new BufferAdapter
  66.164 +  {
  66.165 +    override def bufferLoaded(buffer: JEditBuffer)
  66.166 +    {
  66.167 +      pending_edits.init()
  66.168 +    }
  66.169 +
  66.170 +    override def contentInserted(buffer: JEditBuffer,
  66.171 +      start_line: Int, offset: Int, num_lines: Int, length: Int)
  66.172 +    {
  66.173 +      if (!buffer.isLoading)
  66.174 +        pending_edits += Text.Edit.insert(offset, buffer.getText(offset, length))
  66.175 +    }
  66.176 +
  66.177 +    override def preContentRemoved(buffer: JEditBuffer,
  66.178 +      start_line: Int, offset: Int, num_lines: Int, removed_length: Int)
  66.179 +    {
  66.180 +      if (!buffer.isLoading)
  66.181 +        pending_edits += Text.Edit.remove(offset, buffer.getText(offset, removed_length))
  66.182 +    }
  66.183 +  }
  66.184 +
  66.185 +
  66.186 +  /* semantic token marker */
  66.187 +
  66.188 +  private val token_marker = new TokenMarker
  66.189 +  {
  66.190 +    override def markTokens(prev: TokenMarker.LineContext,
  66.191 +        handler: TokenHandler, line_segment: Segment): TokenMarker.LineContext =
  66.192 +    {
  66.193 +      Isabelle.swing_buffer_lock(buffer) {
  66.194 +        val snapshot = Document_Model.this.snapshot()
  66.195 +
  66.196 +        val previous = prev.asInstanceOf[Document_Model.Token_Markup.Line_Context]
  66.197 +        val line = if (prev == null) 0 else previous.line + 1
  66.198 +        val context = new Document_Model.Token_Markup.Line_Context(line, previous)
  66.199 +
  66.200 +        val start = buffer.getLineStartOffset(line)
  66.201 +        val stop = start + line_segment.count
  66.202 +
  66.203 +        /* FIXME
  66.204 +        for (text_area <- Isabelle.jedit_text_areas(buffer)
  66.205 +              if Document_View(text_area).isDefined)
  66.206 +          Document_View(text_area).get.set_styles()
  66.207 +        */
  66.208 +
  66.209 +        def handle_token(style: Byte, offset: Text.Offset, length: Int) =
  66.210 +          handler.handleToken(line_segment, style, offset, length, context)
  66.211 +
  66.212 +        val syntax = session.current_syntax()
  66.213 +        val tokens = snapshot.select_markup(Text.Range(start, stop))(Isabelle_Markup.tokens(syntax))
  66.214 +
  66.215 +        var last = start
  66.216 +        for (token <- tokens.iterator) {
  66.217 +          val Text.Range(token_start, token_stop) = token.range
  66.218 +          if (last < token_start)
  66.219 +            handle_token(Token.COMMENT1, last - start, token_start - last)
  66.220 +          handle_token(token.info getOrElse Token.NULL,
  66.221 +            token_start - start, token_stop - token_start)
  66.222 +          last = token_stop
  66.223 +        }
  66.224 +        if (last < stop) handle_token(Token.COMMENT1, last - start, stop - last)
  66.225 +
  66.226 +        handle_token(Token.END, line_segment.count, 0)
  66.227 +        handler.setLineContext(context)
  66.228 +        context
  66.229 +      }
  66.230 +    }
  66.231 +  }
  66.232 +
  66.233 +
  66.234 +  /* activation */
  66.235 +
  66.236 +  def activate()
  66.237 +  {
  66.238 +    buffer.setTokenMarker(token_marker)
  66.239 +    buffer.addBufferListener(buffer_listener)
  66.240 +    buffer.propertiesChanged()
  66.241 +    pending_edits.init()
  66.242 +  }
  66.243 +
  66.244 +  def refresh()
  66.245 +  {
  66.246 +    buffer.setTokenMarker(token_marker)
  66.247 +  }
  66.248 +
  66.249 +  def deactivate()
  66.250 +  {
  66.251 +    pending_edits.flush()
  66.252 +    buffer.setTokenMarker(buffer.getMode.getTokenMarker)
  66.253 +    buffer.removeBufferListener(buffer_listener)
  66.254 +  }
  66.255 +}
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/src/Tools/jEdit/src/document_view.scala	Wed Jun 08 22:13:49 2011 +0200
    67.3 @@ -0,0 +1,587 @@
    67.4 +/*  Title:      Tools/jEdit/src/document_view.scala
    67.5 +    Author:     Fabian Immler, TU Munich
    67.6 +    Author:     Makarius
    67.7 +
    67.8 +Document view connected to jEdit text area.
    67.9 +*/
   67.10 +
   67.11 +package isabelle.jedit
   67.12 +
   67.13 +
   67.14 +import isabelle._
   67.15 +
   67.16 +import scala.actors.Actor._
   67.17 +
   67.18 +import java.awt.{BorderLayout, Graphics, Color, Dimension, Graphics2D, Point}
   67.19 +import java.awt.event.{MouseAdapter, MouseMotionAdapter, MouseEvent,
   67.20 +  FocusAdapter, FocusEvent, WindowEvent, WindowAdapter}
   67.21 +import javax.swing.{JPanel, ToolTipManager, Popup, PopupFactory, SwingUtilities, BorderFactory}
   67.22 +import javax.swing.event.{CaretListener, CaretEvent}
   67.23 +import java.util.ArrayList
   67.24 +
   67.25 +import org.gjt.sp.jedit.{jEdit, OperatingSystem, Debug}
   67.26 +import org.gjt.sp.jedit.gui.RolloverButton
   67.27 +import org.gjt.sp.jedit.options.GutterOptionPane
   67.28 +import org.gjt.sp.jedit.textarea.{JEditTextArea, TextArea, TextAreaExtension, TextAreaPainter}
   67.29 +import org.gjt.sp.jedit.syntax.{SyntaxStyle, DisplayTokenHandler, Chunk, Token}
   67.30 +
   67.31 +
   67.32 +object Document_View
   67.33 +{
   67.34 +  /* document view of text area */
   67.35 +
   67.36 +  private val key = new Object
   67.37 +
   67.38 +  def init(model: Document_Model, text_area: JEditTextArea): Document_View =
   67.39 +  {
   67.40 +    Swing_Thread.require()
   67.41 +    val doc_view = new Document_View(model, text_area)
   67.42 +    text_area.putClientProperty(key, doc_view)
   67.43 +    doc_view.activate()
   67.44 +    doc_view
   67.45 +  }
   67.46 +
   67.47 +  def apply(text_area: JEditTextArea): Option[Document_View] =
   67.48 +  {
   67.49 +    Swing_Thread.require()
   67.50 +    text_area.getClientProperty(key) match {
   67.51 +      case doc_view: Document_View => Some(doc_view)
   67.52 +      case _ => None
   67.53 +    }
   67.54 +  }
   67.55 +
   67.56 +  def exit(text_area: JEditTextArea)
   67.57 +  {
   67.58 +    Swing_Thread.require()
   67.59 +    apply(text_area) match {
   67.60 +      case None =>
   67.61 +      case Some(doc_view) =>
   67.62 +        doc_view.deactivate()
   67.63 +        text_area.putClientProperty(key, null)
   67.64 +    }
   67.65 +  }
   67.66 +}
   67.67 +
   67.68 +
   67.69 +class Document_View(val model: Document_Model, text_area: JEditTextArea)
   67.70 +{
   67.71 +  private val session = model.session
   67.72 +
   67.73 +
   67.74 +  /** token handling **/
   67.75 +
   67.76 +  /* extended token styles */
   67.77 +
   67.78 +  private var styles: Array[SyntaxStyle] = null  // owned by Swing thread
   67.79 +
   67.80 +  def extend_styles()
   67.81 +  {
   67.82 +    Swing_Thread.require()
   67.83 +    styles = Document_Model.Token_Markup.extend_styles(text_area.getPainter.getStyles)
   67.84 +  }
   67.85 +  extend_styles()
   67.86 +
   67.87 +  def set_styles()
   67.88 +  {
   67.89 +    Swing_Thread.require()
   67.90 +    text_area.getPainter.setStyles(styles)
   67.91 +  }
   67.92 +
   67.93 +
   67.94 +  /* wrap_margin -- cf. org.gjt.sp.jedit.textarea.TextArea.propertiesChanged */
   67.95 +
   67.96 +  def wrap_margin(): Int =
   67.97 +  {
   67.98 +    val buffer = text_area.getBuffer
   67.99 +    val painter = text_area.getPainter
  67.100 +    val font = painter.getFont
  67.101 +    val font_context = painter.getFontRenderContext
  67.102 +
  67.103 +    val soft_wrap = buffer.getStringProperty("wrap") == "soft"
  67.104 +    val max = buffer.getIntegerProperty("maxLineLen", 0)
  67.105 +
  67.106 +    if (max > 0) font.getStringBounds(" " * max, font_context).getWidth.toInt
  67.107 +    else if (soft_wrap)
  67.108 +      painter.getWidth - (font.getStringBounds(" ", font_context).getWidth.round.toInt) * 3
  67.109 +    else 0
  67.110 +  }
  67.111 +
  67.112 +
  67.113 +  /* chunks */
  67.114 +
  67.115 +  def line_chunks(physical_lines: Set[Int]): Map[Text.Offset, Chunk] =
  67.116 +  {
  67.117 +    import scala.collection.JavaConversions._
  67.118 +
  67.119 +    val buffer = text_area.getBuffer
  67.120 +    val painter = text_area.getPainter
  67.121 +    val margin = wrap_margin().toFloat
  67.122 +
  67.123 +    val out = new ArrayList[Chunk]
  67.124 +    val handler = new DisplayTokenHandler
  67.125 +
  67.126 +    var result = Map[Text.Offset, Chunk]()
  67.127 +    for (line <- physical_lines) {
  67.128 +      out.clear
  67.129 +      handler.init(painter.getStyles, painter.getFontRenderContext, painter, out, margin)
  67.130 +      buffer.markTokens(line, handler)
  67.131 +
  67.132 +      val line_start = buffer.getLineStartOffset(line)
  67.133 +      for (chunk <- handler.getChunkList.iterator)
  67.134 +        result += (line_start + chunk.offset -> chunk)
  67.135 +    }
  67.136 +    result
  67.137 +  }
  67.138 +
  67.139 +
  67.140 +  /* visible line ranges */
  67.141 +
  67.142 +  // simplify slightly odd result of TextArea.getScreenLineEndOffset etc.
  67.143 +  // NB: jEdit already normalizes \r\n and \r to \n
  67.144 +  def proper_line_range(start: Text.Offset, end: Text.Offset): Text.Range =
  67.145 +  {
  67.146 +    val stop = if (start < end) end - 1 else end min model.buffer.getLength
  67.147 +    Text.Range(start, stop)
  67.148 +  }
  67.149 +
  67.150 +  def screen_lines_range(): Text.Range =
  67.151 +  {
  67.152 +    val start = text_area.getScreenLineStartOffset(0)
  67.153 +    val raw_end = text_area.getScreenLineEndOffset(text_area.getVisibleLines - 1 max 0)
  67.154 +    proper_line_range(start, if (raw_end >= 0) raw_end else model.buffer.getLength)
  67.155 +  }
  67.156 +
  67.157 +  def invalidate_line_range(range: Text.Range)
  67.158 +  {
  67.159 +    text_area.invalidateLineRange(
  67.160 +      model.buffer.getLineOfOffset(range.start),
  67.161 +      model.buffer.getLineOfOffset(range.stop))
  67.162 +  }
  67.163 +
  67.164 +
  67.165 +  /* HTML popups */
  67.166 +
  67.167 +  private var html_popup: Option[Popup] = None
  67.168 +
  67.169 +  private def exit_popup() { html_popup.map(_.hide) }
  67.170 +
  67.171 +  private val html_panel =
  67.172 +    new HTML_Panel(Isabelle.system, Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
  67.173 +  html_panel.setBorder(BorderFactory.createLineBorder(Color.black))
  67.174 +
  67.175 +  private def html_panel_resize()
  67.176 +  {
  67.177 +    Swing_Thread.now {
  67.178 +      html_panel.resize(Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
  67.179 +    }
  67.180 +  }
  67.181 +
  67.182 +  private def init_popup(snapshot: Document.Snapshot, x: Int, y: Int)
  67.183 +  {
  67.184 +    exit_popup()
  67.185 +/* FIXME broken
  67.186 +    val offset = text_area.xyToOffset(x, y)
  67.187 +    val p = new Point(x, y); SwingUtilities.convertPointToScreen(p, text_area.getPainter)
  67.188 +
  67.189 +    // FIXME snapshot.cumulate
  67.190 +    snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.popup) match {
  67.191 +      case Text.Info(_, Some(msg)) #:: _ =>
  67.192 +        val popup = PopupFactory.getSharedInstance().getPopup(text_area, html_panel, p.x, p.y + 60)
  67.193 +        html_panel.render_sync(List(msg))
  67.194 +        Thread.sleep(10)  // FIXME !?
  67.195 +        popup.show
  67.196 +        html_popup = Some(popup)
  67.197 +      case _ =>
  67.198 +    }
  67.199 +*/
  67.200 +  }
  67.201 +
  67.202 +
  67.203 +  /* subexpression highlighting */
  67.204 +
  67.205 +  private def subexp_range(snapshot: Document.Snapshot, x: Int, y: Int)
  67.206 +    : Option[(Text.Range, Color)] =
  67.207 +  {
  67.208 +    val offset = text_area.xyToOffset(x, y)
  67.209 +    snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.subexp) match {
  67.210 +      case Text.Info(_, Some((range, color))) #:: _ => Some((snapshot.convert(range), color))
  67.211 +      case _ => None
  67.212 +    }
  67.213 +  }
  67.214 +
  67.215 +  private var highlight_range: Option[(Text.Range, Color)] = None
  67.216 +
  67.217 +
  67.218 +  /* CONTROL-mouse management */
  67.219 +
  67.220 +  private var control: Boolean = false
  67.221 +
  67.222 +  private def exit_control()
  67.223 +  {
  67.224 +    exit_popup()
  67.225 +    highlight_range = None
  67.226 +  }
  67.227 +
  67.228 +  private val focus_listener = new FocusAdapter {
  67.229 +    override def focusLost(e: FocusEvent) {
  67.230 +      highlight_range = None // FIXME exit_control !?
  67.231 +    }
  67.232 +  }
  67.233 +
  67.234 +  private val window_listener = new WindowAdapter {
  67.235 +    override def windowIconified(e: WindowEvent) { exit_control() }
  67.236 +    override def windowDeactivated(e: WindowEvent) { exit_control() }
  67.237 +  }
  67.238 +
  67.239 +  private val mouse_motion_listener = new MouseMotionAdapter {
  67.240 +    override def mouseMoved(e: MouseEvent) {
  67.241 +      control = if (OperatingSystem.isMacOS()) e.isMetaDown else e.isControlDown
  67.242 +      val x = e.getX()
  67.243 +      val y = e.getY()
  67.244 +
  67.245 +      if (!model.buffer.isLoaded) exit_control()
  67.246 +      else
  67.247 +        Isabelle.swing_buffer_lock(model.buffer) {
  67.248 +          val snapshot = model.snapshot
  67.249 +
  67.250 +          if (control) init_popup(snapshot, x, y)
  67.251 +
  67.252 +          highlight_range map { case (range, _) => invalidate_line_range(range) }
  67.253 +          highlight_range = if (control) subexp_range(snapshot, x, y) else None
  67.254 +          highlight_range map { case (range, _) => invalidate_line_range(range) }
  67.255 +        }
  67.256 +    }
  67.257 +  }
  67.258 +
  67.259 +
  67.260 +  /* TextArea painters */
  67.261 +
  67.262 +  private val background_painter = new TextAreaExtension
  67.263 +  {
  67.264 +    override def paintScreenLineRange(gfx: Graphics2D,
  67.265 +      first_line: Int, last_line: Int, physical_lines: Array[Int],
  67.266 +      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
  67.267 +    {
  67.268 +      Isabelle.swing_buffer_lock(model.buffer) {
  67.269 +        val snapshot = model.snapshot()
  67.270 +        val ascent = text_area.getPainter.getFontMetrics.getAscent
  67.271 +
  67.272 +        for (i <- 0 until physical_lines.length) {
  67.273 +          if (physical_lines(i) != -1) {
  67.274 +            val line_range = proper_line_range(start(i), end(i))
  67.275 +
  67.276 +            // background color: status
  67.277 +            val cmds = snapshot.node.command_range(snapshot.revert(line_range))
  67.278 +            for {
  67.279 +              (command, command_start) <- cmds if !command.is_ignored
  67.280 +              val range = line_range.restrict(snapshot.convert(command.range + command_start))
  67.281 +              r <- Isabelle.gfx_range(text_area, range)
  67.282 +              color <- Isabelle_Markup.status_color(snapshot, command)
  67.283 +            } {
  67.284 +              gfx.setColor(color)
  67.285 +              gfx.fillRect(r.x, y + i * line_height, r.length, line_height)
  67.286 +            }
  67.287 +
  67.288 +            // background color (1): markup
  67.289 +            for {
  67.290 +              Text.Info(range, Some(color)) <-
  67.291 +                snapshot.select_markup(line_range)(Isabelle_Markup.background1).iterator
  67.292 +              r <- Isabelle.gfx_range(text_area, range)
  67.293 +            } {
  67.294 +              gfx.setColor(color)
  67.295 +              gfx.fillRect(r.x, y + i * line_height, r.length, line_height)
  67.296 +            }
  67.297 +
  67.298 +            // background color (2): markup
  67.299 +            for {
  67.300 +              Text.Info(range, Some(color)) <-
  67.301 +                snapshot.select_markup(line_range)(Isabelle_Markup.background2).iterator
  67.302 +              r <- Isabelle.gfx_range(text_area, range)
  67.303 +            } {
  67.304 +              gfx.setColor(color)
  67.305 +              gfx.fillRect(r.x + 2, y + i * line_height + 2, r.length - 4, line_height - 4)
  67.306 +            }
  67.307 +
  67.308 +            // sub-expression highlighting -- potentially from other snapshot
  67.309 +            highlight_range match {
  67.310 +              case Some((range, color)) if line_range.overlaps(range) =>
  67.311 +                Isabelle.gfx_range(text_area, line_range.restrict(range)) match {
  67.312 +                  case None =>
  67.313 +                  case Some(r) =>
  67.314 +                    gfx.setColor(color)
  67.315 +                    gfx.drawRect(r.x, y + i * line_height, r.length - 1, line_height - 1)
  67.316 +                }
  67.317 +              case _ =>
  67.318 +            }
  67.319 +
  67.320 +            // squiggly underline
  67.321 +            for {
  67.322 +              Text.Info(range, Some(color)) <-
  67.323 +                snapshot.select_markup(line_range)(Isabelle_Markup.message).iterator
  67.324 +              r <- Isabelle.gfx_range(text_area, range)
  67.325 +            } {
  67.326 +              gfx.setColor(color)
  67.327 +              val x0 = (r.x / 2) * 2
  67.328 +              val y0 = r.y + ascent + 1
  67.329 +              for (x1 <- Range(x0, x0 + r.length, 2)) {
  67.330 +                val y1 = if (x1 % 4 < 2) y0 else y0 + 1
  67.331 +                gfx.drawLine(x1, y1, x1 + 1, y1)
  67.332 +              }
  67.333 +            }
  67.334 +          }
  67.335 +        }
  67.336 +      }
  67.337 +    }
  67.338 +
  67.339 +    override def getToolTipText(x: Int, y: Int): String =
  67.340 +    {
  67.341 +      Isabelle.swing_buffer_lock(model.buffer) {
  67.342 +        val snapshot = model.snapshot()
  67.343 +        val offset = text_area.xyToOffset(x, y)
  67.344 +        if (control) {
  67.345 +          snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.tooltip) match
  67.346 +          {
  67.347 +            case Text.Info(_, Some(text)) #:: _ => Isabelle.tooltip(text)
  67.348 +            case _ => null
  67.349 +          }
  67.350 +        }
  67.351 +        else {
  67.352 +          // FIXME snapshot.cumulate
  67.353 +          snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.popup) match
  67.354 +          {
  67.355 +            case Text.Info(_, Some(text)) #:: _ => Isabelle.tooltip(text)
  67.356 +            case _ => null
  67.357 +          }
  67.358 +        }
  67.359 +      }
  67.360 +    }
  67.361 +  }
  67.362 +
  67.363 +  var use_text_painter = false
  67.364 +
  67.365 +  private val text_painter = new TextAreaExtension
  67.366 +  {
  67.367 +    override def paintScreenLineRange(gfx: Graphics2D,
  67.368 +      first_line: Int, last_line: Int, physical_lines: Array[Int],
  67.369 +      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
  67.370 +    {
  67.371 +      if (use_text_painter) {
  67.372 +        Isabelle.swing_buffer_lock(model.buffer) {
  67.373 +          val painter = text_area.getPainter
  67.374 +          val fm = painter.getFontMetrics
  67.375 +
  67.376 +          val all_chunks = line_chunks(Set[Int]() ++ physical_lines.iterator.filter(i => i != -1))
  67.377 +
  67.378 +          val x0 = text_area.getHorizontalOffset
  67.379 +          var y0 = y + fm.getHeight - (fm.getLeading + 1) - fm.getDescent
  67.380 +          for (i <- 0 until physical_lines.length) {
  67.381 +            if (physical_lines(i) != -1) {
  67.382 +              all_chunks.get(start(i)) match {
  67.383 +                case Some(chunk) =>
  67.384 +                  Chunk.paintChunkList(chunk, gfx, x0, y0, !Debug.DISABLE_GLYPH_VECTOR)
  67.385 +                case None =>
  67.386 +              }
  67.387 +            }
  67.388 +            y0 += line_height
  67.389 +          }
  67.390 +        }
  67.391 +      }
  67.392 +    }
  67.393 +  }
  67.394 +
  67.395 +  private val gutter_painter = new TextAreaExtension
  67.396 +  {
  67.397 +    override def paintScreenLineRange(gfx: Graphics2D,
  67.398 +      first_line: Int, last_line: Int, physical_lines: Array[Int],
  67.399 +      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
  67.400 +    {
  67.401 +      val gutter = text_area.getGutter
  67.402 +      val width = GutterOptionPane.getSelectionAreaWidth
  67.403 +      val border_width = jEdit.getIntegerProperty("view.gutter.borderWidth", 3)
  67.404 +      val FOLD_MARKER_SIZE = 12
  67.405 +
  67.406 +      if (gutter.isSelectionAreaEnabled && !gutter.isExpanded && width >= 12 && line_height >= 12) {
  67.407 +        Isabelle.swing_buffer_lock(model.buffer) {
  67.408 +          val snapshot = model.snapshot()
  67.409 +          for (i <- 0 until physical_lines.length) {
  67.410 +            if (physical_lines(i) != -1) {
  67.411 +              val line_range = proper_line_range(start(i), end(i))
  67.412 +
  67.413 +              // gutter icons
  67.414 +              val icons =
  67.415 +                (for (Text.Info(_, Some(icon)) <- // FIXME snapshot.cumulate
  67.416 +                  snapshot.select_markup(line_range)(Isabelle_Markup.gutter_message).iterator)
  67.417 +                yield icon).toList.sortWith(_ >= _)
  67.418 +              icons match {
  67.419 +                case icon :: _ =>
  67.420 +                  val icn = icon.icon
  67.421 +                  val x0 = (FOLD_MARKER_SIZE + width - border_width - icn.getIconWidth) max 10
  67.422 +                  val y0 = y + i * line_height + (((line_height - icn.getIconHeight) / 2) max 0)
  67.423 +                  icn.paintIcon(gutter, gfx, x0, y0)
  67.424 +                case Nil =>
  67.425 +              }
  67.426 +            }
  67.427 +          }
  67.428 +        }
  67.429 +      }
  67.430 +    }
  67.431 +  }
  67.432 +
  67.433 +
  67.434 +  /* caret handling */
  67.435 +
  67.436 +  def selected_command(): Option[Command] =
  67.437 +  {
  67.438 +    Swing_Thread.require()
  67.439 +    model.snapshot().node.proper_command_at(text_area.getCaretPosition)
  67.440 +  }
  67.441 +
  67.442 +  private val caret_listener = new CaretListener {
  67.443 +    private val delay = Swing_Thread.delay_last(session.input_delay) {
  67.444 +      session.perspective.event(Session.Perspective)
  67.445 +    }
  67.446 +    override def caretUpdate(e: CaretEvent) { delay() }
  67.447 +  }
  67.448 +
  67.449 +
  67.450 +  /* overview of command status left of scrollbar */
  67.451 +
  67.452 +  private val overview = new JPanel(new BorderLayout)
  67.453 +  {
  67.454 +    private val WIDTH = 10
  67.455 +    private val HEIGHT = 2
  67.456 +
  67.457 +    setPreferredSize(new Dimension(WIDTH, 0))
  67.458 +
  67.459 +    setRequestFocusEnabled(false)
  67.460 +
  67.461 +    addMouseListener(new MouseAdapter {
  67.462 +      override def mousePressed(event: MouseEvent) {
  67.463 +        val line = y_to_line(event.getY)
  67.464 +        if (line >= 0 && line < text_area.getLineCount)
  67.465 +          text_area.setCaretPosition(text_area.getLineStartOffset(line))
  67.466 +      }
  67.467 +    })
  67.468 +
  67.469 +    override def addNotify() {
  67.470 +      super.addNotify()
  67.471 +      ToolTipManager.sharedInstance.registerComponent(this)
  67.472 +    }
  67.473 +
  67.474 +    override def removeNotify() {
  67.475 +      ToolTipManager.sharedInstance.unregisterComponent(this)
  67.476 +      super.removeNotify
  67.477 +    }
  67.478 +
  67.479 +    override def paintComponent(gfx: Graphics)
  67.480 +    {
  67.481 +      super.paintComponent(gfx)
  67.482 +      Swing_Thread.assert()
  67.483 +
  67.484 +      val buffer = model.buffer
  67.485 +      Isabelle.buffer_lock(buffer) {
  67.486 +        val snapshot = model.snapshot()
  67.487 +
  67.488 +        def line_range(command: Command, start: Text.Offset): Option[(Int, Int)] =
  67.489 +        {
  67.490 +          try {
  67.491 +            val line1 = buffer.getLineOfOffset(snapshot.convert(start))
  67.492 +            val line2 = buffer.getLineOfOffset(snapshot.convert(start + command.length)) + 1
  67.493 +            Some((line1, line2))
  67.494 +          }
  67.495 +          catch { case e: ArrayIndexOutOfBoundsException => None }
  67.496 +        }
  67.497 +        for {
  67.498 +          (command, start) <- snapshot.node.command_starts
  67.499 +          if !command.is_ignored
  67.500 +          (line1, line2) <- line_range(command, start)
  67.501 +          val y = line_to_y(line1)
  67.502 +          val height = HEIGHT * (line2 - line1)
  67.503 +          color <- Isabelle_Markup.overview_color(snapshot, command)
  67.504 +        } {
  67.505 +          gfx.setColor(color)
  67.506 +          gfx.fillRect(0, y, getWidth - 1, height)
  67.507 +        }
  67.508 +      }
  67.509 +    }
  67.510 +
  67.511 +    private def line_to_y(line: Int): Int =
  67.512 +      (line * getHeight) / (text_area.getBuffer.getLineCount max text_area.getVisibleLines)
  67.513 +
  67.514 +    private def y_to_line(y: Int): Int =
  67.515 +      (y * (text_area.getBuffer.getLineCount max text_area.getVisibleLines)) / getHeight
  67.516 +  }
  67.517 +
  67.518 +
  67.519 +  /* main actor */
  67.520 +
  67.521 +  private val main_actor = actor {
  67.522 +    loop {
  67.523 +      react {
  67.524 +        case Session.Commands_Changed(changed) =>
  67.525 +          val buffer = model.buffer
  67.526 +          Isabelle.swing_buffer_lock(buffer) {
  67.527 +            val snapshot = model.snapshot()
  67.528 +
  67.529 +            if (changed.exists(snapshot.node.commands.contains))
  67.530 +              overview.repaint()
  67.531 +
  67.532 +            val visible_range = screen_lines_range()
  67.533 +            val visible_cmds = snapshot.node.command_range(snapshot.revert(visible_range)).map(_._1)
  67.534 +            if (visible_cmds.exists(changed)) {
  67.535 +              for {
  67.536 +                line <- 0 until text_area.getVisibleLines
  67.537 +                val start = text_area.getScreenLineStartOffset(line) if start >= 0
  67.538 +                val end = text_area.getScreenLineEndOffset(line) if end >= 0
  67.539 +                val range = proper_line_range(start, end)
  67.540 +                val line_cmds = snapshot.node.command_range(snapshot.revert(range)).map(_._1)
  67.541 +                if line_cmds.exists(changed)
  67.542 +              } text_area.invalidateScreenLineRange(line, line)
  67.543 +
  67.544 +              // FIXME danger of deadlock!?
  67.545 +              // FIXME potentially slow!?
  67.546 +              model.buffer.propertiesChanged()
  67.547 +            }
  67.548 +          }
  67.549 +
  67.550 +        case Session.Global_Settings => html_panel_resize()
  67.551 +
  67.552 +        case bad => System.err.println("command_change_actor: ignoring bad message " + bad)
  67.553 +      }
  67.554 +    }
  67.555 +  }
  67.556 +
  67.557 +
  67.558 +  /* activation */
  67.559 +
  67.560 +  private def activate()
  67.561 +  {
  67.562 +    val painter = text_area.getPainter
  67.563 +    painter.addExtension(TextAreaPainter.LINE_BACKGROUND_LAYER + 1, background_painter)
  67.564 +    painter.addExtension(TextAreaPainter.TEXT_LAYER + 1, text_painter)
  67.565 +    text_area.getGutter.addExtension(gutter_painter)
  67.566 +    text_area.addFocusListener(focus_listener)
  67.567 +    text_area.getView.addWindowListener(window_listener)
  67.568 +    painter.addMouseMotionListener(mouse_motion_listener)
  67.569 +    text_area.addCaretListener(caret_listener)
  67.570 +    text_area.addLeftOfScrollBar(overview)
  67.571 +    session.commands_changed += main_actor
  67.572 +    session.global_settings += main_actor
  67.573 +  }
  67.574 +
  67.575 +  private def deactivate()
  67.576 +  {
  67.577 +    val painter = text_area.getPainter
  67.578 +    session.commands_changed -= main_actor
  67.579 +    session.global_settings -= main_actor
  67.580 +    text_area.removeFocusListener(focus_listener)
  67.581 +    text_area.getView.removeWindowListener(window_listener)
  67.582 +    painter.removeMouseMotionListener(mouse_motion_listener)
  67.583 +    text_area.removeCaretListener(caret_listener)
  67.584 +    text_area.removeLeftOfScrollBar(overview)
  67.585 +    text_area.getGutter.removeExtension(gutter_painter)
  67.586 +    painter.removeExtension(text_painter)
  67.587 +    painter.removeExtension(background_painter)
  67.588 +    exit_popup()
  67.589 +  }
  67.590 +}
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/src/Tools/jEdit/src/html_panel.scala	Wed Jun 08 22:13:49 2011 +0200
    68.3 @@ -0,0 +1,206 @@
    68.4 +/*  Title:      Tools/jEdit/src/html_panel.scala
    68.5 +    Author:     Makarius
    68.6 +
    68.7 +HTML panel based on Lobo/Cobra.
    68.8 +*/
    68.9 +
   68.10 +package isabelle.jedit
   68.11 +
   68.12 +
   68.13 +import isabelle._
   68.14 +
   68.15 +import java.io.StringReader
   68.16 +import java.awt.{Font, BorderLayout, Dimension, GraphicsEnvironment, Toolkit, FontMetrics}
   68.17 +import java.awt.event.MouseEvent
   68.18 +
   68.19 +import java.util.logging.{Logger, Level}
   68.20 +
   68.21 +import org.w3c.dom.html2.HTMLElement
   68.22 +
   68.23 +import org.lobobrowser.html.parser.{DocumentBuilderImpl, InputSourceImpl}
   68.24 +import org.lobobrowser.html.gui.HtmlPanel
   68.25 +import org.lobobrowser.html.domimpl.{HTMLDocumentImpl, HTMLStyleElementImpl, NodeImpl}
   68.26 +import org.lobobrowser.html.test.{SimpleHtmlRendererContext, SimpleUserAgentContext}
   68.27 +
   68.28 +import scala.actors.Actor._
   68.29 +
   68.30 +
   68.31 +object HTML_Panel
   68.32 +{
   68.33 +  sealed abstract class Event { val element: HTMLElement; val mouse: MouseEvent }
   68.34 +  case class Context_Menu(val element: HTMLElement, mouse: MouseEvent) extends Event
   68.35 +  case class Mouse_Click(val element: HTMLElement, mouse: MouseEvent) extends Event
   68.36 +  case class Double_Click(val element: HTMLElement, mouse: MouseEvent) extends Event
   68.37 +  case class Mouse_Over(val element: HTMLElement, mouse: MouseEvent) extends Event
   68.38 +  case class Mouse_Out(val element: HTMLElement, mouse: MouseEvent) extends Event
   68.39 +}
   68.40 +
   68.41 +
   68.42 +class HTML_Panel(
   68.43 +    system: Isabelle_System,
   68.44 +    initial_font_family: String,
   68.45 +    initial_font_size: Int)
   68.46 +  extends HtmlPanel
   68.47 +{
   68.48 +  /** Lobo setup **/
   68.49 +
   68.50 +  /* global logging */
   68.51 +
   68.52 +  Logger.getLogger("org.lobobrowser").setLevel(Level.WARNING)
   68.53 +
   68.54 +
   68.55 +  /* pixel size -- cf. org.lobobrowser.html.style.HtmlValues.getFontSize */
   68.56 +
   68.57 +  val screen_resolution =
   68.58 +    if (GraphicsEnvironment.isHeadless()) 72
   68.59 +    else Toolkit.getDefaultToolkit().getScreenResolution()
   68.60 +
   68.61 +  def lobo_px(raw_px: Int): Int = raw_px * 96 / screen_resolution
   68.62 +  def raw_px(lobo_px: Int): Int = (lobo_px * screen_resolution + 95) / 96
   68.63 +
   68.64 +
   68.65 +  /* contexts and event handling */
   68.66 +
   68.67 +  protected val handler: PartialFunction[HTML_Panel.Event, Unit] = Library.undefined
   68.68 +
   68.69 +  private val ucontext = new SimpleUserAgentContext
   68.70 +  private val rcontext = new SimpleHtmlRendererContext(this, ucontext)
   68.71 +  {
   68.72 +    private def handle(event: HTML_Panel.Event): Boolean =
   68.73 +      if (handler.isDefinedAt(event)) { handler(event); false }
   68.74 +      else true
   68.75 +
   68.76 +    override def onContextMenu(elem: HTMLElement, event: MouseEvent): Boolean =
   68.77 +      handle(HTML_Panel.Context_Menu(elem, event))
   68.78 +    override def onMouseClick(elem: HTMLElement, event: MouseEvent): Boolean =
   68.79 +      handle(HTML_Panel.Mouse_Click(elem, event))
   68.80 +    override def onDoubleClick(elem: HTMLElement, event: MouseEvent): Boolean =
   68.81 +      handle(HTML_Panel.Double_Click(elem, event))
   68.82 +    override def onMouseOver(elem: HTMLElement, event: MouseEvent)
   68.83 +      { handle(HTML_Panel.Mouse_Over(elem, event)) }
   68.84 +    override def onMouseOut(elem: HTMLElement, event: MouseEvent)
   68.85 +      { handle(HTML_Panel.Mouse_Out(elem, event)) }
   68.86 +  }
   68.87 +
   68.88 +  private val builder = new DocumentBuilderImpl(ucontext, rcontext)
   68.89 +
   68.90 +
   68.91 +  /* document template with style sheets */
   68.92 +
   68.93 +  private val template_head =
   68.94 +    """<?xml version="1.0" encoding="utf-8"?>
   68.95 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   68.96 +  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   68.97 +<html xmlns="http://www.w3.org/1999/xhtml">
   68.98 +<head>
   68.99 +<style media="all" type="text/css">
  68.100 +""" +
  68.101 +  system.try_read(system.getenv_strict("JEDIT_STYLE_SHEETS").split(":"))
  68.102 +
  68.103 +  private val template_tail =
  68.104 +"""
  68.105 +</style>
  68.106 +</head>
  68.107 +<body/>
  68.108 +</html>
  68.109 +"""
  68.110 +
  68.111 +  private def template(font_family: String, font_size: Int): String =
  68.112 +    template_head +
  68.113 +    "body { font-family: " + font_family + "; font-size: " + raw_px(font_size) + "px; }" +
  68.114 +    template_tail
  68.115 +
  68.116 +
  68.117 +  /** main actor **/
  68.118 +
  68.119 +  /* internal messages */
  68.120 +
  68.121 +  private case class Resize(font_family: String, font_size: Int)
  68.122 +  private case class Render_Document(text: String)
  68.123 +  private case class Render(body: XML.Body)
  68.124 +  private case class Render_Sync(body: XML.Body)
  68.125 +  private case object Refresh
  68.126 +
  68.127 +  private val main_actor = actor {
  68.128 +
  68.129 +    /* internal state */
  68.130 +
  68.131 +    var current_font_metrics: FontMetrics = null
  68.132 +    var current_font_family = ""
  68.133 +    var current_font_size: Int = 0
  68.134 +    var current_margin: Int = 0
  68.135 +    var current_body: XML.Body = Nil
  68.136 +
  68.137 +    def resize(font_family: String, font_size: Int)
  68.138 +    {
  68.139 +      val font = new Font(font_family, Font.PLAIN, lobo_px(raw_px(font_size)))
  68.140 +      val (font_metrics, margin) =
  68.141 +        Swing_Thread.now {
  68.142 +          val metrics = getFontMetrics(font)
  68.143 +          (metrics, (getWidth() / (metrics.charWidth(Symbol.spc) max 1) - 4) max 20)
  68.144 +        }
  68.145 +      if (current_font_metrics == null ||
  68.146 +          current_font_family != font_family ||
  68.147 +          current_font_size != font_size ||
  68.148 +          current_margin != margin)
  68.149 +      {
  68.150 +        current_font_metrics = font_metrics
  68.151 +        current_font_family = font_family
  68.152 +        current_font_size = font_size
  68.153 +        current_margin = margin
  68.154 +        refresh()
  68.155 +      }
  68.156 +    }
  68.157 +
  68.158 +    def refresh() { render(current_body) }
  68.159 +
  68.160 +    def render_document(text: String)
  68.161 +    {
  68.162 +      val doc = builder.parse(new InputSourceImpl(new StringReader(text), "http://localhost"))
  68.163 +      Swing_Thread.later { setDocument(doc, rcontext) }
  68.164 +    }
  68.165 +
  68.166 +    def render(body: XML.Body)
  68.167 +    {
  68.168 +      current_body = body
  68.169 +      val html_body =
  68.170 +        current_body.flatMap(div =>
  68.171 +          Pretty.formatted(List(div), current_margin, Pretty.font_metric(current_font_metrics))
  68.172 +            .map(t =>
  68.173 +              XML.Elem(Markup(HTML.PRE, List((Markup.CLASS, Markup.MESSAGE))),
  68.174 +                HTML.spans(t, true))))
  68.175 +      val doc =
  68.176 +        builder.parse(
  68.177 +          new InputSourceImpl(
  68.178 +            new StringReader(template(current_font_family, current_font_size)), "http://localhost"))
  68.179 +      doc.removeChild(doc.getLastChild())
  68.180 +      doc.appendChild(XML.document_node(doc, XML.elem(HTML.BODY, html_body)))
  68.181 +      Swing_Thread.later { setDocument(doc, rcontext) }
  68.182 +    }
  68.183 +
  68.184 +
  68.185 +    /* main loop */
  68.186 +
  68.187 +    resize(initial_font_family, initial_font_size)
  68.188 +
  68.189 +    loop {
  68.190 +      react {
  68.191 +        case Resize(font_family, font_size) => resize(font_family, font_size)
  68.192 +        case Refresh => refresh()
  68.193 +        case Render_Document(text) => render_document(text)
  68.194 +        case Render(body) => render(body)
  68.195 +        case Render_Sync(body) => render(body); reply(())
  68.196 +        case bad => System.err.println("main_actor: ignoring bad message " + bad)
  68.197 +      }
  68.198 +    }
  68.199 +  }
  68.200 +
  68.201 +
  68.202 +  /* external methods */
  68.203 +
  68.204 +  def resize(font_family: String, font_size: Int) { main_actor ! Resize(font_family, font_size) }
  68.205 +  def refresh() { main_actor ! Refresh }
  68.206 +  def render_document(text: String) { main_actor ! Render_Document(text) }
  68.207 +  def render(body: XML.Body) { main_actor ! Render(body) }
  68.208 +  def render_sync(body: XML.Body) { main_actor !? Render_Sync(body) }
  68.209 +}
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/src/Tools/jEdit/src/isabelle_encoding.scala	Wed Jun 08 22:13:49 2011 +0200
    69.3 @@ -0,0 +1,65 @@
    69.4 +/*  Title:      Tools/jEdit/src/isabelle_encoding.scala
    69.5 +    Author:     Makarius
    69.6 +
    69.7 +Isabelle encoding -- based on UTF-8.
    69.8 +*/
    69.9 +
   69.10 +package isabelle.jedit
   69.11 +
   69.12 +
   69.13 +import isabelle._
   69.14 +
   69.15 +import org.gjt.sp.jedit.io.Encoding
   69.16 +import org.gjt.sp.jedit.buffer.JEditBuffer
   69.17 +
   69.18 +import java.nio.charset.{Charset, CodingErrorAction}
   69.19 +import java.io.{InputStream, OutputStream, Reader, Writer, InputStreamReader, OutputStreamWriter,
   69.20 +  CharArrayReader, ByteArrayOutputStream}
   69.21 +
   69.22 +import scala.io.{Codec, Source, BufferedSource}
   69.23 +
   69.24 +
   69.25 +object Isabelle_Encoding
   69.26 +{
   69.27 +  val NAME = "UTF-8-Isabelle"
   69.28 +
   69.29 +  def is_active(buffer: JEditBuffer): Boolean =
   69.30 +    buffer.getStringProperty(JEditBuffer.ENCODING).asInstanceOf[String] == NAME
   69.31 +}
   69.32 +
   69.33 +class Isabelle_Encoding extends Encoding
   69.34 +{
   69.35 +  private val charset = Charset.forName(Standard_System.charset)
   69.36 +  val BUFSIZE = 32768
   69.37 +
   69.38 +  private def text_reader(in: InputStream, codec: Codec): Reader =
   69.39 +  {
   69.40 +    val source = new BufferedSource(in)(codec)
   69.41 +    new CharArrayReader(Isabelle.system.symbols.decode(source.mkString).toArray)
   69.42 +  }
   69.43 +
   69.44 +  override def getTextReader(in: InputStream): Reader =
   69.45 +    text_reader(in, Standard_System.codec())
   69.46 +
   69.47 +  override def getPermissiveTextReader(in: InputStream): Reader =
   69.48 +  {
   69.49 +    val codec = Standard_System.codec()
   69.50 +    codec.onMalformedInput(CodingErrorAction.REPLACE)
   69.51 +    codec.onUnmappableCharacter(CodingErrorAction.REPLACE)
   69.52 +    text_reader(in, codec)
   69.53 +  }
   69.54 +
   69.55 +  override def getTextWriter(out: OutputStream): Writer =
   69.56 +  {
   69.57 +    val buffer = new ByteArrayOutputStream(BUFSIZE) {
   69.58 +      override def flush()
   69.59 +      {
   69.60 +        val text = Isabelle.system.symbols.encode(toString(Standard_System.charset))
   69.61 +        out.write(text.getBytes(Standard_System.charset))
   69.62 +        out.flush()
   69.63 +      }
   69.64 +      override def close() { out.close() }
   69.65 +    }
   69.66 +    new OutputStreamWriter(buffer, charset.newEncoder())
   69.67 +  }
   69.68 +}
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/src/Tools/jEdit/src/isabelle_hyperlinks.scala	Wed Jun 08 22:13:49 2011 +0200
    70.3 @@ -0,0 +1,88 @@
    70.4 +/*  Title:      Tools/jEdit/src/isabelle_hyperlinks.scala
    70.5 +    Author:     Fabian Immler, TU Munich
    70.6 +
    70.7 +Hyperlink setup for Isabelle proof documents.
    70.8 +*/
    70.9 +
   70.10 +package isabelle.jedit
   70.11 +
   70.12 +
   70.13 +import isabelle._
   70.14 +
   70.15 +import java.io.File
   70.16 +
   70.17 +import gatchan.jedit.hyperlinks.{Hyperlink, HyperlinkSource, AbstractHyperlink}
   70.18 +
   70.19 +import org.gjt.sp.jedit.{View, jEdit, Buffer, TextUtilities}
   70.20 +
   70.21 +
   70.22 +private class Internal_Hyperlink(start: Int, end: Int, line: Int, def_offset: Int)
   70.23 +  extends AbstractHyperlink(start, end, line, "")
   70.24 +{
   70.25 +  override def click(view: View) {
   70.26 +    view.getTextArea.moveCaretPosition(def_offset)
   70.27 +  }
   70.28 +}
   70.29 +
   70.30 +class External_Hyperlink(start: Int, end: Int, line: Int, def_file: String, def_line: Int)
   70.31 +  extends AbstractHyperlink(start, end, line, "")
   70.32 +{
   70.33 +  override def click(view: View) = {
   70.34 +    Isabelle.system.source_file(def_file) match {
   70.35 +      case None =>
   70.36 +        Library.error_dialog(view, "File not found", "Could not find source file " + def_file)
   70.37 +      case Some(file) =>
   70.38 +        jEdit.openFiles(view, file.getParent, Array(file.getName, "+line:" + def_line))
   70.39 +    }
   70.40 +  }
   70.41 +}
   70.42 +
   70.43 +class Isabelle_Hyperlinks extends HyperlinkSource
   70.44 +{
   70.45 +  def getHyperlink(buffer: Buffer, buffer_offset: Int): Hyperlink =
   70.46 +  {
   70.47 +    Swing_Thread.assert()
   70.48 +    Isabelle.buffer_lock(buffer) {
   70.49 +      Document_Model(buffer) match {
   70.50 +        case Some(model) =>
   70.51 +          val snapshot = model.snapshot()
   70.52 +          val markup =
   70.53 +            snapshot.select_markup(Text.Range(buffer_offset, buffer_offset + 1)) {
   70.54 +              // FIXME Isar_Document.Hyperlink extractor
   70.55 +              case Text.Info(info_range,
   70.56 +                  XML.Elem(Markup(Markup.ENTITY, props), _))
   70.57 +                if (props.find(
   70.58 +                  { case (Markup.KIND, Markup.ML_OPEN) => true
   70.59 +                    case (Markup.KIND, Markup.ML_STRUCT) => true
   70.60 +                    case _ => false }).isEmpty) =>
   70.61 +                val Text.Range(begin, end) = info_range
   70.62 +                val line = buffer.getLineOfOffset(begin)
   70.63 +                (Position.File.unapply(props), Position.Line.unapply(props)) match {
   70.64 +                  case (Some(def_file), Some(def_line)) =>
   70.65 +                    new External_Hyperlink(begin, end, line, def_file, def_line)
   70.66 +                  case _ =>
   70.67 +                    (props, props) match {
   70.68 +                      case (Position.Id(def_id), Position.Offset(def_offset)) =>
   70.69 +                        snapshot.lookup_command(def_id) match {
   70.70 +                          case Some(def_cmd) =>
   70.71 +                            snapshot.node.command_start(def_cmd) match {
   70.72 +                              case Some(def_cmd_start) =>
   70.73 +                                new Internal_Hyperlink(begin, end, line,
   70.74 +                                  snapshot.convert(def_cmd_start + def_cmd.decode(def_offset)))
   70.75 +                              case None => null
   70.76 +                            }
   70.77 +                          case None => null
   70.78 +                        }
   70.79 +                      case _ => null
   70.80 +                    }
   70.81 +                }
   70.82 +            }
   70.83 +          markup match {
   70.84 +            case Text.Info(_, Some(link)) #:: _ => link
   70.85 +            case _ => null
   70.86 +          }
   70.87 +        case None => null
   70.88 +      }
   70.89 +    }
   70.90 +  }
   70.91 +}
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/src/Tools/jEdit/src/isabelle_markup.scala	Wed Jun 08 22:13:49 2011 +0200
    71.3 @@ -0,0 +1,216 @@
    71.4 +/*  Title:      Tools/jEdit/src/isabelle_markup.scala
    71.5 +    Author:     Makarius
    71.6 +
    71.7 +Isabelle specific physical rendering and markup selection.
    71.8 +*/
    71.9 +
   71.10 +package isabelle.jedit
   71.11 +
   71.12 +
   71.13 +import isabelle._
   71.14 +
   71.15 +import java.awt.Color
   71.16 +
   71.17 +import org.gjt.sp.jedit.syntax.Token
   71.18 +
   71.19 +
   71.20 +object Isabelle_Markup
   71.21 +{
   71.22 +  /* physical rendering */
   71.23 +
   71.24 +  val outdated_color = new Color(240, 240, 240)
   71.25 +  val unfinished_color = new Color(255, 228, 225)
   71.26 +
   71.27 +  val light_color = new Color(240, 240, 240)
   71.28 +  val regular_color = new Color(192, 192, 192)
   71.29 +  val warning_color = new Color(255, 140, 0)
   71.30 +  val error_color = new Color(178, 34, 34)
   71.31 +  val bad_color = new Color(255, 106, 106, 100)
   71.32 +  val hilite_color = new Color(255, 204, 102, 100)
   71.33 +
   71.34 +  class Icon(val priority: Int, val icon: javax.swing.Icon)
   71.35 +  {
   71.36 +    def >= (that: Icon): Boolean = this.priority >= that.priority
   71.37 +  }
   71.38 +  val warning_icon = new Icon(1, Isabelle.load_icon("16x16/status/dialog-warning.png"))
   71.39 +  val error_icon = new Icon(2, Isabelle.load_icon("16x16/status/dialog-error.png"))
   71.40 +
   71.41 +
   71.42 +  /* command status */
   71.43 +
   71.44 +  def status_color(snapshot: Document.Snapshot, command: Command): Option[Color] =
   71.45 +  {
   71.46 +    val state = snapshot.state(command)
   71.47 +    if (snapshot.is_outdated) Some(outdated_color)
   71.48 +    else
   71.49 +      Isar_Document.command_status(state.status) match {
   71.50 +        case Isar_Document.Forked(i) if i > 0 => Some(unfinished_color)
   71.51 +        case Isar_Document.Unprocessed => Some(unfinished_color)
   71.52 +        case _ => None
   71.53 +      }
   71.54 +  }
   71.55 +
   71.56 +  def overview_color(snapshot: Document.Snapshot, command: Command): Option[Color] =
   71.57 +  {
   71.58 +    val state = snapshot.state(command)
   71.59 +    if (snapshot.is_outdated) None
   71.60 +    else
   71.61 +      Isar_Document.command_status(state.status) match {
   71.62 +        case Isar_Document.Forked(i) => if (i > 0) Some(unfinished_color) else None
   71.63 +        case Isar_Document.Unprocessed => Some(unfinished_color)
   71.64 +        case Isar_Document.Failed => Some(error_color)
   71.65 +        case Isar_Document.Finished =>
   71.66 +          if (state.results.exists(r => Isar_Document.is_error(r._2))) Some(error_color)
   71.67 +          else if (state.results.exists(r => Isar_Document.is_warning(r._2))) Some(warning_color)
   71.68 +          else None
   71.69 +      }
   71.70 +  }
   71.71 +
   71.72 +
   71.73 +  /* markup selectors */
   71.74 +
   71.75 +  val message: Markup_Tree.Select[Color] =
   71.76 +  {
   71.77 +    case Text.Info(_, XML.Elem(Markup(Markup.WRITELN, _), _)) => regular_color
   71.78 +    case Text.Info(_, XML.Elem(Markup(Markup.WARNING, _), _)) => warning_color
   71.79 +    case Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _)) => error_color
   71.80 +  }
   71.81 +
   71.82 +  val popup: Markup_Tree.Select[String] =
   71.83 +  {
   71.84 +    case Text.Info(_, msg @ XML.Elem(Markup(markup, _), _))
   71.85 +    if markup == Markup.WRITELN || markup == Markup.WARNING || markup == Markup.ERROR =>
   71.86 +      Pretty.string_of(List(msg), margin = Isabelle.Int_Property("tooltip-margin"))
   71.87 +  }
   71.88 +
   71.89 +  val gutter_message: Markup_Tree.Select[Icon] =
   71.90 +  {
   71.91 +    case Text.Info(_, XML.Elem(Markup(Markup.WARNING, _), _)) => warning_icon
   71.92 +    case Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _)) => error_icon
   71.93 +  }
   71.94 +
   71.95 +  val background1: Markup_Tree.Select[Color] =
   71.96 +  {
   71.97 +    case Text.Info(_, XML.Elem(Markup(Markup.BAD, _), _)) => bad_color
   71.98 +    case Text.Info(_, XML.Elem(Markup(Markup.HILITE, _), _)) => hilite_color
   71.99 +  }
  71.100 +
  71.101 +  val background2: Markup_Tree.Select[Color] =
  71.102 +  {
  71.103 +    case Text.Info(_, XML.Elem(Markup(Markup.TOKEN_RANGE, _), _)) => light_color
  71.104 +  }
  71.105 +
  71.106 +  val tooltip: Markup_Tree.Select[String] =
  71.107 +  {
  71.108 +    case Text.Info(_, XML.Elem(Markup.Entity(kind, name), _)) => kind + " \"" + name + "\""
  71.109 +    case Text.Info(_, XML.Elem(Markup(Markup.ML_TYPING, _), body)) =>
  71.110 +      Pretty.string_of(List(Pretty.block(XML.Text("ML:") :: Pretty.Break(1) :: body)),
  71.111 +        margin = Isabelle.Int_Property("tooltip-margin"))
  71.112 +    case Text.Info(_, XML.Elem(Markup(Markup.SORT, _), _)) => "sort"
  71.113 +    case Text.Info(_, XML.Elem(Markup(Markup.TYP, _), _)) => "type"
  71.114 +    case Text.Info(_, XML.Elem(Markup(Markup.TERM, _), _)) => "term"
  71.115 +    case Text.Info(_, XML.Elem(Markup(Markup.PROP, _), _)) => "proposition"
  71.116 +    case Text.Info(_, XML.Elem(Markup(Markup.TOKEN_RANGE, _), _)) => "inner syntax token"
  71.117 +    case Text.Info(_, XML.Elem(Markup(Markup.FREE, _), _)) => "free variable (globally fixed)"
  71.118 +    case Text.Info(_, XML.Elem(Markup(Markup.SKOLEM, _), _)) => "skolem variable (locally fixed)"
  71.119 +    case Text.Info(_, XML.Elem(Markup(Markup.BOUND, _), _)) => "bound variable (internally fixed)"
  71.120 +    case Text.Info(_, XML.Elem(Markup(Markup.VAR, _), _)) => "schematic variable"
  71.121 +    case Text.Info(_, XML.Elem(Markup(Markup.TFREE, _), _)) => "free type variable"
  71.122 +    case Text.Info(_, XML.Elem(Markup(Markup.TVAR, _), _)) => "schematic type variable"
  71.123 +  }
  71.124 +
  71.125 +  private val subexp_include =
  71.126 +    Set(Markup.SORT, Markup.TYP, Markup.TERM, Markup.PROP, Markup.ML_TYPING, Markup.TOKEN_RANGE,
  71.127 +      Markup.ENTITY, Markup.FREE, Markup.SKOLEM, Markup.BOUND, Markup.VAR,
  71.128 +      Markup.TFREE, Markup.TVAR)
  71.129 +
  71.130 +  val subexp: Markup_Tree.Select[(Text.Range, Color)] =
  71.131 +  {
  71.132 +    case Text.Info(range, XML.Elem(Markup(name, _), _)) if subexp_include(name) =>
  71.133 +      (range, Color.black)
  71.134 +  }
  71.135 +
  71.136 +
  71.137 +  /* token markup -- text styles */
  71.138 +
  71.139 +  private val command_style: Map[String, Byte] =
  71.140 +  {
  71.141 +    import Token._
  71.142 +    Map[String, Byte](
  71.143 +      Keyword.THY_END -> KEYWORD2,
  71.144 +      Keyword.THY_SCRIPT -> LABEL,
  71.145 +      Keyword.PRF_SCRIPT -> LABEL,
  71.146 +      Keyword.PRF_ASM -> KEYWORD3,
  71.147 +      Keyword.PRF_ASM_GOAL -> KEYWORD3
  71.148 +    ).withDefaultValue(KEYWORD1)
  71.149 +  }
  71.150 +
  71.151 +  private val token_style: Map[String, Byte] =
  71.152 +  {
  71.153 +    import Token._
  71.154 +    Map[String, Byte](
  71.155 +      // logical entities
  71.156 +      Markup.TCLASS -> NULL,
  71.157 +      Markup.TYCON -> NULL,
  71.158 +      Markup.FIXED -> NULL,
  71.159 +      Markup.CONST -> LITERAL2,
  71.160 +      Markup.DYNAMIC_FACT -> LABEL,
  71.161 +      // inner syntax
  71.162 +      Markup.TFREE -> NULL,
  71.163 +      Markup.FREE -> MARKUP,
  71.164 +      Markup.TVAR -> NULL,
  71.165 +      Markup.SKOLEM -> COMMENT2,
  71.166 +      Markup.BOUND -> LABEL,
  71.167 +      Markup.VAR -> NULL,
  71.168 +      Markup.NUM -> DIGIT,
  71.169 +      Markup.FLOAT -> DIGIT,
  71.170 +      Markup.XNUM -> DIGIT,
  71.171 +      Markup.XSTR -> LITERAL4,
  71.172 +      Markup.LITERAL -> OPERATOR,
  71.173 +      Markup.INNER_COMMENT -> COMMENT1,
  71.174 +      Markup.SORT -> NULL,
  71.175 +      Markup.TYP -> NULL,
  71.176 +      Markup.TERM -> NULL,
  71.177 +      Markup.PROP -> NULL,
  71.178 +      // ML syntax
  71.179 +      Markup.ML_KEYWORD -> KEYWORD1,
  71.180 +      Markup.ML_DELIMITER -> OPERATOR,
  71.181 +      Markup.ML_IDENT -> NULL,
  71.182 +      Markup.ML_TVAR -> NULL,
  71.183 +      Markup.ML_NUMERAL -> DIGIT,
  71.184 +      Markup.ML_CHAR -> LITERAL1,
  71.185 +      Markup.ML_STRING -> LITERAL1,
  71.186 +      Markup.ML_COMMENT -> COMMENT1,
  71.187 +      Markup.ML_MALFORMED -> INVALID,
  71.188 +      // embedded source text
  71.189 +      Markup.ML_SOURCE -> COMMENT3,
  71.190 +      Markup.DOC_SOURCE -> COMMENT3,
  71.191 +      Markup.ANTIQ -> COMMENT4,
  71.192 +      Markup.ML_ANTIQ -> COMMENT4,
  71.193 +      Markup.DOC_ANTIQ -> COMMENT4,
  71.194 +      // outer syntax
  71.195 +      Markup.KEYWORD -> KEYWORD2,
  71.196 +      Markup.OPERATOR -> OPERATOR,
  71.197 +      Markup.COMMAND -> KEYWORD1,
  71.198 +      Markup.IDENT -> NULL,
  71.199 +      Markup.VERBATIM -> COMMENT3,
  71.200 +      Markup.COMMENT -> COMMENT1,
  71.201 +      Markup.CONTROL -> COMMENT3,
  71.202 +      Markup.MALFORMED -> INVALID,
  71.203 +      Markup.STRING -> LITERAL3,
  71.204 +      Markup.ALTSTRING -> LITERAL1
  71.205 +    ).withDefaultValue(NULL)
  71.206 +  }
  71.207 +
  71.208 +  def tokens(syntax: Outer_Syntax): Markup_Tree.Select[Byte] =
  71.209 +  {
  71.210 +    case Text.Info(_, XML.Elem(Markup(Markup.COMMAND, List((Markup.NAME, name))), _))
  71.211 +    if syntax.keyword_kind(name).isDefined => command_style(syntax.keyword_kind(name).get)
  71.212 +
  71.213 +    case Text.Info(_, XML.Elem(Markup(Markup.ENTITY, Markup.Kind(kind)), _))
  71.214 +    if token_style(kind) != Token.NULL => token_style(kind)
  71.215 +
  71.216 +    case Text.Info(_, XML.Elem(Markup(name, _), _))
  71.217 +    if token_style(name) != Token.NULL => token_style(name)
  71.218 +  }
  71.219 +}
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/src/Tools/jEdit/src/isabelle_options.scala	Wed Jun 08 22:13:49 2011 +0200
    72.3 @@ -0,0 +1,67 @@
    72.4 +/*  Title:      Tools/jEdit/src/isabelle_options.scala
    72.5 +    Author:     Johannes Hölzl, TU Munich
    72.6 +
    72.7 +Editor pane for plugin options.
    72.8 +*/
    72.9 +
   72.10 +package isabelle.jedit
   72.11 +
   72.12 +
   72.13 +import isabelle._
   72.14 +
   72.15 +import javax.swing.JSpinner
   72.16 +
   72.17 +import scala.swing.CheckBox
   72.18 +
   72.19 +import org.gjt.sp.jedit.AbstractOptionPane
   72.20 +
   72.21 +
   72.22 +class Isabelle_Options extends AbstractOptionPane("isabelle")
   72.23 +{
   72.24 +  private val logic_selector = Isabelle.logic_selector(Isabelle.Property("logic"))
   72.25 +  private val auto_start = new CheckBox()
   72.26 +  private val relative_font_size = new JSpinner()
   72.27 +  private val tooltip_font_size = new JSpinner()
   72.28 +  private val tooltip_margin = new JSpinner()
   72.29 +  private val tooltip_dismiss_delay = new JSpinner()
   72.30 +
   72.31 +  override def _init()
   72.32 +  {
   72.33 +    addComponent(Isabelle.Property("logic.title"), logic_selector.peer)
   72.34 +
   72.35 +    addComponent(Isabelle.Property("auto-start.title"), auto_start.peer)
   72.36 +    auto_start.selected = Isabelle.Boolean_Property("auto-start")
   72.37 +
   72.38 +    relative_font_size.setValue(Isabelle.Int_Property("relative-font-size", 100))
   72.39 +    addComponent(Isabelle.Property("relative-font-size.title"), relative_font_size)
   72.40 +
   72.41 +    tooltip_font_size.setValue(Isabelle.Int_Property("tooltip-font-size", 10))
   72.42 +    addComponent(Isabelle.Property("tooltip-font-size.title"), tooltip_font_size)
   72.43 +
   72.44 +    tooltip_margin.setValue(Isabelle.Int_Property("tooltip-margin", 40))
   72.45 +    addComponent(Isabelle.Property("tooltip-margin.title"), tooltip_margin)
   72.46 +
   72.47 +    tooltip_dismiss_delay.setValue(
   72.48 +      Isabelle.Time_Property("tooltip-dismiss-delay", Time.seconds(8.0)).ms.toInt)
   72.49 +    addComponent(Isabelle.Property("tooltip-dismiss-delay.title"), tooltip_dismiss_delay)
   72.50 +  }
   72.51 +
   72.52 +  override def _save()
   72.53 +  {
   72.54 +    Isabelle.Property("logic") = logic_selector.selection.item.name
   72.55 +
   72.56 +    Isabelle.Boolean_Property("auto-start") = auto_start.selected
   72.57 +
   72.58 +    Isabelle.Int_Property("relative-font-size") =
   72.59 +      relative_font_size.getValue().asInstanceOf[Int]
   72.60 +
   72.61 +    Isabelle.Int_Property("tooltip-font-size") =
   72.62 +      tooltip_font_size.getValue().asInstanceOf[Int]
   72.63 +
   72.64 +    Isabelle.Int_Property("tooltip-margin") =
   72.65 +      tooltip_margin.getValue().asInstanceOf[Int]
   72.66 +
   72.67 +    Isabelle.Time_Property("tooltip-dismiss-delay") =
   72.68 +      Time.seconds(tooltip_dismiss_delay.getValue().asInstanceOf[Int])
   72.69 +  }
   72.70 +}
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/src/Tools/jEdit/src/isabelle_sidekick.scala	Wed Jun 08 22:13:49 2011 +0200
    73.3 @@ -0,0 +1,176 @@
    73.4 +/*  Title:      Tools/jEdit/src/isabelle_sidekick.scala
    73.5 +    Author:     Fabian Immler, TU Munich
    73.6 +    Author:     Makarius
    73.7 +
    73.8 +SideKick parsers for Isabelle proof documents.
    73.9 +*/
   73.10 +
   73.11 +package isabelle.jedit
   73.12 +
   73.13 +
   73.14 +import isabelle._
   73.15 +
   73.16 +import scala.collection.Set
   73.17 +import scala.collection.immutable.TreeSet
   73.18 +
   73.19 +import javax.swing.tree.DefaultMutableTreeNode
   73.20 +import javax.swing.text.Position
   73.21 +import javax.swing.Icon
   73.22 +
   73.23 +import org.gjt.sp.jedit.{Buffer, EditPane, TextUtilities, View}
   73.24 +import errorlist.DefaultErrorSource
   73.25 +import sidekick.{SideKickParser, SideKickParsedData, SideKickCompletion, IAsset}
   73.26 +
   73.27 +
   73.28 +object Isabelle_Sidekick
   73.29 +{
   73.30 +  def int_to_pos(offset: Text.Offset): Position =
   73.31 +    new Position { def getOffset = offset; override def toString = offset.toString }
   73.32 +
   73.33 +  class Asset(name: String, start: Text.Offset, end: Text.Offset) extends IAsset
   73.34 +  {
   73.35 +    protected var _name = name
   73.36 +    protected var _start = int_to_pos(start)
   73.37 +    protected var _end = int_to_pos(end)
   73.38 +    override def getIcon: Icon = null
   73.39 +    override def getShortString: String = _name
   73.40 +    override def getLongString: String = _name
   73.41 +    override def getName: String = _name
   73.42 +    override def setName(name: String) = _name = name
   73.43 +    override def getStart: Position = _start
   73.44 +    override def setStart(start: Position) = _start = start
   73.45 +    override def getEnd: Position = _end
   73.46 +    override def setEnd(end: Position) = _end = end
   73.47 +    override def toString = _name
   73.48 +  }
   73.49 +}
   73.50 +
   73.51 +
   73.52 +abstract class Isabelle_Sidekick(name: String) extends SideKickParser(name)
   73.53 +{
   73.54 +  /* parsing */
   73.55 +
   73.56 +  @volatile protected var stopped = false
   73.57 +  override def stop() = { stopped = true }
   73.58 +
   73.59 +  def parser(data: SideKickParsedData, model: Document_Model): Unit
   73.60 +
   73.61 +  def parse(buffer: Buffer, error_source: DefaultErrorSource): SideKickParsedData =
   73.62 +  {
   73.63 +    stopped = false
   73.64 +
   73.65 +    // FIXME lock buffer (!??)
   73.66 +    val data = new SideKickParsedData(buffer.getName)
   73.67 +    val root = data.root
   73.68 +    data.getAsset(root).setEnd(Isabelle_Sidekick.int_to_pos(buffer.getLength))
   73.69 +
   73.70 +    Swing_Thread.now { Document_Model(buffer) } match {
   73.71 +      case Some(model) =>
   73.72 +        parser(data, model)
   73.73 +        if (stopped) root.add(new DefaultMutableTreeNode("<parser stopped>"))
   73.74 +      case None => root.add(new DefaultMutableTreeNode("<buffer inactive>"))
   73.75 +    }
   73.76 +    data
   73.77 +  }
   73.78 +
   73.79 +
   73.80 +  /* completion */
   73.81 +
   73.82 +  override def supportsCompletion = true
   73.83 +  override def canCompleteAnywhere = true
   73.84 +
   73.85 +  override def complete(pane: EditPane, caret: Text.Offset): SideKickCompletion =
   73.86 +  {
   73.87 +    val buffer = pane.getBuffer
   73.88 +    Isabelle.swing_buffer_lock(buffer) {
   73.89 +      Document_Model(buffer) match {
   73.90 +        case None => null
   73.91 +        case Some(model) =>
   73.92 +          val line = buffer.getLineOfOffset(caret)
   73.93 +          val start = buffer.getLineStartOffset(line)
   73.94 +          val text = buffer.getSegment(start, caret - start)
   73.95 +
   73.96 +          val completion = model.session.current_syntax().completion
   73.97 +          completion.complete(text) match {
   73.98 +            case None => null
   73.99 +            case Some((word, cs)) =>
  73.100 +              val ds =
  73.101 +                (if (Isabelle_Encoding.is_active(buffer))
  73.102 +                  cs.map(Isabelle.system.symbols.decode(_)).sortWith(_ < _)
  73.103 +                 else cs).filter(_ != word)
  73.104 +              if (ds.isEmpty) null
  73.105 +              else new SideKickCompletion(
  73.106 +                pane.getView, word, ds.toArray.asInstanceOf[Array[Object]]) { }
  73.107 +          }
  73.108 +      }
  73.109 +    }
  73.110 +  }
  73.111 +}
  73.112 +
  73.113 +
  73.114 +class Isabelle_Sidekick_Default extends Isabelle_Sidekick("isabelle")
  73.115 +{
  73.116 +  import Thy_Syntax.Structure
  73.117 +
  73.118 +  def parser(data: SideKickParsedData, model: Document_Model)
  73.119 +  {
  73.120 +    val syntax = model.session.current_syntax()
  73.121 +
  73.122 +    def make_tree(offset: Text.Offset, entry: Structure.Entry): List[DefaultMutableTreeNode] =
  73.123 +      entry match {
  73.124 +        case Structure.Block(name, body) =>
  73.125 +          val node =
  73.126 +            new DefaultMutableTreeNode(
  73.127 +              new Isabelle_Sidekick.Asset(Library.first_line(name), offset, offset + entry.length))
  73.128 +          (offset /: body)((i, e) =>
  73.129 +            {
  73.130 +              make_tree(i, e) foreach (nd => node.add(nd))
  73.131 +              i + e.length
  73.132 +            })
  73.133 +          List(node)
  73.134 +        case Structure.Atom(command)
  73.135 +        if command.is_command && syntax.heading_level(command).isEmpty =>
  73.136 +          val node =
  73.137 +            new DefaultMutableTreeNode(
  73.138 +              new Isabelle_Sidekick.Asset(command.name, offset, offset + entry.length))
  73.139 +          List(node)
  73.140 +        case _ => Nil
  73.141 +      }
  73.142 +
  73.143 +    val text = Isabelle.buffer_text(model.buffer)
  73.144 +    val structure = Structure.parse(syntax, "theory " + model.thy_name, text)
  73.145 +
  73.146 +    make_tree(0, structure) foreach (node => data.root.add(node))
  73.147 +  }
  73.148 +}
  73.149 +
  73.150 +
  73.151 +class Isabelle_Sidekick_Raw extends Isabelle_Sidekick("isabelle-raw")
  73.152 +{
  73.153 +  def parser(data: SideKickParsedData, model: Document_Model)
  73.154 +  {
  73.155 +    val root = data.root
  73.156 +    val snapshot = Swing_Thread.now { model.snapshot() }  // FIXME cover all nodes (!??)
  73.157 +    for ((command, command_start) <- snapshot.node.command_range() if !stopped) {
  73.158 +      snapshot.state(command).root_markup.swing_tree(root)((info: Text.Info[Any]) =>
  73.159 +          {
  73.160 +            val range = info.range + command_start
  73.161 +            val content = command.source(info.range).replace('\n', ' ')
  73.162 +            val info_text =
  73.163 +              info.info match {
  73.164 +                case elem @ XML.Elem(_, _) =>
  73.165 +                  Pretty.formatted(List(elem), margin = 40).mkString("\n")
  73.166 +                case x => x.toString
  73.167 +              }
  73.168 +
  73.169 +            new DefaultMutableTreeNode(
  73.170 +              new Isabelle_Sidekick.Asset(command.toString, range.start, range.stop) {
  73.171 +                override def getShortString: String = content
  73.172 +                override def getLongString: String = info_text
  73.173 +                override def toString = "\"" + content + "\" " + range.toString
  73.174 +              })
  73.175 +          })
  73.176 +    }
  73.177 +  }
  73.178 +}
  73.179 +
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/src/Tools/jEdit/src/jEdit.props	Wed Jun 08 22:13:49 2011 +0200
    74.3 @@ -0,0 +1,213 @@
    74.4 +#jEdit properties
    74.5 +buffer.deepIndent=false
    74.6 +buffer.encoding=UTF-8-Isabelle
    74.7 +buffer.indentSize=2
    74.8 +buffer.lineSeparator=\n
    74.9 +buffer.maxLineLen=100
   74.10 +buffer.noTabs=true
   74.11 +buffer.sidekick.keystroke-parse=false
   74.12 +buffer.tabSize=2
   74.13 +console.encoding=UTF-8
   74.14 +console.font=IsabelleText
   74.15 +console.fontsize=14
   74.16 +delete-line.shortcut=A+d
   74.17 +delete.shortcut2=C+d
   74.18 +encoding.opt-out.Big5-HKSCS=true
   74.19 +encoding.opt-out.Big5=true
   74.20 +encoding.opt-out.COMPOUND_TEXT=true
   74.21 +encoding.opt-out.EUC-JP=true
   74.22 +encoding.opt-out.EUC-KR=true
   74.23 +encoding.opt-out.GB18030=true
   74.24 +encoding.opt-out.GB2312=true
   74.25 +encoding.opt-out.GBK=true
   74.26 +encoding.opt-out.IBM-Thai=true
   74.27 +encoding.opt-out.IBM00858=true
   74.28 +encoding.opt-out.IBM01140=true
   74.29 +encoding.opt-out.IBM01141=true
   74.30 +encoding.opt-out.IBM01142=true
   74.31 +encoding.opt-out.IBM01143=true
   74.32 +encoding.opt-out.IBM01144=true
   74.33 +encoding.opt-out.IBM01145=true
   74.34 +encoding.opt-out.IBM01146=true
   74.35 +encoding.opt-out.IBM01147=true
   74.36 +encoding.opt-out.IBM01148=true
   74.37 +encoding.opt-out.IBM01149=true
   74.38 +encoding.opt-out.IBM037=true
   74.39 +encoding.opt-out.IBM1026=true
   74.40 +encoding.opt-out.IBM1047=true
   74.41 +encoding.opt-out.IBM273=true
   74.42 +encoding.opt-out.IBM277=true
   74.43 +encoding.opt-out.IBM278=true
   74.44 +encoding.opt-out.IBM280=true
   74.45 +encoding.opt-out.IBM284=true
   74.46 +encoding.opt-out.IBM285=true
   74.47 +encoding.opt-out.IBM297=true
   74.48 +encoding.opt-out.IBM420=true
   74.49 +encoding.opt-out.IBM424=true
   74.50 +encoding.opt-out.IBM437=true
   74.51 +encoding.opt-out.IBM500=true
   74.52 +encoding.opt-out.IBM775=true
   74.53 +encoding.opt-out.IBM850=true
   74.54 +encoding.opt-out.IBM852=true
   74.55 +encoding.opt-out.IBM855=true
   74.56 +encoding.opt-out.IBM857=true
   74.57 +encoding.opt-out.IBM860=true
   74.58 +encoding.opt-out.IBM861=true
   74.59 +encoding.opt-out.IBM862=true
   74.60 +encoding.opt-out.IBM863=true
   74.61 +encoding.opt-out.IBM864=true
   74.62 +encoding.opt-out.IBM865=true
   74.63 +encoding.opt-out.IBM866=true
   74.64 +encoding.opt-out.IBM868=true
   74.65 +encoding.opt-out.IBM869=true
   74.66 +encoding.opt-out.IBM870=true
   74.67 +encoding.opt-out.IBM871=true
   74.68 +encoding.opt-out.IBM918=true
   74.69 +encoding.opt-out.ISO-2022-CN=true
   74.70 +encoding.opt-out.ISO-2022-JP-2=true
   74.71 +encoding.opt-out.ISO-2022-JP=true
   74.72 +encoding.opt-out.ISO-2022-KR=true
   74.73 +encoding.opt-out.ISO-8859-13=true
   74.74 +encoding.opt-out.ISO-8859-2=true
   74.75 +encoding.opt-out.ISO-8859-3=true
   74.76 +encoding.opt-out.ISO-8859-4=true
   74.77 +encoding.opt-out.ISO-8859-5=true
   74.78 +encoding.opt-out.ISO-8859-6=true
   74.79 +encoding.opt-out.ISO-8859-7=true
   74.80 +encoding.opt-out.ISO-8859-8=true
   74.81 +encoding.opt-out.ISO-8859-9=true
   74.82 +encoding.opt-out.JIS_X0201=true
   74.83 +encoding.opt-out.JIS_X0212-1990=true
   74.84 +encoding.opt-out.KOI8-R=true
   74.85 +encoding.opt-out.KOI8-U=true
   74.86 +encoding.opt-out.Shift_JIS=true
   74.87 +encoding.opt-out.TIS-620=true
   74.88 +encoding.opt-out.UTF-16=true
   74.89 +encoding.opt-out.UTF-16BE=true
   74.90 +encoding.opt-out.UTF-16LE=true
   74.91 +encoding.opt-out.UTF-32=true
   74.92 +encoding.opt-out.UTF-32BE=true
   74.93 +encoding.opt-out.UTF-32LE=true
   74.94 +encoding.opt-out.X-UTF-32BE-BOM=true
   74.95 +encoding.opt-out.X-UTF-32LE-BOM=true
   74.96 +encoding.opt-out.windows-1250=true
   74.97 +encoding.opt-out.windows-1251=true
   74.98 +encoding.opt-out.windows-1253=true
   74.99 +encoding.opt-out.windows-1254=true
  74.100 +encoding.opt-out.windows-1255=true
  74.101 +encoding.opt-out.windows-1256=true
  74.102 +encoding.opt-out.windows-1257=true
  74.103 +encoding.opt-out.windows-1258=true
  74.104 +encoding.opt-out.windows-31j=true
  74.105 +encoding.opt-out.x-Big5-Solaris=true
  74.106 +encoding.opt-out.x-EUC-TW=true
  74.107 +encoding.opt-out.x-IBM1006=true
  74.108 +encoding.opt-out.x-IBM1025=true
  74.109 +encoding.opt-out.x-IBM1046=true
  74.110 +encoding.opt-out.x-IBM1097=true
  74.111 +encoding.opt-out.x-IBM1098=true
  74.112 +encoding.opt-out.x-IBM1112=true
  74.113 +encoding.opt-out.x-IBM1122=true
  74.114 +encoding.opt-out.x-IBM1123=true
  74.115 +encoding.opt-out.x-IBM1124=true
  74.116 +encoding.opt-out.x-IBM1381=true
  74.117 +encoding.opt-out.x-IBM1383=true
  74.118 +encoding.opt-out.x-IBM33722=true
  74.119 +encoding.opt-out.x-IBM737=true
  74.120 +encoding.opt-out.x-IBM834=true
  74.121 +encoding.opt-out.x-IBM856=true
  74.122 +encoding.opt-out.x-IBM874=true
  74.123 +encoding.opt-out.x-IBM875=true
  74.124 +encoding.opt-out.x-IBM921=true
  74.125 +encoding.opt-out.x-IBM922=true
  74.126 +encoding.opt-out.x-IBM930=true
  74.127 +encoding.opt-out.x-IBM933=true
  74.128 +encoding.opt-out.x-IBM935=true
  74.129 +encoding.opt-out.x-IBM937=true
  74.130 +encoding.opt-out.x-IBM939=true
  74.131 +encoding.opt-out.x-IBM942=true
  74.132 +encoding.opt-out.x-IBM942C=true
  74.133 +encoding.opt-out.x-IBM943=true
  74.134 +encoding.opt-out.x-IBM943C=true
  74.135 +encoding.opt-out.x-IBM948=true
  74.136 +encoding.opt-out.x-IBM949=true
  74.137 +encoding.opt-out.x-IBM949C=true
  74.138 +encoding.opt-out.x-IBM950=true
  74.139 +encoding.opt-out.x-IBM964=true
  74.140 +encoding.opt-out.x-IBM970=true
  74.141 +encoding.opt-out.x-ISCII91=true
  74.142 +encoding.opt-out.x-ISO-2022-CN-CNS=true
  74.143 +encoding.opt-out.x-ISO-2022-CN-GB=true
  74.144 +encoding.opt-out.x-JIS0208=true
  74.145 +encoding.opt-out.x-JISAutoDetect=true
  74.146 +encoding.opt-out.x-Johab=true
  74.147 +encoding.opt-out.x-MS932_0213=true
  74.148 +encoding.opt-out.x-MS950-HKSCS=true
  74.149 +encoding.opt-out.x-MacArabic=true
  74.150 +encoding.opt-out.x-MacCentralEurope=true
  74.151 +encoding.opt-out.x-MacCroatian=true
  74.152 +encoding.opt-out.x-MacCyrillic=true
  74.153 +encoding.opt-out.x-MacDingbat=true
  74.154 +encoding.opt-out.x-MacGreek=true
  74.155 +encoding.opt-out.x-MacHebrew=true
  74.156 +encoding.opt-out.x-MacIceland=true
  74.157 +encoding.opt-out.x-MacRoman=true
  74.158 +encoding.opt-out.x-MacRomania=true
  74.159 +encoding.opt-out.x-MacSymbol=true
  74.160 +encoding.opt-out.x-MacThai=true
  74.161 +encoding.opt-out.x-MacTurkish=true
  74.162 +encoding.opt-out.x-MacUkraine=true
  74.163 +encoding.opt-out.x-PCK=true
  74.164 +encoding.opt-out.x-SJIS_0213=true
  74.165 +encoding.opt-out.x-UTF-16LE-BOM=true
  74.166 +encoding.opt-out.x-euc-jp-linux=true
  74.167 +encoding.opt-out.x-eucJP-Open=true
  74.168 +encoding.opt-out.x-iso-8859-11=true
  74.169 +encoding.opt-out.x-mswin-936=true
  74.170 +encoding.opt-out.x-windows-50220=true
  74.171 +encoding.opt-out.x-windows-50221=true
  74.172 +encoding.opt-out.x-windows-874=true
  74.173 +encoding.opt-out.x-windows-949=true
  74.174 +encoding.opt-out.x-windows-950=true
  74.175 +encoding.opt-out.x-windows-iso2022jp=true
  74.176 +encodingDetectors=BOM XML-PI buffer-local-property
  74.177 +end.shortcut=
  74.178 +fallbackEncodings=UTF-8 ISO-8859-15 US-ASCII
  74.179 +firstTime=false
  74.180 +home.shortcut=
  74.181 +insert-newline-indent.shortcut=
  74.182 +insert-newline.shortcut=ENTER
  74.183 +isabelle-output.dock-position=bottom
  74.184 +isabelle-output.height=174
  74.185 +isabelle-output.width=412
  74.186 +isabelle-session.dock-position=bottom
  74.187 +line-end.shortcut=END
  74.188 +line-home.shortcut=HOME
  74.189 +lookAndFeel=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
  74.190 +mode.isabelle.customSettings=true
  74.191 +mode.isabelle.folding=sidekick
  74.192 +mode.isabelle.sidekick.showStatusWindow.label=true
  74.193 +print.font=IsabelleText
  74.194 +restore.remote=false
  74.195 +restore=false
  74.196 +sidekick-tree.dock-position=right
  74.197 +sidekick.buffer-save-parse=true
  74.198 +sidekick.complete-delay=300
  74.199 +sidekick.splitter.location=721
  74.200 +tip.show=false
  74.201 +twoStageSave=false
  74.202 +view.antiAlias=standard
  74.203 +view.blockCaret=true
  74.204 +view.caretBlink=false
  74.205 +view.eolMarkers=false
  74.206 +view.extendedState=0
  74.207 +view.font=IsabelleText
  74.208 +view.fontsize=18
  74.209 +view.fracFontMetrics=false
  74.210 +view.gutter.fontsize=12
  74.211 +view.gutter.selectionAreaWidth=18
  74.212 +view.height=787
  74.213 +view.middleMousePaste=true
  74.214 +view.showToolbar=false
  74.215 +view.thickCaret=true
  74.216 +view.width=1072
    75.1 --- a/src/Tools/jEdit/src/jedit/dockable.scala	Wed Jun 08 17:01:07 2011 +0200
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,41 +0,0 @@
    75.4 -/*  Title:      Tools/jEdit/src/jedit/dockable.scala
    75.5 -    Author:     Makarius
    75.6 -
    75.7 -Generic dockable window.
    75.8 -*/
    75.9 -
   75.10 -package isabelle.jedit
   75.11 -
   75.12 -
   75.13 -import isabelle._
   75.14 -
   75.15 -import java.awt.{Dimension, Component, BorderLayout}
   75.16 -import javax.swing.JPanel
   75.17 -
   75.18 -import org.gjt.sp.jedit.View
   75.19 -import org.gjt.sp.jedit.gui.DockableWindowManager
   75.20 -
   75.21 -
   75.22 -class Dockable(view: View, position: String) extends JPanel(new BorderLayout)
   75.23 -{
   75.24 -  if (position == DockableWindowManager.FLOATING)
   75.25 -    setPreferredSize(new Dimension(500, 250))
   75.26 -
   75.27 -  def set_content(c: Component) { add(c, BorderLayout.CENTER) }
   75.28 -  def set_content(c: scala.swing.Component) { add(c.peer, BorderLayout.CENTER) }
   75.29 -
   75.30 -  protected def init() { }
   75.31 -  protected def exit() { }
   75.32 -
   75.33 -  override def addNotify()
   75.34 -  {
   75.35 -    super.addNotify()
   75.36 -    init()
   75.37 -  }
   75.38 -
   75.39 -  override def removeNotify()
   75.40 -  {
   75.41 -    exit()
   75.42 -    super.removeNotify()
   75.43 -  }
   75.44 -}
    76.1 --- a/src/Tools/jEdit/src/jedit/document_model.scala	Wed Jun 08 17:01:07 2011 +0200
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,252 +0,0 @@
    76.4 -/*  Title:      Tools/jEdit/src/jedit/document_model.scala
    76.5 -    Author:     Fabian Immler, TU Munich
    76.6 -    Author:     Makarius
    76.7 -
    76.8 -Document model connected to jEdit buffer -- single node in theory graph.
    76.9 -*/
   76.10 -
   76.11 -package isabelle.jedit
   76.12 -
   76.13 -
   76.14 -import isabelle._
   76.15 -
   76.16 -import scala.collection.mutable
   76.17 -
   76.18 -import org.gjt.sp.jedit.Buffer
   76.19 -import org.gjt.sp.jedit.buffer.{BufferAdapter, BufferListener, JEditBuffer}
   76.20 -import org.gjt.sp.jedit.syntax.{SyntaxStyle, Token, TokenMarker, TokenHandler, ParserRuleSet}
   76.21 -import org.gjt.sp.jedit.textarea.TextArea
   76.22 -
   76.23 -import java.awt.font.TextAttribute
   76.24 -import javax.swing.text.Segment;
   76.25 -
   76.26 -
   76.27 -object Document_Model
   76.28 -{
   76.29 -  object Token_Markup
   76.30 -  {
   76.31 -    /* extended token styles */
   76.32 -
   76.33 -    private val plain_range: Int = Token.ID_COUNT
   76.34 -    private val full_range: Int = 3 * plain_range
   76.35 -    private def check_range(i: Int) { require(0 <= i && i < plain_range) }
   76.36 -
   76.37 -    def subscript(i: Byte): Byte = { check_range(i); (i + plain_range).toByte }
   76.38 -    def superscript(i: Byte): Byte = { check_range(i); (i + 2 * plain_range).toByte }
   76.39 -
   76.40 -    private def script_style(style: SyntaxStyle, i: Int): SyntaxStyle =
   76.41 -    {
   76.42 -      import scala.collection.JavaConversions._
   76.43 -      val script_font =
   76.44 -        style.getFont.deriveFont(Map(TextAttribute.SUPERSCRIPT -> new java.lang.Integer(i)))
   76.45 -      new SyntaxStyle(style.getForegroundColor, style.getBackgroundColor, script_font)
   76.46 -    }
   76.47 -
   76.48 -    def extend_styles(styles: Array[SyntaxStyle]): Array[SyntaxStyle] =
   76.49 -    {
   76.50 -      val new_styles = new Array[SyntaxStyle](full_range)
   76.51 -      for (i <- 0 until plain_range) {
   76.52 -        val style = styles(i)
   76.53 -        new_styles(i) = style
   76.54 -        new_styles(subscript(i.toByte)) = script_style(style, -1)
   76.55 -        new_styles(superscript(i.toByte)) = script_style(style, 1)
   76.56 -      }
   76.57 -      new_styles
   76.58 -    }
   76.59 -
   76.60 -
   76.61 -    /* line context */
   76.62 -
   76.63 -    private val dummy_rules = new ParserRuleSet("isabelle", "MAIN")
   76.64 -
   76.65 -    class Line_Context(val line: Int, prev: Line_Context)
   76.66 -      extends TokenMarker.LineContext(dummy_rules, prev)
   76.67 -    {
   76.68 -      override def hashCode: Int = line
   76.69 -      override def equals(that: Any): Boolean =
   76.70 -        that match {
   76.71 -          case other: Line_Context => line == other.line
   76.72 -          case _ => false
   76.73 -        }
   76.74 -    }
   76.75 -  }
   76.76 -
   76.77 -
   76.78 -  /* document model of buffer */
   76.79 -
   76.80 -  private val key = "isabelle.document_model"
   76.81 -
   76.82 -  def init(session: Session, buffer: Buffer, thy_name: String): Document_Model =
   76.83 -  {
   76.84 -    Swing_Thread.require()
   76.85 -    val model = new Document_Model(session, buffer, thy_name)
   76.86 -    buffer.setProperty(key, model)
   76.87 -    model.activate()
   76.88 -    model
   76.89 -  }
   76.90 -
   76.91 -  def apply(buffer: Buffer): Option[Document_Model] =
   76.92 -  {
   76.93 -    Swing_Thread.require()
   76.94 -    buffer.getProperty(key) match {
   76.95 -      case model: Document_Model => Some(model)
   76.96 -      case _ => None
   76.97 -    }
   76.98 -  }
   76.99 -
  76.100 -  def exit(buffer: Buffer)
  76.101 -  {
  76.102 -    Swing_Thread.require()
  76.103 -    apply(buffer) match {
  76.104 -      case None =>
  76.105 -      case Some(model) =>
  76.106 -        model.deactivate()
  76.107 -        buffer.unsetProperty(key)
  76.108 -    }
  76.109 -  }
  76.110 -}
  76.111 -
  76.112 -
  76.113 -class Document_Model(val session: Session, val buffer: Buffer, val thy_name: String)
  76.114 -{
  76.115 -  /* pending text edits */
  76.116 -
  76.117 -  object pending_edits  // owned by Swing thread
  76.118 -  {
  76.119 -    private val pending = new mutable.ListBuffer[Text.Edit]
  76.120 -    def snapshot(): List[Text.Edit] = pending.toList
  76.121 -
  76.122 -    def flush(more_edits: Option[List[Text.Edit]]*)
  76.123 -    {
  76.124 -      Swing_Thread.require()
  76.125 -      val edits = snapshot()
  76.126 -      pending.clear
  76.127 -
  76.128 -      val all_edits =
  76.129 -        if (edits.isEmpty) more_edits.toList
  76.130 -        else Some(edits) :: more_edits.toList
  76.131 -      if (!all_edits.isEmpty) session.edit_version(all_edits.map((thy_name, _)))
  76.132 -    }
  76.133 -
  76.134 -    def init()
  76.135 -    {
  76.136 -      Swing_Thread.require()
  76.137 -      flush(None, Some(List(Text.Edit.insert(0, Isabelle.buffer_text(buffer)))))
  76.138 -    }
  76.139 -
  76.140 -    private val delay_flush =
  76.141 -      Swing_Thread.delay_last(session.input_delay) { flush() }
  76.142 -
  76.143 -    def +=(edit: Text.Edit)
  76.144 -    {
  76.145 -      Swing_Thread.require()
  76.146 -      pending += edit
  76.147 -      delay_flush()
  76.148 -    }
  76.149 -  }
  76.150 -
  76.151 -
  76.152 -  /* snapshot */
  76.153 -
  76.154 -  def snapshot(): Document.Snapshot =
  76.155 -  {
  76.156 -    Swing_Thread.require()
  76.157 -    session.snapshot(thy_name, pending_edits.snapshot())
  76.158 -  }
  76.159 -
  76.160 -
  76.161 -  /* buffer listener */
  76.162 -
  76.163 -  private val buffer_listener: BufferListener = new BufferAdapter
  76.164 -  {
  76.165 -    override def bufferLoaded(buffer: JEditBuffer)
  76.166 -    {
  76.167 -      pending_edits.init()
  76.168 -    }
  76.169 -
  76.170 -    override def contentInserted(buffer: JEditBuffer,
  76.171 -      start_line: Int, offset: Int, num_lines: Int, length: Int)
  76.172 -    {
  76.173 -      if (!buffer.isLoading)
  76.174 -        pending_edits += Text.Edit.insert(offset, buffer.getText(offset, length))
  76.175 -    }
  76.176 -
  76.177 -    override def preContentRemoved(buffer: JEditBuffer,
  76.178 -      start_line: Int, offset: Int, num_lines: Int, removed_length: Int)
  76.179 -    {
  76.180 -      if (!buffer.isLoading)
  76.181 -        pending_edits += Text.Edit.remove(offset, buffer.getText(offset, removed_length))
  76.182 -    }
  76.183 -  }
  76.184 -
  76.185 -
  76.186 -  /* semantic token marker */
  76.187 -
  76.188 -  private val token_marker = new TokenMarker
  76.189 -  {
  76.190 -    override def markTokens(prev: TokenMarker.LineContext,
  76.191 -        handler: TokenHandler, line_segment: Segment): TokenMarker.LineContext =
  76.192 -    {
  76.193 -      Isabelle.swing_buffer_lock(buffer) {
  76.194 -        val snapshot = Document_Model.this.snapshot()
  76.195 -
  76.196 -        val previous = prev.asInstanceOf[Document_Model.Token_Markup.Line_Context]
  76.197 -        val line = if (prev == null) 0 else previous.line + 1
  76.198 -        val context = new Document_Model.Token_Markup.Line_Context(line, previous)
  76.199 -
  76.200 -        val start = buffer.getLineStartOffset(line)
  76.201 -        val stop = start + line_segment.count
  76.202 -
  76.203 -        /* FIXME
  76.204 -        for (text_area <- Isabelle.jedit_text_areas(buffer)
  76.205 -              if Document_View(text_area).isDefined)
  76.206 -          Document_View(text_area).get.set_styles()
  76.207 -        */
  76.208 -
  76.209 -        def handle_token(style: Byte, offset: Text.Offset, length: Int) =
  76.210 -          handler.handleToken(line_segment, style, offset, length, context)
  76.211 -
  76.212 -        val syntax = session.current_syntax()
  76.213 -        val tokens = snapshot.select_markup(Text.Range(start, stop))(Isabelle_Markup.tokens(syntax))
  76.214 -
  76.215 -        var last = start
  76.216 -        for (token <- tokens.iterator) {
  76.217 -          val Text.Range(token_start, token_stop) = token.range
  76.218 -          if (last < token_start)
  76.219 -            handle_token(Token.COMMENT1, last - start, token_start - last)
  76.220 -          handle_token(token.info getOrElse Token.NULL,
  76.221 -            token_start - start, token_stop - token_start)
  76.222 -          last = token_stop
  76.223 -        }
  76.224 -        if (last < stop) handle_token(Token.COMMENT1, last - start, stop - last)
  76.225 -
  76.226 -        handle_token(Token.END, line_segment.count, 0)
  76.227 -        handler.setLineContext(context)
  76.228 -        context
  76.229 -      }
  76.230 -    }
  76.231 -  }
  76.232 -
  76.233 -
  76.234 -  /* activation */
  76.235 -
  76.236 -  def activate()
  76.237 -  {
  76.238 -    buffer.setTokenMarker(token_marker)
  76.239 -    buffer.addBufferListener(buffer_listener)
  76.240 -    buffer.propertiesChanged()
  76.241 -    pending_edits.init()
  76.242 -  }
  76.243 -
  76.244 -  def refresh()
  76.245 -  {
  76.246 -    buffer.setTokenMarker(token_marker)
  76.247 -  }
  76.248 -
  76.249 -  def deactivate()
  76.250 -  {
  76.251 -    pending_edits.flush()
  76.252 -    buffer.setTokenMarker(buffer.getMode.getTokenMarker)
  76.253 -    buffer.removeBufferListener(buffer_listener)
  76.254 -  }
  76.255 -}
    77.1 --- a/src/Tools/jEdit/src/jedit/document_view.scala	Wed Jun 08 17:01:07 2011 +0200
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,587 +0,0 @@
    77.4 -/*  Title:      Tools/jEdit/src/jedit/document_view.scala
    77.5 -    Author:     Fabian Immler, TU Munich
    77.6 -    Author:     Makarius
    77.7 -
    77.8 -Document view connected to jEdit text area.
    77.9 -*/
   77.10 -
   77.11 -package isabelle.jedit
   77.12 -
   77.13 -
   77.14 -import isabelle._
   77.15 -
   77.16 -import scala.actors.Actor._
   77.17 -
   77.18 -import java.awt.{BorderLayout, Graphics, Color, Dimension, Graphics2D, Point}
   77.19 -import java.awt.event.{MouseAdapter, MouseMotionAdapter, MouseEvent,
   77.20 -  FocusAdapter, FocusEvent, WindowEvent, WindowAdapter}
   77.21 -import javax.swing.{JPanel, ToolTipManager, Popup, PopupFactory, SwingUtilities, BorderFactory}
   77.22 -import javax.swing.event.{CaretListener, CaretEvent}
   77.23 -import java.util.ArrayList
   77.24 -
   77.25 -import org.gjt.sp.jedit.{jEdit, OperatingSystem, Debug}
   77.26 -import org.gjt.sp.jedit.gui.RolloverButton
   77.27 -import org.gjt.sp.jedit.options.GutterOptionPane
   77.28 -import org.gjt.sp.jedit.textarea.{JEditTextArea, TextArea, TextAreaExtension, TextAreaPainter}
   77.29 -import org.gjt.sp.jedit.syntax.{SyntaxStyle, DisplayTokenHandler, Chunk, Token}
   77.30 -
   77.31 -
   77.32 -object Document_View
   77.33 -{
   77.34 -  /* document view of text area */
   77.35 -
   77.36 -  private val key = new Object
   77.37 -
   77.38 -  def init(model: Document_Model, text_area: JEditTextArea): Document_View =
   77.39 -  {
   77.40 -    Swing_Thread.require()
   77.41 -    val doc_view = new Document_View(model, text_area)
   77.42 -    text_area.putClientProperty(key, doc_view)
   77.43 -    doc_view.activate()
   77.44 -    doc_view
   77.45 -  }
   77.46 -
   77.47 -  def apply(text_area: JEditTextArea): Option[Document_View] =
   77.48 -  {
   77.49 -    Swing_Thread.require()
   77.50 -    text_area.getClientProperty(key) match {
   77.51 -      case doc_view: Document_View => Some(doc_view)
   77.52 -      case _ => None
   77.53 -    }
   77.54 -  }
   77.55 -
   77.56 -  def exit(text_area: JEditTextArea)
   77.57 -  {
   77.58 -    Swing_Thread.require()
   77.59 -    apply(text_area) match {
   77.60 -      case None =>
   77.61 -      case Some(doc_view) =>
   77.62 -        doc_view.deactivate()
   77.63 -        text_area.putClientProperty(key, null)
   77.64 -    }
   77.65 -  }
   77.66 -}
   77.67 -
   77.68 -
   77.69 -class Document_View(val model: Document_Model, text_area: JEditTextArea)
   77.70 -{
   77.71 -  private val session = model.session
   77.72 -
   77.73 -
   77.74 -  /** token handling **/
   77.75 -
   77.76 -  /* extended token styles */
   77.77 -
   77.78 -  private var styles: Array[SyntaxStyle] = null  // owned by Swing thread
   77.79 -
   77.80 -  def extend_styles()
   77.81 -  {
   77.82 -    Swing_Thread.require()
   77.83 -    styles = Document_Model.Token_Markup.extend_styles(text_area.getPainter.getStyles)
   77.84 -  }
   77.85 -  extend_styles()
   77.86 -
   77.87 -  def set_styles()
   77.88 -  {
   77.89 -    Swing_Thread.require()
   77.90 -    text_area.getPainter.setStyles(styles)
   77.91 -  }
   77.92 -
   77.93 -
   77.94 -  /* wrap_margin -- cf. org.gjt.sp.jedit.textarea.TextArea.propertiesChanged */
   77.95 -
   77.96 -  def wrap_margin(): Int =
   77.97 -  {
   77.98 -    val buffer = text_area.getBuffer
   77.99 -    val painter = text_area.getPainter
  77.100 -    val font = painter.getFont
  77.101 -    val font_context = painter.getFontRenderContext
  77.102 -
  77.103 -    val soft_wrap = buffer.getStringProperty("wrap") == "soft"
  77.104 -    val max = buffer.getIntegerProperty("maxLineLen", 0)
  77.105 -
  77.106 -    if (max > 0) font.getStringBounds(" " * max, font_context).getWidth.toInt
  77.107 -    else if (soft_wrap)
  77.108 -      painter.getWidth - (font.getStringBounds(" ", font_context).getWidth.round.toInt) * 3
  77.109 -    else 0
  77.110 -  }
  77.111 -
  77.112 -
  77.113 -  /* chunks */
  77.114 -
  77.115 -  def line_chunks(physical_lines: Set[Int]): Map[Text.Offset, Chunk] =
  77.116 -  {
  77.117 -    import scala.collection.JavaConversions._
  77.118 -
  77.119 -    val buffer = text_area.getBuffer
  77.120 -    val painter = text_area.getPainter
  77.121 -    val margin = wrap_margin().toFloat
  77.122 -
  77.123 -    val out = new ArrayList[Chunk]
  77.124 -    val handler = new DisplayTokenHandler
  77.125 -
  77.126 -    var result = Map[Text.Offset, Chunk]()
  77.127 -    for (line <- physical_lines) {
  77.128 -      out.clear
  77.129 -      handler.init(painter.getStyles, painter.getFontRenderContext, painter, out, margin)
  77.130 -      buffer.markTokens(line, handler)
  77.131 -
  77.132 -      val line_start = buffer.getLineStartOffset(line)
  77.133 -      for (chunk <- handler.getChunkList.iterator)
  77.134 -        result += (line_start + chunk.offset -> chunk)
  77.135 -    }
  77.136 -    result
  77.137 -  }
  77.138 -
  77.139 -
  77.140 -  /* visible line ranges */
  77.141 -
  77.142 -  // simplify slightly odd result of TextArea.getScreenLineEndOffset etc.
  77.143 -  // NB: jEdit already normalizes \r\n and \r to \n
  77.144 -  def proper_line_range(start: Text.Offset, end: Text.Offset): Text.Range =
  77.145 -  {
  77.146 -    val stop = if (start < end) end - 1 else end min model.buffer.getLength
  77.147 -    Text.Range(start, stop)
  77.148 -  }
  77.149 -
  77.150 -  def screen_lines_range(): Text.Range =
  77.151 -  {
  77.152 -    val start = text_area.getScreenLineStartOffset(0)
  77.153 -    val raw_end = text_area.getScreenLineEndOffset(text_area.getVisibleLines - 1 max 0)
  77.154 -    proper_line_range(start, if (raw_end >= 0) raw_end else model.buffer.getLength)
  77.155 -  }
  77.156 -
  77.157 -  def invalidate_line_range(range: Text.Range)
  77.158 -  {
  77.159 -    text_area.invalidateLineRange(
  77.160 -      model.buffer.getLineOfOffset(range.start),
  77.161 -      model.buffer.getLineOfOffset(range.stop))
  77.162 -  }
  77.163 -
  77.164 -
  77.165 -  /* HTML popups */
  77.166 -
  77.167 -  private var html_popup: Option[Popup] = None
  77.168 -
  77.169 -  private def exit_popup() { html_popup.map(_.hide) }
  77.170 -
  77.171 -  private val html_panel =
  77.172 -    new HTML_Panel(Isabelle.system, Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
  77.173 -  html_panel.setBorder(BorderFactory.createLineBorder(Color.black))
  77.174 -
  77.175 -  private def html_panel_resize()
  77.176 -  {
  77.177 -    Swing_Thread.now {
  77.178 -      html_panel.resize(Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
  77.179 -    }
  77.180 -  }
  77.181 -
  77.182 -  private def init_popup(snapshot: Document.Snapshot, x: Int, y: Int)
  77.183 -  {
  77.184 -    exit_popup()
  77.185 -/* FIXME broken
  77.186 -    val offset = text_area.xyToOffset(x, y)
  77.187 -    val p = new Point(x, y); SwingUtilities.convertPointToScreen(p, text_area.getPainter)
  77.188 -
  77.189 -    // FIXME snapshot.cumulate
  77.190 -    snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.popup) match {
  77.191 -      case Text.Info(_, Some(msg)) #:: _ =>
  77.192 -        val popup = PopupFactory.getSharedInstance().getPopup(text_area, html_panel, p.x, p.y + 60)
  77.193 -        html_panel.render_sync(List(msg))
  77.194 -        Thread.sleep(10)  // FIXME !?
  77.195 -        popup.show
  77.196 -        html_popup = Some(popup)
  77.197 -      case _ =>
  77.198 -    }
  77.199 -*/
  77.200 -  }
  77.201 -
  77.202 -
  77.203 -  /* subexpression highlighting */
  77.204 -
  77.205 -  private def subexp_range(snapshot: Document.Snapshot, x: Int, y: Int)
  77.206 -    : Option[(Text.Range, Color)] =
  77.207 -  {
  77.208 -    val offset = text_area.xyToOffset(x, y)
  77.209 -    snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.subexp) match {
  77.210 -      case Text.Info(_, Some((range, color))) #:: _ => Some((snapshot.convert(range), color))
  77.211 -      case _ => None
  77.212 -    }
  77.213 -  }
  77.214 -
  77.215 -  private var highlight_range: Option[(Text.Range, Color)] = None
  77.216 -
  77.217 -
  77.218 -  /* CONTROL-mouse management */
  77.219 -
  77.220 -  private var control: Boolean = false
  77.221 -
  77.222 -  private def exit_control()
  77.223 -  {
  77.224 -    exit_popup()
  77.225 -    highlight_range = None
  77.226 -  }
  77.227 -
  77.228 -  private val focus_listener = new FocusAdapter {
  77.229 -    override def focusLost(e: FocusEvent) {
  77.230 -      highlight_range = None // FIXME exit_control !?
  77.231 -    }
  77.232 -  }
  77.233 -
  77.234 -  private val window_listener = new WindowAdapter {
  77.235 -    override def windowIconified(e: WindowEvent) { exit_control() }
  77.236 -    override def windowDeactivated(e: WindowEvent) { exit_control() }
  77.237 -  }
  77.238 -
  77.239 -  private val mouse_motion_listener = new MouseMotionAdapter {
  77.240 -    override def mouseMoved(e: MouseEvent) {
  77.241 -      control = if (OperatingSystem.isMacOS()) e.isMetaDown else e.isControlDown
  77.242 -      val x = e.getX()
  77.243 -      val y = e.getY()
  77.244 -
  77.245 -      if (!model.buffer.isLoaded) exit_control()
  77.246 -      else
  77.247 -        Isabelle.swing_buffer_lock(model.buffer) {
  77.248 -          val snapshot = model.snapshot
  77.249 -
  77.250 -          if (control) init_popup(snapshot, x, y)
  77.251 -
  77.252 -          highlight_range map { case (range, _) => invalidate_line_range(range) }
  77.253 -          highlight_range = if (control) subexp_range(snapshot, x, y) else None
  77.254 -          highlight_range map { case (range, _) => invalidate_line_range(range) }
  77.255 -        }
  77.256 -    }
  77.257 -  }
  77.258 -
  77.259 -
  77.260 -  /* TextArea painters */
  77.261 -
  77.262 -  private val background_painter = new TextAreaExtension
  77.263 -  {
  77.264 -    override def paintScreenLineRange(gfx: Graphics2D,
  77.265 -      first_line: Int, last_line: Int, physical_lines: Array[Int],
  77.266 -      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
  77.267 -    {
  77.268 -      Isabelle.swing_buffer_lock(model.buffer) {
  77.269 -        val snapshot = model.snapshot()
  77.270 -        val ascent = text_area.getPainter.getFontMetrics.getAscent
  77.271 -
  77.272 -        for (i <- 0 until physical_lines.length) {
  77.273 -          if (physical_lines(i) != -1) {
  77.274 -            val line_range = proper_line_range(start(i), end(i))
  77.275 -
  77.276 -            // background color: status
  77.277 -            val cmds = snapshot.node.command_range(snapshot.revert(line_range))
  77.278 -            for {
  77.279 -              (command, command_start) <- cmds if !command.is_ignored
  77.280 -              val range = line_range.restrict(snapshot.convert(command.range + command_start))
  77.281 -              r <- Isabelle.gfx_range(text_area, range)
  77.282 -              color <- Isabelle_Markup.status_color(snapshot, command)
  77.283 -            } {
  77.284 -              gfx.setColor(color)
  77.285 -              gfx.fillRect(r.x, y + i * line_height, r.length, line_height)
  77.286 -            }
  77.287 -
  77.288 -            // background color (1): markup
  77.289 -            for {
  77.290 -              Text.Info(range, Some(color)) <-
  77.291 -                snapshot.select_markup(line_range)(Isabelle_Markup.background1).iterator
  77.292 -              r <- Isabelle.gfx_range(text_area, range)
  77.293 -            } {
  77.294 -              gfx.setColor(color)
  77.295 -              gfx.fillRect(r.x, y + i * line_height, r.length, line_height)
  77.296 -            }
  77.297 -
  77.298 -            // background color (2): markup
  77.299 -            for {
  77.300 -              Text.Info(range, Some(color)) <-
  77.301 -                snapshot.select_markup(line_range)(Isabelle_Markup.background2).iterator
  77.302 -              r <- Isabelle.gfx_range(text_area, range)
  77.303 -            } {
  77.304 -              gfx.setColor(color)
  77.305 -              gfx.fillRect(r.x + 2, y + i * line_height + 2, r.length - 4, line_height - 4)
  77.306 -            }
  77.307 -
  77.308 -            // sub-expression highlighting -- potentially from other snapshot
  77.309 -            highlight_range match {
  77.310 -              case Some((range, color)) if line_range.overlaps(range) =>
  77.311 -                Isabelle.gfx_range(text_area, line_range.restrict(range)) match {
  77.312 -                  case None =>
  77.313 -                  case Some(r) =>
  77.314 -                    gfx.setColor(color)
  77.315 -                    gfx.drawRect(r.x, y + i * line_height, r.length - 1, line_height - 1)
  77.316 -                }
  77.317 -              case _ =>
  77.318 -            }
  77.319 -
  77.320 -            // squiggly underline
  77.321 -            for {
  77.322 -              Text.Info(range, Some(color)) <-
  77.323 -                snapshot.select_markup(line_range)(Isabelle_Markup.message).iterator
  77.324 -              r <- Isabelle.gfx_range(text_area, range)
  77.325 -            } {
  77.326 -              gfx.setColor(color)
  77.327 -              val x0 = (r.x / 2) * 2
  77.328 -              val y0 = r.y + ascent + 1
  77.329 -              for (x1 <- Range(x0, x0 + r.length, 2)) {
  77.330 -                val y1 = if (x1 % 4 < 2) y0 else y0 + 1
  77.331 -                gfx.drawLine(x1, y1, x1 + 1, y1)
  77.332 -              }
  77.333 -            }
  77.334 -          }
  77.335 -        }
  77.336 -      }
  77.337 -    }
  77.338 -
  77.339 -    override def getToolTipText(x: Int, y: Int): String =
  77.340 -    {
  77.341 -      Isabelle.swing_buffer_lock(model.buffer) {
  77.342 -        val snapshot = model.snapshot()
  77.343 -        val offset = text_area.xyToOffset(x, y)
  77.344 -        if (control) {
  77.345 -          snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.tooltip) match
  77.346 -          {
  77.347 -            case Text.Info(_, Some(text)) #:: _ => Isabelle.tooltip(text)
  77.348 -            case _ => null
  77.349 -          }
  77.350 -        }
  77.351 -        else {
  77.352 -          // FIXME snapshot.cumulate
  77.353 -          snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.popup) match
  77.354 -          {
  77.355 -            case Text.Info(_, Some(text)) #:: _ => Isabelle.tooltip(text)
  77.356 -            case _ => null
  77.357 -          }
  77.358 -        }
  77.359 -      }
  77.360 -    }
  77.361 -  }
  77.362 -
  77.363 -  var use_text_painter = false
  77.364 -
  77.365 -  private val text_painter = new TextAreaExtension
  77.366 -  {
  77.367 -    override def paintScreenLineRange(gfx: Graphics2D,
  77.368 -      first_line: Int, last_line: Int, physical_lines: Array[Int],
  77.369 -      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
  77.370 -    {
  77.371 -      if (use_text_painter) {
  77.372 -        Isabelle.swing_buffer_lock(model.buffer) {
  77.373 -          val painter = text_area.getPainter
  77.374 -          val fm = painter.getFontMetrics
  77.375 -
  77.376 -          val all_chunks = line_chunks(Set[Int]() ++ physical_lines.iterator.filter(i => i != -1))
  77.377 -
  77.378 -          val x0 = text_area.getHorizontalOffset
  77.379 -          var y0 = y + fm.getHeight - (fm.getLeading + 1) - fm.getDescent
  77.380 -          for (i <- 0 until physical_lines.length) {
  77.381 -            if (physical_lines(i) != -1) {
  77.382 -              all_chunks.get(start(i)) match {
  77.383 -                case Some(chunk) =>
  77.384 -                  Chunk.paintChunkList(chunk, gfx, x0, y0, !Debug.DISABLE_GLYPH_VECTOR)
  77.385 -                case None =>
  77.386 -              }
  77.387 -            }
  77.388 -            y0 += line_height
  77.389 -          }
  77.390 -        }
  77.391 -      }
  77.392 -    }
  77.393 -  }
  77.394 -
  77.395 -  private val gutter_painter = new TextAreaExtension
  77.396 -  {
  77.397 -    override def paintScreenLineRange(gfx: Graphics2D,
  77.398 -      first_line: Int, last_line: Int, physical_lines: Array[Int],
  77.399 -      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
  77.400 -    {
  77.401 -      val gutter = text_area.getGutter
  77.402 -      val width = GutterOptionPane.getSelectionAreaWidth
  77.403 -      val border_width = jEdit.getIntegerProperty("view.gutter.borderWidth", 3)
  77.404 -      val FOLD_MARKER_SIZE = 12
  77.405 -
  77.406 -      if (gutter.isSelectionAreaEnabled && !gutter.isExpanded && width >= 12 && line_height >= 12) {
  77.407 -        Isabelle.swing_buffer_lock(model.buffer) {
  77.408 -          val snapshot = model.snapshot()
  77.409 -          for (i <- 0 until physical_lines.length) {
  77.410 -            if (physical_lines(i) != -1) {
  77.411 -              val line_range = proper_line_range(start(i), end(i))
  77.412 -
  77.413 -              // gutter icons
  77.414 -              val icons =
  77.415 -                (for (Text.Info(_, Some(icon)) <- // FIXME snapshot.cumulate
  77.416 -                  snapshot.select_markup(line_range)(Isabelle_Markup.gutter_message).iterator)
  77.417 -                yield icon).toList.sortWith(_ >= _)
  77.418 -              icons match {
  77.419 -                case icon :: _ =>
  77.420 -                  val icn = icon.icon
  77.421 -                  val x0 = (FOLD_MARKER_SIZE + width - border_width - icn.getIconWidth) max 10
  77.422 -                  val y0 = y + i * line_height + (((line_height - icn.getIconHeight) / 2) max 0)
  77.423 -                  icn.paintIcon(gutter, gfx, x0, y0)
  77.424 -                case Nil =>
  77.425 -              }
  77.426 -            }
  77.427 -          }
  77.428 -        }
  77.429 -      }
  77.430 -    }
  77.431 -  }
  77.432 -
  77.433 -
  77.434 -  /* caret handling */
  77.435 -
  77.436 -  def selected_command(): Option[Command] =
  77.437 -  {
  77.438 -    Swing_Thread.require()
  77.439 -    model.snapshot().node.proper_command_at(text_area.getCaretPosition)
  77.440 -  }
  77.441 -
  77.442 -  private val caret_listener = new CaretListener {
  77.443 -    private val delay = Swing_Thread.delay_last(session.input_delay) {
  77.444 -      session.perspective.event(Session.Perspective)
  77.445 -    }
  77.446 -    override def caretUpdate(e: CaretEvent) { delay() }
  77.447 -  }
  77.448 -
  77.449 -
  77.450 -  /* overview of command status left of scrollbar */
  77.451 -
  77.452 -  private val overview = new JPanel(new BorderLayout)
  77.453 -  {
  77.454 -    private val WIDTH = 10
  77.455 -    private val HEIGHT = 2
  77.456 -
  77.457 -    setPreferredSize(new Dimension(WIDTH, 0))
  77.458 -
  77.459 -    setRequestFocusEnabled(false)
  77.460 -
  77.461 -    addMouseListener(new MouseAdapter {
  77.462 -      override def mousePressed(event: MouseEvent) {
  77.463 -        val line = y_to_line(event.getY)
  77.464 -        if (line >= 0 && line < text_area.getLineCount)
  77.465 -          text_area.setCaretPosition(text_area.getLineStartOffset(line))
  77.466 -      }
  77.467 -    })
  77.468 -
  77.469 -    override def addNotify() {
  77.470 -      super.addNotify()
  77.471 -      ToolTipManager.sharedInstance.registerComponent(this)
  77.472 -    }
  77.473 -
  77.474 -    override def removeNotify() {
  77.475 -      ToolTipManager.sharedInstance.unregisterComponent(this)
  77.476 -      super.removeNotify
  77.477 -    }
  77.478 -
  77.479 -    override def paintComponent(gfx: Graphics)
  77.480 -    {
  77.481 -      super.paintComponent(gfx)
  77.482 -      Swing_Thread.assert()
  77.483 -
  77.484 -      val buffer = model.buffer
  77.485 -      Isabelle.buffer_lock(buffer) {
  77.486 -        val snapshot = model.snapshot()
  77.487 -
  77.488 -        def line_range(command: Command, start: Text.Offset): Option[(Int, Int)] =
  77.489 -        {
  77.490 -          try {
  77.491 -            val line1 = buffer.getLineOfOffset(snapshot.convert(start))
  77.492 -            val line2 = buffer.getLineOfOffset(snapshot.convert(start + command.length)) + 1
  77.493 -            Some((line1, line2))
  77.494 -          }
  77.495 -          catch { case e: ArrayIndexOutOfBoundsException => None }
  77.496 -        }
  77.497 -        for {
  77.498 -          (command, start) <- snapshot.node.command_starts
  77.499 -          if !command.is_ignored
  77.500 -          (line1, line2) <- line_range(command, start)
  77.501 -          val y = line_to_y(line1)
  77.502 -          val height = HEIGHT * (line2 - line1)
  77.503 -          color <- Isabelle_Markup.overview_color(snapshot, command)
  77.504 -        } {
  77.505 -          gfx.setColor(color)
  77.506 -          gfx.fillRect(0, y, getWidth - 1, height)
  77.507 -        }
  77.508 -      }
  77.509 -    }
  77.510 -
  77.511 -    private def line_to_y(line: Int): Int =
  77.512 -      (line * getHeight) / (text_area.getBuffer.getLineCount max text_area.getVisibleLines)
  77.513 -
  77.514 -    private def y_to_line(y: Int): Int =
  77.515 -      (y * (text_area.getBuffer.getLineCount max text_area.getVisibleLines)) / getHeight
  77.516 -  }
  77.517 -
  77.518 -
  77.519 -  /* main actor */
  77.520 -
  77.521 -  private val main_actor = actor {
  77.522 -    loop {
  77.523 -      react {
  77.524 -        case Session.Commands_Changed(changed) =>
  77.525 -          val buffer = model.buffer
  77.526 -          Isabelle.swing_buffer_lock(buffer) {
  77.527 -            val snapshot = model.snapshot()
  77.528 -
  77.529 -            if (changed.exists(snapshot.node.commands.contains))
  77.530 -              overview.repaint()
  77.531 -
  77.532 -            val visible_range = screen_lines_range()
  77.533 -            val visible_cmds = snapshot.node.command_range(snapshot.revert(visible_range)).map(_._1)
  77.534 -            if (visible_cmds.exists(changed)) {
  77.535 -              for {
  77.536 -                line <- 0 until text_area.getVisibleLines
  77.537 -                val start = text_area.getScreenLineStartOffset(line) if start >= 0
  77.538 -                val end = text_area.getScreenLineEndOffset(line) if end >= 0
  77.539 -                val range = proper_line_range(start, end)
  77.540 -                val line_cmds = snapshot.node.command_range(snapshot.revert(range)).map(_._1)
  77.541 -                if line_cmds.exists(changed)
  77.542 -              } text_area.invalidateScreenLineRange(line, line)
  77.543 -
  77.544 -              // FIXME danger of deadlock!?
  77.545 -              // FIXME potentially slow!?
  77.546 -              model.buffer.propertiesChanged()
  77.547 -            }
  77.548 -          }
  77.549 -
  77.550 -        case Session.Global_Settings => html_panel_resize()
  77.551 -
  77.552 -        case bad => System.err.println("command_change_actor: ignoring bad message " + bad)
  77.553 -      }
  77.554 -    }
  77.555 -  }
  77.556 -
  77.557 -
  77.558 -  /* activation */
  77.559 -
  77.560 -  private def activate()
  77.561 -  {
  77.562 -    val painter = text_area.getPainter
  77.563 -    painter.addExtension(TextAreaPainter.LINE_BACKGROUND_LAYER + 1, background_painter)
  77.564 -    painter.addExtension(TextAreaPainter.TEXT_LAYER + 1, text_painter)
  77.565 -    text_area.getGutter.addExtension(gutter_painter)
  77.566 -    text_area.addFocusListener(focus_listener)
  77.567 -    text_area.getView.addWindowListener(window_listener)
  77.568 -    painter.addMouseMotionListener(mouse_motion_listener)
  77.569 -    text_area.addCaretListener(caret_listener)
  77.570 -    text_area.addLeftOfScrollBar(overview)
  77.571 -    session.commands_changed += main_actor
  77.572 -    session.global_settings += main_actor
  77.573 -  }
  77.574 -
  77.575 -  private def deactivate()
  77.576 -  {
  77.577 -    val painter = text_area.getPainter
  77.578 -    session.commands_changed -= main_actor
  77.579 -    session.global_settings -= main_actor
  77.580 -    text_area.removeFocusListener(focus_listener)
  77.581 -    text_area.getView.removeWindowListener(window_listener)
  77.582 -    painter.removeMouseMotionListener(mouse_motion_listener)
  77.583 -    text_area.removeCaretListener(caret_listener)
  77.584 -    text_area.removeLeftOfScrollBar(overview)
  77.585 -    text_area.getGutter.removeExtension(gutter_painter)
  77.586 -    painter.removeExtension(text_painter)
  77.587 -    painter.removeExtension(background_painter)
  77.588 -    exit_popup()
  77.589 -  }
  77.590 -}
    78.1 --- a/src/Tools/jEdit/src/jedit/html_panel.scala	Wed Jun 08 17:01:07 2011 +0200
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,206 +0,0 @@
    78.4 -/*  Title:      Tools/jEdit/src/jedit/html_panel.scala
    78.5 -    Author:     Makarius
    78.6 -
    78.7 -HTML panel based on Lobo/Cobra.
    78.8 -*/
    78.9 -
   78.10 -package isabelle.jedit
   78.11 -
   78.12 -
   78.13 -import isabelle._
   78.14 -
   78.15 -import java.io.StringReader
   78.16 -import java.awt.{Font, BorderLayout, Dimension, GraphicsEnvironment, Toolkit, FontMetrics}
   78.17 -import java.awt.event.MouseEvent
   78.18 -
   78.19 -import java.util.logging.{Logger, Level}
   78.20 -
   78.21 -import org.w3c.dom.html2.HTMLElement
   78.22 -
   78.23 -import org.lobobrowser.html.parser.{DocumentBuilderImpl, InputSourceImpl}
   78.24 -import org.lobobrowser.html.gui.HtmlPanel
   78.25 -import org.lobobrowser.html.domimpl.{HTMLDocumentImpl, HTMLStyleElementImpl, NodeImpl}
   78.26 -import org.lobobrowser.html.test.{SimpleHtmlRendererContext, SimpleUserAgentContext}
   78.27 -
   78.28 -import scala.actors.Actor._
   78.29 -
   78.30 -
   78.31 -object HTML_Panel
   78.32 -{
   78.33 -  sealed abstract class Event { val element: HTMLElement; val mouse: MouseEvent }
   78.34 -  case class Context_Menu(val element: HTMLElement, mouse: MouseEvent) extends Event
   78.35 -  case class Mouse_Click(val element: HTMLElement, mouse: MouseEvent) extends Event
   78.36 -  case class Double_Click(val element: HTMLElement, mouse: MouseEvent) extends Event
   78.37 -  case class Mouse_Over(val element: HTMLElement, mouse: MouseEvent) extends Event
   78.38 -  case class Mouse_Out(val element: HTMLElement, mouse: MouseEvent) extends Event
   78.39 -}
   78.40 -
   78.41 -
   78.42 -class HTML_Panel(
   78.43 -    system: Isabelle_System,
   78.44 -    initial_font_family: String,
   78.45 -    initial_font_size: Int)
   78.46 -  extends HtmlPanel
   78.47 -{
   78.48 -  /** Lobo setup **/
   78.49 -
   78.50 -  /* global logging */
   78.51 -
   78.52 -  Logger.getLogger("org.lobobrowser").setLevel(Level.WARNING)
   78.53 -
   78.54 -
   78.55 -  /* pixel size -- cf. org.lobobrowser.html.style.HtmlValues.getFontSize */
   78.56 -
   78.57 -  val screen_resolution =
   78.58 -    if (GraphicsEnvironment.isHeadless()) 72
   78.59 -    else Toolkit.getDefaultToolkit().getScreenResolution()
   78.60 -
   78.61 -  def lobo_px(raw_px: Int): Int = raw_px * 96 / screen_resolution
   78.62 -  def raw_px(lobo_px: Int): Int = (lobo_px * screen_resolution + 95) / 96
   78.63 -
   78.64 -
   78.65 -  /* contexts and event handling */
   78.66 -
   78.67 -  protected val handler: PartialFunction[HTML_Panel.Event, Unit] = Library.undefined
   78.68 -
   78.69 -  private val ucontext = new SimpleUserAgentContext
   78.70 -  private val rcontext = new SimpleHtmlRendererContext(this, ucontext)
   78.71 -  {
   78.72 -    private def handle(event: HTML_Panel.Event): Boolean =
   78.73 -      if (handler.isDefinedAt(event)) { handler(event); false }
   78.74 -      else true
   78.75 -
   78.76 -    override def onContextMenu(elem: HTMLElement, event: MouseEvent): Boolean =
   78.77 -      handle(HTML_Panel.Context_Menu(elem, event))
   78.78 -    override def onMouseClick(elem: HTMLElement, event: MouseEvent): Boolean =
   78.79 -      handle(HTML_Panel.Mouse_Click(elem, event))
   78.80 -    override def onDoubleClick(elem: HTMLElement, event: MouseEvent): Boolean =
   78.81 -      handle(HTML_Panel.Double_Click(elem, event))
   78.82 -    override def onMouseOver(elem: HTMLElement, event: MouseEvent)
   78.83 -      { handle(HTML_Panel.Mouse_Over(elem, event)) }
   78.84 -    override def onMouseOut(elem: HTMLElement, event: MouseEvent)
   78.85 -      { handle(HTML_Panel.Mouse_Out(elem, event)) }
   78.86 -  }
   78.87 -
   78.88 -  private val builder = new DocumentBuilderImpl(ucontext, rcontext)
   78.89 -
   78.90 -
   78.91 -  /* document template with style sheets */
   78.92 -
   78.93 -  private val template_head =
   78.94 -    """<?xml version="1.0" encoding="utf-8"?>
   78.95 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   78.96 -  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   78.97 -<html xmlns="http://www.w3.org/1999/xhtml">
   78.98 -<head>
   78.99 -<style media="all" type="text/css">
  78.100 -""" +
  78.101 -  system.try_read(system.getenv_strict("JEDIT_STYLE_SHEETS").split(":"))
  78.102 -
  78.103 -  private val template_tail =
  78.104 -"""
  78.105 -</style>
  78.106 -</head>
  78.107 -<body/>
  78.108 -</html>
  78.109 -"""
  78.110 -
  78.111 -  private def template(font_family: String, font_size: Int): String =
  78.112 -    template_head +
  78.113 -    "body { font-family: " + font_family + "; font-size: " + raw_px(font_size) + "px; }" +
  78.114 -    template_tail
  78.115 -
  78.116 -
  78.117 -  /** main actor **/
  78.118 -
  78.119 -  /* internal messages */
  78.120 -
  78.121 -  private case class Resize(font_family: String, font_size: Int)
  78.122 -  private case class Render_Document(text: String)
  78.123 -  private case class Render(body: XML.Body)
  78.124 -  private case class Render_Sync(body: XML.Body)
  78.125 -  private case object Refresh
  78.126 -
  78.127 -  private val main_actor = actor {
  78.128 -
  78.129 -    /* internal state */
  78.130 -
  78.131 -    var current_font_metrics: FontMetrics = null
  78.132 -    var current_font_family = ""
  78.133 -    var current_font_size: Int = 0
  78.134 -    var current_margin: Int = 0
  78.135 -    var current_body: XML.Body = Nil
  78.136 -
  78.137 -    def resize(font_family: String, font_size: Int)
  78.138 -    {
  78.139 -      val font = new Font(font_family, Font.PLAIN, lobo_px(raw_px(font_size)))
  78.140 -      val (font_metrics, margin) =
  78.141 -        Swing_Thread.now {
  78.142 -          val metrics = getFontMetrics(font)
  78.143 -          (metrics, (getWidth() / (metrics.charWidth(Symbol.spc) max 1) - 4) max 20)
  78.144 -        }
  78.145 -      if (current_font_metrics == null ||
  78.146 -          current_font_family != font_family ||
  78.147 -          current_font_size != font_size ||
  78.148 -          current_margin != margin)
  78.149 -      {
  78.150 -        current_font_metrics = font_metrics
  78.151 -        current_font_family = font_family
  78.152 -        current_font_size = font_size
  78.153 -        current_margin = margin
  78.154 -        refresh()
  78.155 -      }
  78.156 -    }
  78.157 -
  78.158 -    def refresh() { render(current_body) }
  78.159 -
  78.160 -    def render_document(text: String)
  78.161 -    {
  78.162 -      val doc = builder.parse(new InputSourceImpl(new StringReader(text), "http://localhost"))
  78.163 -      Swing_Thread.later { setDocument(doc, rcontext) }
  78.164 -    }
  78.165 -
  78.166 -    def render(body: XML.Body)
  78.167 -    {
  78.168 -      current_body = body
  78.169 -      val html_body =
  78.170 -        current_body.flatMap(div =>
  78.171 -          Pretty.formatted(List(div), current_margin, Pretty.font_metric(current_font_metrics))
  78.172 -            .map(t =>
  78.173 -              XML.Elem(Markup(HTML.PRE, List((Markup.CLASS, Markup.MESSAGE))),
  78.174 -                HTML.spans(t, true))))
  78.175 -      val doc =
  78.176 -        builder.parse(
  78.177 -          new InputSourceImpl(
  78.178 -            new StringReader(template(current_font_family, current_font_size)), "http://localhost"))
  78.179 -      doc.removeChild(doc.getLastChild())
  78.180 -      doc.appendChild(XML.document_node(doc, XML.elem(HTML.BODY, html_body)))
  78.181 -      Swing_Thread.later { setDocument(doc, rcontext) }
  78.182 -    }
  78.183 -
  78.184 -
  78.185 -    /* main loop */
  78.186 -
  78.187 -    resize(initial_font_family, initial_font_size)
  78.188 -
  78.189 -    loop {
  78.190 -      react {
  78.191 -        case Resize(font_family, font_size) => resize(font_family, font_size)
  78.192 -        case Refresh => refresh()
  78.193 -        case Render_Document(text) => render_document(text)
  78.194 -        case Render(body) => render(body)
  78.195 -        case Render_Sync(body) => render(body); reply(())
  78.196 -        case bad => System.err.println("main_actor: ignoring bad message " + bad)
  78.197 -      }
  78.198 -    }
  78.199 -  }
  78.200 -
  78.201 -
  78.202 -  /* external methods */
  78.203 -
  78.204 -  def resize(font_family: String, font_size: Int) { main_actor ! Resize(font_family, font_size) }
  78.205 -  def refresh() { main_actor ! Refresh }
  78.206 -  def render_document(text: String) { main_actor ! Render_Document(text) }
  78.207 -  def render(body: XML.Body) { main_actor ! Render(body) }
  78.208 -  def render_sync(body: XML.Body) { main_actor !? Render_Sync(body) }
  78.209 -}
    79.1 --- a/src/Tools/jEdit/src/jedit/isabelle_encoding.scala	Wed Jun 08 17:01:07 2011 +0200
    79.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.3 @@ -1,65 +0,0 @@
    79.4 -/*  Title:      Tools/jEdit/src/jedit/isabelle_encoding.scala
    79.5 -    Author:     Makarius
    79.6 -
    79.7 -Isabelle encoding -- based on UTF-8.
    79.8 -*/
    79.9 -
   79.10 -package isabelle.jedit
   79.11 -
   79.12 -
   79.13 -import isabelle._
   79.14 -
   79.15 -import org.gjt.sp.jedit.io.Encoding
   79.16 -import org.gjt.sp.jedit.buffer.JEditBuffer
   79.17 -
   79.18 -import java.nio.charset.{Charset, CodingErrorAction}
   79.19 -import java.io.{InputStream, OutputStream, Reader, Writer, InputStreamReader, OutputStreamWriter,
   79.20 -  CharArrayReader, ByteArrayOutputStream}
   79.21 -
   79.22 -import scala.io.{Codec, Source, BufferedSource}
   79.23 -
   79.24 -
   79.25 -object Isabelle_Encoding
   79.26 -{
   79.27 -  val NAME = "UTF-8-Isabelle"
   79.28 -
   79.29 -  def is_active(buffer: JEditBuffer): Boolean =
   79.30 -    buffer.getStringProperty(JEditBuffer.ENCODING).asInstanceOf[String] == NAME
   79.31 -}
   79.32 -
   79.33 -class Isabelle_Encoding extends Encoding
   79.34 -{
   79.35 -  private val charset = Charset.forName(Standard_System.charset)
   79.36 -  val BUFSIZE = 32768
   79.37 -
   79.38 -  private def text_reader(in: InputStream, codec: Codec): Reader =
   79.39 -  {
   79.40 -    val source = new BufferedSource(in)(codec)
   79.41 -    new CharArrayReader(Isabelle.system.symbols.decode(source.mkString).toArray)
   79.42 -  }
   79.43 -
   79.44 -  override def getTextReader(in: InputStream): Reader =
   79.45 -    text_reader(in, Standard_System.codec())
   79.46 -
   79.47 -  override def getPermissiveTextReader(in: InputStream): Reader =
   79.48 -  {
   79.49 -    val codec = Standard_System.codec()
   79.50 -    codec.onMalformedInput(CodingErrorAction.REPLACE)
   79.51 -    codec.onUnmappableCharacter(CodingErrorAction.REPLACE)
   79.52 -    text_reader(in, codec)
   79.53 -  }
   79.54 -
   79.55 -  override def getTextWriter(out: OutputStream): Writer =
   79.56 -  {
   79.57 -    val buffer = new ByteArrayOutputStream(BUFSIZE) {
   79.58 -      override def flush()
   79.59 -      {
   79.60 -        val text = Isabelle.system.symbols.encode(toString(Standard_System.charset))
   79.61 -        out.write(text.getBytes(Standard_System.charset))
   79.62 -        out.flush()
   79.63 -      }
   79.64 -      override def close() { out.close() }
   79.65 -    }
   79.66 -    new OutputStreamWriter(buffer, charset.newEncoder())
   79.67 -  }
   79.68 -}
    80.1 --- a/src/Tools/jEdit/src/jedit/isabelle_hyperlinks.scala	Wed Jun 08 17:01:07 2011 +0200
    80.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.3 @@ -1,88 +0,0 @@
    80.4 -/*  Title:      Tools/jEdit/src/jedit/isabelle_hyperlinks.scala
    80.5 -    Author:     Fabian Immler, TU Munich
    80.6 -
    80.7 -Hyperlink setup for Isabelle proof documents.
    80.8 -*/
    80.9 -
   80.10 -package isabelle.jedit
   80.11 -
   80.12 -
   80.13 -import isabelle._
   80.14 -
   80.15 -import java.io.File
   80.16 -
   80.17 -import gatchan.jedit.hyperlinks.{Hyperlink, HyperlinkSource, AbstractHyperlink}
   80.18 -
   80.19 -import org.gjt.sp.jedit.{View, jEdit, Buffer, TextUtilities}
   80.20 -
   80.21 -
   80.22 -private class Internal_Hyperlink(start: Int, end: Int, line: Int, def_offset: Int)
   80.23 -  extends AbstractHyperlink(start, end, line, "")
   80.24 -{
   80.25 -  override def click(view: View) {
   80.26 -    view.getTextArea.moveCaretPosition(def_offset)
   80.27 -  }
   80.28 -}
   80.29 -
   80.30 -class External_Hyperlink(start: Int, end: Int, line: Int, def_file: String, def_line: Int)
   80.31 -  extends AbstractHyperlink(start, end, line, "")
   80.32 -{
   80.33 -  override def click(view: View) = {
   80.34 -    Isabelle.system.source_file(def_file) match {
   80.35 -      case None =>
   80.36 -        Library.error_dialog(view, "File not found", "Could not find source file " + def_file)
   80.37 -      case Some(file) =>
   80.38 -        jEdit.openFiles(view, file.getParent, Array(file.getName, "+line:" + def_line))
   80.39 -    }
   80.40 -  }
   80.41 -}
   80.42 -
   80.43 -class Isabelle_Hyperlinks extends HyperlinkSource
   80.44 -{
   80.45 -  def getHyperlink(buffer: Buffer, buffer_offset: Int): Hyperlink =
   80.46 -  {
   80.47 -    Swing_Thread.assert()
   80.48 -    Isabelle.buffer_lock(buffer) {
   80.49 -      Document_Model(buffer) match {
   80.50 -        case Some(model) =>
   80.51 -          val snapshot = model.snapshot()
   80.52 -          val markup =
   80.53 -            snapshot.select_markup(Text.Range(buffer_offset, buffer_offset + 1)) {
   80.54 -              // FIXME Isar_Document.Hyperlink extractor
   80.55 -              case Text.Info(info_range,
   80.56 -                  XML.Elem(Markup(Markup.ENTITY, props), _))
   80.57 -                if (props.find(
   80.58 -                  { case (Markup.KIND, Markup.ML_OPEN) => true
   80.59 -                    case (Markup.KIND, Markup.ML_STRUCT) => true
   80.60 -                    case _ => false }).isEmpty) =>
   80.61 -                val Text.Range(begin, end) = info_range
   80.62 -                val line = buffer.getLineOfOffset(begin)
   80.63 -                (Position.File.unapply(props), Position.Line.unapply(props)) match {
   80.64 -                  case (Some(def_file), Some(def_line)) =>
   80.65 -                    new External_Hyperlink(begin, end, line, def_file, def_line)
   80.66 -                  case _ =>
   80.67 -                    (props, props) match {
   80.68 -                      case (Position.Id(def_id), Position.Offset(def_offset)) =>
   80.69 -                        snapshot.lookup_command(def_id) match {
   80.70 -                          case Some(def_cmd) =>
   80.71 -                            snapshot.node.command_start(def_cmd) match {
   80.72 -                              case Some(def_cmd_start) =>
   80.73 -                                new Internal_Hyperlink(begin, end, line,
   80.74 -                                  snapshot.convert(def_cmd_start + def_cmd.decode(def_offset)))
   80.75 -                              case None => null
   80.76 -                            }
   80.77 -                          case None => null
   80.78 -                        }
   80.79 -                      case _ => null
   80.80 -                    }
   80.81 -                }
   80.82 -            }
   80.83 -          markup match {
   80.84 -            case Text.Info(_, Some(link)) #:: _ => link
   80.85 -            case _ => null
   80.86 -          }
   80.87 -        case None => null
   80.88 -      }
   80.89 -    }
   80.90 -  }
   80.91 -}
    81.1 --- a/src/Tools/jEdit/src/jedit/isabelle_markup.scala	Wed Jun 08 17:01:07 2011 +0200
    81.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.3 @@ -1,216 +0,0 @@
    81.4 -/*  Title:      Tools/jEdit/src/jedit/isabelle_markup.scala
    81.5 -    Author:     Makarius
    81.6 -
    81.7 -Isabelle specific physical rendering and markup selection.
    81.8 -*/
    81.9 -
   81.10 -package isabelle.jedit
   81.11 -
   81.12 -
   81.13 -import isabelle._
   81.14 -
   81.15 -import java.awt.Color
   81.16 -
   81.17 -import org.gjt.sp.jedit.syntax.Token
   81.18 -
   81.19 -
   81.20 -object Isabelle_Markup
   81.21 -{
   81.22 -  /* physical rendering */
   81.23 -
   81.24 -  val outdated_color = new Color(240, 240, 240)
   81.25 -  val unfinished_color = new Color(255, 228, 225)
   81.26 -
   81.27 -  val light_color = new Color(240, 240, 240)
   81.28 -  val regular_color = new Color(192, 192, 192)
   81.29 -  val warning_color = new Color(255, 140, 0)
   81.30 -  val error_color = new Color(178, 34, 34)
   81.31 -  val bad_color = new Color(255, 106, 106, 100)
   81.32 -  val hilite_color = new Color(255, 204, 102, 100)
   81.33 -
   81.34 -  class Icon(val priority: Int, val icon: javax.swing.Icon)
   81.35 -  {
   81.36 -    def >= (that: Icon): Boolean = this.priority >= that.priority
   81.37 -  }
   81.38 -  val warning_icon = new Icon(1, Isabelle.load_icon("16x16/status/dialog-warning.png"))
   81.39 -  val error_icon = new Icon(2, Isabelle.load_icon("16x16/status/dialog-error.png"))
   81.40 -
   81.41 -
   81.42 -  /* command status */
   81.43 -
   81.44 -  def status_color(snapshot: Document.Snapshot, command: Command): Option[Color] =
   81.45 -  {
   81.46 -    val state = snapshot.state(command)
   81.47 -    if (snapshot.is_outdated) Some(outdated_color)
   81.48 -    else
   81.49 -      Isar_Document.command_status(state.status) match {
   81.50 -        case Isar_Document.Forked(i) if i > 0 => Some(unfinished_color)
   81.51 -        case Isar_Document.Unprocessed => Some(unfinished_color)
   81.52 -        case _ => None
   81.53 -      }
   81.54 -  }
   81.55 -
   81.56 -  def overview_color(snapshot: Document.Snapshot, command: Command): Option[Color] =
   81.57 -  {
   81.58 -    val state = snapshot.state(command)
   81.59 -    if (snapshot.is_outdated) None
   81.60 -    else
   81.61 -      Isar_Document.command_status(state.status) match {
   81.62 -        case Isar_Document.Forked(i) => if (i > 0) Some(unfinished_color) else None
   81.63 -        case Isar_Document.Unprocessed => Some(unfinished_color)
   81.64 -        case Isar_Document.Failed => Some(error_color)
   81.65 -        case Isar_Document.Finished =>
   81.66 -          if (state.results.exists(r => Isar_Document.is_error(r._2))) Some(error_color)
   81.67 -          else if (state.results.exists(r => Isar_Document.is_warning(r._2))) Some(warning_color)
   81.68 -          else None
   81.69 -      }
   81.70 -  }
   81.71 -
   81.72 -
   81.73 -  /* markup selectors */
   81.74 -
   81.75 -  val message: Markup_Tree.Select[Color] =
   81.76 -  {
   81.77 -    case Text.Info(_, XML.Elem(Markup(Markup.WRITELN, _), _)) => regular_color
   81.78 -    case Text.Info(_, XML.Elem(Markup(Markup.WARNING, _), _)) => warning_color
   81.79 -    case Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _)) => error_color
   81.80 -  }
   81.81 -
   81.82 -  val popup: Markup_Tree.Select[String] =
   81.83 -  {
   81.84 -    case Text.Info(_, msg @ XML.Elem(Markup(markup, _), _))
   81.85 -    if markup == Markup.WRITELN || markup == Markup.WARNING || markup == Markup.ERROR =>
   81.86 -      Pretty.string_of(List(msg), margin = Isabelle.Int_Property("tooltip-margin"))
   81.87 -  }
   81.88 -
   81.89 -  val gutter_message: Markup_Tree.Select[Icon] =
   81.90 -  {
   81.91 -    case Text.Info(_, XML.Elem(Markup(Markup.WARNING, _), _)) => warning_icon
   81.92 -    case Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _)) => error_icon
   81.93 -  }
   81.94 -
   81.95 -  val background1: Markup_Tree.Select[Color] =
   81.96 -  {
   81.97 -    case Text.Info(_, XML.Elem(Markup(Markup.BAD, _), _)) => bad_color
   81.98 -    case Text.Info(_, XML.Elem(Markup(Markup.HILITE, _), _)) => hilite_color
   81.99 -  }
  81.100 -
  81.101 -  val background2: Markup_Tree.Select[Color] =
  81.102 -  {
  81.103 -    case Text.Info(_, XML.Elem(Markup(Markup.TOKEN_RANGE, _), _)) => light_color
  81.104 -  }
  81.105 -
  81.106 -  val tooltip: Markup_Tree.Select[String] =
  81.107 -  {
  81.108 -    case Text.Info(_, XML.Elem(Markup.Entity(kind, name), _)) => kind + " \"" + name + "\""
  81.109 -    case Text.Info(_, XML.Elem(Markup(Markup.ML_TYPING, _), body)) =>
  81.110 -      Pretty.string_of(List(Pretty.block(XML.Text("ML:") :: Pretty.Break(1) :: body)),
  81.111 -        margin = Isabelle.Int_Property("tooltip-margin"))
  81.112 -    case Text.Info(_, XML.Elem(Markup(Markup.SORT, _), _)) => "sort"
  81.113 -    case Text.Info(_, XML.Elem(Markup(Markup.TYP, _), _)) => "type"
  81.114 -    case Text.Info(_, XML.Elem(Markup(Markup.TERM, _), _)) => "term"
  81.115 -    case Text.Info(_, XML.Elem(Markup(Markup.PROP, _), _)) => "proposition"
  81.116 -    case Text.Info(_, XML.Elem(Markup(Markup.TOKEN_RANGE, _), _)) => "inner syntax token"
  81.117 -    case Text.Info(_, XML.Elem(Markup(Markup.FREE, _), _)) => "free variable (globally fixed)"
  81.118 -    case Text.Info(_, XML.Elem(Markup(Markup.SKOLEM, _), _)) => "skolem variable (locally fixed)"
  81.119 -    case Text.Info(_, XML.Elem(Markup(Markup.BOUND, _), _)) => "bound variable (internally fixed)"
  81.120 -    case Text.Info(_, XML.Elem(Markup(Markup.VAR, _), _)) => "schematic variable"
  81.121 -    case Text.Info(_, XML.Elem(Markup(Markup.TFREE, _), _)) => "free type variable"
  81.122 -    case Text.Info(_, XML.Elem(Markup(Markup.TVAR, _), _)) => "schematic type variable"
  81.123 -  }
  81.124 -
  81.125 -  private val subexp_include =
  81.126 -    Set(Markup.SORT, Markup.TYP, Markup.TERM, Markup.PROP, Markup.ML_TYPING, Markup.TOKEN_RANGE,
  81.127 -      Markup.ENTITY, Markup.FREE, Markup.SKOLEM, Markup.BOUND, Markup.VAR,
  81.128 -      Markup.TFREE, Markup.TVAR)
  81.129 -
  81.130 -  val subexp: Markup_Tree.Select[(Text.Range, Color)] =
  81.131 -  {
  81.132 -    case Text.Info(range, XML.Elem(Markup(name, _), _)) if subexp_include(name) =>
  81.133 -      (range, Color.black)
  81.134 -  }
  81.135 -
  81.136 -
  81.137 -  /* token markup -- text styles */
  81.138 -
  81.139 -  private val command_style: Map[String, Byte] =
  81.140 -  {
  81.141 -    import Token._
  81.142 -    Map[String, Byte](
  81.143 -      Keyword.THY_END -> KEYWORD2,
  81.144 -      Keyword.THY_SCRIPT -> LABEL,
  81.145 -      Keyword.PRF_SCRIPT -> LABEL,
  81.146 -      Keyword.PRF_ASM -> KEYWORD3,
  81.147 -      Keyword.PRF_ASM_GOAL -> KEYWORD3
  81.148 -    ).withDefaultValue(KEYWORD1)
  81.149 -  }
  81.150 -
  81.151 -  private val token_style: Map[String, Byte] =
  81.152 -  {
  81.153 -    import Token._
  81.154 -    Map[String, Byte](
  81.155 -      // logical entities
  81.156 -      Markup.TCLASS -> NULL,
  81.157 -      Markup.TYCON -> NULL,
  81.158 -      Markup.FIXED -> NULL,
  81.159 -      Markup.CONST -> LITERAL2,
  81.160 -      Markup.DYNAMIC_FACT -> LABEL,
  81.161 -      // inner syntax
  81.162 -      Markup.TFREE -> NULL,
  81.163 -      Markup.FREE -> MARKUP,
  81.164 -      Markup.TVAR -> NULL,
  81.165 -      Markup.SKOLEM -> COMMENT2,
  81.166 -      Markup.BOUND -> LABEL,
  81.167 -      Markup.VAR -> NULL,
  81.168 -      Markup.NUM -> DIGIT,
  81.169 -      Markup.FLOAT -> DIGIT,
  81.170 -      Markup.XNUM -> DIGIT,
  81.171 -      Markup.XSTR -> LITERAL4,
  81.172 -      Markup.LITERAL -> OPERATOR,
  81.173 -      Markup.INNER_COMMENT -> COMMENT1,
  81.174 -      Markup.SORT -> NULL,
  81.175 -      Markup.TYP -> NULL,
  81.176 -      Markup.TERM -> NULL,
  81.177 -      Markup.PROP -> NULL,
  81.178 -      // ML syntax
  81.179 -      Markup.ML_KEYWORD -> KEYWORD1,
  81.180 -      Markup.ML_DELIMITER -> OPERATOR,
  81.181 -      Markup.ML_IDENT -> NULL,
  81.182 -      Markup.ML_TVAR -> NULL,
  81.183 -      Markup.ML_NUMERAL -> DIGIT,
  81.184 -      Markup.ML_CHAR -> LITERAL1,
  81.185 -      Markup.ML_STRING -> LITERAL1,
  81.186 -      Markup.ML_COMMENT -> COMMENT1,
  81.187 -      Markup.ML_MALFORMED -> INVALID,
  81.188 -      // embedded source text
  81.189 -      Markup.ML_SOURCE -> COMMENT3,
  81.190 -      Markup.DOC_SOURCE -> COMMENT3,
  81.191 -      Markup.ANTIQ -> COMMENT4,
  81.192 -      Markup.ML_ANTIQ -> COMMENT4,
  81.193 -      Markup.DOC_ANTIQ -> COMMENT4,
  81.194 -      // outer syntax
  81.195 -      Markup.KEYWORD -> KEYWORD2,
  81.196 -      Markup.OPERATOR -> OPERATOR,
  81.197 -      Markup.COMMAND -> KEYWORD1,
  81.198 -      Markup.IDENT -> NULL,
  81.199 -      Markup.VERBATIM -> COMMENT3,
  81.200 -      Markup.COMMENT -> COMMENT1,
  81.201 -      Markup.CONTROL -> COMMENT3,
  81.202 -      Markup.MALFORMED -> INVALID,
  81.203 -      Markup.STRING -> LITERAL3,
  81.204 -      Markup.ALTSTRING -> LITERAL1
  81.205 -    ).withDefaultValue(NULL)
  81.206 -  }
  81.207 -
  81.208 -  def tokens(syntax: Outer_Syntax): Markup_Tree.Select[Byte] =
  81.209 -  {
  81.210 -    case Text.Info(_, XML.Elem(Markup(Markup.COMMAND, List((Markup.NAME, name))), _))
  81.211 -    if syntax.keyword_kind(name).isDefined => command_style(syntax.keyword_kind(name).get)
  81.212 -
  81.213 -    case Text.Info(_, XML.Elem(Markup(Markup.ENTITY, Markup.Kind(kind)), _))
  81.214 -    if token_style(kind) != Token.NULL => token_style(kind)
  81.215 -
  81.216 -    case Text.Info(_, XML.Elem(Markup(name, _), _))
  81.217 -    if token_style(name) != Token.NULL => token_style(name)
  81.218 -  }
  81.219 -}
    82.1 --- a/src/Tools/jEdit/src/jedit/isabelle_options.scala	Wed Jun 08 17:01:07 2011 +0200
    82.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.3 @@ -1,67 +0,0 @@
    82.4 -/*  Title:      Tools/jEdit/src/jedit/isabelle_options.scala
    82.5 -    Author:     Johannes Hölzl, TU Munich
    82.6 -
    82.7 -Editor pane for plugin options.
    82.8 -*/
    82.9 -
   82.10 -package isabelle.jedit
   82.11 -
   82.12 -
   82.13 -import isabelle._
   82.14 -
   82.15 -import javax.swing.JSpinner
   82.16 -
   82.17 -import scala.swing.CheckBox
   82.18 -
   82.19 -import org.gjt.sp.jedit.AbstractOptionPane
   82.20 -
   82.21 -
   82.22 -class Isabelle_Options extends AbstractOptionPane("isabelle")
   82.23 -{
   82.24 -  private val logic_selector = Isabelle.logic_selector(Isabelle.Property("logic"))
   82.25 -  private val auto_start = new CheckBox()
   82.26 -  private val relative_font_size = new JSpinner()
   82.27 -  private val tooltip_font_size = new JSpinner()
   82.28 -  private val tooltip_margin = new JSpinner()
   82.29 -  private val tooltip_dismiss_delay = new JSpinner()
   82.30 -
   82.31 -  override def _init()
   82.32 -  {
   82.33 -    addComponent(Isabelle.Property("logic.title"), logic_selector.peer)
   82.34 -
   82.35 -    addComponent(Isabelle.Property("auto-start.title"), auto_start.peer)
   82.36 -    auto_start.selected = Isabelle.Boolean_Property("auto-start")
   82.37 -
   82.38 -    relative_font_size.setValue(Isabelle.Int_Property("relative-font-size", 100))
   82.39 -    addComponent(Isabelle.Property("relative-font-size.title"), relative_font_size)
   82.40 -
   82.41 -    tooltip_font_size.setValue(Isabelle.Int_Property("tooltip-font-size", 10))
   82.42 -    addComponent(Isabelle.Property("tooltip-font-size.title"), tooltip_font_size)
   82.43 -
   82.44 -    tooltip_margin.setValue(Isabelle.Int_Property("tooltip-margin", 40))
   82.45 -    addComponent(Isabelle.Property("tooltip-margin.title"), tooltip_margin)
   82.46 -
   82.47 -    tooltip_dismiss_delay.setValue(
   82.48 -      Isabelle.Time_Property("tooltip-dismiss-delay", Time.seconds(8.0)).ms.toInt)
   82.49 -    addComponent(Isabelle.Property("tooltip-dismiss-delay.title"), tooltip_dismiss_delay)
   82.50 -  }
   82.51 -
   82.52 -  override def _save()
   82.53 -  {
   82.54 -    Isabelle.Property("logic") = logic_selector.selection.item.name
   82.55 -
   82.56 -    Isabelle.Boolean_Property("auto-start") = auto_start.selected
   82.57 -
   82.58 -    Isabelle.Int_Property("relative-font-size") =
   82.59 -      relative_font_size.getValue().asInstanceOf[Int]
   82.60 -
   82.61 -    Isabelle.Int_Property("tooltip-font-size") =
   82.62 -      tooltip_font_size.getValue().asInstanceOf[Int]
   82.63 -
   82.64 -    Isabelle.Int_Property("tooltip-margin") =
   82.65 -      tooltip_margin.getValue().asInstanceOf[Int]
   82.66 -
   82.67 -    Isabelle.Time_Property("tooltip-dismiss-delay") =
   82.68 -      Time.seconds(tooltip_dismiss_delay.getValue().asInstanceOf[Int])
   82.69 -  }
   82.70 -}
    83.1 --- a/src/Tools/jEdit/src/jedit/isabelle_sidekick.scala	Wed Jun 08 17:01:07 2011 +0200
    83.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.3 @@ -1,176 +0,0 @@
    83.4 -/*  Title:      Tools/jEdit/src/jedit/isabelle_sidekick.scala
    83.5 -    Author:     Fabian Immler, TU Munich
    83.6 -    Author:     Makarius
    83.7 -
    83.8 -SideKick parsers for Isabelle proof documents.
    83.9 -*/
   83.10 -
   83.11 -package isabelle.jedit
   83.12 -
   83.13 -
   83.14 -import isabelle._
   83.15 -
   83.16 -import scala.collection.Set
   83.17 -import scala.collection.immutable.TreeSet
   83.18 -
   83.19 -import javax.swing.tree.DefaultMutableTreeNode
   83.20 -import javax.swing.text.Position
   83.21 -import javax.swing.Icon
   83.22 -
   83.23 -import org.gjt.sp.jedit.{Buffer, EditPane, TextUtilities, View}
   83.24 -import errorlist.DefaultErrorSource
   83.25 -import sidekick.{SideKickParser, SideKickParsedData, SideKickCompletion, IAsset}
   83.26 -
   83.27 -
   83.28 -object Isabelle_Sidekick
   83.29 -{
   83.30 -  def int_to_pos(offset: Text.Offset): Position =
   83.31 -    new Position { def getOffset = offset; override def toString = offset.toString }
   83.32 -
   83.33 -  class Asset(name: String, start: Text.Offset, end: Text.Offset) extends IAsset
   83.34 -  {
   83.35 -    protected var _name = name
   83.36 -    protected var _start = int_to_pos(start)
   83.37 -    protected var _end = int_to_pos(end)
   83.38 -    override def getIcon: Icon = null
   83.39 -    override def getShortString: String = _name
   83.40 -    override def getLongString: String = _name
   83.41 -    override def getName: String = _name
   83.42 -    override def setName(name: String) = _name = name
   83.43 -    override def getStart: Position = _start
   83.44 -    override def setStart(start: Position) = _start = start
   83.45 -    override def getEnd: Position = _end
   83.46 -    override def setEnd(end: Position) = _end = end
   83.47 -    override def toString = _name
   83.48 -  }
   83.49 -}
   83.50 -
   83.51 -
   83.52 -abstract class Isabelle_Sidekick(name: String) extends SideKickParser(name)
   83.53 -{
   83.54 -  /* parsing */
   83.55 -
   83.56 -  @volatile protected var stopped = false
   83.57 -  override def stop() = { stopped = true }
   83.58 -
   83.59 -  def parser(data: SideKickParsedData, model: Document_Model): Unit
   83.60 -
   83.61 -  def parse(buffer: Buffer, error_source: DefaultErrorSource): SideKickParsedData =
   83.62 -  {
   83.63 -    stopped = false
   83.64 -
   83.65 -    // FIXME lock buffer (!??)
   83.66 -    val data = new SideKickParsedData(buffer.getName)
   83.67 -    val root = data.root
   83.68 -    data.getAsset(root).setEnd(Isabelle_Sidekick.int_to_pos(buffer.getLength))
   83.69 -
   83.70 -    Swing_Thread.now { Document_Model(buffer) } match {
   83.71 -      case Some(model) =>
   83.72 -        parser(data, model)
   83.73 -        if (stopped) root.add(new DefaultMutableTreeNode("<parser stopped>"))
   83.74 -      case None => root.add(new DefaultMutableTreeNode("<buffer inactive>"))
   83.75 -    }
   83.76 -    data
   83.77 -  }
   83.78 -
   83.79 -
   83.80 -  /* completion */
   83.81 -
   83.82 -  override def supportsCompletion = true
   83.83 -  override def canCompleteAnywhere = true
   83.84 -
   83.85 -  override def complete(pane: EditPane, caret: Text.Offset): SideKickCompletion =
   83.86 -  {
   83.87 -    val buffer = pane.getBuffer
   83.88 -    Isabelle.swing_buffer_lock(buffer) {
   83.89 -      Document_Model(buffer) match {
   83.90 -        case None => null
   83.91 -        case Some(model) =>
   83.92 -          val line = buffer.getLineOfOffset(caret)
   83.93 -          val start = buffer.getLineStartOffset(line)
   83.94 -          val text = buffer.getSegment(start, caret - start)
   83.95 -
   83.96 -          val completion = model.session.current_syntax().completion
   83.97 -          completion.complete(text) match {
   83.98 -            case None => null
   83.99 -            case Some((word, cs)) =>
  83.100 -              val ds =
  83.101 -                (if (Isabelle_Encoding.is_active(buffer))
  83.102 -                  cs.map(Isabelle.system.symbols.decode(_)).sortWith(_ < _)
  83.103 -                 else cs).filter(_ != word)
  83.104 -              if (ds.isEmpty) null
  83.105 -              else new SideKickCompletion(
  83.106 -                pane.getView, word, ds.toArray.asInstanceOf[Array[Object]]) { }
  83.107 -          }
  83.108 -      }
  83.109 -    }
  83.110 -  }
  83.111 -}
  83.112 -
  83.113 -
  83.114 -class Isabelle_Sidekick_Default extends Isabelle_Sidekick("isabelle")
  83.115 -{
  83.116 -  import Thy_Syntax.Structure
  83.117 -
  83.118 -  def parser(data: SideKickParsedData, model: Document_Model)
  83.119 -  {
  83.120 -    val syntax = model.session.current_syntax()
  83.121 -
  83.122 -    def make_tree(offset: Text.Offset, entry: Structure.Entry): List[DefaultMutableTreeNode] =
  83.123 -      entry match {
  83.124 -        case Structure.Block(name, body) =>
  83.125 -          val node =
  83.126 -            new DefaultMutableTreeNode(
  83.127 -              new Isabelle_Sidekick.Asset(Library.first_line(name), offset, offset + entry.length))
  83.128 -          (offset /: body)((i, e) =>
  83.129 -            {
  83.130 -              make_tree(i, e) foreach (nd => node.add(nd))
  83.131 -              i + e.length
  83.132 -            })
  83.133 -          List(node)
  83.134 -        case Structure.Atom(command)
  83.135 -        if command.is_command && syntax.heading_level(command).isEmpty =>
  83.136 -          val node =
  83.137 -            new DefaultMutableTreeNode(
  83.138 -              new Isabelle_Sidekick.Asset(command.name, offset, offset + entry.length))
  83.139 -          List(node)
  83.140 -        case _ => Nil
  83.141 -      }
  83.142 -
  83.143 -    val text = Isabelle.buffer_text(model.buffer)
  83.144 -    val structure = Structure.parse(syntax, "theory " + model.thy_name, text)
  83.145 -
  83.146 -    make_tree(0, structure) foreach (node => data.root.add(node))
  83.147 -  }
  83.148 -}
  83.149 -
  83.150 -
  83.151 -class Isabelle_Sidekick_Raw extends Isabelle_Sidekick("isabelle-raw")
  83.152 -{
  83.153 -  def parser(data: SideKickParsedData, model: Document_Model)
  83.154 -  {
  83.155 -    val root = data.root
  83.156 -    val snapshot = Swing_Thread.now { model.snapshot() }  // FIXME cover all nodes (!??)
  83.157 -    for ((command, command_start) <- snapshot.node.command_range() if !stopped) {
  83.158 -      snapshot.state(command).root_markup.swing_tree(root)((info: Text.Info[Any]) =>
  83.159 -          {
  83.160 -            val range = info.range + command_start
  83.161 -            val content = command.source(info.range).replace('\n', ' ')
  83.162 -            val info_text =
  83.163 -              info.info match {
  83.164 -                case elem @ XML.Elem(_, _) =>
  83.165 -                  Pretty.formatted(List(elem), margin = 40).mkString("\n")
  83.166 -                case x => x.toString
  83.167 -              }
  83.168 -
  83.169 -            new DefaultMutableTreeNode(
  83.170 -              new Isabelle_Sidekick.Asset(command.toString, range.start, range.stop) {
  83.171 -                override def getShortString: String = content
  83.172 -                override def getLongString: String = info_text
  83.173 -                override def toString = "\"" + content + "\" " + range.toString
  83.174 -              })
  83.175 -          })
  83.176 -    }
  83.177 -  }
  83.178 -}
  83.179 -
    84.1 --- a/src/Tools/jEdit/src/jedit/output_dockable.scala	Wed Jun 08 17:01:07 2011 +0200
    84.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.3 @@ -1,163 +0,0 @@
    84.4 -/*  Title:      Tools/jEdit/src/jedit/output_dockable.scala
    84.5 -    Author:     Makarius
    84.6 -
    84.7 -Dockable window with result message output.
    84.8 -*/
    84.9 -
   84.10 -package isabelle.jedit
   84.11 -
   84.12 -
   84.13 -import isabelle._
   84.14 -
   84.15 -import scala.actors.Actor._
   84.16 -
   84.17 -import scala.swing.{FlowPanel, Button, CheckBox}
   84.18 -import scala.swing.event.ButtonClicked
   84.19 -
   84.20 -import java.awt.BorderLayout
   84.21 -import java.awt.event.{ComponentEvent, ComponentAdapter}
   84.22 -
   84.23 -import org.gjt.sp.jedit.View
   84.24 -
   84.25 -
   84.26 -class Output_Dockable(view: View, position: String) extends Dockable(view, position)
   84.27 -{
   84.28 -  Swing_Thread.require()
   84.29 -
   84.30 -  private val html_panel =
   84.31 -    new HTML_Panel(Isabelle.system, Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
   84.32 -  {
   84.33 -    override val handler: PartialFunction[HTML_Panel.Event, Unit] = {
   84.34 -      case HTML_Panel.Mouse_Click(elem, event) if elem.getClassName() == "sendback" =>
   84.35 -        val text = elem.getFirstChild().getNodeValue()
   84.36 -
   84.37 -        Document_View(view.getTextArea) match {
   84.38 -          case Some(doc_view) =>
   84.39 -            val cmd = current_command.get
   84.40 -            val start_ofs = doc_view.model.snapshot().node.command_start(cmd).get
   84.41 -            val buffer = view.getBuffer
   84.42 -            buffer.beginCompoundEdit()
   84.43 -            buffer.remove(start_ofs, cmd.length)
   84.44 -            buffer.insert(start_ofs, text)
   84.45 -            buffer.endCompoundEdit()
   84.46 -          case None =>
   84.47 -        }
   84.48 -    }       
   84.49 -  }
   84.50 -
   84.51 -  set_content(html_panel)
   84.52 -
   84.53 -
   84.54 -  /* component state -- owned by Swing thread */
   84.55 -
   84.56 -  private var zoom_factor = 100
   84.57 -  private var show_tracing = false
   84.58 -  private var follow_caret = true
   84.59 -  private var current_command: Option[Command] = None
   84.60 -
   84.61 -
   84.62 -  private def handle_resize()
   84.63 -  {
   84.64 -    Swing_Thread.now {
   84.65 -      html_panel.resize(Isabelle.font_family(),
   84.66 -        scala.math.round(Isabelle.font_size() * zoom_factor / 100))
   84.67 -    }
   84.68 -  }
   84.69 -
   84.70 -  private def handle_perspective(): Boolean =
   84.71 -    Swing_Thread.now {
   84.72 -      Document_View(view.getTextArea) match {
   84.73 -        case Some(doc_view) =>
   84.74 -          val cmd = doc_view.selected_command()
   84.75 -          if (current_command == cmd) false
   84.76 -          else { current_command = cmd; true }
   84.77 -        case None => false
   84.78 -      }
   84.79 -    }
   84.80 -
   84.81 -  private def handle_update(restriction: Option[Set[Command]] = None)
   84.82 -  {
   84.83 -    Swing_Thread.now {
   84.84 -      if (follow_caret) handle_perspective()
   84.85 -      Document_View(view.getTextArea) match {
   84.86 -        case Some(doc_view) =>
   84.87 -          current_command match {
   84.88 -            case Some(cmd) if !restriction.isDefined || restriction.get.contains(cmd) =>
   84.89 -              val snapshot = doc_view.model.snapshot()
   84.90 -              val filtered_results =
   84.91 -                snapshot.state(cmd).results.iterator.map(_._2) filter {
   84.92 -                  case XML.Elem(Markup(Markup.TRACING, _), _) => show_tracing  // FIXME not scalable
   84.93 -                  case _ => true
   84.94 -                }
   84.95 -              html_panel.render(filtered_results.toList)
   84.96 -            case _ =>
   84.97 -          }
   84.98 -        case None =>
   84.99 -      }
  84.100 -    }
  84.101 -  }
  84.102 -
  84.103 -
  84.104 -  /* main actor */
  84.105 -
  84.106 -  private val main_actor = actor {
  84.107 -    loop {
  84.108 -      react {
  84.109 -        case Session.Global_Settings => handle_resize()
  84.110 -        case Session.Commands_Changed(changed) => handle_update(Some(changed))
  84.111 -        case Session.Perspective => if (follow_caret && handle_perspective()) handle_update()
  84.112 -        case bad => System.err.println("Output_Dockable: ignoring bad message " + bad)
  84.113 -      }
  84.114 -    }
  84.115 -  }
  84.116 -
  84.117 -  override def init()
  84.118 -  {
  84.119 -    Isabelle.session.global_settings += main_actor
  84.120 -    Isabelle.session.commands_changed += main_actor
  84.121 -    Isabelle.session.perspective += main_actor
  84.122 -  }
  84.123 -
  84.124 -  override def exit()
  84.125 -  {
  84.126 -    Isabelle.session.global_settings -= main_actor
  84.127 -    Isabelle.session.commands_changed -= main_actor
  84.128 -    Isabelle.session.perspective -= main_actor
  84.129 -  }
  84.130 -
  84.131 -
  84.132 -  /* resize */
  84.133 -
  84.134 -  addComponentListener(new ComponentAdapter {
  84.135 -    val delay = Swing_Thread.delay_last(Isabelle.session.update_delay) { handle_resize() }
  84.136 -    override def componentResized(e: ComponentEvent) { delay() }
  84.137 -  })
  84.138 -
  84.139 -
  84.140 -  /* controls */
  84.141 -
  84.142 -  private val zoom = new Library.Zoom_Box(factor => { zoom_factor = factor; handle_resize() })
  84.143 -  zoom.tooltip = "Zoom factor for basic font size"
  84.144 -
  84.145 -  private val tracing = new CheckBox("Tracing") {
  84.146 -    reactions += { case ButtonClicked(_) => show_tracing = this.selected; handle_update() }
  84.147 -  }
  84.148 -  tracing.selected = show_tracing
  84.149 -  tracing.tooltip = "Indicate output of tracing messages"
  84.150 -
  84.151 -  private val auto_update = new CheckBox("Auto update") {
  84.152 -    reactions += { case ButtonClicked(_) => follow_caret = this.selected; handle_update() }
  84.153 -  }
  84.154 -  auto_update.selected = follow_caret
  84.155 -  auto_update.tooltip = "Indicate automatic update following cursor movement"
  84.156 -
  84.157 -  private val update = new Button("Update") {
  84.158 -    reactions += { case ButtonClicked(_) => handle_perspective(); handle_update() }
  84.159 -  }
  84.160 -  update.tooltip = "Update display according to the command at cursor position"
  84.161 -
  84.162 -  private val controls = new FlowPanel(FlowPanel.Alignment.Right)(zoom, tracing, auto_update, update)
  84.163 -  add(controls.peer, BorderLayout.NORTH)
  84.164 -
  84.165 -  handle_update()
  84.166 -}
    85.1 --- a/src/Tools/jEdit/src/jedit/plugin.scala	Wed Jun 08 17:01:07 2011 +0200
    85.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.3 @@ -1,401 +0,0 @@
    85.4 -/*  Title:      Tools/jEdit/src/jedit/plugin.scala
    85.5 -    Author:     Makarius
    85.6 -
    85.7 -Main Isabelle/jEdit plugin setup.
    85.8 -*/
    85.9 -
   85.10 -package isabelle.jedit
   85.11 -
   85.12 -
   85.13 -import isabelle._
   85.14 -
   85.15 -import java.io.{FileInputStream, IOException}
   85.16 -import java.awt.Font
   85.17 -
   85.18 -import scala.collection.mutable
   85.19 -import scala.swing.ComboBox
   85.20 -
   85.21 -import org.gjt.sp.jedit.{jEdit, GUIUtilities, EBMessage, EBPlugin,
   85.22 -  Buffer, EditPane, ServiceManager, View}
   85.23 -import org.gjt.sp.jedit.buffer.JEditBuffer
   85.24 -import org.gjt.sp.jedit.textarea.{JEditTextArea, TextArea}
   85.25 -import org.gjt.sp.jedit.msg.{EditorStarted, BufferUpdate, EditPaneUpdate, PropertiesChanged}
   85.26 -import org.gjt.sp.jedit.gui.DockableWindowManager
   85.27 -
   85.28 -import org.gjt.sp.util.Log
   85.29 -
   85.30 -import scala.actors.Actor
   85.31 -import Actor._
   85.32 -
   85.33 -
   85.34 -object Isabelle
   85.35 -{
   85.36 -  /* plugin instance */
   85.37 -
   85.38 -  var system: Isabelle_System = null
   85.39 -  var session: Session = null
   85.40 -
   85.41 -
   85.42 -  /* properties */
   85.43 -
   85.44 -  val OPTION_PREFIX = "options.isabelle."
   85.45 -
   85.46 -  object Property
   85.47 -  {
   85.48 -    def apply(name: String): String =
   85.49 -      jEdit.getProperty(OPTION_PREFIX + name)
   85.50 -    def apply(name: String, default: String): String =
   85.51 -      jEdit.getProperty(OPTION_PREFIX + name, default)
   85.52 -    def update(name: String, value: String) =
   85.53 -      jEdit.setProperty(OPTION_PREFIX + name, value)
   85.54 -  }
   85.55 -
   85.56 -  object Boolean_Property
   85.57 -  {
   85.58 -    def apply(name: String): Boolean =
   85.59 -      jEdit.getBooleanProperty(OPTION_PREFIX + name)
   85.60 -    def apply(name: String, default: Boolean): Boolean =
   85.61 -      jEdit.getBooleanProperty(OPTION_PREFIX + name, default)
   85.62 -    def update(name: String, value: Boolean) =
   85.63 -      jEdit.setBooleanProperty(OPTION_PREFIX + name, value)
   85.64 -  }
   85.65 -
   85.66 -  object Int_Property
   85.67 -  {
   85.68 -    def apply(name: String): Int =
   85.69 -      jEdit.getIntegerProperty(OPTION_PREFIX + name)
   85.70 -    def apply(name: String, default: Int): Int =
   85.71 -      jEdit.getIntegerProperty(OPTION_PREFIX + name, default)
   85.72 -    def update(name: String, value: Int) =
   85.73 -      jEdit.setIntegerProperty(OPTION_PREFIX + name, value)
   85.74 -  }
   85.75 -
   85.76 -  object Double_Property
   85.77 -  {
   85.78 -    def apply(name: String): Double =
   85.79 -      jEdit.getDoubleProperty(OPTION_PREFIX + name, 0.0)
   85.80 -    def apply(name: String, default: Double): Double =
   85.81 -      jEdit.getDoubleProperty(OPTION_PREFIX + name, default)
   85.82 -    def update(name: String, value: Double) =
   85.83 -      jEdit.setDoubleProperty(OPTION_PREFIX + name, value)
   85.84 -  }
   85.85 -
   85.86 -  object Time_Property
   85.87 -  {
   85.88 -    def apply(name: String): Time =
   85.89 -      Time.seconds(Double_Property(name))
   85.90 -    def apply(name: String, default: Time): Time =
   85.91 -      Time.seconds(Double_Property(name, default.seconds))
   85.92 -    def update(name: String, value: Time) =
   85.93 -      Double_Property.update(name, value.seconds)
   85.94 -  }
   85.95 -
   85.96 -
   85.97 -  /* font */
   85.98 -
   85.99 -  def font_family(): String = jEdit.getProperty("view.font")
  85.100 -
  85.101 -  def font_size(): Float =
  85.102 -    (jEdit.getIntegerProperty("view.fontsize", 16) *
  85.103 -      Int_Property("relative-font-size", 100)).toFloat / 100
  85.104 -
  85.105 -
  85.106 -  /* text area ranges */
  85.107 -
  85.108 -  case class Gfx_Range(val x: Int, val y: Int, val length: Int)
  85.109 -
  85.110 -  def gfx_range(text_area: TextArea, range: Text.Range): Option[Gfx_Range] =
  85.111 -  {
  85.112 -    val p = text_area.offsetToXY(range.start)
  85.113 -    val q = text_area.offsetToXY(range.stop)
  85.114 -    if (p != null && q != null && p.y == q.y) Some(new Gfx_Range(p.x, p.y, q.x - p.x))
  85.115 -    else None
  85.116 -  }
  85.117 -
  85.118 -
  85.119 -  /* tooltip markup */
  85.120 -
  85.121 -  def tooltip(text: String): String =
  85.122 -    "<html><pre style=\"font-family: " + font_family() + "; font-size: " +
  85.123 -        Int_Property("tooltip-font-size", 10).toString + "px; \">" +  // FIXME proper scaling (!?)
  85.124 -      HTML.encode(text) + "</pre></html>"
  85.125 -
  85.126 -  def tooltip_dismiss_delay(): Time =
  85.127 -    Time_Property("tooltip-dismiss-delay", Time.seconds(8.0)) max Time.seconds(0.5)
  85.128 -
  85.129 -  def setup_tooltips()
  85.130 -  {
  85.131 -    Swing_Thread.now {
  85.132 -      val manager = javax.swing.ToolTipManager.sharedInstance
  85.133 -      manager.setDismissDelay(tooltip_dismiss_delay().ms.toInt)
  85.134 -    }
  85.135 -  }
  85.136 -
  85.137 -
  85.138 -  /* icons */
  85.139 -
  85.140 -  def load_icon(name: String): javax.swing.Icon =
  85.141 -  {
  85.142 -    val icon = GUIUtilities.loadIcon(name)
  85.143 -    if (icon.getIconWidth < 0 || icon.getIconHeight < 0)
  85.144 -      Log.log(Log.ERROR, icon, "Bad icon: " + name)
  85.145 -    icon
  85.146 -  }
  85.147 -
  85.148 -
  85.149 -  /* check JVM */
  85.150 -
  85.151 -  def check_jvm()
  85.152 -  {
  85.153 -    if (!Platform.is_hotspot) {
  85.154 -      Library.warning_dialog(jEdit.getActiveView, "Bad Java Virtual Machine",
  85.155 -        "This is " + Platform.jvm_name,
  85.156 -        "Isabelle/jEdit requires Java Hotspot from Sun/Oracle/Apple!")
  85.157 -    }
  85.158 -  }
  85.159 -
  85.160 -
  85.161 -  /* main jEdit components */
  85.162 -
  85.163 -  def jedit_buffers(): Iterator[Buffer] = jEdit.getBuffers().iterator
  85.164 -
  85.165 -  def jedit_views(): Iterator[View] = jEdit.getViews().iterator
  85.166 -
  85.167 -  def jedit_text_areas(view: View): Iterator[JEditTextArea] =
  85.168 -    view.getEditPanes().iterator.map(_.getTextArea)
  85.169 -
  85.170 -  def jedit_text_areas(): Iterator[JEditTextArea] =
  85.171 -    jedit_views().flatMap(jedit_text_areas(_))
  85.172 -
  85.173 -  def jedit_text_areas(buffer: JEditBuffer): Iterator[JEditTextArea] =
  85.174 -    jedit_text_areas().filter(_.getBuffer == buffer)
  85.175 -
  85.176 -  def buffer_lock[A](buffer: JEditBuffer)(body: => A): A =
  85.177 -  {
  85.178 -    try { buffer.readLock(); body }
  85.179 -    finally { buffer.readUnlock() }
  85.180 -  }
  85.181 -
  85.182 -  def swing_buffer_lock[A](buffer: JEditBuffer)(body: => A): A =
  85.183 -    Swing_Thread.now { buffer_lock(buffer) { body } }
  85.184 -
  85.185 -  def buffer_text(buffer: JEditBuffer): String =
  85.186 -    buffer_lock(buffer) { buffer.getText(0, buffer.getLength) }
  85.187 -
  85.188 -
  85.189 -  /* dockable windows */
  85.190 -
  85.191 -  private def wm(view: View): DockableWindowManager = view.getDockableWindowManager
  85.192 -
  85.193 -  def docked_session(view: View): Option[Session_Dockable] =
  85.194 -    wm(view).getDockableWindow("isabelle-session") match {
  85.195 -      case dockable: Session_Dockable => Some(dockable)
  85.196 -      case _ => None
  85.197 -    }
  85.198 -
  85.199 -  def docked_output(view: View): Option[Output_Dockable] =
  85.200 -    wm(view).getDockableWindow("isabelle-output") match {
  85.201 -      case dockable: Output_Dockable => Some(dockable)
  85.202 -      case _ => None
  85.203 -    }
  85.204 -
  85.205 -  def docked_raw_output(view: View): Option[Raw_Output_Dockable] =
  85.206 -    wm(view).getDockableWindow("isabelle-raw-output") match {
  85.207 -      case dockable: Raw_Output_Dockable => Some(dockable)
  85.208 -      case _ => None
  85.209 -    }
  85.210 -
  85.211 -  def docked_protocol(view: View): Option[Protocol_Dockable] =
  85.212 -    wm(view).getDockableWindow("isabelle-protocol") match {
  85.213 -      case dockable: Protocol_Dockable => Some(dockable)
  85.214 -      case _ => None
  85.215 -    }
  85.216 -
  85.217 -
  85.218 -  /* logic image */
  85.219 -
  85.220 -  def default_logic(): String =
  85.221 -  {
  85.222 -    val logic = system.getenv("JEDIT_LOGIC")
  85.223 -    if (logic != "") logic
  85.224 -    else system.getenv_strict("ISABELLE_LOGIC")
  85.225 -  }
  85.226 -
  85.227 -  class Logic_Entry(val name: String, val description: String)
  85.228 -  {
  85.229 -    override def toString = description
  85.230 -  }
  85.231 -
  85.232 -  def logic_selector(logic: String): ComboBox[Logic_Entry] =
  85.233 -  {
  85.234 -    val entries =
  85.235 -      new Logic_Entry("", "default (" + default_logic() + ")") ::
  85.236 -        system.find_logics().map(name => new Logic_Entry(name, name))
  85.237 -    val component = new ComboBox(entries)
  85.238 -    entries.find(_.name == logic) match {
  85.239 -      case None =>
  85.240 -      case Some(entry) => component.selection.item = entry
  85.241 -    }
  85.242 -    component.tooltip = "Isabelle logic image"
  85.243 -    component
  85.244 -  }
  85.245 -
  85.246 -  def start_session()
  85.247 -  {
  85.248 -    val timeout = Time_Property("startup-timeout", Time.seconds(10)) max Time.seconds(5)
  85.249 -    val modes = system.getenv("JEDIT_PRINT_MODE").split(",").toList.map("-m" + _)
  85.250 -    val logic = {
  85.251 -      val logic = Property("logic")
  85.252 -      if (logic != null && logic != "") logic
  85.253 -      else Isabelle.default_logic()
  85.254 -    }
  85.255 -    session.start(timeout, modes ::: List(logic))
  85.256 -  }
  85.257 -}
  85.258 -
  85.259 -
  85.260 -class Plugin extends EBPlugin
  85.261 -{
  85.262 -  /* session management */
  85.263 -
  85.264 -  private def init_model(buffer: Buffer)
  85.265 -  {
  85.266 -    Isabelle.swing_buffer_lock(buffer) {
  85.267 -      val opt_model =
  85.268 -        Document_Model(buffer) match {
  85.269 -          case Some(model) => model.refresh; Some(model)
  85.270 -          case None =>
  85.271 -            Thy_Header.split_thy_path(Isabelle.system.posix_path(buffer.getPath)) match {
  85.272 -              case Some((dir, thy_name)) =>
  85.273 -                Some(Document_Model.init(Isabelle.session, buffer, dir + "/" + thy_name))
  85.274 -              case None => None
  85.275 -            }
  85.276 -        }
  85.277 -      if (opt_model.isDefined) {
  85.278 -        for (text_area <- Isabelle.jedit_text_areas(buffer)) {
  85.279 -          if (Document_View(text_area).map(_.model) != opt_model)
  85.280 -            Document_View.init(opt_model.get, text_area)
  85.281 -        }
  85.282 -      }
  85.283 -    }
  85.284 -  }
  85.285 -
  85.286 -  private def exit_model(buffer: Buffer)
  85.287 -  {
  85.288 -    Isabelle.swing_buffer_lock(buffer) {
  85.289 -      Isabelle.jedit_text_areas(buffer).foreach(Document_View.exit)
  85.290 -      Document_Model.exit(buffer)
  85.291 -    }
  85.292 -  }
  85.293 -
  85.294 -  private case class Init_Model(buffer: Buffer)
  85.295 -  private case class Exit_Model(buffer: Buffer)
  85.296 -  private case class Init_View(buffer: Buffer, text_area: JEditTextArea)
  85.297 -  private case class Exit_View(buffer: Buffer, text_area: JEditTextArea)
  85.298 -
  85.299 -  private val session_manager = actor {
  85.300 -    var ready = false
  85.301 -    loop {
  85.302 -      react {
  85.303 -        case phase: Session.Phase =>
  85.304 -          ready = phase == Session.Ready
  85.305 -          phase match {
  85.306 -            case Session.Failed =>
  85.307 -              Swing_Thread.now {
  85.308 -                val text = new scala.swing.TextArea(Isabelle.session.syslog())
  85.309 -                text.editable = false
  85.310 -                Library.error_dialog(jEdit.getActiveView, "Failed to start Isabelle process", text)
  85.311 -              }
  85.312 -
  85.313 -            case Session.Ready => Isabelle.jedit_buffers.foreach(init_model)
  85.314 -            case Session.Shutdown => Isabelle.jedit_buffers.foreach(exit_model)
  85.315 -            case _ =>
  85.316 -          }
  85.317 -
  85.318 -        case Init_Model(buffer) =>
  85.319 -          if (ready) init_model(buffer)
  85.320 -
  85.321 -        case Exit_Model(buffer) =>
  85.322 -          exit_model(buffer)
  85.323 -
  85.324 -        case Init_View(buffer, text_area) =>
  85.325 -          if (ready) {
  85.326 -            Isabelle.swing_buffer_lock(buffer) {
  85.327 -              Document_Model(buffer) match {
  85.328 -                case Some(model) => Document_View.init(model, text_area)
  85.329 -                case None =>
  85.330 -              }
  85.331 -            }
  85.332 -          }
  85.333 -
  85.334 -        case Exit_View(buffer, text_area) =>
  85.335 -          Isabelle.swing_buffer_lock(buffer) {
  85.336 -            Document_View.exit(text_area)
  85.337 -          }
  85.338 -
  85.339 -        case bad => System.err.println("session_manager: ignoring bad message " + bad)
  85.340 -      }
  85.341 -    }
  85.342 -  }
  85.343 -
  85.344 -
  85.345 -  /* main plugin plumbing */
  85.346 -
  85.347 -  override def handleMessage(message: EBMessage)
  85.348 -  {
  85.349 -    message match {
  85.350 -      case msg: EditorStarted =>
  85.351 -      Isabelle.check_jvm()
  85.352 -      if (Isabelle.Boolean_Property("auto-start")) Isabelle.start_session()
  85.353 -
  85.354 -      case msg: BufferUpdate
  85.355 -      if msg.getWhat == BufferUpdate.PROPERTIES_CHANGED =>
  85.356 -
  85.357 -        val buffer = msg.getBuffer
  85.358 -        if (buffer != null) session_manager ! Init_Model(buffer)
  85.359 -
  85.360 -      case msg: EditPaneUpdate
  85.361 -      if (msg.getWhat == EditPaneUpdate.BUFFER_CHANGING ||
  85.362 -          msg.getWhat == EditPaneUpdate.BUFFER_CHANGED ||
  85.363 -          msg.getWhat == EditPaneUpdate.CREATED ||
  85.364 -          msg.getWhat == EditPaneUpdate.DESTROYED) =>
  85.365 -
  85.366 -        val edit_pane = msg.getEditPane
  85.367 -        val buffer = edit_pane.getBuffer
  85.368 -        val text_area = edit_pane.getTextArea
  85.369 -
  85.370 -        if (buffer != null && text_area != null) {
  85.371 -          if (msg.getWhat == EditPaneUpdate.BUFFER_CHANGED ||
  85.372 -              msg.getWhat == EditPaneUpdate.CREATED)
  85.373 -            session_manager ! Init_View(buffer, text_area)
  85.374 -          else
  85.375 -            session_manager ! Exit_View(buffer, text_area)
  85.376 -        }
  85.377 -
  85.378 -      case msg: PropertiesChanged =>
  85.379 -        Swing_Thread.now {
  85.380 -          Isabelle.setup_tooltips()
  85.381 -          for (text_area <- Isabelle.jedit_text_areas if Document_View(text_area).isDefined)
  85.382 -            Document_View(text_area).get.extend_styles()
  85.383 -        }
  85.384 -        Isabelle.session.global_settings.event(Session.Global_Settings)
  85.385 -
  85.386 -      case _ =>
  85.387 -    }
  85.388 -  }
  85.389 -
  85.390 -  override def start()
  85.391 -  {
  85.392 -    Isabelle.setup_tooltips()
  85.393 -    Isabelle.system = new Isabelle_System
  85.394 -    Isabelle.system.install_fonts()
  85.395 -    Isabelle.session = new Session(Isabelle.system)
  85.396 -    Isabelle.session.phase_changed += session_manager
  85.397 -  }
  85.398 -
  85.399 -  override def stop()
  85.400 -  {
  85.401 -    Isabelle.session.stop()
  85.402 -    Isabelle.session.phase_changed -= session_manager
  85.403 -  }
  85.404 -}
    86.1 --- a/src/Tools/jEdit/src/jedit/protocol_dockable.scala	Wed Jun 08 17:01:07 2011 +0200
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,39 +0,0 @@
    86.4 -/*  Title:      Tools/jEdit/src/jedit/protocol_dockable.scala
    86.5 -    Author:     Makarius
    86.6 -
    86.7 -Dockable window for protocol messages.
    86.8 -*/
    86.9 -
   86.10 -package isabelle.jedit
   86.11 -
   86.12 -
   86.13 -import isabelle._
   86.14 -
   86.15 -import scala.actors.Actor._
   86.16 -import scala.swing.{TextArea, ScrollPane}
   86.17 -
   86.18 -import org.gjt.sp.jedit.View
   86.19 -
   86.20 -
   86.21 -class Protocol_Dockable(view: View, position: String) extends Dockable(view, position)
   86.22 -{
   86.23 -  private val text_area = new TextArea
   86.24 -  set_content(new ScrollPane(text_area))
   86.25 -
   86.26 -
   86.27 -  /* main actor */
   86.28 -
   86.29 -  private val main_actor = actor {
   86.30 -    loop {
   86.31 -      react {
   86.32 -        case result: Isabelle_Process.Result =>
   86.33 -          Swing_Thread.now { text_area.append(result.message.toString + "\n") }
   86.34 -
   86.35 -        case bad => System.err.println("Protocol_Dockable: ignoring bad message " + bad)
   86.36 -      }
   86.37 -    }
   86.38 -  }
   86.39 -
   86.40 -  override def init() { Isabelle.session.raw_messages += main_actor }
   86.41 -  override def exit() { Isabelle.session.raw_messages -= main_actor }
   86.42 -}
    87.1 --- a/src/Tools/jEdit/src/jedit/raw_output_dockable.scala	Wed Jun 08 17:01:07 2011 +0200
    87.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.3 @@ -1,42 +0,0 @@
    87.4 -/*  Title:      Tools/jEdit/src/jedit/raw_output_dockable.scala
    87.5 -    Author:     Makarius
    87.6 -
    87.7 -Dockable window for raw process output (stdout).
    87.8 -*/
    87.9 -
   87.10 -package isabelle.jedit
   87.11 -
   87.12 -
   87.13 -import isabelle._
   87.14 -
   87.15 -import scala.actors.Actor._
   87.16 -import scala.swing.{TextArea, ScrollPane}
   87.17 -
   87.18 -import org.gjt.sp.jedit.View
   87.19 -
   87.20 -
   87.21 -class Raw_Output_Dockable(view: View, position: String)
   87.22 -  extends Dockable(view: View, position: String)
   87.23 -{
   87.24 -  private val text_area = new TextArea
   87.25 -  text_area.editable = false
   87.26 -  set_content(new ScrollPane(text_area))
   87.27 -
   87.28 -
   87.29 -  /* main actor */
   87.30 -
   87.31 -  private val main_actor = actor {
   87.32 -    loop {
   87.33 -      react {
   87.34 -        case result: Isabelle_Process.Result =>
   87.35 -          if (result.is_stdout)
   87.36 -            Swing_Thread.now { text_area.append(XML.content(result.message).mkString) }
   87.37 -
   87.38 -        case bad => System.err.println("Raw_Output_Dockable: ignoring bad message " + bad)
   87.39 -      }
   87.40 -    }
   87.41 -  }
   87.42 -
   87.43 -  override def init() { Isabelle.session.raw_messages += main_actor }
   87.44 -  override def exit() { Isabelle.session.raw_messages -= main_actor }
   87.45 -}
    88.1 --- a/src/Tools/jEdit/src/jedit/scala_console.scala	Wed Jun 08 17:01:07 2011 +0200
    88.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.3 @@ -1,155 +0,0 @@
    88.4 -/*  Title:      Tools/jEdit/src/jedit/scala_console.scala
    88.5 -    Author:     Makarius
    88.6 -
    88.7 -Scala instance of Console plugin.
    88.8 -*/
    88.9 -
   88.10 -package isabelle.jedit
   88.11 -
   88.12 -
   88.13 -import isabelle._
   88.14 -
   88.15 -import console.{Console, ConsolePane, Shell, Output}
   88.16 -
   88.17 -import org.gjt.sp.jedit.{jEdit, JARClassLoader}
   88.18 -import org.gjt.sp.jedit.MiscUtilities
   88.19 -
   88.20 -import java.io.{File, OutputStream, Writer, PrintWriter}
   88.21 -
   88.22 -import scala.tools.nsc.{Interpreter, GenericRunnerSettings, NewLinePrintWriter, ConsoleWriter}
   88.23 -import scala.collection.mutable
   88.24 -
   88.25 -
   88.26 -class Scala_Console extends Shell("Scala")
   88.27 -{
   88.28 -  /* reconstructed jEdit/plugin classpath */
   88.29 -
   88.30 -  private def reconstruct_classpath(): String =
   88.31 -  {
   88.32 -    def find_jars(start: String): List[String] =
   88.33 -      if (start != null)
   88.34 -        Standard_System.find_files(new File(start),
   88.35 -          entry => entry.isFile && entry.getName.endsWith(".jar")).map(_.getAbsolutePath)
   88.36 -      else Nil
   88.37 -    val path = find_jars(jEdit.getSettingsDirectory) ::: find_jars(jEdit.getJEditHome)
   88.38 -    path.mkString(File.pathSeparator)
   88.39 -  }
   88.40 -
   88.41 -
   88.42 -  /* global state -- owned by Swing thread */
   88.43 -
   88.44 -  private var interpreters = Map[Console, Interpreter]()
   88.45 -
   88.46 -  private var global_console: Console = null
   88.47 -  private var global_out: Output = null
   88.48 -  private var global_err: Output = null
   88.49 -
   88.50 -  private val console_stream = new OutputStream
   88.51 -  {
   88.52 -    val buf = new StringBuilder
   88.53 -    override def flush()
   88.54 -    {
   88.55 -      val str = Standard_System.decode_permissive_utf8(buf.toString)
   88.56 -      buf.clear
   88.57 -      if (global_out == null) System.out.print(str)
   88.58 -      else Swing_Thread.now { global_out.writeAttrs(null, str) }
   88.59 -    }
   88.60 -    override def close() { flush () }
   88.61 -    def write(byte: Int) { buf.append(byte.toChar) }
   88.62 -  }
   88.63 -
   88.64 -  private val console_writer = new Writer
   88.65 -  {
   88.66 -    def flush() {}
   88.67 -    def close() {}
   88.68 -
   88.69 -    def write(cbuf: Array[Char], off: Int, len: Int)
   88.70 -    {
   88.71 -      if (len > 0) write(new String(cbuf.slice(off, off + len)))
   88.72 -    }
   88.73 -
   88.74 -    override def write(str: String)
   88.75 -    {
   88.76 -      if (global_out == null) System.out.println(str)
   88.77 -      else global_out.print(null, str)
   88.78 -    }
   88.79 -  }
   88.80 -
   88.81 -  private def with_console[A](console: Console, out: Output, err: Output)(e: => A): A =
   88.82 -  {
   88.83 -    global_console = console
   88.84 -    global_out = out
   88.85 -    global_err = if (err == null) out else err
   88.86 -    val res = Exn.capture { scala.Console.withOut(console_stream)(e) }
   88.87 -    console_stream.flush
   88.88 -    global_console = null
   88.89 -    global_out = null
   88.90 -    global_err = null
   88.91 -    Exn.release(res)
   88.92 -  }
   88.93 -
   88.94 -  private def report_error(str: String)
   88.95 -  {
   88.96 -    if (global_console == null || global_err == null) System.err.println(str)
   88.97 -    else Swing_Thread.now { global_err.print(global_console.getErrorColor, str) }
   88.98 -  }
   88.99 -
  88.100 -
  88.101 -  /* jEdit console methods */
  88.102 -
  88.103 -  override def openConsole(console: Console)
  88.104 -  {
  88.105 -    val settings = new GenericRunnerSettings(report_error)
  88.106 -    settings.classpath.value = reconstruct_classpath()
  88.107 -
  88.108 -    val interp = new Interpreter(settings, new PrintWriter(console_writer, true))
  88.109 -    {
  88.110 -      override def parentClassLoader = new JARClassLoader
  88.111 -    }
  88.112 -    interp.setContextClassLoader
  88.113 -    interp.bind("view", "org.gjt.sp.jedit.View", console.getView)
  88.114 -    interp.bind("console", "console.Console", console)
  88.115 -    interp.interpret("import isabelle.jedit.Isabelle")
  88.116 -
  88.117 -    interpreters += (console -> interp)
  88.118 -  }
  88.119 -
  88.120 -  override def closeConsole(console: Console)
  88.121 -  {
  88.122 -    interpreters -= console
  88.123 -  }
  88.124 -
  88.125 -  override def printInfoMessage(out: Output)
  88.126 -  {
  88.127 -    out.print(null,
  88.128 -     "This shell evaluates Isabelle/Scala expressions.\n\n" +
  88.129 -     "The following special toplevel bindings are provided:\n" +
  88.130 -     "  view      -- current jEdit/Swing view (e.g. view.getBuffer, view.getTextArea)\n" +
  88.131 -     "  console   -- jEdit Console plugin instance\n" +
  88.132 -     "  Isabelle  -- Isabelle plugin instance (e.g. Isabelle.system, Isabelle.session)\n")
  88.133 -  }
  88.134 -
  88.135 -  override def printPrompt(console: Console, out: Output)
  88.136 -  {
  88.137 -    out.writeAttrs(ConsolePane.colorAttributes(console.getInfoColor), "scala>")
  88.138 -    out.writeAttrs(ConsolePane.colorAttributes(console.getPlainColor), " ")
  88.139 -  }
  88.140 -
  88.141 -  override def execute(console: Console, input: String, out: Output, err: Output, command: String)
  88.142 -  {
  88.143 -    val interp = interpreters(console)
  88.144 -    with_console(console, out, err) { interp.interpret(command) }
  88.145 -    if (err != null) err.commandDone()
  88.146 -    out.commandDone()
  88.147 -  }
  88.148 -
  88.149 -  override def stop(console: Console)
  88.150 -  {
  88.151 -    closeConsole(console)
  88.152 -    console.clear
  88.153 -    openConsole(console)
  88.154 -    val out = console.getOutput
  88.155 -    out.commandDone
  88.156 -    printPrompt(console, out)
  88.157 -  }
  88.158 -}
    89.1 --- a/src/Tools/jEdit/src/jedit/session_dockable.scala	Wed Jun 08 17:01:07 2011 +0200
    89.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.3 @@ -1,104 +0,0 @@
    89.4 -/*  Title:      Tools/jEdit/src/jedit/session_dockable.scala
    89.5 -    Author:     Makarius
    89.6 -
    89.7 -Dockable window for prover session management.
    89.8 -*/
    89.9 -
   89.10 -package isabelle.jedit
   89.11 -
   89.12 -
   89.13 -import isabelle._
   89.14 -
   89.15 -import scala.actors.Actor._
   89.16 -import scala.swing.{FlowPanel, Button, TextArea, Label, ScrollPane, TabbedPane, Component, Swing}
   89.17 -import scala.swing.event.{ButtonClicked, SelectionChanged}
   89.18 -
   89.19 -import java.awt.BorderLayout
   89.20 -import javax.swing.border.{BevelBorder, SoftBevelBorder}
   89.21 -
   89.22 -import org.gjt.sp.jedit.View
   89.23 -
   89.24 -
   89.25 -class Session_Dockable(view: View, position: String) extends Dockable(view: View, position: String)
   89.26 -{
   89.27 -  /* main tabs */
   89.28 -
   89.29 -  private val readme = new HTML_Panel(Isabelle.system, "SansSerif", 14)
   89.30 -  readme.render_document(Isabelle.system.try_read(List("$JEDIT_HOME/README.html")))
   89.31 -
   89.32 -  private val syslog = new TextArea(Isabelle.session.syslog())
   89.33 -  syslog.editable = false
   89.34 -
   89.35 -  private val tabs = new TabbedPane {
   89.36 -    pages += new TabbedPane.Page("README", Component.wrap(readme))
   89.37 -    pages += new TabbedPane.Page("System log", new ScrollPane(syslog))
   89.38 -
   89.39 -    selection.index =
   89.40 -    {
   89.41 -      val index = Isabelle.Int_Property("session-panel.selection", 0)
   89.42 -      if (index >= pages.length) 0 else index
   89.43 -    }
   89.44 -    listenTo(selection)
   89.45 -    reactions += {
   89.46 -      case SelectionChanged(_) =>
   89.47 -        Isabelle.Int_Property("session-panel.selection") = selection.index
   89.48 -    }
   89.49 -  }
   89.50 -
   89.51 -  set_content(tabs)
   89.52 -
   89.53 -
   89.54 -  /* controls */
   89.55 -
   89.56 -  val session_phase = new Label(Isabelle.session.phase.toString)
   89.57 -  session_phase.border = new SoftBevelBorder(BevelBorder.LOWERED)
   89.58 -  session_phase.tooltip = "Prover status"
   89.59 -
   89.60 -  private val interrupt = new Button("Interrupt") {
   89.61 -    reactions += { case ButtonClicked(_) => Isabelle.session.interrupt }
   89.62 -  }
   89.63 -  interrupt.tooltip = "Broadcast interrupt to all prover tasks"
   89.64 -
   89.65 -  private val logic = Isabelle.logic_selector(Isabelle.Property("logic"))
   89.66 -  logic.listenTo(logic.selection)
   89.67 -  logic.reactions += {
   89.68 -    case SelectionChanged(_) => Isabelle.Property("logic") = logic.selection.item.name
   89.69 -  }
   89.70 -
   89.71 -  private val controls =
   89.72 -    new FlowPanel(FlowPanel.Alignment.Right)(session_phase, interrupt, logic)
   89.73 -  add(controls.peer, BorderLayout.NORTH)
   89.74 -
   89.75 -
   89.76 -  /* main actor */
   89.77 -
   89.78 -  private val main_actor = actor {
   89.79 -    loop {
   89.80 -      react {
   89.81 -        case result: Isabelle_Process.Result =>
   89.82 -          if (result.is_syslog)
   89.83 -            Swing_Thread.now {
   89.84 -              val text = Isabelle.session.syslog()
   89.85 -              if (text != syslog.text) {
   89.86 -                syslog.text = text
   89.87 -              }
   89.88 -            }
   89.89 -
   89.90 -        case phase: Session.Phase =>
   89.91 -          Swing_Thread.now { session_phase.text = " " + phase.toString + " " }
   89.92 -
   89.93 -        case bad => System.err.println("Session_Dockable: ignoring bad message " + bad)
   89.94 -      }
   89.95 -    }
   89.96 -  }
   89.97 -
   89.98 -  override def init() {
   89.99 -    Isabelle.session.raw_messages += main_actor
  89.100 -    Isabelle.session.phase_changed += main_actor
  89.101 -  }
  89.102 -
  89.103 -  override def exit() {
  89.104 -    Isabelle.session.raw_messages -= main_actor
  89.105 -    Isabelle.session.phase_changed -= main_actor
  89.106 -  }
  89.107 -}
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/src/Tools/jEdit/src/modes/isabelle-session.xml	Wed Jun 08 22:13:49 2011 +0200
    90.3 @@ -0,0 +1,41 @@
    90.4 +<?xml version="1.0"?>
    90.5 +<!DOCTYPE MODE SYSTEM "xmode.dtd">
    90.6 +
    90.7 +<!-- Isabelle session mode -->
    90.8 +<MODE>
    90.9 +  <PROPS>
   90.10 +    <PROPERTY NAME="commentStart" VALUE="(*"/>
   90.11 +    <PROPERTY NAME="commentEnd" VALUE="*)"/>
   90.12 +    <PROPERTY NAME="noWordSep" VALUE="_'.?"/>
   90.13 +    <PROPERTY NAME="unalignedOpenBrackets" VALUE="(" />
   90.14 +    <PROPERTY NAME="unalignedCloseBrackets" VALUE=")" />
   90.15 +    <PROPERTY NAME="tabSize" VALUE="2" />
   90.16 +    <PROPERTY NAME="indentSize" VALUE="2" />
   90.17 +  </PROPS>
   90.18 +  <RULES IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="FALSE" ESCAPE="\">
   90.19 +    <SPAN TYPE="COMMENT1">
   90.20 +      <BEGIN>(*</BEGIN>
   90.21 +      <END>*)</END>
   90.22 +    </SPAN>
   90.23 +    <SPAN TYPE="COMMENT3">
   90.24 +      <BEGIN>{*</BEGIN>
   90.25 +      <END>*}</END>
   90.26 +    </SPAN>
   90.27 +    <SPAN TYPE="LITERAL1">
   90.28 +      <BEGIN>`</BEGIN>
   90.29 +      <END>`</END>
   90.30 +    </SPAN>
   90.31 +    <SPAN TYPE="LITERAL3">
   90.32 +      <BEGIN>"</BEGIN>
   90.33 +      <END>"</END>
   90.34 +    </SPAN>
   90.35 +    <KEYWORDS>
   90.36 +      <KEYWORD1>session</KEYWORD1>
   90.37 +      <KEYWORD2>parent</KEYWORD2>
   90.38 +      <KEYWORD2>imports</KEYWORD2>
   90.39 +      <KEYWORD2>uses</KEYWORD2>
   90.40 +      <KEYWORD2>options</KEYWORD2>
   90.41 +      <KEYWORD2>dependencies</KEYWORD2>
   90.42 +    </KEYWORDS>
   90.43 +  </RULES>
   90.44 +</MODE>
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/src/Tools/jEdit/src/modes/isabelle.xml	Wed Jun 08 22:13:49 2011 +0200
    91.3 @@ -0,0 +1,41 @@
    91.4 +<?xml version="1.0"?>
    91.5 +<!DOCTYPE MODE SYSTEM "xmode.dtd">
    91.6 +
    91.7 +<!-- Isabelle theory mode -->
    91.8 +<MODE>
    91.9 +  <PROPS>
   91.10 +    <PROPERTY NAME="commentStart" VALUE="(*"/>
   91.11 +    <PROPERTY NAME="commentEnd" VALUE="*)"/>
   91.12 +    <PROPERTY NAME="noWordSep" VALUE="_'.?"/>
   91.13 +    <PROPERTY NAME="unalignedOpenBrackets" VALUE="{[(" />
   91.14 +    <PROPERTY NAME="unalignedCloseBrackets" VALUE=")]}" />
   91.15 +    <PROPERTY NAME="tabSize" VALUE="2" />
   91.16 +    <PROPERTY NAME="indentSize" VALUE="2" />
   91.17 +  </PROPS>
   91.18 +  <RULES IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="FALSE" ESCAPE="\">
   91.19 +    <SPAN TYPE="COMMENT1">
   91.20 +      <BEGIN>(*</BEGIN>
   91.21 +      <END>*)</END>
   91.22 +    </SPAN>
   91.23 +    <SPAN TYPE="COMMENT3">
   91.24 +      <BEGIN>{*</BEGIN>
   91.25 +      <END>*}</END>
   91.26 +    </SPAN>
   91.27 +    <SPAN TYPE="LITERAL1">
   91.28 +      <BEGIN>`</BEGIN>
   91.29 +      <END>`</END>
   91.30 +    </SPAN>
   91.31 +    <SPAN TYPE="LITERAL3">
   91.32 +      <BEGIN>"</BEGIN>
   91.33 +      <END>"</END>
   91.34 +    </SPAN>
   91.35 +    <KEYWORDS>
   91.36 +      <KEYWORD2>header</KEYWORD2>
   91.37 +      <KEYWORD1>theory</KEYWORD1>
   91.38 +      <KEYWORD2>imports</KEYWORD2>
   91.39 +      <KEYWORD2>uses</KEYWORD2>
   91.40 +      <KEYWORD2>begin</KEYWORD2>
   91.41 +      <KEYWORD2>end</KEYWORD2>
   91.42 +    </KEYWORDS>
   91.43 +  </RULES>
   91.44 +</MODE>
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/src/Tools/jEdit/src/output_dockable.scala	Wed Jun 08 22:13:49 2011 +0200
    92.3 @@ -0,0 +1,163 @@
    92.4 +/*  Title:      Tools/jEdit/src/output_dockable.scala
    92.5 +    Author:     Makarius
    92.6 +
    92.7 +Dockable window with result message output.
    92.8 +*/
    92.9 +
   92.10 +package isabelle.jedit
   92.11 +
   92.12 +
   92.13 +import isabelle._
   92.14 +
   92.15 +import scala.actors.Actor._
   92.16 +
   92.17 +import scala.swing.{FlowPanel, Button, CheckBox}
   92.18 +import scala.swing.event.ButtonClicked
   92.19 +
   92.20 +import java.awt.BorderLayout
   92.21 +import java.awt.event.{ComponentEvent, ComponentAdapter}
   92.22 +
   92.23 +import org.gjt.sp.jedit.View
   92.24 +
   92.25 +
   92.26 +class Output_Dockable(view: View, position: String) extends Dockable(view, position)
   92.27 +{
   92.28 +  Swing_Thread.require()
   92.29 +
   92.30 +  private val html_panel =
   92.31 +    new HTML_Panel(Isabelle.system, Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
   92.32 +  {
   92.33 +    override val handler: PartialFunction[HTML_Panel.Event, Unit] = {
   92.34 +      case HTML_Panel.Mouse_Click(elem, event) if elem.getClassName() == "sendback" =>
   92.35 +        val text = elem.getFirstChild().getNodeValue()
   92.36 +
   92.37 +        Document_View(view.getTextArea) match {
   92.38 +          case Some(doc_view) =>
   92.39 +            val cmd = current_command.get
   92.40 +            val start_ofs = doc_view.model.snapshot().node.command_start(cmd).get
   92.41 +            val buffer = view.getBuffer
   92.42 +            buffer.beginCompoundEdit()
   92.43 +            buffer.remove(start_ofs, cmd.length)
   92.44 +            buffer.insert(start_ofs, text)
   92.45 +            buffer.endCompoundEdit()
   92.46 +          case None =>
   92.47 +        }
   92.48 +    }       
   92.49 +  }
   92.50 +
   92.51 +  set_content(html_panel)
   92.52 +
   92.53 +
   92.54 +  /* component state -- owned by Swing thread */
   92.55 +
   92.56 +  private var zoom_factor = 100
   92.57 +  private var show_tracing = false
   92.58 +  private var follow_caret = true
   92.59 +  private var current_command: Option[Command] = None
   92.60 +
   92.61 +
   92.62 +  private def handle_resize()
   92.63 +  {
   92.64 +    Swing_Thread.now {
   92.65 +      html_panel.resize(Isabelle.font_family(),
   92.66 +        scala.math.round(Isabelle.font_size() * zoom_factor / 100))
   92.67 +    }
   92.68 +  }
   92.69 +
   92.70 +  private def handle_perspective(): Boolean =
   92.71 +    Swing_Thread.now {
   92.72 +      Document_View(view.getTextArea) match {
   92.73 +        case Some(doc_view) =>
   92.74 +          val cmd = doc_view.selected_command()
   92.75 +          if (current_command == cmd) false
   92.76 +          else { current_command = cmd; true }
   92.77 +        case None => false
   92.78 +      }
   92.79 +    }
   92.80 +
   92.81 +  private def handle_update(restriction: Option[Set[Command]] = None)
   92.82 +  {
   92.83 +    Swing_Thread.now {
   92.84 +      if (follow_caret) handle_perspective()
   92.85 +      Document_View(view.getTextArea) match {
   92.86 +        case Some(doc_view) =>
   92.87 +          current_command match {
   92.88 +            case Some(cmd) if !restriction.isDefined || restriction.get.contains(cmd) =>
   92.89 +              val snapshot = doc_view.model.snapshot()
   92.90 +              val filtered_results =
   92.91 +                snapshot.state(cmd).results.iterator.map(_._2) filter {
   92.92 +                  case XML.Elem(Markup(Markup.TRACING, _), _) => show_tracing  // FIXME not scalable
   92.93 +                  case _ => true
   92.94 +                }
   92.95 +              html_panel.render(filtered_results.toList)
   92.96 +            case _ =>
   92.97 +          }
   92.98 +        case None =>
   92.99 +      }
  92.100 +    }
  92.101 +  }
  92.102 +
  92.103 +
  92.104 +  /* main actor */
  92.105 +
  92.106 +  private val main_actor = actor {
  92.107 +    loop {
  92.108 +      react {
  92.109 +        case Session.Global_Settings => handle_resize()
  92.110 +        case Session.Commands_Changed(changed) => handle_update(Some(changed))
  92.111 +        case Session.Perspective => if (follow_caret && handle_perspective()) handle_update()
  92.112 +        case bad => System.err.println("Output_Dockable: ignoring bad message " + bad)
  92.113 +      }
  92.114 +    }
  92.115 +  }
  92.116 +
  92.117 +  override def init()
  92.118 +  {
  92.119 +    Isabelle.session.global_settings += main_actor
  92.120 +    Isabelle.session.commands_changed += main_actor
  92.121 +    Isabelle.session.perspective += main_actor
  92.122 +  }
  92.123 +
  92.124 +  override def exit()
  92.125 +  {
  92.126 +    Isabelle.session.global_settings -= main_actor
  92.127 +    Isabelle.session.commands_changed -= main_actor
  92.128 +    Isabelle.session.perspective -= main_actor
  92.129 +  }
  92.130 +
  92.131 +
  92.132 +  /* resize */
  92.133 +
  92.134 +  addComponentListener(new ComponentAdapter {
  92.135 +    val delay = Swing_Thread.delay_last(Isabelle.session.update_delay) { handle_resize() }
  92.136 +    override def componentResized(e: ComponentEvent) { delay() }
  92.137 +  })
  92.138 +
  92.139 +
  92.140 +  /* controls */
  92.141 +
  92.142 +  private val zoom = new Library.Zoom_Box(factor => { zoom_factor = factor; handle_resize() })
  92.143 +  zoom.tooltip = "Zoom factor for basic font size"
  92.144 +
  92.145 +  private val tracing = new CheckBox("Tracing") {
  92.146 +    reactions += { case ButtonClicked(_) => show_tracing = this.selected; handle_update() }
  92.147 +  }
  92.148 +  tracing.selected = show_tracing
  92.149 +  tracing.tooltip = "Indicate output of tracing messages"
  92.150 +
  92.151 +  private val auto_update = new CheckBox("Auto update") {
  92.152 +    reactions += { case ButtonClicked(_) => follow_caret = this.selected; handle_update() }
  92.153 +  }
  92.154 +  auto_update.selected = follow_caret
  92.155 +  auto_update.tooltip = "Indicate automatic update following cursor movement"
  92.156 +
  92.157 +  private val update = new Button("Update") {
  92.158 +    reactions += { case ButtonClicked(_) => handle_perspective(); handle_update() }
  92.159 +  }
  92.160 +  update.tooltip = "Update display according to the command at cursor position"
  92.161 +
  92.162 +  private val controls = new FlowPanel(FlowPanel.Alignment.Right)(zoom, tracing, auto_update, update)
  92.163 +  add(controls.peer, BorderLayout.NORTH)
  92.164 +
  92.165 +  handle_update()
  92.166 +}
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/src/Tools/jEdit/src/plugin.scala	Wed Jun 08 22:13:49 2011 +0200
    93.3 @@ -0,0 +1,401 @@
    93.4 +/*  Title:      Tools/jEdit/src/plugin.scala
    93.5 +    Author:     Makarius
    93.6 +
    93.7 +Main Isabelle/jEdit plugin setup.
    93.8 +*/
    93.9 +
   93.10 +package isabelle.jedit
   93.11 +
   93.12 +
   93.13 +import isabelle._
   93.14 +
   93.15 +import java.io.{FileInputStream, IOException}
   93.16 +import java.awt.Font
   93.17 +
   93.18 +import scala.collection.mutable
   93.19 +import scala.swing.ComboBox
   93.20 +
   93.21 +import org.gjt.sp.jedit.{jEdit, GUIUtilities, EBMessage, EBPlugin,
   93.22 +  Buffer, EditPane, ServiceManager, View}
   93.23 +import org.gjt.sp.jedit.buffer.JEditBuffer
   93.24 +import org.gjt.sp.jedit.textarea.{JEditTextArea, TextArea}
   93.25 +import org.gjt.sp.jedit.msg.{EditorStarted, BufferUpdate, EditPaneUpdate, PropertiesChanged}
   93.26 +import org.gjt.sp.jedit.gui.DockableWindowManager
   93.27 +
   93.28 +import org.gjt.sp.util.Log
   93.29 +
   93.30 +import scala.actors.Actor
   93.31 +import Actor._
   93.32 +
   93.33 +
   93.34 +object Isabelle
   93.35 +{
   93.36 +  /* plugin instance */
   93.37 +
   93.38 +  var system: Isabelle_System = null
   93.39 +  var session: Session = null
   93.40 +
   93.41 +
   93.42 +  /* properties */
   93.43 +
   93.44 +  val OPTION_PREFIX = "options.isabelle."
   93.45 +
   93.46 +  object Property
   93.47 +  {
   93.48 +    def apply(name: String): String =
   93.49 +      jEdit.getProperty(OPTION_PREFIX + name)
   93.50 +    def apply(name: String, default: String): String =
   93.51 +      jEdit.getProperty(OPTION_PREFIX + name, default)
   93.52 +    def update(name: String, value: String) =
   93.53 +      jEdit.setProperty(OPTION_PREFIX + name, value)
   93.54 +  }
   93.55 +
   93.56 +  object Boolean_Property
   93.57 +  {
   93.58 +    def apply(name: String): Boolean =
   93.59 +      jEdit.getBooleanProperty(OPTION_PREFIX + name)
   93.60 +    def apply(name: String, default: Boolean): Boolean =
   93.61 +      jEdit.getBooleanProperty(OPTION_PREFIX + name, default)
   93.62 +    def update(name: String, value: Boolean) =
   93.63 +      jEdit.setBooleanProperty(OPTION_PREFIX + name, value)
   93.64 +  }
   93.65 +
   93.66 +  object Int_Property
   93.67 +  {
   93.68 +    def apply(name: String): Int =
   93.69 +      jEdit.getIntegerProperty(OPTION_PREFIX + name)
   93.70 +    def apply(name: String, default: Int): Int =
   93.71 +      jEdit.getIntegerProperty(OPTION_PREFIX + name, default)
   93.72 +    def update(name: String, value: Int) =
   93.73 +      jEdit.setIntegerProperty(OPTION_PREFIX + name, value)
   93.74 +  }
   93.75 +
   93.76 +  object Double_Property
   93.77 +  {
   93.78 +    def apply(name: String): Double =
   93.79 +      jEdit.getDoubleProperty(OPTION_PREFIX + name, 0.0)
   93.80 +    def apply(name: String, default: Double): Double =
   93.81 +      jEdit.getDoubleProperty(OPTION_PREFIX + name, default)
   93.82 +    def update(name: String, value: Double) =
   93.83 +      jEdit.setDoubleProperty(OPTION_PREFIX + name, value)
   93.84 +  }
   93.85 +
   93.86 +  object Time_Property
   93.87 +  {
   93.88 +    def apply(name: String): Time =
   93.89 +      Time.seconds(Double_Property(name))
   93.90 +    def apply(name: String, default: Time): Time =
   93.91 +      Time.seconds(Double_Property(name, default.seconds))
   93.92 +    def update(name: String, value: Time) =
   93.93 +      Double_Property.update(name, value.seconds)
   93.94 +  }
   93.95 +
   93.96 +
   93.97 +  /* font */
   93.98 +
   93.99 +  def font_family(): String = jEdit.getProperty("view.font")
  93.100 +
  93.101 +  def font_size(): Float =
  93.102 +    (jEdit.getIntegerProperty("view.fontsize", 16) *
  93.103 +      Int_Property("relative-font-size", 100)).toFloat / 100
  93.104 +
  93.105 +
  93.106 +  /* text area ranges */
  93.107 +
  93.108 +  case class Gfx_Range(val x: Int, val y: Int, val length: Int)
  93.109 +
  93.110 +  def gfx_range(text_area: TextArea, range: Text.Range): Option[Gfx_Range] =
  93.111 +  {
  93.112 +    val p = text_area.offsetToXY(range.start)
  93.113 +    val q = text_area.offsetToXY(range.stop)
  93.114 +    if (p != null && q != null && p.y == q.y) Some(new Gfx_Range(p.x, p.y, q.x - p.x))
  93.115 +    else None
  93.116 +  }
  93.117 +
  93.118 +
  93.119 +  /* tooltip markup */
  93.120 +
  93.121 +  def tooltip(text: String): String =
  93.122 +    "<html><pre style=\"font-family: " + font_family() + "; font-size: " +
  93.123 +        Int_Property("tooltip-font-size", 10).toString + "px; \">" +  // FIXME proper scaling (!?)
  93.124 +      HTML.encode(text) + "</pre></html>"
  93.125 +
  93.126 +  def tooltip_dismiss_delay(): Time =
  93.127 +    Time_Property("tooltip-dismiss-delay", Time.seconds(8.0)) max Time.seconds(0.5)
  93.128 +
  93.129 +  def setup_tooltips()
  93.130 +  {
  93.131 +    Swing_Thread.now {
  93.132 +      val manager = javax.swing.ToolTipManager.sharedInstance
  93.133 +      manager.setDismissDelay(tooltip_dismiss_delay().ms.toInt)
  93.134 +    }
  93.135 +  }
  93.136 +
  93.137 +
  93.138 +  /* icons */
  93.139 +
  93.140 +  def load_icon(name: String): javax.swing.Icon =
  93.141 +  {
  93.142 +    val icon = GUIUtilities.loadIcon(name)
  93.143 +    if (icon.getIconWidth < 0 || icon.getIconHeight < 0)
  93.144 +      Log.log(Log.ERROR, icon, "Bad icon: " + name)
  93.145 +    icon
  93.146 +  }
  93.147 +
  93.148 +
  93.149 +  /* check JVM */
  93.150 +
  93.151 +  def check_jvm()
  93.152 +  {
  93.153 +    if (!Platform.is_hotspot) {
  93.154 +      Library.warning_dialog(jEdit.getActiveView, "Bad Java Virtual Machine",
  93.155 +        "This is " + Platform.jvm_name,
  93.156 +        "Isabelle/jEdit requires Java Hotspot from Sun/Oracle/Apple!")
  93.157 +    }
  93.158 +  }
  93.159 +
  93.160 +
  93.161 +  /* main jEdit components */
  93.162 +
  93.163 +  def jedit_buffers(): Iterator[Buffer] = jEdit.getBuffers().iterator
  93.164 +
  93.165 +  def jedit_views(): Iterator[View] = jEdit.getViews().iterator
  93.166 +
  93.167 +  def jedit_text_areas(view: View): Iterator[JEditTextArea] =
  93.168 +    view.getEditPanes().iterator.map(_.getTextArea)
  93.169 +
  93.170 +  def jedit_text_areas(): Iterator[JEditTextArea] =
  93.171 +    jedit_views().flatMap(jedit_text_areas(_))
  93.172 +
  93.173 +  def jedit_text_areas(buffer: JEditBuffer): Iterator[JEditTextArea] =
  93.174 +    jedit_text_areas().filter(_.getBuffer == buffer)
  93.175 +
  93.176 +  def buffer_lock[A](buffer: JEditBuffer)(body: => A): A =
  93.177 +  {
  93.178 +    try { buffer.readLock(); body }
  93.179 +    finally { buffer.readUnlock() }
  93.180 +  }
  93.181 +
  93.182 +  def swing_buffer_lock[A](buffer: JEditBuffer)(body: => A): A =
  93.183 +    Swing_Thread.now { buffer_lock(buffer) { body } }
  93.184 +
  93.185 +  def buffer_text(buffer: JEditBuffer): String =
  93.186 +    buffer_lock(buffer) { buffer.getText(0, buffer.getLength) }
  93.187 +
  93.188 +
  93.189 +  /* dockable windows */
  93.190 +
  93.191 +  private def wm(view: View): DockableWindowManager = view.getDockableWindowManager
  93.192 +
  93.193 +  def docked_session(view: View): Option[Session_Dockable] =
  93.194 +    wm(view).getDockableWindow("isabelle-session") match {
  93.195 +      case dockable: Session_Dockable => Some(dockable)
  93.196 +      case _ => None
  93.197 +    }
  93.198 +
  93.199 +  def docked_output(view: View): Option[Output_Dockable] =
  93.200 +    wm(view).getDockableWindow("isabelle-output") match {
  93.201 +      case dockable: Output_Dockable => Some(dockable)
  93.202 +      case _ => None
  93.203 +    }
  93.204 +
  93.205 +  def docked_raw_output(view: View): Option[Raw_Output_Dockable] =
  93.206 +    wm(view).getDockableWindow("isabelle-raw-output") match {
  93.207 +      case dockable: Raw_Output_Dockable => Some(dockable)
  93.208 +      case _ => None
  93.209 +    }
  93.210 +
  93.211 +  def docked_protocol(view: View): Option[Protocol_Dockable] =
  93.212 +    wm(view).getDockableWindow("isabelle-protocol") match {
  93.213 +      case dockable: Protocol_Dockable => Some(dockable)
  93.214 +      case _ => None
  93.215 +    }
  93.216 +
  93.217 +
  93.218 +  /* logic image */
  93.219 +
  93.220 +  def default_logic(): String =
  93.221 +  {
  93.222 +    val logic = system.getenv("JEDIT_LOGIC")
  93.223 +    if (logic != "") logic
  93.224 +    else system.getenv_strict("ISABELLE_LOGIC")
  93.225 +  }
  93.226 +
  93.227 +  class Logic_Entry(val name: String, val description: String)
  93.228 +  {
  93.229 +    override def toString = description
  93.230 +  }
  93.231 +
  93.232 +  def logic_selector(logic: String): ComboBox[Logic_Entry] =
  93.233 +  {
  93.234 +    val entries =
  93.235 +      new Logic_Entry("", "default (" + default_logic() + ")") ::
  93.236 +        system.find_logics().map(name => new Logic_Entry(name, name))
  93.237 +    val component = new ComboBox(entries)
  93.238 +    entries.find(_.name == logic) match {
  93.239 +      case None =>
  93.240 +      case Some(entry) => component.selection.item = entry
  93.241 +    }
  93.242 +    component.tooltip = "Isabelle logic image"
  93.243 +    component
  93.244 +  }
  93.245 +
  93.246 +  def start_session()
  93.247 +  {
  93.248 +    val timeout = Time_Property("startup-timeout", Time.seconds(10)) max Time.seconds(5)
  93.249 +    val modes = system.getenv("JEDIT_PRINT_MODE").split(",").toList.map("-m" + _)
  93.250 +    val logic = {
  93.251 +      val logic = Property("logic")
  93.252 +      if (logic != null && logic != "") logic
  93.253 +      else Isabelle.default_logic()
  93.254 +    }
  93.255 +    session.start(timeout, modes ::: List(logic))
  93.256 +  }
  93.257 +}
  93.258 +
  93.259 +
  93.260 +class Plugin extends EBPlugin
  93.261 +{
  93.262 +  /* session management */
  93.263 +
  93.264 +  private def init_model(buffer: Buffer)
  93.265 +  {
  93.266 +    Isabelle.swing_buffer_lock(buffer) {
  93.267 +      val opt_model =
  93.268 +        Document_Model(buffer) match {
  93.269 +          case Some(model) => model.refresh; Some(model)
  93.270 +          case None =>
  93.271 +            Thy_Header.split_thy_path(Isabelle.system.posix_path(buffer.getPath)) match {
  93.272 +              case Some((dir, thy_name)) =>
  93.273 +                Some(Document_Model.init(Isabelle.session, buffer, dir + "/" + thy_name))
  93.274 +              case None => None
  93.275 +            }
  93.276 +        }
  93.277 +      if (opt_model.isDefined) {
  93.278 +        for (text_area <- Isabelle.jedit_text_areas(buffer)) {
  93.279 +          if (Document_View(text_area).map(_.model) != opt_model)
  93.280 +            Document_View.init(opt_model.get, text_area)
  93.281 +        }
  93.282 +      }
  93.283 +    }
  93.284 +  }
  93.285 +
  93.286 +  private def exit_model(buffer: Buffer)
  93.287 +  {
  93.288 +    Isabelle.swing_buffer_lock(buffer) {
  93.289 +      Isabelle.jedit_text_areas(buffer).foreach(Document_View.exit)
  93.290 +      Document_Model.exit(buffer)
  93.291 +    }
  93.292 +  }
  93.293 +
  93.294 +  private case class Init_Model(buffer: Buffer)
  93.295 +  private case class Exit_Model(buffer: Buffer)
  93.296 +  private case class Init_View(buffer: Buffer, text_area: JEditTextArea)
  93.297 +  private case class Exit_View(buffer: Buffer, text_area: JEditTextArea)
  93.298 +
  93.299 +  private val session_manager = actor {
  93.300 +    var ready = false
  93.301 +    loop {
  93.302 +      react {
  93.303 +        case phase: Session.Phase =>
  93.304 +          ready = phase == Session.Ready
  93.305 +          phase match {
  93.306 +            case Session.Failed =>
  93.307 +              Swing_Thread.now {
  93.308 +                val text = new scala.swing.TextArea(Isabelle.session.syslog())
  93.309 +                text.editable = false
  93.310 +                Library.error_dialog(jEdit.getActiveView, "Failed to start Isabelle process", text)
  93.311 +              }
  93.312 +
  93.313 +            case Session.Ready => Isabelle.jedit_buffers.foreach(init_model)
  93.314 +            case Session.Shutdown => Isabelle.jedit_buffers.foreach(exit_model)
  93.315 +            case _ =>
  93.316 +          }
  93.317 +
  93.318 +        case Init_Model(buffer) =>
  93.319 +          if (ready) init_model(buffer)
  93.320 +
  93.321 +        case Exit_Model(buffer) =>
  93.322 +          exit_model(buffer)
  93.323 +
  93.324 +        case Init_View(buffer, text_area) =>
  93.325 +          if (ready) {
  93.326 +            Isabelle.swing_buffer_lock(buffer) {
  93.327 +              Document_Model(buffer) match {
  93.328 +                case Some(model) => Document_View.init(model, text_area)
  93.329 +                case None =>
  93.330 +              }
  93.331 +            }
  93.332 +          }
  93.333 +
  93.334 +        case Exit_View(buffer, text_area) =>
  93.335 +          Isabelle.swing_buffer_lock(buffer) {
  93.336 +            Document_View.exit(text_area)
  93.337 +          }
  93.338 +
  93.339 +        case bad => System.err.println("session_manager: ignoring bad message " + bad)
  93.340 +      }
  93.341 +    }
  93.342 +  }
  93.343 +
  93.344 +
  93.345 +  /* main plugin plumbing */
  93.346 +
  93.347 +  override def handleMessage(message: EBMessage)
  93.348 +  {
  93.349 +    message match {
  93.350 +      case msg: EditorStarted =>
  93.351 +      Isabelle.check_jvm()
  93.352 +      if (Isabelle.Boolean_Property("auto-start")) Isabelle.start_session()
  93.353 +
  93.354 +      case msg: BufferUpdate
  93.355 +      if msg.getWhat == BufferUpdate.PROPERTIES_CHANGED =>
  93.356 +
  93.357 +        val buffer = msg.getBuffer
  93.358 +        if (buffer != null) session_manager ! Init_Model(buffer)
  93.359 +
  93.360 +      case msg: EditPaneUpdate
  93.361 +      if (msg.getWhat == EditPaneUpdate.BUFFER_CHANGING ||
  93.362 +          msg.getWhat == EditPaneUpdate.BUFFER_CHANGED ||
  93.363 +          msg.getWhat == EditPaneUpdate.CREATED ||
  93.364 +          msg.getWhat == EditPaneUpdate.DESTROYED) =>
  93.365 +
  93.366 +        val edit_pane = msg.getEditPane
  93.367 +        val buffer = edit_pane.getBuffer
  93.368 +        val text_area = edit_pane.getTextArea
  93.369 +
  93.370 +        if (buffer != null && text_area != null) {
  93.371 +          if (msg.getWhat == EditPaneUpdate.BUFFER_CHANGED ||
  93.372 +              msg.getWhat == EditPaneUpdate.CREATED)
  93.373 +            session_manager ! Init_View(buffer, text_area)
  93.374 +          else
  93.375 +            session_manager ! Exit_View(buffer, text_area)
  93.376 +        }
  93.377 +
  93.378 +      case msg: PropertiesChanged =>
  93.379 +        Swing_Thread.now {
  93.380 +          Isabelle.setup_tooltips()
  93.381 +          for (text_area <- Isabelle.jedit_text_areas if Document_View(text_area).isDefined)
  93.382 +            Document_View(text_area).get.extend_styles()
  93.383 +        }
  93.384 +        Isabelle.session.global_settings.event(Session.Global_Settings)
  93.385 +
  93.386 +      case _ =>
  93.387 +    }
  93.388 +  }
  93.389 +
  93.390 +  override def start()
  93.391 +  {
  93.392 +    Isabelle.setup_tooltips()
  93.393 +    Isabelle.system = new Isabelle_System
  93.394 +    Isabelle.system.install_fonts()
  93.395 +    Isabelle.session = new Session(Isabelle.system)
  93.396 +    Isabelle.session.phase_changed += session_manager
  93.397 +  }
  93.398 +
  93.399 +  override def stop()
  93.400 +  {
  93.401 +    Isabelle.session.stop()
  93.402 +    Isabelle.session.phase_changed -= session_manager
  93.403 +  }
  93.404 +}
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/src/Tools/jEdit/src/protocol_dockable.scala	Wed Jun 08 22:13:49 2011 +0200
    94.3 @@ -0,0 +1,39 @@
    94.4 +/*  Title:      Tools/jEdit/src/protocol_dockable.scala
    94.5 +    Author:     Makarius
    94.6 +
    94.7 +Dockable window for protocol messages.
    94.8 +*/
    94.9 +
   94.10 +package isabelle.jedit
   94.11 +
   94.12 +
   94.13 +import isabelle._
   94.14 +
   94.15 +import scala.actors.Actor._
   94.16 +import scala.swing.{TextArea, ScrollPane}
   94.17 +
   94.18 +import org.gjt.sp.jedit.View
   94.19 +
   94.20 +
   94.21 +class Protocol_Dockable(view: View, position: String) extends Dockable(view, position)
   94.22 +{
   94.23 +  private val text_area = new TextArea
   94.24 +  set_content(new ScrollPane(text_area))
   94.25 +
   94.26 +
   94.27 +  /* main actor */
   94.28 +
   94.29 +  private val main_actor = actor {
   94.30 +    loop {
   94.31 +      react {
   94.32 +        case result: Isabelle_Process.Result =>
   94.33 +          Swing_Thread.now { text_area.append(result.message.toString + "\n") }
   94.34 +
   94.35 +        case bad => System.err.println("Protocol_Dockable: ignoring bad message " + bad)
   94.36 +      }
   94.37 +    }
   94.38 +  }
   94.39 +
   94.40 +  override def init() { Isabelle.session.raw_messages += main_actor }
   94.41 +  override def exit() { Isabelle.session.raw_messages -= main_actor }
   94.42 +}
    95.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.2 +++ b/src/Tools/jEdit/src/raw_output_dockable.scala	Wed Jun 08 22:13:49 2011 +0200
    95.3 @@ -0,0 +1,42 @@
    95.4 +/*  Title:      Tools/jEdit/src/raw_output_dockable.scala
    95.5 +    Author:     Makarius
    95.6 +
    95.7 +Dockable window for raw process output (stdout).
    95.8 +*/
    95.9 +
   95.10 +package isabelle.jedit
   95.11 +
   95.12 +
   95.13 +import isabelle._
   95.14 +
   95.15 +import scala.actors.Actor._
   95.16 +import scala.swing.{TextArea, ScrollPane}
   95.17 +
   95.18 +import org.gjt.sp.jedit.View
   95.19 +
   95.20 +
   95.21 +class Raw_Output_Dockable(view: View, position: String)
   95.22 +  extends Dockable(view: View, position: String)
   95.23 +{
   95.24 +  private val text_area = new TextArea
   95.25 +  text_area.editable = false
   95.26 +  set_content(new ScrollPane(text_area))
   95.27 +
   95.28 +
   95.29 +  /* main actor */
   95.30 +
   95.31 +  private val main_actor = actor {
   95.32 +    loop {
   95.33 +      react {
   95.34 +        case result: Isabelle_Process.Result =>
   95.35 +          if (result.is_stdout)
   95.36 +            Swing_Thread.now { text_area.append(XML.content(result.message).mkString) }
   95.37 +
   95.38 +        case bad => System.err.println("Raw_Output_Dockable: ignoring bad message " + bad)
   95.39 +      }
   95.40 +    }
   95.41 +  }
   95.42 +
   95.43 +  override def init() { Isabelle.session.raw_messages += main_actor }
   95.44 +  override def exit() { Isabelle.session.raw_messages -= main_actor }
   95.45 +}
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/src/Tools/jEdit/src/scala_console.scala	Wed Jun 08 22:13:49 2011 +0200
    96.3 @@ -0,0 +1,155 @@
    96.4 +/*  Title:      Tools/jEdit/src/scala_console.scala
    96.5 +    Author:     Makarius
    96.6 +
    96.7 +Scala instance of Console plugin.
    96.8 +*/
    96.9 +
   96.10 +package isabelle.jedit
   96.11 +
   96.12 +
   96.13 +import isabelle._
   96.14 +
   96.15 +import console.{Console, ConsolePane, Shell, Output}
   96.16 +
   96.17 +import org.gjt.sp.jedit.{jEdit, JARClassLoader}
   96.18 +import org.gjt.sp.jedit.MiscUtilities
   96.19 +
   96.20 +import java.io.{File, OutputStream, Writer, PrintWriter}
   96.21 +
   96.22 +import scala.tools.nsc.{Interpreter, GenericRunnerSettings, NewLinePrintWriter, ConsoleWriter}
   96.23 +import scala.collection.mutable
   96.24 +
   96.25 +
   96.26 +class Scala_Console extends Shell("Scala")
   96.27 +{
   96.28 +  /* reconstructed jEdit/plugin classpath */
   96.29 +
   96.30 +  private def reconstruct_classpath(): String =
   96.31 +  {
   96.32 +    def find_jars(start: String): List[String] =
   96.33 +      if (start != null)
   96.34 +        Standard_System.find_files(new File(start),
   96.35 +          entry => entry.isFile && entry.getName.endsWith(".jar")).map(_.getAbsolutePath)
   96.36 +      else Nil
   96.37 +    val path = find_jars(jEdit.getSettingsDirectory) ::: find_jars(jEdit.getJEditHome)
   96.38 +    path.mkString(File.pathSeparator)
   96.39 +  }
   96.40 +
   96.41 +
   96.42 +  /* global state -- owned by Swing thread */
   96.43 +
   96.44 +  private var interpreters = Map[Console, Interpreter]()
   96.45 +
   96.46 +  private var global_console: Console = null
   96.47 +  private var global_out: Output = null
   96.48 +  private var global_err: Output = null
   96.49 +
   96.50 +  private val console_stream = new OutputStream
   96.51 +  {
   96.52 +    val buf = new StringBuilder
   96.53 +    override def flush()
   96.54 +    {
   96.55 +      val str = Standard_System.decode_permissive_utf8(buf.toString)
   96.56 +      buf.clear
   96.57 +      if (global_out == null) System.out.print(str)
   96.58 +      else Swing_Thread.now { global_out.writeAttrs(null, str) }
   96.59 +    }
   96.60 +    override def close() { flush () }
   96.61 +    def write(byte: Int) { buf.append(byte.toChar) }
   96.62 +  }
   96.63 +
   96.64 +  private val console_writer = new Writer
   96.65 +  {
   96.66 +    def flush() {}
   96.67 +    def close() {}
   96.68 +
   96.69 +    def write(cbuf: Array[Char], off: Int, len: Int)
   96.70 +    {
   96.71 +      if (len > 0) write(new String(cbuf.slice(off, off + len)))
   96.72 +    }
   96.73 +
   96.74 +    override def write(str: String)
   96.75 +    {
   96.76 +      if (global_out == null) System.out.println(str)
   96.77 +      else global_out.print(null, str)
   96.78 +    }
   96.79 +  }
   96.80 +
   96.81 +  private def with_console[A](console: Console, out: Output, err: Output)(e: => A): A =
   96.82 +  {
   96.83 +    global_console = console
   96.84 +    global_out = out
   96.85 +    global_err = if (err == null) out else err
   96.86 +    val res = Exn.capture { scala.Console.withOut(console_stream)(e) }
   96.87 +    console_stream.flush
   96.88 +    global_console = null
   96.89 +    global_out = null
   96.90 +    global_err = null
   96.91 +    Exn.release(res)
   96.92 +  }
   96.93 +
   96.94 +  private def report_error(str: String)
   96.95 +  {
   96.96 +    if (global_console == null || global_err == null) System.err.println(str)
   96.97 +    else Swing_Thread.now { global_err.print(global_console.getErrorColor, str) }
   96.98 +  }
   96.99 +
  96.100 +
  96.101 +  /* jEdit console methods */
  96.102 +
  96.103 +  override def openConsole(console: Console)
  96.104 +  {
  96.105 +    val settings = new GenericRunnerSettings(report_error)
  96.106 +    settings.classpath.value = reconstruct_classpath()
  96.107 +
  96.108 +    val interp = new Interpreter(settings, new PrintWriter(console_writer, true))
  96.109 +    {
  96.110 +      override def parentClassLoader = new JARClassLoader
  96.111 +    }
  96.112 +    interp.setContextClassLoader
  96.113 +    interp.bind("view", "org.gjt.sp.jedit.View", console.getView)
  96.114 +    interp.bind("console", "console.Console", console)
  96.115 +    interp.interpret("import isabelle.jedit.Isabelle")
  96.116 +
  96.117 +    interpreters += (console -> interp)
  96.118 +  }
  96.119 +
  96.120 +  override def closeConsole(console: Console)
  96.121 +  {
  96.122 +    interpreters -= console
  96.123 +  }
  96.124 +
  96.125 +  override def printInfoMessage(out: Output)
  96.126 +  {
  96.127 +    out.print(null,
  96.128 +     "This shell evaluates Isabelle/Scala expressions.\n\n" +
  96.129 +     "The following special toplevel bindings are provided:\n" +
  96.130 +     "  view      -- current jEdit/Swing view (e.g. view.getBuffer, view.getTextArea)\n" +
  96.131 +     "  console   -- jEdit Console plugin instance\n" +
  96.132 +     "  Isabelle  -- Isabelle plugin instance (e.g. Isabelle.system, Isabelle.session)\n")
  96.133 +  }
  96.134 +
  96.135 +  override def printPrompt(console: Console, out: Output)
  96.136 +  {
  96.137 +    out.writeAttrs(ConsolePane.colorAttributes(console.getInfoColor), "scala>")
  96.138 +    out.writeAttrs(ConsolePane.colorAttributes(console.getPlainColor), " ")
  96.139 +  }
  96.140 +
  96.141 +  override def execute(console: Console, input: String, out: Output, err: Output, command: String)
  96.142 +  {
  96.143 +    val interp = interpreters(console)
  96.144 +    with_console(console, out, err) { interp.interpret(command) }
  96.145 +    if (err != null) err.commandDone()
  96.146 +    out.commandDone()
  96.147 +  }
  96.148 +
  96.149 +  override def stop(console: Console)
  96.150 +  {
  96.151 +    closeConsole(console)
  96.152 +    console.clear
  96.153 +    openConsole(console)
  96.154 +    val out = console.getOutput
  96.155 +    out.commandDone
  96.156 +    printPrompt(console, out)
  96.157 +  }
  96.158 +}
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/src/Tools/jEdit/src/services.xml	Wed Jun 08 22:13:49 2011 +0200
    97.3 @@ -0,0 +1,20 @@
    97.4 +<?xml version="1.0"?>
    97.5 +<!DOCTYPE SERVICES SYSTEM "services.dtd">
    97.6 +
    97.7 +<SERVICES>
    97.8 +	<SERVICE NAME="UTF-8-Isabelle" CLASS="org.gjt.sp.jedit.io.Encoding">
    97.9 +		new isabelle.jedit.Isabelle_Encoding();
   97.10 +	</SERVICE>
   97.11 +	<SERVICE NAME="isabelle" CLASS="sidekick.SideKickParser">
   97.12 +		new isabelle.jedit.Isabelle_Sidekick_Default();
   97.13 +	</SERVICE>
   97.14 +	<SERVICE NAME="isabelle-raw" CLASS="sidekick.SideKickParser">
   97.15 +		new isabelle.jedit.Isabelle_Sidekick_Raw();
   97.16 +	</SERVICE>
   97.17 +  <SERVICE NAME="isabelle" CLASS="gatchan.jedit.hyperlinks.HyperlinkSource">
   97.18 +    new isabelle.jedit.Isabelle_Hyperlinks();
   97.19 +  </SERVICE>
   97.20 + 	<SERVICE CLASS="console.Shell" NAME="Scala">
   97.21 +		new isabelle.jedit.Scala_Console();
   97.22 +	</SERVICE>
   97.23 +</SERVICES>
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/src/Tools/jEdit/src/session_dockable.scala	Wed Jun 08 22:13:49 2011 +0200
    98.3 @@ -0,0 +1,104 @@
    98.4 +/*  Title:      Tools/jEdit/src/session_dockable.scala
    98.5 +    Author:     Makarius
    98.6 +
    98.7 +Dockable window for prover session management.
    98.8 +*/
    98.9 +
   98.10 +package isabelle.jedit
   98.11 +
   98.12 +
   98.13 +import isabelle._
   98.14 +
   98.15 +import scala.actors.Actor._
   98.16 +import scala.swing.{FlowPanel, Button, TextArea, Label, ScrollPane, TabbedPane, Component, Swing}
   98.17 +import scala.swing.event.{ButtonClicked, SelectionChanged}
   98.18 +
   98.19 +import java.awt.BorderLayout
   98.20 +import javax.swing.border.{BevelBorder, SoftBevelBorder}
   98.21 +
   98.22 +import org.gjt.sp.jedit.View
   98.23 +
   98.24 +
   98.25 +class Session_Dockable(view: View, position: String) extends Dockable(view: View, position: String)
   98.26 +{
   98.27 +  /* main tabs */
   98.28 +
   98.29 +  private val readme = new HTML_Panel(Isabelle.system, "SansSerif", 14)
   98.30 +  readme.render_document(Isabelle.system.try_read(List("$JEDIT_HOME/README.html")))
   98.31 +
   98.32 +  private val syslog = new TextArea(Isabelle.session.syslog())
   98.33 +  syslog.editable = false
   98.34 +
   98.35 +  private val tabs = new TabbedPane {
   98.36 +    pages += new TabbedPane.Page("README", Component.wrap(readme))
   98.37 +    pages += new TabbedPane.Page("System log", new ScrollPane(syslog))
   98.38 +
   98.39 +    selection.index =
   98.40 +    {
   98.41 +      val index = Isabelle.Int_Property("session-panel.selection", 0)
   98.42 +      if (index >= pages.length) 0 else index
   98.43 +    }
   98.44 +    listenTo(selection)
   98.45 +    reactions += {
   98.46 +      case SelectionChanged(_) =>
   98.47 +        Isabelle.Int_Property("session-panel.selection") = selection.index
   98.48 +    }
   98.49 +  }
   98.50 +
   98.51 +  set_content(tabs)
   98.52 +
   98.53 +
   98.54 +  /* controls */
   98.55 +
   98.56 +  val session_phase = new Label(Isabelle.session.phase.toString)
   98.57 +  session_phase.border = new SoftBevelBorder(BevelBorder.LOWERED)
   98.58 +  session_phase.tooltip = "Prover status"
   98.59 +
   98.60 +  private val interrupt = new Button("Interrupt") {
   98.61 +    reactions += { case ButtonClicked(_) => Isabelle.session.interrupt }
   98.62 +  }
   98.63 +  interrupt.tooltip = "Broadcast interrupt to all prover tasks"
   98.64 +
   98.65 +  private val logic = Isabelle.logic_selector(Isabelle.Property("logic"))
   98.66 +  logic.listenTo(logic.selection)
   98.67 +  logic.reactions += {
   98.68 +    case SelectionChanged(_) => Isabelle.Property("logic") = logic.selection.item.name
   98.69 +  }
   98.70 +
   98.71 +  private val controls =
   98.72 +    new FlowPanel(FlowPanel.Alignment.Right)(session_phase, interrupt, logic)
   98.73 +  add(controls.peer, BorderLayout.NORTH)
   98.74 +
   98.75 +
   98.76 +  /* main actor */
   98.77 +
   98.78 +  private val main_actor = actor {
   98.79 +    loop {
   98.80 +      react {
   98.81 +        case result: Isabelle_Process.Result =>
   98.82 +          if (result.is_syslog)
   98.83 +            Swing_Thread.now {
   98.84 +              val text = Isabelle.session.syslog()
   98.85 +              if (text != syslog.text) {
   98.86 +                syslog.text = text
   98.87 +              }
   98.88 +            }
   98.89 +
   98.90 +        case phase: Session.Phase =>
   98.91 +          Swing_Thread.now { session_phase.text = " " + phase.toString + " " }
   98.92 +
   98.93 +        case bad => System.err.println("Session_Dockable: ignoring bad message " + bad)
   98.94 +      }
   98.95 +    }
   98.96 +  }
   98.97 +
   98.98 +  override def init() {
   98.99 +    Isabelle.session.raw_messages += main_actor
  98.100 +    Isabelle.session.phase_changed += main_actor
  98.101 +  }
  98.102 +
  98.103 +  override def exit() {
  98.104 +    Isabelle.session.raw_messages -= main_actor
  98.105 +    Isabelle.session.phase_changed -= main_actor
  98.106 +  }
  98.107 +}
    99.1 --- a/src/Tools/subtyping.ML	Wed Jun 08 17:01:07 2011 +0200
    99.2 +++ b/src/Tools/subtyping.ML	Wed Jun 08 22:13:49 2011 +0200
    99.3 @@ -246,7 +246,7 @@
    99.4        | gen cs _ (Free (_, T)) tye_idx = (T, tye_idx, cs)
    99.5        | gen cs _ (Var (_, T)) tye_idx = (T, tye_idx, cs)
    99.6        | gen cs bs (Bound i) tye_idx =
    99.7 -          (snd (nth bs i handle Subscript => err_loose i), tye_idx, cs)
    99.8 +          (snd (nth bs i handle General.Subscript => err_loose i), tye_idx, cs)
    99.9        | gen cs bs (Abs (x, T, t)) tye_idx =
   99.10            let val (U, tye_idx', cs') = gen cs ((x, T) :: bs) t tye_idx
   99.11            in (T --> U, tye_idx', cs') end
   99.12 @@ -636,7 +636,7 @@
   99.13            let val T' = T;
   99.14            in (Var (xi, T'), T') end
   99.15        | insert bs (Bound i) =
   99.16 -          let val T = nth bs i handle Subscript => err_loose i;
   99.17 +          let val T = nth bs i handle General.Subscript => err_loose i;
   99.18            in (Bound i, T) end
   99.19        | insert bs (Abs (x, T, t)) =
   99.20            let
   99.21 @@ -671,7 +671,7 @@
   99.22        | inf _ (t as (Free (_, T))) tye_idx = (t, T, tye_idx)
   99.23        | inf _ (t as (Var (_, T))) tye_idx = (t, T, tye_idx)
   99.24        | inf bs (t as (Bound i)) tye_idx =
   99.25 -          (t, snd (nth bs i handle Subscript => err_loose i), tye_idx)
   99.26 +          (t, snd (nth bs i handle General.Subscript => err_loose i), tye_idx)
   99.27        | inf bs (Abs (x, T, t)) tye_idx =
   99.28            let val (t', U, tye_idx') = inf ((x, T) :: bs) t tye_idx
   99.29            in (Abs (x, T, t'), T --> U, tye_idx') end