use of org.eclipse.linuxtools.internal.perf.PerfPlugin in project linuxtools by eclipse.
the class PerfStatsQuickDiffHandler method execute.
@Override
public Object execute(ExecutionEvent event) {
// get default files
PerfPlugin plugin = PerfPlugin.getDefault();
IPath curStatData = plugin.getPerfFile(PerfPlugin.PERF_DEFAULT_STAT);
IPath prevStatData = plugin.getPerfFile(PerfPlugin.PERF_DEAFULT_OLD_STAT);
IResource curStatFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(curStatData);
IResource prevStatFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(prevStatData);
// Inject our own selections into the context
IEvaluationContext ctx = (IEvaluationContext) event.getApplicationContext();
ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, new StructuredSelection(new IResource[] { prevStatFile, curStatFile }));
ICommandService cmdService = PlatformUI.getWorkbench().getService(ICommandService.class);
// $NON-NLS-1$
Command cmd = cmdService.getCommand("org.eclipse.linuxtools.perf.CompareAction");
try {
cmd.executeWithChecks(event);
} catch (Exception e) {
}
return null;
}
use of org.eclipse.linuxtools.internal.perf.PerfPlugin in project linuxtools by eclipse.
the class PerfStatsQuickDiffHandler method isEnabled.
@Override
public boolean isEnabled() {
PerfPlugin plugin = PerfPlugin.getDefault();
IPath workingDir = plugin.getWorkingDir();
URI curStatDataURI = null;
URI prevStatDataURI = null;
if (workingDir != null) {
IPath curStatData = plugin.getPerfFile(PerfPlugin.PERF_DEFAULT_STAT);
IPath prevStatData = plugin.getPerfFile(PerfPlugin.PERF_DEAFULT_OLD_STAT);
IRemoteFileProxy proxy = null;
try {
curStatDataURI = new URI(curStatData.toPortableString());
prevStatDataURI = new URI(prevStatData.toPortableString());
proxy = RemoteProxyManager.getInstance().getFileProxy(curStatDataURI);
} catch (URISyntaxException e) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError);
} catch (CoreException e) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError);
}
IFileStore curFileStore = proxy.getResource(curStatDataURI.getPath());
IFileStore prevFileStore = proxy.getResource(prevStatDataURI.getPath());
return (curFileStore.fetchInfo().exists() && prevFileStore.fetchInfo().exists());
}
return false;
}
Aggregations