Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
UI for intermediate dumps.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchof committed Feb 13, 2012
1 parent 2e66757 commit c914511
Show file tree
Hide file tree
Showing 24 changed files with 412 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
******************************************************************************/
package com.mountainminds.eclemma.core;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.jacoco.core.analysis.ICoverageNode;

import com.mountainminds.eclemma.core.analysis.IJavaCoverageListener;
import com.mountainminds.eclemma.core.analysis.IJavaModelCoverage;
import com.mountainminds.eclemma.core.launching.ICoverageLaunch;
import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin;
import com.mountainminds.eclemma.internal.core.SessionExporter;
import com.mountainminds.eclemma.internal.core.SessionImporter;
Expand Down Expand Up @@ -94,6 +100,22 @@ public static void setPreferences(ICorePreferences preferences) {
EclEmmaCorePlugin.getInstance().setPreferences(preferences);
}

/**
* Determines all current coverage launches which are running.
*
* @return list of running coverage launches
*/
public static List<ICoverageLaunch> getRunningCoverageLaunches() {
final List<ICoverageLaunch> result = new ArrayList<ICoverageLaunch>();
for (final ILaunch launch : DebugPlugin.getDefault().getLaunchManager()
.getLaunches()) {
if (launch instanceof ICoverageLaunch && !launch.isTerminated()) {
result.add((ICoverageLaunch) launch);
}
}
return result;
}

private CoverageTools() {
// no instances
}
Expand Down
5 changes: 5 additions & 0 deletions com.mountainminds.eclemma.doc/contexts_ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<description>This tab specifies the scope of the coverage analysis.</description>
<topic label="Launching in Coverage Mode" href="pages/launching.html"/>
</context>
<context id="dump_execution_data">
<description>Dump execution data from a running coverage launch.</description>
<topic label="Launching in Coverage Mode" href="pages/launching.html"/>
<topic label="Managing Coverage Sessions" href="pages/sessions.html"/>
</context>
<context id="select_active_session_context">
<description>Select the coverage session that should be displayed.</description>
<topic label="Managing Coverage Sessions" href="pages/sessions.html"/>
Expand Down
2 changes: 2 additions & 0 deletions com.mountainminds.eclemma.doc/pages/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ <h1>EclEmma Change Log</h1>

<h2>Trunk</h2>
<ul>
<li>For long-running processes intermediate coverage data dumps can now be
collected without terminating the application under test.</li>
<li>Trac #168: New editor for JaCoCo execution data files.</li>
<li>SF #3477725: Java agent must not be added multiple times to plug-in
launch configurations.</li>
Expand Down
3 changes: 3 additions & 0 deletions com.mountainminds.eclemma.doc/pages/coverageview.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ <h3>Toolbar and Drop-Down Menu</h3>
<ul>
<li><b>Coverage Last Launched</b>: Re-run the currently selected coverage
session.</li>
<li><b>Dump Execution Data</b>: Dump execution data from a running process and
create a new session from the data. Only active when at least one process is
running in <i>Coverage</i> mode.</li>
<li><b>Remove Active Session</b>: Remove the currently selected coverage
session.</li>
<li><b>Remove All Sessions</b>: Remove all coverage sessions.</li>
Expand Down
Binary file modified com.mountainminds.eclemma.doc/pages/images/coverageview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified com.mountainminds.eclemma.doc/pages/images/coverageviewtools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions com.mountainminds.eclemma.doc/pages/launching.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ <h2>Launching in Coverage Mode</h2>
<h3>Coverage Data Collection</h3>

<p>
Coverage data is collected and presented automatically <i>after</i> the
application has terminated on its own. If the Java VM is killed externally,
e.g. with the Eclipse <i>Terminate</i> action, coverage results can not be
shown.
Coverage data is collected and presented automatically when the application
terminates on its own. If the Java VM is killed externally, e.g. with the
Eclipse <i>Terminate</i> action, coverage results can not be shown. In
addition intermediate coverage data dumps can also be requested from any
process running in <i>Coverage</i> mode. Such dumps can be triggered from the
toolbar of the <a href="coverageview.html"><i>Coverage</i> view</a>.
</p>

</body>
Expand Down
4 changes: 2 additions & 2 deletions com.mountainminds.eclemma.doc/pages/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<h1>License</h1>

<p>
Copyright &copy; 2006, 2011 Mountainminds GmbH &amp; Co. KG and Contributors
Copyright &copy; 2006, 2012 Mountainminds GmbH &amp; Co. KG and Contributors
</p>

<p>
Expand Down Expand Up @@ -44,7 +44,7 @@ <h1>License</h1>
<h1>EclEmma.org Content</h1>

<p>
Copyright &copy; 2006, 2011 Mountainminds GmbH &amp; Co. KG and Contributors
Copyright &copy; 2006, 2012 Mountainminds GmbH &amp; Co. KG and Contributors
</p>

<p>
Expand Down
6 changes: 6 additions & 0 deletions com.mountainminds.eclemma.doc/pages/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ <h2>Code Coverage Preferences</h2>
it might be more convenient to remove them automatically with the associated
launches. (Default: off)
</li>
<li><b>Reset execution data on dump:</b>
For a running application coverage data can be dumped at any time from
<a href="coverageview.html"><i>Coverage</i> view</a>. This option determines
whether execution data is reset after such an intermediate dump.
(Default: off)
</li>
</ul>

<p>
Expand Down
5 changes: 3 additions & 2 deletions com.mountainminds.eclemma.doc/pages/sessions.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ <h2>Managing Coverage Sessions</h2>
<h3>Session Lifecycle</h3>

<p>
A coverage session is automatically created for each
<a href="launching.html">coverage launch</a>. Alternatively, sessions can be
A coverage session is automatically created at the end of each
<a href="launching.html">coverage launch</a> or whenever an intermediate
execution data has been trigger by the user. Alternatively, sessions can be
<a href="importexport.html">imported</a> from external launches. The
<a href="coverageview.html">coverage view</a> allows removing sessions.
</p>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion com.mountainminds.eclemma.ui/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ RemoveAllSessionsCommand.name = Remove All Sessions
MergeSessionsCommand.name = Merge Sessions
LinkWithSelectionCommand.name = Link with Current Selection
SelectActiveSessionCommand.name = Select Active Session...
OpenSessionExecutionData = Open Execution Data
OpenSessionExecutionData.name = Open Execution Data
DumpExecutionData.name = Dump Execution Data
ResetOnDump.name = Reset on Dump

SelectProjectsMenu.label = Show Projects
SelectPackageRootsMenu.label = Show Package Roots
Expand Down
37 changes: 36 additions & 1 deletion com.mountainminds.eclemma.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,19 @@
categoryId="com.mountainminds.eclemma.ui"
defaultHandler="com.mountainminds.eclemma.internal.ui.handlers.OpenSessionExecutionDataHandler"
id="com.mountainminds.eclemma.ui.openSessionExecutionData"
name="%OpenSessionExecutionData">
name="%OpenSessionExecutionData.name">
</command>
<command
categoryId="com.mountainminds.eclemma.ui"
defaultHandler="com.mountainminds.eclemma.internal.ui.handlers.DumpExecutionDataHandler"
id="com.mountainminds.eclemma.ui.dumpExecutionData"
name="%DumpExecutionData.name">
</command>
<command
categoryId="com.mountainminds.eclemma.ui"
defaultHandler="com.mountainminds.eclemma.internal.ui.handlers.ResetOnDumpHandler"
id="com.mountainminds.eclemma.ui.resetOnDump"
name="%ResetOnDump.name">
</command>
</extension>

Expand Down Expand Up @@ -839,6 +851,13 @@
icon="icons/full/elcl16/relaunch.gif"
style="push">
</command>
<command
commandId="com.mountainminds.eclemma.ui.dumpExecutionData"
disabledIcon="icons/full/dlcl16/dump.gif"
icon="icons/full/elcl16/dump.gif"
id="com.mountainminds.eclemma.ui.coverageView.dumpExecutionData"
style="pulldown">
</command>
<separator
name="separator.sessions"
visible="true">
Expand Down Expand Up @@ -894,5 +913,21 @@
id="com.mountainminds.eclemma.ui.coverageView.sessionSelector">
</dynamic>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="menu:com.mountainminds.eclemma.ui.coverageView.dumpExecutionData">
<dynamic
class="com.mountainminds.eclemma.internal.ui.handlers.DumpExecutionDataItems"
id="com.mountainminds.eclemma.ui.coverageView.dumpExecutionDataSelector">
</dynamic>
<separator
name="separator.options"
visible="true">
</separator>
<command
commandId="com.mountainminds.eclemma.ui.resetOnDump"
style="toggle">
</command>
</menuContribution>
</extension>
</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public final class ContextHelp {
public static final String COVERAGE_LAUNCH_TAB = PREFIX
+ "coverage_launch_tab_context"; //$NON-NLS-1$

public static final String DUMP_EXECUTION_DATA = PREFIX
+ "dump_execution_data"; //$NON-NLS-1$

public static final String SELECT_ACTIVE_SESSION = PREFIX
+ "select_active_session_context"; //$NON-NLS-1$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class EclEmmaUIPlugin extends AbstractUIPlugin {
// Icons used by the Plugin

public static final String ELCL_SESSION = "icons/full/elcl16/session.gif"; //$NON-NLS-1$
public static final String ELCL_DUMP = "icons/full/elcl16/dump.gif"; //$NON-NLS-1$

public static final String EVIEW_COVERAGE = "icons/full/eview16/coverage.gif"; //$NON-NLS-1$
public static final String EVIEW_EXEC = "icons/full/eview16/exec.gif"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public class UIMessages extends NLS {
public static String SelectActiveSessionDialog_title;
public static String SelectActiveSessionDialog_message;

public static String DumpExecutionDataUnknownLaunch_value;
public static String DumpExecutionData_task;
public static String DumpExecutionDataDialog_title;
public static String DumpExecutionDataDialog_message;

public static String MergeSessionsDialog_title;
public static String MergeSessionsDialogDescription_label;
public static String MergeSessionsDialogDescriptionDefault_value;
Expand Down Expand Up @@ -122,6 +127,7 @@ public class UIMessages extends NLS {
public static String CoveragePreferencesShowCoverageView_label;
public static String CoveragePreferencesActivateNewSessions_label;
public static String CoveragePreferencesAutoRemoveSessions_label;
public static String CoveragePreferencesResetOnDump_label;
public static String CoveragePreferencesDefaultScope_title;
public static String CoveragePreferencesSourceFoldersOnly_label;
public static String CoveragePreferencesSameProjectOnly_label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class UIPreferences extends AbstractPreferenceInitializer {
public static final String PREF_SHOW_COVERAGE_VIEW = EclEmmaUIPlugin.ID
+ ".show_coverage_view"; //$NON-NLS-1$

public static final String PREF_RESET_ON_DUMP = EclEmmaUIPlugin.ID
+ ".reset_on_dump"; //$NON-NLS-1$

public static final String PREF_ACTICATE_NEW_SESSIONS = EclEmmaUIPlugin.ID
+ ".activate_new_sessions"; //$NON-NLS-1$

Expand Down Expand Up @@ -87,6 +90,7 @@ public String getAgentExclClassloader() {
public void initializeDefaultPreferences() {
IPreferenceStore pref = getPreferenceStore();
pref.setDefault(PREF_SHOW_COVERAGE_VIEW, true);
pref.setDefault(PREF_SHOW_COVERAGE_VIEW, false);
pref.setDefault(PREF_ACTICATE_NEW_SESSIONS,
ICorePreferences.DEFAULT.getActivateNewSessions());
pref.setDefault(PREF_AUTO_REMOVE_SESSIONS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ private void createSessionManagementGroup(final Composite parent) {
editor = new BooleanFieldEditor(UIPreferences.PREF_AUTO_REMOVE_SESSIONS,
UIMessages.CoveragePreferencesAutoRemoveSessions_label, group);
addField(editor);
editor = new BooleanFieldEditor(UIPreferences.PREF_RESET_ON_DUMP,
UIMessages.CoveragePreferencesResetOnDump_label, group);
addField(editor);
editor.fillIntoGrid(group, 2);
adjustGroupLayout(group);
}
Expand Down
Loading

0 comments on commit c914511

Please sign in to comment.