private void createTaskTree(Composite parent) {
    PatternFilter filter = new PatternFilter();
    FilteredTree filteredTree =
        new FilteredTree(parent, SWT.CHECK | SWT.BORDER, filter, true) {
          @Override
          protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
            return new ContainerCheckedTreeViewer(parent, style);
          }
        };
    taskSelectionTreeViewer = (CheckboxTreeViewer) filteredTree.getViewer();
    filteredTree.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Add multi column support
    Tree tree = taskSelectionTreeViewer.getTree();
    tree.setHeaderVisible(true);
    TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
    column1.setText("Project/Task");
    TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
    column2.setText("Description");
    column1.pack();
    column2.pack();

    taskSelectionTreeViewer.setLabelProvider(new GradleTaskTreeLabelProvider());
    taskSelectionTreeViewer.setContentProvider(
        new GradleTaskTreeContentProvider(taskSelectionTreeViewer, true));
    taskSelectionTreeViewer.setCheckStateProvider(tasksChecked);
    taskSelectionTreeViewer.addCheckStateListener(tasksChecked);

    if (project != null) {
      setTreeInput(project);
    }
  }
 /** This method initializes diagramfilteredTree. */
 private void createDiagramfilteredTree() {
   GridData gridData6 = new GridData();
   gridData6.horizontalAlignment = GridData.FILL;
   gridData6.grabExcessHorizontalSpace = true;
   gridData6.grabExcessVerticalSpace = true;
   gridData6.verticalAlignment = GridData.FILL;
   diagramfilteredTree =
       new FilteredTree(diagramListcomposite, SWT.BORDER, new PatternFilter(), true);
   diagramfilteredTree.setLayoutData(gridData6);
 }
 /** This method initializes filteredTree. */
 private void createModelFilteredTree() {
   GridData gridData3 = new GridData();
   gridData3.horizontalAlignment = GridData.FILL;
   gridData3.grabExcessHorizontalSpace = true;
   gridData3.grabExcessVerticalSpace = true;
   gridData3.verticalSpan = 3;
   gridData3.verticalAlignment = GridData.FILL;
   modeFilteredTree = new FilteredTree(treeViewcomposite, SWT.BORDER, new PatternFilter(), true);
   modeFilteredTree.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
   modeFilteredTree.setLayoutData(gridData3);
 }
Example #4
0
  /**
   * Creates the top level control for this dialog page under the given parent composite.
   *
   * <p>Implementors are responsible for ensuring that the created control can be accessed via
   * <code>getControl</code>
   *
   * @param parent the parent composite
   */
  public void createControl(Composite parent) {
    helper = new DataSetBasePageHelper();

    // initialize the dialog layout
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);

    final Group group = new Group(composite, SWT.NONE);
    group.setLayout(new GridLayout());
    group.setText(Messages.getString("DataSetBasePage.Group.DataSourceSelection")); // $NON-NLS-1$
    group.setLayoutData(
        new GridData(SWT.FILL, SWT.FILL, true, true, 1, 8)); // GridData.FILL_BOTH));

    wizardFilter = new WizardFilter();
    dataSourceFilteredTree =
        new FilteredTree(
            group,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL,
            this.wizardFilter,
            true);
    GridData treeData = new GridData(GridData.FILL_BOTH);
    treeData.grabExcessHorizontalSpace = true;
    treeData.grabExcessVerticalSpace = true;
    treeData.heightHint = 300;
    treeData.widthHint = 600;
    dataSourceFilteredTree.setLayoutData(treeData);
    SelectionListener listener =
        new SelectionListener() {
          TreeItem parent = null;

          public void widgetDefaultSelected(SelectionEvent arg0) {}

          public void widgetSelected(SelectionEvent event) {
            if (event.item.getData() instanceof DataSourceHandle) {
              dataSetTypeChooser.getCombo().setEnabled(true);
              if (parent == null || parent != ((TreeItem) event.item).getParentItem()) {
                parent = ((TreeItem) event.item).getParentItem();
                doDataSourceSelectionChanged(parent.getData());
              }
              setPageComplete(!hasWizard() && (getMessageType() != ERROR));
            } else {
              dataSetTypeChooser.getCombo().clearSelection();
              dataSetTypeChooser.getCombo().setEnabled(false);
              setPageComplete(false);
            }
            dataSourceFilteredTree.getViewer().getTree().setFocus();
          }
        };
    dataSourceFilteredTree.getViewer().getTree().addSelectionListener(listener);
    createDataSetTypeViewer(composite);

    setDataSourceTreeViewer();
    setPageStatus();

    // initialize name editor
    new Label(composite, SWT.RIGHT)
        .setText(Messages.getString("dataset.wizard.label.datasetName")); // $NON-NLS-1$
    nameEditor = new Text(composite, SWT.BORDER);
    String name = ReportPlugin.getDefault().getCustomName(ReportDesignConstants.DATA_SET_ELEMENT);
    if (name != null) {
      nameEditor.setText(Utility.getUniqueDataSetName(name));
    } else // can't get defaut name
    {
      nameEditor.setText(
          Utility.getUniqueDataSetName(
              Messages.getString("dataset.new.defaultName"))); // $NON-NLS-1$		
    }

    nameEditor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    nameEditor.setToolTipText(Messages.getString("DataSetBasePage.tooltip")); // $NON-NLS-1$
    nameEditor.addModifyListener(
        new ModifyListener() {

          public void modifyText(ModifyEvent e) {
            if (StringUtil.isBlank(nameEditor.getText().trim())) {
              setMessage(EMPTY_NAME, ERROR);
            } else if (isDuplicateName()) { // name is duplicated
              setMessage(DUPLICATE_NAME, ERROR);
            } else if (containInvalidCharactor(
                nameEditor.getText())) { // name contains invalid ".", "/", "\", "!", ";", ","
              // character
              String msg =
                  Messages.getFormattedString(
                      "error.invalidName", //$NON-NLS-1$
                      new Object[] {nameEditor.getText()});
              setMessage(msg, ERROR);
            } else { // everything is OK
              setMessage(CREATE_PROMPT);
            }

            setPageComplete(
                !hasWizard() && (getMessageType() != ERROR) && getSelectedDataSource() != null);

            nameEditor.setFocus();
          }
        });
    setControl(composite);

    Utility.setSystemHelp(getControl(), IHelpConstants.CONEXT_ID_DATASET_NEW);
  }