[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-dev] a plugin question: can not get the bundle!
|
Hi all:
I am working on my first plugin demo, the plugin.xml and the manifast.mf
are followed:
plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="myplugin demo"
icon="icons/selectall.gif"
class="myplugindemo.SamplePerspective"
id="myplugindemo.SamplePerspective">
</perspective>
</extension>
<extension
point="org.eclipse.ui.views">
<category
name="myplugin demo 视图"
id="myplugindemo.view">
</category>
<view
name="view 1"
icon="icons/prev.gif"
category="myplugindemo.view"
class="myplugindemo.View1"
id="myplugindemo.View1">
</view>
<view
name="view 2"
icon="icons/project.gif"
category="myplugindemo.view"
class="myplugindemo.View2"
id="myplugindemo.View2">
</view>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
name="中国 editor"
icon="icons/project.gif"
class="myplugindemo.ChinaEditor"
id="myplugindemo.ChinaEditor">
</editor>
<editor
name="US editor"
icon="icons/prev.gif"
class="myplugindemo.UsEditor"
id="myplugindemo.UsEditor">
</editor>
<editor
name="France editor"
icon="icons/remove.gif"
class="myplugindemo.FranceEditor"
id="myplugindemo.FranceEditor">
</editor>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
name="myplugindemo config"
class="myplugindemo.preferences.RootPreferencePage"
id="myplugindemo.preferences.RootPreferencePage">
</page>
<page
name="DB config"
category="myplugindemo.preferences.RootPreferencePage"
class="myplugindemo.preferences.DBPreferencePage"
id="myplugindemo.preferences.DBPreferencePage">
</page>
</extension>
</plugin>
manifest.mf:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyPluginDemo Plug-in
Bundle-SymbolicName: MyPluginDemo;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: myplugindemo.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Eclipse-LazyStart: false
the perspectives/views/editors are all ok, but the preferencePages can not
be initialed because the Activator.getDefault() returns null.
the preferencePages and the Activator are followed:
public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "MyPluginDemo";
private static Activator plugin;
public Activator() {
super();
plugin = this;
}
public void start(BundleContext context) throws Exception {
super.start(context);
}
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
}
public class DBPreferencePage extends PreferencePage implements
IWorkbenchPreferencePage, ModifyListener {
......
public void init(IWorkbench workbench) {
setPreferenceStore(Activator.getDefault().getPreferenceStore());
}
......
}
the error log :
!ENTRY org.eclipse.jface 4 2 2006-08-21 15:48:43.125
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
at
myplugindemo.preferences.DBPreferencePage.init(DBPreferencePage.java:98)
at
org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode.createPage(WorkbenchPreferenceNode.java:57)
......
I don't know this is a bug or sth. else. Whatever, Please tell me how to
solve the problem and tell me why. Thank you a lot!
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/