Search in sources :

Example 1 with ValidationGraphicalViewer

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

the class ERSchemaEditor method createGraphicalViewer.

private ScrollingGraphicalViewer createGraphicalViewer(IEditorSite editorSite, Composite parent) {
    StatusLineValidationMessageHandler messageHandler = new StatusLineValidationMessageHandler(editorSite);
    ScrollingGraphicalViewer viewer = new ValidationGraphicalViewer(messageHandler);
    viewer.createControl(parent);
    viewer.getControl().setBackground(ColorConstants.white);
    viewer.setRootEditPart(new ERScalableFreeformRootEditPart());
    viewer.setEditPartFactory(new PartFactory());
    viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(10, 10));
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_ORIGIN, new Point(5, 5));
    return viewer;
}
Also used : ScrollingGraphicalViewer(org.eclipse.gef.ui.parts.ScrollingGraphicalViewer) ValidationGraphicalViewer(com.cubrid.common.ui.er.ValidationGraphicalViewer) StatusLineValidationMessageHandler(com.cubrid.common.ui.er.directedit.StatusLineValidationMessageHandler) PartFactory(com.cubrid.common.ui.er.part.PartFactory) GraphicalViewerKeyHandler(org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler) Dimension(org.eclipse.draw2d.geometry.Dimension) Point(org.eclipse.draw2d.geometry.Point)

Example 2 with ValidationGraphicalViewer

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

the class ColumnPart method createDirectEditManager.

private void createDirectEditManager() {
    if (manager == null) {
        ValidationGraphicalViewer viewer = (ValidationGraphicalViewer) getViewer();
        ValidationMessageHandler handler = viewer.getValidationHandler();
        Label label = (Label) getFigure();
        ColumnNameTypeCellEditorValidator columnNameTypeCellEditorValidator = new ColumnNameTypeCellEditorValidator(handler, (ERTableColumn) getModel());
        manager = new ERDirectEditManager(label, columnNameTypeCellEditorValidator, this, TextCellEditor.class, new LabelCellEditorLocator(label));
    }
}
Also used : ValidationGraphicalViewer(com.cubrid.common.ui.er.ValidationGraphicalViewer) ERDirectEditManager(com.cubrid.common.ui.er.directedit.ERDirectEditManager) LabelCellEditorLocator(com.cubrid.common.ui.er.directedit.LabelCellEditorLocator) ValidationMessageHandler(com.cubrid.common.ui.er.ValidationMessageHandler) EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) Label(org.eclipse.draw2d.Label) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ColumnNameTypeCellEditorValidator(com.cubrid.common.ui.er.directedit.ColumnNameTypeCellEditorValidator)

Example 3 with ValidationGraphicalViewer

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

the class TablePart method performDirectEdit.

protected void performDirectEdit() {
    if (manager == null) {
        ValidationGraphicalViewer viewer = (ValidationGraphicalViewer) getViewer();
        ValidationMessageHandler handler = viewer.getValidationHandler();
        TableFigure figure = (TableFigure) getFigure();
        EditableLabel nameLabel = figure.getNameLabel();
        manager = new ERDirectEditManager(nameLabel, new TableNameCellEditorValidator(handler), this, TableNameCellEditor.class, new LabelCellEditorLocator(nameLabel));
    }
    manager.show();
}
Also used : ValidationGraphicalViewer(com.cubrid.common.ui.er.ValidationGraphicalViewer) TableFigure(com.cubrid.common.ui.er.figures.TableFigure) EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) ERDirectEditManager(com.cubrid.common.ui.er.directedit.ERDirectEditManager) LabelCellEditorLocator(com.cubrid.common.ui.er.directedit.LabelCellEditorLocator) ValidationMessageHandler(com.cubrid.common.ui.er.ValidationMessageHandler) TableNameCellEditor(com.cubrid.common.ui.er.editor.TableNameCellEditor) TableNameCellEditorValidator(com.cubrid.common.ui.er.directedit.TableNameCellEditorValidator)

Example 4 with ValidationGraphicalViewer

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

the class SchemaDiagramPart method getEditor.

public ERSchemaEditor getEditor() {
    EditPart parentP = getParent();
    if (parentP instanceof ScalableFreeformRootEditPart) {
        ScalableFreeformRootEditPart parentEditor = (ScalableFreeformRootEditPart) parentP;
        EditPartViewer viewer = parentEditor.getViewer();
        if (viewer instanceof ValidationGraphicalViewer) {
            ValidationGraphicalViewer gViewer = (ValidationGraphicalViewer) viewer;
            EditDomain domain = gViewer.getEditDomain();
            if (domain instanceof ERSchemaEditDomain) {
                ERSchemaEditDomain erEditorDomain = (ERSchemaEditDomain) domain;
                return (ERSchemaEditor) erEditorDomain.getEditorPart();
            }
        }
    }
    return null;
}
Also used : ValidationGraphicalViewer(com.cubrid.common.ui.er.ValidationGraphicalViewer) EditDomain(org.eclipse.gef.EditDomain) ERSchemaEditDomain(com.cubrid.common.ui.er.editor.ERSchemaEditDomain) ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) EditPart(org.eclipse.gef.EditPart) ERSchemaEditDomain(com.cubrid.common.ui.er.editor.ERSchemaEditDomain) EditPartViewer(org.eclipse.gef.EditPartViewer)

Aggregations

ValidationGraphicalViewer (com.cubrid.common.ui.er.ValidationGraphicalViewer)4 ValidationMessageHandler (com.cubrid.common.ui.er.ValidationMessageHandler)2 ERDirectEditManager (com.cubrid.common.ui.er.directedit.ERDirectEditManager)2 LabelCellEditorLocator (com.cubrid.common.ui.er.directedit.LabelCellEditorLocator)2 EditableLabel (com.cubrid.common.ui.er.figures.EditableLabel)2 ColumnNameTypeCellEditorValidator (com.cubrid.common.ui.er.directedit.ColumnNameTypeCellEditorValidator)1 StatusLineValidationMessageHandler (com.cubrid.common.ui.er.directedit.StatusLineValidationMessageHandler)1 TableNameCellEditorValidator (com.cubrid.common.ui.er.directedit.TableNameCellEditorValidator)1 ERSchemaEditDomain (com.cubrid.common.ui.er.editor.ERSchemaEditDomain)1 ERSchemaEditor (com.cubrid.common.ui.er.editor.ERSchemaEditor)1 TableNameCellEditor (com.cubrid.common.ui.er.editor.TableNameCellEditor)1 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)1 PartFactory (com.cubrid.common.ui.er.part.PartFactory)1 Label (org.eclipse.draw2d.Label)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 Point (org.eclipse.draw2d.geometry.Point)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