Search in sources :

Example 21 with ErrorDialog

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

the class DataOverrideHandler method showFeatureList.

public void showFeatureList() {
    Shell parent = getShell();
    DatabaseMeta dbinfo = new DatabaseMeta();
    getInfo(dbinfo);
    try {
        java.util.List<RowMetaAndData> buffer = dbinfo.getFeatureSummary();
        if (buffer.size() > 0) {
            RowMetaInterface rowMeta = buffer.get(0).getRowMeta();
            java.util.List<Object[]> rowData = new ArrayList<Object[]>();
            for (RowMetaAndData row : buffer) {
                rowData.add(row.getData());
            }
            PreviewRowsDialog prd = new PreviewRowsDialog(parent, dbinfo, SWT.NONE, null, rowMeta, rowData);
            prd.setTitleMessage(BaseMessages.getString(PKG, "DatabaseDialog.FeatureList.title"), BaseMessages.getString(PKG, "DatabaseDialog.FeatureList.title"));
            prd.open();
        }
    } catch (Exception e) {
        new ErrorDialog(parent, BaseMessages.getString(PKG, "DatabaseDialog.FeatureListError.title"), BaseMessages.getString(PKG, "DatabaseDialog.FeatureListError.description"), e);
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ArrayList(java.util.ArrayList) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 22 with ErrorDialog

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

the class RepositoriesHelper method newRepository.

public void newRepository() {
    PluginRegistry registry = PluginRegistry.getInstance();
    Class<? extends PluginTypeInterface> pluginType = RepositoryPluginType.class;
    List<PluginInterface> plugins = registry.getPlugins(pluginType);
    String[] names = new String[plugins.size()];
    for (int i = 0; i < names.length; i++) {
        PluginInterface plugin = plugins.get(i);
        names[i] = plugin.getName() + " - " + plugin.getDescription();
    }
    // TODO: make this a bit fancier!
    EnterSelectionDialog selectRepositoryType = new EnterSelectionDialog(this.shell, names, BaseMessages.getString(PKG, "RepositoryLogin.SelectRepositoryType"), BaseMessages.getString(PKG, "RepositoryLogin.SelectRepositoryTypeCreate"));
    String choice = selectRepositoryType.openRepoDialog();
    if (choice != null) {
        int index = selectRepositoryType.getSelectionNr();
        PluginInterface plugin = plugins.get(index);
        String id = plugin.getIds()[0];
        try {
            // With this ID we can create a new Repository object...
            // 
            RepositoryMeta repositoryMeta = PluginRegistry.getInstance().loadClass(RepositoryPluginType.class, id, RepositoryMeta.class);
            RepositoryDialogInterface dialog = getRepositoryDialog(plugin, repositoryMeta, input, this.shell);
            RepositoryMeta meta = dialog.open(MODE.ADD);
            if (meta != null) {
                // If it does then display a error to the user
                if (meta.getName() != null) {
                    input.addRepository(meta);
                    fillRepositories();
                    model.setSelectedRepository(meta);
                    writeData();
                }
            }
        } catch (Exception e) {
            log.logDetailed(BaseMessages.getString(PKG, "RepositoryLogin.ErrorCreatingRepository", e.getLocalizedMessage()));
            new ErrorDialog(shell, BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "RepositoryLogin.ErrorCreatingRepository", e.getLocalizedMessage()), e);
        }
    }
}
Also used : RepositoryPluginType(org.pentaho.di.core.plugins.RepositoryPluginType) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleException(org.pentaho.di.core.exception.KettleException) KettleSecurityException(org.pentaho.di.core.exception.KettleSecurityException) RepositoryMeta(org.pentaho.di.repository.RepositoryMeta) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) RepositoryDialogInterface(org.pentaho.di.ui.repository.dialog.RepositoryDialogInterface) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog)

Example 23 with ErrorDialog

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

the class RepositoriesHelper method deleteRepository.

public void deleteRepository() {
    try {
        XulConfirmBox confirmBox = (XulConfirmBox) document.createElement("confirmbox");
        final RepositoryMeta repositoryMeta = input.searchRepository(model.getSelectedRepository().getName());
        if (repositoryMeta != null) {
            confirmBox.setTitle(BaseMessages.getString(PKG, "RepositoryLogin.ConfirmDeleteRepositoryDialog.Title"));
            confirmBox.setMessage(BaseMessages.getString(PKG, "RepositoryLogin.ConfirmDeleteRepositoryDialog.Message"));
            confirmBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
            confirmBox.setCancelLabel(BaseMessages.getString(PKG, "Dialog.Cancel"));
            confirmBox.addDialogCallback(new XulDialogCallback<Object>() {

                public void onClose(XulComponent sender, Status returnCode, Object retVal) {
                    if (returnCode == Status.ACCEPT) {
                        int idx = input.indexOfRepository(repositoryMeta);
                        input.removeRepository(idx);
                        fillRepositories();
                        writeData();
                    }
                }

                public void onError(XulComponent sender, Throwable t) {
                    log.logDetailed(BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", t.getLocalizedMessage()));
                    new ErrorDialog(shell, BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", t.getLocalizedMessage()), t);
                }
            });
            confirmBox.open();
        }
    } catch (Exception e) {
        log.logDetailed(BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", e.getLocalizedMessage()));
        new ErrorDialog(shell, BaseMessages.getString(PKG, "Dialog.Error"), BaseMessages.getString(PKG, "RepositoryLogin.UnableToDeleteRepository", e.getLocalizedMessage()), e);
    }
}
Also used : RepositoryMeta(org.pentaho.di.repository.RepositoryMeta) XulConfirmBox(org.pentaho.ui.xul.components.XulConfirmBox) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) XulComponent(org.pentaho.ui.xul.XulComponent) KettleException(org.pentaho.di.core.exception.KettleException) KettleSecurityException(org.pentaho.di.core.exception.KettleSecurityException)

Example 24 with ErrorDialog

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

the class RepositoryExplorerDialog method open.

public RepositoryObjectReference open() {
    debug = "opening repository explorer";
    try {
        debug = "open new independent shell";
        Shell parent = getParent();
        Display display = parent.getDisplay();
        shell = new Shell(display, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
        props.setLook(shell);
        shell.setImage(GUIResource.getInstance().getImageFolderConnections());
        shell.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Title") + rep.getName() + "]");
        FormLayout formLayout = new FormLayout();
        formLayout.marginWidth = Const.FORM_MARGIN;
        formLayout.marginHeight = Const.FORM_MARGIN;
        shell.setLayout(formLayout);
        // Add a small toolbar to expand/collapse all items
        // 
        ToolBar treeTb = new ToolBar(shell, SWT.HORIZONTAL | SWT.FLAT);
        props.setLook(treeTb);
        fdTreeTb = new FormData();
        fdTreeTb.left = new FormAttachment(0, 0);
        fdTreeTb.top = new FormAttachment(0, 0);
        treeTb.setLayoutData(fdTreeTb);
        // Add the items...
        // 
        exportToXML = new ToolItem(treeTb, SWT.PUSH);
        exportToXML.setImage(GUIResource.getInstance().getImageExport());
        exportToXML.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ExportToXML.Label"));
        exportToXML.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ExportToXML.Tooltip"));
        importFromXML = new ToolItem(treeTb, SWT.PUSH);
        importFromXML.setImage(GUIResource.getInstance().getImageImport());
        importFromXML.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ImportFromXML.Label"));
        importFromXML.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ImportFromXML.Tooltip"));
        new ToolItem(treeTb, SWT.SEPARATOR);
        showHideDeleted = new ToolItem(treeTb, SWT.PUSH);
        showHideDeleted.setImage(GUIResource.getInstance().getImageShowDeleted());
        showHideDeleted.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ShowDeleted.Label"));
        showHideDeleted.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ShowDeleted.Tooltip"));
        showHideDeleted.setEnabled(rep.getRepositoryMeta().getRepositoryCapabilities().supportsRevisions());
        new ToolItem(treeTb, SWT.SEPARATOR);
        expandAll = new ToolItem(treeTb, SWT.PUSH);
        expandAll.setImage(GUIResource.getInstance().getImageExpandAll());
        expandAll.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ExpandAll.Label"));
        expandAll.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ExpandAll.Tooltip"));
        collapseAll = new ToolItem(treeTb, SWT.PUSH);
        collapseAll.setImage(GUIResource.getInstance().getImageCollapseAll());
        collapseAll.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.CollapseAll.Label"));
        collapseAll.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.CollapseAll.Tooltip"));
        // Tree
        wTree = new Tree(shell, SWT.MULTI | SWT.BORDER);
        wTree.setHeaderVisible(true);
        props.setLook(wTree);
        // Add some columns to it as well...
        nameColumn = new TreeColumn(wTree, SWT.LEFT);
        nameColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Name"));
        nameColumn.setWidth(350);
        nameColumn.setAlignment(10);
        nameColumn.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                setSort(0);
            }
        });
        // No sorting on the type column just yet.
        typeColumn = new TreeColumn(wTree, SWT.LEFT);
        typeColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Type"));
        typeColumn.setWidth(100);
        typeColumn.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                setSort(1);
            }
        });
        userColumn = new TreeColumn(wTree, SWT.LEFT);
        userColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.User"));
        userColumn.setWidth(100);
        userColumn.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                setSort(2);
            }
        });
        changedColumn = new TreeColumn(wTree, SWT.LEFT);
        changedColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Changed"));
        changedColumn.setWidth(120);
        changedColumn.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                setSort(3);
            }
        });
        descriptionColumn = new TreeColumn(wTree, SWT.LEFT);
        descriptionColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Description"));
        descriptionColumn.setWidth(120);
        descriptionColumn.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                setSort(4);
            }
        });
        lockColumn = new TreeColumn(wTree, SWT.LEFT);
        lockColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.LockMessage"));
        lockColumn.setWidth(120);
        lockColumn.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                setSort(5);
            }
        });
        // Add a memory to the tree.
        TreeMemory.addTreeListener(wTree, STRING_REPOSITORY_EXPLORER_TREE_NAME);
        // Buttons
        wOK = new Button(shell, SWT.PUSH);
        wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
        FormData fdTree = new FormData();
        int margin = 10;
        // To the right of the label
        fdTree.left = new FormAttachment(0, 0);
        fdTree.top = new FormAttachment(treeTb, 0);
        fdTree.right = new FormAttachment(100, 0);
        fdTree.bottom = new FormAttachment(100, -50);
        wTree.setLayoutData(fdTree);
        BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK }, margin, null);
        // Add listeners
        wOK.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                close();
            }
        });
        wTree.addMenuDetectListener(new MenuDetectListener() {

            @Override
            public void menuDetected(MenuDetectEvent e) {
                setTreeMenu();
            }
        });
        wTree.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDoubleClick(MouseEvent e) {
                if (e.button == 1) {
                    // left double click!
                    doDoubleClick();
                }
            }
        });
        wTree.addKeyListener(new KeyAdapter() {

            @Override
            public void keyPressed(KeyEvent e) {
                // F2 --> rename...
                if (e.keyCode == SWT.F2) {
                    if (!readonly) {
                        renameInTree();
                    }
                }
                // F5 --> refresh...
                if (e.keyCode == SWT.F5) {
                    refreshTree();
                }
            }
        });
        expandAll.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent event) {
                expandAllItems(wTree.getItems(), true);
            }
        });
        collapseAll.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent event) {
                expandAllItems(wTree.getItems(), false);
            }
        });
        importFromXML.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent event) {
                importAll();
            }
        });
        exportToXML.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent event) {
                exportAll(null);
            }
        });
        showHideDeleted.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent event) {
                includeDeleted = !includeDeleted;
                if (includeDeleted) {
                    showHideDeleted.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.HideDeleted.Label"));
                    showHideDeleted.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.HideDeleted.Tooltip"));
                } else {
                    showHideDeleted.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ShowDeleted.Label"));
                    showHideDeleted.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.ToolItem.ShowDeleted.Tooltip"));
                }
                refreshTree();
            }
        });
        // Drag & Drop
        Transfer[] ttypes = new Transfer[] { TextTransfer.getInstance() };
        DragSource ddSource = new DragSource(wTree, DND.DROP_MOVE);
        ddSource.setTransfer(ttypes);
        ddSource.addDragListener(new DragSourceListener() {

            @Override
            public void dragStart(DragSourceEvent event) {
                debug = "drag start";
                event.doit = true;
            }

            @Override
            public void dragSetData(DragSourceEvent event) {
                debug = "drag set data";
                event.data = "";
                event.doit = false;
                TreeItem[] ti = wTree.getSelection();
                if (ti.length >= 1) {
                    int cat = getItemCategory(ti[0]);
                    // 
                    if (cat == ITEM_CATEGORY_TRANSFORMATION) {
                        debug = "drag set: drag around transformation";
                        RepositoryDirectoryInterface repdir = getDirectory(ti[0]);
                        if (repdir != null) {
                            // 
                            // Pass info as a piece of XML
                            // 
                            String xml = XMLHandler.getXMLHeader();
                            xml += "<dragdrop>" + Const.CR;
                            xml += "  " + XMLHandler.addTagValue("directory", repdir.getPath());
                            xml += "  " + XMLHandler.addTagValue("transformation", ti[0].getText());
                            xml += "</dragdrop>" + Const.CR;
                            event.data = xml;
                            event.doit = true;
                        }
                    } else if (cat == ITEM_CATEGORY_JOB) {
                        debug = "drag set: drag around job";
                        RepositoryDirectoryInterface repdir = getDirectory(ti[0]);
                        if (repdir != null) {
                            // 
                            // Pass info as a piece of XML
                            // 
                            String xml = XMLHandler.getXMLHeader();
                            xml += "<dragdrop>" + Const.CR;
                            xml += "  " + XMLHandler.addTagValue("directory", repdir.getPath());
                            xml += "  " + XMLHandler.addTagValue("job", ti[0].getText());
                            xml += "</dragdrop>" + Const.CR;
                            event.data = xml;
                            event.doit = true;
                        }
                    } else {
                        debug = "do nothing";
                        String xml = XMLHandler.getXMLHeader();
                        xml += "<dragdrop>" + Const.CR;
                        xml += "</dragdrop>" + Const.CR;
                        event.data = xml;
                        event.doit = true;
                    }
                }
            }

            @Override
            public void dragFinished(DragSourceEvent event) {
            }
        });
        DropTarget ddTarget = new DropTarget(wTree, DND.DROP_MOVE);
        ddTarget.setTransfer(ttypes);
        ddTarget.addDropListener(new DropTargetListener() {

            @Override
            public void dragEnter(DropTargetEvent event) {
            }

            @Override
            public void dragLeave(DropTargetEvent event) {
                debug = "drag leave";
            }

            @Override
            public void dragOperationChanged(DropTargetEvent event) {
            }

            @Override
            public void dragOver(DropTargetEvent event) {
                debug = "drag over";
            }

            @Override
            public void drop(DropTargetEvent event) {
                try {
                    debug = "Drop item in tree";
                    if (event.data == null) {
                        // no data to copy, indicate failure in event.detail
                        event.detail = DND.DROP_NONE;
                        return;
                    }
                    // event.feedback = DND.FEEDBACK_NONE;
                    TreeItem ti = (TreeItem) event.item;
                    if (ti != null) {
                        debug = "Get category";
                        int category = getItemCategory(ti);
                        if (category == ITEM_CATEGORY_TRANSFORMATION_DIRECTORY || category == ITEM_CATEGORY_TRANSFORMATION) {
                            debug = "Get directory";
                            RepositoryDirectoryInterface repdir = getDirectory(ti);
                            if (repdir != null) {
                                event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
                                if (moveTransformation((String) event.data, repdir)) {
                                    refreshTree();
                                } else {
                                    MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
                                    mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Trans.Move.UnableToMove.Message"));
                                    mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Trans.Move.UnableToMove.Title"));
                                    mb.open();
                                }
                            }
                        } else if (category == ITEM_CATEGORY_JOB_DIRECTORY || category == ITEM_CATEGORY_JOB) {
                            debug = "Get directory";
                            RepositoryDirectoryInterface repdir = getDirectory(ti);
                            if (repdir != null) {
                                event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
                                if (moveJob((String) event.data, repdir)) {
                                    refreshTree();
                                } else {
                                    MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
                                    mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Move.UnableToMove.Message"));
                                    mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Job.Move.UnableToMove.Title"));
                                    mb.open();
                                }
                            }
                        } else {
                            MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
                            mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Trans.Move.SorryOneItemAtATime.Message"));
                            mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Trans.Move.SorryOneItemAtATime.Title"));
                            mb.open();
                        }
                    }
                } catch (Throwable e) {
                    new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Drop.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Drop.UnexpectedError.Message1") + debug + "]" + Const.CR + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Drop.UnexpectedError.Message2"), e);
                }
            }

            @Override
            public void dropAccept(DropTargetEvent event) {
                debug = "drop accept";
            }
        });
        // Detect X or ALT-F4 or something that kills this window...
        shell.addShellListener(new ShellAdapter() {

            @Override
            public void shellClosed(ShellEvent e) {
                close();
            }
        });
        debug = "set screen size and position";
        BaseStepDialog.setSize(shell, 400, 480, true);
        // refreshes too.
        setSort(0);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    } catch (Throwable e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Main.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Main.UnexpectedError.Message1") + debug + "]" + Const.CR + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Main.UnexpectedError.Message2") + Const.CR + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Main.UnexpectedError.Message3"), e);
    }
    return lastOpened;
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) Listener(org.eclipse.swt.widgets.Listener) DragSourceListener(org.eclipse.swt.dnd.DragSourceListener) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) MenuDetectListener(org.eclipse.swt.events.MenuDetectListener) TreeItem(org.eclipse.swt.widgets.TreeItem) KeyAdapter(org.eclipse.swt.events.KeyAdapter) ShellEvent(org.eclipse.swt.events.ShellEvent) DragSourceListener(org.eclipse.swt.dnd.DragSourceListener) KeyEvent(org.eclipse.swt.events.KeyEvent) DragSourceEvent(org.eclipse.swt.dnd.DragSourceEvent) Shell(org.eclipse.swt.widgets.Shell) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) Button(org.eclipse.swt.widgets.Button) TreeColumn(org.eclipse.swt.widgets.TreeColumn) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Tree(org.eclipse.swt.widgets.Tree) FormAttachment(org.eclipse.swt.layout.FormAttachment) ToolItem(org.eclipse.swt.widgets.ToolItem) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) DragSource(org.eclipse.swt.dnd.DragSource) MessageBox(org.eclipse.swt.widgets.MessageBox) MenuDetectEvent(org.eclipse.swt.events.MenuDetectEvent) ToolBar(org.eclipse.swt.widgets.ToolBar) Transfer(org.eclipse.swt.dnd.Transfer) TextTransfer(org.eclipse.swt.dnd.TextTransfer) FocusEvent(org.eclipse.swt.events.FocusEvent) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) MenuDetectEvent(org.eclipse.swt.events.MenuDetectEvent) DragSourceEvent(org.eclipse.swt.dnd.DragSourceEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuDetectListener(org.eclipse.swt.events.MenuDetectListener) DropTarget(org.eclipse.swt.dnd.DropTarget) Display(org.eclipse.swt.widgets.Display)

Example 25 with ErrorDialog

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

the class RepositoryExplorerDialog method newCluster.

public void newCluster() {
    try {
        ClusterSchema cluster = new ClusterSchema();
        ClusterSchemaDialog dd = new ClusterSchemaDialog(shell, cluster, rep.getSlaveServers());
        if (dd.open()) {
            // See if this slave server already exists...
            ObjectId idCluster = rep.getClusterID(cluster.getName());
            if (idCluster == null) {
                rep.insertLogEntry("Creating new cluster '" + cluster.getName() + "'");
                rep.save(cluster, Const.VERSION_COMMENT_INITIAL_VERSION, null);
            } else {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Message"));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Title"));
                mb.open();
            }
            // Refresh tree...
            refreshTree();
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Message"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ClusterSchema(org.pentaho.di.cluster.ClusterSchema) ClusterSchemaDialog(org.pentaho.di.ui.cluster.dialog.ClusterSchemaDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)527 KettleException (org.pentaho.di.core.exception.KettleException)440 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)178 MessageBox (org.eclipse.swt.widgets.MessageBox)118 TableItem (org.eclipse.swt.widgets.TableItem)97 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)76 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)63 TransMeta (org.pentaho.di.trans.TransMeta)48 Shell (org.eclipse.swt.widgets.Shell)46 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)46 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)44 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)44 ArrayList (java.util.ArrayList)43 TableItemInsertListener (org.pentaho.di.ui.trans.step.TableItemInsertListener)43 EnterSelectionDialog (org.pentaho.di.ui.core.dialog.EnterSelectionDialog)42 SelectionEvent (org.eclipse.swt.events.SelectionEvent)40 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)39 StepMeta (org.pentaho.di.trans.step.StepMeta)38 FormData (org.eclipse.swt.layout.FormData)37 FormLayout (org.eclipse.swt.layout.FormLayout)37