コード例 #1
0
  @Override
  public void onSourceTabSelected() {

    context.setEditionMode(DataModelerContext.EditionMode.SOURCE_MODE);
    if (context.isParsed() && context.isEditorChanged()) {

      // If there are changes in the ui the source must be regenerated on server side.
      view.showLoading();
      modelerService
          .call(
              new RemoteCallback<GenerationResult>() {
                @Override
                public void callback(GenerationResult result) {
                  view.hideBusyIndicator();
                  setSource(result.getSource());
                  updateSource(result.getSource());
                  context.setEditionStatus(DataModelerContext.EditionStatus.NO_CHANGES);
                  dataModelerWBContext.setActiveContext(context);
                }
              },
              new DataModelerErrorCallback(Constants.INSTANCE.modelEditor_loading_error()))
          .updateSource(
              getSource(), versionRecordManager.getCurrentPath(), context.getDataObject());
    } else {
      if (!isOverviewTabSelected()) {
        context.setEditionStatus(DataModelerContext.EditionStatus.NO_CHANGES);
      }
      updateSource(javaSourceEditor.getContent());
      dataModelerWBContext.setActiveContext(context);
    }
  }
コード例 #2
0
  @OnStartup
  public void onStartup(final ObservablePath path, final PlaceRequest place) {

    loading = true;
    setSourceEditionGrant();
    init(path, place, resourceType);

    initContext(path);

    currentMessageType = "DataModeler" + path.toURI();
    cleanSystemMessages(getCurrentMessageType());

    javaSourceEditor.addChangeHandler(
        new EditJavaSourceWidget.TextChangeHandler() {
          @Override
          public void onTextChange() {
            if (context != null) {
              context.setEditionStatus(DataModelerContext.EditionStatus.SOURCE_CHANGED);
            }
          }
        });
  }
コード例 #3
0
 public void setSource(String source) {
   javaSourceEditor.setContent(source);
   context.getEditorModelContent().setSource(source);
 }
コード例 #4
0
 public String getSource() {
   return javaSourceEditor.getContent();
 }