本文整理匯總了Java中org.eclipse.swt.widgets.TableItem.getData方法的典型用法代碼示例。如果您正苦於以下問題:Java TableItem.getData方法的具體用法?Java TableItem.getData怎麽用?Java TableItem.getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.TableItem
的用法示例。
在下文中一共展示了TableItem.getData方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkSelection
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
private void checkSelection(final Table table) {
TableItem[] items = table.getSelection();
if (items != null && items.length > 0) {
for (TableItem item: items) {
Plugin plugin = (Plugin) item.getData();
if (plugin != null) {
if (source.stream().anyMatch(p -> p.equals(plugin))) {
btnSelect.setEnabled(true);
} else if (target.stream().anyMatch(p -> p.equals(plugin))) {
btnDeselect.setEnabled(true);
}
return;
}
}
}
btnSelect.setEnabled(false);
btnDeselect.setEnabled(false);
}
示例2: selectedMonitors
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
public List<DecoratedMonitor> selectedMonitors ()
{
if ( this.tableRef.get ().getTable ().getSelectionCount () == 0 )
{
return new ArrayList<DecoratedMonitor> ();
}
final List<DecoratedMonitor> result = new ArrayList<DecoratedMonitor> ();
for ( final TableItem row : this.tableRef.get ().getTable ().getSelection () )
{
if ( row.getData () instanceof DecoratedMonitor )
{
result.add ( (DecoratedMonitor)row.getData () );
}
}
return result;
}
示例3: selectedEvents
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
public List<DecoratedEvent> selectedEvents ()
{
if ( this.tableViewer.getTable ().getSelectionCount () == 0 )
{
return new ArrayList<DecoratedEvent> ();
}
final ArrayList<DecoratedEvent> result = new ArrayList<DecoratedEvent> ();
for ( final TableItem row : this.tableViewer.getTable ().getSelection () )
{
if ( row.getData () instanceof DecoratedEvent )
{
result.add ( (DecoratedEvent)row.getData () );
}
}
return result;
}
示例4: deleteFile
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
/**
* Delete the currently selected files.
*/
protected void deleteFile() {
TableItem[] selection = fileTable.getSelection();
String message = (selection.length > 1) ?
textBundle.get("DeletePromptMultipleFiles") : //$NON-NLS-1$
textBundle.get("DeletePromptSingleFile") //$NON-NLS-1$
+ textBundle.get("DeletePromptTrailer"); //$NON-NLS-1$
int answer = SwtUtil.showYesNoDialog(shell,
textBundle.get("DeletePromptTitle"), //$NON-NLS-1$
message);
if (answer == SWT.YES) {
for (int i=0; i<selection.length; i++) {
TableItem tableItem = selection[i];
FileEntry fileEntry = (FileEntry) tableItem.getData();
fileEntry.delete();
}
fillFileTable(currentFileList);
saveToolItem.setEnabled(true);
}
}
示例5: getFieldNameModifyListener
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
/**
* Gets the field name modify listener.
*
* @param tableViewer
* the table viewer
* @param conditionsList
* the conditions list
* @param fieldsAndTypes
* the fields and types
* @param fieldNames
* the field names
* @param saveButton
* the save button
* @param displayButton
* the display button
* @return the field name modify listener
*/
public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList,
final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
ModifyListener listener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
CCombo source = (CCombo) e.getSource();
int index = (int) source.getData(FilterConstants.ROW_INDEX);
Condition filterConditions = conditionsList.get(index);
String fieldName = source.getText();
filterConditions.setFieldName(fieldName);
if(StringUtils.isNotBlank(fieldName)){
String fieldType = fieldsAndTypes.get(fieldName);
TableItem item = tableViewer.getTable().getItem(index);
CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS);
if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){
conditionalCombo.setText(filterConditions.getConditionalOperator());
conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType));
new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems());
}
}
validateCombo(source);
toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
}
};
return listener;
}
示例6: getConditionalOperatorModifyListener
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
/**
* Gets the conditional operator modify listener.
*
* @param conditionsList
* the conditions list
* @param fieldsAndTypes
* the fields and types
* @param fieldNames
* the field names
* @param saveButton
* the save button
* @param displayButton
* the display button
* @return the conditional operator modify listener
*/
public ModifyListener getConditionalOperatorModifyListener(final List<Condition> conditionsList,
final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
ModifyListener listener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
CCombo source = (CCombo) e.getSource();
TableItem tableItem = getTableItem(source);
Condition condition = (Condition) tableItem.getData();
if (tableItem.getData(FilterConstants.VALUE2TEXTBOX) != null) {
Text text = (Text) tableItem.getData(FilterConstants.VALUE2TEXTBOX);
enableAndDisableValue2TextBox(condition.getConditionalOperator(), text);
}
processConditionalOperator(source, conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
}
};
return listener;
}
示例7: modify
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
@Override
public void modify ( final Object element, final String property, final Object value )
{
logger.debug ( "Modify Value: {}:{}:{}", new Object[] { element, property, value } );
final TableItem tableItem = (TableItem)element;
if ( tableItem.getData () instanceof AttributeEntry )
{
final AttributeEntry entry = (AttributeEntry)tableItem.getData ();
if ( property.equals ( "value" ) )
{
entry.setValue ( value.toString () );
}
else if ( property.equals ( "name" ) )
{
entry.setName ( value.toString () );
}
else if ( property.equals ( "value-type" ) )
{
final Integer i = (Integer)value;
final String valueType = WriteAttributesOperationWizardValuePage.this.valueTypeEditor.getItems ()[i];
for ( final ValueType vt : ValueType.values () )
{
if ( vt.label ().equals ( valueType ) )
{
entry.setValueType ( vt );
}
}
}
this.viewer.update ( entry, WriteAttributesOperationWizardValuePage.this.PROPERTIES );
dialogChanged ();
}
}
示例8: gatherIgnoredFactories
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
protected Set<String> gatherIgnoredFactories ()
{
final Set<String> result = new HashSet<String> ();
for ( final TableItem item : this.factoriesViewer.getTable ().getItems () )
{
if ( item.getChecked () )
{
final String data = (String)item.getData ();
result.add ( data );
}
}
return result;
}
示例9: getStepDetails
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
public List<StepDetail> getStepDetails() {
TableItem[] items = table.getItems();
List<StepDetail> details = new ArrayList<StepDetail>();
for (TableItem tableItem : items) {
StepDetail sd = (StepDetail) tableItem.getData();
details.add(sd);
}
return details;
}
示例10: updateModelsAndPathGenerators
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
private void updateModelsAndPathGenerators() {
forceUpdate = true;
tableViewer.setInput(mainFile);
TableItem [] all = table.getItems();
int index=0;
for (TableItem tableItem : all) {
ModelData d = (ModelData) tableItem.getData();
tableItem.setChecked(additionalExecutionContexts[index++].isSelected());
}
for (int i = 0, n = tableViewer.getTable().getColumnCount(); i < n; i++)
tableViewer.getTable().getColumn(i).pack();
}
示例11: validate
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
public String validate() {
TableItem[] items = tableViewer.getTable().getItems();
for (int i = 0; i < items.length; i++) {
TableItem ti = items[i];
if (ti.getChecked()) {
ModelData data = (ModelData) ti.getData();
return data.validatePolicy();
}
}
return null;
}
示例12: getModel
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
public ModelData[] getModel() {
List<ModelData> temp = new ArrayList<ModelData>();
TableItem[] items = tableViewer.getTable().getItems();
for (int i = 0; i < items.length; i++) {
TableItem ti = items[i];
ModelData data = (ModelData) ti.getData();
temp.add(data);
}
ModelData[] ret = new ModelData[temp.size()];
temp.toArray(ret);
return ret;
}
示例13: setProperties
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
private void
setProperties(
ChatParticipant p )
{
for ( TableItem ti: buddy_table.getItems()){
if ( ti.getData() == p ){
setProperties( ti, p );
}
}
}
示例14: getGroupCheckCellProvider
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
private CellLabelProvider getGroupCheckCellProvider(final TableViewer tableViewer, final List<Condition> conditionsList,
final Button btnAddGrp) {
return new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
final TableItem item = (TableItem) cell.getItem();
// DO NOT REMOVE THIS CONDITION. The condition is return to
// prevent multiple updates on single item
if (item.getData("UPDATED3") == null) {
item.setData("UPDATED3", TRUE);
} else {
return;
}
addCheckButtonInTable(tableViewer, item, GROUP_CHECKBOX, GROUP_CHECKBOX_PANE, GROUP_EDITOR, cell.getColumnIndex(),
FilterHelper.INSTANCE.checkButtonListener(tableViewer, conditionsList,btnAddGrp));
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
Button groupButton = (Button) item.getData(GROUP_CHECKBOX);
((TableEditor)groupButton.getData(GROUP_EDITOR)).dispose();
groupButton.dispose();
Composite composite = (Composite)item.getData(GROUP_CHECKBOX_PANE);
composite.dispose();
}
});
}
};
}
示例15: getRemoveButtonCellProvider
import org.eclipse.swt.widgets.TableItem; //導入方法依賴的package包/類
private CellLabelProvider getRemoveButtonCellProvider(final TableViewer tableViewer, final List<Condition> conditionsList,
final Button btnAddGrp, final TreeMap<Integer, List<List<Integer>>> groupSelectionMap, final boolean isRemote) {
return new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
final TableItem item = (TableItem) cell.getItem();
// DO NOT REMOVE THIS CONDITION. The condition is return to
// prevent multiple updates on single item
if (item.getData("UPDATED2") == null) {
item.setData("UPDATED2", TRUE);
} else {
return;
}
if(OSValidator.isMac()){
addButtonInTable(tableViewer, item, REMOVE, REMOVE_BUTTON_PANE, REMOVE_EDITOR, cell.getColumnIndex(),
removeButtonListener(tableViewer, conditionsList, dummyList,groupSelectionMap, btnAddGrp,isRemote),
ImagePathConstant.MAC_DELETE_BUTTON);
}else{
addButtonInTable(tableViewer, item, REMOVE, REMOVE_BUTTON_PANE, REMOVE_EDITOR, cell.getColumnIndex(),
removeButtonListener(tableViewer, conditionsList, dummyList,groupSelectionMap, btnAddGrp,isRemote),
ImagePathConstant.DELETE_BUTTON);
}
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
Button removeButton = (Button) item.getData(REMOVE);
((TableEditor)removeButton.getData(REMOVE_EDITOR)).dispose();
removeButton.dispose();
Composite composite = (Composite)item.getData(REMOVE_BUTTON_PANE);
composite.dispose();
}
});
}
};
}