Search in sources :

Example 1 with ErdiagramDiagramEditor

use of org.talend.sqlbuilder.erdiagram.ui.editor.ErdiagramDiagramEditor in project tdi-studio-se by Talend.

the class ErDiagramComposite method addErDiagramEditor.

/**
     * admin Comment method "addErDiagramEditor".
     */
//$NON-NLS-1$
@SuppressWarnings("unchecked")
private void addErDiagramEditor(boolean isShowDesignerPage) {
    GridData gridData = new GridData(GridData.FILL_BOTH);
    this.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginBottom = 0;
    layout.marginTop = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 1;
    this.setLayout(layout);
    editor = new ErdiagramDiagramEditor();
    editor.createPartControl(this);
    editor.getViewer().setContents(createErDiagram(isShowDesignerPage));
    Control control = editor.getGraphicalControl();
    if (control != null) {
        control.setParent(this);
        control.setLayoutData(gridData);
    }
    layout = new GridLayout();
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginBottom = 0;
    layout.marginTop = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 30;
    int textstyle = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
    sqlText = new ColorStyledText(this, textstyle, CorePlugin.getDefault().getPreferenceStore(), language);
    sqlText.setLayoutData(gridData);
    //$NON-NLS-1$
    sqlText.setText("");
    sqlText.setBackground(getBackground());
    sqlText.addModifyListener(new ModifyListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
             */
        public void modifyText(ModifyEvent e) {
            sqlString = sqlText.getText();
        }
    });
}
Also used : ErdiagramDiagramEditor(org.talend.sqlbuilder.erdiagram.ui.editor.ErdiagramDiagramEditor) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) ColorStyledText(org.talend.commons.ui.swt.colorstyledtext.ColorStyledText)

Example 2 with ErdiagramDiagramEditor

use of org.talend.sqlbuilder.erdiagram.ui.editor.ErdiagramDiagramEditor in project tdi-studio-se by Talend.

the class TableAddAction method run.

/*
     * (non-Java)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
//$NON-NLS-1$
@SuppressWarnings("unchecked")
@Override
public void run() {
    ErdiagramDiagramEditor erdiagramDiagramEditor = (ErdiagramDiagramEditor) part;
    Control control = erdiagramDiagramEditor.getGraphicalControl();
    AddTablesDialog dialog = new AddTablesDialog(new Shell(control.getShell()));
    if (control.getParent() instanceof ErDiagramComposite) {
        if (EMFRepositoryNodeManager.getInstance().getRoot() == null) {
            return;
        }
        dialog.setRootNode(EMFRepositoryNodeManager.getInstance().getRoot());
    }
    if (Window.OK == dialog.open()) {
        List tables1 = dialog.getTables();
        this.execute(createCreateCommand((ErDiagram) erdiagramDiagramEditor.getViewer().getContents().getModel(), tables1));
    }
}
Also used : ErdiagramDiagramEditor(org.talend.sqlbuilder.erdiagram.ui.editor.ErdiagramDiagramEditor) ErDiagramComposite(org.talend.sqlbuilder.erdiagram.ui.ErDiagramComposite) Control(org.eclipse.swt.widgets.Control) Shell(org.eclipse.swt.widgets.Shell) ErDiagram(org.talend.sqlbuilder.erdiagram.ui.nodes.ErDiagram) AddTablesDialog(org.talend.sqlbuilder.erdiagram.ui.AddTablesDialog) List(java.util.List)

Aggregations

Control (org.eclipse.swt.widgets.Control)2 ErdiagramDiagramEditor (org.talend.sqlbuilder.erdiagram.ui.editor.ErdiagramDiagramEditor)2 List (java.util.List)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Shell (org.eclipse.swt.widgets.Shell)1 ColorStyledText (org.talend.commons.ui.swt.colorstyledtext.ColorStyledText)1 AddTablesDialog (org.talend.sqlbuilder.erdiagram.ui.AddTablesDialog)1 ErDiagramComposite (org.talend.sqlbuilder.erdiagram.ui.ErDiagramComposite)1 ErDiagram (org.talend.sqlbuilder.erdiagram.ui.nodes.ErDiagram)1