use of org.eclipse.linuxtools.internal.perf.ui.PerfProfileView in project linuxtools by eclipse.
the class PerfCore method refreshView.
public static void refreshView(final String title) {
Display.getDefault().syncExec(() -> {
try {
PerfProfileView view = (PerfProfileView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PerfPlugin.VIEW_ID);
view.setContentDescription(title);
view.refreshModel();
} catch (PartInitException e) {
logException(e);
}
});
}
use of org.eclipse.linuxtools.internal.perf.ui.PerfProfileView in project linuxtools by eclipse.
the class PerfSaveSessionHandler method saveData.
@Override
public IPath saveData(String filename) {
// get paths
IPath newDataLoc = getNewDataLocation(filename, DATA_EXT);
IPath defaultDataLoc = PerfPlugin.getDefault().getPerfProfileData();
URI newDataLocURI = null;
URI defaultDataLocURI = null;
// get files
IRemoteFileProxy proxy = null;
try {
newDataLocURI = new URI(newDataLoc.toPortableString());
defaultDataLocURI = new URI(defaultDataLoc.toPortableString());
proxy = RemoteProxyManager.getInstance().getFileProxy(newDataLocURI);
} catch (URISyntaxException e) {
openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment());
} catch (CoreException e) {
openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment());
}
IFileStore newDataFileStore = proxy.getResource(newDataLocURI.getPath());
IFileStore defaultDataFileStore = proxy.getResource(defaultDataLocURI.getPath());
if (canSave(newDataLoc)) {
// copy default data into new location
try {
defaultDataFileStore.copy(newDataFileStore, EFS.OVERWRITE, null);
PerfPlugin.getDefault().setPerfProfileData(newDataLoc);
try {
PerfProfileView view = (PerfProfileView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PerfPlugin.VIEW_ID);
view.setContentDescription(newDataLoc.toOSString());
} catch (PartInitException e) {
// fail silently
}
IFileInfo info = newDataFileStore.fetchInfo();
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true);
newDataFileStore.putInfo(info, EFS.SET_ATTRIBUTES, null);
return newDataLoc;
} catch (CoreException e) {
openErroDialog(Messages.PerfSaveSession_failure_title, Messages.PerfSaveSession_failure_msg, newDataLoc.lastSegment());
}
}
return null;
}
use of org.eclipse.linuxtools.internal.perf.ui.PerfProfileView in project linuxtools by eclipse.
the class ModelTest method testDoubleClickAction.
@Test
public void testDoubleClickAction() {
TreeParent invisibleRoot = buildModel("resources/defaultevent-data/perf.data", "resources/defaultevent-data/perf.data.txt", "resources/defaultevent-data/perf.data.err.log");
PerfPlugin.getDefault().setModelRoot(invisibleRoot);
// update the model root for the view
PerfCore.refreshView("resources/defaultevent-data/perf.data");
// number of parents excluding invisibleRoot
int numOfParents = getNumberOfParents(invisibleRoot) - 1;
// create a double click action to act on the tree viewer
try {
PerfProfileView view = (PerfProfileView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PerfPlugin.VIEW_ID);
TreeViewer tv = view.getTreeViewer();
PerfDoubleClickAction dblClick = new PerfDoubleClickAction(tv);
// double click every element
doubleClickAllChildren(invisibleRoot, tv, dblClick);
// If all elements are expanded, this is the number of elements
// in our model that have children.
assertEquals(numOfParents, tv.getExpandedElements().length);
} catch (PartInitException e) {
fail("Failed to open the Profiling View.");
}
}
Aggregations