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


Java ISelection.isEmpty方法代码示例

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


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

示例1: dbBlocksJournalViewSelectionChanged

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
private void dbBlocksJournalViewSelectionChanged(SelectionChangedEvent event) {
    ISelection selection = event.getSelection();
    if (selection.isEmpty()) {
        dbBlocksJournalProcessInfoView.hide();
    } else {
        DBProcess process;
        IStructuredSelection structuredSelection = (IStructuredSelection)selection;
        Object element = structuredSelection.getFirstElement();
        if (element instanceof DBBlocksJournalProcess) {
            DBBlocksJournalProcess blocksJournalProcess = (DBBlocksJournalProcess)element;
            process = blocksJournalProcess.getProcess();
        } else {
            process = (DBProcess)element;
        }
        dbBlocksJournalProcessInfoView.show(process);
    }
}
 
开发者ID:technology16,项目名称:pgsqlblocks,代码行数:18,代码来源:ProcessesController.java

示例2: isSelectionEditable

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
@Override
public boolean isSelectionEditable() {
	ISelection selection = getSelection();
	if (!selection.isEmpty()) {
		Object firstElement = ((StructuredSelection) selection).getFirstElement();
		String nodeId = "";
		if (firstElement instanceof KeyValue) {
			KeyValue keyValue = (KeyValue) firstElement;
			nodeId = keyValue.getParentNode();
		} else {
			nodeId = firstElement.toString();
		}
		return (!nodeId.startsWith("/default/") && (!nodeId.startsWith("/bundle_defaults/")));
	}
	return false;
}
 
开发者ID:32kda,项目名称:com.onpositive.prefeditor,代码行数:17,代码来源:PlatformViewerPage.java

示例3: handleContentOutlineSelection

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
/**
 * This deals with how we want selection in the outliner to affect the other views.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void handleContentOutlineSelection ( ISelection selection )
{
    if ( currentViewerPane != null && !selection.isEmpty () && selection instanceof IStructuredSelection )
    {
        Iterator<?> selectedElements = ( (IStructuredSelection)selection ).iterator ();
        if ( selectedElements.hasNext () )
        {
            // Get the first selected element.
            //
            Object selectedElement = selectedElements.next ();

            // If it's the selection viewer, then we want it to select the same selection as this selection.
            //
            if ( currentViewerPane.getViewer () == selectionViewer )
            {
                ArrayList<Object> selectionList = new ArrayList<Object> ();
                selectionList.add ( selectedElement );
                while ( selectedElements.hasNext () )
                {
                    selectionList.add ( selectedElements.next () );
                }

                // Set the selection to the widget.
                //
                selectionViewer.setSelection ( new StructuredSelection ( selectionList ) );
            }
            else
            {
                // Set the input to the widget.
                //
                if ( currentViewerPane.getViewer ().getInput () != selectedElement )
                {
                    currentViewerPane.getViewer ().setInput ( selectedElement );
                    currentViewerPane.setTitle ( selectedElement );
                }
            }
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:46,代码来源:ProfileEditor.java

示例4: handleContentOutlineSelection

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
/**
 * This deals with how we want selection in the outliner to affect the other views.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void handleContentOutlineSelection(ISelection selection) {
	if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
		Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
		if (selectedElements.hasNext()) {
			// Get the first selected element.
			//
			Object selectedElement = selectedElements.next();

			// If it's the selection viewer, then we want it to select the same selection as this selection.
			//
			if (currentViewerPane.getViewer() == selectionViewer) {
				ArrayList<Object> selectionList = new ArrayList<Object>();
				selectionList.add(selectedElement);
				while (selectedElements.hasNext()) {
					selectionList.add(selectedElements.next());
				}

				// Set the selection to the widget.
				//
				selectionViewer.setSelection(new StructuredSelection(selectionList));
			}
			else {
				// Set the input to the widget.
				//
				if (currentViewerPane.getViewer().getInput() != selectedElement) {
					currentViewerPane.getViewer().setInput(selectedElement);
					currentViewerPane.setTitle(selectedElement);
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:39,代码来源:GexpressionsEditor.java

示例5: handleContentOutlineSelection

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
/**
 * This deals with how we want selection in the outliner to affect the other views.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   public void handleContentOutlineSelection(ISelection selection) {
	if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
		Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
		if (selectedElements.hasNext()) {
			// Get the first selected element.
			//
			Object selectedElement = selectedElements.next();

			// If it's the selection viewer, then we want it to select the same selection as this selection.
			//
			if (currentViewerPane.getViewer() == selectionViewer) {
				ArrayList<Object> selectionList = new ArrayList<Object>();
				selectionList.add(selectedElement);
				while (selectedElements.hasNext()) {
					selectionList.add(selectedElements.next());
				}

				// Set the selection to the widget.
				//
				selectionViewer.setSelection(new StructuredSelection(selectionList));
			}
			else {
				// Set the input to the widget.
				//
				if (currentViewerPane.getViewer().getInput() != selectedElement) {
					currentViewerPane.getViewer().setInput(selectedElement);
					currentViewerPane.setTitle(selectedElement);
				}
			}
		}
	}
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:39,代码来源:SmarthomeEditor.java

示例6: getSelectedTreeObjects

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
public TreeObject[] getSelectedTreeObjects() {
	TreeObject[] treeObjects = null;
	ISelection selection = viewer.getSelection();
	if (!selection.isEmpty()) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		Object[] treeArray = structuredSelection.toArray();
		treeObjects = new TreeObject[structuredSelection.size()];
		for (int i=0; i<treeObjects.length; i++)
			treeObjects[i] = (TreeObject)treeArray[i];
	}
	return treeObjects;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:13,代码来源:ProjectExplorerView.java

示例7: copyValue

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
public void copyValue() {
	String text = null;
	ISelection selection = viewer.getSelection();
	if (!selection.isEmpty()) {
		Object element = ((StructuredSelection) selection).getFirstElement();
		if (element instanceof KeyValue) {
			text = ((KeyValue) element).getValue();
			textToClipboard(text);
		} 
	}
}
 
开发者ID:32kda,项目名称:com.onpositive.prefeditor,代码行数:12,代码来源:ViewerPage.java

示例8: refreshSelectedTreeObjects

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
public void refreshSelectedTreeObjects() {
	ISelection selection = viewer.getSelection();
	if(!selection.isEmpty()) viewer.setSelection(selection, false);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:5,代码来源:ProjectExplorerView.java

示例9: handleDelete

import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
public void handleDelete ()
{
    final ISelection sel = this.viewer.getSelection ();
    if ( sel == null || sel.isEmpty () || ! ( sel instanceof IStructuredSelection ) )
    {
        return;
    }

    final IStructuredSelection selection = (IStructuredSelection)sel;

    final Collection<String> items = new LinkedList<String> ();

    final Iterator<?> i = selection.iterator ();
    while ( i.hasNext () )
    {
        final ConfigurationDescriptor info = (ConfigurationDescriptor)i.next ();
        items.add ( info.getConfigurationInformation ().getId () );
    }

    if ( items.isEmpty () )
    {
        return;
    }

    if ( !MessageDialog.openConfirm ( this.viewer.getControl ().getShell (), "Delete configurations", String.format ( "Delete %s configuration entries", items.size () ) ) )
    {
        return;
    }

    final org.eclipse.core.runtime.jobs.Job job = this.factoryInput.createDeleteJob ( items );
    job.addJobChangeListener ( new JobChangeAdapter () {

        @Override
        public void done ( final IJobChangeEvent event )
        {
            refresh ();
        }

    } );
    job.schedule ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:42,代码来源:FactoryEditor.java


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