Java源码示例:org.eclipse.e4.ui.workbench.modeling.EPartService.PartState

示例1
void switchTo(MPart newPart) {
	if (getOrderedStacks(apart).size() == 1) {
		// case 1: 1 frame, split with miniPart
		// convenience hack: change direction on uArg
		splitIt(newPart, getDirection((isUniversalPresent()) ? !DISPLAY_HORIZONTAL : DISPLAY_HORIZONTAL));
	} else {
		// case 2: multiple stacks, move to adjacent stack
		// get the starting stack
		MElementContainer<MUIElement> stack = getParentStack(apart).getStack();
		// get the topart's stack
		MElementContainer<MUIElement> tstack = getParentStack(newPart).getStack();
		stack = findNextStack(apart, stack, 1);
		if (stack != null && stack != tstack) {
			modelService.move(newPart, stack, 0);
		}
	}
	if (displayOnly) {
		// brings to top
		partService.showPart(newPart, PartState.VISIBLE);
		reactivate(apart);
	} else {
		// bug in Kepler forces us to activate the old before the new
		reactivate(apart);
		reactivate(newPart);
	}
}
 
示例2
@Override
public void doubleClick(DoubleClickEvent event){
	ITask selectedTask = (ITask) ((StructuredSelection) event.getSelection()).getFirstElement();
	MPart taskDetailPart =
		partService.createPart("ch.elexis.core.ui.tasks.partdescriptor.taskdetail");
	taskDetailPart.getTransientData().put("task", selectedTask);
	partService.showPart(taskDetailPart, PartState.CREATE);
}