วันศุกร์ที่ 28 เมษายน พ.ศ. 2560

เมนู Help->JAR Plugin เป็นอีกเมนูที่แสดงข้อมูลใน Folder plugins

JAR Plugin

Author:
Wayne Rasband (wsr at nih dot gov)
History:
2003/11/28: First version
2003/12/02: Displays an Edit>Options> dialog box
2003/12/16: Adds Plugins/JAR Demo submenu with four commands
Requires:
ImageJ 1.31s or later, which adds the ability to package plugins in JAR files
Source:
Contained in jar_demo.jar, which can be opened using a ZIP utility
Installation:
Download jar_demo.jar to the plugins folder, or subfolder, restart ImageJ, and there should be 11 new commands that run this plugin.
Description:
This plugin demonstrates how plugins can be packaged in JAR files and installed in multiple menus. The JAR file must have an underscore in its name and contain a file named "plugins.config". This is what "plugins.config" in the JAR file containing this plugin ("jar_demo.jar") looks like:

# Name: JAR_Plugin
# Author: Wayne Rasband
# Version: 1.2
# Date: 2003/12/15
# Requires: ImageJ 1.31s
# Generate the jar file using: "jar cvfM jar_demo.jar *"
File>Import, "JAR Demo (Import 1)...", JAR_Plugin("import1")
File>Import, "JAR Demo (Import 2)...", JAR_Plugin("import2")
File>Save As, "JAR Demo (Save As)...", JAR_Plugin("save")
Edit>Options, "JAR Demo...", JAR_Plugin("options1")
Analyze>Tools, "JAR Demo (Tools)...", JAR_Plugin("tools")
Plugins>JAR Demo, "Run JAR Demo...", JAR_Plugin("run")
Plugins>JAR Demo, "JAR Demo Options...", JAR_Plugin("options2")
Plugins>JAR Demo, "About JAR Demo...", JAR_Plugin("about1")
Plugins>JAR Demo, "Uninstall JAR Demo...", JAR_Plugin("uninstall")
Plugins, "JAR Demo (Plugins)...", JAR_Plugin("plugins")
Help>About Plugins, "JAR_Plugin...", JAR_Plugin("about2")
Lines starting with '#" are comments that may be used by a future Plugin Manager. Each line in the form
Menu>Submenu, "Command", Plugin
creates an ImageJ menu command. There are three parts, separated by commas. The first specifies the menu where the command will be installed, the second is the command name, and the third is the plugin. As an example, the line
File>Save As, "JAR Demo (Save As)...", JAR_Plugin("save")
installs the command "JAR Demo (Save As)..." in the File>Save As menu. When the user selects this command ImageJ runs the plugin JAR_Plugin.class, passing it the argument "save".

Plugins can be installed in the File>Import, File>Save As, Edit>Options, Analyze>Tools, Help>About Plugins and Plugins menu and submenus. If Plugins>Submenu is specified, the command will installed in the submenu of the Plugins manu named Submenu. If this submenu does not exist, it is created. If Plugins is specified, the command will be installed in the submenu of the Plugins menu that corresponds to the directory containing the JAR file. For example, if the JAR file is in ImageJ/plugins/jars, the command will be installed in Plugins>jars.

JAR files are basically the same as ZIP files. They are created using the command line jar utility or a ZIP utility such WinZip. The jar utility is included with Sun's free Java SDK (aka JDK). It is pre-installed on Mac OS X.

On Mac OS X, use the pre-installed jar utility to create a JAR file:
1 Open a Terminal window
2 Type "cd "
3 Drag and drop the folder containing the plugin(s) and plugins.config file to the Terminal window and press return
4 Type "jar cvfM Name_of_Package.jar *"
On Windows, use the jar utility included with the Java Software Development Kit (SDK) from Sun:
1 Open a command line window
2 Change (cd) to the directory containing the plugin(s) and plugins.config file
3 Type "C:\jdk1.5.0\bin\jar cvf Name_of_Package.jar *" (assumes the SDK is installed in C:\jdk1.5.0)

See Also:
The PluginClassLoader Demo plugin demonstrates how files required for plugins (images, config files, etc) can be packaged in a jar file.

เมื่อทำการดาวโหลด java_demo.jar แล้วเก็บไว้ใน .../imagej/plugins/  ก็จะได้ปิดและเปิดโปรแกรมใหม่ก็จะได้เมนูที่เปลี่ยนแปลงไปดังนี้

File>Import, "JAR Demo (Import 1)...", JAR_Plugin("import1")
File>Import, "JAR Demo (Import 2)...", JAR_Plugin("import2")



File>Save As, "JAR Demo (Save As)...", JAR_Plugin("save")


Edit>Options, "JAR Demo...", JAR_Plugin("options1")


Analyze>Tools, "JAR Demo (Tools)...", JAR_Plugin("tools")


Plugins>JAR Demo, "Run JAR Demo...", JAR_Plugin("run")
Plugins>JAR Demo, "JAR Demo Options...", JAR_Plugin("options2")
Plugins>JAR Demo, "About JAR Demo...", JAR_Plugin("about1")
Plugins>JAR Demo, "Uninstall JAR Demo...", JAR_Plugin("uninstall")


Plugins, "JAR Demo (Plugins)...", JAR_Plugin("plugins")


Help>About Plugins, "JAR_Plugin...", JAR_Plugin("about2")

ไม่มีความคิดเห็น:

แสดงความคิดเห็น