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


Java DoubleClickEvent.getSelection方法代码示例

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


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

示例1: getDoubleClickListener

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
private IDoubleClickListener getDoubleClickListener() {
  return new IDoubleClickListener() {
    @Override
    public void doubleClick(final DoubleClickEvent event) {
      final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
      final Object firstElement = selection.getFirstElement();
      if (MarkerPage.markTreeViewer.isExpandable(firstElement)) {
        final boolean expanded = MarkerPage.markTreeViewer.getExpandedState(firstElement);
        MarkerPage.markTreeViewer.setExpandedState(firstElement, !expanded);
      } else {
        MarkerWizard.this.performFinish();
        MarkerWizard.this.getContainer().getShell().close();
      }
    }
  };
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:17,代码来源:MarkerWizard.java

示例2: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
@Override
public void doubleClick(DoubleClickEvent event) {
	final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
	if (selection == null || selection.isEmpty())
		return;
	final Object sel = selection.getFirstElement();

	final ITreeContentProvider provider = (ITreeContentProvider) viewer.getContentProvider();

	if (!provider.hasChildren(sel))
		return;

	if (viewer.getExpandedState(sel))
		viewer.collapseToLevel(sel, AbstractTreeViewer.ALL_LEVELS);
	else
		viewer.expandToLevel(sel, 1);

}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:19,代码来源:ExpandCollapseDoubleClickListener.java

示例3: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
@Override
public void doubleClick(final DoubleClickEvent event) {
  final ISelection selection = event.getSelection();
  if (selection.isEmpty()
      || !(selection instanceof StructuredSelection || ((StructuredSelection) selection).size() != 1)) {
    return;
  }
  final StructuredSelection structuredSelection = (StructuredSelection) selection;
  final Object firstElement = structuredSelection.getFirstElement();
  if ((firstElement instanceof IDependencyRelation)) {
    select(((IDependencyRelation) firstElement).getItem());
    return;
  }
  if ((firstElement instanceof IType)) {
    select(((IType) firstElement));
    return;
  }
}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:19,代码来源:ElementSelectingDoubleClickListener.java

示例4: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
@Override
public void doubleClick(final DoubleClickEvent event) {
    final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
    final Object element = selection.getFirstElement();

    final Shell shell = treeViewer.getControl().getShell();
    final TFSServer server = context.getServer();
    final ProjectInfo projectInfo = context.getCurrentProjectInfo();

    if (element instanceof WSSNode) {
        final WSSNode wssNode = (WSSNode) element;
        WSSHelper.openWSSNode(shell, server, projectInfo, wssNode);
    } else if (element instanceof WSSDocumentLibrary) {
        final WSSDocumentLibrary library = (WSSDocumentLibrary) element;
        WSSHelper.openWSSDocumentLibrary(shell, server, projectInfo, library);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:18,代码来源:TeamExplorerDocumentsSection.java

示例5: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
@Override
public void doubleClick(final DoubleClickEvent event) {
    final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
    final Object element = selection.getFirstElement();

    if (element instanceof QueryFolder) {
        final boolean expanded = treeViewer.getExpandedState(element);
        treeViewer.setExpandedState(element, !expanded);
    } else if (element instanceof QueryDefinition) {
        final Shell shell = treeViewer.getControl().getShell();
        final QueryDefinition queryDefinition = (QueryDefinition) element;
        final StoredQuery storedQuery = WorkItemHelpers.createStoredQueryFromDefinition(queryDefinition);

        WorkItemHelpers.runQuery(shell, context.getServer(), context.getCurrentProject(), storedQuery);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:17,代码来源:TeamExplorerWorkItemsQueriesSection.java

示例6: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
@Override
public void doubleClick(final DoubleClickEvent event) {
    final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
    final Object element = selection.getFirstElement();

    if (element instanceof PendingChangesTreeNode) {
        final PendingChangesTreeNode node = (PendingChangesTreeNode) element;
        final PendingChange pendingChange = node.getPendingChange();

        if (pendingChange != null && pendingChange.getLocalItem() != null) {
            final String localPath = pendingChange.getLocalItem();
            final File file = new File(localPath);

            if (file.exists()) {
                final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                ViewFileHelper.viewLocalFileOrFolder(localPath, page, false);
            }
        }
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:PendingChangesTreeDoubleClickListener.java

示例7: handleDoubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
/**
 * Open on double-click
 */
protected void handleDoubleClick(DoubleClickEvent anEvent)
{
    super.handleDoubleClick(anEvent);
    // open the model
    if (anEvent.getSelection() instanceof IStructuredSelection) {
    	IStructuredSelection iss = (IStructuredSelection) anEvent.getSelection();
    	Object firstElement = iss.getFirstElement();
    	if (firstElement instanceof Module) {
    		final Map<String, String> parameters = new HashMap<String, String>();
    		parameters.put(OpenModuleHandler.PARAM_MODULE, ((Module) firstElement).getModuleName());
UIHelper.runCommand(OpenModuleHandler.COMMAND_ID, parameters);
    	} else if (firstElement instanceof IGroup) {
    		// No-Op
    	} else if (firstElement instanceof Spec && ((Spec) firstElement).isCurrentSpec()) {
    		// No-op, do not re-open an open spec again.
    	} else {
    		UIHelper.runCommand(ToolboxExplorer.COMMAND_ID, new HashMap<String, String>());
    	}
    }
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:24,代码来源:ToolboxExplorer.java

示例8: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
@Override
	public void doubleClick(DoubleClickEvent event) {
//		logger.debug("source = "+e.getSource());
		
		IStructuredSelection selection = (IStructuredSelection) event.getSelection();
		Object el = selection.getFirstElement();
		
		logger.debug("double click on element: "+el);
		if (el instanceof ITrpShapeType) {
	//		ICanvasShape shape = mainWidget.getScene().findShapeWithData(el);
			ICanvasShape shape = GuiUtil.getCanvasShape((ITrpShapeType)el);
			mainWidget.getCanvas().focusShape(shape, true);
		}
		else if (el instanceof TrpPageType) {
			mainWidget.getCanvas().fitToPage();
		}
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:18,代码来源:StructureTreeListener.java

示例9: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
public void doubleClick(DoubleClickEvent event) {
	IStructuredSelection selection = (IStructuredSelection) event
			.getSelection();
	Object firstElement = selection.getFirstElement();
	if (treeViewer.isExpandable(firstElement)) {
		boolean expanded = treeViewer.getExpandedState(firstElement);
		treeViewer.setExpandedState(firstElement, !expanded);
	} else {
		// FIXME :: does not trigger validation
		boolean newState = !treeViewer.getChecked(firstElement);
		treeViewer.setChecked(firstElement, newState);
		if (checkStateListener != null) {
			checkStateListener
					.checkStateChanged(new CheckStateChangedEvent(
							treeViewer, firstElement, newState));
		}
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:TreeExpandingDoubleClickListener.java

示例10: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
@Override
public void doubleClick(final DoubleClickEvent event) {
	// safety check first
	if (event == null || event.getSelection() == null || !(event.getSelection() instanceof TreeSelection)) {
		return;
	}
	final TreeSelection selection = (TreeSelection) event.getSelection();
	final TreePath[] paths = selection.getPaths();
	final TreePath treePath = paths[paths.length - 1];
	final Object segment = treePath.getLastSegment();

	final TreeItem[] items = viewer.getTree().getItems();
	final TreeItem item = getItem(items, segment);
	if (item != null) {
		item.setExpanded(!item.getExpanded());
		viewer.refresh();
	}
}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:19,代码来源:TreeCollapseExpandListener.java

示例11: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
/**
 * The callback function for the double click listener. Finds what was 
 * clicked on, if its a rule show it in the editor (or focus on the already
 * open editor).
 */
/* Override */
public void doubleClick( DoubleClickEvent event )
{
    if( event.getSelection() instanceof TreeSelection ) {
       TreeSelection selected = (TreeSelection) event.getSelection();
       if( selected.getFirstElement() != null ) {
          switch( ((ModelElement) selected.getFirstElement()).getModelType() ) {
             
             case RULE:
                TrafficScriptEditor.openEditorForRule( (Rule) selected.getFirstElement() );
             break;
             
          }
       }
    }
}
 
开发者ID:brocade,项目名称:vTM-eclipse,代码行数:22,代码来源:ZXTMViewInputManager.java

示例12: handleDoubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
/**
 * The mouse has been double-clicked in the tree, perform appropriate
 * behaviour.
 */
private void handleDoubleClick(DoubleClickEvent e) {
    // Only act on single selection
    ISelection selection = e.getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection structured = (IStructuredSelection)selection;
        if (structured.size() == 1) {
            Object first = structured.getFirstElement();
            if (first instanceof ISVNRemoteFile) {
                // It's a file, open it.
                openAction.selectionChanged(null, selection);
                openAction.run(null);
            } else {
                // Try to expand/contract
                treeViewer.setExpandedState(first, !treeViewer.getExpandedState(first));
            }
        }
    } 
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:23,代码来源:RepositoriesView.java

示例13: handleDoubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
/**
 * Handles a double-click event from the viewer.
 * 
 * @param event
 *            the double-click event
 */
protected void handleDoubleClick( DoubleClickEvent event )
{
	IStructuredSelection selection = (IStructuredSelection) event.getSelection( );
	Object element = selection.getFirstElement( );
	TreeViewer viewer = getTreeViewer( );

	if ( element instanceof ResourceEntryWrapper )
	{
		switch ( ( (ResourceEntryWrapper) element ).getType( ) )
		{
			case ResourceEntryWrapper.LIBRARY :
				return;

			case ResourceEntryWrapper.CSS_STYLE_SHEET :
			default :
				break;
		}
	}

	if ( viewer.isExpandable( element ) )
	{
		viewer.setExpandedState( element,
				!viewer.getExpandedState( element ) );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:32,代码来源:LibraryExplorerTreeViewPage.java

示例14: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
public void doubleClick(DoubleClickEvent event)
{
    ISelection selection = event.getSelection();
    
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    
    if (obj instanceof TreeObject)
    {
        Object data = ((TreeObject) obj).getData();
        
        if (data instanceof Openable)
        {
            ((Openable) data).openInEditor();
        }
    }
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:17,代码来源:TreeObjectDoubleClickListener.java

示例15: doubleClick

import org.eclipse.jface.viewers.DoubleClickEvent; //导入方法依赖的package包/类
public void doubleClick(DoubleClickEvent event){
	if (dlListeners != null) {
		Iterator<DoubleClickListener> it = dlListeners.iterator();
		while (it.hasNext()) {
			DoubleClickListener dl = it.next();
			IStructuredSelection sel = (IStructuredSelection) event.getSelection();
			if ((sel != null) && (!sel.isEmpty())) {
				Object element = sel.getFirstElement();
				if (element instanceof Tree<?>) {
					element = ((Tree<?>) element).contents;
				}
				if (element instanceof PersistentObject) {
					dl.doubleClicked((PersistentObject) element, this);
				}
			}
		}
	}
	
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:20,代码来源:CommonViewer.java


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