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


Java Item.setData方法代码示例

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


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

示例1: addPage

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

示例2: 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

示例3: doUpdateItem

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
	boolean oldBusy = isBusy();
	setBusy(true);
	try {
		if (widget instanceof Item) {
			Item item = (Item) widget;

			// ensure that back pointer is correct
			if (fullMap) {
				associate(element, item);
			} else {
				Object data = item.getData();
				if (data != null) {
					unmapElement(data, item);
				}
				item.setData(element);
				mapElement(element, item);
			}

			// update icon and label
			SafeRunnable.run(new UpdateItemSafeRunnable(item, element));
		}
	} finally {
		setBusy(oldBusy);
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:27,代码来源:AbstractTreeViewer.java

示例4: 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

示例5: 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

示例6: disassociate

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
/**
 * Disassociates the given SWT item from its corresponding element. Sets the
 * item's data to <code>null</code> and removes the element from the element
 * map (if enabled).
 * 
 * @param item
 *            the widget
 */
protected void disassociate(Item item) {
	if (associateListener != null)
		associateListener.disassociate(item);
	Object element = item.getData();
	Assert.isNotNull(element);
	// Clear the map before we clear the data
	unmapElement(element, item);
	item.setData(null);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:18,代码来源:StructuredViewer.java

示例7: 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

示例8: doUpdateItem

import org.eclipse.swt.widgets.Item; //导入方法依赖的package包/类
protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
	boolean oldBusy = isBusy();
	setBusy(true);
	try {
		if (widget instanceof Item) {
			final Item item = (Item) widget;

			// remember element we are showing
			if (fullMap) {
				associate(element, item);
			} else {
				Object data = item.getData();
				if (data != null) {
					unmapElement(data, item);
				}
				item.setData(element);
				mapElement(element, item);
			}

			int columnCount = doGetColumnCount();
			if (columnCount == 0)
				columnCount = 1;// If there are no columns do the first one

			ViewerRow viewerRowFromItem = getViewerRowFromItem(item);

			boolean isVirtual = (getControl().getStyle() & SWT.VIRTUAL) != 0;

			// If the control is virtual, we cannot use the cached viewer row object. See bug 188663.
			if (isVirtual) {
				viewerRowFromItem = (ViewerRow) viewerRowFromItem.clone();
			}

			// Also enter loop if no columns added. See 1G9WWGZ: JFUIF:WINNT -
			// TableViewer with 0 columns does not work
			for (int column = 0; column < columnCount || column == 0; column++) {
				ViewerColumn columnViewer = getViewerColumn(column);
				ViewerCell cellToUpdate = updateCell(viewerRowFromItem,
						column, element);

				// If the control is virtual, we cannot use the cached cell object. See bug 188663.
				if (isVirtual) {
					cellToUpdate = new ViewerCell(cellToUpdate.getViewerRow(), cellToUpdate.getColumnIndex(), element);
				}

				columnViewer.refresh(cellToUpdate);

				// clear cell (see bug 201280)
				updateCell(null, 0, null);

				// As it is possible for user code to run the event
				// loop check here.
				if (item.isDisposed()) {
					unmapElement(element, item);
					return;
				}

			}

		}
	} finally {
		setBusy(oldBusy);
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:64,代码来源:AbstractTableViewer.java


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