Search in sources :

Example 1 with Frame

use of org.eclipse.titan.log.viewer.views.msc.ui.core.Frame in project titan.EclipsePlug-ins by eclipse.

the class MSCModel method getModelFrame.

/**
 * @return the frame
 */
public Frame getModelFrame() {
    if (this.model == null) {
        return null;
    }
    this.frame = new Frame(this);
    this.frame.setName(this.model.getTestCase().getTestCaseName());
    List<EventObject> events = this.model.getLifelineInformation();
    if (sutLifeline == null) {
        this.sutLifeline = new Lifeline();
    }
    for (EventObject event : events) {
        int eventNumber = event.getEventNumber();
        sutLifeline.setCurrentEventOccurrence(eventNumber);
        extractLifeLineAndHeaderNodes(event, eventNumber);
    }
    sutLifeline.setCurrentEventOccurrence(model.getNumberOfEvents());
    return this.frame;
}
Also used : Frame(org.eclipse.titan.log.viewer.views.msc.ui.core.Frame) Lifeline(org.eclipse.titan.log.viewer.views.msc.ui.core.Lifeline)

Example 2 with Frame

use of org.eclipse.titan.log.viewer.views.msc.ui.core.Frame 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

Frame (org.eclipse.titan.log.viewer.views.msc.ui.core.Frame)2 Lifeline (org.eclipse.titan.log.viewer.views.msc.ui.core.Lifeline)2 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