本文整理汇总了Java中org.eclipse.e4.ui.model.application.ui.basic.MPartStack类的典型用法代码示例。如果您正苦于以下问题:Java MPartStack类的具体用法?Java MPartStack怎么用?Java MPartStack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MPartStack类属于org.eclipse.e4.ui.model.application.ui.basic包,在下文中一共展示了MPartStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectEditorWindow
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
/**
* Returns the project window (Swing or SWT).
*
* @param project the project
* @return the project window
*/
public AwbProjectEditorWindow getProjectEditorWindow(Project project) {
AwbProjectEditorWindow projectEditorWindow = null;
switch (this.getVisualisationPlatform()) {
case EclipseFramework:
// --- SWT editor -------------------
MPartStack editorStack = (MPartStack) project.getEclipseEModelService().find(AppModelId.PARTSTACK_ORG_AGENTGUI_CORE_PARTSTACK_EDITOR, project.getEclipseMApplication());
MPart editorPart = project.getEclipseEPartService().createPart(AppModelId.PARTDESCRIPTOR_ORG_AGENTGUI_CORE_PARTDESCRIPTOR_AGENTPROJECT);
if (editorPart!=null) {
editorPart.getTransientData().put(Project.class.getName(), project);
editorPart.setVisible(true);
editorStack.getChildren().add(editorPart);
project.getEclipseEPartService().showPart(editorPart, PartState.VISIBLE);
projectEditorWindow = (AwbProjectEditorWindow) editorPart.getObject();
}
break;
case AgentGuiSwing:
// --- Swing editor -----------------
projectEditorWindow = new org.agentgui.gui.swing.project.ProjectWindow(project);
break;
}
return projectEditorWindow;
}
示例2: getOpenedEditors
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
public static HashSet<MPart> getOpenedEditors(){
EModelService modelService = CloudscaleContext.getGlobalContext().get(EModelService.class);
MApplication app = CloudscaleContext.getGlobalContext().get(MApplication.class);
if(modelService == null){
throw new IllegalSelectorException();
}
if(app == null){
throw new IllegalSelectorException();
}
HashSet<MPart> out = new HashSet<MPart>();
MPartStack stack = (MPartStack)modelService.find("org.eclipse.e4.primaryDataStack", app);
for(MStackElement el : stack.getChildren()){
if(el instanceof MPart){
MPart part = (MPart)el;
if(part.getContext() != null){
out.add(part);
}
}
}
return out;
}
示例3: setup
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
@PostConstruct
public void setup(IEventBroker eventBroker){
partStack = (MPartStack)modelService.find("linguine.partstack.advanced."
+ "dataEditorPartStack", application);
eventBroker.subscribe(LinGUIneEvents.UILifeCycle.OPEN_PROJECT_DATA,
new EventHandler(){
@Override
public void handleEvent(Event event) {
if(event != null){
for(String propName: event.getPropertyNames()){
//Does nothing, but I'm afraid to get rid of it
}
}
}
});
}
示例4: activate
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
@Execute
void activate(final EPartService inPartService,
final EModelService inModelService, final MApplication inApplication) {
// get browser stack
final MPartStack lStack = (MPartStack) inModelService.find(
RelationsConstants.PART_STACK_BROWSERS, inApplication);
final Iterator<MStackElement> lParts = lStack.getChildren().iterator();
// iterate over children
while (lParts.hasNext()) {
final MStackElement lElement = lParts.next();
if (lElement instanceof MPart) {
final MPart lPart = (MPart) lElement;
// activate visible
if (inPartService.isPartVisible(lPart)) {
inPartService.activate(lPart, true);
break;
}
}
}
}
示例5: createFastViewStack
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
private static MPartStack createFastViewStack(MTrimmedWindow window, MPerspective mPerspective,
EModelService eModelService){
if (window != null && mPerspective != null) {
MPartStack mPartStack = eModelService.createModelElement(MPartStack.class);
mPartStack.setElementId(ELEXIS_FASTVIEW_STACK);
mPartStack.setToBeRendered(true);
mPartStack.getTags().add("Minimized");
mPartStack.setOnTop(false);
mPartStack.setVisible(false);
mPartStack.getTags().add("NoAutoCollapse");
mPartStack.getTags().add("active");
mPerspective.getChildren().add(0, mPartStack);
return mPartStack;
}
return null;
}
示例6: setActiveTerminology
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
private void setActiveTerminology( EModelService modelService, MApplication application) {
MPartStack stack = (MPartStack) modelService.find(TermSuiteUI.UI_MAIN_PART_STACK, application);
MStackElement element = stack.getSelectedElement();
if(element != null && element instanceof MPart) {
MPart activePart = (MPart) element;
if(activePart.getObject() instanceof TerminologyPart)
updateActiveTerminology((activePart.getContext().get(ETerminology.class)));
}
}
示例7: getPartStack
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
private MPartStack getPartStack(MPart childPart) {
MStackElement stackElement = childPart;
MPartStack newStack = BasicFactoryImpl.eINSTANCE.createPartStack();
newStack.getChildren().add(stackElement);
newStack.setSelectedElement(stackElement);
return newStack;
}
示例8: showMPartForOrder
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
public void showMPartForOrder(final Order order) {
// if already exist we show the part
if (!orderIdToMPartMap.containsKey(order.getId())) {
MPartStack partstack = filterOutOrdersPartStack();
MPart newPart = createAndMapNewPart(order);
partstack.getChildren().add(newPart);
}
MPart part = orderIdToMPartMap.get(order.getId());
partService.showPart(part, PartState.ACTIVATE);
}
示例9: filterOutOrdersPartStack
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
private MPartStack filterOutOrdersPartStack() {
List<MPartStack> partstacks = modelService.findElements(application,
MODEL_PARTSTACKS_EDITOR_ID, MPartStack.class, null);
for (MPartStack partstack : partstacks) {
MPerspective perspective = modelService.getPerspectiveFor(partstack);
if (MODEL_PERSPECTIVE_ORDERS_ID.equals(perspective.getElementId())) {
return partstack;
}
}
throw new IllegalStateException("no partstack of " + partstacks
+ " does belong to a perspecktive(id=" + MODEL_PERSPECTIVE_ORDERS_ID + ")");
}
示例10: showMPartForPosition
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
public void showMPartForPosition(final PositionWithOrderAndArticleInfoDTO positionViewDTO) {
// if already exist we show the part
MPart mpart = null;
if (positionIdToMPartMap.containsKey(positionViewDTO.getPositionId())) {
mpart = positionIdToMPartMap.get(positionViewDTO.getPositionId());
} else {
MPartStack partstack = filterOutOrdersPartStack();
mpart = createAndMapNewPart(positionViewDTO);
partstack.getChildren().add(mpart);
}
passDataToMPart(positionViewDTO, mpart);
partService.showPart(mpart, PartState.ACTIVATE);
}
示例11: grid
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
static void grid(final MPartStack displayStack, final List<MPlaceholder> holders) {
final MElementContainer currentSash = displayStack.getParent();
final int size = holders.size();
final List<MElementContainer> containers = new ArrayList<>();
createContainers(currentSash, containers, size, true);
for (int i = 0; i < holders.size(); i++) {
associate(containers.get(i), holders.get(i), false);
}
}
示例12: horizontalOrVertical
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
static void horizontalOrVertical(final MPartStack displayStack, final List<MPlaceholder> holders,
final boolean horizontal) {
final MElementContainer rootSash = displayStack.getParent();
((MPartSashContainer) rootSash).setHorizontal(horizontal);
for (int i = 0; i < holders.size(); i++) {
associate(createContainer(rootSash), holders.get(i), false);
}
}
示例13: createStack
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
static MPartStack createStack(final MElementContainer root) {
final MPartStack stack = modelService.createModelElement(MPartStack.class);
stack.getTransientData().put("Dynamic", true);
stack.setContainerData("5000");
root.getChildren().add(stack);
return stack;
}
示例14: createPart
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
@Override
public boolean createPart(Path rootPath, String panelId) {
boolean result = false;
if (rootPath != null) {
String rootPathString = null;
rootPathString = PathUtils.getFileName(rootPath);
// create dynamic part
MPart part = createDynamicPart(modelService);
if (part != null) {
// specify part
part.setLabel(rootPathString);
part.setElementId(createElementId());
// add tab to the part stack (panel)
MPartStack panel = (MPartStack) modelService.find(panelId, application);
panel.getChildren().add(part);
//
openedParts.add(part);
// TODO Send out events: workout
broker.post(TabEvents.TOPIC_TAB_OPEN, part);
result = true;
}
else {
log.error("Unable to create dynamic part."); //$NON-NLS-1$
}
}
return result;
}
示例15: copyPart
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; //导入依赖的package包/类
@Override
public boolean copyPart(MPart activePart, PartCopyType copyType) {
// 1. copy part
MPart newPart = copyPart(partService, activePart);
// 2. get panel
MPartStack panel = getPanel(modelService, application, activePart, copyType);
// 3. add part into panel
if (panel != null && panel.getChildren() != null) {
panel.getChildren().add(newPart);
}
// 4. add created part to opened parts set
openedParts.add(newPart);
lastPart = newPart;
// TODO Send out events
// broker.post(MyEventConstants.TOPIC_TODO_NEW, updateTodo);
// 6. show part
showPart(partService, newPart, activePart);
// 6. resolve selections
// if (PartCopyType.COPY == copyType) {
// tabService.clearSelection(getVisiblePart(activePart,
// !stayActiveTab));
// tabService.setSelection(getVisiblePart(activePart, stayActiveTab));
// }
// else if (PartCopyType.DUPLICATE == copyType) {
// tabService.clearSelection(activePart);
// tabService.setSelection(newPart);
// }
return true;
}