Class Problem
Usually Checks creates the problem. It takes the severity and the tab from its own
settings (Checks.warnings(), Checks.onTab(String)) and the text from the message
of the check. Code can also create a problem directly and then pass it to Checks.report(Problem) or ValidationResult.add(Problem).
An application can extend this class to give extra data to the UI. For example, a subclass keeps the scenario graph, and the UI uses it to show the unreachable nodes. Only the constructor sets the fields of this class, and they do not change later.
AbstractProblemsPart uses the fields as follows:
- the severity selects the group: errors or warnings;
- the object sets the group by object type, and a double click selects this object in the tree, in the table and in the property panel;
- the tab: after a double click, the property panel opens the tab with this title.
If the object is null, the part shows the problem directly under its severity, without a
group, and a double click does nothing. If the tab is null, or the property panel has no
tab with this title, the panel keeps the current tab.
The class does not override equals and hashCode: two problems with equal fields
are different objects.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionProblem(Problem.Severity severity, org.eclipse.emf.ecore.EObject object, String message, String tab) Creates a problem. -
Method Summary
Modifier and TypeMethodDescriptionReturns the text of the problem for the user.org.eclipse.emf.ecore.EObjectReturns the model object of the problem.Returns the severity of the problem.getTab()Returns the title of the property panel tab.toString()Returns the text of the problem, the same asgetMessage().
-
Constructor Details
-
Problem
public Problem(Problem.Severity severity, org.eclipse.emf.ecore.EObject object, String message, String tab) Creates a problem.- Parameters:
severity- the severity of the problem, notnullobject- the model object of the problem;nullif the problem is about the whole scenario and not about one objectmessage- the text for the user in the current language; usually it contains the label of the fieldtab- the title of the property panel tab where the user can fix the problem;nullif the tab must not change
-
-
Method Details
-
getSeverity
Returns the severity of the problem.- Returns:
- the severity, not
null
-
getObject
public org.eclipse.emf.ecore.EObject getObject()Returns the model object of the problem.- Returns:
- the object, or
null
-
getMessage
Returns the text of the problem for the user.- Returns:
- the text in the language that was current when the problem was created
-
getTab
Returns the title of the property panel tab.- Returns:
- the title, or
null
-
toString
Returns the text of the problem, the same asgetMessage().
-