Search in sources :

Example 31 with Dialog

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

the class ParallelExecutionAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    boolean hasFlowConnection = false;
    for (IConnection connection : node.getOutgoingConnections()) {
        if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
            hasFlowConnection = true;
            break;
        }
    }
    if (hasFlowConnection) {
        MessageDialog.openError(getWorkbenchPart().getSite().getShell(), Messages.getString(//$NON-NLS-1$
        "ParallelExecutionAction.gotLink"), //$NON-NLS-1$
        Messages.getString("ParallelExecutionAction.noOutputLink"));
        return;
    }
    IElementParameter enableParallelizeParameter = node.getElementParameter(EParameterName.PARALLELIZE.getName());
    if (enableParallelizeParameter != null) {
        parallelEnable = (Boolean) enableParallelizeParameter.getValue();
    }
    IElementParameter numberParallelizeParameter = node.getElementParameter(EParameterName.PARALLELIZE_NUMBER.getName());
    if (numberParallelizeParameter != null) {
        numberParallel = (String) numberParallelizeParameter.getValue();
    }
    Dialog dialog = new ParallelDialog(getWorkbenchPart().getSite().getShell());
    if (dialog.open() == Dialog.OK) {
        Command command = new PropertyChangeCommand(node, EParameterName.PARALLELIZE.getName(), parallelEnable);
        execute(command);
    }
}
Also used : PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Dialog(org.eclipse.jface.dialogs.Dialog) IElementParameter(org.talend.core.model.process.IElementParameter) IConnection(org.talend.core.model.process.IConnection)

Example 32 with Dialog

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

the class SqlMemoController method refreshConnectionCommand.

private Command refreshConnectionCommand() {
    // open sql builder in repository mode, just use query object, no need for connection information
    ConnectionParameters connParameters = new ConnectionParameters();
    String queryId = (String) elem.getPropertyValue(EParameterName.REPOSITORY_QUERYSTORE_TYPE.getName());
    Query query = MetadataToolHelper.getQueryFromRepository(queryId);
    DatabaseConnectionItem item = findRepositoryItem(queryId);
    if (item != null) {
        connParameters.setRepositoryName(item.getProperty().getLabel());
        connParameters.setRepositoryId(item.getProperty().getId());
    }
    connParameters.setQueryObject(query);
    connParameters.setQuery(query.getValue());
    TextUtil.setDialogTitle(TextUtil.SQL_BUILDER_TITLE_REP);
    String processName = null;
    if (elem instanceof IProcess) {
        processName = ((IProcess) elem).getName();
    } else if (elem instanceof INode) {
        processName = ((INode) elem).getProcess().getName();
    } else if (elem instanceof IConnection) {
        processName = ((IConnection) elem).getSource().getProcess().getName();
    }
    connParameters.setNodeReadOnly(false);
    connParameters.setFromRepository(true);
    ISQLBuilderService sqlBuilderService = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
    Dialog sqlBuilder = sqlBuilderService.openSQLBuilderDialog(composite.getShell(), processName, connParameters);
    String sql = null;
    if (Window.OK == sqlBuilder.open()) {
        sql = connParameters.getQuery();
    }
    if (sql != null && !queryText.isDisposed()) {
        queryText.setText(sql);
        String propertyName = (String) openSQLEditorButton.getData(PARAMETER_NAME);
        return new PropertyChangeCommand(elem, propertyName, sql);
    }
    return null;
}
Also used : INode(org.talend.core.model.process.INode) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) Query(org.talend.core.model.metadata.builder.connection.Query) ModelSelectionDialog(org.talend.commons.ui.swt.dialogs.ModelSelectionDialog) Dialog(org.eclipse.jface.dialogs.Dialog) ConnectionParameters(org.talend.core.sqlbuilder.util.ConnectionParameters) IConnection(org.talend.core.model.process.IConnection) IProcess(org.talend.core.model.process.IProcess) ISQLBuilderService(org.talend.core.ui.services.ISQLBuilderService) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem)

Example 33 with Dialog

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

the class Spoon method openFile.

public void openFile(String filename, boolean importfile) {
    // Open the XML and see what's in there.
    // We expect a single <transformation> or <job> root at this time...
    // does the file exist? If not, show an error dialog
    boolean fileExists = false;
    try {
        final FileObject file = KettleVFS.getFileObject(filename);
        fileExists = file.exists();
    } catch (final KettleFileException | FileSystemException e) {
    // nothing to do, null fileObject will be handled below
    }
    if (StringUtils.isBlank(filename) || !fileExists) {
        final Dialog dlg = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Message", getFileType(filename).toLowerCase()), MessageDialog.ERROR, BaseMessages.getString(PKG, "System.Button.Close"), MISSING_RECENT_DLG_WIDTH, SimpleMessageDialog.BUTTON_WIDTH);
        dlg.open();
        return;
    }
    boolean loaded = false;
    FileListener listener = null;
    Node root = null;
    // match by extension first
    int idx = filename.lastIndexOf('.');
    if (idx != -1) {
        for (FileListener li : fileListeners) {
            if (li.accepts(filename)) {
                listener = li;
                break;
            }
        }
    }
    // types.
    try {
        Document document = XMLHandler.loadXMLFile(filename);
        root = document.getDocumentElement();
    } catch (KettleXMLException e) {
        if (log.isDetailed()) {
            log.logDetailed(BaseMessages.getString(PKG, "Spoon.File.Xml.Parse.Error"));
        }
    }
    // as XML
    if (listener == null && root != null) {
        for (FileListener li : fileListeners) {
            if (li.acceptsXml(root.getNodeName())) {
                listener = li;
                break;
            }
        }
    }
    // 
    if (!Utils.isEmpty(filename)) {
        if (listener != null) {
            try {
                loaded = listener.open(root, filename, importfile);
            } catch (KettleMissingPluginsException e) {
                log.logError(e.getMessage(), e);
            }
        }
        if (!loaded) {
            // Give error back
            hideSplash();
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setMessage(BaseMessages.getString(PKG, "Spoon.UnknownFileType.Message", filename));
            mb.setText(BaseMessages.getString(PKG, "Spoon.UnknownFileType.Title"));
            mb.open();
        } else {
            // set variables in the newly loaded
            applyVariables();
        // transformation(s) and job(s).
        }
    }
}
Also used : KettleFileException(org.pentaho.di.core.exception.KettleFileException) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) MessageBox(org.eclipse.swt.widgets.MessageBox) FileSystemException(org.apache.commons.vfs2.FileSystemException) LogSettingsDialog(org.pentaho.di.ui.spoon.dialog.LogSettingsDialog) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) SubjectDataBrowserDialog(org.pentaho.di.ui.core.dialog.SubjectDataBrowserDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ImportRulesDialog(org.pentaho.di.ui.imp.ImportRulesDialog) RepositoriesDialog(org.pentaho.di.ui.repository.RepositoriesDialog) KettlePropertiesFileDialog(org.pentaho.di.ui.core.dialog.KettlePropertiesFileDialog) EnterMappingDialog(org.pentaho.di.ui.core.dialog.EnterMappingDialog) Dialog(org.eclipse.jface.dialogs.Dialog) CheckTransProgressDialog(org.pentaho.di.ui.spoon.dialog.CheckTransProgressDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) ShowMessageDialog(org.pentaho.di.ui.core.dialog.ShowMessageDialog) CapabilityManagerDialog(org.pentaho.di.ui.spoon.dialog.CapabilityManagerDialog) TransHopDialog(org.pentaho.di.ui.trans.dialog.TransHopDialog) TransLoadProgressDialog(org.pentaho.di.ui.trans.dialog.TransLoadProgressDialog) EnterOptionsDialog(org.pentaho.di.ui.core.dialog.EnterOptionsDialog) BrowserEnvironmentWarningDialog(org.pentaho.di.ui.core.dialog.BrowserEnvironmentWarningDialog) AuthProviderDialog(org.pentaho.di.ui.core.auth.AuthProviderDialog) EnterSearchDialog(org.pentaho.di.ui.core.dialog.EnterSearchDialog) EnterStringsDialog(org.pentaho.di.ui.core.dialog.EnterStringsDialog) VfsFileChooserDialog(org.pentaho.vfs.ui.VfsFileChooserDialog) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) SelectDirectoryDialog(org.pentaho.di.ui.repository.dialog.SelectDirectoryDialog) MetaStoreExplorerDialog(org.pentaho.di.ui.spoon.dialog.MetaStoreExplorerDialog) RepositoryImportProgressDialog(org.pentaho.di.ui.repository.dialog.RepositoryImportProgressDialog) SaveProgressDialog(org.pentaho.di.ui.spoon.dialog.SaveProgressDialog) AnalyseImpactProgressDialog(org.pentaho.di.ui.spoon.dialog.AnalyseImpactProgressDialog) RepositoryExportProgressDialog(org.pentaho.di.ui.repository.dialog.RepositoryExportProgressDialog) AboutDialog(org.pentaho.di.ui.core.dialog.AboutDialog) JobLoadProgressDialog(org.pentaho.di.ui.job.dialog.JobLoadProgressDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) CheckResultDialog(org.pentaho.di.ui.core.dialog.CheckResultDialog) ShowBrowserDialog(org.pentaho.di.ui.core.dialog.ShowBrowserDialog) FileDialog(org.eclipse.swt.widgets.FileDialog) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) FileObject(org.apache.commons.vfs2.FileObject)

Example 34 with Dialog

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

the class JobEntryTransDialog method ok.

protected void ok() {
    if (Utils.isEmpty(wName.getText())) {
        final Dialog dialog = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "System.StepJobEntryNameMissing.Title"), BaseMessages.getString(PKG, "System.JobEntryNameMissing.Msg"), MessageDialog.ERROR);
        dialog.open();
        return;
    }
    jobEntry.setName(wName.getText());
    try {
        getInfo(jobEntry);
    } catch (KettleException e) {
    // suppress exceptions at this time - we will let the runtime report on any errors
    }
    jobEntry.setChanged();
    dispose();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) BaseStepDialog(org.pentaho.di.ui.trans.step.BaseStepDialog) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) JobDialog(org.pentaho.di.ui.job.dialog.JobDialog) FileDialog(org.eclipse.swt.widgets.FileDialog) Dialog(org.eclipse.jface.dialogs.Dialog)

Example 35 with Dialog

use of org.eclipse.jface.dialogs.Dialog in project eclipse.platform.text by eclipse.

the class ChangeEncodingAction method run.

@Override
public void run() {
    final IResource resource = getResource();
    final Shell parentShell = getTextEditor().getSite().getShell();
    final IEncodingSupport encodingSupport = getEncodingSupport();
    if (resource == null && encodingSupport == null) {
        MessageDialog.openInformation(parentShell, fDialogTitle, TextEditorMessages.ChangeEncodingAction_message_noEncodingSupport);
        return;
    }
    Dialog dialog = new Dialog(parentShell) {

        private AbstractEncodingFieldEditor fEncodingEditor;

        private IPreferenceStore store = null;

        @Override
        protected void configureShell(Shell newShell) {
            super.configureShell(newShell);
            newShell.setText(fDialogTitle);
        }

        @Override
        protected Control createDialogArea(Composite parent) {
            Composite composite = (Composite) super.createDialogArea(parent);
            composite = new Composite(composite, SWT.NONE);
            GridLayout layout = new GridLayout();
            layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
            layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
            layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
            layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
            composite.setLayout(layout);
            GridData data = new GridData(GridData.FILL_BOTH);
            composite.setLayoutData(data);
            composite.setFont(parent.getFont());
            DialogPage page = new MessageDialogPage(composite) {

                @Override
                public void setErrorMessage(String newMessage) {
                    super.setErrorMessage(newMessage);
                    setButtonEnabledState(IDialogConstants.OK_ID, newMessage == null);
                    setButtonEnabledState(APPLY_ID, newMessage == null);
                }

                private void setButtonEnabledState(int id, boolean state) {
                    Button button = getButton(id);
                    if (button != null)
                        button.setEnabled(state);
                }
            };
            if (resource != null) {
                // $NON-NLS-1$
                fEncodingEditor = new ResourceEncodingFieldEditor("", composite, resource, null);
                fEncodingEditor.setPage(page);
                fEncodingEditor.load();
            } else {
                // $NON-NLS-1$
                fEncodingEditor = new EncodingFieldEditor(ENCODING_PREF_KEY, "", null, composite);
                store = new PreferenceStore();
                String defaultEncoding = encodingSupport.getDefaultEncoding();
                store.setDefault(ENCODING_PREF_KEY, defaultEncoding);
                String encoding = encodingSupport.getEncoding();
                if (encoding != null)
                    store.setValue(ENCODING_PREF_KEY, encoding);
                fEncodingEditor.setPreferenceStore(store);
                fEncodingEditor.setPage(page);
                fEncodingEditor.load();
                if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0)
                    fEncodingEditor.loadDefault();
            }
            return composite;
        }

        @Override
        protected void createButtonsForButtonBar(Composite parent) {
            createButton(parent, APPLY_ID, TextEditorMessages.ChangeEncodingAction_button_apply_label, false);
            super.createButtonsForButtonBar(parent);
        }

        @Override
        protected void buttonPressed(int buttonId) {
            if (buttonId == APPLY_ID)
                apply();
            else
                super.buttonPressed(buttonId);
        }

        @Override
        protected void okPressed() {
            apply();
            super.okPressed();
        }

        private void apply() {
            fEncodingEditor.store();
            if (resource == null) {
                String encoding = fEncodingEditor.getPreferenceStore().getString(fEncodingEditor.getPreferenceName());
                encodingSupport.setEncoding(encoding);
            }
        }
    };
    dialog.open();
}
Also used : AbstractEncodingFieldEditor(org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor) Composite(org.eclipse.swt.widgets.Composite) IEncodingSupport(org.eclipse.ui.editors.text.IEncodingSupport) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) PreferenceStore(org.eclipse.jface.preference.PreferenceStore) Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) AbstractEncodingFieldEditor(org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor) ResourceEncodingFieldEditor(org.eclipse.ui.ide.dialogs.ResourceEncodingFieldEditor) EncodingFieldEditor(org.eclipse.ui.ide.dialogs.EncodingFieldEditor) Button(org.eclipse.swt.widgets.Button) ResourceEncodingFieldEditor(org.eclipse.ui.ide.dialogs.ResourceEncodingFieldEditor) Dialog(org.eclipse.jface.dialogs.Dialog) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) DialogPage(org.eclipse.jface.dialogs.DialogPage) GridData(org.eclipse.swt.layout.GridData) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IResource(org.eclipse.core.resources.IResource)

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