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


Java IStructuredSelection.toArray方法代码示例

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


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

示例1: performSelectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
private void performSelectionChanged(final IStructuredSelection structuredSelection) {
	final Object[] array = structuredSelection.toArray();
	final ArrayList<IProject> openProjects = new ArrayList<>();
	final int selectionStatus = evaluateSelection(array, openProjects);
	final StructuredSelection sel = new StructuredSelection(openProjects);

	// If only projects are selected, disable this action group, as all of
	// the project-related contributions will be provided by default action providers
	enableContribution = (selectionStatus & NON_PROJECT_SELECTED) != 0;

	openAction.setEnabled(hasClosedProjectsInWorkspace());
	enableOpenInContextMenu = (selectionStatus & CLOSED_PROJECTS_SELECTED) != 0
			|| (selectionStatus == 0 && array.length == 0 && hasClosedProjectsInWorkspace());
	closeAction.selectionChanged(sel);
	closeUnrelatedAction.selectionChanged(sel);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:N4JSProjectActionGroup.java

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

示例3: run

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void run() {
	final IStructuredSelection selection = getStructuredSelection();
	final Object[] selectionElements = selection.toArray();
	final WorkingSet[] selectedWorkingSets = Arrays2.filter(selectionElements, WorkingSet.class);

	final WorkingSetManager manager = selectedWorkingSets[0].getWorkingSetManager();
	final WorkingSetDiffBuilder builder = new WorkingSetDiffBuilder(manager);
	final WorkingSet[] newAllItems = manager.getAllWorkingSets();
	final List<WorkingSet> newItems = newArrayList(manager.getWorkingSets());
	for (final WorkingSet toHide : selectedWorkingSets) {
		newItems.remove(toHide);
	}
	final Diff<WorkingSet> diff = builder.build(Iterables.toArray(newItems, WorkingSet.class), newAllItems);
	if (!diff.isEmpty()) {
		manager.updateState(diff);
		manager.saveState(new NullProgressMonitor());
		manager.getWorkingSetManagerBroker().refreshNavigator();
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:HideWorkingSetAction.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: 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

示例6: dragSetData

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void dragSetData(DragSourceEvent event) {
    if (schemaViewer.getSelection() instanceof IStructuredSelection) {
        LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
        IStructuredSelection ss = (IStructuredSelection) schemaViewer.getSelection();
        Object[] objects = ss.toArray();
        transfer.setSelection(new StructuredSelection(objects));
        event.data = transfer.getSelection();
    }
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:11,代码来源:DnDSourceListener.java


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