コード例 #1
0
 /**
  * Return all of the properties page contributors for an element.
  *
  * @param element
  * @return {@link IPreferenceNode}[]
  * @since 3.4
  */
 public static IPreferenceNode[] propertiesContributorsFor(Object element) {
   PropertyPageManager pageManager = new PropertyPageManager();
   if (element == null) {
     return null;
   }
   // load pages for the selection
   // fill the manager with contributions from the matching contributors
   PropertyPageContributorManager.getManager().contribute(pageManager, element);
   // testing if there are pages in the manager
   List pages = pageManager.getElements(PreferenceManager.PRE_ORDER);
   IPreferenceNode[] nodes = new IPreferenceNode[pages.size()];
   pages.toArray(nodes);
   return nodes;
 }
コード例 #2
0
 /**
  * Indicates whether the specified element has at least one property page contributor.
  *
  * @param element an adapter element of a property page
  * @return true for having at least one contributor; false otherwise
  * @since 3.4
  */
 public static boolean hasPropertiesContributors(Object element) {
   if (element == null || !(element instanceof IAdaptable)) return false;
   Collection contributors =
       PropertyPageContributorManager.getManager().getApplicableContributors(element);
   return contributors != null && contributors.size() > 0;
 }