Search in sources :

Example 1 with EventObject

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

the class OpenValueViewAction method run.

@Override
public void run() {
    if (selectedLine == null || this.mscView == null || selectedLine < 2 || selectedLine >= this.mscView.getModel().getNumberOfEvents() + 2) {
        return;
    }
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (activePage == null) {
        return;
    }
    LogFileMetaData logFileMetaData = this.mscView.getLogFileMetaData();
    IProject project = getProjectByName(logFileMetaData);
    IFile logFile = getLogFileFromProject(logFileMetaData, project);
    if (!logFile.exists()) {
        IViewReference[] viewReferences = activePage.getViewReferences();
        ActionUtils.closeAssociatedViews(activePage, viewReferences, logFile);
        // $NON-NLS-1$
        TitanLogExceptionHandler.handleException(new UserException(Messages.getString("OpenValueViewAction.1")));
        return;
    }
    if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
        LogFileCacheHandler.handleLogFileChange(logFile);
        return;
    }
    DetailsView detailsview = (DetailsView) activePage.findView(Constants.DETAILS_VIEW_ID);
    if (detailsview == null && !forceEditorOpening) {
        return;
    }
    if (forceEditorOpening) {
        try {
            detailsview = (DetailsView) activePage.showView(Constants.DETAILS_VIEW_ID);
        } catch (PartInitException e) {
            ErrorReporter.logExceptionStackTrace(e);
            // $NON-NLS-1$
            TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenValueViewAction.4") + e.getMessage()));
            return;
        }
    }
    // pass log file meta data
    detailsview.setLogFileMetaData(this.mscView.getLogFileMetaData());
    ExecutionModel model = this.mscView.getModel();
    IEventObject ieventObject = model.getEvent(selectedLine - 2);
    if (!(ieventObject instanceof EventObject)) {
        return;
    }
    EventObject eventObject = (EventObject) ieventObject;
    String testCase = model.getTestCase().getTestCaseName();
    if ((testCase == null) || eventObject.getRecordNumber() == 0) {
        return;
    }
    // get value
    LogRecord logrecord;
    try {
        logrecord = ValueReader.getInstance().readLogRecordFromLogFileCached(this.mscView.getLogFileMetaData().getFilePath(), eventObject);
    } catch (Exception e) {
        ErrorReporter.logExceptionStackTrace(e);
        // $NON-NLS-1$
        TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenValueViewAction.3")));
        return;
    }
    String message = logrecord.getMessage();
    DetailData detailData = new DetailData(eventObject.getName(), eventObject.getPort(), message, testCase, eventObject.getEventType(), logrecord.getSourceInformation());
    detailsview.setData(detailData, false);
}
Also used : IFile(org.eclipse.core.resources.IFile) DetailsView(org.eclipse.titan.log.viewer.views.DetailsView) TechnicalException(org.eclipse.titan.log.viewer.exceptions.TechnicalException) IProject(org.eclipse.core.resources.IProject) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject) IEventObject(org.eclipse.titan.log.viewer.views.msc.model.IEventObject) PartInitException(org.eclipse.ui.PartInitException) TechnicalException(org.eclipse.titan.log.viewer.exceptions.TechnicalException) UserException(org.eclipse.titan.log.viewer.exceptions.UserException) IEventObject(org.eclipse.titan.log.viewer.views.msc.model.IEventObject) ExecutionModel(org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel) LogFileMetaData(org.eclipse.titan.log.viewer.models.LogFileMetaData) LogRecord(org.eclipse.titan.log.viewer.parsers.data.LogRecord) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) UserException(org.eclipse.titan.log.viewer.exceptions.UserException) PartInitException(org.eclipse.ui.PartInitException) DetailData(org.eclipse.titan.log.viewer.views.details.DetailData)

Example 2 with EventObject

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

the class TextTableView method addListeners.

private void addListeners() {
    this.table.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (logFileMetaData == null) {
                return;
            }
            final IFile logFile = logFileMetaData.getLogfile();
            if (logFile == null) {
                return;
            }
            if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
                LogFileCacheHandler.handleLogFileChange(logFile);
                return;
            }
            setContentDescription(TextTableView.this.logFileMetaData.getProjectRelativePath() + " [" + (TextTableView.this.table.getSelectionIndex() + 1) + "/" + TextTableView.this.filteredLogReader.size() + "]");
            if (e.getSource() instanceof Table) {
                updateSelection((Table) e.getSource());
            }
        }
    });
    this.table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(final MouseEvent e) {
            if (logFileMetaData == null) {
                return;
            }
            final IFile logFile = logFileMetaData.getLogfile();
            if (logFile == null) {
                return;
            }
            if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
                LogFileCacheHandler.handleLogFileChange(logFile);
                return;
            }
            if (!(e.getSource() instanceof Table)) {
                return;
            }
            Table table = (Table) e.getSource();
            int index = table.getSelectionIndex();
            if (index < 0 || index >= table.getItemCount()) {
                return;
            }
            TableItem tableItem = table.getItem(index);
            Object data = tableItem.getData();
            if (data instanceof LogRecord) {
                LogRecord logrecord = (LogRecord) data;
                EventObject eventObject = createEventObject(logrecord);
                // $NON-NLS-1$
                TextTableView.this.eventSelection = new EventSelection(eventObject, "");
                TextTableView.this.openValueViewMenuAction.run();
                silentOpenSourceViewMenuAction.selectionChanged(eventSelection);
                silentOpenSourceViewMenuAction.run();
            } else {
                TextTableView.this.eventSelection = new EventSelection(null, null);
            }
            fireSelectionChangeEvent();
        }
    });
    this.table.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(final KeyEvent e) {
            int moves = e.keyCode;
            if (moves != SWT.CR) {
                return;
            }
            if (e.getSource() instanceof Table) {
                Table table = (Table) e.getSource();
                TableItem tableItem = table.getItem(table.getSelectionIndex());
                Object data = tableItem.getData();
                if (data instanceof LogRecord) {
                    LogRecord logrecord = (LogRecord) data;
                    EventObject eventObject = createEventObject(logrecord);
                    // $NON-NLS-1$
                    TextTableView.this.eventSelection = new EventSelection(eventObject, "");
                } else {
                    TextTableView.this.eventSelection = new EventSelection(null, null);
                }
            }
            fireSelectionChangeEvent();
            TextTableView.this.openValueViewMenuAction.run();
            silentOpenSourceViewMenuAction.selectionChanged(eventSelection);
            silentOpenSourceViewMenuAction.run();
        }
    });
}
Also used : IFile(org.eclipse.core.resources.IFile) Table(org.eclipse.swt.widgets.Table) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) KeyAdapter(org.eclipse.swt.events.KeyAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) EventSelection(org.eclipse.titan.log.viewer.views.msc.model.EventSelection) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject) KeyEvent(org.eclipse.swt.events.KeyEvent) LogRecord(org.eclipse.titan.log.viewer.parsers.data.LogRecord) SelectionEvent(org.eclipse.swt.events.SelectionEvent) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject)

Example 3 with EventObject

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

the class OpenSourceViewMenuAction method run.

@Override
public void run() {
    if (this.eventSelection == null) {
        return;
    }
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    LogFileMetaData logFileMetaData;
    logFileMetaData = this.view.getLogFileMetaData();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    IProject project = root.getProject(logFileMetaData.getProjectName());
    IFile logFile = project.getFile(logFileMetaData.getProjectRelativePath().substring(logFileMetaData.getProjectName().length() + 1));
    if (!logFile.exists()) {
        IViewReference[] viewReferences = activePage.getViewReferences();
        ActionUtils.closeAssociatedViews(activePage, viewReferences, logFile);
        // $NON-NLS-1$
        TitanLogExceptionHandler.handleException(new UserException("The log file could not be found.\n Please perform the Open Text Table action again."));
        return;
    }
    if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
        LogFileCacheHandler.handleLogFileChange(logFile);
        return;
    }
    EventObject eventObject = this.eventSelection.getEventObject();
    String testCase = this.eventSelection.getTestCaseName();
    if ((eventObject == null) || (testCase == null)) {
        return;
    }
    // get value
    LogRecord logrecord;
    try {
        logrecord = ValueReader.getInstance().readLogRecordFromLogFile(logFileMetaData.getFilePath(), eventObject);
    } catch (Exception e) {
        ErrorReporter.logExceptionStackTrace(e);
        // $NON-NLS-1$
        TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("MSCView.8")));
        return;
    }
    SourceInformation sourceInformation = null;
    try {
        sourceInformation = SourceInformation.createInstance(logrecord.getSourceInformation());
    } catch (InvalidSourceInformationException e) {
        if (!silent) {
            String setting = logFileMetaData.getOptionsSettings("SourceInfoFormat");
            if (setting == null) {
                Display.getDefault().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        MessageDialog.openError(null, "Error opening source", // $NON-NLS-1$
                        "This log file is not generated with source location information inserted. And it really does not seem to contain source location information");
                    }
                });
            } else {
                Display.getDefault().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        // $NON-NLS-1$
                        MessageDialog.openError(null, "Error opening source", "This log record does not seem to contain source location information");
                    }
                });
            }
        }
        return;
    }
    final String fileName = sourceInformation.getSourceFileName();
    if (fileName == null) {
        view.getViewSite().getActionBars().getStatusLineManager().setErrorMessage("The name of the target file could not be extracted");
        return;
    }
    IFile targetFile;
    if (lastFilename != null && lastFilename.equals(fileName) && lastPath != null) {
        IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(lastPath);
        if (files.length == 0) {
            view.getViewSite().getActionBars().getStatusLineManager().setErrorMessage("The file `" + lastFilename + "' could not be found");
            setLastFilename(null);
            return;
        }
        targetFile = files[0];
    } else {
        targetFile = OpenSourceAction.findSourceFile(project, fileName);
        if (targetFile == null) {
            view.getViewSite().getActionBars().getStatusLineManager().setErrorMessage("The file `" + fileName + "' could not be found");
            return;
        }
        setLastFilename(fileName);
        setLastPath(targetFile.getLocationURI());
    }
    OpenSourceAction.openEditor(targetFile, sourceInformation.getLineNumber(), view, forceEditorOpening);
}
Also used : IFile(org.eclipse.core.resources.IFile) TechnicalException(org.eclipse.titan.log.viewer.exceptions.TechnicalException) InvalidSourceInformationException(org.eclipse.titan.log.viewer.models.SourceInformation.InvalidSourceInformationException) IProject(org.eclipse.core.resources.IProject) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject) TechnicalException(org.eclipse.titan.log.viewer.exceptions.TechnicalException) InvalidSourceInformationException(org.eclipse.titan.log.viewer.models.SourceInformation.InvalidSourceInformationException) UserException(org.eclipse.titan.log.viewer.exceptions.UserException) SourceInformation(org.eclipse.titan.log.viewer.models.SourceInformation) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) LogFileMetaData(org.eclipse.titan.log.viewer.models.LogFileMetaData) LogRecord(org.eclipse.titan.log.viewer.parsers.data.LogRecord) IWorkspace(org.eclipse.core.resources.IWorkspace) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) UserException(org.eclipse.titan.log.viewer.exceptions.UserException)

Example 4 with EventObject

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

the class OpenValueViewMenuAction method run.

@Override
public void run() {
    if (this.eventSelection == null) {
        return;
    }
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    LogFileMetaData logFileMetaData;
    if (this.view instanceof MSCView) {
        logFileMetaData = ((MSCView) this.view).getLogFileMetaData();
    } else if (this.view instanceof TextTableView) {
        logFileMetaData = ((TextTableView) this.view).getLogFileMetaData();
    } else {
        return;
    }
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    IProject project = root.getProject(logFileMetaData.getProjectName());
    IFile logFile = project.getFile(logFileMetaData.getProjectRelativePath().substring(logFileMetaData.getProjectName().length() + 1));
    if (!logFile.exists()) {
        IViewReference[] viewReferences = activePage.getViewReferences();
        ActionUtils.closeAssociatedViews(activePage, viewReferences, logFile);
        if (this.view instanceof TextTableView) {
            // $NON-NLS-1$
            TitanLogExceptionHandler.handleException(new UserException("The log file could not be found.\n Please perform the Open Text Table action again."));
        } else {
            // $NON-NLS-1$
            TitanLogExceptionHandler.handleException(new UserException(Messages.getString("OpenValueViewMenuAction.1")));
        }
        return;
    }
    if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
        LogFileCacheHandler.handleLogFileChange(logFile);
        return;
    }
    DetailsView detailsview = (DetailsView) activePage.findView(Constants.DETAILS_VIEW_ID);
    if (detailsview == null && !forceEditorOpening) {
        return;
    }
    if (forceEditorOpening) {
        try {
            detailsview = (DetailsView) activePage.showView(Constants.DETAILS_VIEW_ID);
        } catch (PartInitException e) {
            ErrorReporter.logExceptionStackTrace(e);
            // $NON-NLS-1$
            TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("MSCView.1") + e.getMessage()));
            return;
        }
    }
    // pass log file meta data
    detailsview.setLogFileMetaData(logFileMetaData);
    EventObject eventObject = this.eventSelection.getEventObject();
    String testCase = this.eventSelection.getTestCaseName();
    if ((eventObject == null) || (testCase == null)) {
        return;
    }
    // get value
    LogRecord logrecord;
    try {
        logrecord = ValueReader.getInstance().readLogRecordFromLogFile(logFileMetaData.getFilePath(), eventObject);
    } catch (final IOException e) {
        ErrorReporter.logExceptionStackTrace(e);
        // $NON-NLS-1$
        TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("MSCView.8")));
        return;
    } catch (final ParseException e) {
        ErrorReporter.logExceptionStackTrace(e);
        // $NON-NLS-1$
        TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("MSCView.8")));
        return;
    }
    String message = logrecord.getMessage();
    DetailData detailData = new DetailData(eventObject.getName(), eventObject.getPort(), message, testCase, eventObject.getEventType(), logrecord.getSourceInformation());
    detailsview.setData(detailData, false);
    detailsview.setFocus();
}
Also used : IFile(org.eclipse.core.resources.IFile) DetailsView(org.eclipse.titan.log.viewer.views.DetailsView) TechnicalException(org.eclipse.titan.log.viewer.exceptions.TechnicalException) IOException(java.io.IOException) IProject(org.eclipse.core.resources.IProject) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) LogFileMetaData(org.eclipse.titan.log.viewer.models.LogFileMetaData) LogRecord(org.eclipse.titan.log.viewer.parsers.data.LogRecord) IWorkspace(org.eclipse.core.resources.IWorkspace) IViewReference(org.eclipse.ui.IViewReference) MSCView(org.eclipse.titan.log.viewer.views.MSCView) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) UserException(org.eclipse.titan.log.viewer.exceptions.UserException) PartInitException(org.eclipse.ui.PartInitException) ParseException(java.text.ParseException) TextTableView(org.eclipse.titan.log.viewer.views.text.table.TextTableView) DetailData(org.eclipse.titan.log.viewer.views.details.DetailData)

Example 5 with EventObject

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

the class Parser method preParseLogRecord.

// parse
/**
 * Parse a single log record.
 *
 * @param logRecord the record to analyze.
 */
private void preParseLogRecord(final LogRecord logRecord, final Set<String> currentlyLivingComponents) {
    final String message = logRecord.getMessage();
    this.messageAnalyser.setMessage(message);
    boolean isLogRecordIgnored = false;
    if (executionModel.getFilterPattern() != null) {
        isLogRecordIgnored = !executionModel.getFilterPattern().match(logRecord);
    }
    // This branch handles send events.
    if (this.messageAnalyser.isSend()) {
        String sendType = messageAnalyser.getSendType();
        if (!isLogRecordIgnored && !isSignalIgnored(sendType) && components != null) {
            String sendTarget = messageAnalyser.getSendTarget();
            TestComponent tc = components.get(sendTarget);
            if (tc != null) {
                String logComponentRef = logRecord.getComponentReference();
                Set<String> sources = tc.getMappedFromReference(messageAnalyser.getSendSource());
                String source = getSource(logComponentRef, sources);
                if (source != null && !isComponentIgnored(source)) {
                    sends++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (messageAnalyser.isReceive()) {
        // This branch handles receive events.
        String receiveType = messageAnalyser.getReceiveType();
        if (!isLogRecordIgnored && !isSignalIgnored(receiveType) && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String receiveTargetPort = messageAnalyser.getReceiveTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(receiveTargetPort);
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    recs++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (messageAnalyser.isEnqueued()) {
        // This branch handles enqueued events.
        String receiveType = messageAnalyser.getReceiveType();
        if (!isLogRecordIgnored && !isSignalIgnored(receiveType) && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String enqueuedTargetPort = messageAnalyser.getEnqueuedTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(enqueuedTargetPort);
                // In case of valid log files it cannot happen.
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    enqs++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (this.messageAnalyser.isReceiveOperation()) {
        // This branch handles receive operation events. AFAIK,
        // it is obsolete in new (>= 1.7.pl0) TITAN versions.
        String recieveType = messageAnalyser.getReceiveOperationType();
        if (!isLogRecordIgnored && !isSignalIgnored(recieveType) && components != null) {
            String sourceRef = messageAnalyser.getReceiveSource();
            TestComponent tc = components.get(sourceRef);
            if (tc != null) {
                String receiveTargetPort = messageAnalyser.getReceiveOperationTarget();
                String logComponentRef = logRecord.getComponentReference();
                Set<String> targetRefs = tc.getMappedFromReference(receiveTargetPort);
                String targetRef = getTargetRef(logComponentRef, targetRefs);
                if (targetRef != null && !isComponentIgnored(targetRef)) {
                    recs++;
                    eventVector.add(logRecord.getRecordNumber());
                }
            }
        }
    } else if (this.messageAnalyser.isStartFunction()) {
        // This branch handles function start events.
        if (components != null) {
            String targetRef = this.messageAnalyser.getStartFunctionReference();
            if ((targetRef != null) && !isLogRecordIgnored && !isComponentIgnored(targetRef) && !isFunctionIgnored(this.messageAnalyser.getStartFunctionName())) {
                eventVector.add(logRecord.getRecordNumber());
            }
        }
    } else if (this.messageAnalyser.isComponentCreation()) {
        // This branch handles component creation events.
        if (components != null) {
            EventObject event = createEventObject(logRecord, EventType.PTC_CREATE);
            event.setEventNumber(eventVector.size() + 3);
            String reference = event.getReference();
            currentlyLivingComponents.add(reference);
            TestComponent tc = components.get(reference);
            if (tc == null) {
                addComponent(event);
                if ((reference != null) && !isComponentIgnored(reference)) {
                    this.ptcs++;
                    eventVector.add(logRecord.getRecordNumber());
                    executionModel.addLifeLineInfo(event);
                }
            } else {
                if (!isComponentIgnored(reference)) {
                    logRecord.setComponentReference(Constants.MTC_REFERENCE);
                    eventVector.add(logRecord.getRecordNumber());
                    executionModel.addLifeLineInfo(event);
                }
            }
        }
    } else if (this.messageAnalyser.isComponentDone()) {
        // This branch handles component done events.
        EventObject event = createEventObject(logRecord, EventType.PTC_DONE);
        String reference = event.getReference();
        if ((reference != null) && !isComponentIgnored(reference)) {
            eventVector.add(logRecord.getRecordNumber());
        }
    } else if (this.messageAnalyser.isComponentTermination()) {
        // This branch handles component termination events.
        if (components != null) {
            String ref = this.messageAnalyser.getComponentTerminationReference();
            currentlyLivingComponents.remove(ref);
            if ((ref != null) && !isComponentIgnored(ref)) {
                String terminationVerdict = this.messageAnalyser.getComponentTerminationVerdict();
                TestComponent component = components.get(ref);
                if (component != null) {
                    component.setVerdict(terminationVerdict);
                }
                EventObject event = createEventObject(logRecord, EventType.PTC_TERMINATE);
                event.setEventNumber(eventVector.size() + 3);
                event.setReference(ref);
                eventVector.add(logRecord.getRecordNumber());
                executionModel.addLifeLineInfo(event);
            }
        }
    } else if (this.messageAnalyser.isPortMapping()) {
        // This branch handles port mapping events.
        String mappingSource = this.messageAnalyser.getPortMappingSource();
        final String compRef = this.messageAnalyser.getComponentRef(mappingSource);
        String target = this.messageAnalyser.getPortMappingTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(mappingSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterMappingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.maps++;
        }
        // Used for mapping ports to reference
        addPortMapping(compRef, sourcePort, targetRef, targetPort);
    } else if (this.messageAnalyser.isPortUnmapping()) {
        // This branch handles port unmapping events.
        String unmappingSource = this.messageAnalyser.getPortUnMapping();
        String compRef = this.messageAnalyser.getComponentRef(unmappingSource);
        compRef = this.messageAnalyser.getComponentRef(compRef);
        String target = this.messageAnalyser.getPortUnMappingTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        if (!filterMappingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.maps++;
        }
    // Used for mapping ports to reference
    // removePortMapping(messageAnalyser.getPortMappingSource(),
    } else if (this.messageAnalyser.isPortConnection()) {
        // This branch handles port connection events.
        String connectionSource = this.messageAnalyser.getPortConnectionSource();
        final String compRef = this.messageAnalyser.getComponentRef(connectionSource);
        // Used for connect port and reference
        String target = this.messageAnalyser.getPortConnectionTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        String sourcePort = this.messageAnalyser.getPort(connectionSource);
        String targetPort = this.messageAnalyser.getPort(target);
        if (!filterConnectingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.cons++;
        }
        addPortMapping(compRef, sourcePort, targetRef, targetPort);
    } else if (this.messageAnalyser.isPortDisconnection()) {
        // This branch handles port disconnection events.
        String disconnectionSource = this.messageAnalyser.getPortDisconnectionSource();
        final String compRef = this.messageAnalyser.getComponentRef(disconnectionSource);
        // Used for disconnect port and reference
        String target = this.messageAnalyser.getPortConnectionTarget();
        String targetRef = this.messageAnalyser.getComponentRef(target);
        if (!filterConnectingPorts && !isLogRecordIgnored && !(isComponentIgnored(compRef) || isComponentIgnored(targetRef))) {
            logRecord.setComponentReference(compRef);
            eventVector.add(logRecord.getRecordNumber());
            this.cons++;
        }
    } else if (this.messageAnalyser.isTestcaseStart()) {
        // This branch handles test case start events.
        eventVector.add(logRecord.getRecordNumber());
    } else if (this.messageAnalyser.isTestcaseEnd()) {
        // This branch handles test case end events.
        eventVector.add(logRecord.getRecordNumber());
        notifyChange();
    } else if (this.messageAnalyser.isMTCCreation()) {
        EventObject event = createEventObject(logRecord, EventType.MTC_CREATE);
        addComponent(event);
        eventVector.add(logRecord.getRecordNumber());
    } else if (this.messageAnalyser.isMTCTermination()) {
        // This branch handles master test component termination events.
        eventVector.add(logRecord.getRecordNumber());
        mtcTerminated = true;
    } else if (this.messageAnalyser.isMTCDone()) {
        // This branch handles master test component done and sets the verdict.
        eventVector.add(logRecord.getRecordNumber());
    } else if (this.messageAnalyser.isSetverdict()) {
        if ((logRecord.getComponentReference() != null) && !isLogRecordIgnored && !isComponentIgnored(logRecord.getComponentReference())) {
            // Get type - change type inconc
            String setverdicttype = this.messageAnalyser.getSetverdictType();
            if (Constants.TEST_CASE_VERDICT_INCONCLUSIVE.equals(setverdicttype) && displaySetverdictInconc) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_ERROR.equals(setverdicttype) && displaySetverdictError) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_FAIL.equals(setverdicttype) && displaySetverdictFail) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_NONE.equals(setverdicttype) && displaySetverdictNone) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            } else if (Constants.TEST_CASE_VERDICT_PASS.equals(setverdicttype) && displaySetverdictPass) {
                setverdictVector.add(eventVector.size());
                eventVector.add(logRecord.getRecordNumber());
            }
            errorVector.clear();
            failVector.clear();
        }
    } else {
        // Silent events
        Boolean filtered = isEventIgnored(logRecord.getEventType());
        String compRef = logRecord.getComponentReference();
        if (compRef == null || compRef.length() == 0) {
            compRef = this.messageAnalyser.isSilentEvent();
        }
        if (compRef != null && compRef.length() > 0 && !isComponentIgnored(logRecord.getComponentReference())) {
            addDummyComponent(compRef);
            currentlyLivingComponents.add(compRef);
        }
        isLogRecordIgnored = isLogRecordIgnored || isComponentIgnored(logRecord.getComponentReference());
        if (!filtered && !isLogRecordIgnored) {
            eventVector.add(logRecord.getRecordNumber());
        }
    }
    // setverdict(error)
    if (this.messageAnalyser.isDynamicTestCaseError()) {
        ConnectedRecord connectedRecord = new ConnectedRecord(logRecord.getRecordOffset(), logRecord.getRecordLength(), logRecord.getRecordNumber());
        errorVector.add(connectedRecord);
    }
    // check if fail messages, used for setverdict(fail)
    if (this.messageAnalyser.isFailMessages()) {
        ConnectedRecord connectedRecord = new ConnectedRecord(logRecord.getRecordOffset(), logRecord.getRecordLength(), logRecord.getRecordNumber());
        failVector.add(connectedRecord);
    }
}
Also used : TestComponent(org.eclipse.titan.log.viewer.views.msc.model.TestComponent) HashSet(java.util.HashSet) Set(java.util.Set) EventObject(org.eclipse.titan.log.viewer.views.msc.model.EventObject)

Aggregations

EventObject (org.eclipse.titan.log.viewer.views.msc.model.EventObject)13 LogRecord (org.eclipse.titan.log.viewer.parsers.data.LogRecord)7 IFile (org.eclipse.core.resources.IFile)5 ParseException (java.text.ParseException)4 IProject (org.eclipse.core.resources.IProject)4 UserException (org.eclipse.titan.log.viewer.exceptions.UserException)4 LogFileMetaData (org.eclipse.titan.log.viewer.models.LogFileMetaData)4 IViewReference (org.eclipse.ui.IViewReference)4 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)4 IWorkspace (org.eclipse.core.resources.IWorkspace)3 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)3 TechnicalException (org.eclipse.titan.log.viewer.exceptions.TechnicalException)3 ExecutionModel (org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel)3 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 SourceInformation (org.eclipse.titan.log.viewer.models.SourceInformation)2 InvalidSourceInformationException (org.eclipse.titan.log.viewer.models.SourceInformation.InvalidSourceInformationException)2