当前位置: 首页>>代码示例>>Java>>正文


Java CheckboxTableViewer类代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.CheckboxTableViewer的典型用法代码示例。如果您正苦于以下问题:Java CheckboxTableViewer类的具体用法?Java CheckboxTableViewer怎么用?Java CheckboxTableViewer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CheckboxTableViewer类属于org.eclipse.jface.viewers包,在下文中一共展示了CheckboxTableViewer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createViewer

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
public void createViewer(Composite parent){
	
	GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;
	
	viewer = CheckboxTableViewer.newCheckList(parent, SWT.NONE);
	viewer.getTable().setLayoutData(gridData);
	viewer.setContentProvider(new ArrayContentProvider());
	viewer.setLabelProvider(getProvider());
	viewer.setInput(getViewerInput());
	viewer.addCheckStateListener(new ICheckStateListener() {

		public void checkStateChanged(CheckStateChangedEvent event) {
			checkPage();
		}

	});
	checkPage();
	parent.pack();
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:21,代码来源:SimulationWizard.java

示例2: updateSelectAllCheckState

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * Updates the tri-state "select all" element based on the size of the set
 * of currently checked (non-special) items in the table. If all non-special
 * items are checked, the "select all" box is checked and ungrayed. If no
 * non-special items are checked, the "select all" box is unchecked and
 * ungrayed. If some but not all non-special items are checked, the
 * "select all" box is checked and grayed.
 */
private void updateSelectAllCheckState() {
    final CheckboxTableViewer viewer = ((CheckboxTableViewer) getViewer());

    // Use the filtered (non-special items removed) counts
    final int checkedCount = getValidCheckedProjectsCount();
    final int elementCount = removeNotValidVC(getProjects()).length;

    if (checkedCount == elementCount && elementCount > 0) {
        viewer.setChecked(SELECT_ALL_SPECIAL_PROJECT_INFO, true);
        viewer.setGrayed(SELECT_ALL_SPECIAL_PROJECT_INFO, false);
    } else if (checkedCount == 0) {
        viewer.setChecked(SELECT_ALL_SPECIAL_PROJECT_INFO, false);
        viewer.setGrayed(SELECT_ALL_SPECIAL_PROJECT_INFO, false);
    } else {
        viewer.setChecked(SELECT_ALL_SPECIAL_PROJECT_INFO, true);
        viewer.setGrayed(SELECT_ALL_SPECIAL_PROJECT_INFO, true);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:27,代码来源:TeamProjectTable.java

示例3: getUncheckedChangeItems

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * @return the items that are not checked
 */
private ChangeItem[] getUncheckedChangeItems() {
    /*
     * This is not very efficient because the base class doesn't keep track
     * of the unchecked items, just the checked ones. So query the
     * underlying table viewer and hope it is efficient.
     */
    final ChangeItem[] allChangeItems = getChangeItems();

    final List uncheckedChangeItems = new ArrayList();

    for (int i = 0; i < allChangeItems.length; i++) {
        if (((CheckboxTableViewer) getViewer()).getChecked(allChangeItems[i]) == false) {
            uncheckedChangeItems.add(allChangeItems[i]);
        }
    }

    return (ChangeItem[]) uncheckedChangeItems.toArray(new ChangeItem[uncheckedChangeItems.size()]);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:22,代码来源:ChangesTable.java

示例4: setChecked

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
@Override
public boolean setChecked(final Object element, final boolean state) {
    throwIfNotCheckboxTable();
    final boolean success = ((CheckboxTableViewer) viewer).setChecked(element, state);

    if (success) {
        /**
         * Programmatically setting check state
         * (CheckboxTableViewer#setChecked()) does not fire a
         * CheckStateChangedEvent. We need to manually trigger a recompute
         * of the checked element set.
         */
        computeCheckedElements(true);
    }

    return success;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:18,代码来源:TableControl.java

示例5: setCheckedElements

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * Sets the currently checked elements in this {@link TableControl}. Any
 * existing check state is discarded. Any changes in the checked elements
 * will be reported to registered {@link CheckboxListener}s. If this
 * {@link TableControl} was not constructed with the {@link SWT#CHECK}
 * style, an exception is thrown.
 *
 * @param elementsToCheck
 *        the elements that should be checked in this control, or
 *        <code>null</code> if no elements should be checked
 */
public void setCheckedElements(Object[] elementsToCheck) {
    throwIfNotCheckboxTable();

    if (elementsToCheck == null) {
        elementsToCheck = new Object[0];
    }

    ((CheckboxTableViewer) viewer).setCheckedElements(elementsToCheck);

    /**
     * Programmatically setting check state
     * (CheckboxTableViewer#setCheckedElements()) does not fire a
     * CheckStateChangedEvent. We need to manually trigger a recompute of
     * the checked element set.
     */
    computeCheckedElements(true);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:29,代码来源:TableControl.java

示例6: doAdd

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
  * 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();

         view.getModel().setTraceExplorerExpression(FormHelper.getSerializedInput(tableViewer));
     }
 }
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:25,代码来源:TraceExplorerComposite.java

示例7: doEdit

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * 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);
        }
        tableViewer.refresh();
    }

    changeButtonEnablement();

    view.getModel().setTraceExplorerExpression(FormHelper.getSerializedInput(tableViewer));
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:23,代码来源:TraceExplorerComposite.java

示例8: doAdd

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:21,代码来源:ValidateableTableSectionPart.java

示例9: doEdit

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:20,代码来源:ValidateableTableSectionPart.java

示例10: createPageControls

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
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 );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:26,代码来源:CleanupPreferencePage.java

示例11: createFieldComposite

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
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;
}
 
开发者ID:maximeAudrain,项目名称:jenerate,代码行数:18,代码来源:FieldDialogImpl.java

示例12: CooperateProjectImportComposite

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * Constructor, creates a CheckboxTableViewer and selection buttons.
 * 
 * @param parent
 *            The parent composite.
 * @param style
 *            Style which will be used.
 * @param page
 *            Page which uses this composite.
 */
public CooperateProjectImportComposite(Composite parent, int style, ImportWizardPage page) {
    super(parent, style);
    Composite tableComposite = new Composite(this, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.makeColumnsEqualWidth = false;
    tableComposite.setLayout(layout);

    tableComposite
            .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));

    tv = CheckboxTableViewer.newCheckList(tableComposite, style | SWT.BORDER);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.widthHint = new PixelConverter(tv.getControl()).convertWidthInCharsToPixels(25);
    gridData.heightHint = new PixelConverter(tv.getControl()).convertHeightInCharsToPixels(10);
    tv.getControl().setLayoutData(gridData);
    setLayout(layout);
    tv.addSelectionChangedListener(event -> selectionChanged(page));
    addSelectionButtons(page);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:32,代码来源:CooperateProjectImportComposite.java

示例13: makeTable

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
protected TableViewer makeTable(final Composite parent) {
	CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);
	tableViewer.setContentProvider(new ArrayContentProvider());
	tableViewer.setInput(markerList);

	tableViewer.setLabelProvider(getLabelProvider());

	tableViewer.addSelectionChangedListener(event -> {
		Object marker = ((StructuredSelection) event.getSelection()).getFirstElement();
		if(marker instanceof IMarker) {
			openEditor((IMarker) marker);
		}
	});

	tableViewer.addCheckStateListener(getCheckStateListener());

	return tableViewer;
}
 
开发者ID:diverse-project,项目名称:InspectorGuidget,代码行数:19,代码来源:InspectorGuidgetView.java

示例14: getCheckedElements

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:CheckedListDialogField.java

示例15: selectAll

import org.eclipse.jface.viewers.CheckboxTableViewer; //导入依赖的package包/类
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();
    }
}
 
开发者ID:Talend,项目名称:tesb-studio-se,代码行数:17,代码来源:CheckedCamelDependenciesPanel.java


注:本文中的org.eclipse.jface.viewers.CheckboxTableViewer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。