@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); } }
@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); } } }); }
public void setSource(String source) { javaSourceEditor.setContent(source); context.getEditorModelContent().setSource(source); }
public String getSource() { return javaSourceEditor.getContent(); }