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