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


Java IStructuredSelection.isEmpty方法代码示例

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


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

示例1: execute

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
protected Object execute(SchemaRegistryView registryView, AvroSchemaEditor editor, ExecutionEvent event) {
	
	IStructuredSelection selection = (IStructuredSelection) registryView.getSelection();
	
	if (!selection.isEmpty()) {
		Object element = selection.getFirstElement();
		if (element instanceof AvroNode) {
			AvroNode node = (AvroNode) element;
			SchemaViewer masterViewer = editor.getContentPart().getSchemaViewer(AvroContext.Kind.MASTER);
			masterViewer.setSelection(new StructuredSelection(node));
			masterViewer.reveal(node);
		}
	}
	
	return null;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:18,代码来源:ShowInEditorHandler.java

示例2: updateButtonAvailability

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
/**
 * Updates the modify buttons' enabled state based on the current selection.
 */
private void updateButtonAvailability() {
	final IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
	final boolean hasSelection = !selection.isEmpty();
	final boolean hasSingleSelection = selection.size() == 1;

	if (manager instanceof MutableWorkingSetManager) {
		removeButton.setEnabled(hasSelection && containsNoBuiltInWorkingSets(selection));
		editButton.setEnabled(hasSingleSelection && containsNoBuiltInWorkingSets(selection));
	}
	if (upButton != null) {
		upButton.setEnabled(canMoveUp());
	}
	if (downButton != null) {
		downButton.setEnabled(canMoveDown());
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:WorkingSetConfigurationDialog.java

示例3: updateSelection

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public boolean updateSelection(IStructuredSelection selection) {
	if (selection == null || selection.isEmpty()) {
		return false;
	}

	final Object[] selectedElements = selection.toArray();
	final IProject[] selectedProjects = Arrays2.filter(selectedElements, IProject.class);

	// only enable this action for project-only selections
	if (selectedElements.length != selectedProjects.length) {
		return false;
	}

	// also check whether the active manager is {@link ManualAssociationAwareWorkingSetManager}
	if (!(broker.getActiveManager() instanceof ManualAssociationAwareWorkingSetManager)) {
		return false;
	} else {
		return true;
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:AssignWorkingSetsAction.java

示例4: updateSelection

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
@VisibleForTesting
public boolean updateSelection(IStructuredSelection selection) {
	if (selection == null || selection.isEmpty()) {
		return false;
	}

	final Object[] selectionElements = selection.toArray();
	final WorkingSet[] selectedWorkingSets = Arrays2.filter(selectionElements, WorkingSet.class);

	if (selectionElements.length != selectedWorkingSets.length) {
		return false;
	}

	final WorkingSetManager manager = selectedWorkingSets[0].getWorkingSetManager();
	// Cannot hide all working sets.
	return manager.getWorkingSets().length > selectedWorkingSets.length;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:HideWorkingSetAction.java

示例5: updateToolbarOnSelectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
protected void updateToolbarOnSelectionChanged(ISelection selection) {
	IStructuredSelection sel = (IStructuredSelection) selection;
	NSNode selectedNode = null;
	if (sel.isEmpty()) {
		selectedNode = schemaRegistry.getNameSpaceTree();
	} else {
		Object element = sel.getFirstElement();
		if (element instanceof NSNode) {
			selectedNode = (NSNode) element;
		}
	}		
	for (NameSpaceAction action : actions) {
		action.setNSNode(selectedNode);				
	}
	toolbarMgr.update(true);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:17,代码来源:SchemaRegistryView.java

示例6: getItems

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
/**
 * Get all items from the selection
 *
 * @return a data of all selected items
 */
protected Collection<Item> getItems ()
{
    final Collection<Item> result = new LinkedList<Item> ();

    final IStructuredSelection sel = getSelection ();

    if ( sel != null && !sel.isEmpty () )
    {
        for ( final Iterator<?> i = sel.iterator (); i.hasNext (); )
        {
            final Object o = i.next ();

            final Item holder = AdapterHelper.adapt ( o, Item.class );
            if ( holder != null )
            {
                result.add ( holder );
            }
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:AbstractItemHandler.java

示例7: getItems

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
protected Collection<ItemWrapper> getItems ()
{
    final Collection<ItemWrapper> result = new LinkedList<ItemWrapper> ();

    final IStructuredSelection sel = getSelection ();

    if ( sel != null && !sel.isEmpty () )
    {
        for ( final Iterator<?> i = sel.iterator (); i.hasNext (); )
        {
            final Object o = i.next ();

            final ItemWrapper item = AdapterHelper.adapt ( o, ItemWrapper.class );
            if ( item != null )
            {
                result.add ( item );
            }
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:23,代码来源:CreateQueryHandler.java

示例8: getQueries

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
protected Collection<QueryBuffer> getQueries ()
{
    final Collection<QueryBuffer> result = new LinkedList<QueryBuffer> ();

    final IStructuredSelection sel = getSelection ();

    if ( sel != null && !sel.isEmpty () )
    {
        for ( final Iterator<?> i = sel.iterator (); i.hasNext (); )
        {
            final Object o = i.next ();

            final QueryBuffer item = AdapterHelper.adapt ( o, QueryBuffer.class );
            if ( item != null )
            {
                result.add ( item );
            }
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:23,代码来源:AbstractQueryHandler.java

示例9: getSelectedSchemaNode

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
protected SchemaNode getSelectedSchemaNode(SchemaViewer viewer, AvroContext context) {
	IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
	if (!selection.isEmpty() && selection.size() == 1) {
		AvroNode node = (AvroNode) selection.getFirstElement();
		SchemaNodeRegistry schemaNodeRegistry = context.getSchemaNodeRegistry();
		SchemaViewerNodeConverter converter = new SchemaViewerNodeConverter(schemaNodeRegistry);
		return converter.convertToSchemaNode(node);
	}
	return null;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:11,代码来源:ContextualHandler.java

示例10: init

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void init(final IWorkbench workbench, final IStructuredSelection selection) {
	if (selection != null && !selection.isEmpty()) {
		final Object firstElement = selection.getFirstElement();
		if (firstElement instanceof WorkingSet) {
			editedWorkingSet = (WorkingSet) firstElement;
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:WorkingSetEditWizard.java

示例11: doExecute

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
protected void doExecute(ExecutionEvent event, AvroSchemaEditor schemaEditor, AvroContext context) {

	SchemaViewer schemaViewer = schemaEditor.getContentPart().getSchemaViewer(context.getKind());
	IStructuredSelection selection = (IStructuredSelection) schemaViewer.getSelection();
	
	if (!selection.isEmpty() && selection.size() == 1) {
		AvroNode node = (AvroNode) selection.getFirstElement();
		if (isNavigableNode(node)) {
			schemaViewer.setContent(node);
		}
	}
	
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:15,代码来源:NavigateInHandler.java

示例12: fillContextMenu

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
private void fillContextMenu(IMenuManager manager) {

        IStructuredSelection structuredSelection = (IStructuredSelection) _TreeViewer.getSelection();

        boolean emptySelection = structuredSelection == null || structuredSelection.isEmpty();

        manager.add(_NewJmxConnectionAction);

        if (emptySelection) {
            return;
        }

        manager.add(new Separator());
        manager.add(_OpenAction);
        manager.add(new Separator());

        if (_DeleteAction.isEnabled()) {
            manager.add(_DeleteAction);
            manager.add(new Separator());
        }

        manager.add(_RefreshAction);
        manager.add(new Separator());

        _DrillDownAdapter.addNavigationActions(manager);

        // Other plug-ins can contribute there actions here
        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    }
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:30,代码来源:JmxExplorerView.java

示例13: dragStart

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void dragStart ( final DragSourceEvent event )
{
    event.doit = false;

    if ( ! ( this.viewer.getSelection () instanceof IStructuredSelection ) )
    {
        return;
    }

    final IStructuredSelection selection = (IStructuredSelection)this.viewer.getSelection ();
    if ( selection.isEmpty () )
    {
        return;
    }

    for ( final Iterator<?> i = selection.iterator (); i.hasNext (); )
    {
        final Object o = i.next ();
        if ( ! ( o instanceof ListEntry ) )
        {
            return;
        }
    }

    LocalSelectionTransfer.getTransfer ().setSelection ( this.viewer.getSelection () );

    event.doit = true;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:30,代码来源:RealtimeListDragSourceListener.java

示例14: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void selectionChanged(SelectionChangedEvent event) {
    IStructuredSelection sel = (IStructuredSelection) cmbDbNames.getSelection();
    if (sel.isEmpty()) {
        return;
    }
    Object selected = sel.getFirstElement();

    boolean revertSelection;
    if (selected instanceof DbInfo || selected instanceof File) {
        previous = sel;
        revertSelection = false;
    } else if (selected instanceof LoadFileElement) {
        LoadFileElement loadEl = (LoadFileElement) selected;
        File dumpFile = chooseDbSource(getShell(), prefStore, loadEl.loadDir);
        if (dumpFile != null) {
            loadStore(new StructuredSelection(dumpFile));
            revertSelection = false;
        } else {
            revertSelection = true;
        }
    } else {
        // string or some other "unselectable" selection
        revertSelection = true;
    }

    if (revertSelection) {
        cmbDbNames.setSelection(previous);
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:31,代码来源:DbStorePicker.java

示例15: getCurrentNodeConfig

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
private NodeImageConfig getCurrentNodeConfig(){
	IStructuredSelection selection=(IStructuredSelection)tableViewer.getSelection();
	if(selection.isEmpty()){
		MessageDialog.openError(getShell(), "操作错误", "请先选中一个要操作的节点!");
		return null;
	}
	return (NodeImageConfig)selection.getFirstElement();
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:9,代码来源:DesignerPreferencePage.java


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