use of org.talend.designer.components.exchange.ui.ReviewComponentDialog 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"));
}
}
});
}
}
}
}
}
Aggregations