use of com.google.gwt.core.client.JsArrayString in project gerrit by GerritCodeReview.
the class Extras method clearAnnotations.
public final void clearAnnotations() {
JsArrayString gutters = ((JsArrayString) JsArrayString.createArray());
cm.setOption("gutters", gutters);
annotated = false;
}
use of com.google.gwt.core.client.JsArrayString in project gerrit by GerritCodeReview.
the class Extras method setAnnotations.
public final void setAnnotations(JsArray<BlameInfo> blameInfos) {
if (blameInfos.length() > 0) {
setBlameInfo(blameInfos);
JsArrayString gutters = ((JsArrayString) JsArrayString.createArray());
gutters.push(ANNOTATION_GUTTER_ID);
cm.setOption("gutters", gutters);
annotated = true;
DateTimeFormat format = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT);
JsArray<LintLine> annotations = JsArray.createArray().cast();
for (BlameInfo blameInfo : Natives.asList(blameInfos)) {
for (RangeInfo range : Natives.asList(blameInfo.ranges())) {
Date commitTime = new Date(blameInfo.time() * 1000L);
String shortId = blameInfo.id().substring(0, 8);
String shortBlame = C.shortBlameMsg(shortId, format.format(commitTime), blameInfo.author());
String detailedBlame = C.detailedBlameMsg(blameInfo.id(), blameInfo.author(), FormatUtil.mediumFormat(commitTime), blameInfo.commitMsg());
annotations.push(LintLine.create(shortBlame, detailedBlame, shortId, Pos.create(range.start() - 1)));
}
}
cm.setOption("lint", getAnnotation(annotations));
}
}
use of com.google.gwt.core.client.JsArrayString in project gerrit by GerritCodeReview.
the class ModeInjector method ensureDependenciesAreLoaded.
private void ensureDependenciesAreLoaded(String mode) {
JsArrayString deps = getDependencies(mode);
for (int i = 0; i < deps.length(); i++) {
String d = deps.get(i);
if (loading.contains(d) || isModeLoaded(d)) {
continue;
}
if (!canLoad(d)) {
Logger.getLogger("net.codemirror").log(Level.SEVERE, "CodeMirror mode " + d + " needs " + d);
continue;
}
loading.add(d);
beginLoading(d);
}
}
use of com.google.gwt.core.client.JsArrayString in project gerrit by GerritCodeReview.
the class ChangeInfo method getMissingLabelIndex.
/**
* @return the index of the missing label or -1 if no label is missing, or if more than one label
* is missing.
*/
public final int getMissingLabelIndex() {
int i = -1;
int ret = -1;
List<LabelInfo> labels = Natives.asList(allLabels().values());
for (LabelInfo label : labels) {
i++;
if (!permittedLabels().containsKey(label.name())) {
continue;
}
JsArrayString values = permittedValues(label.name());
if (values.length() == 0) {
continue;
}
switch(label.status()) {
case // Label is required for submit.
NEED:
if (ret != -1) {
// approve, return -1
return -1;
}
ret = i;
continue;
// Label already applied.
case OK:
case // Label is not required.
MAY:
continue;
// Submit cannot happen, do not quick approve.
case REJECT:
case IMPOSSIBLE:
return -1;
}
}
return ret;
}
use of com.google.gwt.core.client.JsArrayString in project opennms by OpenNMS.
the class JSNodeMarker method getCategoriesAsString.
public String getCategoriesAsString() {
final StringBuilder catBuilder = new StringBuilder();
final JsArrayString categories = getCategories();
if (categories.length() > 0) {
if (categories.length() == 1) {
catBuilder.append("Category: ");
} else {
catBuilder.append("Categories: ");
}
for (int i = 0; i < categories.length(); i++) {
catBuilder.append(categories.get(i));
if (i != (categories.length() - 1)) {
catBuilder.append(", ");
}
}
}
return catBuilder.toString();
}
Aggregations