コード例 #1
0
 @Override
 public Configurable[] getConfigurables() {
   if (!isInitialized) {
     ArrayList<Configurable> list = new ArrayList<Configurable>();
     if (super.myEp.dynamic) {
       Composite composite = cast(Composite.class, this);
       if (composite != null) {
         Collections.addAll(list, composite.getConfigurables());
       }
     }
     if (super.myEp.children != null) {
       for (ConfigurableEP ep : super.myEp.getChildren()) {
         if (ep.isAvailable()) {
           list.add((Configurable) wrapConfigurable(ep));
         }
       }
     }
     if (super.myEp.childrenEPName != null) {
       Object[] extensions =
           Extensions.getArea(super.myEp.getProject())
               .getExtensionPoint(super.myEp.childrenEPName)
               .getExtensions();
       if (extensions.length > 0) {
         if (extensions[0] instanceof ConfigurableEP) {
           for (Object object : extensions) {
             list.add((Configurable) wrapConfigurable((ConfigurableEP) object));
           }
         } else if (!super.myEp.dynamic) {
           Composite composite = cast(Composite.class, this);
           if (composite != null) {
             Collections.addAll(list, composite.getConfigurables());
           }
         }
       }
     }
     Collections.addAll(list, myKids);
     // sort configurables is needed
     for (Configurable configurable : list) {
       if (configurable instanceof Weighted) {
         if (((Weighted) configurable).getWeight() != 0) {
           myComparator = COMPARATOR;
           Collections.sort(list, myComparator);
           break;
         }
       }
     }
     myKids = ArrayUtil.toObjectArray(list, Configurable.class);
     isInitialized = true;
   }
   return myKids;
 }
コード例 #2
0
 private static <T extends UnnamedConfigurable> T createConfigurable(
     @NotNull ConfigurableEP<T> ep, boolean log) {
   long time = System.currentTimeMillis();
   T configurable = ep.createConfigurable();
   if (configurable instanceof Configurable) {
     ConfigurableCardPanel.warn((Configurable) configurable, "init", time);
     if (log) {
       LOG.debug("cannot create configurable wrapper for " + configurable.getClass());
     }
   }
   return configurable;
 }
コード例 #3
0
 @Nullable
 public static <T extends UnnamedConfigurable> T wrapConfigurable(@NotNull ConfigurableEP<T> ep) {
   if (!ep.canCreateConfigurable()) {
     return null;
   }
   if (ep.displayName != null || ep.key != null || ep.parentId != null || ep.groupId != null) {
     return !ep.dynamic && ep.children == null && ep.childrenEPName == null
         ? (T) new ConfigurableWrapper(ep)
         : (T) new CompositeWrapper(ep);
   }
   return createConfigurable(ep, LOG.isDebugEnabled());
 }
コード例 #4
0
 @Nls
 @Override
 public String getDisplayName() {
   if (myEp.displayName == null && myEp.key == null) {
     boolean loaded = myConfigurable != null;
     Configurable configurable = cast(Configurable.class, this);
     if (configurable != null) {
       String name = configurable.getDisplayName();
       if (!loaded && LOG.isDebugEnabled()) {
         LOG.debug("XML does not provide displayName for " + configurable.getClass());
       }
       return name;
     }
   }
   return myEp.getDisplayName();
 }