org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart Java Examples
The following examples show how to use
org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractLiveValidationMarkerConstraint.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private View getViewFor(final DiagramEditor editor, EObject validatedObject) { if (editor instanceof ProcessDiagramEditor) { if (!(validatedObject instanceof FlowElement || validatedObject instanceof BoundaryEvent || validatedObject instanceof Container || validatedObject instanceof Connection)) { validatedObject = ModelHelper.getParentFlowElement(validatedObject); } } for (final Object ep : editor.getDiagramGraphicalViewer().getEditPartRegistry().values()) { if (!(ep instanceof ITextAwareEditPart) && !(ep instanceof ShapeCompartmentEditPart) && ep instanceof IGraphicalEditPart && ((IGraphicalEditPart) ep).resolveSemanticElement() != null && ((IGraphicalEditPart) ep).resolveSemanticElement().equals(validatedObject)) { return ((IGraphicalEditPart) ep).getNotationView(); } } return null; }
Example #2
Source File: BotGefProcessDiagramEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private List<SWTBotGefEditPart> getLaneInPool(final SWTBotGefEditPart pGef, final String pLabel) { final List<SWTBotGefEditPart> descendants = new ArrayList<SWTBotGefEditPart>(); final List<SWTBotGefEditPart> children = pGef.children(); for (final SWTBotGefEditPart child : children) { if (child.part() instanceof CustomLaneEditPart) { final ITextAwareEditPart textEditPart = (ITextAwareEditPart) child.children().get(0).part(); final String d = textEditPart.getEditText(); if (d.equals(pLabel)) { descendants.add(child); } } else { descendants.addAll(getLaneInPool(child, pLabel)); } } return descendants; }
Example #3
Source File: CustomDragDropEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private boolean isCollapsed(EditPart ep) { if(ep instanceof ShapeCompartmentEditPart){ return !((ShapeCompartmentEditPart) ep).getCompartmentFigure().isExpanded() ; }else{ if(ep instanceof ITextAwareEditPart){ ep=ep.getParent() ; } for(final Object child : ep.getChildren()){ if(child instanceof ShapeCompartmentEditPart){ return !((ShapeCompartmentEditPart) child).getCompartmentFigure().isExpanded() ; } } } return false; }
Example #4
Source File: ProcessElementNameContribution.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void updatePartName(final String name, final Display display) { if (selection != null && !selection.isEmpty()) { final ITextAwareEditPart textAwareEditPart = getTextAwareEditPart((IStructuredSelection) selection); if (textAwareEditPart != null) { textAwareEditPart.setLabelText(name); display.asyncExec(refreshPoolEditPart(textAwareEditPart)); } } }
Example #5
Source File: ProcessElementNameContribution.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Runnable refreshPoolEditPart(final ITextAwareEditPart textAwareEditPart) { return new Runnable() { @Override public void run() { final EditPart poolEp = getPoolEditPart(textAwareEditPart); if (poolEp != null) { poolEp.refresh(); } } }; }
Example #6
Source File: ProcessEditPartFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) { if (source.getFigure() instanceof WrappingLabel) return new TextCellEditorLocator((WrappingLabel) source.getFigure()); else { return new LabelCellEditorLocator((Label) source.getFigure()); } }
Example #7
Source File: ProcessTextNonResizableEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void showPrimarySelection() { if (getHostFigure() instanceof WrappingLabel) { final GraphicalEditPart ep = (GraphicalEditPart) getHost(); if (ep.resolveSemanticElement() instanceof Activity) { final CustomTextDirectEditManager manager = new CustomTextDirectEditManager(ep, CustomTextDirectEditManager.getTextCellEditorClass(ep), ProcessEditPartFactory.getTextCellEditorLocator((ITextAwareEditPart) ep)); manager.show(); manager.getCellEditor().addListener(new ICellEditorListener() { @Override public void editorValueChanged(boolean oldValidState, boolean newValidState) { } @Override public void cancelEditor() { ep.getViewer().select(getHost().getParent()); } @Override public void applyEditorValue() { ep.getViewer().select(getHost().getParent()); } }); } else { ((WrappingLabel) getHostFigure()).setSelected(true); } } else { showSelection(); showFocus(); } }
Example #8
Source File: ProcessTextSelectionEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void showPrimarySelection() { if (getHostFigure() instanceof WrappingLabel) { final GraphicalEditPart ep = (GraphicalEditPart) getHost(); if (ep.resolveSemanticElement() instanceof Activity) { final CustomTextDirectEditManager manager = new CustomTextDirectEditManager(ep, CustomTextDirectEditManager.getTextCellEditorClass(ep), ProcessEditPartFactory.getTextCellEditorLocator((ITextAwareEditPart) ep)); manager.show(); manager.getCellEditor().addListener(new ICellEditorListener() { @Override public void editorValueChanged(boolean oldValidState, boolean newValidState) { } @Override public void cancelEditor() { ep.getViewer().select(getHost().getParent()); } @Override public void applyEditorValue() { ep.getViewer().select(getHost().getParent()); } }); } else { ((WrappingLabel) getHostFigure()).setSelected(true); } } else { showSelection(); showFocus(); } }
Example #9
Source File: ImporterUtil.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private static String getTextFromEditPart(EditPart o) { for(Object obj : o.getChildren()){ if(obj instanceof ITextAwareEditPart){ return ((ITextAwareEditPart)obj).getEditText(); } } return null; }
Example #10
Source File: CrossflowEditPartFactory.java From scava with Eclipse Public License 2.0 | 4 votes |
/** * @generated */ public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) { return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source); }
Example #11
Source File: CustomProcessEditPolicyProvider.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public void createEditPolicies(EditPart editPart) { EObject resolveSemanticElement = ((GraphicalEditPart)editPart).resolveSemanticElement(); if(!(editPart instanceof ITextAwareEditPart)){//DO NOT INSTALL EDIT POLICIES ON LABELS if ((resolveSemanticElement instanceof FlowElement || resolveSemanticElement instanceof BoundaryEvent || resolveSemanticElement instanceof SubProcessEvent) && !(resolveSemanticElement instanceof Pool)) { editPart.installEditPolicy(SelectionFeedbackEditPolicy.BONITA_SELECTION_FEEDBACK_ROLE, new SelectionFeedbackEditPolicy(((IGraphicalEditPart)editPart).resolveSemanticElement().eClass())); } if ((resolveSemanticElement instanceof FlowElement ||resolveSemanticElement instanceof BoundaryEvent || resolveSemanticElement instanceof TextAnnotation) && !(resolveSemanticElement instanceof Pool) && !(resolveSemanticElement instanceof SubProcessEvent)) { editPart.installEditPolicy(NextElementEditPolicy.NEXT_ELEMENT_ROLE, new NextElementEditPolicy()); } if (resolveSemanticElement instanceof Activity && !(resolveSemanticElement instanceof SubProcessEvent)) { editPart.installEditPolicy(ActivitySwitchEditPolicy.SWITCH_TYPE_ROLE, new ActivitySwitchEditPolicy()); } if (resolveSemanticElement instanceof Activity && !(resolveSemanticElement instanceof SendTask) && !(resolveSemanticElement instanceof SubProcessEvent)) { editPart.installEditPolicy(BoundaryEventToolEditPolicy.BOUNDARY_TOOL_ROLE, new BoundaryEventToolEditPolicy()); } if (resolveSemanticElement instanceof Event) { editPart.installEditPolicy(ActivitySwitchEditPolicy.SWITCH_TYPE_ROLE, new ActivitySwitchEditPolicy()); } if (resolveSemanticElement instanceof Gateway) { editPart.installEditPolicy(ActivitySwitchEditPolicy.SWITCH_TYPE_ROLE, new ActivitySwitchEditPolicy()); } if (resolveSemanticElement instanceof BoundaryTimerEvent) { editPart.installEditPolicy(ActivitySwitchEditPolicy.SWITCH_TYPE_ROLE, new BoundaryEventSwitchEditPolicy()); } } // Override the container LAYOUT_ROLE instead of the edit part PRIMARY_DRAG_ROLE // since the edit policy is created on edit part by container and there is no // way to override it EditPolicy layoutEditPolicy = editPart.getEditPolicy(EditPolicy.LAYOUT_ROLE); if (layoutEditPolicy != null && layoutEditPolicy instanceof XYLayoutEditPolicy) { editPart.removeEditPolicy(EditPolicy.LAYOUT_ROLE); editPart.installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomFeedbackXYLayoutPolicy()); } if ( resolveSemanticElement instanceof Pool) { editPart.installEditPolicy(SwitchPoolSelectionEditPolicy.SWITCH_POOL_SELECTION_FEEDBACK_ROLE, new SwitchPoolSelectionEditPolicy()); editPart.installEditPolicy(UpdateSizePoolSelectionEditPolicy.UPDATE_POOL_SIZE_SELECTION_FEEDBACK_ROLE, new UpdateSizePoolSelectionEditPolicy()); } if (resolveSemanticElement instanceof Lane) { if(editPart instanceof LaneEditPart){ editPart.installEditPolicy(AbstractSwitchLaneSelectionEditPolicy.SWITCH_LANE_SELECTION_FEEDBACK_ROLE, new SwitchLaneSelectionEditpolicy()); editPart.installEditPolicy(UpdateSizeLaneSelectionEditPolicy.UPDATE_LANE_SIZE_SELECTION_FEEDBACK_ROLE, new UpdateSizeLaneSelectionEditPolicy()); } } editPart.removeEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE); editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy()); if (!(resolveSemanticElement instanceof MainProcess)) { editPart.removeEditPolicy(EditPolicyRoles.CREATION_ROLE); editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomCreationEditPolicy()); } editPart.removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); editPart.removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); editPart.installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDetailsOrGoToSubProcessEditPolicy()); }
Example #12
Source File: CustomCreationEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected Command getReparentCommand(final ChangeBoundsRequest request) { final CompoundCommand cc = new CompoundCommand(); if(getHost() instanceof ITextAwareEditPart){ return UnexecutableCommand.INSTANCE; } if(request.getExtendedData().get("DELETE_FROM_LANE") != null){ return super.getReparentCommand(request); } if(getHost() instanceof CustomPoolCompartmentEditPart && request.getEditParts().get(0) != null && ((EditPart) request.getEditParts().get(0)).getParent() instanceof CustomLaneCompartmentEditPart){ return UnexecutableCommand.INSTANCE; } if(getHost() instanceof CustomSubprocessEventCompartmentEditPart && request.getEditParts().get(0) != null){ for(final Object child : request.getEditParts()){ if(child instanceof IGraphicalEditPart){ if(!((IGraphicalEditPart) child).getTargetConnections().isEmpty() || !((IGraphicalEditPart) child).getSourceConnections().isEmpty()){ return UnexecutableCommand.INSTANCE; } else { if (child instanceof StartTimerEvent2EditPart && !(((IGraphicalEditPart) child).getParent() instanceof CustomSubprocessEventCompartmentEditPart) && !((IGraphicalEditPart)child).getParent().equals(getHost())){ final Command editCommand = editTimerEventValue((IGraphicalEditPart)child); if (editCommand.canExecute()){ cc.add(editCommand); } } } } } } if(getHost() instanceof CustomSubProcessEvent2EditPart){ return UnexecutableCommand.INSTANCE; } if(getHost() instanceof CustomLaneEditPart){ if( request.getLocation() != null){ return UnexecutableCommand.INSTANCE; } } cc.add(super.getReparentCommand(request)); return cc; }
Example #13
Source File: UpdateSizePoolSelectionEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected void showSelection() { if(!(((IGraphicalEditPart) getHost()).resolveSemanticElement() instanceof Pool)){ return ; } if(getHost() instanceof ITextAwareEditPart || getHost() instanceof ShapeCompartmentEditPart) { return ; } poolEditPart = (ShapeNodeEditPart) getHost() ; haveLanes = false ; for(Object o : poolEditPart.getChildren()){ if(o instanceof CustomPoolCompartmentEditPart){ if(!((CustomPoolCompartmentEditPart)o).getPoolLanes().isEmpty()){ haveLanes = true ; break ; } } } if (sourceFigure == null) { sourceFigure = poolEditPart.getFigure(); sourceFigure.addFigureListener(figureListener); } hideSelection(); layer = getLayer(LayerConstants.HANDLE_LAYER); Rectangle ref = sourceFigure.getBounds(); if (ref.x == 0 && ref.y == 0 && ref.height == 0 && ref.width == 0) { return; } if(zoomManager.getZoom() > GMFTools.MINIMAL_ZOOM_DISPLAY){ showSelectionForAddRight(zoomManager.getZoom()); showSelectionForRemoveRight(zoomManager.getZoom()); if(!haveLanes){ showSelectionForAddBottom(zoomManager.getZoom()); showSelectionForRemoveBottom(zoomManager.getZoom()); } } }