protected void useItem ( final Item item )
{
if ( this.label != null )
{
item.setText ( this.label );
}
item.setImage ( getEmptyImage () );
this.blinker = new StyleBlinker () {
@Override
public void update ( final CurrentStyle currentStyle )
{
if ( !item.isDisposed () )
{
updateItem ( item, currentStyle );
}
}
};
this.styler = new StateStyler ( this.blinker );
this.styler.style ( new SummaryStateInformation ( this.summaryInformation ) );
}
java类org.eclipse.swt.widgets.Item的实例源码
BaseFolderImplementation.java 文件源码
项目:neoscada
阅读 39
收藏 0
点赞 0
评论 0
ArrayEditorCellModifier.java 文件源码
项目:convertigo-eclipse
阅读 34
收藏 0
点赞 0
评论 0
public Object getValue(Object element, String property) {
int columnIndex = Arrays.asList(tableViewer.getColumnProperties()).indexOf(property);
CellEditor[] cellEditors = tableViewer.getCellEditors();
CellEditor cellEditor = cellEditors[columnIndex];
boolean isComboBoxEditor = cellEditor instanceof ComboBoxCellEditor;
if (element instanceof Item) {
element = ((Item) element).getData();
}
ArrayEditorRow row = (ArrayEditorRow) element;
Object object = row.getValue(columnIndex);
if (isComboBoxEditor) {
int index = Arrays.asList(((ComboBoxCellEditor)cellEditor).getItems()).indexOf(object.toString());
object = new Integer(index);
}
return object;
}
TableEditorCellModifier.java 文件源码
项目:convertigo-eclipse
阅读 26
收藏 0
点赞 0
评论 0
public Object getValue(Object element, String property) {
int columnIndex = Arrays.asList(tableViewer.getColumnProperties()).indexOf(property);
CellEditor[] cellEditors = tableViewer.getCellEditors();
CellEditor cellEditor = cellEditors[columnIndex];
boolean isComboBoxEditor = cellEditor instanceof ComboBoxCellEditor;
boolean isTextCellEditor = cellEditor instanceof TextCellEditor;
if (element instanceof Item) {
element = ((Item) element).getData();
}
TableEditorRow row = (TableEditorRow) element;
Object object = row.getValue(columnIndex);
if (isComboBoxEditor) {
int index = Arrays.asList(((ComboBoxCellEditor)cellEditor).getItems()).indexOf(object.toString());
object = new Integer(index);
}
if (isTextCellEditor && (!(object instanceof String))) {
object = object.toString();
}
return object;
}
CheckedTreeViewer.java 文件源码
项目:pgcodekeeper
阅读 27
收藏 0
点赞 0
评论 0
/**
* Updates the check state of all created children
*/
private void updateChildrenItems(TreeItem parent) {
boolean state = parent.getChecked();
// do not implicitly check children, only uncheck
if(state) {
return;
}
Item[] children = getChildren(parent);
for (int i = 0; i < children.length; i++) {
TreeItem curr = (TreeItem) children[i];
if (curr.getData() != null
&& ((curr.getChecked() != state) || curr.getGrayed())) {
curr.setChecked(state);
curr.setGrayed(false);
updateChildrenItems(curr);
}
}
}
CheckedTreeViewer.java 文件源码
项目:pgcodekeeper
阅读 33
收藏 0
点赞 0
评论 0
/**
* Updates the check / gray state of all parent items
*/
private void updateParentItems(TreeItem item) {
if (item != null) {
Item[] children = getChildren(item);
boolean containsChecked = false;
boolean containsUnchecked = false;
for (int i = 0; i < children.length; i++) {
TreeItem curr = (TreeItem) children[i];
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
updateParentItems(item.getParentItem());
}
}
CheckedTreeViewer.java 文件源码
项目:pgcodekeeper
阅读 29
收藏 0
点赞 0
评论 0
@Override
public Object[] getCheckedElements() {
Object[] checked = super.getCheckedElements();
// add all items that are children of a checked node but not created yet
ArrayList<Object> result = new ArrayList<>();
for (int i = 0; i < checked.length; i++) {
Object curr = checked[i];
result.add(curr);
Widget item = findItem(curr);
if (item != null) {
Item[] children = getChildren(item);
// check if contains the dummy node
if (children.length == 1 && children[0].getData() == null) {
// not yet created
collectChildren(curr, result);
}
}
}
return result.toArray();
}
TransformMappingOutputTableCellModifier.java 文件源码
项目:Hydrograph
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
{
element = ((Item) element).getData();
}
FilterProperties filterProperties = (FilterProperties) element;
int indexOfSelectedField= transformDialog.getATMapping().getOutputFieldList().indexOf(filterProperties);
filterProperties.setPropertyname((String )value);
if(indexOfSelectedField==-1)
transformDialog.getATMapping().getOutputFieldList().add(filterProperties);
transformDialog.refreshOutputTable();
transformDialog.showHideValidationMessage();
viewer.refresh();
}
SecondaryColumnKeysWidgetCellModifier.java 文件源码
项目:Hydrograph
阅读 26
收藏 0
点赞 0
评论 0
/**
* Modifies the element
*
* @param element
* the element
* @param property
* the property
* @param value
* the value
*/
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
element = ((Item) element).getData();
SecondaryColumnKeysInformation p = (SecondaryColumnKeysInformation) element;
if (COLUMNNAME.equals(property)){
if(ParameterUtil.isParameter((String)value)){
p.setSortOrder(Constants.NONE_SORT_ORDER);
}
p.setColumnName(((String) value));
}else if (SORTORDER.equals(property)){
if(!ParameterUtil.isParameter(p.getColumnName()) && !Constants.NONE_SORT_ORDER.equals((String) value)){
p.setSortOrder((String) value);
}else
p.setSortOrder(Constants.ASCENDING_SORT_ORDER);
}
// Force the viewer to refresh
viewer.refresh();
}
LookupCellModifier.java 文件源码
项目:Hydrograph
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
element = ((Item) element).getData();
LookupMapProperty mapp = (LookupMapProperty) element;
if (ELTLookupMapWizard.PROPERTY_NAME.equals(property)){
if(ParameterUtil.isParameter((String)value)){
mapp.setOutput_Field((String)value);
}
mapp.setSource_Field((String)value);
}
if (ELTLookupMapWizard.PROPERTY_VALUE.equals(property)){
if(ParameterUtil.isParameter((String)value)){
mapp.setSource_Field((String)value);
}
mapp.setOutput_Field((String)value);
}
viewer.refresh();
}
CommonStructureControl.java 文件源码
项目:team-explorer-everywhere
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void modify(final Object element, final String property, final Object value) {
final CSSNode node = (CSSNode) (element instanceof Item ? ((Item) element).getData() : element);
if (node.getURI().length() == 0) {
// this is a new node.
if (value == null || value.toString() == null || value.toString().trim().length() == 0) {
// No name provided - remove the new node.
final CSSNode parent = node.getParentNode();
parent.removeChildNode(node);
cssControl.getTreeViewer().setSelection(new StructuredSelection(parent));
cssControl.getTreeViewer().refresh(parent);
return;
}
cssControl.newNode(node, value.toString().trim());
} else {
// Renaming a node
if (value == null || value.toString() == null || value.toString().trim().length() == 0) {
return;
}
cssControl.renameNode(node, value.toString().trim());
}
}
PolicyConfigurationTable.java 文件源码
项目:team-explorer-everywhere
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void modify(final Object element, final String property, final Object value) {
final PolicyConfiguration policyConfiguration =
(PolicyConfiguration) (element instanceof Item ? ((Item) element).getData() : element);
final String sValue = (String) value;
int priority;
try {
priority = Integer.parseInt(sValue);
} catch (final NumberFormatException e) {
return;
}
policyConfiguration.setPriority(priority);
viewer.update(policyConfiguration, new String[] {
property
});
}
RetentionPolicyTableControl.java 文件源码
项目:team-explorer-everywhere
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void modify(final Object element, final String property, final Object value) {
if (KEEP_COL.equals(property) || DELETE_COL.equals(property)) {
IRetentionPolicy policy;
if (element instanceof Item) {
policy = (IRetentionPolicy) ((Item) element).getData();
} else {
policy = (IRetentionPolicy) element;
}
final int selectedIndex = ((Integer) value).intValue();
if (KEEP_COL.equals(property)) {
if (selectedIndex < 0 || values[selectedIndex] < 0) {
return;
}
policy.setNumberToKeep(values[selectedIndex]);
} else {
if (selectedIndex < 0 || deleteValues[selectedIndex] == null) {
return;
}
policy.setDeleteOptions((deleteValues[selectedIndex]));
}
viewer.update(policy, null);
}
}
ContainerCheckedTreeViewer.java 文件源码
项目:subclipse
阅读 24
收藏 0
点赞 0
评论 0
/**
* Updates the check / gray state of all parent items
*/
private void updateParentItems(TreeItem item) {
if (item != null) {
Item[] children= getChildren(item);
boolean containsChecked= false;
boolean containsUnchecked= false;
for (int i= 0; i < children.length; i++) {
TreeItem curr= (TreeItem) children[i];
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
updateParentItems(item.getParentItem());
}
}
ContainerCheckedTreeViewer.java 文件源码
项目:subclipse
阅读 41
收藏 0
点赞 0
评论 0
public Object[] getCheckedElements() {
Object[] checked= super.getCheckedElements();
// add all items that are children of a checked node but not created yet
ArrayList result= new ArrayList();
for (int i= 0; i < checked.length; i++) {
Object curr= checked[i];
result.add(curr);
Widget item= findItem(curr);
if (item != null) {
Item[] children= getChildren(item);
// check if contains the dummy node
if (children.length == 1 && children[0].getData() == null) {
// not yet created
collectChildren(curr, result);
}
}
}
return result.toArray();
}
ValidPreferenceCheckedTreeViewer.java 文件源码
项目:dsl-devkit
阅读 23
收藏 0
点赞 0
评论 0
/**
* Update the parent and children nodes after a checkstate change (e.g. recalculation of the grayed state, automatic
* checking/unchecking of children)
*
* @param element
* the element that was checked/unchecked
*/
protected void doCheckStateChanged(final Object element) {
final Widget item = findItem(element);
if (item instanceof TreeItem) {
final TreeItem treeItem = (TreeItem) item;
updateChildrenItems(treeItem);
final Item[] children = getChildren(item);
if (children.length > 0) {
boolean containsChecked = false;
boolean containsUnchecked = false;
for (final Item element2 : children) {
final TreeItem curr = (TreeItem) element2;
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
treeItem.setChecked(containsChecked);
treeItem.setGrayed(containsChecked && containsUnchecked);
}
updateParentItems(treeItem.getParentItem());
}
}
ValidPreferenceCheckedTreeViewer.java 文件源码
项目:dsl-devkit
阅读 25
收藏 0
点赞 0
评论 0
/**
* Updates the check / gray state of all parent items.
*
* @param item
* the item
*/
private void updateParentItems(final TreeItem item) {
if (item != null) {
final Item[] children = getChildren(item);
boolean containsChecked = false;
boolean containsUnchecked = false;
for (final Item element : children) {
final TreeItem curr = (TreeItem) element;
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
updateParentItems(item.getParentItem());
}
}
ValidPreferenceCheckedTreeViewer.java 文件源码
项目:dsl-devkit
阅读 22
收藏 0
点赞 0
评论 0
/** {@inheritDoc} */
@Override
public Object[] getCheckedElements() {
final Object[] checked = super.getCheckedElements();
// add all items that are children of a checked node but not created yet
final ArrayList<Object> result = new ArrayList<Object>();
for (final Object curr : checked) {
result.add(curr);
final Widget item = findItem(curr);
if (item != null) {
final Item[] children = getChildren(item);
// check if contains the dummy node
if (children.length == 1 && children[0].getData() == null) {
// not yet created
collectChildren(curr, result);
}
}
}
return result.toArray();
}
TreeItemUtil.java 文件源码
项目:NEXCORE-UML-Modeler
阅读 36
收藏 0
点赞 0
评论 0
/**
* getExpandTreePaths
*
* @param tree
* @param selectedItem
* @return TreePath[]
*/
public static TreePath[] getExpandTreePaths(Tree tree, TreeItem selectedItem) {
ArrayList<Object> items = new ArrayList<Object>();
internalCollectTreeItems(items, tree);
ArrayList<Object> result = new ArrayList<Object>();
for (Iterator<Object> it = items.iterator(); it.hasNext();) {
Item item = (Item) it.next();
// if (item == selectedItem) {
TreePath treePath = getTreePathFromItem(item);
if (treePath != null) {
result.add(treePath);
}
// }
}
return (TreePath[]) result.toArray(new TreePath[items.size()]);
}
TreeItemUtil.java 文件源码
项目:NEXCORE-UML-Modeler
阅读 32
收藏 0
点赞 0
评论 0
/**
* internalExpandTreeItems
*
* @param result
* @param o void
*/
private static void internalExpandTreeItems(List<Object> result, Widget o) {
Item[] items = getChildren(o);
for (int i = 0; i < items.length; i++) {
Item item = items[i];
if (item instanceof TreeItem) {
if (((TreeItem) item).getExpanded()) {
// Object obj = item.getData();
// if (obj instanceof ITreeNode || obj instanceof IFolder) {
// result.add(item);
// }
result.add(item);
internalExpandTreeItems(result, item);
}
}
}
}
GalleryTreeViewer.java 文件源码
项目:PDFReporter-Studio
阅读 34
收藏 0
点赞 0
评论 0
protected Item[] getSelection(Control control) {
Item[] selection = ((Gallery) control).getSelection();
if (selection == null) {
return new GalleryItem[0];
}
List<Item> notDisposed = new ArrayList<Item>(selection.length);
for (int i = 0; i < selection.length; i++) {
if (!selection[i].isDisposed()) {
notDisposed.add(selection[i]);
} else {
System.out.println("GalleryItem was disposed (ignoring)");
}
}
selection = (GalleryItem[]) notDisposed.toArray(new GalleryItem[notDisposed.size()]);
return selection;
}
Gallery.java 文件源码
项目:PDFReporter-Studio
阅读 40
收藏 0
点赞 0
评论 0
/**
* Send SWT.PaintItem for one item.
*
* @param item
* @param index
* @param gc
* @param x
* @param y
*/
protected void sendPaintItemEvent(Item item, int index, GC gc, int x,
int y, int width, int height) {
Event e = new Event();
e.item = item;
e.type = SWT.PaintItem;
e.index = index;
// TODO: Does clipping need to be set ?
// gc.setClipping(x, y, width, height);
e.gc = gc;
e.x = x;
e.y = y;
e.width = width;
e.height = height;
this.notifyListeners(SWT.PaintItem, e);
}
MultiPageToolbarEditorPart.java 文件源码
项目:PDFReporter-Studio
阅读 48
收藏 0
点赞 0
评论 0
/**
* Creates and adds a new page containing the given editor to this multi-page editor. The page is added at the given
* index. This also hooks a property change listener on the nested editor.
*
* @param index
* the index at which to add the page (0-based)
* @param editor
* the nested editor
* @param input
* the input for the nested editor
* @exception PartInitException
* if a new page could not be created
*
*/
public void addPage(int index, IEditorPart editor, IEditorInput input) throws PartInitException {
IEditorSite site = createSite(editor);
// call init first so that if an exception is thrown, we have created no
// new widgets
editor.init(site, input);
Composite parent2 = new Composite(getContainer(), getOrientation(editor));
parent2.setLayout(new FillLayout());
editor.createPartControl(parent2);
editor.addPropertyListener(new IPropertyListener() {
public void propertyChanged(Object source, int propertyId) {
MultiPageToolbarEditorPart.this.handlePropertyChange(propertyId);
}
});
// create item for page only after createPartControl has succeeded
Item item = createItem(index, parent2);
// remember the editor, as both data on the item, and in the list of
// editors (see field comment)
item.setData(editor);
nestedEditors.add(editor);
}
ContainerCheckedTreeViewer.java 文件源码
项目:APICloud-Studio
阅读 29
收藏 0
点赞 0
评论 0
/**
* Updates the check / gray state of all parent items
*/
private void updateParentItems(TreeItem item) {
if (item != null) {
Item[] children= getChildren(item);
boolean containsChecked= false;
boolean containsUnchecked= false;
for (int i= 0; i < children.length; i++) {
TreeItem curr= (TreeItem) children[i];
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
updateParentItems(item.getParentItem());
}
}
ContainerCheckedTreeViewer.java 文件源码
项目:APICloud-Studio
阅读 22
收藏 0
点赞 0
评论 0
public Object[] getCheckedElements() {
Object[] checked= super.getCheckedElements();
// add all items that are children of a checked node but not created yet
ArrayList result= new ArrayList();
for (int i= 0; i < checked.length; i++) {
Object curr= checked[i];
result.add(curr);
Widget item= findItem(curr);
if (item != null) {
Item[] children= getChildren(item);
// check if contains the dummy node
if (children.length == 1 && children[0].getData() == null) {
// not yet created
collectChildren(curr, result);
}
}
}
return result.toArray();
}
ResourceToItemsMapper.java 文件源码
项目:Eclipse-Postfix-Code-Completion-Juno38
阅读 26
收藏 0
点赞 0
评论 0
/**
* Removes an element from the map.
* @param element The data element
* @param item The table or tree item
*/
public void removeFromMap(Object element, Item item) {
IResource resource= getCorrespondingResource(element);
if (resource != null) {
Object existingMapping= fResourceToItem.get(resource);
if (existingMapping == null) {
return;
} else if (existingMapping instanceof Item) {
fResourceToItem.remove(resource);
} else { // List
@SuppressWarnings("unchecked")
List<Item> list= (List<Item>) existingMapping;
list.remove(item);
if (list.isEmpty()) {
fResourceToItem.remove(list);
releaseList(list);
}
}
}
}
TableTreeViewer.java 文件源码
项目:gef-gwt
阅读 35
收藏 0
点赞 0
评论 0
protected Item newItem(Widget parent, int flags, int ix) {
TableTreeItem item;
if (ix >= 0) {
if (parent instanceof TableTreeItem) {
item = new TableTreeItem((TableTreeItem) parent, flags, ix);
} else {
item = new TableTreeItem((TableTree) parent, flags, ix);
}
} else {
if (parent instanceof TableTreeItem) {
item = new TableTreeItem((TableTreeItem) parent, flags);
} else {
item = new TableTreeItem((TableTree) parent, flags);
}
}
return item;
}
TreeTableViewer.java 文件源码
项目:OpenSPIFe
阅读 40
收藏 0
点赞 0
评论 0
@Override
protected Item newItem(Widget parent, int flags, int ix) {
TreeItem item;
if (ix >= 0) {
if (parent instanceof TreeItem) {
item = new TreeItem((TreeItem) parent, flags, ix);
} else {
item = new TreeItem((Tree) parent, flags, ix);
}
} else {
if (parent instanceof TreeItem) {
item = new TreeItem((TreeItem) parent, flags);
} else {
item = new TreeItem((Tree) parent, flags);
}
}
return item;
}
TreeTableViewer.java 文件源码
项目:OpenSPIFe
阅读 31
收藏 0
点赞 0
评论 0
@Override
protected void setExpanded(Item node, boolean expand) {
TreeItem item = (TreeItem) node;
boolean pre = item.getExpanded();
item.setExpanded(expand);
/*
* See Eclipse Bugzilla Bug 177378 and JIRA MER-176. In summary, the
* collapseAll() and expandAll() methods filter through this
* setExpanded() method. However, this path through the system does not
* notify listeners of the expansion event. Therefore, we added code to
* notify the listeners if the expansion state changes as a result of a
* programmatic call (user clicks in the tree do notify the listeners
* since those expansions take a different path).
*/
// do not fire the event if the expansion state did not change
if (pre == expand) return;
TreeExpansionEvent e = new TreeExpansionEvent(this, node.getData());
if (expand) fireTreeExpanded (e);
else fireTreeCollapsed(e);
}
TreeTableViewer.java 文件源码
项目:OpenSPIFe
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void run() {
synchronized (elementsBeingUpdated) {
elementsBeingUpdated.removeAll(elementsNeedingUpdates);
}
Tree tree = getTree();
if (tree.isDisposed()) return;
List<TreeItem> selection = Arrays.asList(tree.getSelection());
ViewerComparator comparator = getComparator();
Item[] treeChildren = (comparator != null ? getChildren(tree) : null);
for (O element : elementsNeedingUpdates) {
boolean refreshCalled = handleObjectUpdated(element, selection, treeChildren);
if (refreshCalled) {
break;
}
}
}
ReportItemParametersDialog.java 文件源码
项目:birt
阅读 38
收藏 0
点赞 0
评论 0
/**
* Sets text of Value column
*/
private void updateBindingData( )
{
if ( DEUtil.getDataSetList( reportItemHandle ).size( ) == 0 )
return;
Iterator iterator = reportItemHandle.paramBindingsIterator( );
while ( iterator != null && iterator.hasNext( ) )
{
ParamBindingHandle handle = (ParamBindingHandle) iterator.next( );
String expression = handle.getExpression( );
int rowIndex = this.bindingParametersList.indexOf( handle );
if ( rowIndex != -1 && expression != null )
{
table.getItem( rowIndex ).setText( columnNames.length - 1,
expression );
Item item = table.getItem( rowIndex );
if ( item.getData( Binding ) == null )
item.setData( Binding, handle );
}
}
}