Search in sources :

Example 1 with ERSchema

use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.

the class CreateRelationshipCommand method execute.

@Override
public void execute() {
    if (!check()) {
        return;
    }
    ERSchema erSchema = foreignTable.getERSchema();
    SchemaInfo fkSchemaInfo = erSchema.getSchemaInfo(foreignTable.getName());
    AddFKDialog dlg = new AddFKDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), erSchema.getCubridDatabase(), fkSchemaInfo, null, false, erSchema.getAllSchemaInfo());
    dlg.setDefaultTableName(primaryTable.getName());
    int returnCode = dlg.open();
    if (returnCode == AddFKDialog.OK) {
        Constraint fk = dlg.getRetFK();
        if (fk == null) {
            return;
        }
        CubridTableParser parser = new CubridTableParser(erSchema);
        try {
            parser.addFKShip(foreignTable, fkSchemaInfo, fk);
            fkSchemaInfo.addConstraint(fk);
        } catch (Exception e) {
            CommonUITool.openErrorBox(e.getMessage());
        }
    }
}
Also used : Constraint(com.cubrid.common.core.common.model.Constraint) ERSchema(com.cubrid.common.ui.er.model.ERSchema) CubridTableParser(com.cubrid.common.ui.er.model.CubridTableParser) Constraint(com.cubrid.common.core.common.model.Constraint) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo) AddFKDialog(com.cubrid.common.ui.cubrid.table.dialog.AddFKDialog)

Example 2 with ERSchema

use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.

the class FlyoutChangeLayoutAction method run.

public void run() {
    if (editor instanceof ERSchemaEditor) {
        ERSchemaEditor erSchemaEditor = (ERSchemaEditor) editor;
        ERSchema erSchema = erSchemaEditor.getSchema();
        boolean isManual = erSchema.isLayoutManualDesired();
        erSchema.setLayoutManualDesiredAndFire(!isManual);
        checked = !isManual;
        setChecked(checked);
    }
}
Also used : ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) ERSchema(com.cubrid.common.ui.er.model.ERSchema)

Example 3 with ERSchema

use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.

the class FlyoutChangeLayoutAction method isChecked.

public boolean isChecked(IEditorPart editor) {
    if (editor instanceof ERSchemaEditor) {
        ERSchemaEditor erSchemaEditor = (ERSchemaEditor) editor;
        ERSchema erSchema = erSchemaEditor.getSchema();
        boolean checkTrue = erSchema.isLayoutManualDesired();
        return (!checkTrue);
    } else {
        return false;
    }
}
Also used : ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) ERSchema(com.cubrid.common.ui.er.model.ERSchema)

Example 4 with ERSchema

use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.

the class DelegatingLayoutManager method layout.

public void layout(IFigure container) {
    ERSchema erSchema = diagram.getSchema();
    if (erSchema.isLayoutManualDesired()) {
        if (activeLayoutManager != xyLayoutManager) {
            if (erSchema.isLayoutManualAllowed()) {
                setLayoutManager(container, xyLayoutManager);
                activeLayoutManager.layout(container);
            } else {
                if (diagram.setTableFigureBounds(true)) {
                    setLayoutManager(container, xyLayoutManager);
                    activeLayoutManager.layout(container);
                } else {
                    activeLayoutManager.layout(container);
                    setLayoutManager(container, xyLayoutManager);
                }
            }
        } else {
            setLayoutManager(container, xyLayoutManager);
            activeLayoutManager.layout(container);
        }
    } else {
        setLayoutManager(container, erGraphLayoutManager);
        activeLayoutManager.layout(container);
    }
}
Also used : ERSchema(com.cubrid.common.ui.er.model.ERSchema)

Example 5 with ERSchema

use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.

the class ERSchemaEditor method initializeGraphicalViewer.

protected void initializeGraphicalViewer() {
    IEditorInput input = this.getEditorInput();
    if (input instanceof ICubridNode) {
        ICubridNode node = (ICubridNode) input;
        ERSchema erSchema = (ERSchema) node.getAdapter(ERSchema.class);
        getGraphicalViewer().setContents(erSchema);
    }
}
Also used : ERSchema(com.cubrid.common.ui.er.model.ERSchema) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) IEditorInput(org.eclipse.ui.IEditorInput)

Aggregations

ERSchema (com.cubrid.common.ui.er.model.ERSchema)16 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)6 ERTable (com.cubrid.common.ui.er.model.ERTable)5 Constraint (com.cubrid.common.core.common.model.Constraint)3 ERSchemaEditor (com.cubrid.common.ui.er.editor.ERSchemaEditor)3 CubridTableParser (com.cubrid.common.ui.er.model.CubridTableParser)3 ERTableColumn (com.cubrid.common.ui.er.model.ERTableColumn)3 List (java.util.List)3 ArrayList (java.util.ArrayList)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 DBAttribute (com.cubrid.common.core.common.model.DBAttribute)1 SerialInfo (com.cubrid.common.core.common.model.SerialInfo)1 AddFKDialog (com.cubrid.common.ui.cubrid.table.dialog.AddFKDialog)1 ERException (com.cubrid.common.ui.er.ERException)1 SchemaEditorInput (com.cubrid.common.ui.er.SchemaEditorInput)1 AddTableCommand (com.cubrid.common.ui.er.commands.AddTableCommand)1 DeleteTableCommand (com.cubrid.common.ui.er.commands.DeleteTableCommand)1 ERSchemaTableNodesLoader (com.cubrid.common.ui.er.loader.ERSchemaTableNodesLoader)1 PhysicalLogicRelation (com.cubrid.common.ui.er.logic.PhysicalLogicRelation)1 Relationship (com.cubrid.common.ui.er.model.Relationship)1