Java Code Examples for org.eclipse.gef.EditPart#SELECTED_PRIMARY

The following examples show how to use org.eclipse.gef.EditPart#SELECTED_PRIMARY . 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: NormalColumnEditPart.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
private List<NormalColumn> getSelectedForeignKeyColulmnList() {
    final List<NormalColumn> foreignKeyColulmnList = new ArrayList<NormalColumn>();

    final TableViewEditPart parent = (TableViewEditPart) getParent();

    for (final Object object : parent.getTargetConnections()) {
        final ConnectionEditPart connectionEditPart = (ConnectionEditPart) object;

        final int selected = connectionEditPart.getSelected();

        if (selected == EditPart.SELECTED || selected == EditPart.SELECTED_PRIMARY) {
            final ConnectionElement connectionElement = (ConnectionElement) connectionEditPart.getModel();

            if (connectionElement instanceof Relation) {
                final Relation relation = (Relation) connectionElement;

                foreignKeyColulmnList.addAll(relation.getForeignKeyColumns());
            }
        }
    }

    return foreignKeyColulmnList;
}
 
Example 2
Source File: NormalColumnEditPart.java    From erflute with Apache License 2.0 6 votes vote down vote up
private List<NormalColumn> getSelectedForeignKeyColulmnList() {
    final List<NormalColumn> foreignKeyColulmnList = new ArrayList<>();
    final TableViewEditPart parent = (TableViewEditPart) getParent();
    for (final Object object : parent.getTargetConnections()) {
        final ConnectionEditPart connectionEditPart = (ConnectionEditPart) object;
        final int selected = connectionEditPart.getSelected();
        if (selected == EditPart.SELECTED || selected == EditPart.SELECTED_PRIMARY) {
            final WalkerConnection connectionElement = (WalkerConnection) connectionEditPart.getModel();
            if (connectionElement instanceof Relationship) {
                final Relationship relation = (Relationship) connectionElement;
                foreignKeyColulmnList.addAll(relation.getForeignKeyColumns());
            }
        }
    }
    return foreignKeyColulmnList;
}
 
Example 3
Source File: NormalColumnEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private List<NormalColumn> getSelectedForeignKeyColulmnList() {
	List<NormalColumn> foreignKeyColulmnList = new ArrayList<NormalColumn>();

	TableViewEditPart parent = (TableViewEditPart) this.getParent();

	for (Object object : parent.getTargetConnections()) {
		ConnectionEditPart connectionEditPart = (ConnectionEditPart) object;

		int selected = connectionEditPart.getSelected();

		if (selected == EditPart.SELECTED
				|| selected == EditPart.SELECTED_PRIMARY) {
			ConnectionElement connectionElement = (ConnectionElement) connectionEditPart
					.getModel();

			if (connectionElement instanceof Relation) {
				Relation relation = (Relation) connectionElement;

				foreignKeyColulmnList.addAll(relation
						.getForeignKeyColumns());
			}
		}
	}

	return foreignKeyColulmnList;
}
 
Example 4
Source File: NormalColumnEditPart.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private List<NormalColumn> getSelectedReferencedColulmnList() {
	List<NormalColumn> referencedColulmnList = new ArrayList<NormalColumn>();

	TableViewEditPart parent = (TableViewEditPart) this.getParent();
	TableView tableView = (TableView) parent.getModel();

	for (Object object : parent.getSourceConnections()) {
		ConnectionEditPart connectionEditPart = (ConnectionEditPart) object;

		int selected = connectionEditPart.getSelected();

		if (selected == EditPart.SELECTED
				|| selected == EditPart.SELECTED_PRIMARY) {
			ConnectionElement connectionElement = (ConnectionElement) connectionEditPart
					.getModel();

			if (connectionElement instanceof Relation) {
				Relation relation = (Relation) connectionElement;

				if (relation.isReferenceForPK()) {
					referencedColulmnList.addAll(((ERTable) tableView)
							.getPrimaryKeys());

				} else if (relation.getReferencedComplexUniqueKey() != null) {
					referencedColulmnList.addAll(relation
							.getReferencedComplexUniqueKey()
							.getColumnList());

				} else {
					referencedColulmnList.add(relation
							.getReferencedColumn());
				}
			}
		}

	}
	return referencedColulmnList;
}
 
Example 5
Source File: NormalColumnEditPart.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private List<NormalColumn> getSelectedReferencedColulmnList() {
    final List<NormalColumn> referencedColulmnList = new ArrayList<NormalColumn>();

    final TableViewEditPart parent = (TableViewEditPart) getParent();
    final TableView tableView = (TableView) parent.getModel();

    for (final Object object : parent.getSourceConnections()) {
        final ConnectionEditPart connectionEditPart = (ConnectionEditPart) object;

        final int selected = connectionEditPart.getSelected();

        if (selected == EditPart.SELECTED || selected == EditPart.SELECTED_PRIMARY) {
            final ConnectionElement connectionElement = (ConnectionElement) connectionEditPart.getModel();

            if (connectionElement instanceof Relation) {
                final Relation relation = (Relation) connectionElement;

                if (relation.isReferenceForPK()) {
                    referencedColulmnList.addAll(((ERTable) tableView).getPrimaryKeys());

                } else if (relation.getReferencedComplexUniqueKey() != null) {
                    referencedColulmnList.addAll(relation.getReferencedComplexUniqueKey().getColumnList());

                } else {
                    referencedColulmnList.add(relation.getReferencedColumn());
                }
            }
        }

    }
    return referencedColulmnList;
}
 
Example 6
Source File: UpdateSizePoolSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
public UpdateSizePoolSelectionEditPolicy() {
    figureListener = new FigureListener() {

        public void figureMoved(IFigure source) {
            hideSelection();
            if(hasFocus || state == EditPart.SELECTED || state == EditPart.SELECTED_PRIMARY){
                showSelection();
            }
        }
    };
}
 
Example 7
Source File: AbstractSingleSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setSelectedState(int type) {
	if (this.state == type) {
		return;
	}
	this.state = type;
	if (type == EditPart.SELECTED_PRIMARY && isSingleSelection()) {
		showPrimarySelection();
	} else {
		hideSelection();
	}
}
 
Example 8
Source File: AbstractSwitchLaneSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
public AbstractSwitchLaneSelectionEditPolicy() {
	figureListener = new FigureListener() {

		public void figureMoved(IFigure source) {
			hideSelection();
			if(hasFocus || state == EditPart.SELECTED || state == EditPart.SELECTED_PRIMARY){
				showSelection();
			}
		}
	};
}
 
Example 9
Source File: UpdateSizeLaneSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 */
public UpdateSizeLaneSelectionEditPolicy() {
    figureListener = new FigureListener() {

        @Override
        public void figureMoved(final IFigure source) {
            hideSelection();
            if(hasFocus || state == EditPart.SELECTED || state == EditPart.SELECTED_PRIMARY){
                showSelection();
            }
        }
    };
}
 
Example 10
Source File: ActivityNameCursorMouseMotionListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void mouseEntered(MouseEvent me) {
    final Figure source = (Figure) me.getSource();
    if (editPart.getSelected() == EditPart.SELECTED_PRIMARY) {
        source.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM));
    } else {
        source.setCursor(Pics.getOpenedHandCursor());
    }

}
 
Example 11
Source File: ActivityNameCursorMouseMotionListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void mouseHover(MouseEvent me) {
    final Figure source = (Figure) me.getSource();
    if (editPart.getSelected() == EditPart.SELECTED_PRIMARY) {
        source.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM));
    } else {
        source.setCursor(Pics.getOpenedHandCursor());
    }
}
 
Example 12
Source File: TableCellResizeEditPolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void addSelectionHandles( )
{
	if ( ((ReportElementEditPart)getHost()).isDelete() || getHost( ).getSelected( ) != EditPart.SELECTED_PRIMARY )
	{
		return;
	}
	super.addSelectionHandles( );
	IFigure layer = getTopLayer( LayerConstants.HANDLE_LAYER );
	ArrayList list = new ArrayList( );
	TableHandleKit.addHandles( (TableEditPart) getHost( ).getParent( ), list );
	for ( int i = 0; i < list.size( ); i++ )
		layer.add( (IFigure) list.get( i ) );
	handles.addAll( list );
}
 
Example 13
Source File: TableCellResizeEditPolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected List createSelectionHandles( )
{
	List list = new ArrayList( );
	if ( getHost( ).getSelected( ) != EditPart.SELECTED_PRIMARY )
	{
		return list;
	}
	TableHandleKit.addHandles( (TableCellEditPart) getHost( ), list );
	return list;
}
 
Example 14
Source File: TableResizeEditPolice.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void addSelectionHandles( )
{
	super.addSelectionHandles( );
	if ( ( (ReportElementEditPart) getHost( ) ).isDelete( )
			|| getHost( ).getSelected( ) != EditPart.SELECTED_PRIMARY )
	{
		return;
	}
	IFigure layer = getLayer( LayerConstants.HANDLE_LAYER );
	ArrayList list = new ArrayList( );
	TableHandleKit.addHandles( (TableEditPart) getHost( ), list );
	for ( int i = 0; i < list.size( ); i++ )
		layer.add( (IFigure) list.get( i ) );
	handles.addAll( list );
}
 
Example 15
Source File: ColumnSelectionEditPolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void showSelection( )
{
	if ( this.getHost( ).getSelected( ) == EditPart.SELECTED_PRIMARY )
	{
		( (ColumnFigure) this.getHostFigure( ) ).setSelectedColors( );
	}
	else
	{
		( (ColumnFigure) this.getHostFigure( ) ).setSelectedFonts( );
	}
}
 
Example 16
Source File: CrosstabCellResizeEditPolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void addSelectionHandles( )
{
	if ( ( (ReportElementEditPart) getHost( ) ).isDelete( )
			|| getHost( ).getSelected( ) != EditPart.SELECTED_PRIMARY )
	{
		return;
	}
	super.addSelectionHandles( );

}
 
Example 17
Source File: CrosstabCellResizeEditPolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected List createSelectionHandles( )
{
	List list = new ArrayList( );
	if ( getHost( ).getSelected( ) != EditPart.SELECTED_PRIMARY )
	{
		return list;
	}
	CrosstabHandleKit.addHandles( (CrosstabCellEditPart) getHost( ), list );
	return list;
}
 
Example 18
Source File: NormalColumnEditPart.java    From erflute with Apache License 2.0 5 votes vote down vote up
private List<NormalColumn> getSelectedReferencedColulmnList() {
    final List<NormalColumn> referencedColulmnList = new ArrayList<>();

    final TableViewEditPart parent = (TableViewEditPart) getParent();
    final TableView tableView = (TableView) parent.getModel();

    for (final Object object : parent.getSourceConnections()) {
        final ConnectionEditPart connectionEditPart = (ConnectionEditPart) object;

        final int selected = connectionEditPart.getSelected();

        if (selected == EditPart.SELECTED || selected == EditPart.SELECTED_PRIMARY) {
            final WalkerConnection connectionElement = (WalkerConnection) connectionEditPart.getModel();

            if (connectionElement instanceof Relationship) {
                final Relationship relation = (Relationship) connectionElement;

                if (relation.isReferenceForPK()) {
                    referencedColulmnList.addAll(((ERTable) tableView).getPrimaryKeys());

                } else if (relation.getReferredCompoundUniqueKey() != null) {
                    referencedColulmnList.addAll(relation.getReferredCompoundUniqueKey().getColumnList());

                } else {
                    referencedColulmnList.add(relation.getReferredSimpleUniqueColumn());
                }
            }
        }
    }
    return referencedColulmnList;
}
 
Example 19
Source File: TransitionEditPart.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setSelected(int value) {
	switch (value) {
	case EditPart.SELECTED:
	case EditPart.SELECTED_PRIMARY:
		getFigure().setLineWidth(getMapMode().DPtoLP(2));
		break;
	default:
		getFigure().setLineWidth(getMapMode().DPtoLP(1));
	}

	super.setSelected(value);
}
 
Example 20
Source File: CustomResizeHandle.java    From bonita-studio with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if the handle's owner is the primary selection.
 * 
 * @return <code>true</code> if the handles owner has primary selection.
 */
protected boolean isPrimary() {
	return getOwner().getSelected() == EditPart.SELECTED_PRIMARY;
}