org.eclipse.gef.Request Java Examples
The following examples show how to use
org.eclipse.gef.Request.
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: RelationOutlineEditPart.java From ermasterr with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void performRequest(final Request request) { final Relation relation = (Relation) getModel(); if (request.getType().equals(RequestConstants.REQ_OPEN)) { final Relation copy = relation.copy(); final RelationDialog dialog = new RelationDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), copy); if (dialog.open() == IDialogConstants.OK_ID) { final ChangeRelationPropertyCommand command = new ChangeRelationPropertyCommand(relation, copy); execute(command); } } super.performRequest(request); }
Example #2
Source File: ERDiagramLayoutEditPolicy.java From erflute with Apache License 2.0 | 6 votes |
@Override public Command getCommand(Request request) { if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_PLACE_TABLE.equals(request.getType())) { final DirectEditRequest editRequest = (DirectEditRequest) request; final Object feature = editRequest.getDirectEditFeature(); if (feature instanceof ERTable) { final ERTable ertable = (ERTable) feature; return new PlaceTableCommand(ertable); } if (feature instanceof List) { @SuppressWarnings("unchecked") final List<ERTable> list = (List<ERTable>) feature; return new PlaceTableCommand(list); } } return super.getCommand(request); }
Example #3
Source File: TablespaceOutlineEditPart.java From erflute with Apache License 2.0 | 6 votes |
@Override public void performRequest(Request request) { final Tablespace tablespace = (Tablespace) getModel(); final ERDiagram diagram = getDiagram(); if (request.getType().equals(RequestConstants.REQ_OPEN)) { final TablespaceDialog dialog = EclipseDBManagerFactory.getEclipseDBManager(diagram).createTablespaceDialog(); if (dialog == null) { Activator.showMessageDialog("dialog.message.tablespace.not.supported"); } else { dialog.init(tablespace, diagram); if (dialog.open() == IDialogConstants.OK_ID) { final EditTablespaceCommand command = new EditTablespaceCommand(diagram, tablespace, dialog.getResult()); execute(command); } } } super.performRequest(request); }
Example #4
Source File: CustomLaneCompartmentEditPart.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public DragTracker getDragTracker(Request req) { if (!supportsDragSelection()) return super.getDragTracker(req); if (req instanceof SelectionRequest && ((SelectionRequest) req).getLastButtonPressed() == 3) return new DeselectAllTracker(this) { protected boolean handleButtonDown(int button) { getCurrentViewer().select(CustomLaneCompartmentEditPart.this); return true; } }; return new CustomRubberbandDragTracker() { protected void handleFinished() { if (getViewer().getSelectedEditParts().isEmpty()) getViewer().select(CustomLaneCompartmentEditPart.this); } }; }
Example #5
Source File: ExtendedEditPart.java From birt with Eclipse Public License 1.0 | 6 votes |
protected void createEditPolicies( ) { installEditPolicy( EditPolicy.COMPONENT_ROLE, new ReportComponentEditPolicy( ) { public boolean understandsRequest( Request request ) { if ( RequestConstants.REQ_DIRECT_EDIT.equals( request.getType( ) ) || RequestConstants.REQ_OPEN.equals( request.getType( ) ) ) // !creation request already processed in createion // tool // || ReportRequest.CREATE_ELEMENT.equals( // request.getType( ) ) ) return true; return super.understandsRequest( request ); } } ); }
Example #6
Source File: TableCellEditPart.java From birt with Eclipse Public License 1.0 | 6 votes |
public void showTargetFeedback( Request request ) { if ( this.getSelected( ) == 0 && isActive( ) && request.getType( ) == RequestConstants.REQ_SELECTION ) { if ( isFigureLeft( request ) ) { this.getViewer( ).setCursor( ReportPlugin.getDefault( ).getLeftCellCursor( ) ); } else { this.getViewer( ).setCursor( ReportPlugin.getDefault( ).getRightCellCursor( ) ); } } super.showTargetFeedback( request ); }
Example #7
Source File: BaseInsertHandler.java From birt with Eclipse Public License 1.0 | 6 votes |
protected Request insertElement( ) throws Exception { Request request = new Request( IRequestConstants.REQUEST_TYPE_INSERT ); Map extendsData = new HashMap( ); extendsData.put( IRequestConstants.REQUEST_KEY_INSERT_SLOT, slotHandle ); extendsData.put( IRequestConstants.REQUEST_KEY_INSERT_TYPE, insertType ); extendsData.put( IRequestConstants.REQUEST_KEY_INSERT_POSITION, InsertAction.BELOW ); request.setExtendedData( extendsData ); if ( ProviderFactory.createProvider( slotHandle.getElementHandle( ) ) .performRequest( model, request ) ) { return request; } return null; }
Example #8
Source File: ScriptedTaskScriptedTaskOutputVariablesCompartmentEditPart.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ public EditPart getTargetEditPart(Request request) { if (request instanceof CreateViewAndElementRequest) { CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor() .getCreateElementRequestAdapter(); IElementType type = (IElementType) adapter.getAdapter(IElementType.class); if (type == CrossflowElementTypes.Field_3003) { return this; } return getParent().getTargetEditPart(request); } if (request instanceof CreateUnspecifiedTypeConnectionRequest) { return getParent().getTargetEditPart(request); } return super.getTargetEditPart(request); }
Example #9
Source File: SequenceOutlineEditPart.java From ermaster-b with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void performRequest(Request request) { try { Sequence sequence = (Sequence) this.getModel(); ERDiagram diagram = this.getDiagram(); if (request.getType().equals(RequestConstants.REQ_OPEN)) { SequenceDialog dialog = new SequenceDialog(PlatformUI .getWorkbench().getActiveWorkbenchWindow().getShell(), sequence, diagram); if (dialog.open() == IDialogConstants.OK_ID) { EditSequenceCommand command = new EditSequenceCommand( diagram, sequence, dialog.getResult()); this.execute(command); } } super.performRequest(request); } catch (Exception e) { Activator.showExceptionDialog(e); } }
Example #10
Source File: BoundaryMessageEventLabel2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #11
Source File: BoundarySignalEventLabelEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #12
Source File: StartTimerEventLabelEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #13
Source File: TypeEditPart.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * @generated */ public EditPart getTargetEditPart(Request request) { if (request instanceof CreateViewAndElementRequest) { CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor() .getCreateElementRequestAdapter(); IElementType type = (IElementType) adapter.getAdapter(IElementType.class); if (type == CrossflowElementTypes.Field_3001) { return getChildBySemanticHint( CrossflowVisualIDRegistry.getType(TypeTypeFieldsCompartmentEditPart.VISUAL_ID)); } } return super.getTargetEditPart(request); }
Example #14
Source File: ServiceTaskLabelEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #15
Source File: ERDiagramAlignmentAction.java From ermasterr with Apache License 2.0 | 5 votes |
/** * Returns the alignment rectangle to which all selected parts should be * aligned. * * @param request * the alignment Request * @return the alignment rectangle */ protected Rectangle calculateAlignmentRectangle(final Request request) { final List editparts = getOperationSet(request); if (editparts == null || editparts.isEmpty()) return null; final GraphicalEditPart part = (GraphicalEditPart) editparts.get(editparts.size() - 1); final Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds()); part.getFigure().translateToAbsolute(rect); return rect; }
Example #16
Source File: EndSignalEventLabel2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #17
Source File: ColorAndFontPropertySection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Command getCommand(Request request) { List operationSet = getInput(); Iterator editParts = operationSet.iterator(); CompoundCommand command = new CompoundCommand("Change Font"); while (editParts.hasNext()) { EditPart editPart = (EditPart) editParts.next(); Command curCommand = editPart.getCommand(request); if (curCommand != null) { command.add(curCommand); } } return command.isEmpty() || command.size() != operationSet.size() ? UnexecutableCommand.INSTANCE : (Command) command; }
Example #18
Source File: PoolNameEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #19
Source File: StartMessageEventLabel2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #20
Source File: ProcessLinkCreatePolicy.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected Connection createDummyConnection(Request req) { PolylineConnection con = (PolylineConnection) super.createDummyConnection(req); con.setForegroundColor(Link.COLOR); if (!(req instanceof CreateConnectionRequest)) { con.setTargetDecoration(new PolygonDecoration()); return con; } CreateLinkCommand cmd = (CreateLinkCommand) ((CreateConnectionRequest) req).getStartCommand(); if (cmd.output != null) con.setTargetDecoration(new PolygonDecoration()); else if (cmd.input != null) con.setSourceDecoration(new PolygonDecoration()); return con; }
Example #21
Source File: CustomLaneEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void showSourceFeedback(final Request request) { if (request instanceof ChangeBoundsRequest) { if (request.getType().equals(RequestConstants.REQ_RESIZE)) { super.showSourceFeedback(request); } } }
Example #22
Source File: ERDiagramAlignmentAction.java From erflute with Apache License 2.0 | 5 votes |
/** * Returns the alignment rectangle to which all selected parts should be aligned. * @param request the alignment Request * @return the alignment rectangle */ protected Rectangle calculateAlignmentRectangle(Request request) { final List<?> editparts = getOperationSet(request); if (editparts == null || editparts.isEmpty()) return null; final GraphicalEditPart part = (GraphicalEditPart) editparts.get(editparts.size() - 1); final Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds()); part.getFigure().translateToAbsolute(rect); return rect; }
Example #23
Source File: EnlargeContainerEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override public void showSourceFeedback(Request request) { if (containerHierachy == null) { containerHierachy = collectContainerHierachy(); } if (!RequestConstants.REQ_RESIZE.equals(request.getType()) && !RequestConstants.REQ_MOVE.equals(request.getType())) return; showContainerFeedback((ChangeBoundsRequest) request); }
Example #24
Source File: StartSignalEventLabel2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #25
Source File: DiagramWalkerEditPart.java From erflute with Apache License 2.0 | 5 votes |
@Override public void performRequest(Request request) { if (request.getType().equals(RequestConstants.REQ_OPEN)) { try { performRequestOpen(); } catch (final Exception e) { Activator.showExceptionDialog(e); } } super.performRequest(request); }
Example #26
Source File: TableViewGraphicalNodeEditPolicy.java From ermaster-b with Apache License 2.0 | 5 votes |
@Override public void showTargetFeedback(Request request) { ERDiagram diagram = ERModelUtil.getDiagram(this.getHost().getRoot().getContents()); if (diagram.isTooltip()) { ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this .getHost().getRoot()).getZoomManager(); double zoom = zoomManager.getZoom(); TableView tableView = (TableView) this.getHost().getModel(); Rectangle tableBounds = this.getHostFigure().getBounds(); String name = TableViewEditPart.getTableViewName(tableView, diagram); Label label = new Label(); label.setText(name); label.setBorder(new SimpleRaisedBorder()); label.setBackgroundColor(ColorConstants.orange); label.setOpaque(true); Dimension dim = FigureUtilities.getTextExtents(name, Display .getCurrent().getSystemFont()); label.setBounds(new Rectangle((int) (zoom * (tableBounds.x + 33)), (int) (zoom * (tableBounds.y + 5)), (int) (dim.width * 1.5), 20)); this.addFeedback(label); } super.showTargetFeedback(request); }
Example #27
Source File: ColumnEditPart.java From ermasterr with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void performRequest(final Request request) { if (request.getType().equals(RequestConstants.REQ_OPEN)) { try { performRequestOpen(); } catch (final Exception e) { ERDiagramActivator.showExceptionDialog(e); } } super.performRequest(request); }
Example #28
Source File: ActivityName2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest.getExtendedData() .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } }
Example #29
Source File: ReportDesignEditPart.java From birt with Eclipse Public License 1.0 | 5 votes |
public DragTracker getDragTracker( Request req ) { if ( req instanceof SelectionRequest && ( (SelectionRequest) req ).getLastButtonPressed( ) == 3 ) return new DeselectAllTracker( this ); return new RootDragTracker( ); }
Example #30
Source File: ListEditPart.java From birt with Eclipse Public License 1.0 | 5 votes |
public void eraseTargetFeedback( Request request ) { if ( isActive( ) ) { this.getViewer( ).setCursor( null ); } super.eraseTargetFeedback( request ); }