public Widget getAdminPerspective() {
return adminPerspective;
}
private void fetchPluginOverlays() {
AbstractCommand cmd = new AbstractCommand() {
protected void performOperation( boolean feedback ) {
performOperation();
}
protected void performOperation() {
final String url = GWT.getHostPageBaseURL() + "api/plugin-manager/overlays"; //$NON-NLS-1$
RequestBuilder builder = new RequestBuilder( RequestBuilder.GET, url );
builder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
builder.setHeader( "accept", "application/json" );
try {
builder.sendRequest( null, new RequestCallback() {
public void onError( Request request, Throwable exception ) {
Window.alert( exception.getMessage() );
}
public void onResponseReceived( Request request, Response response ) {
JsArray<JsXulOverlay> jsoverlays =
JsXulOverlay.parseJson( JsonUtils.escapeJsonForEval( response.getText() ) );
ArrayList<XulOverlay> overlays = new ArrayList<XulOverlay>();
for ( int i = 0; i < jsoverlays.length(); i++ ) {
JsXulOverlay o = jsoverlays.get( i );
MantleXulOverlay overlay;
overlay =
new MantleXulOverlay( o.getId(), o.getOverlayUri(), o.getSource(), o.getResourceBundleUri(),
Integer.parseInt( o.getPriority() ) );
overlays.add( overlay );
}
MantleXul.this.addOverlays( overlays );
final String url = GWT.getHostPageBaseURL() + "plugin/data-access/api/permissions/hasDataAccess"; //$NON-NLS-1$
RequestBuilder builder = new RequestBuilder( RequestBuilder.GET, url );
builder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
builder.setHeader( "accept", "application/json" );
try {
builder.sendRequest( null, new RequestCallback() {
public void onError( Request request, Throwable exception ) {
Window.alert( exception.getMessage() );
}
public void onResponseReceived( Request request, Response response ) {
if ( response.getText().equals( "true" ) ) {
controller.loadOverlay( "dataaccess" );
}
}
} );
} catch ( RequestException e ) {
// showError(e);
}
}
} );
} catch ( RequestException e ) {
// showError(e);
}
}
};
cmd.execute();
}