Search in sources :

Example 1 with ERSchemaEditor

use of com.cubrid.common.ui.er.editor.ERSchemaEditor 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 2 with ERSchemaEditor

use of com.cubrid.common.ui.er.editor.ERSchemaEditor 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 3 with ERSchemaEditor

use of com.cubrid.common.ui.er.editor.ERSchemaEditor in project cubrid-manager by CUBRID.

the class AbstractBasicPart method postSchemaDataChanged.

public void postSchemaDataChanged(PropertyChangeEvent evt) {
    String property = evt.getPropertyName();
    boolean isDataChanged = PropertyChangeProvider.CHILD_CHANGE.equals(property) | PropertyChangeProvider.OUTPUT_CHANGE.equals(property) | PropertyChangeProvider.INPUT_CHANGE.equals(property) | PropertyChangeProvider.TEXT_CHANGE.equals(property);
    if (!isDataChanged) {
        return;
    }
    IWorkbenchPage page = getActivePage();
    if (page == null) {
        return;
    }
    IEditorPart editor = page.getActiveEditor();
    if (editor instanceof ERSchemaEditor) {
        ERSchemaEditor erEditor = (ERSchemaEditor) editor;
        erEditor.setDirty(true);
    }
}
Also used : ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 4 with ERSchemaEditor

use of com.cubrid.common.ui.er.editor.ERSchemaEditor in project cubrid-manager by CUBRID.

the class SchemaContainerEditPolicy method getCreateCommand.

@Override
protected Command getCreateCommand(CreateRequest request) {
    Object newObject = request.getNewObject();
    if (!(newObject instanceof ERTable)) {
        return null;
    }
    Point location = request.getLocation();
    SchemaDiagramPart schemaPart = (SchemaDiagramPart) getHost();
    ERSchema erSchema = schemaPart.getSchema();
    ERTable erTable = (ERTable) newObject;
    ERSchemaEditor editor = schemaPart.getEditor();
    int offsetX = 0;
    int offsetY = 0;
    if (editor != null) {
        offsetX = editor.getHorizontalScrollWidth();
        offsetY = editor.getVerticalScrollHeight();
    }
    erTable.setBounds(new Rectangle(location.x + offsetX, location.y + offsetY, erTable.getMinWidth(), erTable.getMinHeight()));
    AddTableCommand addTableCommand = new AddTableCommand();
    addTableCommand.setSchema(erSchema);
    SchemaInfo schemaInfo = ERTable.createEmptySchemaInfo(erTable.getName(), erTable.getCubridDatabase().getName());
    addTableCommand.setTable(erTable, schemaInfo);
    return addTableCommand;
}
Also used : SchemaDiagramPart(com.cubrid.common.ui.er.part.SchemaDiagramPart) AddTableCommand(com.cubrid.common.ui.er.commands.AddTableCommand) ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) ERSchema(com.cubrid.common.ui.er.model.ERSchema) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable) Point(org.eclipse.draw2d.geometry.Point) Point(org.eclipse.draw2d.geometry.Point) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 5 with ERSchemaEditor

use of com.cubrid.common.ui.er.editor.ERSchemaEditor in project cubrid-manager by CUBRID.

the class SchemaDiagramPart method moveLastTableLocationFocus.

public boolean moveLastTableLocationFocus() {
    TablePart bottomRightT = getBottomRightTable();
    ERSchemaEditor editor = getEditor();
    if (bottomRightT != null && editor != null) {
        IFigure figure = bottomRightT.getFigure();
        Point point = figure.getBounds().getBottomRight();
        editor.setLocatePoint(point.x, point.y + 160);
        // 160 is the distance between ERD canvas top and the CM/CQB app top
        return true;
    }
    return false;
}
Also used : ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

ERSchemaEditor (com.cubrid.common.ui.er.editor.ERSchemaEditor)6 ERSchema (com.cubrid.common.ui.er.model.ERSchema)3 Point (org.eclipse.draw2d.geometry.Point)2 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)1 ValidationGraphicalViewer (com.cubrid.common.ui.er.ValidationGraphicalViewer)1 AddTableCommand (com.cubrid.common.ui.er.commands.AddTableCommand)1 ERSchemaEditDomain (com.cubrid.common.ui.er.editor.ERSchemaEditDomain)1 ERTable (com.cubrid.common.ui.er.model.ERTable)1 SchemaDiagramPart (com.cubrid.common.ui.er.part.SchemaDiagramPart)1 IFigure (org.eclipse.draw2d.IFigure)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 EditDomain (org.eclipse.gef.EditDomain)1 EditPart (org.eclipse.gef.EditPart)1 EditPartViewer (org.eclipse.gef.EditPartViewer)1 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1