Search in sources :

Example 11 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class RowGenProcessMain method run.

/**
     * yzhang Comment method "run".
     * 
     * @param refresh
     * @param number
     * @return
     */
public List<List<String>> run(final Button refresh, String number) {
    this.number = number;
    results.clear();
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
    try {
        progressService.runInUI(PlatformUI.getWorkbench().getProgressService(), new IRunnableWithProgress() {

            public void run(final IProgressMonitor monitor) {
                //$NON-NLS-1$
                monitor.beginTask(Messages.getString("RowGenPreivewCodeMain.Process.Generate"), IProgressMonitor.UNKNOWN);
                try {
                    try {
                        process = runPreviewCode();
                        if (process == null) {
                            return;
                        }
                        StringBuffer out = new StringBuffer();
                        StringBuffer err = new StringBuffer();
                        createResultThread(process.getErrorStream(), err).start();
                        createResultThread(process.getInputStream(), out).start();
                        process.waitFor();
                        if (out.length() > 0) {
                            convert(out.toString());
                        }
                        if (err.length() > 0) {
                            //$NON-NLS-1$
                            String mainMsg = Messages.getString("RowGenPreivewCodeMain.PerlRun.Error");
                            new ErrorDialogWidthDetailArea(Display.getCurrent().getActiveShell(), PluginUtils.PLUGIN_ID, mainMsg, //$NON-NLS-1$
                            Messages.getString("RowGenProcessMain.checkParameter", err.toString()));
                        }
                    } catch (Exception e) {
                        ExceptionHandler.process(e);
                        kill();
                    }
                } finally {
                    monitor.done();
                    //$NON-NLS-1$
                    refresh.setText(Messages.getString("RowGenPreivewCodeMain.PreviewBtn.Text"));
                }
            }
        }, null);
    } catch (Exception ex) {
        ExceptionHandler.process(ex);
    } finally {
        proc.reconnection();
    }
    return results;
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IProgressService(org.eclipse.ui.progress.IProgressService) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) ProcessorException(org.talend.designer.runprocess.ProcessorException) IOException(java.io.IOException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 12 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class ModifyExtensionAction method updateUI.

/**
     * Update ui after job finished.
     * 
     * @param action
     * @param event
     */
private void updateUI(final ModifyExtensionJob modifyJob, final IJobChangeEvent event) {
    if (event.getResult().isOK()) {
        WebserviceStatus wbs = modifyJob.getWs();
        if (wbs.isResult()) {
            ExchangeManager.getInstance().setSelectedExtension(null);
            RefreshComponenentsAction action = new RefreshComponenentsAction();
            action.run(new String[] { RefreshComponenentsAction.REFRESH_MY_EXTENSIONS, RefreshComponenentsAction.REFRESH_AVAILABLES }, ContentConstants.UL_LIST_MY_EXTENSIONS);
        } else {
            String mainMsg = Messages.getString("ModifyExtensionJob.ModifyFailure") + " " + Messages.getString("ModifyExtensionJob.ModifyFailureTip");
            new ErrorDialogWidthDetailArea(null, ExchangePlugin.PLUGIN_ID, mainMsg, wbs.getMessageException());
        }
    }
}
Also used : ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) WebserviceStatus(org.talend.designer.components.exchange.util.WebserviceStatus)

Example 13 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class DeleteExtensionAction method updateUI.

/**
     * Update ui after job finished.
     * 
     * @param action
     * @param event
     */
private void updateUI(final DeleteExtensionJob delJob, final IJobChangeEvent event) {
    if (event.getResult().isOK()) {
        WebserviceStatus wbs = delJob.getWs();
        if (wbs.isResult()) {
            ExchangeManager.getInstance().setSelectedExtension(null);
            RefreshComponenentsAction action = new RefreshComponenentsAction();
            action.run(new String[] { RefreshComponenentsAction.REFRESH_ALL }, ContentConstants.UL_LIST_MY_EXTENSIONS);
        } else {
            String mainMsg = Messages.getString("DeleteExtensionJob.DeleteFailure") + " " + Messages.getString("DeleteExtensionJob.DeleteFailureTip");
            new ErrorDialogWidthDetailArea(null, ExchangePlugin.PLUGIN_ID, mainMsg, wbs.getMessageException());
        }
    }
    ExchangeManager.getInstance().setSelectedExtension(null);
}
Also used : ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) WebserviceStatus(org.talend.designer.components.exchange.util.WebserviceStatus)

Example 14 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class ExchangeUrlAction method run.

public void run(IIntroSite site, Properties params) {
    if (params != null) {
        if (EDIT_REVIEWS.equals(params.get(KEY_TYPE))) {
            Display current = Display.getCurrent();
            if (current == null) {
                current = Display.getDefault();
            }
            Shell shell = null;
            if (current != null) {
                shell = current.getActiveShell();
            }
            final Shell fShell = shell;
            if (ExchangeManager.getInstance().getSelectedExtension() != null) {
                ReviewComponentDialog reviewDialog = new ReviewComponentDialog(shell);
                if (reviewDialog.open() == IDialogConstants.OK_ID) {
                    final String title = reviewDialog.getTitle();
                    final String rate = reviewDialog.getRating() + "";
                    final String review = reviewDialog.getReview();
                    Display.getDefault().asyncExec(new Runnable() {

                        public void run() {
                            if (ExchangeUtils.checkUserAndPassword()) {
                                WebserviceStatus ws = ExchangeWebService.insertReviewService(ExchangeManager.getInstance().getSelectedExtension().getIdExtension(), ExchangeUtils.TYPEEXTENSION, ExchangeUtils.getUserName(), ExchangeUtils.getPasswordHash(), title, review, rate);
                                if (ws.isResult()) {
                                    RefreshComponenentsAction action = new RefreshComponenentsAction();
                                    action.run(new String[] { RefreshComponenentsAction.REFRESH_AVAILABLES }, ContentConstants.UL_LIST_AVAILABLE_EXTENSIONS);
                                } else {
                                    String mainMsg = Messages.getString("AvailableExtensionsComposite.ViewDetail.InsertionReviewFailure") + " " + Messages.getString("AvailableExtensionsComposite.ViewDetail.InsertionReviewFailureTip");
                                    new ErrorDialogWidthDetailArea(fShell, ExchangePlugin.PLUGIN_ID, mainMsg, ws.getMessageException());
                                }
                            } else {
                                MessageDialog.openInformation(fShell, Messages.getString("AvailableExtensionsComposite.ViewDetail.WriteReview"), //$NON-NLS-1$
                                Messages.getString("Exchange.logon.error"));
                            }
                        }
                    });
                }
            }
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ReviewComponentDialog(org.talend.designer.components.exchange.ui.ReviewComponentDialog) RefreshComponenentsAction(org.talend.designer.components.exchange.ui.actions.RefreshComponenentsAction) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) Display(org.eclipse.swt.widgets.Display) WebserviceStatus(org.talend.designer.components.exchange.util.WebserviceStatus)

Aggregations

ErrorDialogWidthDetailArea (org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea)14 WebserviceStatus (org.talend.designer.components.exchange.util.WebserviceStatus)5 Shell (org.eclipse.swt.widgets.Shell)2 BusinessException (org.talend.commons.exception.BusinessException)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)2 IOException (java.io.IOException)1 ResultSet (java.sql.ResultSet)1 ResultSetMetaData (java.sql.ResultSetMetaData)1 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Display (org.eclipse.swt.widgets.Display)1 IProgressService (org.eclipse.ui.progress.IProgressService)1 ListenableList (org.talend.commons.utils.data.list.ListenableList)1 ILibrariesService (org.talend.core.model.general.ILibrariesService)1 ELibraryInstallStatus (org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus)1