use of com.google.gwt.core.client.JavaScriptObject in project gerrit by GerritCodeReview.
the class DownloadBox method saveScheme.
private void saveScheme() {
String schemeStr = scheme.getValue(scheme.getSelectedIndex());
GeneralPreferences prefs = Gerrit.getUserPreferences();
if (Gerrit.isSignedIn() && !schemeStr.equals(prefs.downloadScheme())) {
prefs.downloadScheme(schemeStr);
GeneralPreferences in = GeneralPreferences.create();
in.downloadScheme(schemeStr);
AccountApi.self().view("preferences").put(in, new AsyncCallback<JavaScriptObject>() {
@Override
public void onSuccess(JavaScriptObject result) {
}
@Override
public void onFailure(Throwable caught) {
}
});
}
}
use of com.google.gwt.core.client.JavaScriptObject in project gerrit by GerritCodeReview.
the class GroupSuggestOracle method requestSuggestions.
@Override
public void requestSuggestions(final Request req, final Callback done) {
if (req.getQuery().length() < chars) {
responseEmptySuggestion(req, done);
return;
}
RestApi rest = new RestApi("/groups/").addParameter("suggest", req.getQuery());
if (req.getLimit() > 0) {
rest.addParameter("n", req.getLimit());
}
rest.get(new AsyncCallback<NativeMap<JavaScriptObject>>() {
@Override
public void onSuccess(NativeMap<JavaScriptObject> result) {
List<String> keys = result.sortedKeys();
List<Suggestion> suggestions = new ArrayList<>(keys.size());
for (String g : keys) {
suggestions.add(new HighlightSuggestion(req.getQuery(), g));
}
done.onSuggestionsReady(req, new Response(suggestions));
}
@Override
public void onFailure(Throwable caught) {
responseEmptySuggestion(req, done);
}
});
}
use of com.google.gwt.core.client.JavaScriptObject in project gerrit by GerritCodeReview.
the class AccountApi method registerEmail.
/** Register a new email address */
public static void registerEmail(String account, String email, AsyncCallback<EmailInfo> cb) {
JavaScriptObject in = JavaScriptObject.createObject();
new RestApi("/accounts/").id(account).view("emails").id(email).ifNoneMatch().put(in, cb);
}
use of com.google.gwt.core.client.JavaScriptObject in project rstudio by rstudio.
the class MainWindowObject method set.
public final void set(T value) {
JavaScriptObject rstudioObject = getRStudioObject(getRStudioMainWindow());
setImpl(key_, value, rstudioObject);
}
use of com.google.gwt.core.client.JavaScriptObject in project rstudio by rstudio.
the class MainWindowObject method get.
@SuppressWarnings("unchecked")
public final T get() {
JavaScriptObject rstudioObject = getRStudioObject(getRStudioMainWindow());
if (!hasImpl(key_, rstudioObject))
return provider_.defaultValue();
// Work around JDK 1.6 compiler issues with casting from JSO to T
JavaScriptObject object = getImpl(key_, rstudioObject);
T casted = (T) object;
return casted;
}
Aggregations