コード例 #1
0
  /**
   * Handles the button pressed event on the filter criteria. Move the items between the lists based
   * on the selection and but button pressed.
   */
  private void buttonPressed(int buttonId) {
    String[] items = {};
    switch (buttonId) {
      case ADD_TO_ID:
        items = filterList.getSelection();
        for (int i = 0; i < items.length; i++) {
          filters.add(items[i]);
          filterList.remove(items[i]);
        }
        addTo.setEnabled(false);
        break;
      case REMOVE_FROM_ID:
        items = filters.getSelection();
        for (int i = 0; i < items.length; i++) {
          filterList.add(items[i]);
          filters.remove(items[i]);
        }
        removeFrom.setEnabled(false);
        break;
      case ADD_ALL_TO_ID:
        items = filterList.getItems();
        for (int i = 0; i < items.length; i++) {
          filters.add(items[i]);
          filterList.remove(items[i]);
        }
        break;
      case REMOVE_ALL_FROM_ID:
        items = filters.getItems();
        for (int i = 0; i < items.length; i++) {
          filters.remove(items[i]);
          filterList.add(items[i]);
        }
        break;
    }
    updateFilteringKeysFromControls();
    if (pageType == CHILD_PAGE) {
      refreshList();
    } else if (pageType == ROOT_PAGE) {
      PreferenceManager preferenceManager =
          ((SortFilterDialog) getContainer()).getPreferenceManager();
      Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
      while (nodes.hasNext()) {
        PreferenceNode node = (PreferenceNode) nodes.next();
        SortFilterPage page = (SortFilterPage) node.getPage();
        if (page == this) {
          continue;
        }

        if (Arrays.equals(filterStrings, page.getFilterList())) {
          page._filteringKeys = new ArrayList(_filteringKeys.size());
          page._filteringKeys.addAll(_filteringKeys);
          page._filtering = _filtering;
          page.populateFilterLists();
          page.refreshList();
          page.updateApplyButton();
        }
      }
    }
    updateApplyButton();
  }
コード例 #2
0
 /** 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);
       }
     }
   }
 }
コード例 #3
0
  private void populateList(List list, IStatus status, int nesting) {
    if (!status.matches(MASK)) {
      return;
    }
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < nesting; i++) {
      buffer.append(NESTING_INDENT);
    }
    buffer.append(status.getMessage());
    list.add(buffer.toString());

    // Look for a nested core exception
    Throwable t = status.getException();
    if (t instanceof CoreException) {
      CoreException ce = (CoreException) t;
      populateList(list, ce.getStatus(), nesting + 1);
    } else if (t != null) {
      // Include low-level exception message
      buffer = new StringBuffer();
      for (int i = 0; i < nesting; i++) {
        buffer.append(NESTING_INDENT);
      }
      String message = t.getLocalizedMessage();
      if (message == null) {
        message = t.toString();
      }
      buffer.append(message);
      list.add(buffer.toString());
    }

    IStatus[] children = status.getChildren();
    for (int i = 0; i < children.length; i++) {
      populateList(list, children[i], nesting + 1);
    }
  }
コード例 #4
0
 private void populateVersions() {
   versions.add("v20080424"); // $NON-NLS-1$
   versions.add("v20080516"); // $NON-NLS-1$
   versions.add("v20080522"); // $NON-NLS-1$
   versions.add("v20080705"); // $NON-NLS-1$
   versions.setSelection(0);
 }
コード例 #5
0
  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(); }
     */
  }
コード例 #6
0
 public void addCurrentCourse(List list, String course) {
   if (list.getItem(0).equals("No Courses Selected")) {
     list.remove(0);
     list.add(course);
   } else {
     list.add(course);
   }
 }
コード例 #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();
  }
コード例 #8
0
  public void createControl(Composite parent) {
    int margin = Const.MARGIN;

    // create the composite to hold the widgets
    Composite composite = new Composite(parent, SWT.NONE);
    props.setLook(composite);

    FormLayout compLayout = new FormLayout();
    compLayout.marginHeight = Const.FORM_MARGIN;
    compLayout.marginWidth = Const.FORM_MARGIN;
    composite.setLayout(compLayout);

    wSourceDB = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    props.setLook(wSourceDB);
    for (int i = 0; i < databases.size(); i++) {
      DatabaseMeta dbInfo = databases.get(i);
      wSourceDB.add(dbInfo.getName());
    }
    fdSourceDB = new FormData();
    fdSourceDB.top = new FormAttachment(0, 0);
    fdSourceDB.left = new FormAttachment(0, 0);
    fdSourceDB.bottom = new FormAttachment(100, 0);
    fdSourceDB.right = new FormAttachment(50, 0);
    wSourceDB.setLayoutData(fdSourceDB);
    wSourceDB.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            setPageComplete(false);
          }
        });

    wTargetDB = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    props.setLook(wTargetDB);
    for (int i = 0; i < databases.size(); i++) {
      DatabaseMeta dbInfo = databases.get(i);
      wTargetDB.add(dbInfo.getName());
    }
    fdTargetDB = new FormData();
    fdTargetDB.top = new FormAttachment(0, 0);
    fdTargetDB.left = new FormAttachment(50, margin);
    fdTargetDB.bottom = new FormAttachment(100, 0);
    fdTargetDB.right = new FormAttachment(100, 0);
    wTargetDB.setLayoutData(fdTargetDB);
    wTargetDB.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            setPageComplete(false);
          }
        });

    // set the composite as the control for this page
    setControl(composite);
  }
コード例 #9
0
 /** Notifies that the Add button has been pressed. */
 private void addPressed() {
   setPresentsDefaultValue(false);
   String value = promptForText(local.getString("entNewVal"));
   if (value != null && isTextValid(value)) {
     int index = list.getSelectionIndex();
     if (index >= 0) {
       list.add(value, index + 1);
     } else {
       list.add(value, 0);
     }
     selectionChanged();
   } else {
     showErrorMessage(local.getString("invalid") + value);
   }
 }
コード例 #10
0
  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]);
      }
    }
  }
コード例 #11
0
  public void addSelectedFilesToTargetList() {
    ISelection selection = sourceFileViewer.getSelection();

    if (isValidSourceFileViewerSelection(selection)) {
      java.util.List list = null;
      if (selection instanceof IStructuredSelection) {
        list = ((IStructuredSelection) selection).toList();

        if (list != null) {
          list = ((IStructuredSelection) selection).toList();
          for (Iterator i = list.iterator(); i.hasNext(); ) {
            IResource resource = (IResource) i.next();
            if (resource instanceof IFile) {
              // Check if its in the list. Don't add it if it is.
              String resourceName = resource.getFullPath().toString();
              if (selectedListBox.indexOf(resourceName) == -1) selectedListBox.add(resourceName);
            }
          }
          setFiles(selectedListBox.getItems());
        }

        setAddButtonEnabled(false);

        if (selectedListBox.getItemCount() > 0) {
          removeAllButton.setEnabled(true);
          if (isFileMandatory) setPageComplete(true);
          if (selectedListBox.getSelectionCount() > 0) setRemoveButtonEnabled(true);
          else setRemoveButtonEnabled(false);
        }
      }
    }
  }
コード例 #12
0
 private void doAdd() {
   setPresentsDefaultValue(false);
   Object[] input = getNewInputObjects();
   for (int i = 0; i < input.length; i++) {
     String s = this.labelProvider.getText(input[i]);
     int index = list.getSelectionIndex();
     int target = -1;
     if (index >= 0) {
       elements.add(index + 1, input[i]);
       list.add(s, target = index + 1);
     } else {
       elements.add(i, input[i]);
       list.add(s, target = i);
     }
     selectionChanged(target);
   }
 }
コード例 #13
0
 public void add(Node node) {
   if (node != null) {
     String name = getQualifiedName(node);
     listIntermediary.add(name);
     //				nodes.put(listIntermediary.indexOf(name), node);
     nodes.add(node);
   }
 }
コード例 #14
0
 /**
  * Populates a given list with a predefined set of elements which can be highlighted differently
  *
  * @param list The list to be populated
  */
 private void populateList(final List list) {
   if (list != null) {
     list.add("Keywords");
     list.add("Strings");
     list.add("Comments");
     list.add("Functions");
     list.add("Datatypes");
     list.add("Variables");
     list.add("Parameters");
     list.add("Fields");
     list.add("Interfaces");
     list.add("Typeconstructors");
   }
 }
コード例 #15
0
  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);
    }
  }
コード例 #16
0
  public void refreshLiteratureView() {
    LiteratureReviewController literatureReviewController = new LiteratureReviewController();
    literatureReviews = literatureReviewController.findAllLiteratureReview();

    list.removeAll();
    for (LiteratureReview literatureReview : literatureReviews) {
      list.add(literatureReview.getTitle());
    }
  }
コード例 #17
0
 /**
  * 为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());
   }
 }
コード例 #18
0
 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());
       }
     }
   }
 }
コード例 #19
0
  private void loadConsoles() {

    for (IConsole console : consoles) {
      if ((console instanceof TextConsole) && !(console instanceof GrepConsole)) {
        TextConsole textConsole = (TextConsole) console;
        consoleList.add(textConsole.getName());
      }
    }
    consoleList.setSelection(0);
  }
コード例 #20
0
 /*
  * (non-) Method declared on FieldEditor.
  */
 @Override
 protected void doLoad() {
   if (list != null) {
     String s = getPreferenceStore().getString(getPreferenceName());
     String[] array = parseString(s);
     for (int i = 0; i < array.length; i++) {
       list.add(array[i]);
     }
   }
 }
コード例 #21
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());
     }
   }
 }
コード例 #22
0
  public void refreshCriteriaList() {
    if (selectedLiteratureReview != null) {
      java.util.List<Criteria> cr = selectedLiteratureReview.getCritireon();

      criteriaList.removeAll();
      for (Criteria c : cr) {
        criteriaList.add(c.getName());
      }
    }
  }
 private void addRepositoryList() {
   java.util.List<GuvnorRepository> reps = Activator.getLocationManager().getRepositories();
   for (int i = 0; i < reps.size(); i++) {
     repLocations.add(reps.get(i).getLocation());
   }
   if (repLocations.getItemCount() > 0) {
     repLocations.setSelection(0);
     updateModel();
   }
 }
コード例 #24
0
 /** 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());
     }
   }
 }
コード例 #25
0
 /** 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());
       }
     }
   }
 }
コード例 #26
0
  /**
   * Moves the currently selected item up or down.
   *
   * @param up <code>true</code> if the item should move up, and <code>false</code> if it should
   *     move down
   */
  private void swap(boolean up) {
    setPresentsDefaultValue(false);
    int index = list.getSelectionIndex();
    int target = up ? index - 1 : index + 1;

    if (index >= 0) {
      String[] selection = list.getSelection();
      Assert.isTrue(selection.length == 1);
      list.remove(index);
      list.add(selection[0], target);
      list.setSelection(target);
    }
    selectionChanged();
  }
 private void onAddClicked() {
   int selectionIndex = availableConfigsCombo.getSelectionIndex();
   if (selectionIndex < 0) {
     return;
   }
   String selectedItem = availableConfigsCombo.getItem(selectionIndex);
   int response = ask("It's about to add [" + selectedItem + "]?", "Add lauch configuration");
   if (response != SWT.YES) {
     return;
   }
   selectedConfigsList.add(selectedItem);
   availableConfigsCombo.remove(selectionIndex);
   updateButtonsState();
   updateLaunchConfigurationDialog();
 }
コード例 #28
0
  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$
      }
    }
  }
コード例 #29
0
 private void handleIgnoreNewButtonPressed() {
   InputDialog dialog =
       new InputDialog(
           getShell(),
           Messages.getString("MemcheckToolPage.Ignore_Ranges"),
           Messages.getString("MemcheckToolPage.Range"),
           "",
           null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   if (dialog.open() == Window.OK) {
     String function = dialog.getValue();
     if (!function.equals("")) { // $NON-NLS-1$
       ignoreRangesList.add(function);
     }
   }
 }
コード例 #30
0
  /** Overrides the dialog box. Prompts the user for what features to select. */
  @Override
  protected Control createDialogArea(Composite parent) {
    // The composite for the dialog box
    Composite independentVarSelection = (Composite) super.createDialogArea(parent);
    independentVarSelection.setLayout(new GridLayout(1, true));
    independentVarSelection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    // Checks that a list of features was set for the user to select from
    if (featureList != null) {
      // Label to prompt the user to select an X and a Y
      Label headerLabel = new Label(independentVarSelection, SWT.FILL);
      headerLabel.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
      headerLabel.setText(
          "Select independent variables for " + source + "\n(Ctrl-click to select multiple)");

      // The list for the X features
      final List independentFeatureList =
          new List(independentVarSelection, SWT.V_SCROLL | SWT.BORDER | SWT.H_SCROLL | SWT.MULTI);
      independentFeatureList.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));

      for (String feature : featureList) {
        independentFeatureList.add(feature);
      }

      // The listener for the xFeatureList which sets what the user
      // selected to xAxisFeature
      independentFeatureList.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
              independentVariables.clear();
              String[] selection = independentFeatureList.getSelection();
              for (int i = 0; i < selection.length; i++) {
                independentVariables.add(selection[i]);
              }
            }
          });

      // Select the first item by default.
      if (!featureList.isEmpty()) {
        independentFeatureList.setSelection(0);
        independentVariables.add(featureList.get(0));
      }
    }

    return independentVarSelection;
  }