Search in sources :

Example 1 with RefreshComponenentsAction

use of org.talend.designer.components.exchange.ui.actions.RefreshComponenentsAction in project tdi-studio-se by Talend.

the class ExchangeView method createPartControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
     */
@Override
public void createPartControl(Composite parent) {
    try {
        browser = new Browser(parent, SWT.NONE);
        manager.setBrowser(browser);
        browser.addLocationListener(new MyExtensionLocationListener());
        browser.setLayoutData(new GridData(GridData.FILL_BOTH));
        if (manager.getDocument() != null) {
            RefreshComponenentsAction action = new RefreshComponenentsAction();
            action.run(new String[] { RefreshComponenentsAction.REFRESH_ALL });
        }
    } catch (Throwable t) {
        Exception ex = new Exception("The internal web browser can not be access,the exchange view won't be displayed");
        ExceptionHandler.process(ex);
    }
}
Also used : RefreshComponenentsAction(org.talend.designer.components.exchange.ui.actions.RefreshComponenentsAction) GridData(org.eclipse.swt.layout.GridData) MyExtensionLocationListener(org.talend.designer.components.exchange.ui.htmlcontent.MyExtensionLocationListener) PartInitException(org.eclipse.ui.PartInitException) Browser(org.eclipse.swt.browser.Browser)

Example 2 with RefreshComponenentsAction

use of org.talend.designer.components.exchange.ui.actions.RefreshComponenentsAction 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

RefreshComponenentsAction (org.talend.designer.components.exchange.ui.actions.RefreshComponenentsAction)2 Browser (org.eclipse.swt.browser.Browser)1 GridData (org.eclipse.swt.layout.GridData)1 Display (org.eclipse.swt.widgets.Display)1 Shell (org.eclipse.swt.widgets.Shell)1 PartInitException (org.eclipse.ui.PartInitException)1 ErrorDialogWidthDetailArea (org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea)1 ReviewComponentDialog (org.talend.designer.components.exchange.ui.ReviewComponentDialog)1 MyExtensionLocationListener (org.talend.designer.components.exchange.ui.htmlcontent.MyExtensionLocationListener)1 WebserviceStatus (org.talend.designer.components.exchange.util.WebserviceStatus)1