summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCamilo Bernal2013-05-01 16:31:52 (EDT)
committer Roland Grunberg2013-05-27 14:07:21 (EDT)
commit100e4be5e9762493f06a975ba807187131557d72 (patch)
tree1f40a1edb49fcfffc42e28e12a99cba560d493ba
parent1ac4822aafb3b616c0248ed0563e02ed008b1172 (diff)
downloadorg.eclipse.linuxtools-100e4be5e9762493f06a975ba807187131557d72.zip
org.eclipse.linuxtools-100e4be5e9762493f06a975ba807187131557d72.tar.gz
org.eclipse.linuxtools-100e4be5e9762493f06a975ba807187131557d72.tar.bz2
Add support for perf diff command.refs/changes/96/11996/13
* Added perf diff view, handler, data manipulator and SWTBot test. * Perf diff feature behaves similarly to perf stat diff. That is, it runs on user specified perf data files and displays the comparison result in a text view. Change-Id: If66b0eb439e6e18314d49858efcb26a9d51aade7 Reviewed-on: https://git.eclipse.org/r/11996 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AllPerfTests.java3
-rw-r--r--perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/ReportComparisonViewTest.java55
-rw-r--r--perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/DataManipulatorTest.java37
-rw-r--r--perf/org.eclipse.linuxtools.perf/plugin.properties7
-rw-r--r--perf/org.eclipse.linuxtools.perf/plugin.xml36
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java12
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ReportComparisonData.java47
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfComparisonHandler.java53
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/ReportComparisonView.java146
9 files changed, 386 insertions, 10 deletions
diff --git a/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AllPerfTests.java b/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AllPerfTests.java
index 360fe67..b7e97d0 100644
--- a/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AllPerfTests.java
+++ b/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AllPerfTests.java
@@ -17,6 +17,7 @@ import org.junit.runners.Suite;
@Suite.SuiteClasses({
StatViewTest.class,
SourceDisassemblyViewTest.class,
- StatComparisonViewTest.class })
+ StatComparisonViewTest.class,
+ ReportComparisonViewTest.class})
public class AllPerfTests {
}
diff --git a/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/ReportComparisonViewTest.java b/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/ReportComparisonViewTest.java
new file mode 100644
index 0000000..db87fb1
--- /dev/null
+++ b/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/ReportComparisonViewTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.perf.swtbot.tests;
+
+import org.eclipse.linuxtools.internal.perf.PerfPlugin;
+import org.eclipse.linuxtools.internal.perf.ui.ReportComparisonView;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.junit.Test;
+
+/**
+ * SWTBot test for ReportComparisonView.
+ */
+public class ReportComparisonViewTest extends AbstractStyledTextViewTest {
+
+ @Override
+ @Test
+ public void runPerfViewTest() throws Exception {
+ /*
+ * No need to create project or open launch dialog,
+ * just need to open view and run test.
+ */
+ openStubView();
+ testPerfView();
+ }
+
+ @Override
+ protected String getViewId() {
+ return "Perf Comparison";
+ }
+
+ @Override
+ protected String getExpectedText() {
+ return PerfPlugin.getDefault().getReportDiffData().getPerfData();
+ }
+
+ @Override
+ protected void setPerfOptions(SWTWorkbenchBot bot) {
+ // no perf options needed
+ }
+
+ @Override
+ protected void openStubView() {
+ PerfPlugin.getDefault().setReportDiffData(new StubPerfData());
+ ReportComparisonView.refreshView();
+ }
+
+}
diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/DataManipulatorTest.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/DataManipulatorTest.java
index 2625b3a..0e3230f 100644
--- a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/DataManipulatorTest.java
+++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/DataManipulatorTest.java
@@ -12,12 +12,14 @@ package org.eclipse.linuxtools.internal.perf.tests;
import static org.junit.Assert.assertEquals;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.perf.ReportComparisonData;
import org.eclipse.linuxtools.internal.perf.SourceDisassemblyData;
import org.eclipse.linuxtools.internal.perf.StatData;
import org.junit.Test;
@@ -77,6 +79,20 @@ public class DataManipulatorTest {
assertEquals(expected, sData.getPerfData().trim());
}
+ @Test
+ public void testEchoReportDiffData() {
+ File oldData = new File("perf.old.data"); //$NON-NLS-1$
+ File newData = new File("perf.data"); //$NON-NLS-1$
+ StubReportDiffData diffData = new StubReportDiffData("title", //$NON-NLS-1$
+ oldData, newData);
+ diffData.parse();
+
+ String expected = "perf diff " + oldData.getAbsolutePath() //$NON-NLS-1$
+ + " " + newData.getAbsolutePath(); //$NON-NLS-1$
+
+ assertEquals(expected, diffData.getPerfData().trim());
+ }
+
/**
* Used for testing SourceDisassemblyData
*/
@@ -123,4 +139,25 @@ public class DataManipulatorTest {
}
}
+ /**
+ * Used for testing ReportComparisonData
+ */
+ private class StubReportDiffData extends ReportComparisonData{
+
+ public StubReportDiffData(String title, File oldFile, File newFile) {
+ super(title, oldFile, newFile);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ protected String[] getCommand() {
+ // return the same command with 'echo' prepended
+ List<String> ret = new ArrayList<String>();
+ ret.add("echo"); //$NON-NLS-1$
+ ret.addAll(Arrays.asList(super.getCommand()));
+ return ret.toArray(new String[0]);
+ }
+
+ }
+
}
diff --git a/perf/org.eclipse.linuxtools.perf/plugin.properties b/perf/org.eclipse.linuxtools.perf/plugin.properties
index 0cc4d26..d823640 100644
--- a/perf/org.eclipse.linuxtools.perf/plugin.properties
+++ b/perf/org.eclipse.linuxtools.perf/plugin.properties
@@ -4,4 +4,9 @@ launchConfigurationTabGroup.description.0 = Profile C/C++ Application Using Perf
launchConfigurationTabGroup.description.1 = Profile Remote C/C++ Application Using Perf
perfLaunchConfiguration.name.0=Perf
perfLaunchConfiguration.description=Hardware/Software Events Timing
-perfLaunchConfiguration.information=Note: does not require set-up or special compilation. \ No newline at end of file
+perfLaunchConfiguration.information=Note: does not require set-up or special compilation.
+perfSaveCurrentSession=Save Current Session
+perfCompareSessions=Compare Sessions
+perfSaveStatistics=Save Statistics
+perfCompareStatistics=Compare Statistics
+perfCompareLatest=Compare Latest \ No newline at end of file
diff --git a/perf/org.eclipse.linuxtools.perf/plugin.xml b/perf/org.eclipse.linuxtools.perf/plugin.xml
index ec0cb4f..6808f0b 100644
--- a/perf/org.eclipse.linuxtools.perf/plugin.xml
+++ b/perf/org.eclipse.linuxtools.perf/plugin.xml
@@ -43,6 +43,15 @@
id="org.eclipse.linuxtools.perf.ui.StatViewDiff"
name="Perf Statistics Comparison">
</view>
+ <view
+ allowMultiple="true"
+ category="org.eclipse.linuxtools.profiling.ui"
+ class="org.eclipse.linuxtools.internal.perf.ui.ReportComparisonView"
+ icon="icons/symbol.gif"
+ id="org.eclipse.linuxtools.perf.ui.ReportViewDiff"
+ name="Perf Comparison"
+ restorable="true">
+ </view>
</extension>
<extension
point="org.eclipse.help.contexts">
@@ -178,7 +187,13 @@
<command
commandId="org.eclipse.linuxtools.perf.SaveData"
id="org.eclipse.linuxtools.perf.SaveCommand"
- label="Save Current Session"
+ label="%perfSaveCurrentSession"
+ style="push">
+ </command>
+ <command
+ commandId="org.eclipse.linuxtools.perf.ReportDiff"
+ id="org.eclipse.linuxtools.perf.ReportDiff"
+ label="%perfCompareSessions"
style="push">
</command>
</menuContribution>
@@ -188,19 +203,19 @@
<command
commandId="org.eclipse.linuxtools.perf.SaveStatData"
id="org.eclipse.linuxtools.perf.SaveStatData"
- label="Save Statistics"
+ label="%perfSaveStatistics"
style="push">
</command>
<command
commandId="org.eclipse.linuxtools.perf.StatDiff"
id="org.eclipse.linuxtools.perf.StatDiff"
- label="Compare Statistics"
+ label="%perfCompareStatistics"
style="push">
</command>
<command
commandId="org.eclipse.linuxtools.perf.QuickStatDiff"
id="org.eclipse.linuxtools.perf.QuickStatDiff"
- label="Compare Latest"
+ label="%perfCompareLatest"
style="push">
</command>
</menuContribution>
@@ -210,22 +225,27 @@
<command
defaultHandler="org.eclipse.linuxtools.internal.perf.handlers.PerfSaveSessionHandler"
id="org.eclipse.linuxtools.perf.SaveData"
- name="Save Current Session">
+ name="%perfSaveCurrentSession">
</command>
<command
defaultHandler="org.eclipse.linuxtools.internal.perf.handlers.PerfSaveStatsHandler"
id="org.eclipse.linuxtools.perf.SaveStatData"
- name="Save Statistics">
+ name="%perfSaveStatistics">
</command>
<command
defaultHandler="org.eclipse.linuxtools.internal.perf.handlers.PerfStatsComparisonHandler"
id="org.eclipse.linuxtools.perf.StatDiff"
- name="Compare Statistics">
+ name="%perfCompareStatistics">
+ </command>
+ <command
+ defaultHandler="org.eclipse.linuxtools.internal.perf.handlers.PerfComparisonHandler"
+ id="org.eclipse.linuxtools.perf.ReportDiff"
+ name="%perfCompareSessions">
</command>
<command
defaultHandler="org.eclipse.linuxtools.internal.perf.handlers.PerfStatsQuickDiffHandler"
id="org.eclipse.linuxtools.perf.QuickStatDiff"
- name="Compare Latest">
+ name="%perfCompareLatest">
</command>
</extension>
</plugin>
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java
index 94e942b..f9241c0 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfPlugin.java
@@ -45,6 +45,7 @@ public class PerfPlugin extends AbstractUIPlugin {
public static final String SOURCE_DISASSEMBLY_VIEW_ID = "org.eclipse.linuxtools.perf.ui.SourceDisassemblyView";
public static final String STAT_VIEW_ID = "org.eclipse.linuxtools.perf.ui.StatView";
public static final String STAT_DIFF_VIEW_ID = "org.eclipse.linuxtools.perf.ui.StatViewDiff";
+ public static final String REPORT_DIFF_VIEW_ID = "org.eclipse.linuxtools.perf.ui.ReportViewDiff";
// Launch Config ID
public static final String LAUNCHCONF_ID = "org.eclipse.linuxtools.perf.launch.profile";
@@ -133,6 +134,9 @@ public class PerfPlugin extends AbstractUIPlugin {
// Current stat comparison data
private IPerfData statDiffData;
+ // Current report comparison data
+ private IPerfData reportDiffData;
+
public TreeParent getModelRoot() {
return _modelRoot;
}
@@ -153,6 +157,10 @@ public class PerfPlugin extends AbstractUIPlugin {
return statDiffData;
}
+ public IPerfData getReportDiffData(){
+ return reportDiffData;
+ }
+
public IPath getWorkingDir(){
return curWorkingDir;
}
@@ -205,6 +213,10 @@ public class PerfPlugin extends AbstractUIPlugin {
this.statDiffData = diffData;
}
+ public void setReportDiffData(IPerfData diffData){
+ this.reportDiffData = diffData;
+ }
+
public void setWorkingDir(IPath workingDir){
curWorkingDir = workingDir;
}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ReportComparisonData.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ReportComparisonData.java
new file mode 100644
index 0000000..82e8da9
--- /dev/null
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ReportComparisonData.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.perf;
+
+import java.io.File;
+
+/**
+ * Class for handling launch of perf diff command and storing of
+ * the resulting data.
+ */
+public class ReportComparisonData extends AbstractDataManipulator {
+
+ private File oldFile;
+ private File newFile;
+
+ public ReportComparisonData(String title, File oldFile, File newFile) {
+ super(title, null);
+ this.oldFile = oldFile;
+ this.newFile = newFile;
+ }
+
+ @Override
+ public void parse() {
+ performCommand(getCommand(), 1);
+ }
+
+ /**
+ * Get perf diff command to execute.
+ *
+ * @return String array representing command to execute.
+ */
+ protected String[] getCommand() {
+ return new String[] { PerfPlugin.PERF_COMMAND,
+ "diff", //$NON-NLS-1$
+ oldFile.getAbsolutePath(),
+ newFile.getAbsolutePath() };
+ }
+
+}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfComparisonHandler.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfComparisonHandler.java
new file mode 100644
index 0000000..e72d3af
--- /dev/null
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/handlers/PerfComparisonHandler.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.perf.handlers;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.linuxtools.internal.perf.ReportComparisonData;
+import org.eclipse.linuxtools.internal.perf.PerfPlugin;
+import org.eclipse.linuxtools.internal.perf.ui.ReportComparisonView;
+
+/**
+ * Handler for comparison between perf data files.
+ */
+public class PerfComparisonHandler extends AbstractComparisonHandler {
+
+ @Override
+ protected boolean isValidFile(IFile file) {
+ if (file != null) {
+ return PerfSaveSessionHandler.DATA_EXT.equals(file
+ .getFileExtension())
+ || "old".equals(file.getFileExtension()); //$NON-NLS-1$
+ }
+ return false;
+ }
+
+ @Override
+ protected void handleComparison(IFile oldData, IFile newData) {
+ String title = MessageFormat.format(Messages.ContentDescription_0,
+ new Object[] { oldData.getName(), newData.getName() });
+
+ // get corresponding files
+ File oldDatum = oldData.getLocation().toFile();
+ File newDatum = newData.getLocation().toFile();
+
+ // create comparison data and run comparison.
+ ReportComparisonData diffData = new ReportComparisonData(title, oldDatum, newDatum);
+ diffData.parse();
+
+ PerfPlugin.getDefault().setReportDiffData(diffData);
+ ReportComparisonView.refreshView();
+ }
+
+}
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/ReportComparisonView.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/ReportComparisonView.java
new file mode 100644
index 0000000..b7f3860
--- /dev/null
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/ReportComparisonView.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.perf.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.linuxtools.internal.perf.IPerfData;
+import org.eclipse.linuxtools.internal.perf.PerfPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * A view part to display perf comparison reports.
+ */
+public class ReportComparisonView extends ViewPart {
+
+ // Color values constants
+ private static final Color BLACK = new Color(Display.getDefault(), 0, 0, 0);
+ private static final Color RED = new Color(Display.getDefault(), 150, 0, 0);
+ private static final Color GREEN = new Color(Display.getDefault(), 0, 50, 0);
+ private static final Color LIGHT_GREEN = new Color(Display.getDefault(), 0, 105, 0);
+ private static final Color ORANGE = new Color(Display.getDefault(), 150, 100, 0);
+
+ // Regex for a generic entry in a perf comparison report.
+ private static final String DIFF_ENTRY = "\\s+(\\d+(\\.\\d+)?)\\%\\s+([\\+\\-]?\\d+(\\.\\d+)?)\\%.*";
+
+ // Secondary view id.
+ private static int SECONDARY_ID = 0;
+
+ // Comparison result.
+ private StyledText result;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ parent.setLayoutData(new GridLayout(1, true));
+
+ result = new StyledText(parent, SWT.V_SCROLL | SWT.H_SCROLL);
+ result.setEditable(false);
+
+ IPerfData data = PerfPlugin.getDefault().getReportDiffData();
+ if (data != null) {
+ //setStyledText(data.getPerfData());
+ setStyledText(data.getPerfData());
+ setContentDescription(data.getTitle());
+ }
+ }
+
+ /**
+ * Set properties for StlyedText widget.
+ * @param input String StyledText content.
+ */
+ private void setStyledText(String input) {
+ result.setText(input);
+ result.setJustify(true);
+ result.setAlignment(SWT.LEFT);
+
+ result.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
+
+ List<StyleRange> styles = new ArrayList<StyleRange>();
+ int ptr = 0;
+ String[] lines = input.split("\n");
+
+ for(String line : lines){
+ if (Pattern.matches(DIFF_ENTRY, line)) {
+ Matcher m = Pattern.compile(DIFF_ENTRY).matcher(line);
+ if (m.matches() && m.group(1) != null && m.group(3) != null) {
+ try {
+ float baseline = Float.parseFloat(m.group(1).trim());
+ float delta = Float.parseFloat(m.group(3).trim());
+ if (baseline > 1 && Math.abs(delta) > 1) {
+ StyleRange curStyleRange = new StyleRange(ptr, line.length(), BLACK, null);
+ if (delta < 0 ) {
+ curStyleRange = delta < -5 ? new StyleRange(ptr, line.length(), LIGHT_GREEN, null) :
+ new StyleRange(ptr, line.length(), GREEN, null);
+ } else {
+ curStyleRange = delta < 5 ? new StyleRange(ptr, line .length(), ORANGE, null) :
+ new StyleRange(ptr, line.length(), RED, null);
+ }
+ styles.add(curStyleRange);
+ }
+ } catch (NumberFormatException e) {
+ // set no StyleRange
+ }
+ }
+ }
+ // + 1 to skip over the '\n' at EOL that the tokenizer eats
+ ptr += line.length() + 1;
+ }
+
+ result.setStyleRanges(styles.toArray(new StyleRange[0]));
+ }
+
+ @Override
+ public void setFocus() {
+ return;
+
+ }
+
+ /**
+ * Refresh this view.
+ */
+ public static void refreshView() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ PlatformUI
+ .getWorkbench()
+ .getActiveWorkbenchWindow()
+ .getActivePage()
+ .showView(PerfPlugin.REPORT_DIFF_VIEW_ID,
+ Integer.toString(SECONDARY_ID++),
+ IWorkbenchPage.VIEW_CREATE);
+ } catch (PartInitException e) {
+ IStatus status = new Status(IStatus.ERROR,
+ PerfPlugin.PLUGIN_ID, e.getMessage(), e);
+ PerfPlugin.getDefault().getLog().log(status);
+ }
+ }
+ });
+ }
+}