本文整理汇总了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);
}
}
}
}
}
示例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;
}
}
示例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;
}
}
}