Move some project classes to extension to expose them in Project API
Change-Id: I25a8d463b50fd3cd016c7d182790ae54883b7401
This commit is contained in:
committed by
David Ostrovsky
parent
c72b30cab8
commit
99dea4bfba
@@ -34,10 +34,11 @@ import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||
import com.google.gerrit.client.ui.NpIntTextBox;
|
||||
import com.google.gerrit.client.ui.OnEditEnabler;
|
||||
import com.google.gerrit.client.ui.SmallHeading;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectState;
|
||||
import com.google.gerrit.extensions.common.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.common.SubmitType;
|
||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
|
||||
import com.google.gerrit.reviewdb.client.Project.SubmitType;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
@@ -185,7 +186,7 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
grid.addHeader(new SmallHeading(Util.C.headingProjectOptions()));
|
||||
|
||||
submitType = new ListBox();
|
||||
for (final Project.SubmitType type : Project.SubmitType.values()) {
|
||||
for (final SubmitType type : SubmitType.values()) {
|
||||
submitType.addItem(Util.toLongString(type), type.name());
|
||||
}
|
||||
submitType.addChangeHandler(new ChangeHandler() {
|
||||
@@ -198,7 +199,7 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
grid.add(Util.C.headingProjectSubmitType(), submitType);
|
||||
|
||||
state = new ListBox();
|
||||
for (final Project.State stateValue : Project.State.values()) {
|
||||
for (final ProjectState stateValue : ProjectState.values()) {
|
||||
state.addItem(Util.toLongString(stateValue), stateValue.name());
|
||||
}
|
||||
saveEnabler.listenTo(state);
|
||||
@@ -238,7 +239,7 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
* content merge the useContentMerge checkbox gets disabled.
|
||||
*/
|
||||
private void setEnabledForUseContentMerge() {
|
||||
if (SubmitType.FAST_FORWARD_ONLY.equals(Project.SubmitType
|
||||
if (SubmitType.FAST_FORWARD_ONLY.equals(SubmitType
|
||||
.valueOf(submitType.getValue(submitType.getSelectedIndex())))) {
|
||||
contentMerge.setEnabled(false);
|
||||
InheritedBooleanInfo b = InheritedBooleanInfo.create();
|
||||
@@ -263,7 +264,7 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
grid.addHtml(Util.C.useSignedOffBy(), signedOffBy);
|
||||
}
|
||||
|
||||
private void setSubmitType(final Project.SubmitType newSubmitType) {
|
||||
private void setSubmitType(final SubmitType newSubmitType) {
|
||||
int index = -1;
|
||||
if (submitType != null) {
|
||||
for (int i = 0; i < submitType.getItemCount(); i++) {
|
||||
@@ -277,7 +278,7 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
}
|
||||
}
|
||||
|
||||
private void setState(final Project.State newState) {
|
||||
private void setState(final ProjectState newState) {
|
||||
if (state != null) {
|
||||
for (int i = 0; i < state.getItemCount(); i++) {
|
||||
if (newState.name().equals(state.getValue(i))) {
|
||||
@@ -569,8 +570,8 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
getBool(contributorAgreements), getBool(contentMerge),
|
||||
getBool(signedOffBy), getBool(requireChangeID),
|
||||
maxObjectSizeLimit.getText().trim(),
|
||||
Project.SubmitType.valueOf(submitType.getValue(submitType.getSelectedIndex())),
|
||||
Project.State.valueOf(state.getValue(state.getSelectedIndex())),
|
||||
SubmitType.valueOf(submitType.getValue(submitType.getSelectedIndex())),
|
||||
ProjectState.valueOf(state.getValue(state.getSelectedIndex())),
|
||||
getPluginConfigValues(), new GerritCallback<ConfigInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ConfigInfo result) {
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
package com.google.gerrit.client.admin;
|
||||
|
||||
import com.google.gerrit.common.data.ProjectAdminService;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectState;
|
||||
import com.google.gerrit.extensions.common.SubmitType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwtjsonrpc.client.JsonUtil;
|
||||
|
||||
@@ -31,7 +32,7 @@ public class Util {
|
||||
AdminResources.I.css().ensureInjected();
|
||||
}
|
||||
|
||||
public static String toLongString(final Project.SubmitType type) {
|
||||
public static String toLongString(final SubmitType type) {
|
||||
if (type == null) {
|
||||
return "";
|
||||
}
|
||||
@@ -51,7 +52,7 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static String toLongString(final Project.State type) {
|
||||
public static String toLongString(final ProjectState type) {
|
||||
if (type == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -48,11 +48,10 @@ import com.google.gerrit.client.ui.Screen;
|
||||
import com.google.gerrit.client.ui.UserActivityMonitor;
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.extensions.common.ListChangesOption;
|
||||
import com.google.gerrit.extensions.common.SubmitType;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Change.Status;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.Project.SubmitType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
@@ -841,7 +840,7 @@ public class ChangeScreen2 extends Screen {
|
||||
|
||||
private void renderSubmitType(String action) {
|
||||
try {
|
||||
SubmitType type = Project.SubmitType.valueOf(action);
|
||||
SubmitType type = SubmitType.valueOf(action);
|
||||
submitActionText.setInnerText(
|
||||
com.google.gerrit.client.admin.Util.toLongString(type));
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.google.gerrit.common.data.ChangeDetail;
|
||||
import com.google.gerrit.common.data.ChangeInfo;
|
||||
import com.google.gerrit.common.data.SubmitTypeRecord;
|
||||
import com.google.gerrit.extensions.common.ListChangesOption;
|
||||
import com.google.gerrit.extensions.common.SubmitType;
|
||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Change.Status;
|
||||
@@ -50,7 +51,6 @@ import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gerrit.reviewdb.client.Patch.ChangeType;
|
||||
import com.google.gerrit.reviewdb.client.Patch.PatchType;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
@@ -311,7 +311,7 @@ public class ChangeScreen extends Screen
|
||||
@Override
|
||||
public void onSuccess(NativeString result) {
|
||||
event.getValue().setSubmitTypeRecord(SubmitTypeRecord.OK(
|
||||
Project.SubmitType.valueOf(result.asString())));
|
||||
SubmitType.valueOf(result.asString())));
|
||||
}
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
|
||||
@@ -36,11 +36,11 @@ import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.common.data.ChangeDetail;
|
||||
import com.google.gerrit.common.data.SubmitTypeRecord;
|
||||
import com.google.gerrit.extensions.common.ListChangesOption;
|
||||
import com.google.gerrit.extensions.common.SubmitType;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
@@ -169,7 +169,7 @@ public class PublishCommentScreen extends AccountScreen implements
|
||||
@Override
|
||||
public void onSuccess(NativeString result) {
|
||||
submitTypeRecord = SubmitTypeRecord.OK(
|
||||
Project.SubmitType.valueOf(result.asString()));
|
||||
SubmitType.valueOf(result.asString()));
|
||||
}
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
|
||||
@@ -17,9 +17,9 @@ package com.google.gerrit.client.projects;
|
||||
import com.google.gerrit.client.ErrorDialog;
|
||||
import com.google.gerrit.client.actions.ActionInfo;
|
||||
import com.google.gerrit.client.rpc.NativeMap;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
|
||||
import com.google.gerrit.reviewdb.client.Project.SubmitType;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectState;
|
||||
import com.google.gerrit.extensions.common.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.common.SubmitType;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
@@ -63,11 +63,11 @@ public class ConfigInfo extends JavaScriptObject {
|
||||
private final native String submit_typeRaw()
|
||||
/*-{ return this.submit_type }-*/;
|
||||
|
||||
public final Project.State state() {
|
||||
public final ProjectState state() {
|
||||
if (stateRaw() == null) {
|
||||
return Project.State.ACTIVE;
|
||||
return ProjectState.ACTIVE;
|
||||
}
|
||||
return Project.State.valueOf(stateRaw());
|
||||
return ProjectState.valueOf(stateRaw());
|
||||
}
|
||||
private final native String stateRaw()
|
||||
/*-{ return this.state }-*/;
|
||||
|
||||
@@ -19,9 +19,10 @@ import com.google.gerrit.client.rpc.CallbackGroup;
|
||||
import com.google.gerrit.client.rpc.NativeMap;
|
||||
import com.google.gerrit.client.rpc.NativeString;
|
||||
import com.google.gerrit.client.rpc.RestApi;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectState;
|
||||
import com.google.gerrit.extensions.common.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.common.SubmitType;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
|
||||
import com.google.gerrit.reviewdb.client.Project.SubmitType;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
@@ -85,7 +86,7 @@ public class ProjectApi {
|
||||
InheritableBoolean useContributorAgreements,
|
||||
InheritableBoolean useContentMerge, InheritableBoolean useSignedOffBy,
|
||||
InheritableBoolean requireChangeId, String maxObjectSizeLimit,
|
||||
SubmitType submitType, Project.State state,
|
||||
SubmitType submitType, ProjectState state,
|
||||
Map<String, Map<String, ConfigParameterValue>> pluginConfigValues,
|
||||
AsyncCallback<ConfigInfo> cb) {
|
||||
ConfigInput in = ConfigInput.create();
|
||||
@@ -217,7 +218,7 @@ public class ProjectApi {
|
||||
private final native void setSubmitTypeRaw(String t)
|
||||
/*-{ if(t)this.submit_type=t; }-*/;
|
||||
|
||||
final void setState(Project.State s) {
|
||||
final void setState(ProjectState s) {
|
||||
setStateRaw(s.name());
|
||||
}
|
||||
private final native void setStateRaw(String s)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.client.projects;
|
||||
|
||||
import com.google.gerrit.extensions.api.projects.ProjectState;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.user.client.ui.SuggestOracle;
|
||||
@@ -28,8 +29,8 @@ public class ProjectInfo
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
public final native String description() /*-{ return this.description; }-*/;
|
||||
|
||||
public final Project.State state() {
|
||||
return Project.State.valueOf(getStringState());
|
||||
public final ProjectState state() {
|
||||
return ProjectState.valueOf(getStringState());
|
||||
}
|
||||
|
||||
private final native String getStringState() /*-{ return this.state; }-*/;
|
||||
|
||||
Reference in New Issue
Block a user