/** Populates the filter lists based on the _filteringKeys and the filter criteria. */
 private void populateFilterLists() {
   if (filterMap != null && !filterMap.isEmpty() && filterList != null && filters != null) {
     filterList.removeAll();
     filters.removeAll();
     Set keySet = filterMap.keySet();
     Iterator i = keySet.iterator();
     if (_filtering == Filtering.AUTOMATIC_LITERAL) {
       // Set the values of the filtered and unfiltered string
       while (i.hasNext()) {
         String filterString = (String) i.next();
         if (_filteringKeys.contains(filterString)) {
           filters.add(filterString);
         } else {
           filterList.add(filterString);
         }
       }
     } else {
       // Add all filter strings to the possible filter list
       while (i.hasNext()) {
         String filterString = (String) i.next();
         filterList.add(filterString);
       }
     }
   }
 }
  private void refreshMappings() {
    // Refresh the results...
    wResult.removeAll();
    for (int i = 0; i < mappings.size(); i++) {
      SourceToTargetMapping mapping = (SourceToTargetMapping) mappings.get(i);
      String mappingString =
          sourceList[mapping.getSourcePosition()]
              + " --> "
              + targetList[mapping.getTargetPosition()];
      wResult.add(mappingString);
    }

    wSource.removeAll();
    // Refresh the sources
    for (int a = 0; a < sourceList.length; a++) {
      boolean found = false;
      if (wSourceHide.getSelection()) {
        for (int b = 0; b < mappings.size() && !found; b++) {
          SourceToTargetMapping mapping = (SourceToTargetMapping) mappings.get(b);
          if (mapping.getSourcePosition() == Const.indexOfString(sourceList[a], sourceList)) {
            found = true;
          }
        }
      }

      if (!found) {
        wSource.add(sourceList[a]);
      }
    }

    wTarget.removeAll();
    // Refresh the targets
    for (int a = 0; a < targetList.length; a++) {
      boolean found = false;
      if (wTargetHide.getSelection()) {
        for (int b = 0; b < mappings.size() && !found; b++) {
          SourceToTargetMapping mapping = (SourceToTargetMapping) mappings.get(b);
          if (mapping.getTargetPosition() == Const.indexOfString(targetList[a], targetList)) {
            found = true;
          }
        }
      }

      if (!found) {
        wTarget.add(targetList[a]);
      }
    }
  }
  private void refresh() {
    wSelection.removeAll();

    for (int i = 0; i < choices.length; i++) {
      if (quickSearch) {
        if (wbRegex.getSelection()) {
          // use regex
          if (pattern != null) {
            Matcher matcher = pattern.matcher(choices[i]);
            if (matcher.matches()) {
              wSelection.add(choices[i]);
            }
          } else {
            wSelection.add(choices[i]);
          }
        } else {
          if (filterString != null) {
            if (choices[i].toUpperCase().contains(filterString)) {
              wSelection.add(choices[i]);
            }
          } else {
            wSelection.add(choices[i]);
          }
        }
      } else {
        wSelection.add(choices[i]);
      }
    }
    wSelection.redraw();
    /*
     * selectedNrs = new int[] {}; if (selectedNrs!=null){ wSelection.select(selectedNrs); wSelection.showSelection(); }
     */
  }
  public void UpdateExchangeList(java.util.List<Queue> QueueList) {
    queueList.removeAll();

    for (int idx = 0; idx < QueueList.size(); ++idx) {
      String exchName = QueueList.get(idx).toString();

      queueList.add(exchName);
    }
  }
 /**
  * 为List组件设置数据
  *
  * @param list
  * @param data
  */
 private void setListData(List list, Map<String, String> data) {
   list.removeAll();
   if (data == null) {
     return;
   }
   for (Entry<String, String> entry : data.entrySet()) {
     list.add(entry.getKey());
   }
 }
  public void refreshLiteratureView() {
    LiteratureReviewController literatureReviewController = new LiteratureReviewController();
    literatureReviews = literatureReviewController.findAllLiteratureReview();

    list.removeAll();
    for (LiteratureReview literatureReview : literatureReviews) {
      list.add(literatureReview.getTitle());
    }
  }
Example #7
0
  @Override
  public void setPackageProductType(ProductType packageProductType) {
    this.packageProductType = packageProductType;
    this.packageProductTypeItem = null;
    productTypeItemList.clear();
    productTypeGUIList.removeAll();

    if (packageProductType != null) {
      String languageID = NLLocale.getDefault().getLanguage();

      if (packageProductType.getInnerPriceConfig() != null) {
        productTypeItemList.add(new Item(false, true, packageProductType));
        productTypeGUIList.add(
            packageProductType.getName().getText(languageID)
                + Messages.getString(
                    "org.nightlabs.jfire.trade.admin.ui.gridpriceconfig.ProductTypeSelectorListImpl.packageProductType_base")); //$NON-NLS-1$
      }

      //			EventInnerProductInfo assemblyInnerProductInfo =
      // assemblyPackageProductInfo.getEventInnerProductInfo();
      //			if (!(assemblyInnerProductInfo.getPriceConfig() instanceof FormulaPriceConfig))
      //				throw new IllegalArgumentException("The PriceConfig of assemblyInnerProductInfo is not
      // an instance of FormulaPriceConfig!");
      //
      //			productTypeItemList.add(assemblyInnerProductInfo);
      //			productTypeGUIList.add(assemblyInnerProductInfo.getPrimaryKey()); // TO DO i18n

      for (NestedProductTypeLocal nestedProductTypeLocal :
          packageProductType.getProductTypeLocal().getNestedProductTypeLocals()) {
        ProductType productType =
            nestedProductTypeLocal.getInnerProductTypeLocal().getProductType();
        //				if (assemblyInnerProductInfo == productInfo)
        //					continue;

        productTypeItemList.add(new Item(false, false, productType));
        productTypeGUIList.add(
            productType.getName().getText(languageID)
                + " ["
                + nestedProductTypeLocal.getQuantity()
                + "]"); //$NON-NLS-1$ //$NON-NLS-2$
      }

      if (packageProductType.getPackagePriceConfig() != null) {
        packageProductTypeItem = new Item(true, false, packageProductType);
        productTypeItemList.add(packageProductTypeItem);
        productTypeGUIList.add(
            packageProductType.getName().getText(languageID)
                + Messages.getString(
                    "org.nightlabs.jfire.trade.admin.ui.gridpriceconfig.ProductTypeSelectorListImpl.packageProductType_total")); //$NON-NLS-1$
      }

      productTypeGUIList.select(0);
    } // if (assemblyPackageProductInfo != null) {

    fireSelectionChangedEvent();
  }
 public void fillTextArea(ArrayList<RegistryResourceNode> itemsList) {
   if (changePermissionWizPage1 != null) {
     if (!itemsList.isEmpty()) {
       list.removeAll();
       for (int i = 0; i < itemsList.size(); i++) {
         list.add(itemsList.get(i).getRegistryResourcePath());
       }
     }
   }
 }
  public void refreshCriteriaList() {
    if (selectedLiteratureReview != null) {
      java.util.List<Criteria> cr = selectedLiteratureReview.getCritireon();

      criteriaList.removeAll();
      for (Criteria c : cr) {
        criteriaList.add(c.getName());
      }
    }
  }
Example #10
0
 private void displayDataSources() {
   list.removeAll();
   if (dataSources != null) {
     for (Iterator it = dataSources.iterator(); it.hasNext(); ) {
       Object value = it.next();
       list.setData(value.toString(), value);
       list.add(value.toString());
     }
   }
 }
 /*
  * (non-) Method declared on FieldEditor.
  */
 @Override
 protected void doLoadDefault() {
   if (list != null) {
     list.removeAll();
     String s = getPreferenceStore().getDefaultString(getPreferenceName());
     String[] array = parseString(s);
     for (int i = 0; i < array.length; i++) {
       list.add(array[i]);
     }
   }
 }
 /** display a method more detail. */
 private void displayMethodDetails(Method m) {
   listParameter.removeAll();
   labelReturnType.setText(m == null ? "" : m.getReturnType().getName());
   if (m != null) {
     Class[] parTypes = m.getParameterTypes();
     for (int i = 0; i < parTypes.length; i++) {
       listParameter.setData(parTypes[i].toString(), parTypes[i]);
       listParameter.add(parTypes[i].toString());
     }
   }
 }
 /** set a list which includes java methods to disply them in a list object. */
 private void setList(Class clazz) {
   listMethods.removeAll();
   if (clazz != null) {
     Method[] methods = clazz == null ? new Method[0] : clazz.getMethods();
     for (int i = 0; i < methods.length; i++) {
       if (filter == null || filter.accept(methods[i])) {
         listMethods.setData(methods[i].toString(), methods[i]);
         listMethods.add(methods[i].toString());
       }
     }
   }
 }
  protected void setStatusAdapter(StatusAdapter adapter) {
    list.removeAll();
    populateList(list, adapter.getStatus(), 0);
    if (workbenchStatusDialog.getStatusAdapters().size() == 1) {
      Long timestamp = (Long) adapter.getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY);

      if (timestamp != null) {
        String date =
            DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG)
                .format(new Date(timestamp.longValue()));
        list.add(
            NLS.bind(ProgressMessages.JobInfo_Error, (new Object[] {"", date}))); // $NON-NLS-1$
      }
    }
  }
  /**
   * set a model to apply content to user interface.
   *
   * @param p a dynabeanfunction
   */
  public void setModel(Object p) {

    dynaBeanFunction = ((DynaBeanFunction) ((TreeObject) p).getUserObject());
    treeObject = (TreeObject) p;

    textName.setText(dynaBeanFunction.getName() == null ? "" : dynaBeanFunction.getName());
    textProperty.setText(dynaBeanFunction == null ? "" : dynaBeanFunction.getPropertyName());

    listMethods.removeAll();
    listParameter.removeAll();

    textClass.setData(dynaBeanFunction.getMethod().getDeclaringClass());
    textClass.setText(dynaBeanFunction.getMethod().getDeclaringClass().toString());
    setList(dynaBeanFunction.getMethod().getDeclaringClass());
    String[] items = listMethods.getItems();

    for (int i = 0; i < items.length; i++) {
      if (items[i].equals(dynaBeanFunction.getMethod().toString())) {
        listMethods.select(i);
        displayMethodDetails(dynaBeanFunction.getMethod());
        break;
      }
    }
  }
Example #16
0
  /** Fills the function list. */
  private void fillFunctionsList() {
    fctList.removeAll();

    ArrayList<String> names = new ArrayList<String>();

    MetaModelRegistry.getEventsFor(widget.getType());
    Set<FunctionType> functions = MetaModelRegistry.getFunctionsFor(event.getEventType());

    for (FunctionType ft : functions) {
      String funcName = ft.getName();
      names.add(funcName);
    }

    Collections.sort(names);
    fctList.setItems(names.toArray(new String[] {}));
  }
Example #17
0
 void refreshDifference() {
   DeviceData info = display.getDeviceData();
   if (!info.tracking) {
     MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
     dialog.setText(shell.getText());
     dialog.setMessage("Warning: Device is not tracking resource allocation"); // $NON-NLS-1$
     dialog.open();
   }
   Object[] newObjects = info.objects;
   Error[] newErrors = info.errors;
   Object[] diffObjects = new Object[newObjects.length];
   Error[] diffErrors = new Error[newErrors.length];
   int count = 0;
   for (int i = 0; i < newObjects.length; i++) {
     int index = 0;
     while (index < oldObjects.length) {
       if (newObjects[i] == oldObjects[index]) break;
       index++;
     }
     if (index == oldObjects.length) {
       diffObjects[count] = newObjects[i];
       diffErrors[count] = newErrors[i];
       count++;
     }
   }
   objects = new Object[count];
   errors = new Error[count];
   System.arraycopy(diffObjects, 0, objects, 0, count);
   System.arraycopy(diffErrors, 0, errors, 0, count);
   list.removeAll();
   text.setText(""); // $NON-NLS-1$
   canvas.redraw();
   for (int i = 0; i < objects.length; i++) {
     list.add(objectName(objects[i]));
   }
   refreshLabel();
   layout();
 }
 protected void doLoadDefault() {
   if (listControl != null) {
     listControl.removeAll();
     java.util.List<String> defaults = new LinkedList<String>();
     int index = 0;
     IPreferenceStore store = getPreferenceStore();
     // If the default exist and isn't null
     while (store.contains(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index)) {
       String value =
           getPreferenceStore()
               .getDefaultString(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index);
       if (value != null && !value.equals("")) {
         defaults.add(
             store.getDefaultString(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index));
       }
       index++;
     }
     String[] array = defaults.toArray(new String[defaults.size()]);
     for (int i = 0; i < array.length; i++) {
       listControl.add(array[i]);
     }
   }
 }
 @Override
 public void initializeFrom(ILaunchConfiguration configuration) {
   ILaunchManager launchManager = getLaunchManager();
   ILaunchConfiguration[] launchConfigurations;
   try {
     launchConfigurations = launchManager.getLaunchConfigurations();
   } catch (CoreException e) {
     // todo: may be this is the case to throw exception?
     setErrorMessage(e.getMessage());
     return;
   }
   List selectedList = Collections.emptyList();
   try {
     selectedList =
         configuration.getAttribute(SELECTED_CONFIGURATION_LIST, Collections.emptyList());
   } catch (CoreException e) {
     setErrorMessage(e.getMessage());
   }
   availableConfigsCombo.removeAll();
   allConfigNames = new HashSet<String>();
   for (ILaunchConfiguration conf : launchConfigurations) {
     String configurationName = conf.getName();
     if (!configurationName.equals(configuration.getName())
         && !selectedList.contains(configurationName)) {
       availableConfigsCombo.add(configurationName);
     }
     allConfigNames.add(configurationName);
   }
   selectedConfigsList.removeAll();
   for (Object item : selectedList) {
     selectedConfigsList.add((String) item);
     if (!allConfigNames.contains((String) item)) {
       setErrorMessage("Configuration [" + item + "] is undefined");
     }
   }
   updateButtonsState();
 }
Example #20
0
 /**
  * Removes all of the items from the receiver's list and clear the contents of receiver's text
  * field.
  *
  * <p>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public void removeAll() {
   checkWidget();
   text.setText(""); // $NON-NLS-1$
   list.removeAll();
 }
Example #21
0
 public void removeAllUsers() {
   GlobalUsersList.removeAll();
 }
Example #22
0
 private void updateList() {
   list.removeAll();
   for (String file : files) list.add(file);
 }
Example #23
0
 @Override
 protected void listRemoveAll() {
   list.removeAll();
 }
Example #24
0
  /*
   * (non-Javadoc)
   * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
   */
  public void initializeFrom(ILaunchConfiguration configuration) {

    try {
      String id = configuration.getType().getIdentifier();
      IInterpreterManager manager = null;
      if (Constants.ID_JYTHON_LAUNCH_CONFIGURATION_TYPE.equals(id)
          || Constants.ID_JYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE.equals(id)) {
        manager = PydevPlugin.getJythonInterpreterManager();

      } else if (Constants.ID_IRONPYTHON_LAUNCH_CONFIGURATION_TYPE.equals(id)
          || Constants.ID_IRONPYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE.equals(id)) {
        manager = PydevPlugin.getIronpythonInterpreterManager();

      } else if (Constants.ID_PYTHON_REGULAR_LAUNCH_CONFIGURATION_TYPE.equals(id)
          || Constants.ID_PYTHON_COVERAGE_LAUNCH_CONFIGURATION_TYPE.equals(id)
          || Constants.ID_PYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE.equals(id)) {
        manager = PydevPlugin.getPythonInterpreterManager();
      } else {
        // Get from the project
        try {
          // could throw core exception if project does not exist.
          IProject project = PythonRunnerConfig.getProjectFromConfiguration(configuration);
          PythonNature nature = PythonNature.getPythonNature(project);
          if (nature != null) {
            manager = PydevPlugin.getInterpreterManager(nature);
          }
        } catch (Exception e) {
          Log.log(e);
        }

        if (manager == null) {
          Log.log("Could not recognize: '" + id + "' using default python interpreter manager.");
          manager = PydevPlugin.getPythonInterpreterManager();
        }
      }
      String pythonPath = PythonRunnerConfig.getPythonpathFromConfiguration(configuration, manager);

      fPythonPathList.removeAll();
      java.util.List<String> paths = SimpleRunner.splitPythonpath(pythonPath);
      for (String p : paths) {
        fPythonPathList.add(p);
      }
      setErrorMessage(null);
    } catch (Exception e) {
      // Exceptions here may have several reasons
      // - The interpreter is incorrectly configured
      // - The arguments use an unresolved variable.
      // In each case, the exception contains a meaningful message, that is displayed
      Log.log(e);

      String message = e.getMessage();
      if (message == null) {
        message = "null (see error log for the traceback).";
      }
      String errorMsg =
          org.python.pydev.shared_core.string.StringUtils.replaceNewLines(message, " ");

      fPythonPathList.removeAll();
      fPythonPathList.add(errorMsg);
      setErrorMessage(errorMsg);
    }
  }