Search in sources :

Example 1 with AlfrescoModelDialog

use of org.talend.designer.alfrescooutput.ui.AlfrescoModelDialog in project tdi-studio-se by Talend.

the class AlfrescoOutputManager method createUI.

/**
     * Checks the connections and creates the UI (a dialog actually)
     * 
     * @param parent
     * @return
     */
public AlfrescoModelDialog createUI(Composite parent) {
    IConnection inConn = null;
    AbstractNode connector = this.alfrescoOutputComponent;
    for (IConnection conn : connector.getIncomingConnections()) {
        if ((conn.getLineStyle().equals(EConnectionType.FLOW_MAIN)) || (conn.getLineStyle().equals(EConnectionType.FLOW_REF))) {
            inConn = conn;
            break;
        }
    }
    if (inConn != null) {
        if (!inConn.getMetadataTable().sameMetadataAs(connector.getMetadataList().get(0))) {
            MessageBox messageBox = new MessageBox(parent.getShell(), SWT.APPLICATION_MODAL | SWT.OK);
            //$NON-NLS-1$
            messageBox.setText(Messages.getString("AlfrescoOutputManager.schemaError.title"));
            //$NON-NLS-1$
            messageBox.setMessage(Messages.getString("AlfrescoOutputManager.schemaError.msg"));
            if (messageBox.open() == SWT.OK) {
                ((Shell) parent).close();
                return null;
            }
        }
    }
    // first load the model :
    try {
        // NB. or when modelManager is created
        modelManager.load();
    } catch (AlfrescoOutputException aoex) {
        MessageDialog.openError(new Shell(Display.getCurrent(), SWT.APPLICATION_MODAL), Messages.getString("AlfrescoOutputManager.failedLoadModel"), //$NON-NLS-1$
        aoex.getMessage());
        modelManager.clear();
    }
    // then create and open the model dialog :
    AlfrescoModelDialog alfrescoModelDialog = new AlfrescoModelDialog(parent.getShell(), this);
    alfrescoModelDialog.open();
    // NB. this dialog is non-blocking ; model save is done in its okPressed()
    return alfrescoModelDialog;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) AbstractNode(org.talend.core.model.process.AbstractNode) AlfrescoModelDialog(org.talend.designer.alfrescooutput.ui.AlfrescoModelDialog) IConnection(org.talend.core.model.process.IConnection) AlfrescoOutputException(org.talend.designer.alfrescooutput.util.AlfrescoOutputException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

MessageBox (org.eclipse.swt.widgets.MessageBox)1 Shell (org.eclipse.swt.widgets.Shell)1 AbstractNode (org.talend.core.model.process.AbstractNode)1 IConnection (org.talend.core.model.process.IConnection)1 AlfrescoModelDialog (org.talend.designer.alfrescooutput.ui.AlfrescoModelDialog)1 AlfrescoOutputException (org.talend.designer.alfrescooutput.util.AlfrescoOutputException)1