Merge branch 'stable-2.6' into stable-2.7

* stable-2.6:
  Fix: NullPointerException of dashboard title
  Properly handle double click on external group in GroupTable
  Add plugin repositories section in the pom
  PrettyFormatter: Fix expand tab when syntax coloring is on.
This commit is contained in:
Shawn Pearce
2013-07-05 18:55:24 -07:00
4 changed files with 18 additions and 8 deletions

View File

@@ -29,6 +29,7 @@ import com.google.gerrit.common.PageLinks;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.History; import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter; import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.google.gwt.user.client.ui.HTMLTable.Cell; import com.google.gwt.user.client.ui.HTMLTable.Cell;
@@ -77,7 +78,12 @@ public class GroupTable extends NavigationTable<GroupInfo> {
@Override @Override
protected void onOpenRow(final int row) { protected void onOpenRow(final int row) {
History.newItem(Dispatcher.toGroup(getRowItem(row).getGroupId())); GroupInfo groupInfo = getRowItem(row);
if (isInteralGroup(groupInfo)) {
History.newItem(Dispatcher.toGroup(groupInfo.getGroupId()));
} else if (groupInfo.url() != null) {
Window.open(groupInfo.url(), "_self", null);
}
} }
public void display(GroupMap groups, String toHighlight) { public void display(GroupMap groups, String toHighlight) {
@@ -108,7 +114,7 @@ public class GroupTable extends NavigationTable<GroupInfo> {
void populate(final int row, final GroupInfo k, final String toHighlight) { void populate(final int row, final GroupInfo k, final String toHighlight) {
if (k.url() != null) { if (k.url() != null) {
if (k.url().startsWith("#" + PageLinks.ADMIN_GROUPS)) { if (isInteralGroup(k)) {
table.setWidget(row, 1, new HighlightingInlineHyperlink(k.name(), table.setWidget(row, 1, new HighlightingInlineHyperlink(k.name(),
Dispatcher.toGroup(k.getGroupId()), toHighlight)); Dispatcher.toGroup(k.getGroupId()), toHighlight));
} else { } else {
@@ -133,4 +139,9 @@ public class GroupTable extends NavigationTable<GroupInfo> {
setRowItem(row, k); setRowItem(row, k);
} }
private boolean isInteralGroup(final GroupInfo groupInfo) {
return groupInfo != null
&& groupInfo.url().startsWith("#" + PageLinks.ADMIN_GROUPS);
}
} }

View File

@@ -60,13 +60,12 @@ public class ClientSideFormatter extends PrettyFormatter {
@Override @Override
protected String prettify(String html, String type) { protected String prettify(String html, String type) {
return go(prettify.getContext(), html, type, diffPrefs.getTabSize()); return go(prettify.getContext(), html, type);
} }
private static native String go(JavaScriptObject ctx, String srcText, private static native String go(JavaScriptObject ctx, String srcText,
String srcType, int tabSize) String srcType)
/*-{ /*-{
ctx.PR_TAB_WIDTH = tabSize;
return ctx.prettyPrintOne(srcText, srcType); return ctx.prettyPrintOne(srcText, srcType);
}-*/; }-*/;
} }

View File

@@ -129,6 +129,7 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
String html = toHTML(src); String html = toHTML(src);
html = expandTabs(html);
if (diffPrefs.isSyntaxHighlighting() && getFileType() != null if (diffPrefs.isSyntaxHighlighting() && getFileType() != null
&& src.isWholeFile()) { && src.isWholeFile()) {
// The prettify parsers don't like &#39; as an entity for the // The prettify parsers don't like &#39; as an entity for the
@@ -149,8 +150,6 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
html = html.replaceAll("(\r)?\n", " $1\n"); html = html.replaceAll("(\r)?\n", " $1\n");
html = prettify(html, getFileType()); html = prettify(html, getFileType());
html = html.replaceAll(" (\r)?\n", "$1\n"); html = html.replaceAll(" (\r)?\n", "$1\n");
} else {
html = expandTabs(html);
} }
int pos = 0; int pos = 0;

View File

@@ -160,7 +160,8 @@ class DashboardsCollection implements
DashboardInfo info = new DashboardInfo(refName, path); DashboardInfo info = new DashboardInfo(refName, path);
info.project = project; info.project = project;
info.definingProject = definingProject.getName(); info.definingProject = definingProject.getName();
info.title = replace(project, config.getString("dashboard", null, "title")); String query = config.getString("dashboard", null, "title");
info.title = replace(project, query == null ? info.path : query);
info.description = replace(project, config.getString("dashboard", null, "description")); info.description = replace(project, config.getString("dashboard", null, "description"));
info.foreach = config.getString("dashboard", null, "foreach"); info.foreach = config.getString("dashboard", null, "foreach");