Java Code Examples for org.eclipse.swt.widgets.TableItem#setChecked()
The following examples show how to use
org.eclipse.swt.widgets.TableItem#setChecked() .
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: ShowSummaryFieldDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
private void init( ) { if ( input != null ) { summaryFieldViewer.setInput( input ); for ( int i = 0; i < summaryFieldViewer.getTable( ).getItemCount( ); i++ ) { TableItem item = summaryFieldViewer.getTable( ).getItem( i ); if ( item.getData( ) != null && item.getData( ) instanceof MeasureInfo ) { item.setChecked( ( (MeasureInfo) item.getData( ) ).isShow( ) ); } } } }
Example 2
Source File: EnhancedCheckBoxTableViewer.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Sets which nodes are checked in this viewer. The given list contains the elements that are to * be checked; all other nodes are to be unchecked. * <p> * This method is typically used when restoring the interesting state of a viewer captured by an * earlier call to <code>getCheckedElements</code>. * </p> * * @param elements * the list of checked elements (element type: <code>Object</code>) * @see #getCheckedElements */ public void setCheckedElements(Object[] elements) { assertElementsNotNull(elements); CustomHashtable set = newHashtable(elements.length * 2 + 1); for (int i = 0; i < elements.length; ++i) { set.put(elements[i], elements[i]); } TableItem[] items = getTable().getItems(); for (int i = 0; i < items.length; ++i) { TableItem item = items[i]; Object element = item.getData(); if (element != null) { boolean check = set.containsKey(element); // only set if different, to avoid flicker if (item.getChecked() != check) { item.setChecked(check); } } } }
Example 3
Source File: IgnorePage.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public void setVisible ( final boolean visible ) { super.setVisible ( visible ); if ( visible ) { final Object[] data = this.mergeController.makeKnownFactories ().toArray (); this.factoriesViewer.setInput ( data ); final Set<String> factories = this.mergeController.getIgnoreFactories (); // select all for ( final TableItem item : this.factoriesViewer.getTable ().getItems () ) { item.setChecked ( factories.contains ( item.getData () ) ); } // set ignore fields this.fieldsViewer.setInput ( this.mergeController.getIgnoreFields () ); } }
Example 4
Source File: ConversionProblemsDialog.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public void create() { super.create(); if (javaFilesTable != null && !javaFilesTable.isDisposed()) { for (Entry<ICompilationUnit, ConversionResult> entry : input.entrySet()) { if (entry.getValue().getProblems().iterator().hasNext()) { ICompilationUnit cu = entry.getKey(); IResource resource = cu.getResource(); TableItem ti = new TableItem(javaFilesTable, SWT.NONE); ti.setImage(CompareUI.getImage(resource)); ti.setText(resource.getName()); ti.setData(cu); ti.setChecked(true); } } if (javaFilesTable.getItems().length > 0) { javaFilesTable.select(0); handleMemberSelect(javaFilesTable.getItems()[0]); } } }
Example 5
Source File: XMLAnalysesManagerPreferencePage.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Fill the table with the imported files. */ private void fillAnalysesTable() { fAnalysesTable.removeAll(); Map<String, File> files = XmlUtils.listFiles(); for (String file : files.keySet()) { // Remove the extension from the file path to display. IPath path = new Path(file); // Create item and add to table TableItem item = new TableItem(fAnalysesTable, SWT.NONE); item.setText(path.removeFileExtension().toString()); item.setChecked(XmlUtils.isAnalysisEnabled(path.toString())); } setButtonsEnabled(false); }
Example 6
Source File: WizardSubPageFormTable.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
protected void setupTableContents(int selIndex) { tableViewer.setInput(fieldList.toArray()); tableViewer.getTable().setSelection(selIndex); int i = 0; for(TableItem ti : tableViewer.getTable().getItems()) { ti.setChecked(fieldList.get(i++).checked); } }
Example 7
Source File: NetworkPreferencePage.java From saros with GNU General Public License v2.0 | 5 votes |
private void handleGatewaySelection(Event event) { for (TableItem item : upnpDevicesTable.getItems()) { if (item.equals(event.item) && !item.equals(lastCheckedItem)) { lastCheckedItem = item; item.setChecked(true); } else if (item.equals(event.item) && item.equals(lastCheckedItem)) { item.setChecked(false); lastCheckedItem = null; } else item.setChecked(false); } }
Example 8
Source File: PullPushCheckboxTableViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected void doUpdateItem(Widget widget, Object element, boolean fullMap) { super.doUpdateItem(widget, element, fullMap); if (! (widget instanceof TableItem)) return; TableItem item= (TableItem)widget; IMemberActionInfo info= (IMemberActionInfo)element; item.setChecked(PullPushCheckboxTableViewer.getCheckState(info)); Assert.isTrue(item.getChecked() == PullPushCheckboxTableViewer.getCheckState(info)); }
Example 9
Source File: BranchTagWizardCopyPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void deselectAll() { TableItem[] items = table.getItems(); for (TableItem item : items) { item.setChecked(false); ((SVNExternal)item.getData()).setSelected(false); } }
Example 10
Source File: BranchTagWizardCopyPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void selectAll() { TableItem[] items = table.getItems(); for (TableItem item : items) { item.setChecked(true); ((SVNExternal)item.getData()).setSelected(true); } }
Example 11
Source File: HierarchyWizardPageDate.java From arx with Apache License 2.0 | 5 votes |
/** * Creates a list of all available granularities * @param table */ private void createItems(DynamicTable table) { // Initialize for (Granularity g : Granularity.values()) { TableItem item = new TableItem(table, SWT.CHECK); item.setText(Resources.getMessage("HierarchyWizardPageDate." + g.toString())); //$NON-NLS-1$ item.setData(g); item.setChecked(model.getGranularities().contains(g)); } }
Example 12
Source File: XMLAnalysesManagerPreferencePage.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Apply change to items according to their checkboxes. */ private void handleChecks() { Map<@NonNull String, @NonNull File> listFiles = XmlUtils.listFiles(); Collection<String> filesToEnable = Lists.newArrayList(); Collection<String> filesToDisable = Lists.newArrayList(); for (TableItem item : fAnalysesTable.getItems()) { String xmlName = XmlUtils.createXmlFileString(item.getText()); // Only enable/disable if the checkbox status has changed if (item.getChecked() && !XmlUtils.isAnalysisEnabled(xmlName)) { // Do not enable an invalid file if (isFileValid(xmlName, listFiles)) { filesToEnable.add(xmlName); } else { item.setChecked(false); } } else if (!item.getChecked() && XmlUtils.isAnalysisEnabled(xmlName)) { filesToDisable.add(xmlName); } } // Apply changes if (!(filesToEnable.isEmpty() && filesToDisable.isEmpty())) { enableAndDisableAnalyses(filesToEnable, filesToDisable); } // Force update for selection handling handleSelection(fAnalysesTable.getSelection()); }
Example 13
Source File: HopGitPerspective.java From hop with Apache License 2.0 | 5 votes |
private void refreshChangedTable() { changedTable.removeAll(); changedFiles = new ArrayList<>(); boolean allowChecking; if ( isOnlyWIP() ) { // Work in progress, not a committed revision // authorNameTextbox.setText( Const.NVL( vcs.getAuthorName( IVCS.WORKINGTREE ), "" ) ); commitMessageTextbox.setText( Const.NVL( vcs.getCommitMessage( IVCS.WORKINGTREE ), "" ) ); changedFiles.addAll( vcs.getUnstagedFiles() ); changedFiles.addAll( vcs.getStagedFiles() ); allowChecking = true; } else { String commitId = revisions.get( revisionTable.getSelectionIndex() ).getRevisionId(); authorNameTextbox.setText( Const.NVL( vcs.getAuthorName( commitId ), "" ) ); commitMessageTextbox.setText( Const.NVL( vcs.getCommitMessage( commitId ), "" ) ); changedFiles.addAll( vcs.getStagedFiles( vcs.getParentCommitId( commitId ), commitId ) ); allowChecking = false; } addChangedTable( allowChecking ); for ( UIFile changedFile : changedFiles ) { TableItem item = new TableItem( changedTable, SWT.NONE ); item.setChecked( false ); switch ( changedFile.getChangeType() ) { case MODIFY: item.setImage( 1, imageChanged ); break; case ADD: item.setImage( 1, imageAdded ); break; case DELETE: item.setImage( 1, imageRemoved ); break; default: item.setText( 1, changedFile.getChangeType().name() ); break; } item.setText( 2, changedFile.getIsStaged() ? "Staged" : "" ); item.setText( 3, changedFile.getName() ); } }
Example 14
Source File: XMLAnalysesManagerPreferencePage.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Handle the current table selection by validating the associated file. * * @param selection * the selected table item */ private void handleSelection(TableItem[] selection) { for (TableItem selectedItem : selection) { String xmlName = XmlUtils.createXmlFileString(selectedItem.getText()); if (isFileValid(xmlName)) { if (selection.length == 1) { if (XmlUtils.isAnalysisEnabled(xmlName)) { fStatusLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN)); fStatusLabel.setText(Messages.ManageXMLAnalysisDialog_FileEnabled); } else { fStatusLabel.setText(""); //$NON-NLS-1$ } } } else { if (selection.length == 1) { fStatusLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); fStatusLabel.setText(Messages.ManageXMLAnalysisDialog_FileValidationError); } if (XmlUtils.isAnalysisEnabled(xmlName)) { enableAndDisableAnalyses( Collections.emptyList(), ImmutableList.of(Objects.requireNonNull(xmlName))); } selectedItem.setChecked(false); } } if (selection.length != 1) { fStatusLabel.setText(""); //$NON-NLS-1$ } }
Example 15
Source File: DetectorConfigurationTab.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
void refreshUI(UserPreferences preferences) { // Enable only those detectors that are enabled by preferences TableItem[] itemList = availableFactoriesTableViewer.getTable().getItems(); for (int i = 0; i < itemList.length; i++) { TableItem item = itemList[i]; DetectorFactory factory = (DetectorFactory) item.getData(); item.setChecked(preferences.isDetectorEnabled(factory)); } refreshTable(); syncUserPreferencesWithTable(); }
Example 16
Source File: StaticAnalyzerPreferences.java From CogniCrypt with Eclipse Public License 2.0 | 5 votes |
/*** * This method creates a row for each of the rule set with a drop-down list of versions passed. * * @param ruleset rule set to be added */ private void createRulesTableRow(Ruleset ruleset) { TableEditor editor = new TableEditor(table.getTable()); TableItem rulesRow = new TableItem(table.getTable(), SWT.NONE); rulesRow.setText(0, ruleset.getFolderName()); editor.grabHorizontal = true; editor.setEditor(ruleset.getVersions(), rulesRow, 1); rulesRow.setText(2, ruleset.getUrl()); rulesRow.setChecked(ruleset.isChecked()); ruleset.setRulesRow(rulesRow); }
Example 17
Source File: IgnorePage.java From neoscada with Eclipse Public License 1.0 | 5 votes |
protected void setFieldSelection ( final boolean state ) { for ( final TableItem item : this.factoriesViewer.getTable ().getItems () ) { item.setChecked ( state ); } }
Example 18
Source File: EnhancedCheckBoxTableViewer.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Sets to the given value the checked state for all elements in this viewer. * * @param state * <code>true</code> if the element should be checked, and <code>false</code> if it * should be unchecked */ public void setAllChecked(boolean state) { TableItem[] children = getTable().getItems(); for (int i = 0; i < children.length; i++) { TableItem item = children[i]; item.setChecked(state); } }
Example 19
Source File: SWTCheckTable.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
public void setCheckedItem(UITableItem<T> item, boolean checked) { TableItem tableItem = this.getTableItem(item); if( tableItem != null ) { tableItem.setChecked(checked); } }
Example 20
Source File: FilterListDialog.java From tracecompass with Eclipse Public License 2.0 | 3 votes |
/** * Constructor * * @param parent The parent table * @param isActive <code>true</code> if filter criteria is active else <code>false</code> * @param isPositive <code>true</code> for positive filter else <code>false</code> * @param loaderClassName The loader class name */ public CriteriaTableItem(Table parent, boolean isActive, boolean isPositive, String loaderClassName) { fTableItem = new TableItem(parent, SWT.NONE); fTableItem.setData(this); fTableItem.setChecked(isActive); fIsPositive = isPositive; fLoaderClassName = loaderClassName; }