Search in sources :

Example 1 with LamiAnalysisFactoryException

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysisFactoryException in project tracecompass by tracecompass.

the class AddAnalysisHandler method execute.

@Override
@Nullable
public Object execute(@Nullable ExecutionEvent event) throws ExecutionException {
    final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    final AddAnalysisDialog dialog = new AddAnalysisDialog(shell, Messages.AddAnalysisDialog_Title, NAME_INPUT_VALIDATOR, COMMAND_INPUT_VALIDATOR);
    if (dialog.open() != Window.OK) {
        // User clicked Cancel, cancel the add operation
        return null;
    }
    Path configFilePath;
    try {
        configFilePath = LamiConfigUtils.createConfigFile(checkNotNull(dialog.getName().trim()), checkNotNull(dialog.getCommand().trim()));
    } catch (IOException e) {
        showErrorBox(shell, e);
        return null;
    }
    try {
        final LamiAnalysis analysis = LamiAnalysisFactoryFromConfigFile.buildFromConfigFile(configFilePath, true, trace -> true);
        OnDemandAnalysisManager.getInstance().registerAnalysis(analysis);
    } catch (LamiAnalysisFactoryException e) {
        showErrorBox(shell, e);
        return null;
    }
    final Object elem = HandlerUtils.getSelectedModelElement();
    if (elem != null && elem instanceof TmfOnDemandAnalysesElement) {
        final TmfOnDemandAnalysesElement analysesElem = (TmfOnDemandAnalysesElement) elem;
        analysesElem.refresh();
    }
    return null;
}
Also used : Path(java.nio.file.Path) LamiAnalysisFactoryException(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysisFactoryException) Shell(org.eclipse.swt.widgets.Shell) IOException(java.io.IOException) LamiAnalysis(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysis) TmfOnDemandAnalysesElement(org.eclipse.tracecompass.tmf.ui.project.model.TmfOnDemandAnalysesElement) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 2 with LamiAnalysisFactoryException

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysisFactoryException in project tracecompass by tracecompass.

the class Activator method loadUserDefinedAnalyses.

private void loadUserDefinedAnalyses() {
    final Path configDirPath = LamiConfigUtils.getConfigDirPath();
    try {
        final List<LamiAnalysis> analyses = LamiAnalysisFactoryFromConfigFile.buildFromConfigDir(configDirPath, true, trace -> true);
        OnDemandAnalysisManager manager = OnDemandAnalysisManager.getInstance();
        analyses.forEach(manager::registerAnalysis);
    } catch (LamiAnalysisFactoryException e) {
        // $NON-NLS-1$
        logWarning("Cannot load user-defined external analyses", e);
    }
}
Also used : Path(java.nio.file.Path) LamiAnalysisFactoryException(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysisFactoryException) OnDemandAnalysisManager(org.eclipse.tracecompass.tmf.core.analysis.ondemand.OnDemandAnalysisManager) LamiAnalysis(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysis)

Example 3 with LamiAnalysisFactoryException

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysisFactoryException in project tracecompass by tracecompass.

the class Activator method start.

// ------------------------------------------------------------------------
// Operators
// ------------------------------------------------------------------------
@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    TmfEventMatching.registerMatchObject(new TcpEventMatching());
    TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
    try {
        LttngAnalysesLoader.load();
    } catch (LamiAnalysisFactoryException | IOException e) {
        // Not the end of the world if the analyses are not available
        // $NON-NLS-1$
        logWarning("Cannot find LTTng analyses configuration files: " + e.getMessage());
    }
}
Also used : LamiAnalysisFactoryException(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysisFactoryException) TcpLttngEventMatching(org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpLttngEventMatching) IOException(java.io.IOException) TcpEventMatching(org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpEventMatching)

Aggregations

LamiAnalysisFactoryException (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysisFactoryException)3 IOException (java.io.IOException)2 Path (java.nio.file.Path)2 LamiAnalysis (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysis)2 Nullable (org.eclipse.jdt.annotation.Nullable)1 Shell (org.eclipse.swt.widgets.Shell)1 TcpEventMatching (org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpEventMatching)1 TcpLttngEventMatching (org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpLttngEventMatching)1 OnDemandAnalysisManager (org.eclipse.tracecompass.tmf.core.analysis.ondemand.OnDemandAnalysisManager)1 TmfOnDemandAnalysesElement (org.eclipse.tracecompass.tmf.ui.project.model.TmfOnDemandAnalysesElement)1