Search in sources :

Example 6 with MessageDialog

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

the class JavaProcessorUtilities method handleMissingJarsForProcess.

/**
     * 
     * Added by Marvin Wang on Nov 7, 2012.
     * 
     * @param missingJarsForRoutines
     * @param missingJarsForProcess
     * @param missingJars
     * @throws BusinessException
     */
private static void handleMissingJarsForProcess(Set<String> missingJarsForRoutines, final Set<String> missingJarsForProcess, String missingJars) throws ProcessorException {
    //$NON-NLS-1$
    final StringBuffer sb = new StringBuffer("");
    if (missingJarsForProcess.size() > 0) {
        //$NON-NLS-1$
        sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.forProcess"));
        for (String missingJar : missingJarsForProcess) {
            sb.append(missingJar);
            //$NON-NLS-1$
            sb.append(", ");
        }
        if (missingJarsForRoutines.size() > 0) {
            // subForMsg(sb.toString());
            //$NON-NLS-1$
            sb.append("\r\n\r\n\r\n");
            //$NON-NLS-1$
            sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.note"));
            //$NON-NLS-1$
            sb.append("\r\n");
            //$NON-NLS-1$
            sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.onlyforroutine"));
            //$NON-NLS-1$
            sb.append("\r\n");
            for (String missingJar : missingJarsForRoutines) {
                sb.append(missingJar);
                //$NON-NLS-1$
                sb.append(", ");
            }
            subForMsg(sb.toString());
        } else {
            subForMsg(sb.toString());
        }
        if (!CommonsPlugin.isHeadless()) {
            Display display = DisplayUtils.getDisplay();
            if (display != null) {
                display.syncExec(new Runnable() {

                    @Override
                    public void run() {
                        // fix for TDI-24906
                        MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), Messages.getString("JavaProcessorUtilities.msg.missingjar.warningtitle"), null, subForMsg(sb.toString()), 4, new String[] { IDialogConstants.OK_LABEL }, 0) {

                            /*
                                 * (non-Javadoc)
                                 * 
                                 * @see org.eclipse.jface.window.Window#setShellStyle(int)
                                 */
                            @Override
                            protected void setShellStyle(int newShellStyle) {
                                super.setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL);
                            }
                        };
                        dialog.open();
                    }
                });
            }
        } else {
            throw new ProcessorException(missingJars);
        }
    } else {
        if (missingJarsForRoutines.size() > 0) {
            //$NON-NLS-1$
            sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.onlyforroutine"));
            for (String missingJar : missingJarsForRoutines) {
                sb.append(missingJar);
                //$NON-NLS-1$
                sb.append(", ");
            }
            CommonExceptionHandler.warn(subForMsg(sb.toString()));
        }
    }
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Display(org.eclipse.swt.widgets.Display)

Example 7 with MessageDialog

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

the class CreateNodeContainerCommand method execute.

@Override
public void execute() {
    if (this.location != null) {
        this.nodeContainer.getNode().setLocation(this.location);
    }
    updatePaletteRecentlyUsedList();
    AbstractProcessProvider provider = AbstractProcessProvider.findProcessProviderFromPID(nodeContainer.getNode().getComponent().getPluginExtension());
    IElementParameter ep = nodeContainer.getNode().getElementParameter(EParameterName.UNIQUE_NAME.getName());
    process.addUniqueNodeName(ep.getValue().toString());
    if (provider == null || (provider != null && provider.containNodeInMemoryNotProcess())) {
        this.process.addNodeContainer(this.nodeContainer);
        process.checkStartNodes();
        nodeContainer.getNode().checkAndRefreshNode();
        refreshRelatedNodes();
        // }
        if (nodeContainer.getNode().getComponent().getComponentType() == EComponentType.JOBLET) {
            IUpdateItemType jobletContextType = UpdateManagerProviderDetector.INSTANCE.getUpdateItemType(UpdateManagerHelper.TYPE_JOBLET_CONTEXT);
            if (jobletContextType != null) {
                process.getUpdateManager().update(jobletContextType);
            }
        }
    } else {
        String name = provider.getComponentProcess().getName() + " " + provider.getComponentProcess().getVersion();
        MessageDialog warningMessageDialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Can't create node", null, "Joblet process " + name + " is not saved. Please save it first", MessageDialog.OK, new String[] { "OK" }, 0);
        warningMessageDialog.open();
    }
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) IUpdateItemType(org.talend.core.model.update.IUpdateItemType) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) AbstractProcessProvider(org.talend.designer.core.model.process.AbstractProcessProvider)

Example 8 with MessageDialog

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

the class QueryEditorDNDController method openConfirmDialog.

/**
	 *
	 * Open confirm dialog
	 *
	 * @return the button id
	 */
private int openConfirmDialog() {
    String title = com.cubrid.common.ui.common.Messages.titleConfirm;
    String[] buttons = new String[] { Messages.btnYes, Messages.btnNo, Messages.cancel };
    MessageDialog dialog = new MessageDialog(editor.getSite().getShell(), title, null, Messages.changeDbConfirm, MessageDialog.QUESTION, buttons, 0) {

        protected void buttonPressed(int buttonId) {
            switch(buttonId) {
                case 0:
                    setReturnCode(0);
                    close();
                    break;
                case 1:
                    setReturnCode(1);
                    close();
                    break;
                case 2:
                    setReturnCode(2);
                    close();
                    break;
                default:
                    break;
            }
        }
    };
    return dialog.open();
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 9 with MessageDialog

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

the class QueryEditorPart method queryErrSkipOrNot.

/**
	 * Open a message dialog to confirm skip query error or not.
	 *
	 * @param ee SQLException
	 * @param errorSql String
	 * @return value boolean[]
	 *
	 */
public boolean[] queryErrSkipOrNot(final SQLException ee, String errorSql) {
    final boolean[] value = new boolean[2];
    SQLEditorComposite sqlEditorComp = combinedQueryComposite.getSqlEditorComp();
    StyledText txaEdit = sqlEditorComp.getText();
    if (txaEdit != null && !txaEdit.isDisposed()) {
        sqlEditorComp.txtFind(errorSql, 0, false, false, true, false);
        line = txaEdit.getLineAtOffset(txaEdit.getSelection().x) + 1;
    }
    String errorLineMsg = Messages.bind(Messages.errWhere, line);
    String errMsg = Messages.skipOrNot + StringUtil.NEWLINE + StringUtil.NEWLINE + Messages.runError + ee.getErrorCode() + StringUtil.NEWLINE + errorLineMsg + StringUtil.NEWLINE + Messages.errorHead + ee.getMessage();
    MessageDialog dialog = new MessageDialog(QueryEditorPart.this.getEditorSite().getShell(), Messages.warning, null, errMsg, MessageDialog.QUESTION, new String[] { Messages.btnYes, Messages.btnNo }, 1) {

        Button btn = null;

        protected Control createCustomArea(Composite parent) {
            btn = new Button(parent, SWT.CHECK);
            btn.setText(Messages.showOneTimeTip);
            return btn;
        }

        protected void buttonPressed(int buttonId) {
            value[0] = btn.getSelection();
            if (buttonId == IDialogConstants.CANCEL_ID) {
                value[1] = false;
            } else {
                value[1] = true;
            }
            close();
        }
    };
    dialog.open();
    return value;
}
Also used : SQLEditorComposite(com.cubrid.common.ui.query.control.SQLEditorComposite) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) MultiDBQueryComposite(com.cubrid.common.ui.query.control.MultiDBQueryComposite) QueryResultComposite(com.cubrid.common.ui.query.control.QueryResultComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) SQLEditorComposite(com.cubrid.common.ui.query.control.SQLEditorComposite) CombinedQueryEditorComposite(com.cubrid.common.ui.query.control.CombinedQueryEditorComposite) Button(org.eclipse.swt.widgets.Button) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 10 with MessageDialog

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

the class QueryEditorPart method resetJDBCConnection.

/**
	 * Reset the query connection
	 *
	 * @return boolean
	 */
public boolean resetJDBCConnection() {
    if (connection.hasConnection() && isActive) {
        String title = com.cubrid.common.ui.common.Messages.titleConfirm;
        String msg = Messages.bind(Messages.connCloseConfirm, new String[] { this.getSelectedDatabase().getLabel() });
        String[] buttons = new String[] { Messages.btnYes, Messages.btnNo, Messages.cancel };
        MessageDialog dialog = new MessageDialog(getSite().getShell(), title, null, msg, MessageDialog.QUESTION, buttons, 0) {

            protected void buttonPressed(int buttonId) {
                switch(buttonId) {
                    case 0:
                        commit();
                        setReturnCode(0);
                        close();
                        break;
                    case 1:
                        rollback();
                        setReturnCode(1);
                        close();
                        break;
                    case 2:
                        setReturnCode(2);
                        close();
                        break;
                    default:
                        break;
                }
            }
        };
        int returnVal = dialog.open();
        if (returnVal == 2 || returnVal == -1) {
            return false;
        }
    }
    if (connection != null) {
        connection.close();
    }
    return true;
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Point(org.eclipse.swt.graphics.Point)

Aggregations

MessageDialog (org.eclipse.jface.dialogs.MessageDialog)44 Shell (org.eclipse.swt.widgets.Shell)13 CoreException (org.eclipse.core.runtime.CoreException)7 File (java.io.File)5 IPath (org.eclipse.core.runtime.IPath)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IFile (org.eclipse.core.resources.IFile)4 Point (org.eclipse.swt.graphics.Point)4 Composite (org.eclipse.swt.widgets.Composite)4 IOException (java.io.IOException)3 HashSet (java.util.HashSet)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 Path (org.eclipse.core.runtime.Path)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 CombinedQueryEditorComposite (com.cubrid.common.ui.query.control.CombinedQueryEditorComposite)2 URI (java.net.URI)2 LinkedList (java.util.LinkedList)2 IFileStore (org.eclipse.core.filesystem.IFileStore)2 IProject (org.eclipse.core.resources.IProject)2