NEW - bug 187154: manage Mylyn participation in EPP
https://bugs.eclipse.org/bugs/show_bug.cgi?id=187154
diff --git a/org.eclipse.mylyn.monitor.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.monitor.tests/META-INF/MANIFEST.MF
index 3e505fe..93d6f4f 100644
--- a/org.eclipse.mylyn.monitor.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.monitor.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,6 @@
org.eclipse.mylyn.java.ui,
org.eclipse.mylyn.context.ui,
org.eclipse.mylyn.tasks.ui,
- org.eclipse.mylyn.monitor.reports,
org.eclipse.ui.ide,
org.eclipse.mylyn.monitor.usage,
org.eclipse.mylyn.monitor.ui,
diff --git a/org.eclipse.mylyn.monitor.tests/src/org/eclipse/mylyn/monitor/tests/AllMonitorTests.java b/org.eclipse.mylyn.monitor.tests/src/org/eclipse/mylyn/monitor/tests/AllMonitorTests.java
index 7bc4f9b..14057a8 100644
--- a/org.eclipse.mylyn.monitor.tests/src/org/eclipse/mylyn/monitor/tests/AllMonitorTests.java
+++ b/org.eclipse.mylyn.monitor.tests/src/org/eclipse/mylyn/monitor/tests/AllMonitorTests.java
@@ -11,12 +11,12 @@
package org.eclipse.mylyn.monitor.tests;
-import org.eclipse.mylyn.monitor.reports.tests.AllMonitorReportTests;
-import org.eclipse.mylyn.monitor.tests.usage.tests.AllMonitorUsageTests;
-
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.mylyn.monitor.reports.tests.AllMonitorReportTests;
+import org.eclipse.mylyn.monitor.tests.usage.tests.AllMonitorUsageTests;
+
/**
* @author Mik Kersten
*/
@@ -25,11 +25,11 @@
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.eclipse.mylyn.monitor.ui.tests");
+ // suite.addTestSuite(TaskTimerTest.class);
+
// $JUnit-BEGIN$
suite.addTest(AllMonitorUsageTests.suite());
suite.addTest(AllMonitorReportTests.suite());
- // suite.addTestSuite(TaskTimerTest.class);
- suite.addTestSuite(StatisticsReportingTest.class);
suite.addTestSuite(InteractionLoggerTest.class);
suite.addTestSuite(ActiveTimerTest.class);
suite.addTestSuite(StatisticsLoggingTest.class);
diff --git a/org.eclipse.mylyn.monitor.tests/src/org/eclipse/mylyn/monitor/tests/StatisticsReportingTest.java b/org.eclipse.mylyn.monitor.tests/src/org/eclipse/mylyn/monitor/tests/StatisticsReportingTest.java
deleted file mode 100644
index 1fc640a..0000000
--- a/org.eclipse.mylyn.monitor.tests/src/org/eclipse/mylyn/monitor/tests/StatisticsReportingTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2006 University Of British Columbia and others.
- * 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:
- * University Of British Columbia - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.monitor.tests;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.mylyn.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.context.ui.ContextUiPlugin;
-import org.eclipse.mylyn.internal.java.ui.JavaUiBridgePlugin;
-import org.eclipse.mylyn.internal.java.ui.actions.FocusPackageExplorerAction;
-import org.eclipse.mylyn.internal.monitor.core.collection.IUsageCollector;
-import org.eclipse.mylyn.internal.monitor.reports.collectors.FocusedUiUsageAnalysisCollector;
-import org.eclipse.mylyn.internal.monitor.reports.collectors.FocusedUiViewUsageCollector;
-import org.eclipse.mylyn.internal.monitor.usage.InteractionEventLogger;
-import org.eclipse.mylyn.internal.monitor.usage.UiUsageMonitorPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.monitor.core.InteractionEvent;
-import org.eclipse.mylyn.monitor.ui.MonitorUiPlugin;
-import org.eclipse.mylyn.monitor.usage.ReportGenerator;
-import org.eclipse.mylyn.monitor.usage.UsageStatisticsSummary;
-
-/**
- * @author Mik Kersten
- */
-public class StatisticsReportingTest extends TestCase {
-
- private InteractionEventLogger logger;
-
- private FocusedUiViewUsageCollector viewCollector = new FocusedUiViewUsageCollector();
-
- private FocusedUiUsageAnalysisCollector editRatioCollector = new FocusedUiUsageAnalysisCollector();;
-
- private ReportGenerator report;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- assertNotNull(ContextCorePlugin.getDefault());
- assertNotNull(JavaUiBridgePlugin.getDefault());
- assertNotNull(PackageExplorerPart.openInActivePerspective());
-
- UiUsageMonitorPlugin.getDefault().startMonitoring();
- assertTrue(UiUsageMonitorPlugin.getDefault().isMonitoringEnabled());
- logger = UiUsageMonitorPlugin.getDefault().getInteractionLogger();
- logger.clearInteractionHistory();
-
- List<IUsageCollector> collectors = new ArrayList<IUsageCollector>();
- collectors.add(viewCollector);
- collectors.add(editRatioCollector);
- report = new ReportGenerator(logger, collectors);
- report.forceSyncForTesting(true);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- protected InteractionEvent mockExplorerSelection(String handle) {
- InteractionEvent event = new InteractionEvent(InteractionEvent.Kind.SELECTION, "java", handle,
- JavaUI.ID_PACKAGES);
- MonitorUiPlugin.getDefault().notifyInteractionObserved(event);
- return event;
- }
-
- protected void mockEdit(String handle) {
- MonitorUiPlugin.getDefault().notifyInteractionObserved(
- new InteractionEvent(InteractionEvent.Kind.EDIT, "java", handle, JavaUI.ID_PACKAGES));
- }
-
- protected void mockTypesSelection(String handle) {
- MonitorUiPlugin.getDefault().notifyInteractionObserved(
- new InteractionEvent(InteractionEvent.Kind.SELECTION, "java", handle, JavaUI.ID_TYPES_VIEW));
- }
-
- public void testEditRatio() throws InvocationTargetException, InterruptedException {
- logger.stopMonitoring();
- PackageExplorerPart part = PackageExplorerPart.openInActivePerspective();
- assertNotNull(part.getTreeViewer());
- part.setFocus();
-
- logger.startMonitoring();
- final InteractionEvent first = mockExplorerSelection("A.java");
- mockUserDelay();
- mockUserDelay();
- final InteractionEvent second = mockExplorerSelection("A.java");
-
- assertTrue(!first.getDate().equals(second.getDelta()));
-
- try {
- // XXX: this is a hack and sensitive to CPU speeds
- Thread.sleep(3000);
- } catch (InterruptedException ie) {
- fail();
- }
-
- mockEdit("A.java");
-
- MonitorUiPlugin.getDefault().notifyInteractionObserved(
- InteractionEvent.makeCommand(TaskActivateAction.ID, ""));
-
- mockExplorerSelection("A.java");
- mockEdit("A.java");
- mockUserDelay();
- mockEdit("A.java");
-
- logger.stopMonitoring();
- report.getStatisticsFromInteractionHistory(logger.getOutputFile(), null);
-
- // TODO: these are off from expected when test run alone, due to unknown
- // element selections
- assertEquals(0.5f, editRatioCollector.getBaselineRatio(-1));
- assertEquals(2f, editRatioCollector.getMylarRatio(-1));
- }
-
- @SuppressWarnings("unused")
- public void testSimpleSelection() {
- mockExplorerSelection("A.java");
- report.getStatisticsFromInteractionHistory(logger.getOutputFile(), new JobChangeAdapter() {
- public void done() {
- UsageStatisticsSummary summary = report.getLastParsedSummary();
- assertTrue(summary.getSingleSummaries().size() > 0);
- }
- });
-
- }
-
- @SuppressWarnings("unused")
- public void testFilteredModeDetection() throws IOException {
- UiUsageMonitorPlugin.getDefault().addMonitoredPreferences(
- ContextUiPlugin.getDefault().getPluginPreferences());
-
- UiUsageMonitorPlugin.getDefault().getInteractionLogger().clearInteractionHistory();
- mockExplorerSelection("A.java");
- mockUserDelay();
- mockExplorerSelection("A.java");
- mockUserDelay();
- mockTypesSelection("A.java");
-
- assertNotNull(ContextUiPlugin.getDefault().getPreferenceStore());
- String prefId = FocusPackageExplorerAction.PREF_ID_PREFIX + JavaUI.ID_PACKAGES;
- assertNotNull(prefId);
-
- PackageExplorerPart part = PackageExplorerPart.openInActivePerspective();
- assertNotNull(part);
- // AbstractFocusViewAction action =
- // FocusPackageExplorerAction.getActionForPart(part);
- // assertNotNull(action);
-
- ContextUiPlugin.getDefault().getPreferenceStore().setValue(prefId, true);
-
- mockExplorerSelection("A.java");
- mockUserDelay();
- mockExplorerSelection("A.java");
- mockUserDelay();
- mockTypesSelection("A.java");
-
- ContextUiPlugin.getDefault().getPreferenceStore().setValue(prefId, false);
-
- mockExplorerSelection("A.java");
-
- logger.stopMonitoring();
- report.getStatisticsFromInteractionHistory(logger.getOutputFile(), new JobChangeAdapter() {
-
- public void done() {
- int normal = viewCollector.getNormalViewSelections().get(JavaUI.ID_PACKAGES);
- assertEquals(5, normal);
-
- int filtered = viewCollector.getFilteredViewSelections().get(JavaUI.ID_PACKAGES);
- assertEquals(2, filtered);
-
- UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(
- ContextUiPlugin.getDefault().getPluginPreferences());
- }
- });
-
- }
-
- /**
- * Delay enough to make replicated events different
- */
- private void mockUserDelay() {
- // TODO: Refactor into mylar.core.tests
- try {
- // XXX: this could be sensitive to CPU speeds
- Thread.sleep(100);
- } catch (InterruptedException ie) {
- fail();
- }
- }
-}
diff --git a/org.eclipse.mylyn/src/org/eclipse/mylyn/core/MylarStatusHandler.java b/org.eclipse.mylyn/src/org/eclipse/mylyn/core/MylarStatusHandler.java
index 06e46d1..cdcfdd7 100644
--- a/org.eclipse.mylyn/src/org/eclipse/mylyn/core/MylarStatusHandler.java
+++ b/org.eclipse.mylyn/src/org/eclipse/mylyn/core/MylarStatusHandler.java
@@ -25,7 +25,7 @@
// private static boolean testingMode = false;
- private static final String ID_PLUGIN = "org.eclipse.mylar";
+ private static final String ID_PLUGIN = "org.eclipse.mylyn";
private static Set<IStatusHandler> handlers = new HashSet<IStatusHandler>();
@@ -50,7 +50,7 @@
}
public static void log(String message, Object source) {
- message = "Mylar: " + message;
+ message = "Mylyn: " + message;
if (source != null)
message += ", source: " + source.getClass().getName();