當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。