コード例 #1
0
 protected void changeSelection(final TreeItem item, final boolean select) {
   SelectableFeature feature = (SelectableFeature) item.getData();
   if (feature.getAutomatic() == Selection.UNDEFINED) {
     switch (feature.getManual()) {
       case SELECTED:
         set(feature, (select) ? Selection.UNDEFINED : Selection.UNSELECTED);
         break;
       case UNSELECTED:
         set(feature, (select) ? Selection.SELECTED : Selection.UNDEFINED);
         break;
       case UNDEFINED:
         set(feature, (select) ? Selection.SELECTED : Selection.UNSELECTED);
         break;
       default:
         set(feature, Selection.UNDEFINED);
     }
     if (!dirty) {
       setDirty();
     }
     if (configurationEditor.isAutoSelectFeatures()) {
       computeTree(false);
       //				updateInfoLabel();
     } else {
       refreshItem(item, feature);
       if (configurationEditor.getConfiguration().canBeValid()) {
         invalidFeatures.clear();
       } else {
         invalidFeatures.add(feature);
       }
       //				updateInfoLabel();
     }
   }
 }
コード例 #2
0
 protected void refreshItem(TreeItem item, SelectableFeature feature) {
   item.setBackground(null);
   item.setFont(treeItemStandardFont);
   switch (feature.getAutomatic()) {
     case SELECTED:
       item.setGrayed(true);
       item.setForeground(null);
       item.setChecked(true);
       break;
     case UNSELECTED:
       item.setGrayed(true);
       item.setForeground(gray);
       item.setChecked(false);
       break;
     case UNDEFINED:
       item.setGrayed(false);
       item.setForeground(null);
       item.setChecked(feature.getManual() == Selection.SELECTED);
       break;
   }
 }
コード例 #3
0
 protected IConfigJob<?> computeFeatures(
     final boolean redundantManual, final Display currentDisplay) {
   if (!configurationEditor.isAutoSelectFeatures()) {
     return null;
   }
   final TreeItem topItem = tree.getTopItem();
   SelectableFeature feature = (SelectableFeature) (topItem.getData());
   final IConfigJob<?> job =
       configurationEditor
           .getConfiguration()
           .getPropagator()
           .getJobWrapper()
           .update(redundantManual, feature.getFeature().getName());
   job.setIntermediateFunction(
       new IFunction<Object, Void>() {
         @Override
         public Void invoke(Object t) {
           if (t instanceof SelectableFeature) {
             final SelectableFeature feature = (SelectableFeature) t;
             final TreeItem item = itemMap.get(feature);
             if (item == null) {
               return null;
             }
             currentDisplay.asyncExec(
                 new Runnable() {
                   @Override
                   public void run() {
                     updateFeatures.remove(feature);
                     refreshItem(item, feature);
                   }
                 });
           }
           return null;
         }
       });
   return job;
 }