Search in sources :

Example 1 with MSCModel

use of org.eclipse.titan.log.viewer.views.msc.model.MSCModel in project titan.EclipsePlug-ins by eclipse.

the class MSCView method setModel.

public void setModel(final ExecutionModel model, final int firstRow) {
    if ((this.logFileMetaData == null) || (model == null)) {
        return;
    }
    // Create MSCModel
    String sutName = PreferencesHandler.getInstance().getPreferences(this.logFileMetaData.getProjectName()).getSutName();
    if (sutName.length() == 0) {
        sutName = MSCConstants.SUT_NAME;
    }
    this.model = model;
    MSCModel mscModel = new MSCModel(model, this.logFileMetaData, sutName);
    Frame frame = mscModel.getModelFrame();
    // Change order of components according to preferences
    List<String> visualOrderComponents = PreferencesHandler.getInstance().getPreferences(this.logFileMetaData.getProjectName()).getVisualOrderComponents();
    for (int i = visualOrderComponents.size() - 1; i >= 0; i--) {
        String currentComp = visualOrderComponents.get(i);
        if (currentComp.contentEquals(Constants.SUT)) {
            currentComp = sutName;
        } else if (currentComp.contentEquals(Constants.MTC)) {
            currentComp = MSCConstants.MTC_NAME;
        }
        for (int j = 1; j < frame.lifeLinesCount(); j++) {
            Lifeline lifeLine = frame.getLifeline(j);
            if (lifeLine.getName().contentEquals(currentComp)) {
                // Move to first position
                frame.moveLifeLineToPosition(lifeLine, 1);
            }
        }
    }
    setPartName(frame.getName());
    setFrame(frame, true);
    setContentDescription(this.logFileMetaData.getProjectRelativePath());
    int verdict = model.getTestCase().getVerdict();
    switch(verdict) {
        case Constants.VERDICT_PASS:
            setTitleImage(Activator.getDefault().getIcon(Constants.ICONS_PASS));
            break;
        case Constants.VERDICT_FAIL:
            setTitleImage(Activator.getDefault().getIcon(Constants.ICONS_FAIL));
            break;
        case Constants.VERDICT_ERROR:
            setTitleImage(Activator.getDefault().getIcon(Constants.ICONS_ERROR));
            break;
        case Constants.VERDICT_INCONCLUSIVE:
            setTitleImage(Activator.getDefault().getIcon(Constants.ICONS_INCONCLUSIVE));
            break;
        // Verdict NONE is default
        default:
            setTitleImage(Activator.getDefault().getIcon(Constants.ICONS_NONE));
            break;
    }
    if (this.mscWidget != null) {
        this.mscWidget.setSelection(new StructuredSelection(firstRow));
    }
}
Also used : Frame(org.eclipse.titan.log.viewer.views.msc.ui.core.Frame) Lifeline(org.eclipse.titan.log.viewer.views.msc.ui.core.Lifeline) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) MSCModel(org.eclipse.titan.log.viewer.views.msc.model.MSCModel)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 MSCModel (org.eclipse.titan.log.viewer.views.msc.model.MSCModel)1 Frame (org.eclipse.titan.log.viewer.views.msc.ui.core.Frame)1 Lifeline (org.eclipse.titan.log.viewer.views.msc.ui.core.Lifeline)1