當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。