當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。