use of org.eclipse.tracecompass.tmf.ui.project.model.TmfAnalysisElement in project tracecompass by tracecompass.
the class ProjectModelAnalysisTest method testListAnalysis.
/**
* Test the getAvailableAnalysis() method
*/
@Test
public void testListAnalysis() {
TmfTraceElement trace = getTraceElement();
/* Make sure the analysis list is not empty */
List<TmfAnalysisElement> analysisList = trace.getAvailableAnalysis();
assertFalse(analysisList.isEmpty());
/* Make sure TestAnalysisUi is there */
TmfAnalysisElement analysis = null;
for (TmfAnalysisElement analysisElement : analysisList) {
if (analysisElement.getAnalysisId().equals(MODULE_UI)) {
analysis = analysisElement;
}
}
assertNotNull(analysis);
assertEquals("Test analysis in UI", analysis.getName());
}
use of org.eclipse.tracecompass.tmf.ui.project.model.TmfAnalysisElement in project tracecompass by tracecompass.
the class ProjectModelOutputTest method testListOutputs.
/**
* Test the getAvailableOutputs() method
*/
@Test
public void testListOutputs() {
TmfAnalysisElement analysis = getTestAnalysisUi();
TmfCommonProjectElement traceElement = analysis.getParent().getParent();
/* To get the list of outputs the trace needs to be opened */
analysis.activateParentTrace();
try {
ProjectModelTestData.delayUntilTraceOpened(traceElement);
} catch (WaitTimeoutException e) {
fail("The analysis parent did not open in a reasonable time");
}
/* Make sure the output list is not empty */
WaitUtils.waitUntil(new ConditionTraceChildrenElements(analysis, 1));
List<TmfAnalysisOutputElement> outputList = analysis.getAvailableOutputs();
assertFalse(outputList.isEmpty());
boolean found = false;
for (ITmfProjectModelElement element : outputList) {
if (element instanceof TmfAnalysisOutputElement) {
TmfAnalysisOutputElement outputElement = (TmfAnalysisOutputElement) element;
if (outputElement.getName().equals("Test Analysis View")) {
found = true;
}
}
}
assertTrue(found);
traceElement.closeEditors();
}
use of org.eclipse.tracecompass.tmf.ui.project.model.TmfAnalysisElement in project tracecompass by tracecompass.
the class ProjectModelOutputTest method getTestAnalysisUi.
private TmfAnalysisElement getTestAnalysisUi() {
TmfTraceElement trace = getTraceElement();
/* Make sure the analysis list is not empty */
List<TmfAnalysisElement> analysisList = trace.getAvailableAnalysis();
assertFalse(analysisList.isEmpty());
/* Make sure TestAnalysisUi is there */
TmfAnalysisElement analysis = null;
for (TmfAnalysisElement analysisElement : analysisList) {
if (analysisElement.getAnalysisId().equals(ProjectModelAnalysisTest.MODULE_UI)) {
analysis = analysisElement;
}
}
assertNotNull(analysis);
return analysis;
}
use of org.eclipse.tracecompass.tmf.ui.project.model.TmfAnalysisElement in project tracecompass by tracecompass.
the class ProjectModelOutputTest method testOpenView.
/**
* Test the outputAnalysis method for a view
*/
@Test
public void testOpenView() {
TmfAnalysisElement analysis = getTestAnalysisUi();
TmfCommonProjectElement traceElement = analysis.getParent().getParent();
analysis.activateParentTrace();
try {
ProjectModelTestData.delayUntilTraceOpened(traceElement);
} catch (WaitTimeoutException e) {
fail("The analysis parent did not open in a reasonable time");
}
WaitUtils.waitUntil(new ConditionTraceChildrenElements(analysis, 1));
List<TmfAnalysisOutputElement> outputList = analysis.getAvailableOutputs();
assertFalse(outputList.isEmpty());
final IWorkbench wb = PlatformUI.getWorkbench();
final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();
IViewPart view = activePage.findView(TestAnalysisUi.VIEW_ID);
if (view != null) {
activePage.hideView(view);
}
TmfAnalysisOutputElement outputElement = null;
for (ITmfProjectModelElement element : outputList) {
if (element instanceof TmfAnalysisOutputElement) {
TmfAnalysisOutputElement el = (TmfAnalysisOutputElement) element;
if (el.getName().equals("Test Analysis View")) {
outputElement = el;
}
}
}
assertNotNull(outputElement);
outputElement.outputAnalysis();
WaitUtils.waitUntil(workbenchPage -> workbenchPage.findView(TestAnalysisUi.VIEW_ID) != null, activePage, "Test Analysis View did not open");
traceElement.closeEditors();
}
use of org.eclipse.tracecompass.tmf.ui.project.model.TmfAnalysisElement in project tracecompass by tracecompass.
the class OpenAction method isEnabled.
@Override
public boolean isEnabled() {
ISelection selection = selectionProvider.getSelection();
if (!selection.isEmpty()) {
IStructuredSelection sSelection = (IStructuredSelection) selection;
Object firstElement = sSelection.getFirstElement();
if ((sSelection.size() == 1) && (firstElement instanceof TmfTraceElement || firstElement instanceof TmfExperimentElement || firstElement instanceof TmfOnDemandAnalysisElement || firstElement instanceof TmfAnalysisOutputElement || firstElement instanceof TmfReportElement || firstElement instanceof TmfAnalysisElement)) {
element = (TmfProjectModelElement) firstElement;
return true;
}
}
return false;
}
Aggregations