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


Java Item.getData方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Item.getData方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getData方法的具体用法?Java Item.getData怎么用?Java Item.getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Item的用法示例。


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

示例1: updateBindingData

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * 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 );
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:24,代码来源:ReportItemParametersDialog.java

示例2: modify

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
@Override
public void modify(Object element, String property, Object value) {
	if (element instanceof Item) {
		Item item = (Item) element;
		SearchEntry data = (SearchEntry) item.getData();
		if (NAME_PROP.equals(property)) {
			if (!((String) value).equals(data.getSearchName())) {
				data.setSearchName((String) value);
				checkboxTableViewer.update(data, null);
				setDirty(true);
			}
		} else if (URL_PROP.equals(property)) {
			if (!((String) value).equals(data.getSearchUrl())) {
				data.setSearchUrl((String) value);
				checkboxTableViewer.update(data, null);
				setDirty(true);
			}
		}

	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:22,代码来源:WebSearchPreferencePage.java

示例3: associate

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Associates the given element with the given widget. Sets the given item's
 * data to be the element, and maps the element to the item in the element
 * map (if enabled).
 * 
 * @param element
 *            the element
 * @param item
 *            the widget
 */
protected void associate(Object element, Item item) {
	Object data = item.getData();
	if (data != element) {
		if (data != null) {
			disassociate(item);
		}
		item.setData(element);
		mapElement(element, item);
	} else {
		// Always map the element, even if data == element,
		// since unmapAllElements() can leave the map inconsistent
		// See bug 2741 for details.
		mapElement(element, item);
	}
	if (associateListener != null)
		associateListener.associate(element, item);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:28,代码来源:StructuredViewer.java

示例4: applyState

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Applies the checked and grayed states of the given widget and its
 * descendents.
 *
 * @param checked a set of elements (element type: <code>Object</code>) 
 * @param grayed a set of elements (element type: <code>Object</code>) 
 * @param widget the widget
 */
private void applyState(CustomHashtable checked, CustomHashtable grayed,
        Widget widget) {
    Item[] items = getChildren(widget);
    for (int i = 0; i < items.length; i++) {
        Item item = items[i];
        if (item instanceof TreeItem) {
            Object data = item.getData();
            if (data != null) {
                TreeItem ti = (TreeItem) item;
                ti.setChecked(checked.containsKey(data));
                ti.setGrayed(grayed.containsKey(data));
            }
        }
        applyState(checked, grayed, item);
    }
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:25,代码来源:CheckboxTreeViewer.java

示例5: internalFindItem

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Recursively tries to find the given element.
 * 
 * @param parent
 *            the parent item
 * @param element
 *            the element
 * @return Widget
 */
private Widget internalFindItem(Item parent, Object element) {

	// compare with node
	Object data = parent.getData();
	if (data != null) {
		if (equals(data, element)) {
			return parent;
		}
	}
	// recurse over children
	Item[] items = getChildren(parent);
	for (int i = 0; i < items.length; i++) {
		Item item = items[i];
		Widget o = internalFindItem(item, element);
		if (o != null) {
			return o;
		}
	}
	return null;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:30,代码来源:AbstractTreeViewer.java

示例6: update

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
@Override
protected void update(Item item, String newValue) {
	if (item==null) return; 
	String value = (String) item.getData();
	int index = this.folders.indexOf(value);
	if (index==-1) return;
	this.folders.set(index, newValue);
	
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:StringCustomListModel.java

示例7: getTreePathFromItem

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * 
 * @param item
 * @return TreePath
 */
private static TreePath getTreePathFromItem(Item item) {
    LinkedList<Object> segments = new LinkedList<Object>();
    while (item != null) {
        Object segment = item.getData();
        if (segment == null) {
            return null;
        }
        Assert.isNotNull(segment);
        segments.addFirst(segment);
        item = getParentItem(item);
    }
    return new TreePath(segments.toArray());
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:TreeItemUtil.java

示例8: internalCollectTreeItems

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * 
 * @param result
 * @param o
 *            void
 */
private static void internalCollectTreeItems(List<Object> result, Widget o) {
    Item[] items = getChildren(o);
    for (int i = 0; i < items.length; i++) {
        Item item = items[i];
        Object obj = item.getData();
        if (obj instanceof UMLTreeNode || obj instanceof UMLFileTreeNode || obj instanceof IFolder) {
            result.add(item);
        }
        internalCollectTreeItems(result, item);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:18,代码来源:TreeItemUtil.java

示例9: getEditor

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Returns the editor for the given page index. The page index must be valid.
 * 
 * @param pageIndex
 *          the index of the page
 * @return the editor for the specified page, or <code>null</code> if the specified page was not created with
 *         <code>addPage(IEditorPart,IEditorInput)</code>
 */
protected IEditorPart getEditor(int pageIndex) {
	Item item = getItem(pageIndex);
	if (item != null) {
		Object data = item.getData();
		if (data instanceof IEditorPart) {
			return (IEditorPart) data;
		}
	}
	return null;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:MultiPageToolbarEditorPart.java

示例10: getPageSite

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Returns the service locator for the given page index. This method can be used to create service locators for pages
 * that are just controls. The page index must be valid.
 * <p>
 * This will return the editor site service locator for an editor, and create one for a page that is just a control.
 * </p>
 * 
 * @param pageIndex
 *          the index of the page
 * @return the editor for the specified page, or <code>null</code> if the specified page was not created with
 *         <code>addPage(IEditorPart,IEditorInput)</code>
 * @since 3.4
 */
protected final IServiceLocator getPageSite(int pageIndex) {
	if (pageIndex == PAGE_CONTAINER_SITE) {
		return getPageContainerSite();
	}

	Item item = getItem(pageIndex);
	if (item != null) {
		Object data = item.getData();
		if (data instanceof IEditorPart) {
			return ((IEditorPart) data).getSite();
		} else if (data instanceof IServiceLocator) {
			return (IServiceLocator) data;
		} else if (data == null) {
			IServiceLocatorCreator slc = (IServiceLocatorCreator) getSite().getService(IServiceLocatorCreator.class);
			IServiceLocator sl = slc.createServiceLocator(getSite(), null, new IDisposable() {
				public void dispose() {
					close();
				}
			});
			item.setData(sl);
			pageSites.add(sl);
			return sl;
		}
	}
	return null;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:40,代码来源:MultiPageToolbarEditorPart.java

示例11: setCheckedChildren

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Sets the checked state for the children of the given item.
 *
 * @param item the item
 * @param state <code>true</code> if the item should be checked,
 *  and <code>false</code> if it should be unchecked
 */
private void setCheckedChildren(Item item, boolean state) {
    createChildren(item);
    Item[] items = getChildren(item);
    if (items != null) {
        for (int i = 0; i < items.length; i++) {
            Item it = items[i];
            if (it.getData() != null && (it instanceof TreeItem)) {
                TreeItem treeItem = (TreeItem) it;
                treeItem.setChecked(state);
                setCheckedChildren(treeItem, state);
            }
        }
    }
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:22,代码来源:CheckboxTreeViewer.java

示例12: updatePlus

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
protected void updatePlus(Item item, Object element) {
	if (contentProviderIsLazy) {
		Object data = item.getData();
		int itemCount = 0;
		if (data != null) {
			// item is already materialized
			itemCount = ((TreeItem) item).getItemCount();
		}
		virtualLazyUpdateHasChildren(item, itemCount);
	} else {
		super.updatePlus(item, element);
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:14,代码来源:TreeViewer.java

示例13: internalRemove

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Removes the given elements from this viewer, whenever those elements
 * appear as children of the given parent.
 * 
 * @param parent
 *            the parent element
 * @param elements
 *            the elements to remove
 * @since 3.1
 */
protected void internalRemove(Object parent, Object[] elements) {

	CustomHashtable toRemove = new CustomHashtable(getComparer());
	for (int i = 0; i < elements.length; i++) {
		toRemove.put(elements[i], elements[i]);
	}

	// Find each place the parent appears in the tree
	Widget[] parentItemArray = findItems(parent);
	for (int i = 0; i < parentItemArray.length; i++) {
		Widget parentItem = parentItemArray[i];

		// May happen if parent element is a descendent of of a previously
		// removed element
		if (parentItem.isDisposed())
			continue;

		// Iterate over the child items and remove each one
		Item[] children = getChildren(parentItem);

		if (children.length == 1 && children[0].getData() == null
				&& parentItem instanceof Item) { // dummy node
			// Remove plus if parent element has no children
			updatePlus((Item) parentItem, parent);
		} else {
			for (int j = 0; j < children.length; j++) {
				Item child = children[j];

				Object data = child.getData();
				if (data != null && toRemove.containsKey(data)) {
					disassociate(child);
					child.dispose();
				}
			}
		}
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:48,代码来源:AbstractTreeViewer.java

示例14: internalExpandToLevel

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
@Override
protected void internalExpandToLevel(Widget node, int level) {
	if (node instanceof Item) {
		Item i= (Item) node;
		if (i.getData() instanceof IJavaElement) {
			IJavaElement je= (IJavaElement) i.getData();
			if (je.getElementType() == IJavaElement.IMPORT_CONTAINER || isInnerType(je)) {
				setExpanded(i, false);
		return;
			}
		}
	}
	super.internalExpandToLevel(node, level);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:15,代码来源:JavaOutlinePage.java

示例15: associate

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
protected void associate(Object element, Item item) {
	Object data = item.getData();
	if (data != null && data != element && equals(data, element)) {
		// workaround for PR 1FV62BT
		// assumption: elements are equal but not identical
		// -> remove from map but don't touch children
		unmapElement(data, item);
		item.setData(element);
		mapElement(element, item);
	} else {
		// recursively disassociate all
		super.associate(element, item);
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:15,代码来源:AbstractTreeViewer.java


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