SciTE Java API

简介: (转自http://www.burgaud.com/scite-java-api/)SciTE (Scintilla Text Editor) supports API and Keyword files to customize some asp...

(转自http://www.burgaud.com/scite-java-api/)

SciTE (Scintilla Text Editor) supports API and Keyword files to customize some aspects of the editor for a given programming language. Keywords files extend the highlighting of source code files (i.e. Class names in Java), and API files allow to displays calltips, basic form of the popular Microsoft Intellisense ®. The BeanShell script, SciteJavaApi.bsh, generates both the Java API and the Keyword files for your current Java Runtime Environment.

Summary

Requirements

If you just need the API and Keyword files, download SciteJavaApi_api_files.zip (947kB) and jump to section SciTE Configuration.

In order to run SciteJavaApi.bsh you need:

  1. A recent version of the Java Runtime Environment.
  2. A recent version of the Java Dynamic Language BeanShell. Some packages available for download already include the BeanShell library.

Of course, you also need SciTE (Scintilla Text Editor) in order to use the Java API files.

Installation and Usage

  • Download the latest release: SciteJavaApi15.zip (8kB). If you don’t have already BeanShell, download the package including it: SciteJavaApi15_bsh.zip (364kB).
  • Extract the content of the SciteJavaApi zip file to your hard drive.
  • Assuming SciteJavaApi.bsh and bsh-2.0b5.jar being in C:\SciteJavaApi, execute:
C:\SciteJavaApi>java -cp bsh-2.0b5.jar bsh.Interpreter SciteJavaApi.bsh
  • You should get the following output:
Start ClassPath Mapping
Mapping: Archive: file:/C:/bsh/bsh-2.0b5.jar
Mapping: Archive: file:/C:/jdk1.5.0_06/jre/lib/rt.jar
End ClassPath Mapping
======================================
Beanshell SciteJavaApi
Version 1.5 December 23, 2006
Copyright 2000-2006 (c) Andre Burgaud
======================================
BeanShell 2.0b5 - by Pat Niemeyer (pat@pat.net)
Java 1.5.0_06 - by Sun Microsystems Inc.
======================================
Beanshell SciTETools Menu
- Type "q|Q" and [ENTER] to quit.
- Type "1" and [ENTER] to build a Java Keywords file for SciTE.
- Type "2" and [ENTER] to build a Java Api file for SciTE.
Your choice:
  • Choose 1 or 2 to generate respectively the Java Keywords file or the Java API file.
  • To generate the API files for a different Java version, invoke the corresponding Java command. You can achieve this by using the environment variable JAVA_HOME. See the shell script java_api.sh and windows batch file java_api.bat included in the package for more detailed examples.
  • After generating the API files, you can configure SciTE.

SciTE Configuration

  • Copy the Java API and keywords files in the install directory of SciTE (where the default SciTE properties files are).
  • Assuming that the API and Keywords files are respectively: java150.api and java150_kwd.properties.
  • Open the file cpp.properties available in the install directory of SciTE.
  • Add the following lines (check first if similar lines are already existing and modify accordingly):
import java150_kwd
api.*.java=$(SciteDefaultHome)\java150.api
calltip.java.word.characters=._$(word.chars.cxx)
calltip.java.parameters.start=(
calltip.java.parameters.start=)
calltip.java.parameters.separators=.

Note: In versions prior to 1.5, SciteJavaApi.bsh generated the keyword file with the format java150.kwd. You had to rename the file to java150_kwd.properties, in order to allow the import to work.

Configuring SciTE as explained above will enable the following features:

  1. Java classes highlighting,
  2. Calltips,
  3. Auto completion.

Java Classes Highlighting

The Java classes highlighting is automatically enabled due to the import of the keywords file. Classes are highlighted as shown in the following screen capture:

SciTE Keyword Highlighting

To modify the highlight color, modify the value of the style associated with keyword2 in the file cpp.properties:

...
# Keywords2
style.cpp.16=fore:#B00040
...

Note: To limit the size of the keywords properties file, only classes from packages started with java are included. This excludes classes from javax packages for example.

Calltips

With the calltip configuration, such as the one described in the section Scite Configuration, when you type the open parenthesis after a method name, a scrollable pop-up help box displays the possible parameters of this method. You can enter the parameters accordingly, and also use the mouse to navigate up and down to see the other method signatures. You can also invoke calltips by pressing Ctrl+Shift+Space with the cursor located inside of the method parameter parenthesis.

SciTE Calltips

Auto Completion

SciTE allows you to customize the behavior of the word completion feature, based on the source code being edited. In the case of Java, I simply suggest to take advantage of the the word completion from the API file by invoking it via the shortcut key Ctrl+Space or Ctrl+i, as shown in the screen capture below:

SciTE API Completion

Though not directly related to the auto completion provided by the API file, there is another auto completion feature available in SciTE. By typing Ctrl+Enter just after at least one character, SciTE will open a list of words already available in your file and matching the first characters of the word being typed.

SciTE Auto Completion

Compatibility

  • Version 1.5 of the BeanShell script was tested with BeanShell 2.0b4 and 2.0b5, Java 1.3.1, 1.4.2, 1.5.0 and 1.6.0, on Windows XP and Linux. BeanShell 2.0b5 is not compatible with Java 1.3.1 and Java 1.4.2: it causes the error java.lang.UnsupportedClassVersionError.
  • Version 1.4 of the BeanShell script was tested with BeanShell 1.3, 2.0b2 and 2.0b4, Java 1.4.2 and 5.0.
  • Version 1.3 of the BeanShell script was tested with BeanShell 2.0b1. It is not compatible with previous versions of BeanShell.
  • Version 1.2 of the script is not compatible with BeanShell 1.3 nor 2.0b1. It is only working with BeanShell 1.2.
目录
相关文章
|
2天前
|
Java API
Java基础&API(3)
Java基础&API(3)
|
2天前
|
Java 机器人 API
Java基础&常用API(1)
Java基础&常用API(1)
|
2天前
|
安全 Java 程序员
|
6天前
|
Java API Apache
ZooKeeper【基础 03】Java 客户端 Apache Curator 基础 API 使用举例(含源代码)
【4月更文挑战第11天】ZooKeeper【基础 03】Java 客户端 Apache Curator 基础 API 使用举例(含源代码)
24 11
|
8天前
|
安全 Java API
java借助代理ip,解决访问api频繁导致ip被禁的问题
java借助代理ip,解决访问api频繁导致ip被禁的问题
|
10天前
|
存储 安全 Java
说说Java 8 引入的Stream API
说说Java 8 引入的Stream API
12 0
|
10天前
|
分布式计算 Java API
Java 8新特性之Lambda表达式与Stream API
【4月更文挑战第16天】本文将介绍Java 8中的两个重要新特性:Lambda表达式和Stream API。Lambda表达式是Java 8中引入的一种新的编程语法,它允许我们将函数作为参数传递给其他方法,从而使代码更加简洁、易读。Stream API是Java 8中引入的一种新的数据处理方式,它允许我们以声明式的方式处理数据,从而使代码更加简洁、高效。本文将通过实例代码详细讲解这两个新特性的使用方法和优势。
|
11天前
|
安全 Java API
RESTful API设计与实现:Java后台开发指南
【4月更文挑战第15天】本文介绍了如何使用Java开发RESTful API,重点是Spring Boot框架和Spring MVC。遵循无状态、统一接口、资源标识和JSON数据格式的设计原则,通过创建控制器处理HTTP请求,如示例中的用户管理操作。此外,文章还提及数据绑定、验证、异常处理和跨域支持。最后,提出了版本控制、安全性、文档测试以及限流和缓存的最佳实践,以确保API的稳定、安全和高效。
|
14天前
|
存储 Java 关系型数据库
掌握Java 8 Stream API的艺术:详解流式编程(一)
掌握Java 8 Stream API的艺术:详解流式编程
46 1
|
23天前
|
前端开发 Java API
构建RESTful API:Java中的RESTful服务开发
【4月更文挑战第3天】本文介绍了在Java环境中构建RESTful API的重要性及方法。遵循REST原则,利用HTTP方法处理资源,实现CRUD操作。在Java中,常用框架如Spring MVC简化了RESTful服务开发,包括定义资源、设计表示层、实现CRUD、考虑安全性、文档和测试。通过Spring MVC示例展示了创建RESTful服务的步骤,强调了其在现代Web服务开发中的关键角色,有助于提升互操作性和用户体验。
构建RESTful API:Java中的RESTful服务开发