Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2012-03-23 15:29:50 +0000
committerRoland Grunberg2012-03-23 20:55:40 +0000
commit8c69c682a9a090498f09159caf185f5d5b044c70 (patch)
tree7ebf0a3a912258027afbf9a710e2edd949d3bdb4 /perf/org.eclipse.linuxtools.perf
parent23dc8046b911cd034524c7e8d793c52a0373e538 (diff)
downloadorg.eclipse.linuxtools-8c69c682a9a090498f09159caf185f5d5b044c70.tar.gz
org.eclipse.linuxtools-8c69c682a9a090498f09159caf185f5d5b044c70.tar.xz
org.eclipse.linuxtools-8c69c682a9a090498f09159caf185f5d5b044c70.zip
Clean up double-clicking of elements in the perf tree model.
Diffstat (limited to 'perf/org.eclipse.linuxtools.perf')
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMDso.java7
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMEvent.java3
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMFile.java2
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/ui/PerfDoubleClickAction.java44
4 files changed, 19 insertions, 37 deletions
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMDso.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMDso.java
index b387913c36..17a01020b8 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMDso.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMDso.java
@@ -27,14 +27,13 @@ public class PMDso extends TreeParent {
public PMFile getFile(String fileName) {
//check if exists else make a new one.
- PMFile tmp = (PMFile)getChild(fileName);
+ PMFile tmp = (PMFile) getChild(fileName);
if (tmp != null) {
- return tmp;
} else {
tmp = new PMFile(fileName);
addChild(tmp);
- return tmp;
- }
+ }
+ return tmp;
}
public void setPath(String filePath) {
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMEvent.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMEvent.java
index af56e2eacb..fe692ceff6 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMEvent.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMEvent.java
@@ -14,7 +14,6 @@ public class PMEvent extends TreeParent {
public PMEvent(String name) {
super(name);
- // Don't think theres anything else to do in here.
}
-
+
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMFile.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMFile.java
index cb84c8e7b6..19dc4361d6 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMFile.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/model/PMFile.java
@@ -11,7 +11,7 @@
package org.eclipse.linuxtools.perf.model;
public class PMFile extends TreeParent {
- protected String path;
+ private String path;
public PMFile(String fileName) {
super(fileName, 0);
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/ui/PerfDoubleClickAction.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/ui/PerfDoubleClickAction.java
index 6b650592b1..26178b1c16 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/ui/PerfDoubleClickAction.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/perf/ui/PerfDoubleClickAction.java
@@ -15,15 +15,12 @@ import java.util.HashMap;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.linuxtools.perf.PerfPlugin;
-import org.eclipse.linuxtools.perf.model.PMCommand;
import org.eclipse.linuxtools.perf.model.PMDso;
-import org.eclipse.linuxtools.perf.model.PMEvent;
import org.eclipse.linuxtools.perf.model.PMFile;
import org.eclipse.linuxtools.perf.model.PMLineRef;
import org.eclipse.linuxtools.perf.model.PMSymbol;
@@ -41,66 +38,53 @@ public class PerfDoubleClickAction extends Action {
public void run() {
ISelection selection = viewer.getSelection();
Object obj = ((IStructuredSelection)selection).getFirstElement();
+
if (obj instanceof PMLineRef) {
//Open in editor
- PMLineRef tmp = (PMLineRef)obj;
-// showMessage(tmp.getParent().getName().toString());
+ PMFile file = (PMFile) ((PMLineRef) obj).getParent();
try {
- PMFile file = (PMFile) tmp.getParent().getParent();
- ProfileUIUtils.openEditorAndSelect(file.getPath(), Integer.parseInt(tmp.getName()));
+ ProfileUIUtils.openEditorAndSelect(file.getPath(), Integer.parseInt(file.getName()));
} catch (PartInitException e) {
e.printStackTrace();
} catch (BadLocationException e) {
e.printStackTrace();
}
} else if (obj instanceof PMFile) {
- PMFile tmp = (PMFile)obj;
- //showMessage(tmp.getName().toString());
+ PMFile file = (PMFile)obj;
try {
- ProfileUIUtils.openEditorAndSelect(tmp.getName(), 1);
+ ProfileUIUtils.openEditorAndSelect(file.getName(), 1);
} catch (PartInitException e) {
e.printStackTrace();
} catch (BadLocationException e) {
e.printStackTrace();
}
} else if (obj instanceof PMSymbol) {
- PMSymbol tmpsym = (PMSymbol)obj;
- PMFile tmpfile = (PMFile)tmpsym.getParent();
- PMDso tmpdso = (PMDso)tmpfile.getParent();
- if (tmpfile.getName().equals(PerfPlugin.STRINGS_UnfiledSymbols))
+ PMSymbol sym = (PMSymbol)obj;
+ PMFile file = (PMFile) sym.getParent();
+ PMDso dso = (PMDso) file.getParent();
+
+ if (file.getName().equals(PerfPlugin.STRINGS_UnfiledSymbols))
return; //Don't try to do anything if we don't know where or what the symbol is.
- String binaryPath = tmpdso.getPath();
+
+ String binaryPath = dso.getPath();
ICProject project;
try {
project = ProfileUIUtils.findCProjectWithAbsolutePath(binaryPath);
- HashMap<String, int[]> map = ProfileUIUtils.findFunctionsInProject(project, tmpsym.getFunctionName(), -1, tmpfile.getPath(), true);
+ HashMap<String, int[]> map = ProfileUIUtils.findFunctionsInProject(project, sym.getFunctionName(), -1, file.getPath(), true);
boolean bFound = false;
for (String loc : map.keySet()) {
ProfileUIUtils.openEditorAndSelect(loc, map.get(loc)[0], map.get(loc)[1]);
bFound = true;
}
if (!bFound) {
- ProfileUIUtils.openEditorAndSelect(tmpfile.getPath(), 1);
+ ProfileUIUtils.openEditorAndSelect(file.getPath(), 1);
}
} catch (CoreException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
} catch (BadLocationException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
- } else if (obj instanceof PMDso || obj instanceof PMCommand || obj instanceof PMEvent) {
- //no effect
- } else {
- //Shouldn't happen...
- showMessage("Double-click detected on "+obj.toString()+" "+obj.getClass().toString());
}
}
- private void showMessage(String message) {
- MessageDialog.openInformation(
- viewer.getControl().getShell(),
- "Perf Profile View",
- message);
- }
}

Back to the top