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


Java OpenEvent.getSelection方法代码示例

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


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

示例1: handleOpen

import org.eclipse.jface.viewers.OpenEvent; //导入方法依赖的package包/类
protected void handleOpen(OpenEvent openEvent) {
	ISelection selection = openEvent.getSelection();
	if (selection instanceof IStructuredSelection) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		for (Iterator<?> i = structuredSelection.iterator(); i.hasNext();) {
			Object selectedObject = i.next();
			if (selectedObject instanceof ReferenceSearchViewTreeNode) {
				ReferenceSearchViewTreeNode treeNode = (ReferenceSearchViewTreeNode) selectedObject;
				Object description = treeNode.getDescription();
				if (description instanceof IReferenceDescription) {
					IReferenceDescription referenceDescription = (IReferenceDescription) description;
					uriEditorOpener.open(referenceDescription.getSourceEObjectUri(),
							referenceDescription.getEReference(), referenceDescription.getIndexInList(), true);
				} else if (description instanceof IResourceDescription) {
					uriEditorOpener.open(((IResourceDescription) description).getURI(), true);
				}
			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:ReferenceSearchViewPage.java

示例2: open

import org.eclipse.jface.viewers.OpenEvent; //导入方法依赖的package包/类
/***********************************************************************
 * Open event on double click
 **********************************************************************/
@Override
public void open(OpenEvent event)
{
	TreeSelection sel = (TreeSelection) event.getSelection();
	try
	{
		ProcedureNode item = (ProcedureNode) sel.getFirstElement();
		// Open procedures only, ignore categories
		String category = item.getProcID();
		if (category == null || category.equals("") || category.equals("CATEGORY"))
		{
			return;
		}
		CommandHelper.execute(OpenProcedure.ID);
	}
	catch (Exception e)
	{
		return;
	}
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:24,代码来源:NavigationView.java

示例3: handleOpen

import org.eclipse.jface.viewers.OpenEvent; //导入方法依赖的package包/类
/**
 * Handles an open event from the viewer. Opens an editor on the selected
 * library.
 * 
 * @param event
 *            the open event
 * @throws IOException
 *             if an I/O error occurs.
 */
protected void handleOpen( OpenEvent event ) throws IOException
{
	IStructuredSelection selection = (IStructuredSelection) event.getSelection( );
	Object element = selection.getFirstElement( );

	if ( element instanceof ResourceEntryWrapper
			&& ( (ResourceEntryWrapper) element ).isFile( ) )
	{
		switch ( ( (ResourceEntryWrapper) element ).getType( ) )
		{
			case ResourceEntryWrapper.RPTDESIGN :
			case ResourceEntryWrapper.LIBRARY :
				File file = null;
				URL url = ( (ResourceEntryWrapper) element ).getURL( );

				if ( ( (ResourceEntryWrapper) element ).getEntry( ) instanceof FragmentResourceEntry )
				{
					file = ResourceAction.convertToFile( Platform.getBundle( IResourceLocator.FRAGMENT_RESOURCE_HOST )
							.getEntry( url.getPath( ) ) );
				}
				else
				{
					file = ResourceAction.convertToFile( url );
				}

				if ( file != null && file.exists( ) && file.isFile( ) )
				{
					if ( ( (ResourceEntryWrapper) element ).getType( ) == ResourceEntryWrapper.LIBRARY )
					{
						ResourceAction.openLibrary( this, file, false );
					}
					else if ( ( (ResourceEntryWrapper) element ).getType( ) == ResourceEntryWrapper.RPTDESIGN )
					{
						ResourceAction.openDesigner( this, file, false );
					}
				}
				else
				{
					if ( ( (ResourceEntryWrapper) element ).getType( ) == ResourceEntryWrapper.LIBRARY )
					{
						if ( MessageDialog.openConfirm( getSite( ).getShell( ),
								Messages.getString( "LibraryNotExist.Dialog.Title" ), //$NON-NLS-1$
								Messages.getString( "LibraryNotExist.Dialog.Message" ) ) ) //$NON-NLS-1$
						{
							refreshRoot( );
						}
					}
					else if ( ( (ResourceEntryWrapper) element ).getType( ) == ResourceEntryWrapper.RPTDESIGN )
					{
						if ( MessageDialog.openConfirm( getSite( ).getShell( ),
								Messages.getString( "DesignerNotExist.Dialog.Title" ), //$NON-NLS-1$
								Messages.getString( "DesignerNotExist.Dialog.Message" ) ) ) //$NON-NLS-1$
						{
							refreshRoot( );
						}
					}
				}
				break;

			case ResourceEntryWrapper.CSS_STYLE_SHEET :
			default :
				break;
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:75,代码来源:LibraryExplorerTreeViewPage.java


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