Search in sources :

Example 1 with SimpleMessageDialog

use of org.pentaho.di.ui.core.dialog.SimpleMessageDialog 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)

Example 2 with SimpleMessageDialog

use of org.pentaho.di.ui.core.dialog.SimpleMessageDialog in project pentaho-kettle by pentaho.

the class Spoon method loadLastUsedFile.

private void loadLastUsedFile(LastUsedFile lastUsedFile, String repositoryName, boolean trackIt, boolean isStartup) throws KettleException {
    boolean useRepository = repositoryName != null;
    // 
    if (lastUsedFile.isSourceRepository()) {
        if (!Utils.isEmpty(lastUsedFile.getRepositoryName())) {
            if (useRepository && !lastUsedFile.getRepositoryName().equalsIgnoreCase(repositoryName)) {
                // We just asked...
                useRepository = false;
            }
        }
    }
    if (useRepository && lastUsedFile.isSourceRepository()) {
        if (rep != null) {
            // load from this repository...
            if (rep.getName().equalsIgnoreCase(lastUsedFile.getRepositoryName())) {
                RepositoryDirectoryInterface rdi = rep.findDirectory(lastUsedFile.getDirectory());
                if (rdi != null) {
                    // does the file exist in the repo?
                    final RepositoryObjectType fileType = lastUsedFile.isJob() ? RepositoryObjectType.JOB : RepositoryObjectType.TRANSFORMATION;
                    if (!rep.exists(lastUsedFile.getFilename(), rdi, fileType)) {
                        // opening this file
                        if (isStartup) {
                            if (log.isDetailed()) {
                                log.logDetailed(BaseMessages.getString(PKG, "Spoon.log.openingMissingFile"));
                            }
                        } else {
                            final Dialog dlg = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Message", lastUsedFile.getLongFileType().toLowerCase()), MessageDialog.ERROR, BaseMessages.getString(PKG, "System.Button.Close"), MISSING_RECENT_DLG_WIDTH, SimpleMessageDialog.BUTTON_WIDTH);
                            dlg.open();
                        }
                    } else {
                        // Are we loading a transformation or a job?
                        if (lastUsedFile.isTransformation()) {
                            if (log.isDetailed()) {
                                // "Auto loading transformation ["+lastfiles[0]+"] from repository directory ["+lastdirs[0]+"]"
                                log.logDetailed(BaseMessages.getString(PKG, "Spoon.Log.AutoLoadingTransformation", lastUsedFile.getFilename(), lastUsedFile.getDirectory()));
                            }
                            TransLoadProgressDialog tlpd = new TransLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null);
                            TransMeta transMeta = tlpd.open();
                            if (transMeta != null) {
                                if (trackIt) {
                                    props.addLastFile(LastUsedFile.FILE_TYPE_TRANSFORMATION, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null);
                                }
                                // transMeta.setFilename(lastUsedFile.getFilename());
                                transMeta.clearChanged();
                                addTransGraph(transMeta);
                                refreshTree();
                            }
                        } else if (lastUsedFile.isJob()) {
                            JobLoadProgressDialog progressDialog = new JobLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null);
                            JobMeta jobMeta = progressDialog.open();
                            if (jobMeta != null) {
                                if (trackIt) {
                                    props.addLastFile(LastUsedFile.FILE_TYPE_JOB, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null);
                                }
                                jobMeta.clearChanged();
                                addJobGraph(jobMeta);
                            }
                        }
                        refreshTree();
                    }
                }
            }
        }
    }
    // open files stored locally, not in the repository
    if (!lastUsedFile.isSourceRepository() && !Utils.isEmpty(lastUsedFile.getFilename())) {
        if (lastUsedFile.isTransformation()) {
            openFile(lastUsedFile.getFilename(), rep != null);
        }
        if (lastUsedFile.isJob()) {
            openFile(lastUsedFile.getFilename(), false);
        }
        refreshTree();
    }
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) JobMeta(org.pentaho.di.job.JobMeta) SimpleMessageDialog(org.pentaho.di.ui.core.dialog.SimpleMessageDialog) TransLoadProgressDialog(org.pentaho.di.ui.trans.dialog.TransLoadProgressDialog) 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) TransMeta(org.pentaho.di.trans.TransMeta) RepositoryObjectType(org.pentaho.di.repository.RepositoryObjectType) JobLoadProgressDialog(org.pentaho.di.ui.job.dialog.JobLoadProgressDialog)

Example 3 with SimpleMessageDialog

use of org.pentaho.di.ui.core.dialog.SimpleMessageDialog 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 4 with SimpleMessageDialog

use of org.pentaho.di.ui.core.dialog.SimpleMessageDialog 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)

Aggregations

Dialog (org.eclipse.jface.dialogs.Dialog)4 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)4 SimpleMessageDialog (org.pentaho.di.ui.core.dialog.SimpleMessageDialog)4 FileDialog (org.eclipse.swt.widgets.FileDialog)3 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)3 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 AuthProviderDialog (org.pentaho.di.ui.core.auth.AuthProviderDialog)2 AboutDialog (org.pentaho.di.ui.core.dialog.AboutDialog)2 BrowserEnvironmentWarningDialog (org.pentaho.di.ui.core.dialog.BrowserEnvironmentWarningDialog)2 CheckResultDialog (org.pentaho.di.ui.core.dialog.CheckResultDialog)2 EnterMappingDialog (org.pentaho.di.ui.core.dialog.EnterMappingDialog)2 EnterOptionsDialog (org.pentaho.di.ui.core.dialog.EnterOptionsDialog)2 EnterSearchDialog (org.pentaho.di.ui.core.dialog.EnterSearchDialog)2 EnterSelectionDialog (org.pentaho.di.ui.core.dialog.EnterSelectionDialog)2 EnterStringsDialog (org.pentaho.di.ui.core.dialog.EnterStringsDialog)2 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)2 KettlePropertiesFileDialog (org.pentaho.di.ui.core.dialog.KettlePropertiesFileDialog)2 ShowBrowserDialog (org.pentaho.di.ui.core.dialog.ShowBrowserDialog)2 ShowMessageDialog (org.pentaho.di.ui.core.dialog.ShowMessageDialog)2