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


Java IStructuredSelection.size方法代码示例

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


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

示例1: 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

示例2: isEnabled

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public boolean isEnabled() {
	ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
	if(selection instanceof IStructuredSelection) {
		IStructuredSelection s = (IStructuredSelection) selection;
		if(s.size() == 1) {
			Object e = s.getFirstElement();
			try {
				return e instanceof IProject && ((IProject) e).hasNature("org.eclipse.jdt.internal.core.JavaProject");
			} catch (CoreException e1) {
				return false;
			}
		}
	}
	return false;
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:17,代码来源:NewJavaFileCommand.java

示例3: drop

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void drop(DropTargetEvent event) {
	
	IStructuredSelection structuredSelection = (IStructuredSelection) LocalSelectionTransfer
               .getTransfer().getSelection();
	
	if (structuredSelection.size() == 1) {

		AvroNode sourceNode = (AvroNode) structuredSelection.getFirstElement();
		TreeItem item = (TreeItem) event.item;
		if (item != null) {
			AvroNode targetNode = nodeConverter.convertToAvroNode(item.getData());
			dropPolicy.drop(sourceNode, targetNode, position);
		}
		
	}
	
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:19,代码来源:DnDTargetListener.java

示例4: isMultiApplyAttempt

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
/**
 * Returns true iff the user is trying to apply quick fixes to multiple issues / markers at once.
 * <p>
 * Implementation note: this method assumes that the entire code of class MarkerResolutionGenerator is only invoked
 * if quick fixes are initiated via the Problems view (not if they are initiated from within the editor). Therefore,
 * this method simply checks whether the Problems view contains a selection of multiple, i.e. two or more, elements.
 */
private boolean isMultiApplyAttempt() {
	if (workbench == null)
		return false;
	try {
		// get the current selection in the problems view
		final ISelectionService service = workbench.getActiveWorkbenchWindow().getSelectionService();
		final IStructuredSelection sel = (IStructuredSelection) service.getSelection(IPageLayout.ID_PROBLEM_VIEW);
		return sel != null && sel.size() >= 2;
	} catch (Exception e) {
		return false;
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:N4JSMarkerResolutionGenerator.java

示例5: canEnable

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
private boolean canEnable(final IStructuredSelection sel) {
	if (sel.size() == 0) {
		return true;
	}

	final List<?> list = sel.toList();
	for (final Iterator<?> iterator = list.iterator(); iterator.hasNext(); /**/) {
		if (!isNewTarget(iterator.next())) {
			return false;
		}
	}

	return true;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:N4JSNewWizardsActionGroup.java

示例6: getSingleSelectedEntry

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
protected ListEntry getSingleSelectedEntry() {
	final IStructuredSelection sel = (IStructuredSelection) listViewer.getSelection();
	final Object obj = sel.size() == 1 ? sel.getFirstElement() : null;
	if (obj instanceof ListEntry)
		return (ListEntry) obj;
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:GraphList.java

示例7: getSingleSelectedEntry

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
/** returns currently selected entry or null */
protected VisualisationSnapshot getSingleSelectedEntry() {
	final IStructuredSelection sel = (IStructuredSelection) listViewer.getSelection();
	final Object obj = sel.size() == 1 ? sel.getFirstElement() : null;
	if (obj instanceof VisualisationSnapshot)
		return (VisualisationSnapshot) obj;
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:DashboardComposite.java

示例8: getSelectedTreeObjects

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的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

示例9: getObject

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private Object getObject(Object objects, boolean multiple[]) {
	Object object = null;
	if (objects instanceof IStructuredSelection) {
		IStructuredSelection selection = (IStructuredSelection) objects;
		object = selection.getFirstElement();
		if (selection.size() == 1) {
			multiple[0] = false;
			return object;
		}
		multiple[0] = true;
		Class firstClass = typeMapper.mapType(object);
		if (selection.size() > 1) {
			for (Iterator i = selection.iterator(); i.hasNext();) {
				Object next = i.next();
				Class nextClass = typeMapper.mapType(next);
				if (!nextClass.equals(firstClass)) {
					multiple[0] = false;
					object = null;
					break;
				}
			}
		}
	} else {
		multiple[0] = false;
		object = objects;
	}
	return object;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:30,代码来源:BaseModelLabelProvider.java

示例10: initialize

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
/**
 * Tests if the current workbench selection is a suitable container to use.
 */

private void initialize() {
	if (selection != null && selection.isEmpty() == false
			&& selection instanceof IStructuredSelection) {
		IStructuredSelection ssel = (IStructuredSelection) selection;
		if (ssel.size() > 1)
			return;
		Object obj = ssel.getFirstElement();
	}
	fileText.setText("Example.java");
	fileText.setSelection(0, "Example.java".length()-".java".length());
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:16,代码来源:NewFileWizardPage.java

示例11: initialize

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
/**
 * Tests if the current workbench selection is a suitable container to use.
 */

private void initialize() {
	if (selection != null && selection.isEmpty() == false
			&& selection instanceof IStructuredSelection) {
		IStructuredSelection ssel = (IStructuredSelection) selection;
		if (ssel.size() > 1)
			return;
		Object obj = ssel.getFirstElement();
	}
	fileText.setText("pack");
	fileText.setSelection(0, "pack".length());
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:16,代码来源:NewFolderWizardPage.java

示例12: 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

示例13: 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

示例14: getSelectionList

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
private List<?> getSelectionList(IStructuredSelection selection) {
    return (selection != null && selection.size() > 1) ? selection.toList()
            : Collections.emptyList();
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:5,代码来源:DiffTableViewer.java

示例15: test

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
protected boolean test(Object receiver, String property, Object[] args, Object expectedValue, AvroSchemaEditor editor) {
	if (PROPERTY.equals(property)) {
		
		if (receiver instanceof IStructuredSelection) {
			IStructuredSelection selection = (IStructuredSelection) receiver;
			
			if (selection.size() == 1) {
				
				AvroNode node = (AvroNode) selection.getFirstElement();
				
				NodeType[] types = EditUtils.getAddableNodeTypes(node, editor.getServiceProvider().getService(AvroSchemaController.class));
				
				return types.length > 0;
				
			}
			
		}
		
	}
	return false;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:23,代码来源:AddElementPropertyTester.java


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