这里是延伸的松鼠插件一类在Java中提出:
public class FulltextsearchPlugin extends DefaultSessionPlugin {
private final Analyzer analyzer = new StandardAnalyzer();
private final String path = "c:/temp/lucene/squirrel/";
private final IndexWriter writer = createIndexWriter();
@Override
public String getAuthor() {
return "Mike Haller";
}
@Override
public String getDescriptiveName() {
return "Full-Text Search Plugin";
}
@Override
public String getInternalName() {
return "fulltextsearchplugin";
}
@Override
public String getVersion() {
return "0.0.1";
}
@Override
public PluginSessionCallback sessionStarted(ISession session) {
// Add context menu items to the object tree's view and procedure nodes.
IObjectTreeAPI otApi = session.getSessionInternalFrame()
.getObjectTreeAPI();
otApi.addToPopup(DatabaseObjectType.TABLE, new FulltextsearchMenu(this,
session));
return new PluginSessionCallbackAdaptor(this);
}
}
这是在我看来,它提供了一个非常明确的讨论最好的教程的一个代码快照与步骤如何获得plugin implemented。该材料提供了一个很好的模板来将其扩展到其他案例。
谢谢,看来我可以通过session.getObjectTreeAPIOfActiveSessionWindow()访问模式模型 –