类org.eclipse.ui.dialogs.IWorkingSetSelectionDialog源码实例Demo

下面列出了怎么用org.eclipse.ui.dialogs.IWorkingSetSelectionDialog的API类实例代码及写法,或者点击链接到github查看源代码。

private void selectWorkingSetAction() {
	IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
	IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(getShell(), true);
	dialog.open();
	IWorkingSet[] sets = dialog.getSelection();
	if(sets != null) {
		workingSets = sets;
	} else {
		// dialog cancelled
		return;
	}
	updateWorkingSetScope();
	updateWorkingSetLabel();
	
	participantScope.setSelection(false);
	selectedResourcesScope.setSelection(false);
	workingSetScope.setSelection(true);
}
 
@Override
public void run() {
	Shell shell= getShell();
	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	IWorkingSetSelectionDialog dialog= manager.createWorkingSetSelectionDialog(shell, false);
	IWorkingSet workingSet= fActionGroup.getWorkingSet();
	if (workingSet != null)
		dialog.setSelection(new IWorkingSet[]{workingSet});

	if (dialog.open() == Window.OK) {
		IWorkingSet[] result= dialog.getSelection();
		if (result != null && result.length > 0) {
			fActionGroup.setWorkingSet(result[0], true);
			manager.addRecentWorkingSet(result[0]);
		}
		else
			fActionGroup.setWorkingSet(null, true);
	}
}
 
public IWorkingSet[] queryWorkingSets() throws InterruptedException {
	Shell shell= JavaPlugin.getActiveWorkbenchShell();
	if (shell == null)
		return null;
	IWorkingSetSelectionDialog dialog= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell, true);
	if (dialog.open() != Window.OK) {
		throw new InterruptedException();
	}

	IWorkingSet[] workingSets= dialog.getSelection();
	if (workingSets.length > 0)
		return workingSets;
	return null; // 'no working set' selected
}
 
 类所在包
 类方法
 同包方法