コード例 #1
0
 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
   this.viewer = viewer;
   if (oldInput != null) {
     IExecutionContext oldContext = (IExecutionContext) oldInput;
     oldContext.removeExecutionContextListener(this);
   }
   if (newInput != null) {
     IExecutionContext newContext = (IExecutionContext) newInput;
     newContext.addExecutionContextListener(this);
   }
 }
コード例 #2
0
 public Object[] getElements(Object inputElement) {
   if (inputElement == null) {
     return new Object[] {};
   }
   if (inputElement instanceof IExecutionContext) {
     Set<Container> scopes = new HashSet<Container>();
     Container defaultContainer = new Container();
     scopes.add(defaultContainer);
     Container timeEventContainer = new Container("Time Events");
     scopes.add(timeEventContainer);
     IExecutionContext context = (IExecutionContext) inputElement;
     Iterable<AbstractSlot> slotelements =
         Iterables.concat(context.getDeclaredEvents(), context.getVariables());
     for (AbstractSlot abstractSlot : slotelements) {
       if (abstractSlot.getScopeSegment() != null) {
         Container newScope = new Container();
         newScope.name = abstractSlot.getScopeSegment();
         newScope.slots.add(abstractSlot);
         scopes.add(newScope);
       }
     }
     for (AbstractSlot abstractSlot : slotelements) {
       if (abstractSlot.getScopeSegment() == null) {
         if (abstractSlot.getSimpleName().contains("time_event")) {
           if (!hideTimeEvents()) {
             timeEventContainer.slots.add(abstractSlot);
           }
         } else {
           defaultContainer.slots.add(abstractSlot);
         }
       } else {
         for (Container container : scopes) {
           if (abstractSlot.getScopeSegment().equals(container.name)) {
             container.slots.add(abstractSlot);
             break;
           }
         }
       }
     }
     return Iterables.toArray(
         Iterables.filter(
             scopes,
             new Predicate<Container>() {
               public boolean apply(Container input) {
                 return input.slots.size() > 0;
               }
             }),
         Container.class);
   }
   return new Object[] {};
 }