Java Code Examples for org.eclipse.gef.EditPart#setModel()

The following examples show how to use org.eclipse.gef.EditPart#setModel() . 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: CFGPartFactory.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public EditPart createEditPart(EditPart arg0, Object arg1) {
	EditPart part = null;
	if (arg1 instanceof CFGGraph){
		part = new CFGGraphEditPart();
	}
	else if (arg1 instanceof CFGNode){
		part = new CFGNodeEditPart();
	}
	else if (arg1 instanceof CFGEdge){
		part = new CFGEdgeEditPart();	
	}
	else if (arg1 instanceof CFGFlowData){
		part = new FlowDataEditPart();
	}
	else if (arg1 instanceof CFGPartialFlowData){
		part = new PartialFlowDataEditPart();
	}
	else if (arg1 instanceof CFGFlowInfo){
		part = new FlowInfoEditPart();
	}
	else if (arg1 instanceof CFGNodeData){
		part = new NodeDataEditPart();
	}
	part.setModel(arg1);
	return part;
}
 
Example 2
Source File: PartFactory.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public EditPart createEditPart(EditPart arg0, Object arg1) {
	EditPart part = null;
	if (arg1 instanceof Graph){
		part = new GraphEditPart();
	}
	else if (arg1 instanceof SimpleNode){
		part = new SimpleNodeEditPart();
	}
	else if (arg1 instanceof Edge){
		part = new EdgeEditPart();	
	}
	else if (arg1 instanceof ComplexNode){
		part = new ComplexNodeEditPart();
	}
	
	part.setModel(arg1);
	return part;
}
 
Example 3
Source File: EditpartExtensionManager.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static EditPart createEditPart( EditPart context, Object model )
{
	EvaluationContext econtext = new EvaluationContext( null, model );
	for ( Iterator<Expression> iterator = extensionMap.keySet( ).iterator( ); iterator.hasNext( ); )
	{
		try
		{
			Expression expression = iterator.next( );
			if ( expression.evaluate( econtext ) == EvaluationResult.TRUE )
			{
				EditPart editPart = (EditPart) extensionMap.get( expression )
						.createExecutableExtension( "type" ); //$NON-NLS-1$
				editPart.setModel( model );
				return editPart;
			}
		}
		catch ( CoreException e )
		{
			logger.log( Level.SEVERE, e.getMessage( ), e );
		}
	}
	return null;
}
 
Example 4
Source File: GridEditPartFactory.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Overrides the default behavior to connect Grids and Cells to their
 * corresponding EditParts (GridEditPart and CellEditPart).
 */
@Override
public EditPart createEditPart(EditPart context, Object model) {
	// The code here is based off of the tutorials here:
	// http://www.eclipsecon.org/2008/?page=sub/&id=102
	// http://www.vainolo.com/2011/06/21/creating-a-gef-editor-%E2%80%93-part-4-showing-the-model-on-the-editor/

	EditPart editPart = null;
	if (model instanceof Grid) {
		editPart = new GridEditPart();
	} else if (model instanceof Cell) {
		editPart = new CellEditPart();
	}

	if (editPart != null) {
		editPart.setModel(model);
	}
	return editPart;
}
 
Example 5
Source File: CircularGridEditPartFactory.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Overrides the default behavior to connect Grids and Cells to their
 * corresponding EditParts (GridEditPart and CellEditPart).
 */
@Override
public EditPart createEditPart(EditPart context, Object model) {
	// The code here is based off of the tutorials here:
	// http://www.eclipsecon.org/2008/?page=sub/&id=102
	// http://www.vainolo.com/2011/06/21/creating-a-gef-editor-%E2%80%93-part-4-showing-the-model-on-the-editor/

	EditPart editPart = null;
	if (model instanceof Grid) {
		editPart = new CircularGridEditPart();
	} else if (model instanceof Cell) {
		editPart = new CircularCellEditPart();
	}

	if (editPart != null) {
		editPart.setModel(model);
	}
	return editPart;
}
 
Example 6
Source File: HexagonalGridEditPartFactory.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Overrides the default behavior to connect Grids and Cells to their
 * corresponding EditParts (GridEditPart and CellEditPart).
 */
@Override
public EditPart createEditPart(EditPart context, Object model) {
	// The code here is based off of the tutorials here:
	// http://www.eclipsecon.org/2008/?page=sub/&id=102
	// http://www.vainolo.com/2011/06/21/creating-a-gef-editor-%E2%80%93-part-4-showing-the-model-on-the-editor/

	EditPart editPart = null;
	if (model instanceof Grid) {
		editPart = new HexagonalGridEditPart();
	} else if (model instanceof Cell) {
		editPart = new HexagonalCellEditPart();
	}

	if (editPart != null) {
		editPart.setModel(model);
	}
	return editPart;
}
 
Example 7
Source File: AppTreeEditPartFactory.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public EditPart createEditPart(EditPart context, Object model) {
	EditPart part = null;
	if (model instanceof ProductSystem)
		part = new ProductSystemTreeEditPart();
	else if (model instanceof ProcessDescriptor)
		part = new ProcessTreeEditPart(this.model);
	if (part != null)
		part.setModel(model);
	return part;
}
 
Example 8
Source File: SankeyEditPartFactory.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public EditPart createEditPart(EditPart context, Object model) {
	EditPart part = createEditPart(model);
	if (part != null)
		part.setModel(model);
	return part;
}
 
Example 9
Source File: ERDiagramOutlineEditPartFactory.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
@Override
public EditPart createEditPart(final EditPart context, final Object model) {
    EditPart editPart = null;

    if (model instanceof ERTable) {
        editPart = new TableOutlineEditPart();

    } else if (model instanceof ERDiagram) {
        editPart = new ERDiagramOutlineEditPart();

    } else if (model instanceof Relation) {
        editPart = new RelationOutlineEditPart();

    } else if (model instanceof Word) {
        editPart = new WordOutlineEditPart();

    } else if (model instanceof Dictionary) {
        editPart = new DictionaryOutlineEditPart();

    } else if (model instanceof ColumnGroup) {
        editPart = new GroupOutlineEditPart();

    } else if (model instanceof GroupSet) {
        editPart = new GroupSetOutlineEditPart();

    } else if (model instanceof SequenceSet) {
        editPart = new SequenceSetOutlineEditPart();

    } else if (model instanceof Sequence) {
        editPart = new SequenceOutlineEditPart();

    } else if (model instanceof ViewSet) {
        editPart = new ViewSetOutlineEditPart();

    } else if (model instanceof View) {
        editPart = new ViewOutlineEditPart();

    } else if (model instanceof TriggerSet) {
        editPart = new TriggerSetOutlineEditPart();

    } else if (model instanceof Trigger) {
        editPart = new TriggerOutlineEditPart();

    } else if (model instanceof TablespaceSet) {
        editPart = new TablespaceSetOutlineEditPart();

    } else if (model instanceof Tablespace) {
        editPart = new TablespaceOutlineEditPart();

    } else if (model instanceof TableSet) {
        editPart = new TableSetOutlineEditPart();

    } else if (model instanceof IndexSet) {
        editPart = new IndexSetOutlineEditPart();

    } else if (model instanceof Index) {
        editPart = new IndexOutlineEditPart();

    }

    if (editPart != null) {
        editPart.setModel(model);
    }

    return editPart;
}
 
Example 10
Source File: ERDiagramEditPartFactory.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
@Override
public EditPart createEditPart(final EditPart context, final Object model) {
    EditPart editPart = null;

    if (model instanceof ERTable) {
        editPart = new ERTableEditPart();

    } else if (model instanceof View) {
        editPart = new ViewEditPart();

    } else if (model instanceof ERDiagram) {
        editPart = new ERDiagramEditPart();

    } else if (model instanceof Relation) {
        editPart = new RelationEditPart();

    } else if (model instanceof Note) {
        editPart = new NoteEditPart();

    } else if (model instanceof ModelProperties) {
        editPart = new ModelPropertiesEditPart();

    } else if (model instanceof CommentConnection) {
        editPart = new CommentConnectionEditPart();

    } else if (model instanceof Category) {
        editPart = new CategoryEditPart();

    } else if (model instanceof RemovedERTable) {
        editPart = new RemovedERTableEditPart();

    } else if (model instanceof RemovedNote) {
        editPart = new RemovedNoteEditPart();

    } else if (model instanceof NormalColumn) {
        editPart = new NormalColumnEditPart();

    } else if (model instanceof ColumnGroup) {
        editPart = new GroupColumnEditPart();

    } else if (model instanceof InsertedImage) {
        editPart = new InsertedImageEditPart();

    }

    if (editPart != null) {
        editPart.setModel(model);
    }

    return editPart;
}
 
Example 11
Source File: ERDiagramOutlineEditPartFactory.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
public EditPart createEditPart(EditPart context, Object model) {
    EditPart editPart = null;
    if (model instanceof ERVirtualDiagram) {
        editPart = new ERVirtualDiagramOutlineEditPart();
    } else if (model instanceof ERVirtualDiagramSet) {
        editPart = new ERVirtualDiagramSetOutlineEditPart();
    } else if (model instanceof ERTable) {
        editPart = new TableOutlineEditPart(quickMode);
        tableParts.put(((ERTable) model).getLogicalName(), editPart);
    } else if (model instanceof ERDiagram) {
        editPart = new ERDiagramOutlineEditPart(quickMode);
    } else if (model instanceof Relationship) {
        editPart = new RelationOutlineEditPart();
    } else if (model instanceof Word) {
        editPart = new WordOutlineEditPart();
    } else if (model instanceof Dictionary) {
        editPart = new DictionaryOutlineEditPart();
    } else if (model instanceof ColumnGroup) {
        editPart = new ColumnGroupOutlineEditPart();
    } else if (model instanceof ColumnGroupSet) {
        editPart = new GroupSetOutlineEditPart();
    } else if (model instanceof SequenceSet) {
        editPart = new SequenceSetOutlineEditPart();
    } else if (model instanceof Sequence) {
        editPart = new SequenceOutlineEditPart();
    } else if (model instanceof ViewSet) {
        editPart = new ViewSetOutlineEditPart();
    } else if (model instanceof ERView) {
        editPart = new ViewOutlineEditPart();
    } else if (model instanceof TriggerSet) {
        editPart = new TriggerSetOutlineEditPart();
    } else if (model instanceof Trigger) {
        editPart = new TriggerOutlineEditPart();
    } else if (model instanceof TablespaceSet) {
        editPart = new TablespaceSetOutlineEditPart();
    } else if (model instanceof Tablespace) {
        editPart = new TablespaceOutlineEditPart();
    } else if (model instanceof TableSet) {
        editPart = new TableSetOutlineEditPart();
    } else if (model instanceof IndexSet) {
        editPart = new IndexSetOutlineEditPart();
    } else if (model instanceof ERIndex) {
        editPart = new IndexOutlineEditPart();
    }
    if (editPart != null) {
        editPart.setModel(model);
        ((FilteringEditPart) editPart).setFilterText(filterText);
    } else {
        System.out.println("error");
    }
    return editPart;
}
 
Example 12
Source File: ERDiagramEditPartFactory.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
public EditPart createEditPart(EditPart context, Object model) {
    EditPart editPart = null;
    if (model instanceof ERVirtualDiagram) {
        editPart = new ERVirtualDiagramEditPart();
    } else if (model instanceof ERVirtualTable) {
        editPart = new ERVirtualTableEditPart();
    } else if (model instanceof ERTable) {
        editPart = new ERTableEditPart();
    } else if (model instanceof ERView) {
        editPart = new ViewEditPart();
    } else if (model instanceof ERDiagram) {
        editPart = new ERDiagramEditPart();
    } else if (model instanceof Relationship) {
        editPart = new RelationEditPart();
    } else if (model instanceof WalkerNote) {
        editPart = new WalkerNoteEditPart();
    } else if (model instanceof ERIndex) {
        editPart = new IndexEditPart();
    } else if (model instanceof ModelProperties) {
        editPart = new ModelPropertiesEditPart();
    } else if (model instanceof CommentConnection) {
        editPart = new CommentConnectionEditPart();
    } else if (model instanceof Category) {
        editPart = new CategoryEditPart();
    } else if (model instanceof NormalColumn) {
        editPart = new NormalColumnEditPart();
    } else if (model instanceof ColumnGroup) {
        editPart = new GroupColumnEditPart();
    } else if (model instanceof InsertedImage) {
        editPart = new InsertedImageEditPart();
    } else if (model instanceof WalkerGroup) {
        editPart = new WalkerGroupEditPart();
    }
    if (editPart != null) {
        editPart.setModel(model);
    } else {
        System.out.println("error");
    }
    return editPart;
}
 
Example 13
Source File: ERDiagramOutlineEditPartFactory.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public EditPart createEditPart(EditPart context, Object model) {
	EditPart editPart = null;

	if (model instanceof ERModel) {
		editPart = new ERModelOutlineEditPart();
	} else if (model instanceof ERModelSet) {
		editPart = new ERModelSetOutlineEditPart();

	} else if (model instanceof ERTable) {
		editPart = new TableOutlineEditPart(quickMode);
		tableParts.put(((ERTable) model).getLogicalName(), editPart);

	} else if (model instanceof ERDiagram) {
		editPart = new ERDiagramOutlineEditPart(quickMode);

	} else if (model instanceof Relation) {
		editPart = new RelationOutlineEditPart();

	} else if (model instanceof Word) {
		editPart = new WordOutlineEditPart();

	} else if (model instanceof Dictionary) {
		editPart = new DictionaryOutlineEditPart();

	} else if (model instanceof ColumnGroup) {
		editPart = new GroupOutlineEditPart();

	} else if (model instanceof GroupSet) {
		editPart = new GroupSetOutlineEditPart();

	} else if (model instanceof SequenceSet) {
		editPart = new SequenceSetOutlineEditPart();

	} else if (model instanceof Sequence) {
		editPart = new SequenceOutlineEditPart();

	} else if (model instanceof ViewSet) {
		editPart = new ViewSetOutlineEditPart();

	} else if (model instanceof View) {
		editPart = new ViewOutlineEditPart();

	} else if (model instanceof TriggerSet) {
		editPart = new TriggerSetOutlineEditPart();

	} else if (model instanceof Trigger) {
		editPart = new TriggerOutlineEditPart();

	} else if (model instanceof TablespaceSet) {
		editPart = new TablespaceSetOutlineEditPart();

	} else if (model instanceof Tablespace) {
		editPart = new TablespaceOutlineEditPart();

	} else if (model instanceof TableSet) {
		editPart = new TableSetOutlineEditPart();

	} else if (model instanceof IndexSet) {
		editPart = new IndexSetOutlineEditPart();

	} else if (model instanceof Index) {
		editPart = new IndexOutlineEditPart();
	}

	if (editPart != null) {
		editPart.setModel(model);
		((FilteringEditPart)editPart).setFilterText(filterText);
	} else {
		System.out.println("error");
	}

	return editPart;
}
 
Example 14
Source File: ERDiagramEditPartFactory.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public EditPart createEditPart(EditPart context, Object model) {
	EditPart editPart = null;

	if (model instanceof ERModel) {
		editPart = new ERModelEditPart();
	} else if (model instanceof ERVirtualTable) {
		editPart = new ERVirtualTableEditPart();
	} else if (model instanceof ERTable) {
		editPart = new ERTableEditPart();

	} else if (model instanceof View) {
		editPart = new ViewEditPart();

	} else if (model instanceof ERDiagram) {
		editPart = new ERDiagramEditPart();

	} else if (model instanceof Relation) {
		editPart = new RelationEditPart();

	} else if (model instanceof Note) {
		editPart = new NoteEditPart();

	} else if (model instanceof Index) {
		editPart = new IndexEditPart();

	} else if (model instanceof ModelProperties) {
		editPart = new ModelPropertiesEditPart();

	} else if (model instanceof CommentConnection) {
		editPart = new CommentConnectionEditPart();

	} else if (model instanceof Category) {
		editPart = new CategoryEditPart();

	} else if (model instanceof RemovedERTable) {
		editPart = new RemovedERTableEditPart();

	} else if (model instanceof RemovedNote) {
		editPart = new RemovedNoteEditPart();

	} else if (model instanceof NormalColumn) {
		editPart = new NormalColumnEditPart();

	} else if (model instanceof ColumnGroup) {
		editPart = new GroupColumnEditPart();

	} else if (model instanceof InsertedImage) {
		editPart = new InsertedImageEditPart();

	} else if (model instanceof VGroup) {
		editPart = new VGroupEditPart();

	}

	if (editPart != null) {
		editPart.setModel(model);
	} else {
		System.out.println("error");
	}

	return editPart;
}