/** * @param dragElement * @param dropStack2 * @return */ private boolean crossSharedAreaBoundary(MUIElement dragElement, MPartStack dropStack) { EModelService ms = dndManager.getModelService(); boolean deNotInSA = (ms.getElementLocation(dragElement) & EModelService.IN_SHARED_AREA) == 0; boolean dsInSA = (ms.getElementLocation(dropStack) & EModelService.IN_SHARED_AREA) != 0; return deNotInSA && dsInSA; } }
/** * Unzooms the shared area if the specified element is in the shared area. * * @param element * the element to check if it is in the shared area * @see #unzoomSharedArea() */ private void unzoomSharedArea(MUIElement element) { if (modelService.getElementLocation(element) == EModelService.IN_SHARED_AREA) { unzoomSharedArea(); } }
public void removePlaceholder(String id) { MUIElement refModel = findElement(perspModel, id); if (!(refModel instanceof MPlaceholder)) { E4Util.unsupported("removePlaceholder: failed to find " + id + ": " + refModel); //$NON-NLS-1$ //$NON-NLS-2$ return; } // placeholders in the shared area should be ignored if (modelService.getElementLocation(refModel) != EModelService.IN_SHARED_AREA) { MElementContainer<MUIElement> parent = refModel.getParent(); if (parent != null) { parent.getChildren().remove(refModel); } } }
boolean outsidePerspectives = (modelService.getElementLocation(element) & EModelService.OUTSIDE_PERSPECTIVE) != 0; List<MPartStack> stacks = modelService.findElements(win, null, MPartStack.class, minTag, EModelService.PRESENTATION); int stackLoc = modelService.getElementLocation(theStack); if ((stackLoc & EModelService.OUTSIDE_PERSPECTIVE) == 0) { continue; int loc = modelService.getElementLocation(element); if ((loc & EModelService.OUTSIDE_PERSPECTIVE) != 0) { List<MPerspectiveStack> psList = modelService.findElements(win, null, MPerspectiveStack.class);
private MUIElement getTargetElement(MUIElement dragElement, DnDInfo info) { MUIElement target = null; dragElementLocation = dndManager.getModelService().getElementLocation(dragElement); // If we're inside a perspective somewhere check the shared area's edges if (dragElementLocation == EModelService.IN_SHARED_AREA || dragElementLocation == EModelService.IN_ACTIVE_PERSPECTIVE) { target = checkAreaEdge(dragElement, info); } if (target == null && dragElementLocation == EModelService.IN_ACTIVE_PERSPECTIVE || dragElementLocation == EModelService.OUTSIDE_PERSPECTIVE) { target = checkPerspectiveEdge(dragElement, info); } if (target == null) { target = checkStacks(dragElement, info); } return target; }
int loc = modelService.getElementLocation(element); boolean inSharedArea = loc == EModelService.IN_SHARED_AREA; boolean validLocation = allowSharedArea || !inSharedArea;
int loc = modelService.getElementLocation(element); if ((loc & EModelService.OUTSIDE_PERSPECTIVE) != 0) {
int phLoc = modelService.getElementLocation(ph); if (phLoc == EModelService.IN_ACTIVE_PERSPECTIVE || phLoc == EModelService.IN_SHARED_AREA
int loc = modelService.getElementLocation(element); if ((loc & EModelService.OUTSIDE_PERSPECTIVE) != 0) { List<MPerspectiveStack> psList = modelService.findElements(win, null,
public Object createWidget(MUIElement element, Object parent) { if (!(element instanceof MPartStack) || !(parent instanceof Composite)) return null; Composite parentComposite = (Composite) parent; // Ensure that all rendered PartStacks have an Id if (element.getElementId() == null || element.getElementId().length() == 0) { String generatedId = "PartStack@" + Integer.toHexString(element.hashCode()); //$NON-NLS-1$ element.setElementId(generatedId); } // TBD: need to define attributes to handle this final CTabFolder ctf = new CTabFolder(parentComposite, SWT.BORDER); ctf.setMRUVisible(getInitialMRUValue(ctf)); // Adjust the minimum chars based on the location int location = modelService.getElementLocation(element); if ((location & EModelService.IN_SHARED_AREA) != 0) { ctf.setMinimumCharacters(MIN_EDITOR_CHARS); ctf.setUnselectedCloseVisible(true); } else { ctf.setMinimumCharacters(MIN_VIEW_CHARS); ctf.setUnselectedCloseVisible(false); } bindWidget(element, ctf); // ?? Do we need this ? // Add a composite to manage the view's TB and Menu addTopRight(ctf); return ctf; }
public MUIElement getActiveElement(IWorkbenchPartReference ref) { MUIElement element = null; MPerspective curPersp = modelService.getActivePerspective(window); if (curPersp == null) return null; MPlaceholder eaPH = (MPlaceholder) modelService.find(IPageLayout.ID_EDITOR_AREA, curPersp); MPart model = ((WorkbenchPartReference) ref).getModel(); MPlaceholder placeholder = model.getCurSharedRef(); switch (modelService.getElementLocation(placeholder == null ? model : placeholder)) { case EModelService.IN_ACTIVE_PERSPECTIVE: case EModelService.OUTSIDE_PERSPECTIVE: MUIElement parent = placeholder == null ? model.getParent() : placeholder.getParent(); if (parent instanceof MPartStack) { element = parent; } break; case EModelService.IN_SHARED_AREA: element = eaPH; break; } return element; }
@Override public Object createWidget(MUIElement element, Object parent) { if (!(element instanceof MPartStack) || !(parent instanceof Composite)) return null; MPartStack pStack = (MPartStack) element; Composite parentComposite = (Composite) parent; // Ensure that all rendered PartStacks have an Id if (element.getElementId() == null || element.getElementId().length() == 0) { String generatedId = "PartStack@" + Integer.toHexString(element.hashCode()); //$NON-NLS-1$ element.setElementId(generatedId); } int styleOverride = getStyleOverride(pStack); int style = styleOverride == -1 ? SWT.BORDER : styleOverride; final CTabFolder tabFolder = new CTabFolder(parentComposite, style); tabFolder.setMRUVisible(getMRUValue(tabFolder)); // Adjust the minimum chars based on the location int location = modelService.getElementLocation(element); if ((location & EModelService.IN_SHARED_AREA) != 0) { tabFolder.setMinimumCharacters(MIN_EDITOR_CHARS); tabFolder.setUnselectedCloseVisible(true); } else { tabFolder.setMinimumCharacters(MIN_VIEW_CHARS); tabFolder.setUnselectedCloseVisible(false); } bindWidget(element, tabFolder); // ?? Do we need this ? // Add a composite to manage the view's TB and Menu addTopRight(tabFolder); return tabFolder; }
int loc = modelService.getElementLocation(element); if ((loc & EModelService.OUTSIDE_PERSPECTIVE) != 0) { continue; loc = modelService.getElementLocation(theStack); if (loc != EModelService.IN_SHARED_AREA && theStack.getWidget() != null && theStack.isVisible() && !theStack.getTags().contains(MINIMIZED)) {
perspective.getContext().activate(); } else { if ((modelService.getElementLocation(newActivePart) & EModelService.IN_SHARED_AREA) != 0) { if (newActivePart.getParent().getSelectedElement() != newActivePart) { newActivePart = (MPart) newActivePart.getParent().getSelectedElement();