on Eclipse plug-in:how to implement such a propert

2019-05-22 14:56发布

问题:

I want to display a array of objects in PropertyView/PropertySheet,just like this:

How to do it? thx.

回答1:

You can follow this eclipse tips: creating a custom property view, based on PageBookView (which is the kind of view which displays the properties of the selected element in the active part. Whenever the selection changes or the active part changes, it tracks them and displays the properties, unless you used the 'Pin to selection' feature available from 3.5).

<view
  class="com.eclipse_tips.views.CustomPropertiesView"
  icon="icons/sample.gif"
  id="com.eclipse-tips.views.customePropertiesView"
  name="My Properties View">
</view>

Followed by:

public class CustomPropertiesView extends PropertySheet {

 @Override
 protected boolean isImportant(IWorkbenchPart part) {
  if (part.getSite().getId().equals(IPageLayout.ID_PROJECT_EXPLORER))
   return true;
  return false;
 }
}

Now this would react to properties from the project explorer (and not your own set of properties).
So you need to get back to the PageBookView article and see how to implement your own display.