- Timestamp:
- 03/29/12 23:10:04 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modelicaml/org.openmodelica.modelicaml.tabbedproperties.editors.glue/src/org/openmodelica/modelicaml/tabbedproperties/editors/glue/edit/part/PropertiesSectionXtextEditorHelper.java
r1356 r1471 46 46 import org.eclipse.core.runtime.IStatus; 47 47 import org.eclipse.core.runtime.Status; 48 import org.eclipse.core.runtime.jobs.Job; 49 import org.eclipse.emf.common.util.Diagnostic; 48 50 import org.eclipse.emf.ecore.EObject; 51 import org.eclipse.emf.ecore.util.Diagnostician; 49 52 import org.eclipse.jface.action.Action; 50 53 import org.eclipse.jface.action.IAction; … … 363 366 * @return boolean 364 367 */ 368 // public boolean isDocumentHasErrors() { 369 // IXtextDocument xtextDocument = sourceViewerHandle.getDocument(); 370 // return (xtextDocument.readOnly(new IUnitOfWork<Boolean, XtextResource>() { 371 // public Boolean exec(XtextResource state) throws Exception { 372 // IParseResult parseResult = state.getParseResult(); 373 // return !state.getErrors().isEmpty() || parseResult == null; 374 // } 375 // })); 376 // } 377 // 378 379 /** 380 * Checks if is document has errors. 381 * 382 * @return boolean 383 */ 365 384 public boolean isDocumentHasErrors() { 385 // partialEditor.createResource(getText()); 386 if (getXtextResource().getContents() != null && getXtextResource().getContents().size() > 0) { 387 EObject myModel = getXtextResource().getContents().get(0); 388 Diagnostic diagnostic = Diagnostician.INSTANCE.validate(myModel); 389 switch (diagnostic.getSeverity()) { 390 case Diagnostic.ERROR: { 391 return true; 392 // System.err.println("Model has errors: ",diagnostic); 393 } 394 case Diagnostic.WARNING: 395 return false; 396 // System.err.println("Model has warnings: ",diagnostic); 397 } 398 } 399 366 400 IXtextDocument xtextDocument = sourceViewerHandle.getDocument(); 367 401 return (xtextDocument.readOnly(new IUnitOfWork<Boolean, XtextResource>() { … … 371 405 } 372 406 })); 373 } 407 408 } 409 410 411 412 413 374 414 375 415
Note: See TracChangeset
for help on using the changeset viewer.