org.eclipse.jface.viewers.CheckboxTableViewer Java Examples

The following examples show how to use org.eclipse.jface.viewers.CheckboxTableViewer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CheckedCamelDependenciesPanel.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
protected TableViewer createTableViewer() {
    final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(this, SWT.MULTI | SWT.H_SCROLL
        | SWT.V_SCROLL | SWT.BORDER);
    viewer.setCheckStateProvider(checkStateProvider);
    viewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            if (((ManifestItem) event.getElement()).isBuiltIn()) {
                viewer.setChecked(event.getElement(), !event.getChecked());
            } else {
                ((ManifestItem) event.getElement()).setOptional(!event.getChecked());
                fireDependenciesChangedListener();
            }
        }
    });
    return viewer;
}
 
Example #2
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets the checked elements.
 * 
 * @return the list of checked elements
 */
@SuppressWarnings("unchecked")
public List<E> getCheckedElements() {
	if (isOkToUse(fTableControl)) {
		// workaround for bug 53853
		Object[] checked= ((CheckboxTableViewer) fTable).getCheckedElements();
		ArrayList<E> res= new ArrayList<E>(checked.length);
		for (int i= 0; i < checked.length; i++) {
			res.add((E) checked[i]);
		}
		return res;
	}


	return new ArrayList<E>(fCheckedElements);
}
 
Example #3
Source File: GrandTotalProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public boolean canModify( Object element, String property )
{
	// TODO Auto-generated method stub
	if ( Arrays.asList( columnNames ).indexOf( property ) == 2
			|| Arrays.asList( columnNames ).indexOf( property ) == 3 )
	{
		if ( viewer instanceof CheckboxTableViewer )
		{
			return ( (CheckboxTableViewer) viewer ).getChecked( element );
		}
		else
		{
			return true;
		}

	}
	else
	{
		return false;
	}
}
 
Example #4
Source File: FieldDialogImpl.java    From jenerate with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createFieldComposite(final Composite composite) {
    Composite fieldComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    fieldComposite.setLayout(layout);

    fieldViewer = CheckboxTableViewer.newCheckList(fieldComposite, SWT.MULTI | SWT.TOP | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.grabExcessHorizontalSpace = true;

    fieldViewer.getTable().setLayoutData(data);

    fieldViewer.setLabelProvider(new JavaElementLabelProvider());
    fieldViewer.setContentProvider(new ArrayContentProvider());
    fieldViewer.setInput(allFields);
    selectAllNonTransientFields();
    return fieldComposite;
}
 
Example #5
Source File: CleanupPreferencePage.java    From eclipse-extras with Eclipse Public License 1.0 6 votes vote down vote up
private void createPageControls( Composite parent ) {
  cleanupButton = new Button( parent, SWT.CHECK );
  cleanupButton.setText( "Remove on-the-fly generated launch configurations when no longer needed" );
  cleanupButton.addListener( SWT.Selection, this::cleanupButtonSelected );
  cleanupTypesLabel = new Label( parent, SWT.NONE );
  cleanupTypesLabel.setText( "Select the launch configuration types to clean up" );
  cleanupTypesViewer = CheckboxTableViewer.newCheckList( parent, SWT.BORDER );
  cleanupTypesViewer.setLabelProvider( DebugUITools.newDebugModelPresentation() );
  cleanupTypesViewer.setContentProvider( ArrayContentProvider.getInstance() );
  cleanupTypesViewer.setComparator( new WorkbenchViewerComparator() );
  cleanupTypesViewer.addFilter( new LaunchConfigTypeFilter() );
  cleanupTypesViewer.setInput( launchManager.getLaunchConfigurationTypes() );
  selectAllButton = new Button( parent, SWT.PUSH );
  selectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( true ) );
  selectAllButton.setText( "&Select All" );
  deselectAllButton = new Button( parent, SWT.PUSH );
  deselectAllButton.setText( "&Deselect All" );
  deselectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( false ) );
  notelabel = new Label( parent, SWT.WRAP );
  String text
    = "Note: Launch configurations are considered as on-the-fly generated if "
    + "they were created outside the Run Configurations dialog without further "
    + "manual changes. For example with Run As > JUnit Test";
  notelabel.setText( text );
}
 
Example #6
Source File: ChartMakerDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Constructor.
 *
 * @param parent
 *            Parent shell
 * @param model
 *            Model to choose source from
 */
public ChartMakerDialog(Shell parent, IDataChartProvider<?> model) {
    super(parent);

    fComposite = parent;
    fDataProvider = model;

    /* Create tables */
    fTypeTable = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER);
    fSeriesTable = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER);
    fSelectionXTable = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.NO_SCROLL | SWT.V_SCROLL);
    fSelectionYTable = checkNotNull(CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.NO_SCROLL | SWT.V_SCROLL));

    /* Create buttons */
    fAddButton = new Button(parent, SWT.NONE);
    fXLogscaleButton = new Button(parent, SWT.CHECK);
    fYLogscaleButton = new Button(parent, SWT.CHECK);
    fWarningLabel = new Label(parent, SWT.NONE);

    setShellStyle(getShellStyle() | SWT.RESIZE);
}
 
Example #7
Source File: ValidateableTableSectionPart.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Edit selected formula 
 */
protected void doEdit()
{
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    Formula formula = (Formula) selection.getFirstElement();
    Formula editedFormula = doEditFormula(formula);
    if (editedFormula != null)
    {
        formula.setFormula(editedFormula.getFormula());
        if (tableViewer instanceof CheckboxTableViewer)
        {
            ((CheckboxTableViewer) tableViewer).setChecked(formula, true);
        }
        this.doMakeDirty();
        tableViewer.refresh();
    }
}
 
Example #8
Source File: ValidateableTableSectionPart.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Add a formula to the list
 */
protected void doAdd()
{
    Formula formula = doEditFormula(null);

    // add a formula
    if (formula != null)
    {
        Vector input = ((Vector) tableViewer.getInput());
        input.add(formula);
        tableViewer.setInput(input);
        if (tableViewer instanceof CheckboxTableViewer)
        {
            ((CheckboxTableViewer) tableViewer).setChecked(formula, true);
        }
        this.doMakeDirty();
    }
}
 
Example #9
Source File: FormHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
    * Reads the input (list of formulas) and returns a list of strings which can be serialized 
    * @param source - viewer containing the formulas/assignments
    * @return
    */
public static List<String> getSerializedInput(final TableViewer tableViewer) {
	if (tableViewer instanceof CheckboxTableViewer) {
		final ArrayList<String> result = new ArrayList<>();
		final TableItem[] tableItems = tableViewer.getTable().getItems();
		final int itemCount = tableItems.length;
		for (int i = 0; i < itemCount; i++) {
			final TableItem item = tableItems[i];
			final String serialized = (item.getChecked() ? "1" : "0") + item.getText();
			
			result.add(serialized);
		}

           return result;
	} else {
           @SuppressWarnings("unchecked")
		List<Assignment> assignments = (List<Assignment>) tableViewer.getInput();
		if (assignments == null) {
			return null;
		}

           return ModelHelper.serializeAssignmentList(assignments);
       }
   }
 
Example #10
Source File: TraceExplorerComposite.java    From tlaplus with MIT License 6 votes vote down vote up
/**
    * Edit selected formula 
    */
protected void doEdit() {
       final IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
       final Formula formula;
       
       if (selection.size() == 1) {
       	formula = (Formula) selection.getFirstElement();
       } else {
       	formula = (Formula) tableViewer.getElementAt(0);
       }
       
       final Formula editedFormula = doEditFormula(formula);
	if (editedFormula != null) {
		formula.setFormula(editedFormula.getFormula());
		if (tableViewer instanceof CheckboxTableViewer) {
			((CheckboxTableViewer) tableViewer).setChecked(formula, true);
           }
           tableViewer.refresh();
       }

       saveModel();
   }
 
Example #11
Source File: TraceExplorerComposite.java    From tlaplus with MIT License 6 votes vote down vote up
/**
   * Add a formula to the list
   */
  protected void doAdd()
  {
      Formula formula = doEditFormula(null);

      // add a formula
if (formula != null) {
          @SuppressWarnings("unchecked")
	Vector<Formula> input = ((Vector<Formula>) tableViewer.getInput());
          input.add(formula);
          tableViewer.setInput(input);
	if (tableViewer instanceof CheckboxTableViewer) {
              ((CheckboxTableViewer) tableViewer).setChecked(formula, true);
          }

          changeButtonEnablement();

          saveModel();
      }
  }
 
Example #12
Source File: TraceExplorerComposite.java    From tlaplus with MIT License 6 votes vote down vote up
/**
    * This creates the table viewer. It should be called
    * within {@link TraceExplorerComposite#sectionInitialize(FormToolkit)}.
    * @param table
    * @return
    */
protected CheckboxTableViewer createTableViewer(Table table) {
       // create
       final CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
       // represent formulas in the view
       tableViewer.setContentProvider(new FormulaContentProvider());
       // on changed selection change button enablement
       tableViewer.addSelectionChangedListener(m_formulaEnablementListener);
       // edit on double-click on a formula
	tableViewer.addDoubleClickListener((event) -> {
		doEdit();
	});

       // save the input when an element is checked or unchecked
	tableViewer.addCheckStateListener((event) -> {
		view.getModel().save(new NullProgressMonitor());
	});

       tableViewer.setInput(new Vector<Formula>());
       
       return tableViewer;
   }
 
Example #13
Source File: PathsProvider.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected PathsProvider(TableViewer viewer, FindbugsPropertyPage propertyPage) {
    this.propertyPage = propertyPage;
    this.paths = new ArrayList<>();
    this.viewer = viewer;
    if (viewer instanceof CheckboxTableViewer) {
        CheckboxTableViewer tv = (CheckboxTableViewer) viewer;
        tv.setCheckStateProvider(this);
        tv.addCheckStateListener(new ICheckStateListener() {
            @Override
            public void checkStateChanged(CheckStateChangedEvent event) {
                boolean checked = event.getChecked();
                IPathElement element = (IPathElement) event.getElement();
                element.setEnabled(checked);
                handleContendChanged();
            }
        });
    }
    this.control = viewer.getTable();
    listeners = new ListenerList();
    viewer.setContentProvider(this);
}
 
Example #14
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintEditionViewer(Composite parent) {
    constraintEditionViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
    constraintEditionViewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    constraintEditionViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, CONSTRAINT_EDITION_VIEWER_ID);
    formPage.getToolkit().adapt(constraintEditionViewer.getTable(), true, true);

    constraintEditionViewer.setContentProvider(new ObservableListContentProvider());
    constraintEditionViewer.setLabelProvider(new LabelProviderBuilder<Field>()
            .withStyledStringProvider(fieldStyleStringProvider)
            .createStyledCellLabelProvider());
    constraintEditionViewer.addFilter(new IndexableFieldFilter());
    constraintEditionViewer.setInput(actualsFieldsObservable);

    selectedAttributeObservable = ViewerProperties.singleSelection(Field.class).observe(constraintEditionViewer);
    constraintEditionViewer.addCheckStateListener(
            new ConstraintAttributeCheckListener(selectedConstraintObservable, selectedAttributeObservable,
                    formPage, constraintViewer));
}
 
Example #15
Source File: CheckedCamelDependenciesPanel.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
private void selectAll(boolean state) {
    boolean hasChanged = false;
    Collection<? extends ManifestItem> input = getInput();
    for (ManifestItem bcp : input) {
        if (bcp.isBuiltIn() || !bcp.isOptional() == state) {
            continue;
        }
        hasChanged = true;
        bcp.setOptional(!state);
        ((CheckboxTableViewer) tableViewer).setChecked(bcp, state);
    }
    if (hasChanged) {
        //((CheckboxTableViewer) tableViewer).setAllChecked(state);
        fireDependenciesChangedListener();
    }
}
 
Example #16
Source File: SubTotalProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public boolean canModify( Object element, String property )
{
	// TODO Auto-generated method stub
	if ( Arrays.asList( columnNames ).indexOf( property ) == 2
			|| Arrays.asList( columnNames ).indexOf( property ) == 3 )
	{
		if ( viewer instanceof CheckboxTableViewer )
		{
			return ( (CheckboxTableViewer) viewer ).getChecked( element );
		}
		else
		{
			return true;
		}
	}
	else
	{
		return false;
	}
}
 
Example #17
Source File: TemplateCustomPropertiesPage.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {

    final Composite container = new Composite(parent, parent.getStyle());
    setControl(container);
    container.setLayout(new GridLayout(1, false));

    final TabFolder tabFolder = new TabFolder(container, SWT.BORDER);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    final CheckboxTableViewer tokenViewer = addTokenTabItem(tabFolder, registry, properties);
    addNSURITabItem(tabFolder, tokenViewer, properties);
    addServicesTabItem(tabFolder, tokenViewer, properties);
    if (!M2DocUtils.VERSION.equals(properties.getM2DocVersion())) {
        setMessage("M2Doc version mismatch: template version is " + properties.getM2DocVersion()
            + " and current M2Doc version is " + M2DocUtils.VERSION, IMessageProvider.WARNING);
    } else {
        setMessage("Select services and packages");
    }
}
 
Example #18
Source File: FormHelper.java    From tlaplus with MIT License 5 votes vote down vote up
/**
   * Performs the inverse operation to {@link FormHelper#getSerializedInput(CheckboxTableViewer)} 
   */
  public static void setSerializedInput(TableViewer table, List<String> serializedInput)
  {
      @SuppressWarnings("unchecked")
Vector<Formula> input = ((Vector<Formula>) table.getInput());
      if (input == null)
      {
          input = new Vector<Formula>();
      }
      // handling Formulas
      if (table instanceof CheckboxTableViewer)
      {
          Iterator<String> serializedIterator = serializedInput.iterator();
          Vector<Formula> checked = new Vector<Formula>();

          CheckboxTableViewer checkTable = (CheckboxTableViewer) table;
          while (serializedIterator.hasNext())
          {
              String entry = serializedIterator.next();
              Formula formula = new Formula(entry.substring(1));
              input.add(formula);
              if ("1".equals(entry.substring(0, 1)))
              {
                  checked.add(formula);
              }
          }
          checkTable.setInput(input);
          checkTable.setCheckedElements(checked.toArray());

      } else
      // handling Assignments
      {
          List<Assignment> deserializeAssignmentList = ModelHelper.deserializeAssignmentList(serializedInput);
          table.setInput(deserializeAssignmentList);
      }

  }
 
Example #19
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected TableViewer createTableViewer(Composite parent) {
	Table table= new Table(parent, SWT.CHECK | getListStyle());
	table.setFont(parent.getFont());
	CheckboxTableViewer tableViewer= new CheckboxTableViewer(table);
	tableViewer.addCheckStateListener(new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent e) {
			doCheckStateChanged(e);
		}
	});
	return tableViewer;
}
 
Example #20
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Control getListControl(Composite parent) {
	Control control= super.getListControl(parent);
	if (parent != null) {
		((CheckboxTableViewer)fTable).setCheckedElements(fCheckedElements.toArray());
		((CheckboxTableViewer)fTable).setGrayedElements(fGrayedElements.toArray());
	}
	return control;
}
 
Example #21
Source File: ColumnBindingDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void updateSelection( )
{
	if ( canSelect )
	{
		( (CheckboxTableViewer) bindingTable ).setAllChecked( false );
		( (CheckboxTableViewer) bindingTable ).setGrayed( dummyChoice, true );
		if ( getSelectColumnHandle( ) != null )
		{
			( (CheckboxTableViewer) bindingTable ).setChecked( getSelectColumnHandle( ),
					true );
		}
	}
}
 
Example #22
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns true if the element is checked.
 * 
 * @param obj the element to check
 * @return <code>true</code> if the given element is checked
 */
public boolean isChecked(Object obj) {
	if (isOkToUse(fTableControl)) {
		return ((CheckboxTableViewer) fTable).getChecked(obj);
	}

	return fCheckedElements.contains(obj);
}
 
Example #23
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean isGrayed(Object obj) {
	if (isOkToUse(fTableControl)) {
		return ((CheckboxTableViewer) fTable).getGrayed(obj);
	}

	return fGrayedElements.contains(obj);
}
 
Example #24
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the checked elements.
 * 
 * @param list the list of checked elements
 */
public void setCheckedElements(Collection<E> list) {
	fCheckedElements= new ArrayList<E>(list);
	if (isOkToUse(fTableControl)) {
		((CheckboxTableViewer)fTable).setCheckedElements(list.toArray());
	}
	checkStateChanged();
}
 
Example #25
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the checked state of an element. No dialog changed listener is informed.
 * 
 * @param object the element for which to set the state
 * @param state the checked state
 */
public void setCheckedWithoutUpdate(E object, boolean state) {
	if (state) {
		if (!fCheckedElements.contains(object)) {
			fCheckedElements.add(object);
		}
	} else {
		fCheckedElements.remove(object);
	}
	if (isOkToUse(fTableControl)) {
		((CheckboxTableViewer)fTable).setChecked(object, state);
	}
}
 
Example #26
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void setGrayedWithoutUpdate(E object, boolean state) {
	if (state) {
		if (!fGrayedElements.contains(object)) {
			fGrayedElements.add(object);
		}
	} else {
		fGrayedElements.remove(object);
	}
	if (isOkToUse(fTableControl)) {
		((CheckboxTableViewer)fTable).setGrayed(object, state);
	}
}
 
Example #27
Source File: WebSearchPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private Composite createTableArea(Composite parent) {
	Composite tableArea = new Composite(parent, SWT.NONE);
	GridLayout gridLayout = new GridLayout(1, false);
	gridLayout.marginWidth = 0;
	tableArea.setLayout(gridLayout);
	GridData gridData = new GridData(GridData.FILL_BOTH);
	tableArea.setLayoutData(gridData);
	checkboxTableViewer = CheckboxTableViewer.newCheckList(tableArea, SWT.BORDER | SWT.FULL_SELECTION);
	table = checkboxTableViewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(false);
	TableLayout tableLayout = new TableLayout();
	tableLayout.addColumnData(new ColumnPixelData(40));
	tableLayout.addColumnData(new ColumnWeightData(50, 50, true));
	tableLayout.addColumnData(new ColumnWeightData(70, 50, true));
	table.setLayout(tableLayout);
	GridData tableGridData = new GridData(GridData.FILL_BOTH);
	table.setLayoutData(tableGridData);
	WebSearchLableProvider webSearchLableProvider = new WebSearchLableProvider();
	webSearchLableProvider.createColumns(checkboxTableViewer);
	checkboxTableViewer.setContentProvider(new WebSearchContentProvider());
	checkboxTableViewer.setLabelProvider(webSearchLableProvider);
	checkboxTableViewer.setCheckStateProvider(new CheckProvider());
	checkboxTableViewer.addCheckStateListener(new CheckListener());
	// checkboxTableViewer.setCellEditors(new CellEditor[] { null, new TextCellEditor(table),
	// new TextCellEditor(table) });
	// checkboxTableViewer.setCellModifier(new NameModifier());
	checkboxTableViewer.setColumnProperties(new String[] { APP_PROP, NAME_PROP, URL_PROP });
	cache = WebSearchPreferencStore.getIns().getSearchConfig();
	checkboxTableViewer.setInput((Object) cache);
	return tableArea;
}
 
Example #28
Source File: ConfigureWorkingSetAssignementAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected CheckboxTableViewer createTableViewer(Composite parent) {

			final CheckboxTableViewer result= CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI);
			result.addCheckStateListener(new ICheckStateListener() {
				public void checkStateChanged(CheckStateChangedEvent event) {
					GrayedCheckedModelElement element= (GrayedCheckedModelElement)event.getElement();
					result.setGrayed(element, false);
					if (event.getChecked()) {
						element.select();
					} else {
						element.deselect();
					}
					result.update(element, null);
				}
			});
			GridData data= new GridData(GridData.FILL_BOTH);
			data.heightHint= convertHeightInCharsToPixels(20);
			data.widthHint= convertWidthInCharsToPixels(50);
			result.getTable().setLayoutData(data);

			result.addFilter(new Filter());
			result.setLabelProvider(new GrayedCheckedModelLabelProvider());
			result.setSorter(new GrayedCheckModelElementSorter());
			result.setContentProvider(new GrayedCheckedModelContentProvider());

			result.setInput(fModel);
			result.setCheckedElements(fModel.getChecked());
			result.setGrayedElements(fModel.getGrayed());

			return result;
		}
 
Example #29
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the check state of all elements.
 * 
 * @param state the checked state
 */
public void checkAll(boolean state) {
	if (state) {
		fCheckedElements= getElements();
	} else {
		fCheckedElements.clear();
	}
	if (isOkToUse(fTableControl)) {
		((CheckboxTableViewer)fTable).setAllChecked(state);
	}
	checkStateChanged();
}
 
Example #30
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void refresh() {
	super.refresh();
	if (isOkToUse(fTableControl)) {
		((CheckboxTableViewer)fTable).setCheckedElements(fCheckedElements.toArray());
		((CheckboxTableViewer)fTable).setGrayedElements(fGrayedElements.toArray());
	}
}