- 浏览: 207916 次
文章分类
最新评论
-
qinzl_1:
能举一些代码实例吗?
Apache VFS(2):文件的监听和监控 -
skyuck:
java9920 写道写得很清晰,很不错!我想问一下,如果可以 ...
Jackrabbit的简单节点定义文件格式 -
caoyangx:
roki 写道新书推荐!清华出版社新书《搜索引擎零距离》
购 ...
Apache Solr 介绍(1) -
PointOnLine:
再 顶 。
Apache VFS(4): 事件 -
PointOnLine:
再 顶 。
Apache VFS(3): 文件过滤器和选择器
They had a brief run of popularity as Yet Another Way To Store Settings a few years ago, around when the new window system was being conceived. They're not bad, but a bit baroque. The main point was to avoid loading classes or creating objects just to satisfy a test like "how many object instances are there of X", "does this folder/lookup/collection contain an instance of X". For NetBeans, where there are lots of classes, this sort of thing really does make a difference in performance. The observation was that huge amounts of classloading could be triggered just to find out that something was not actually of use to whatever code triggered it to be instantiated.
.settings files can be used for the same purposes as .instance files - as a way of indicating that the file represents some class that should be instantiated. The main difference is that by defining all of the superclasses and interfaces of the the object they represent, it is possible for the system to delay actually instantiating the object longer - more questions about the object can be answered by the system without creating it to answer those questions.
.settings files are typically not used for registering actions in the main menu and similar places, since these actions will need to be instantiated almost immediately anyway in order to determine if they should be enabled or not. A future API for declarative actions will possibly change that, but at present, it does neither harm more good, and .instance files are simpler (and for cases where the object will be instatiated immediately anyway, faster).
Some examples:
Declaring a system option as a .settings file from an XML layer
Have a layer entry such as this:<folder name="Services">
<file name="org-openide-text-PrintSettings.settings" url="PrintSettings.settings">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.core.Bundle"/>
<attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/openide/resources/printSettings.gif"/>
</file>
</folder>
Note the url attribute - it points to a file PrintSettings.settings which is in the same directory in the module jar as the layer file - it is a relative path. That settings file will look like this:
<?xml version="1.0"?>
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
<settings version="1.0">
<instanceof class="java.beans.beancontext.BeanContextProxy"/>
<instanceof class="org.openide.util.SharedClassObject"/>
<instanceof class="org.openide.options.SystemOption"/>
<instanceof class="org.openide.options.ContextSystemOption"/>
<instanceof class="org.openide.text.PrintSettings"/>
<instance class="org.openide.text.PrintSettings"/>
</settings>
The two things to note are that the .settings file declares many of the relevant parent classes of the object (so it does not need to be instantiated just to see what kind of object it is), and the layer file declares the icon and a resource bundle (for the display name) as file attributes .
发表评论
-
Netbeans平台: 顶层组件
2007-06-25 15:09 2031Netbeans平台的顶层组件:org.openide.win ... -
Netbeans平台: 数据对象
2007-06-25 14:52 1419数据对象是文件对象的 ... -
Netbeans平台: .shadow文件
2007-06-25 10:59 1406Netbeans平台中, .shadow文件主要用于系统文件 ... -
Netbeans平台: 我该使用何种注册方式呢?
2007-06-25 09:49 1995我们知道在Netbeans平台中有四种注册/安装方式: ... -
Netbeans平台: 声明式的安装 VS 程序式的安装
2007-06-25 09:31 1667在很久很久以前, Netbeans中的大部分对象都是在启动的时 ... -
Netbeans平台: 模块是如何影响系统的?
2007-06-25 09:05 1346Netbeans平台中的模块包含两个重要的内容,一个是配置数据 ... -
Netbeans平台: 窗口系统
2007-06-22 17:04 2252Netbeans平台中窗口系统负责创建主应用窗口,能够在用户界 ... -
Netbeans平台: .instance文件
2007-06-22 16:32 1444Netbeans平台中有.instance文件这个概念. 实际 ... -
Netbeans平台: 文件对象
2007-06-22 16:10 1498Netbeans平台中的文件对象(FileObject)是存在 ... -
Netbeans平台: 文件的识别
2007-06-22 15:16 1671很多应用程序通过用户界面来显示目录和文件, Netbeans用 ... -
Netbeans平台:系统文件系统
2007-06-22 14:18 1739Netbeans平台中有一个概念: System FileSy ... -
Netbeans平台的API: 数据系统(Datasystem API)
2007-06-18 14:07 1288Netbeans平台的数据系统 ... -
Netbeans平台的API: 节点API(Node)
2007-06-18 10:37 2147Netbeans使用Node将JavaBeans或者其他具备属 ... -
Netbeans平台的API们
2007-06-18 10:05 2511Netbeans平台上开发富客户端需要仔细研究他的API,这里 ... -
Netbeans平台的一些概念和基础知识
2007-06-11 13:17 1551开发Netbeans RCP前需要一些基础知识: 原文 ... -
Visual Web Pack 的背后(1)
2007-04-02 10:02 70Visual Web Pack 大概是Netbeans5以来最 ... -
Two examples for Netbeans Platform Application
2007-01-30 16:33 1420http://www.ociweb.com/jnb/ ... -
Netbeans API
2007-01-18 17:29 105Netbeans API 是用来基于Netbeans平台开发R ... -
NetBeans中使用Java Persistence API
2006-12-26 15:20 101JPA是EJB3.0的规范之一。本文章将描述如何使用Netbe ... -
Visual Web Pack面板
2006-12-22 17:15 1745Visual Web Pack是Netbeans5.5的一个卖 ...
相关推荐
netbeans字体配置文件.netbeans字体配置文件netbeans字体配置文件.netbeans字体配置文件netbeans字体配置文件.netbeans字体配置文件netbeans字体配置文件.netbeans字体配置文件netbeans字体配置文件.netbeans字体...
NetBeans.Platform.6.9.Developers.Guide
语言程序设计资料:NetBeans使用教程.doc
org.netbeans.lib.axtextra absolutelayout absoluteconstains
语言程序设计资料:第13章_开发工具:NetBeans的使用.ppt
语言程序设计资料:netbeans基础教程.doc
语言程序设计资料:NetBeans学习笔记.doc
语言程序设计资料:NetBeans使用文档.doc
NetBeans.IDE.7使用,常见问题解决方法
NetBeans.Platform.6.9.Developers.Guide中的代码。
Netbeans.教程.doc
一共分两卷,这是第二部分。... you'll find what you need in this book to get started with the more vibrant, more productive extensible NetBeans platform project found on netbeans.org.
Apress,.Pro.Netbeans.IDE.6.Rich.Client.Platform.Edition.(2008)
NetBeans使用手册.pdf,有兴趣的朋可以参考一下,很有用的。
Building.SOA.Based.Composite.Applications.Using.NetBeans.IDE.6
Packt.Building.SOA-Based.Composite.Applications.Using.NetBeans.IDE.6
Netbeans操作数据库.pdf
[The.Definitive.Guide.to.NetBeans.Platform.7].Heiko.Böck.文字版.pdf