Class AbstractProblemsPart
java.lang.Object
com.amalgamasimulation.desktop.appelements.parts.AbstractProblemsPart
Base part for the list of problems that a check of the scenario finds. The part shows a tree. The
top nodes are errors and warnings, each with the number of problems. Under them, the problems are
in groups by the type of the tree element. If a problem has no type, it is directly under the
node of errors or warnings. A group shows not more than 100 problems, and the label of the group
then shows "N of M". The part shows the result from the VALIDATION_FINISHED message. A subclass
implements validate, which starts the check.
- Author:
- Ionov Ivan
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.e4.core.services.events.IEventBrokerprotected com.amalgamasimulation.desktop.utils.MessageManagerprotected org.eclipse.swt.widgets.ToolBar -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateContents(org.eclipse.swt.widgets.Composite parent) Creates the tree of problems and subscribes to the VALIDATION_FINISHED and NEW_SCENARIO messages.protected voidcreateToolbar(org.eclipse.swt.widgets.Composite parent) Creates the toolbar with the refresh button.protected AbstractTreeElementTypegetTreeElementType(Problem problem) Returns the type of the tree element that the problem's object belongs to.protected booleanReturns true if the tree needs a column that shows the problem's object.protected StringobjectLabel(Problem problem) Returns the text of the object column: the id of the problem's object.protected voidonDoubleClick(Problem problem) Opens the problem's object.protected voidThe part calls this method on the NEW_SCENARIO message.voidpostConstruct(org.eclipse.swt.widgets.Composite parent) Creates the toolbar and the contents of the part in the parent.protected voidshowResult(ValidationResult result) Replaces the contents of the tree with the result of the check and expands all nodes.protected abstract voidvalidate()Starts the check of the current scenario.
-
Field Details
-
eventBroker
@Inject protected org.eclipse.e4.core.services.events.IEventBroker eventBroker -
messageManager
@Inject protected com.amalgamasimulation.desktop.utils.MessageManager messageManager -
toolbar
protected org.eclipse.swt.widgets.ToolBar toolbar
-
-
Constructor Details
-
AbstractProblemsPart
public AbstractProblemsPart()
-
-
Method Details
-
validate
protected abstract void validate()Starts the check of the current scenario. The part calls this method from the refresh button on the toolbar and on a new scenario. The result comes to the part in the VALIDATION_FINISHED message. -
onNewScenario
protected void onNewScenario()The part calls this method on the NEW_SCENARIO message. By default, calls validate. -
postConstruct
@PostConstruct public void postConstruct(org.eclipse.swt.widgets.Composite parent) Creates the toolbar and the contents of the part in the parent. -
createToolbar
protected void createToolbar(org.eclipse.swt.widgets.Composite parent) Creates the toolbar with the refresh button. The button calls validate. -
createContents
protected void createContents(org.eclipse.swt.widgets.Composite parent) Creates the tree of problems and subscribes to the VALIDATION_FINISHED and NEW_SCENARIO messages. If the part opens after a check, it shows the last result of the check at once. When the tree is disposed, the part unsubscribes from the messages. -
hasObjectColumn
protected boolean hasObjectColumn()Returns true if the tree needs a column that shows the problem's object. By default, returns false. -
objectLabel
Returns the text of the object column: the id of the problem's object. If the object has no id, returns an empty string. -
getTreeElementType
Returns the type of the tree element that the problem's object belongs to. The part uses this type to put problems in groups and to open the object on a double-click. If the result is null, the problem is not in a group. -
onDoubleClick
Opens the problem's object. The part selects the type of the element in the tree, shows the table of this type, selects the object in the table and shows its properties. If the problem has a tab, the part opens this tab in the properties. If the problem has no object, does nothing. -
showResult
Replaces the contents of the tree with the result of the check and expands all nodes.
-