Search in sources :

Example 1 with DataClusterDialog

use of com.amalto.workbench.editors.DataClusterDialog in project tmdm-studio-se by Talend.

the class TestTriggerAction method doRun.

@Override
protected void doRun() {
    com.amalto.workbench.utils.MDMServerDef serverDef = getServerDef();
    if (serverDef == null) {
        return;
    }
    boolean canConnect = checkConnection(serverDef.getUrl(), serverDef.getUser(), serverDef.getPasswd());
    if (!canConnect) {
        MessageDialog.openError(getShell(), Messages.RoutingRuleMainPage2_CheckConnection, Messages.RoutingRuleMainPage2_UnableToConnect);
        return;
    }
    try {
        service = Util.getMDMService(new URL(serverDef.getUrl()), serverDef.getUser(), serverDef.getPasswd());
        IWorkbenchPartSite site = commonViewer.getCommonNavigator().getSite();
        dialog = new DataClusterDialog(getShell(), new TreeObject(), site);
        dialog.setDefaultServerDef(serverDef);
        dialog.setOkLabel(Messages.TestTriggerAction_Test);
        dialog.setCancelLabel(Messages.TestTriggerAction_Close);
        dialog.setSelectionListener(this);
        dialog.open();
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) TreeObject(com.amalto.workbench.models.TreeObject) URL(java.net.URL) DataClusterDialog(com.amalto.workbench.editors.DataClusterDialog)

Example 2 with DataClusterDialog

use of com.amalto.workbench.editors.DataClusterDialog in project tmdm-studio-se by Talend.

the class ComplexTableViewerR method creatTextPortion.

@Override
protected void creatTextPortion(Composite textParent, ComplexTableViewerColumn column) {
    Composite righComposite = toolkit.createComposite(textParent, SWT.NONE);
    righComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    righComposite.setLayout(layout);
    Button readRecordButton = toolkit.createButton(righComposite, Messages.ComplexTableViewerR_PickRecordFromContainer, SWT.PUSH | SWT.CENTER);
    readRecordButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            DataClusterDialog dialog = new DataClusterDialog(site.getShell(), new TreeObject(), site);
            dialog.create();
            Point size = dialog.getShell().getSize();
            Rectangle clientArea = Display.getCurrent().getClientArea();
            int locx = clientArea.x + (clientArea.width - size.x) / 2;
            int locy = clientArea.y + (clientArea.height - size.y) / 2;
            dialog.getShell().setLocation(locx, locy);
            if (dialog.open() == Dialog.OK) {
                String recordContent = dialog.getRecordContent();
                if (recordContent != null && recordContent.trim().length() > 0)
                    text.setText(recordContent);
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        // 
        }
    });
    readRecordButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
    super.creatTextPortion(righComposite, column);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Rectangle(org.eclipse.swt.graphics.Rectangle) TreeObject(com.amalto.workbench.models.TreeObject) Point(org.eclipse.swt.graphics.Point) SelectionListener(org.eclipse.swt.events.SelectionListener) DataClusterDialog(com.amalto.workbench.editors.DataClusterDialog)

Aggregations

DataClusterDialog (com.amalto.workbench.editors.DataClusterDialog)2 TreeObject (com.amalto.workbench.models.TreeObject)2 URL (java.net.URL)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Point (org.eclipse.swt.graphics.Point)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 IWorkbenchPartSite (org.eclipse.ui.IWorkbenchPartSite)1