diff options
author | Alexander Kurtakov | 2017-04-07 13:49:16 +0000 |
---|---|---|
committer | Roland Grunberg | 2017-05-12 14:36:18 +0000 |
commit | 32570e10ab57c7305ccc9a5d58f39673571d3c03 (patch) | |
tree | 3e32518e8434bfc48ea9bef0782b3c1a9ed9794f /oprofile/org.eclipse.linuxtools.oprofile.ui/src/org | |
parent | ddeeffca3bce14b3d91769fd3f6b9fc100a93f8f (diff) | |
download | org.eclipse.linuxtools-32570e10ab57c7305ccc9a5d58f39673571d3c03.tar.gz org.eclipse.linuxtools-32570e10ab57c7305ccc9a5d58f39673571d3c03.tar.xz org.eclipse.linuxtools-32570e10ab57c7305ccc9a5d58f39673571d3c03.zip |
oprofile: Remove opcontrol support.
Initial work on removing opcontrol support - providers and
OPCONTROL_BINARY cases.
Change-Id: Iafb257146d3a16d17927514af36aa33931cd4d19
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
Reviewed-on: https://git.eclipse.org/r/94675
Tested-by: Hudson CI
Diffstat (limited to 'oprofile/org.eclipse.linuxtools.oprofile.ui/src/org')
2 files changed, 33 insertions, 64 deletions
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java index 35e39a6dbc..9c382ec1cc 100755 --- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewDeleteSessionAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010-2013 Red Hat, Inc. + * Copyright (c) 2010, 2017 Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,9 +15,9 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.linuxtools.internal.oprofile.core.OpcontrolException; import org.eclipse.linuxtools.internal.oprofile.core.Oprofile; import org.eclipse.linuxtools.internal.oprofile.core.OprofileCorePlugin; +import org.eclipse.linuxtools.internal.oprofile.core.opxml.sessions.SessionManager; import org.eclipse.linuxtools.internal.oprofile.ui.OprofileUiPlugin; import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement; import org.eclipse.linuxtools.oprofile.ui.model.UiModelSession; @@ -48,31 +48,20 @@ public class OprofileViewDeleteSessionAction extends Action { * @param sessionName The name of the session to delete * @param eventName The name of the event containing the session */ - private void deleteSession(UiModelSession sess) { - String sessionName = sess.getLabelText(); - IUiModelElement[] modelEvents = sess.getChildren(); - try { - for (int i = 0; i < modelEvents.length; i++) { - OprofileCorePlugin - .getDefault() - .getOpcontrolProvider() - .deleteSession(sessionName, - modelEvents[i].getLabelText()); - } - // clear out collected data by this session - // check if profile is done through operf or oprofile - if (Oprofile.OprofileProject.getProfilingBinary().equals( - Oprofile.OprofileProject.OPERF_BINARY)) { - // delete operf_data folder - deleteOperfDataFolder(Oprofile.OprofileProject.getProject() - .getFolder(Oprofile.OprofileProject.OPERF_DATA)); - } else if (Oprofile.OprofileProject.getProfilingBinary().equals(Oprofile.OprofileProject.OPCONTROL_BINARY)) { - OprofileCorePlugin.getDefault().getOpcontrolProvider().reset(); - } - } catch (OpcontrolException e) { - OprofileCorePlugin.showErrorDialog("opcontrolProvider", e); //$NON-NLS-1$ + private void deleteSession(UiModelSession sess) { + String sessionName = sess.getLabelText(); + IUiModelElement[] modelEvents = sess.getChildren(); + + for (int i = 0; i < modelEvents.length; i++) { + SessionManager.deleteSession(sessionName, modelEvents[i].getLabelText()); } - } + // clear out collected data by this session + // check if profile is done through operf or oprofile + if (Oprofile.OprofileProject.getProfilingBinary().equals(Oprofile.OprofileProject.OPERF_BINARY)) { + // delete operf_data folder + deleteOperfDataFolder(Oprofile.OprofileProject.getProject().getFolder(Oprofile.OprofileProject.OPERF_DATA)); + } + } public static void deleteOperfDataFolder(IFolder operfData) { if(operfData.exists()) { @@ -84,4 +73,5 @@ public class OprofileViewDeleteSessionAction extends Action { } } + } diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java index 463adf5c3b..b1889e06b5 100755 --- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 Red Hat, Inc. + * Copyright (c) 2004, 2017 Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,9 +20,7 @@ import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.window.Window; -import org.eclipse.linuxtools.internal.oprofile.core.OpcontrolException; import org.eclipse.linuxtools.internal.oprofile.core.Oprofile; -import org.eclipse.linuxtools.internal.oprofile.core.OprofileCorePlugin; import org.eclipse.linuxtools.internal.oprofile.core.opxml.sessions.SessionManager; import org.eclipse.linuxtools.internal.oprofile.ui.OprofileUiMessages; import org.eclipse.linuxtools.internal.oprofile.ui.OprofileUiPlugin; @@ -49,8 +47,8 @@ public class OprofileViewSaveDefaultSessionAction extends Action { @Override public void run() { boolean defaultSessionExists = false; - String defaultSessionName = null; UiModelRoot modelRoot = UiModelRoot.getDefault(); + String defaultSessionName = null; IUiModelElement[] modelEvents = null; if (modelRoot.hasChildren()) { @@ -83,41 +81,22 @@ public class OprofileViewSaveDefaultSessionAction extends Action { new SaveSessionValidator()); int result = dialog.open(); - if (result == Window.OK) { - try { - OprofileCorePlugin.getDefault().getOpcontrolProvider() - .saveSession(dialog.getValue()); - // remove the default session - for (int i = 0; i < modelEvents.length; i++) { - OprofileCorePlugin - .getDefault() - .getOpcontrolProvider() - .deleteSession(defaultSessionName, - modelEvents[i].getLabelText()); - } - // clear out collected data by this session - // if opcontol is used - if (Oprofile.OprofileProject.OPCONTROL_BINARY - .equals(Oprofile.OprofileProject - .getProfilingBinary())) { - OprofileCorePlugin.getDefault() - .getOpcontrolProvider().reset(); - } else if (Oprofile.OprofileProject.OPERF_BINARY.equals(Oprofile.OprofileProject.getProfilingBinary())){ - // remove oprofile_data so current event no longer - // be there - OprofileViewDeleteSessionAction - .deleteOperfDataFolder(Oprofile.OprofileProject - .getProject() - .getFolder( - Oprofile.OprofileProject.OPERF_DATA)); - } - OprofileUiPlugin.getDefault().getOprofileView() - .refreshView(); - } catch (OpcontrolException oe) { - OprofileCorePlugin.showErrorDialog( - "opcontrolProvider", oe); //$NON-NLS-1$ + if (result == Window.OK) { + SessionManager.saveSession(dialog.getValue()); + + // remove the default session + for (int i = 0; i < modelEvents.length; i++) { + SessionManager.deleteSession(defaultSessionName, modelEvents[i].getLabelText()); } - } + + if (Oprofile.OprofileProject.OPERF_BINARY.equals(Oprofile.OprofileProject.getProfilingBinary())) { + // remove oprofile_data so current event no longer + // be there + OprofileViewDeleteSessionAction.deleteOperfDataFolder( + Oprofile.OprofileProject.getProject().getFolder(Oprofile.OprofileProject.OPERF_DATA)); + } + OprofileUiPlugin.getDefault().getOprofileView().refreshView(); + } } else { MessageDialog .openError( |