org.eclipse.gef.RequestConstants Java Examples

The following examples show how to use org.eclipse.gef.RequestConstants. 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: TableEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 #2
Source File: TableOutlineEditPart.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(final Request request) {
    final ERTable table = (ERTable) getModel();
    final ERDiagram diagram = (ERDiagram) getRoot().getContents().getModel();

    if (request.getType().equals(RequestConstants.REQ_OPEN)) {
        final ERTable copyTable = table.copyData();

        final TableDialog dialog = new TableDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getViewer(), copyTable);

        if (dialog.open() == IDialogConstants.OK_ID) {
            final CompoundCommand command = ERTableEditPart.createChangeTablePropertyCommand(diagram, table, copyTable);

            execute(command.unwrap());
        }
    }

    super.performRequest(request);
}
 
Example #3
Source File: IndexOutlineEditPart.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(final Request request) {
    final Index index = (Index) getModel();
    final ERDiagram diagram = getDiagram();

    if (request.getType().equals(RequestConstants.REQ_OPEN)) {
        final IndexDialog dialog = new IndexDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), index, index.getTable());

        if (dialog.open() == IDialogConstants.OK_ID) {
            final ChangeIndexCommand command = new ChangeIndexCommand(diagram, index, dialog.getResultIndex());

            execute(command);
        }
    }

    super.performRequest(request);
}
 
Example #4
Source File: SequenceOutlineEditPart.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(final Request request) {
    try {
        final Sequence sequence = (Sequence) getModel();
        final ERDiagram diagram = getDiagram();

        if (request.getType().equals(RequestConstants.REQ_OPEN)) {
            final SequenceDialog dialog = new SequenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), sequence, diagram);

            if (dialog.open() == IDialogConstants.OK_ID) {
                final EditSequenceCommand command = new EditSequenceCommand(diagram, sequence, dialog.getResult());
                execute(command);
            }
        }

        super.performRequest(request);

    } catch (final Exception e) {
        ERDiagramActivator.showExceptionDialog(e);
    }
}
 
Example #5
Source File: ERDiagramAlignmentAction.java    From erflute with Apache License 2.0 6 votes vote down vote up
private Command createAlignmentCommand() {
    final AlignmentRequest request = new AlignmentRequest(RequestConstants.REQ_ALIGN);
    request.setAlignmentRectangle(calculateAlignmentRectangle(request));
    request.setAlignment(alignment);
    final List<?> editparts = getOperationSet(request);
    if (editparts.size() < 2)
        return null;

    final CompoundCommand command = new CompoundCommand();
    command.setDebugLabel(getText());
    for (int i = 0; i < editparts.size(); i++) {
        final EditPart editpart = (EditPart) editparts.get(i);
        command.add(editpart.getCommand(request));
    }
    return command;
}
 
Example #6
Source File: IndexOutlineEditPart.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void performRequest(Request request) {
    final ERIndex index = (ERIndex) getModel();
    final ERDiagram diagram = getDiagram();

    if (request.getType().equals(RequestConstants.REQ_OPEN)) {
        final IndexDialog dialog = new IndexDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), index, index.getTable());

        if (dialog.open() == IDialogConstants.OK_ID) {
            final ChangeIndexCommand command = new ChangeIndexCommand(diagram, index, dialog.getResultIndex());
            execute(command);
        }
    }

    super.performRequest(request);
}
 
Example #7
Source File: SequenceOutlineEditPart.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void performRequest(Request request) {
    try {
        final Sequence sequence = (Sequence) getModel();
        final ERDiagram diagram = getDiagram();

        if (request.getType().equals(RequestConstants.REQ_OPEN)) {
            final SequenceDialog dialog =
                    new SequenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), sequence, diagram);

            if (dialog.open() == IDialogConstants.OK_ID) {
                final EditSequenceCommand command = new EditSequenceCommand(diagram, sequence, dialog.getResult());
                execute(command);
            }
        }

        super.performRequest(request);

    } catch (final Exception e) {
        Activator.showExceptionDialog(e);
    }
}
 
Example #8
Source File: TableOutlineEditPart.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void performRequest(Request request) {
    final ERTable table = getModel();
    final ERDiagram diagram = getDiagram();
    if (request.getType().equals(RequestConstants.REQ_OPEN)) {
        final ERTable copyTable = table.copyData();

        final TableDialog dialog =
                new TableDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getViewer(), copyTable, diagram
                        .getDiagramContents().getColumnGroupSet());

        if (dialog.open() == IDialogConstants.OK_ID) {
            final CompoundCommand command = ERTableEditPart.createChangeTablePropertyCommand(diagram, table, copyTable);
            execute(command.unwrap());
        }
    }

    super.performRequest(request);
}
 
Example #9
Source File: TriggerOutlineEditPart.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void performRequest(Request request) {
    final Trigger trigger = (Trigger) getModel();
    final ERDiagram diagram = getDiagram();

    if (request.getType().equals(RequestConstants.REQ_OPEN)) {
        final TriggerDialog dialog = new TriggerDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), trigger);

        if (dialog.open() == IDialogConstants.OK_ID) {
            final EditTriggerCommand command = new EditTriggerCommand(diagram, trigger, dialog.getResult());
            getViewer().getEditDomain().getCommandStack().execute(command);
        }
    }

    super.performRequest(request);
}
 
Example #10
Source File: CrosstabCellEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 #11
Source File: CrosstabTableEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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( ) )
							|| ReportRequest.CREATE_ELEMENT.equals( request.getType( ) ) )
						return true;
					return super.understandsRequest( request );
				}
			} );
	installEditPolicy( EditPolicy.CONTAINER_ROLE,
			new ReportContainerEditPolicy( ) );

	installEditPolicy( EditPolicy.LAYOUT_ROLE,
			new CrosstabXYLayoutEditPolicy( (XYLayout) getContentPane( ).getLayoutManager( ) ) );
}
 
Example #12
Source File: ExtendedEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 #13
Source File: ReportElementEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * perform edit directly when the request is the corresponding type.
 */
public void performRequest( Request request )
{
	if (request.getExtendedData( ).get( DesignerConstants.NEWOBJECT_FROM_LIBRARY )!= null)
	{
		return ;
	}
	if ( RequestConstants.REQ_OPEN.equals( request.getType( ) )
			|| ReportRequest.CREATE_ELEMENT.equals( request.getType( ) ) )
	{
		if ( isEdited( ) )
		{
			return;
		}
		setEdited( true );
		try
		{
			performDirectEdit( );
		}
		catch ( RuntimeException e )
		{
			logger.log( Level.SEVERE, e.getMessage( ), e );
		}
		setEdited( false );
	}
}
 
Example #14
Source File: TableEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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( ) )
							|| ReportRequest.CREATE_ELEMENT.equals( request.getType( ) ) )
						return true;
					return super.understandsRequest( request );
				}
			} );
	installEditPolicy( EditPolicy.CONTAINER_ROLE,
			new ReportContainerEditPolicy( ) );
	// should add highlight policy
	// installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
	// ContainerHighlightEditPolicy());
	installEditPolicy( EditPolicy.LAYOUT_ROLE,
			new TableXYLayoutEditPolicy( (XYLayout) getContentPane( ).getLayoutManager( ) ) );
}
 
Example #15
Source File: TableEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void performRequest( Request request )
{
	if ( RequestConstants.REQ_OPEN.equals( request.getType( ) ) )
	{
		Object obj = request.getExtendedData( )
				.get( DesignerConstants.TABLE_ROW_NUMBER );
		if ( obj != null )
		{
			int rowNum = ( (Integer) obj ).intValue( );
			RowHandle row = (RowHandle) getRow( rowNum );
			if ( row.getContainer( ) instanceof TableGroupHandle )
			{
				IAction action = new EditGroupAction( null,
						(TableGroupHandle) row.getContainer( ) );
				if ( action.isEnabled( ) )
				{
					action.run( );
				}
			}
		}
	}
}
 
Example #16
Source File: WordOutlineEditPart.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(final Request request) {
    final Word word = (Word) getModel();
    final ERDiagram diagram = getDiagram();

    if (request.getType().equals(RequestConstants.REQ_OPEN)) {
        final WordDialog dialog = new WordDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), word, false, diagram);

        if (dialog.open() == IDialogConstants.OK_ID) {
            final EditWordCommand command = new EditWordCommand(word, dialog.getWord(), diagram);
            execute(command);
        }
    }

    super.performRequest(request);
}
 
Example #17
Source File: ListEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 #18
Source File: TableCellEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 #19
Source File: ERDiagramAlignmentAction.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private Command createAlignmentCommand() {
	AlignmentRequest request = new AlignmentRequest(
			RequestConstants.REQ_ALIGN);
	request.setAlignmentRectangle(calculateAlignmentRectangle(request));
	request.setAlignment(alignment);
	List editparts = getOperationSet(request);
	if (editparts.size() < 2)
		return null;

	CompoundCommand command = new CompoundCommand();
	command.setDebugLabel(getText());
	for (int i = 0; i < editparts.size(); i++) {
		EditPart editpart = (EditPart) editparts.get(i);
		command.add(editpart.getCommand(request));
	}
	return command;
}
 
Example #20
Source File: WordOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Word word = (Word) this.getModel();
	ERDiagram diagram = this.getDiagram();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		WordDialog dialog = new WordDialog(PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getShell(), word, false,
				diagram);

		if (dialog.open() == IDialogConstants.OK_ID) {
			EditWordCommand command = new EditWordCommand(word, dialog
					.getWord(), diagram);
			this.execute(command);
		}
	}

	super.performRequest(request);
}
 
Example #21
Source File: TablespaceOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Tablespace tablespace = (Tablespace) this.getModel();
	ERDiagram diagram = this.getDiagram();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		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) {
				EditTablespaceCommand command = new EditTablespaceCommand(
						diagram, tablespace, dialog.getResult());
				this.execute(command);
			}
		}
	}

	super.performRequest(request);
}
 
Example #22
Source File: ViewOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	View view = (View) this.getModel();
	ERDiagram diagram = (ERDiagram) this.getRoot().getContents().getModel();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		View copyView = view.copyData();

		ViewDialog dialog = new ViewDialog(PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getShell(), this.getViewer(),
				copyView, diagram.getDiagramContents().getGroups());

		if (dialog.open() == IDialogConstants.OK_ID) {
			CompoundCommand command = ViewEditPart
					.createChangeViewPropertyCommand(diagram, view,
							copyView);

			this.execute(command.unwrap());
		}
	}

	super.performRequest(request);
}
 
Example #23
Source File: GroupOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	ColumnGroup columnGroup = (ColumnGroup) this.getModel();
	ERDiagram diagram = this.getDiagram();

	GroupSet groupSet = diagram.getDiagramContents().getGroups();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		GroupDialog dialog = new GroupDialog(PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getShell(), groupSet, diagram,
				groupSet.indexOf(columnGroup));

		if (dialog.open() == IDialogConstants.OK_ID) {
			List<CopyGroup> newColumnGroups = dialog.getCopyColumnGroups();

			Command command = new ChangeGroupCommand(diagram, groupSet,
					newColumnGroups);

			this.execute(command);
		}
	}

	super.performRequest(request);
}
 
Example #24
Source File: IndexOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Index index = (Index) this.getModel();
	ERDiagram diagram = this.getDiagram();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		IndexDialog dialog = new IndexDialog(PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getShell(), index, index
				.getTable());

		if (dialog.open() == IDialogConstants.OK_ID) {
			ChangeIndexCommand command = new ChangeIndexCommand(diagram,
					index, dialog.getResultIndex());

			this.execute(command);
		}
	}

	super.performRequest(request);
}
 
Example #25
Source File: SequenceOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@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 #26
Source File: TableOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	ERTable table = (ERTable) this.getModel();
	ERDiagram diagram = (ERDiagram) this.getRoot().getContents().getModel();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		ERTable copyTable = table.copyData();

		TableDialog dialog = new TableDialog(PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getShell(), this.getViewer(),
				copyTable, diagram.getDiagramContents().getGroups());

		if (dialog.open() == IDialogConstants.OK_ID) {
			CompoundCommand command = ERTableEditPart
					.createChangeTablePropertyCommand(diagram, table,
							copyTable);

			this.execute(command.unwrap());
		}
	}

	super.performRequest(request);
}
 
Example #27
Source File: RelationOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Relation relation = (Relation) this.getModel();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		Relation copy = relation.copy();

		RelationDialog dialog = new RelationDialog(PlatformUI
				.getWorkbench().getActiveWorkbenchWindow().getShell(), copy);

		if (dialog.open() == IDialogConstants.OK_ID) {
			ChangeRelationPropertyCommand command = new ChangeRelationPropertyCommand(
					relation, copy);
			this.execute(command);
		}
	}

	super.performRequest(request);
}
 
Example #28
Source File: TriggerOutlineEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Trigger trigger = (Trigger) this.getModel();
	ERDiagram diagram = (ERDiagram) this.getRoot().getContents().getModel();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		TriggerDialog dialog = new TriggerDialog(PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getShell(), trigger);

		if (dialog.open() == IDialogConstants.OK_ID) {
			EditTriggerCommand command = new EditTriggerCommand(diagram,
					trigger, dialog.getResult());
			this.getViewer().getEditDomain().getCommandStack().execute(
					command);
		}
	}

	super.performRequest(request);
}
 
Example #29
Source File: CommentConnectionEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Relation relation = (Relation) this.getModel();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		Relation copy = relation.copy();

		RelationDialog dialog = new RelationDialog(PlatformUI
				.getWorkbench().getActiveWorkbenchWindow().getShell(), copy);

		if (dialog.open() == IDialogConstants.OK_ID) {
			ChangeRelationPropertyCommand command = new ChangeRelationPropertyCommand(
					relation, copy);
			this.getViewer().getEditDomain().getCommandStack().execute(
					command);
		}
	}

	super.performRequest(request);
}
 
Example #30
Source File: RelationEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Relation relation = (Relation) this.getModel();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		Relation copy = relation.copy();

		RelationDialog dialog = new RelationDialog(PlatformUI
				.getWorkbench().getActiveWorkbenchWindow().getShell(), copy);

		if (dialog.open() == IDialogConstants.OK_ID) {
			ChangeRelationPropertyCommand command = new ChangeRelationPropertyCommand(
					relation, copy);
			this.getViewer().getEditDomain().getCommandStack().execute(
					command);
		}
	}

	super.performRequest(request);
}