sidebar 隐藏/显示

要添加一个树型的preference pages,可以对plug.xml增加如下扩展点

 <extension
        point="org.eclipse.ui.preferencePages">
      <page        class="de.tu_darmstadt.informatik.st.pegasus.collaboration.eclipse_plugin.preferences.PegasusPerferencePage"
  id="de.tu_darmstadt.informatik.st.pegasus.collaboration.eclipse_plugin.preferences.PegasusPreferencePage"
         name="Pegasus">
      </page

         <page
              name="Collaboration Server"              category="de.tu_darmstadt.informatik.st.pegasus.collaboration.eclipse_plugin.preferences.PegasusPreferencePage"
 class="de.tu_darmstadt.informatik.st.pegasus.collaboration.eclipse_plugin.preferences.CollaborationServerPreferencePage"           id="de.tu_darmstadt.informatik.st.pegasus.collaboration.eclipse_plugin.preferences.CollaborationServerPreferencePage">
   </extension>
 

注意,collaboration server 是子节点,所以它的category需填入跟节点的id。与此同时,根节点的category要留空(千万注意,不留空情况在3.3里无法显示,我就是在这个问题上败了近半个小时。)

Goal:  create a LabelProvider for a View, then it needs the images. If images are not from the default system, but in our own directory. How can i get the url of images ?

Solution: 

Eclispe 3.0 or alter:

URL url = Activator.getDefault().find(new Path(IMG_URL);

Now in 3.2 the find method is deprecated,  

So, we should use the following method:

URL url = Activator.getPathRelToPlugIn(IMG_URL);  

Activator is the Class of plugin, IMG_URL is the local path of  image.

In Class Activator:

    public static URL getPathRelToPlugIn(String filePath) {
          return Platform.getBundle(PLUGIN_ID).getEntry(filePath);
    }

After got the url  a image will be created as the result.

ImageDescriptor id = ImageDescriptor.createFromURL(url);
Image fileImage = id.createImage();

  • plugin插件安装
  • 在Eclipse平台增加多级菜单
  • 既然知道Eclipse基于SWT,所以也要开始看下面的例子了

  •  SWT/JFace开发入门指南
  • Understanding Layouts in SWT

     托上面两篇的福,总算把layout解决了,接下来就是event的编写

     PS:刚才大巴突然变得好慢好慢,明明已经是半夜了还这么不稳定地抽风= =

     

  • 共1页 1