Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 141119

Summary: Dialog warning that project does not contain annotated source
Product: [Modeling] EMF Reporter: Michael Giroux <michael.giroux>
Component: ToolsAssignee: Dave Steinberg <davidms>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Michael Giroux CLA 2006-05-10 14:48:00 EDT
If you attempt to create a new EMF model from annotated java source, and the project does not contain any sources that are recognized, that is, none of the sources have @model annotation on the interface, then it would be nice if EMF would display a warning dialog that none of the sources are annotated.

In version 2.1, if none of the sources are correctly annotated, then the package selection dialog is displayed but there are no entries.  This is a pretty subtle way of informing the user that no sources were found that meet the requirements.
Comment 1 Ed Merks CLA 2006-05-10 15:12:13 EDT
I'll add this to the long list in the other bug...  We have a lot more serious types of problems to report.  Even errors within the annotations are currently mostly overlooked or ignored... :-(

*** This bug has been marked as a duplicate of 104727 ***
Comment 2 Dave Steinberg CLA 2006-05-17 14:50:26 EDT
Reopening to mark WONTFIX.
Comment 3 Dave Steinberg CLA 2006-05-17 14:53:25 EDT
The fact that no packages are shown quite reasonably implies that no modeled elements were found in the Java source. The only other possible conclusion I could think of is that perhaps an error prevented the importer from building a model.  But we'd have no way of distinguishing between those two cases at this point (either way, we'd have no model elements), so adding an error message wouldn't appear to be terribly helpful.
Comment 4 Michael Giroux CLA 2006-05-17 15:26:54 EDT
(In reply to comment #3)
> so adding an error message
> wouldn't appear to be terribly helpful.

I do not agree.  It is not obvious to a user of EMF that an empty package selection dialog is the same as not finding any model information.  The user might think that the project is structured incorrectly and that the .classpath file does not contain a classpathentry for any packages.  Maybe I did not create packages.  Maybe I am using the wrong type of project.  Who knows.

I spent about 30 minutes looking into this problem before I discovered that I did not have a @model on the interface.  In fact, I *DID* have @model on several getXxx methods so the fact that the @model was missing on the interface statement escaped me for quite a while.  See sample below.  I thought the point of the model-from-java feature was to give a java developer who is *NOT* familiar w/ EMF a headstart.  A subtle error as I have below was very difficult to discover without any form of diagnostic message.

Michael Giroux

package com.bull.giroux;
import org.eclipse.emf.ecore.EObject;

public interface Book extends EObject{
  /**
   * @model
   */
  public String getAuthor();
  
  /**
   * @model
   */
  public int getPages();

  /**
   * @model
   */
  public int getYear();


}


Comment 5 Dave Steinberg CLA 2006-05-17 17:05:53 EDT
Okay, you've convinced me.  You make excellent points, and it didn't hurt that it was much easier to fix than I first thought.  ;)

If no model elements were produced by the importer, you'll now get an error message.  Depending on whether any Java source files were encountered, it will be one of the following:

No Java source was found

No model elements were found in Java source: check for "@model" on interfaces and classes

The fix is in CVS.
Comment 6 Nick Boldt CLA 2006-05-19 11:36:30 EDT
Fixed in 2.2.0.I200605181255.
Comment 7 Nick Boldt CLA 2008-01-28 16:47:13 EST
Move to verified as per bug 206558.