Search in sources :

Example 1 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project tdi-studio-se by Talend.

the class RowGeneratorComponent method open.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.core.model.components.IExternalComponent#open()
     */
@Override
public int open(final Composite parent) {
    initRowGeneratorMain();
    rowGeneratorMain.createModelFromExternalData(getIODataComponents(), getMetadataList(), externalData, true);
    Dialog dialog = rowGeneratorMain.createRowGeneratorDialog(parent.getShell());
    dialog.open();
    return rowGeneratorMain.getMapperDialogResponse();
}
Also used : Dialog(org.eclipse.jface.dialogs.Dialog)

Example 2 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project tdi-studio-se by Talend.

the class AbstractElementPropertySectionController method openSQLBuilder.

/**
     * DOC qzhang Comment method "openSQLBuilder".
     *
     * @param repositoryType
     * @param propertyName
     * @param query
     */
protected String openSQLBuilder(String repositoryType, String propertyName, String query) {
    if (repositoryType.equals(EmfComponent.BUILTIN)) {
        connParameters.setQuery(query);
        if (connParameters.isShowConfigParamDialog()) {
            if (!isUseExistingConnection()) {
                initConnectionParametersWithContext(elem, part.getProcess().getContextManager().getDefaultContext());
            } else {
                initConnectionParametersWithContext(connectionNode, part.getProcess().getContextManager().getDefaultContext());
            }
        }
        // add for bug TDI-20335
        if (part == null) {
            Shell parentShell = new Shell(composite.getShell().getDisplay());
            ISQLBuilderService service = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
            Dialog sqlBuilder = service.openSQLBuilderDialog(parentShell, "", connParameters);
            sqlBuilder.open();
        } else {
            openSqlBuilderBuildIn(connParameters, propertyName);
        }
    } else if (repositoryType.equals(EmfComponent.REPOSITORY)) {
        //$NON-NLS-1$
        String repositoryName2 = "";
        String repositoryId = null;
        IElementParameter memoParam = elem.getElementParameter(propertyName);
        IElementParameter repositoryParam = null;
        for (IElementParameter param : elem.getElementParameters()) {
            if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE && param.getRepositoryValue().startsWith("DATABASE")) {
                repositoryParam = param;
                break;
            }
        }
        // in case no database property found, take the first property (to keep compatibility with old code)
        if (repositoryParam == null) {
            for (IElementParameter param : elem.getElementParameters()) {
                if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
                    repositoryParam = param;
                    break;
                }
            }
        }
        if (repositoryParam != null) {
            IElementParameter itemFromRepository = repositoryParam.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
            String value = (String) itemFromRepository.getValue();
            repositoryId = value;
            // for (String key : this.dynamicProperty.getRepositoryConnectionItemMap().keySet()) {
            // if (key.equals(value)) {
            // repositoryName2 =
            // this.dynamicProperty.getRepositoryConnectionItemMap().get(key).getProperty().getLabel();
            // }
            // }
            /* get connection item dynamictly,not from cache ,see 16969 */
            IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
            try {
                IRepositoryViewObject repobj = factory.getLastVersion(value);
                if (repobj != null) {
                    Property property = repobj.getProperty();
                    if (property != null) {
                        repositoryName2 = property.getLabel();
                    }
                }
            } catch (PersistenceException e) {
                ExceptionHandler.process(e);
            }
        }
        // When no repository avaiable on "Repository" mode, open a MessageDialog.
        if (repositoryName2 == null || repositoryName2.length() == 0) {
            MessageDialog.openError(composite.getShell(), Messages.getString("NoRepositoryDialog.Title"), //$NON-NLS-1$
            Messages.getString(//$NON-NLS-1$
            "NoRepositoryDialog.Text"));
            return null;
        }
        // Part maybe not exist
        //$NON-NLS-1$
        String processName = "";
        //$NON-NLS-1$
        String key = "";
        if (elem instanceof Node) {
            processName = ((Node) elem).getProcess().getName();
            key = processName + ((Node) elem).getUniqueName();
        } else if (elem instanceof IProcess) {
            processName = ((IProcess) elem).getName();
            key = processName;
        }
        key += repositoryName2;
        final Dialog builderDialog = sqlbuilers.get(key);
        if (!composite.isDisposed() && builderDialog != null && builderDialog.getShell() != null && !builderDialog.getShell().isDisposed()) {
            builderDialog.getShell().setActive();
        } else {
            connParameters.setRepositoryName(repositoryName2);
            if (repositoryId != null) {
                connParameters.setRepositoryId(repositoryId);
            }
            Shell parentShell = new Shell(composite.getShell().getDisplay());
            String nodeLabel = null;
            if (elem instanceof Node) {
                nodeLabel = (String) ((Node) elem).getElementParameter(EParameterName.LABEL.getName()).getValue();
            }
            TextUtil.setDialogTitle(processName, nodeLabel, elem.getElementName());
            ISQLBuilderService service = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
            connParameters.setQuery(query);
            // first open Sql Builder,set true
            connParameters.setFirstOpenSqlBuilder(true);
            Dialog sqlBuilder = service.openSQLBuilderDialog(parentShell, processName, connParameters);
            sqlbuilers.put(key, sqlBuilder);
            if (Window.OK == sqlBuilder.open()) {
                if (!composite.isDisposed() && !connParameters.isNodeReadOnly()) {
                    String sql = connParameters.getQuery();
                    // modified by hyWang
                    if (!connParameters.getIfContextButtonCheckedFromBuiltIn()) {
                        sql = QueryUtil.checkAndAddQuotes(sql);
                    }
                    return sql;
                }
            }
        }
    }
    return null;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Dialog(org.eclipse.jface.dialogs.Dialog) ModelSelectionDialog(org.talend.commons.ui.swt.dialogs.ModelSelectionDialog) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) Node(org.talend.designer.core.ui.editor.nodes.Node) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IElementParameter(org.talend.core.model.process.IElementParameter) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Property(org.talend.core.model.properties.Property) IProcess(org.talend.core.model.process.IProcess) ISQLBuilderService(org.talend.core.ui.services.ISQLBuilderService) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 3 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project cubrid-manager by CUBRID.

the class PropertyAction method run.

/**
	 * Open property dialog,view and set property
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    final ICubridNode node = (ICubridNode) obj[0];
    String type = node.getType();
    if (CubridNodeType.SERVER.equals(type) || CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type) || CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
        TaskExecutor taskExcutor = new GetPropertyExecutor(node, getShell());
        ServerInfo serverInfo = node.getServer().getServerInfo();
        GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
        GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
        GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
        if (CubridNodeType.SERVER.equals(type)) {
            taskExcutor.addTask(getCubridConfParameterTask);
            taskExcutor.addTask(getBrokerConfParameterTask);
            taskExcutor.addTask(getCMConfParameterTask);
            if (CompatibleUtil.isSupportNewHAConfFile(serverInfo)) {
                GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
                taskExcutor.addTask(getHAConfParameterTask);
            }
        }
        if (CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type)) {
            taskExcutor.addTask(getCubridConfParameterTask);
        }
        if (CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
            taskExcutor.addTask(getBrokerConfParameterTask);
        }
        new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    }
    if (!isCancel) {
        Dialog dialog = PreferenceUtil.createPropertyDialog(getShell(), node);
        dialog.open();
    }
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) Dialog(org.eclipse.jface.dialogs.Dialog) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetBrokerConfParameterTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask)

Example 4 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project translationstudio8 by heartsome.

the class ConfigureColumnsAction method run.

/**
     * {@inheritDoc}
     */
public void run() {
    save();
    Dialog confColsDialog = new Dialog(Display.getCurrent().getActiveShell()) {

        @Override
        protected Control createDialogArea(Composite parent) {
            return createColumnControlPanel(parent);
        }
    };
    int result = confColsDialog.open();
    if (result == Dialog.CANCEL) {
        restore();
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Dialog(org.eclipse.jface.dialogs.Dialog)

Example 5 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project pentaho-kettle by pentaho.

the class CommonStepDialog method openDialog.

protected void openDialog(final String title, final String message, final int dialogType) {
    final Dialog dialog = new SimpleMessageDialog(shell, title, message, dialogType);
    dialog.open();
}
Also used : SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) BaseStepDialog(org.pentaho.di.ui.trans.step.BaseStepDialog) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Dialog(org.eclipse.jface.dialogs.Dialog)

Aggregations

Dialog (org.eclipse.jface.dialogs.Dialog)49 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)15 FileDialog (org.eclipse.swt.widgets.FileDialog)11 Composite (org.eclipse.swt.widgets.Composite)9 ArrayList (java.util.ArrayList)8 WizardDialog (org.eclipse.jface.wizard.WizardDialog)8 Control (org.eclipse.swt.widgets.Control)7 Shell (org.eclipse.swt.widgets.Shell)7 GridData (org.eclipse.swt.layout.GridData)6 Button (org.eclipse.swt.widgets.Button)6 ITextSelection (org.eclipse.jface.text.ITextSelection)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 IStructuredCleanupProcessor (org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor)5 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)5 File (java.io.File)4 Client (name.abuchen.portfolio.model.Client)4 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)4 List (java.util.List)3 SWT (org.eclipse.swt.SWT)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3