Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2010-04-24 20:13:57 +0000
committerSusan Franklin2010-04-24 20:13:57 +0000
commit2e0058c3316e03fb7d10d0cf037399d91b77ad1a (patch)
tree450acb7502d64b56a0fa083a4cafc2845f5889bc /bundles
parentbcde189cc17726636e028561c235fdad914ce74e (diff)
downloadrt.equinox.p2-2e0058c3316e03fb7d10d0cf037399d91b77ad1a.tar.gz
rt.equinox.p2-2e0058c3316e03fb7d10d0cf037399d91b77ad1a.tar.xz
rt.equinox.p2-2e0058c3316e03fb7d10d0cf037399d91b77ad1a.zip
Bug 300860 - [ui] Support event tracing
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.options5
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/RepositoryEvent.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java2
13 files changed, 106 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.core/.options b/bundles/org.eclipse.equinox.p2.core/.options
index 92221e798..a4d705ba4 100644
--- a/bundles/org.eclipse.equinox.p2.core/.options
+++ b/bundles/org.eclipse.equinox.p2.core/.options
@@ -35,4 +35,7 @@ org.eclipse.equinox.p2.core/planner/projector=false
org.eclipse.equinox.p2.core/reconciler=false
#Detailed debugging information about the publisher
-org.eclipse.equinox.p2.core/publisher=false \ No newline at end of file
+org.eclipse.equinox.p2.core/publisher=false
+
+#Detailed debugging information about event clients
+org.eclipse.equinox.p2.core/events/client = false \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java
index ca929c56e..b7fb78d38 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/Tracing.java
@@ -35,12 +35,14 @@ public class Tracing {
public static boolean DEBUG_RECONCILER = false;
public static boolean DEBUG_REMOVE_REPO = false;
public static boolean DEBUG_UPDATE_CHECK = false;
+ public static boolean DEBUG_EVENTS_CLIENT = false;
static {
DebugOptions options = (DebugOptions) ServiceHelper.getService(Activator.context, DebugOptions.class.getName());
if (options != null) {
DEBUG = options.getBooleanOption(Activator.ID + "/debug", false); //$NON-NLS-1$
if (DEBUG) {
+ DEBUG_EVENTS_CLIENT = options.getBooleanOption(Activator.ID + "/events/client", false); //$NON-NLS-1$
DEBUG_GENERATOR_PARSING = options.getBooleanOption(Activator.ID + "/generator/parsing", false); //$NON-NLS-1$
DEBUG_INSTALL_REGISTRY = options.getBooleanOption(Activator.ID + "/engine/installregistry", false); //$NON-NLS-1$
DEBUG_METADATA_PARSING = options.getBooleanOption(Activator.ID + "/metadata/parsing", false); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
index 73313e649..c81fd933f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
@@ -40,4 +40,28 @@ public class ProfileEvent extends EventObject implements IProfileEvent {
public String getProfileId() {
return (String) getSource();
}
+
+ /*
+ * (non-Javadoc)
+ * @see java.util.EventObject#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("ProfileEvent["); //$NON-NLS-1$
+ buffer.append(getProfileId());
+ buffer.append("-->"); //$NON-NLS-1$
+ switch (reason) {
+ case IProfileEvent.ADDED :
+ buffer.append("ADDED"); //$NON-NLS-1$
+ break;
+ case IProfileEvent.REMOVED :
+ buffer.append("REMOVED"); //$NON-NLS-1$
+ break;
+ case IProfileEvent.CHANGED :
+ buffer.append("CHANGED"); //$NON-NLS-1$
+ break;
+ }
+ buffer.append("] "); //$NON-NLS-1$
+ return buffer.toString();
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/RepositoryEvent.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/RepositoryEvent.java
index 9de78fb8e..9342c6f4e 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/RepositoryEvent.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/RepositoryEvent.java
@@ -149,4 +149,40 @@ public class RepositoryEvent extends EventObject {
return isEnabled;
}
+ /*
+ * (non-Javadoc)
+ * @see java.util.EventObject#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("RepositoryEvent["); //$NON-NLS-1$
+ switch (kind) {
+ case ADDED :
+ buffer.append("ADDED "); //$NON-NLS-1$
+ break;
+ case CHANGED :
+ buffer.append("CHANGED "); //$NON-NLS-1$
+ break;
+ case DISCOVERED :
+ buffer.append("DISCOVERED "); //$NON-NLS-1$
+ break;
+ case ENABLEMENT :
+ buffer.append("ENABLED "); //$NON-NLS-1$
+ break;
+ case REMOVED :
+ buffer.append("REMOVED "); //$NON-NLS-1$
+ break;
+ }
+ if (type == IRepository.TYPE_ARTIFACT)
+ buffer.append("Artifact "); //$NON-NLS-1$
+ else
+ buffer.append("Metadata "); //$NON-NLS-1$
+ // uri
+ buffer.append(getSource().toString());
+ if (nickname != null)
+ buffer.append("Nickname: " + nickname); //$NON-NLS-1$
+ buffer.append(" Enabled: " + Boolean.toString(isEnabled)); //$NON-NLS-1$
+ buffer.append("] "); //$NON-NLS-1$
+ return buffer.toString();
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java
index 43e5c566a..7272c6763 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java
@@ -81,7 +81,7 @@ public class ProfilesView extends ProvView {
protected void addListeners() {
super.addListeners();
- listener = new StructuredViewerProvisioningListener(viewer, ProvUIProvisioningListener.PROV_EVENT_IU | ProvUIProvisioningListener.PROV_EVENT_PROFILE);
+ listener = new StructuredViewerProvisioningListener(getClass().getName(), viewer, ProvUIProvisioningListener.PROV_EVENT_IU | ProvUIProvisioningListener.PROV_EVENT_PROFILE);
ProvUI.addProvisioningListener(listener);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java
index cf21efabc..08af6d02e 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java
@@ -96,7 +96,7 @@ abstract class RepositoriesView extends ProvView {
protected void addListeners() {
super.addListeners();
- listener = new StructuredViewerProvisioningListener(viewer, getListenerEventTypes()) {
+ listener = new StructuredViewerProvisioningListener(getClass().getName(), viewer, getListenerEventTypes()) {
protected void refreshViewer() {
RepositoriesView.this.refreshAll(false);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java
index f1614de2f..5b5cbd92a 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java
@@ -12,6 +12,7 @@
package org.eclipse.equinox.internal.p2.ui;
import java.util.EventObject;
+import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
import org.eclipse.equinox.p2.engine.IProfileEvent;
@@ -33,28 +34,49 @@ public abstract class ProvUIProvisioningListener implements SynchronousProvision
int eventTypes = 0;
int batchCount = 0;
+ String name;
- public ProvUIProvisioningListener(int eventTypes) {
+ public ProvUIProvisioningListener(String name, int eventTypes) {
+ this.name = name;
this.eventTypes = eventTypes;
}
public void notify(EventObject o) {
if (o instanceof RepositoryOperationBeginningEvent) {
batchCount++;
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Batch Eventing: Ignore Following Events. Batch count: " + Integer.toString(batchCount) + getReceiverString()); //$NON-NLS-1$
} else if (o instanceof RepositoryOperationEndingEvent) {
batchCount--;
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Batch Eventing: Batch Ended. Batch count: " + Integer.toString(batchCount) + getReceiverString()); //$NON-NLS-1$
+
// A batch operation completed. Refresh.
if (batchCount <= 0) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Batch Eventing Complete." + getReceiverString()); //$NON-NLS-1$
RepositoryOperationEndingEvent event = (RepositoryOperationEndingEvent) o;
- if (event.getEvent() == null && event.update())
+ if (event.getEvent() == null && event.update()) {
+ if (Tracing.DEBUG_EVENTS_CLIENT) {
+ Tracing.debug("Refreshing After Batch." + getReceiverString()); //$NON-NLS-1$
+ }
refreshAll();
- else if (event.update())
+ } else if (event.update()) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Dispatching Last Event in Batch." + getReceiverString()); //$NON-NLS-1$
notify(event.getEvent());
+ } else if (Tracing.DEBUG_EVENTS_CLIENT) {
+ Tracing.debug("No Refresh on Batch Complete."); //$NON-NLS-1$
+ }
}
} else if (batchCount > 0) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug(name + " Ignoring: " + o.toString()); //$NON-NLS-1$
// We are in the middle of a batch operation
return;
} else if (o instanceof IProfileEvent && (((eventTypes & PROV_EVENT_IU) == PROV_EVENT_IU) || ((eventTypes & PROV_EVENT_PROFILE) == PROV_EVENT_PROFILE))) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug(o.toString() + getReceiverString());
IProfileEvent event = (IProfileEvent) o;
if (event.getReason() == IProfileEvent.CHANGED) {
profileChanged(event.getProfileId());
@@ -64,6 +86,8 @@ public abstract class ProvUIProvisioningListener implements SynchronousProvision
profileRemoved(event.getProfileId());
}
} else if (o instanceof RepositoryEvent) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug(o.toString() + getReceiverString());
RepositoryEvent event = (RepositoryEvent) o;
// Do not handle unless this is the type of repo that we are interested in
if ((event.getRepositoryType() == IRepository.TYPE_METADATA && (eventTypes & PROV_EVENT_METADATA_REPOSITORY) == PROV_EVENT_METADATA_REPOSITORY) || (event.getRepositoryType() == IRepository.TYPE_ARTIFACT && (eventTypes & PROV_EVENT_ARTIFACT_REPOSITORY) == PROV_EVENT_ARTIFACT_REPOSITORY)) {
@@ -82,6 +106,10 @@ public abstract class ProvUIProvisioningListener implements SynchronousProvision
}
}
+ private String getReceiverString() {
+ return " -- <" + name + "> "; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
/**
* A repository has been added. Subclasses may override. May be called
* from a non-UI thread.
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
index a242299fe..d7d01e017 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
@@ -167,7 +167,7 @@ public class AvailableIUGroup extends StructuredIUGroup {
// after content has been retrieved.
filteredTree.contentProviderSet(contentProvider);
- final StructuredViewerProvisioningListener listener = new StructuredViewerProvisioningListener(availableIUViewer, ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
+ final StructuredViewerProvisioningListener listener = new StructuredViewerProvisioningListener(getClass().getName(), availableIUViewer, ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
protected void repositoryAdded(final RepositoryEvent event) {
makeRepositoryVisible(event.getRepositoryLocation());
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
index 852c587d7..167b2084c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
@@ -525,7 +525,7 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
// We might need to adjust the content of the available IU group's viewer
// according to installation changes. We want to be very selective about refreshing,
// because the viewer has its own listeners installed.
- profileListener = new StructuredViewerProvisioningListener(availableIUGroup.getStructuredViewer(), ProvUIProvisioningListener.PROV_EVENT_PROFILE) {
+ profileListener = new StructuredViewerProvisioningListener(getClass().getName(), availableIUGroup.getStructuredViewer(), ProvUIProvisioningListener.PROV_EVENT_PROFILE) {
protected void profileAdded(String id) {
// do nothing
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java
index ceb7ab4fc..d944f93b9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java
@@ -71,7 +71,7 @@ public class InstalledIUGroup extends StructuredIUGroup {
// Input last.
installedIUViewer.setInput(getInput());
- final StructuredViewerProvisioningListener listener = new StructuredViewerProvisioningListener(installedIUViewer, ProvUIProvisioningListener.PROV_EVENT_IU | ProvUIProvisioningListener.PROV_EVENT_PROFILE);
+ final StructuredViewerProvisioningListener listener = new StructuredViewerProvisioningListener(getClass().getName(), installedIUViewer, ProvUIProvisioningListener.PROV_EVENT_IU | ProvUIProvisioningListener.PROV_EVENT_PROFILE);
ProvUIActivator.getDefault().addProvisioningListener(listener);
installedIUViewer.getControl().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
index 90035f8b3..e9a97aa54 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
@@ -469,7 +469,7 @@ public class RepositorySelectionGroup {
void addComboProvisioningListeners() {
// We need to monitor repository events so that we can adjust the repo combo.
- comboRepoListener = new ProvUIProvisioningListener(ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
+ comboRepoListener = new ProvUIProvisioningListener(getClass().getName(), ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
protected void repositoryAdded(RepositoryEvent e) {
fillRepoCombo(getSiteString(e.getRepositoryLocation()));
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java
index a907f604e..733fd9e52 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java
@@ -33,8 +33,8 @@ public class StructuredViewerProvisioningListener extends ProvUIProvisioningList
StructuredViewer viewer;
Display display;
- public StructuredViewerProvisioningListener(StructuredViewer viewer, int eventTypes) {
- super(eventTypes);
+ public StructuredViewerProvisioningListener(String name, StructuredViewer viewer, int eventTypes) {
+ super(name, eventTypes);
this.viewer = viewer;
this.display = viewer.getControl().getDisplay();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
index 91222f27e..b52bee08b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
@@ -514,7 +514,7 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
}
private StructuredViewerProvisioningListener getViewerProvisioningListener() {
- return new StructuredViewerProvisioningListener(repositoryViewer, ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
+ return new StructuredViewerProvisioningListener(RepositoryManipulationPage.this.getClass().getName(), repositoryViewer, ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
protected void repositoryDiscovered(RepositoryEvent e) {
RepositoryManipulationPage.this.safeRefresh(null);
}

Back to the top