开发者社区> 时序> 正文

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.

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
一口气整理三种不同运营商要素验证API的Java 接入代码
一口气整理三种不同运营商要素验证API的Java 接入代码
406 0
Sui为根应用提供Java APIs,滴API。主要提供直接使用Android APIs的能力(几乎以Java作为root的身份
Sui为根应用提供Java APIs,滴API。主要提供直接使用Android APIs的能力(几乎以Java作为root的身份,在root下启动app自己的AIDL风格的Java服务。这将使root应用程序开发变得更加容易。
22 0
一文看懂车牌识别OCR:从技术原理到 API Java 示例代码接入
一文看懂车牌识别OCR:从技术原理到 API Java 示例代码接入
30 0
Java借助API输出百分数
很多时候我们自己计算百分数还得转为字符串再拼接"%",其实在Java下面有一个类,可以帮助我们格式化数字为百分数
20 0
生活指数知识知多少(附未来7天生活指数API Java 接入代码)
生活指数知识知多少(附未来7天生活指数API Java 接入代码)
34 0
一文看懂增值税发票识别OCR:从技术原理到 API Java 示例代码接入
一文看懂增值税发票识别OCR:从技术原理到 API Java 示例代码接入
52 0
使用java api操作zookeeper
使用java api操作zookeeper
52 0
java api操作HDFS
java api操作HDFS
51 0
看懂二维码识别OCR:从算法到 API Java 接入代码
看懂二维码识别OCR:从算法到API 接入代码
7683 0
Java Stream API 操作完全攻略:让你的代码更加出色 (三)
Java Stream 是一种强大的数据处理工具,可以帮助开发人员快速高效地处理和转换数据流。使用 Stream 操作可以大大简化代码,使其更具可读性和可维护性,从而提高开发效率。本文将为您介绍 Java Stream 操作的所有方面,包括 groupingBy、groupingBy、joining、mapping 等操作,让你的代码行云流水,更加优雅。
90 0
+关注
时序
科幻影迷,书虫,硬核玩家,译者 互联网分布式系统稳定性建设,容量规划,压测,监控,容灾多活系统。 SRE, DevOps 微信公众号:麦芽面包
文章
问答
视频
文章排行榜
最热
最新
相关课程
更多
相关电子书
更多
数据资源的基础设施API总线
立即下载
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
相关实验场景
更多