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());
}
}
}
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);
}
}
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;
}
}
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);
}
}
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);
}
}
Aggregations