Fix Eclipse warnings introduced by I51f3ac5a
Change-Id: Ia1d3d119958743edcbd447cddf7b7d5471723d20
This commit is contained in:
@@ -38,14 +38,13 @@ public class ExtensionPanel extends FlowPanel {
|
|||||||
this(extensionPoint, new ArrayList<String>());
|
this(extensionPoint, new ArrayList<String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtensionPanel(GerritUiExtensionPoint extensionPoint,
|
public ExtensionPanel(GerritUiExtensionPoint extensionPoint, List<String> panelNames) {
|
||||||
List<String> panelNames) {
|
|
||||||
this.extensionPoint = extensionPoint;
|
this.extensionPoint = extensionPoint;
|
||||||
this.contexts = create(panelNames);
|
this.contexts = create(panelNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Context> create(List<String> panelNames) {
|
private List<Context> create(List<String> panelNames) {
|
||||||
List<Context> contexts = new ArrayList<Context>();
|
List<Context> contexts = new ArrayList<>();
|
||||||
for (Definition def : getOrderedDefs(panelNames)) {
|
for (Definition def : getOrderedDefs(panelNames)) {
|
||||||
SimplePanel p = new SimplePanel();
|
SimplePanel p = new SimplePanel();
|
||||||
add(p);
|
add(p);
|
||||||
@@ -58,31 +57,28 @@ public class ExtensionPanel extends FlowPanel {
|
|||||||
if (panelNames == null) {
|
if (panelNames == null) {
|
||||||
panelNames = Collections.emptyList();
|
panelNames = Collections.emptyList();
|
||||||
}
|
}
|
||||||
Map<String, List<Definition>> defsOrderedByName =
|
Map<String, List<Definition>> defsOrderedByName = new LinkedHashMap<>();
|
||||||
new LinkedHashMap<String, List<Definition>>();
|
|
||||||
for (String name : panelNames) {
|
for (String name : panelNames) {
|
||||||
defsOrderedByName.put(name, new ArrayList<Definition>());
|
defsOrderedByName.put(name, new ArrayList<Definition>());
|
||||||
}
|
}
|
||||||
for (Definition def : Natives.asList(
|
for (Definition def : Natives.asList(Definition.get(extensionPoint.name()))) {
|
||||||
Definition.get(extensionPoint.name()))) {
|
|
||||||
addDef(def, defsOrderedByName);
|
addDef(def, defsOrderedByName);
|
||||||
}
|
}
|
||||||
List<Definition> orderedDefs = new ArrayList<Definition>();
|
List<Definition> orderedDefs = new ArrayList<>();
|
||||||
for (List<Definition> defList : defsOrderedByName.values()) {
|
for (List<Definition> defList : defsOrderedByName.values()) {
|
||||||
orderedDefs.addAll(defList);
|
orderedDefs.addAll(defList);
|
||||||
}
|
}
|
||||||
return orderedDefs;
|
return orderedDefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addDef(Definition def,
|
private static void addDef(Definition def, Map<String, List<Definition>> defsOrderedByName) {
|
||||||
Map<String, List<Definition>> defsOrderedByName) {
|
|
||||||
String panelName = def.getPanelName();
|
String panelName = def.getPanelName();
|
||||||
if (panelName.equals(def.getPluginName() + ".undefined")) {
|
if (panelName.equals(def.getPluginName() + ".undefined")) {
|
||||||
/* Handle a partially undefined panel name from the
|
/* Handle a partially undefined panel name from the
|
||||||
javascript layer by generating a random panel name.
|
javascript layer by generating a random panel name.
|
||||||
This maintains support for panels that do not provide a name. */
|
This maintains support for panels that do not provide a name. */
|
||||||
panelName = def.getPluginName() + "." + Long.toHexString(
|
panelName =
|
||||||
Double.doubleToLongBits(Math.random()));
|
def.getPluginName() + "." + Long.toHexString(Double.doubleToLongBits(Math.random()));
|
||||||
}
|
}
|
||||||
if (defsOrderedByName.containsKey(panelName)) {
|
if (defsOrderedByName.containsKey(panelName)) {
|
||||||
defsOrderedByName.get(panelName).add(def);
|
defsOrderedByName.get(panelName).add(def);
|
||||||
@@ -163,6 +159,7 @@ public class ExtensionPanel extends FlowPanel {
|
|||||||
protected Definition() {}
|
protected Definition() {}
|
||||||
|
|
||||||
public final native String getPanelName() /*-{ return this.pluginName + "." + this.name; }-*/;
|
public final native String getPanelName() /*-{ return this.pluginName + "." + this.name; }-*/;
|
||||||
|
|
||||||
public final native String getPluginName() /*-{ return this.pluginName; }-*/;
|
public final native String getPluginName() /*-{ return this.pluginName; }-*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,8 +22,6 @@ import com.google.gerrit.reviewdb.client.Change;
|
|||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@@ -558,20 +558,22 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
|||||||
loadPermissionRules(rc, ACCOUNTS, null, KEY_SAME_GROUP_VISIBILITY, groupsByName, false));
|
loadPermissionRules(rc, ACCOUNTS, null, KEY_SAME_GROUP_VISIBILITY, groupsByName, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadExtensionPanelSections(Config rc) throws IOException {
|
private void loadExtensionPanelSections(Config rc) {
|
||||||
Map<String, String> lowerNames = Maps.newHashMapWithExpectedSize(2);
|
Map<String, String> lowerNames = Maps.newHashMapWithExpectedSize(2);
|
||||||
extensionPanelSections = Maps.newLinkedHashMap();
|
extensionPanelSections = Maps.newLinkedHashMap();
|
||||||
for (String name : rc.getSubsections(EXTENSION_PANELS)) {
|
for (String name : rc.getSubsections(EXTENSION_PANELS)) {
|
||||||
String lower = name.toLowerCase();
|
String lower = name.toLowerCase();
|
||||||
if (lowerNames.containsKey(lower)) {
|
if (lowerNames.containsKey(lower)) {
|
||||||
error(new ValidationError(PROJECT_CONFIG, String.format(
|
error(
|
||||||
"Extension Panels \"%s\" conflicts with \"%s\"",
|
new ValidationError(
|
||||||
name, lowerNames.get(lower))));
|
PROJECT_CONFIG,
|
||||||
|
String.format(
|
||||||
|
"Extension Panels \"%s\" conflicts with \"%s\"", name, lowerNames.get(lower))));
|
||||||
}
|
}
|
||||||
lowerNames.put(lower, name);
|
lowerNames.put(lower, name);
|
||||||
extensionPanelSections.put(name,
|
extensionPanelSections.put(
|
||||||
new ArrayList<String>(Arrays.asList(
|
name,
|
||||||
rc.getStringList(EXTENSION_PANELS, name, KEY_PANEL))));
|
new ArrayList<>(Arrays.asList(rc.getStringList(EXTENSION_PANELS, name, KEY_PANEL))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user