Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse')
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/AbstractEventConfigTab.java4
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/LaunchOptions.java13
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java35
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java29
5 files changed, 59 insertions, 33 deletions
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/AbstractEventConfigTab.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/AbstractEventConfigTab.java
index 8e605aa228..79e8e1ff8f 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/AbstractEventConfigTab.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/AbstractEventConfigTab.java
@@ -1027,7 +1027,9 @@ public abstract class AbstractEventConfigTab extends
public void setEnabled(boolean enabled) {
if (unitMaskButtons != null) {
for (Button b : unitMaskButtons) {
- b.setEnabled(enabled);
+ if (!b.isDisposed()) {
+ b.setEnabled(enabled);
+ }
}
}
}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/LaunchOptions.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/LaunchOptions.java
index c44f0b3117..b357b41e42 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/LaunchOptions.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/LaunchOptions.java
@@ -13,6 +13,7 @@
package org.eclipse.linuxtools.internal.oprofile.launch.configuration;
import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -42,7 +43,7 @@ public class LaunchOptions {
public boolean isValid() {
IRemoteFileProxy proxy = null;
try {
- proxy = RemoteProxyManager.getInstance().getFileProxy(Oprofile.OprofileProject.getProject());
+ proxy = RemoteProxyManager.getInstance().getFileProxy(getOprofileProject());
} catch (CoreException e) {
e.printStackTrace();
}
@@ -55,7 +56,15 @@ public class LaunchOptions {
return true;
}
-
+
+ /**
+ * Get project to profile
+ * @return IProject project to profile
+ */
+ protected IProject getOprofileProject(){
+ return Oprofile.OprofileProject.getProject();
+ }
+
/**
* Saves the global options of this object into the specified launch
* configuration
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java
index fe2f029d72..a8d25fc99c 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileCounter.java
@@ -49,9 +49,18 @@ public class OprofileCounter {
* @param nr the counter number
*/
public OprofileCounter(int nr) {
+ this(nr, Oprofile.getEvents(nr));
+ }
+
+ /**
+ * Constructor for OprofileCounter.
+ * @param nr the counter number
+ * @param events the given events for counter number <code>nr</code>
+ */
+ public OprofileCounter(int nr, OpEvent[] events) {
number = nr;
_enabled = false;
- eventList = Oprofile.getEvents(number);
+ eventList = events;
daemonEvent = new OprofileDaemonEvent();
}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java
index c153534f7f..bf1392a3d2 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/configuration/OprofileSetupTab.java
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.internal.oprofile.launch.configuration;
import java.text.MessageFormat;
import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -48,9 +49,6 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
protected Button checkSeparateLibrary;
protected Button checkSeparateKernel;
- //maybe these later
-// protected Button _checkSeparateThread;
-// protected Button _checkSeparateCpu;
protected LaunchOptions options = null;
@@ -63,7 +61,6 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
@Override
public boolean isValid(ILaunchConfiguration config) {
boolean b = options.isValid();
- // System.out.println("SetupTab isValid = " + b);
return b;
}
@@ -87,10 +84,6 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
checkSeparateLibrary.setSelection(true);
if ((separate & OprofileDaemonOptions.SEPARATE_KERNEL) != 0)
checkSeparateKernel.setSelection(true);
-// if ((separate & OprofileDaemonOptions.SEPARATE_THREAD) != 0)
-// _checkSeparateThread.setSelection(true);
-// if ((separate & OprofileDaemonOptions.SEPARATE_CPU) != 0)
-// _checkSeparateCpu.setSelection(true);
}
}
@@ -164,8 +157,6 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
checkSeparateLibrary = myCreateCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateLibrary.text")); //$NON-NLS-1$
checkSeparateKernel = myCreateCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateKernel.text")); //$NON-NLS-1$
-// _checkSeparateThread = _createCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateThread.text")); //$NON-NLS-1$
-// _checkSeparateCpu = _createCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateCpu.text")); //$NON-NLS-1$
}
// convenience method to create radio buttons with the given label
@@ -199,18 +190,6 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
} else {
newSeparate = oldSeparate & ~OprofileDaemonOptions.SEPARATE_KERNEL;
}
-// } else if (button == _checkSeparateThread) {
-// if (button.getSelection()) {
-// newSeparate = oldSeparate | OprofileDaemonOptions.SEPARATE_THREAD;
-// } else {
-// newSeparate = oldSeparate & ~OprofileDaemonOptions.SEPARATE_THREAD;
-// }
-// } else if (button == _checkSeparateCpu) {
-// if (button.getSelection()) {
-// newSeparate = oldSeparate | OprofileDaemonOptions.SEPARATE_CPU;
-// } else {
-// newSeparate = oldSeparate & ~OprofileDaemonOptions.SEPARATE_CPU;
-// }
}
options.setSeparateSamples(newSeparate);
@@ -225,7 +204,7 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
if (filename.length() > 0) {
try {
- proxy = RemoteProxyManager.getInstance().getFileProxy(Oprofile.OprofileProject.getProject());
+ proxy = RemoteProxyManager.getInstance().getFileProxy(getOprofileProject());
} catch (CoreException e) {
e.printStackTrace();
}
@@ -252,7 +231,7 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
// Displays a file dialog to allow the user to select the kernel image file
private void showFileDialog(Shell shell) {
try {
- proxy = RemoteProxyManager.getInstance().getFileProxy(Oprofile.OprofileProject.getProject());
+ proxy = RemoteProxyManager.getInstance().getFileProxy(getOprofileProject());
} catch (CoreException e) {
e.printStackTrace();
}
@@ -287,4 +266,12 @@ public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
}
}
}
+
+ /**
+ * Get project to profile
+ * @return IProject project to profile
+ */
+ protected IProject getOprofileProject(){
+ return Oprofile.OprofileProject.getProject();
+ }
}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
index 35e4cc47c5..b9cd069c22 100644
--- a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/internal/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
@@ -59,7 +59,7 @@ public abstract class AbstractOprofileLaunchConfigurationDelegate extends Profil
OprofileDaemonEvent[] daemonEvents = null;
if (!config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false)) {
//get the events to profile from the counters
- OprofileCounter[] counters = OprofileCounter.getCounters(config);
+ OprofileCounter[] counters = oprofileCounters(config);
ArrayList<OprofileDaemonEvent> events = new ArrayList<OprofileDaemonEvent>();
for (int i = 0; i < counters.length; ++i) {
@@ -78,10 +78,8 @@ public abstract class AbstractOprofileLaunchConfigurationDelegate extends Profil
* originally in the CDT under LocalCDILaunchDelegate::RunLocalApplication
*/
//set up and launch the local c/c++ program
- IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(Oprofile.OprofileProject.getProject());
- IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(Oprofile.OprofileProject.getProject());
- URI workingDirURI = proxy.getWorkingDir();
- IPath workingDirPath = new Path(workingDirURI.getPath());
+ IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(oprofileProject());
+ IPath workingDirPath = new Path(oprofileWorkingDirURI().getPath());
String arguments[] = getProgramArgumentsArray( config );
Process process = launcher.execute(exePath, arguments, getEnvironment(config), workingDirPath, monitor);
@@ -138,6 +136,27 @@ public abstract class AbstractOprofileLaunchConfigurationDelegate extends Profil
OprofileCorePlugin.getDefault().getOpcontrolProvider().dumpSamples();
}
+ protected IProject oprofileProject(){
+ return Oprofile.OprofileProject.getProject();
+ }
+
+
+ /**
+ * Return the URI of the current working directory from the current
+ * project's file proxy.
+ *
+ * @return URI URI of the working directory.
+ * @throws CoreException
+ */
+ protected URI oprofileWorkingDirURI() throws CoreException{
+ IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(oprofileProject());
+ return proxy.getWorkingDir();
+ }
+
+ protected OprofileCounter[] oprofileCounters(ILaunchConfiguration config){
+ return OprofileCounter.getCounters(config);
+ }
+
/**
* Runs opcontrol --help. Returns true if there was any output, false
* otherwise. Return value can be used to tell if the user successfully

Back to the top