本文整理汇总了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);
}
}
示例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;
}
示例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 );
}
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
}
示例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;
}
示例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);
}
}
}
示例8: refreshSelectedTreeObjects
import org.eclipse.jface.viewers.ISelection; //导入方法依赖的package包/类
public void refreshSelectedTreeObjects() {
ISelection selection = viewer.getSelection();
if(!selection.isEmpty()) viewer.setSelection(selection, false);
}
示例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 ();
}