Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordstadnik2006-05-12 09:32:40 -0400
committerdstadnik2006-05-12 09:32:40 -0400
commit4d9d08c81b98868487e2b28b90db6bc397995d40 (patch)
treed2bfa9512cc47d6b3178e9ab86f538c60ca59557 /devtools
parenta9093b3c23a93d17746386033e1ab2abd1f0d2a4 (diff)
downloadorg.eclipse.gmf-tooling-4d9d08c81b98868487e2b28b90db6bc397995d40.tar.gz
org.eclipse.gmf-tooling-4d9d08c81b98868487e2b28b90db6bc397995d40.tar.xz
org.eclipse.gmf-tooling-4d9d08c81b98868487e2b28b90db6bc397995d40.zip
move aspect to this plugin; remove gmf rt dep
Diffstat (limited to 'devtools')
-rw-r--r--devtools/org.eclipse.gmf.dev/.project3
-rw-r--r--devtools/org.eclipse.gmf.dev/META-INF/MANIFEST.MF3
-rw-r--r--devtools/org.eclipse.gmf.dev/plugin.xml3
-rw-r--r--devtools/org.eclipse.gmf.dev/readme.txt5
-rw-r--r--devtools/org.eclipse.gmf.dev/schema/editPartRequestFilters.exsd115
-rw-r--r--devtools/org.eclipse.gmf.dev/schema/editPartTraceContributors.exsd105
-rw-r--r--devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartRequestFiltersProvider.java23
-rw-r--r--devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceConstructor.java195
-rw-r--r--devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceContributor.java30
-rw-r--r--devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceRequestFilters.java45
-rw-r--r--devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceView.java6
-rw-r--r--devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTracer.aj (renamed from devtools/org.eclipse.gmf.dev/EditPartTracer.aj)20
12 files changed, 383 insertions, 170 deletions
diff --git a/devtools/org.eclipse.gmf.dev/.project b/devtools/org.eclipse.gmf.dev/.project
index 696b62e37..e6432bb07 100644
--- a/devtools/org.eclipse.gmf.dev/.project
+++ b/devtools/org.eclipse.gmf.dev/.project
@@ -6,7 +6,7 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
+ <name>org.eclipse.ajdt.core.ajbuilder</name>
<arguments>
</arguments>
</buildCommand>
@@ -22,6 +22,7 @@
</buildCommand>
</buildSpec>
<natures>
+ <nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
diff --git a/devtools/org.eclipse.gmf.dev/META-INF/MANIFEST.MF b/devtools/org.eclipse.gmf.dev/META-INF/MANIFEST.MF
index 9ab53261c..9440755bc 100644
--- a/devtools/org.eclipse.gmf.dev/META-INF/MANIFEST.MF
+++ b/devtools/org.eclipse.gmf.dev/META-INF/MANIFEST.MF
@@ -10,5 +10,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.draw2d,
org.eclipse.gef,
- org.eclipse.gmf.runtime.diagram.ui
+ org.aspectj.runtime
Eclipse-LazyStart: true
+Export-Package: org.eclipse.gmf.dev
diff --git a/devtools/org.eclipse.gmf.dev/plugin.xml b/devtools/org.eclipse.gmf.dev/plugin.xml
index 6306d28b9..b9b12a3c9 100644
--- a/devtools/org.eclipse.gmf.dev/plugin.xml
+++ b/devtools/org.eclipse.gmf.dev/plugin.xml
@@ -3,6 +3,9 @@
<plugin>
+ <extension-point id="editPartRequestFilters" name="Edit Part Request Filters" schema="schema/editPartRequestFilters.exsd"/>
+ <extension-point id="editPartTraceContributors" name="Edit Part Trace Contributors" schema="schema/editPartTraceContributors.exsd"/>
+
<extension
point="org.eclipse.ui.views">
<category
diff --git a/devtools/org.eclipse.gmf.dev/readme.txt b/devtools/org.eclipse.gmf.dev/readme.txt
new file mode 100644
index 000000000..fbdbe8c8a
--- /dev/null
+++ b/devtools/org.eclipse.gmf.dev/readme.txt
@@ -0,0 +1,5 @@
+How to enable tracing for the plugin X:
+
+1. Convert X to aspectj project (project context menu -> AspectJ Tools -> Convert...)
+2. Add to X dependency to this plugin (org.eclipse.gmf.dev)
+3. Add compiled aspect to aspectpath of X (org.eclipse.gmf.dev/bin to project properties -> AspectJ Aspect Path -> Libraries -> Add Class Folder...)
diff --git a/devtools/org.eclipse.gmf.dev/schema/editPartRequestFilters.exsd b/devtools/org.eclipse.gmf.dev/schema/editPartRequestFilters.exsd
new file mode 100644
index 000000000..58e7f8956
--- /dev/null
+++ b/devtools/org.eclipse.gmf.dev/schema/editPartRequestFilters.exsd
@@ -0,0 +1,115 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.gmf.dev">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.gmf.dev" id="editPartRequestFilters" name="Edit Part Request Filters"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="category" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="category">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.gmf.dev.EditPartRequestFiltersProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/devtools/org.eclipse.gmf.dev/schema/editPartTraceContributors.exsd b/devtools/org.eclipse.gmf.dev/schema/editPartTraceContributors.exsd
new file mode 100644
index 000000000..37bdebf95
--- /dev/null
+++ b/devtools/org.eclipse.gmf.dev/schema/editPartTraceContributors.exsd
@@ -0,0 +1,105 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.gmf.dev">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.gmf.dev" id="editPartTraceContributors" name="Edit Part Trace Contributors"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="contributor" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="contributor">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.gmf.dev.EditPartTraceContributor"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartRequestFiltersProvider.java b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartRequestFiltersProvider.java
new file mode 100644
index 000000000..e446b6446
--- /dev/null
+++ b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartRequestFiltersProvider.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2005 Borland Software Corporation
+ *
+ * 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:
+ * Dmitri Stadnik (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.dev;
+
+/**
+ * @author dstadnik
+ */
+public interface EditPartRequestFiltersProvider {
+
+ /**
+ * @return type that defines request constants
+ */
+ public Class getConstants();
+}
diff --git a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceConstructor.java b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceConstructor.java
index 4acce91f6..204bd735e 100644
--- a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceConstructor.java
+++ b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceConstructor.java
@@ -14,9 +14,9 @@ package org.eclipse.gmf.dev;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Request;
@@ -24,22 +24,36 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.EtoolsProxyCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SemanticCreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
/**
* @author dstadnik
*/
-class EditPartTraceConstructor {
+public class EditPartTraceConstructor {
+
+ private static List<EditPartTraceContributor> contributors;
private EditPartTraceConstructor() {
}
+ private static void loadContributors() {
+ if (contributors != null) {
+ return;
+ }
+ String id = DevPlugin.getInstance().getBundle().getSymbolicName();
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(id, "editPartTraceContributors");
+ contributors = new ArrayList<EditPartTraceContributor>(elements.length);
+ for (int i = 0; i < elements.length; i++) {
+ if (!"contributor".equals(elements[i].getName())) {
+ continue;
+ }
+ try {
+ contributors.add((EditPartTraceContributor) elements[i].createExecutableExtension("class"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
public static EditPartTraceRecord createEditPartNode(EditPart editPart) {
List<EditPartTraceRecord> kids = new ArrayList<EditPartTraceRecord>();
kids.add(new EditPartTraceRecord(String.valueOf(editPart.getModel()), DevPlugin.MODEL_IMAGE));
@@ -47,7 +61,11 @@ class EditPartTraceConstructor {
GraphicalEditPart gEditPart = (GraphicalEditPart) editPart;
kids.add(new EditPartTraceRecord("figure bounds " + gEditPart.getFigure().getBounds()));
}
- return new EditPartTraceRecord(DevUtils.getFullClassName(editPart), DevPlugin.EDITPART_IMAGE, (EditPartTraceRecord[]) kids.toArray(new EditPartTraceRecord[kids.size()]));
+ loadContributors();
+ for (EditPartTraceContributor contributor : contributors) {
+ contributor.contribute(kids, editPart);
+ }
+ return new EditPartTraceRecord(DevUtils.getFullClassName(editPart), DevPlugin.EDITPART_IMAGE, kids.toArray(new EditPartTraceRecord[kids.size()]));
}
public static EditPartTraceRecord createRequestNode(Request request) {
@@ -67,76 +85,30 @@ class EditPartTraceConstructor {
}
}
}
- if (request instanceof EditCommandRequestWrapper) {
- IEditCommandRequest realRequest = ((EditCommandRequestWrapper) request).getEditCommandRequest();
- if (realRequest != null) {
- kids.add(createRequestNode(realRequest));
- }
- }
- return new EditPartTraceRecord(DevUtils.getFullClassName(request), DevPlugin.REQUEST_IMAGE, (EditPartTraceRecord[]) kids.toArray(new EditPartTraceRecord[kids.size()]));
- }
-
- private static String getLabel(IEditCommandRequest request) {
- String label = DevUtils.getFullClassName(request);
- if (request.getLabel() != null) {
- label += '<' + request.getLabel() + '>';
- }
- return label;
- }
-
- public static EditPartTraceRecord createRequestNode(IEditCommandRequest request) {
- List<EditPartTraceRecord> kids = new ArrayList<EditPartTraceRecord>();
- //kids.add(new EditPartTraceRecord("edit helper context " + request.getEditHelperContext()));
- List elementsToEdit = request.getElementsToEdit();
- if (elementsToEdit != null) {
- for (Object elementToEdit : elementsToEdit) {
- kids.add(new EditPartTraceRecord("element to edit " + elementToEdit));
- }
- }
- Map parameters = request.getParameters();
- if (parameters != null) {
- for (Object key : parameters.keySet()) {
- if ("org.eclipse.gmf.dev.sources".equals(key)) {
- continue;
- }
- kids.add(new EditPartTraceRecord(String.valueOf(key) + '=' + parameters.get(key), DevPlugin.PARAMETER_IMAGE));
- }
+ loadContributors();
+ for (EditPartTraceContributor contributor : contributors) {
+ contributor.contribute(kids, request);
}
- return new EditPartTraceRecord(getLabel(request), DevPlugin.REQUEST_IMAGE, (EditPartTraceRecord[]) kids.toArray(new EditPartTraceRecord[kids.size()]));
+ return new EditPartTraceRecord(DevUtils.getFullClassName(request), DevPlugin.REQUEST_IMAGE, kids.toArray(new EditPartTraceRecord[kids.size()]));
}
- private static String getLabel(org.eclipse.emf.common.command.Command command) {
- String label = DevUtils.getFullClassName(command);
- if (command.getLabel() != null) {
- label += '<' + command.getLabel() + '>';
- }
- return label;
- }
-
- private static String getImage(org.eclipse.emf.common.command.Command command) {
- String id = DevPlugin.COMMANDX_IMAGE;
- try {
- if (command.canExecute()) {
- id = DevPlugin.COMMAND_IMAGE;
- }
- } catch (Exception e) {
- // ignore
- }
- return id;
- }
-
- public static EditPartTraceRecord createCommandNode(org.eclipse.emf.common.command.Command command, CommandCreatedEvent event) {
+ public static EditPartTraceRecord createCommandNode(Command command, CommandCreatedEvent event) {
List<EditPartTraceRecord> kids = new ArrayList<EditPartTraceRecord>();
Object source = event.getSource(command);
if (source != null) {
kids.add(new EditPartTraceRecord("from " + DevUtils.getFullClassName(source)));
}
- if (command instanceof org.eclipse.emf.common.command.CompoundCommand) {
- for (org.eclipse.emf.common.command.Command subCommand : (List<? extends org.eclipse.emf.common.command.Command>) ((org.eclipse.emf.common.command.CompoundCommand) command).getCommandList()) {
- kids.add(createCommandNode(subCommand, event));
+ if (command instanceof CompoundCommand) {
+ Iterator commands = ((CompoundCommand) command).getCommands().iterator();
+ while (commands.hasNext()) {
+ kids.add(createCommandNode((Command) commands.next(), event));
}
}
- return new EditPartTraceRecord(getLabel(command), getImage(command), (EditPartTraceRecord[]) kids.toArray(new EditPartTraceRecord[kids.size()]));
+ loadContributors();
+ for (EditPartTraceContributor contributor : contributors) {
+ contributor.contribute(kids, command, event);
+ }
+ return new EditPartTraceRecord(getLabel(command), getImage(command), kids.toArray(new EditPartTraceRecord[kids.size()]));
}
private static String getLabel(Command command) {
@@ -158,83 +130,4 @@ class EditPartTraceConstructor {
}
return id;
}
-
- public static EditPartTraceRecord createCommandNode(Command command, CommandCreatedEvent event) {
- List<EditPartTraceRecord> kids = new ArrayList<EditPartTraceRecord>();
- Object source = event.getSource(command);
- if (source != null) {
- kids.add(new EditPartTraceRecord("from " + DevUtils.getFullClassName(source)));
- }
- if (command instanceof CompoundCommand) {
- for (Command subCommand : (List<? extends Command>) ((CompoundCommand) command).getCommands()) {
- kids.add(createCommandNode(subCommand, event));
- }
- }
- if (command instanceof EtoolsProxyCommand) {
- ICommand realCommand = ((EtoolsProxyCommand) command).getICommand();
- if (realCommand != null) {
- kids.add(createCommandNode(realCommand, event));
- }
- }
- if (command instanceof IAdaptable) {
- org.eclipse.emf.common.command.Command delegate = (org.eclipse.emf.common.command.Command) ((IAdaptable) command).getAdapter(org.eclipse.emf.common.command.Command.class);
- if (delegate != null) {
- kids.add(createCommandNode(delegate, event));
- }
- }
- return new EditPartTraceRecord(getLabel(command), getImage(command), (EditPartTraceRecord[]) kids.toArray(new EditPartTraceRecord[kids.size()]));
- }
-
- private static String getLabel(ICommand command) {
- String label = DevUtils.getFullClassName(command);
- if (command.getLabel() != null) {
- label += '<' + command.getLabel() + '>';
- }
- return label;
- }
-
- private static String getImage(ICommand command) {
- String id = DevPlugin.COMMANDX_IMAGE;
- try {
- if (command.canExecute()) {
- id = DevPlugin.COMMAND_IMAGE;
- }
- } catch (Exception e) {
- // ignore
- }
- return id;
- }
-
- public static EditPartTraceRecord createCommandNode(ICommand command, CommandCreatedEvent event) {
- List<EditPartTraceRecord> kids = new ArrayList<EditPartTraceRecord>();
- Object source = event.getSource(command);
- if (source != null) {
- kids.add(new EditPartTraceRecord("from " + DevUtils.getFullClassName(source)));
- }
- if (command instanceof CompositeCommand) {
- Iterator<? extends ICommand> subCommands = ((CompositeCommand) command).iterator();
- while (subCommands.hasNext()) {
- kids.add(createCommandNode(subCommands.next(), event));
- }
- }
- if (command instanceof CommandProxy) {
- Command realCommand = ((CommandProxy) command).getCommand();
- if (realCommand != null) {
- kids.add(createCommandNode(realCommand, event));
- }
- }
- if (command instanceof SemanticCreateCommand) {
- ICommand realCommand = (ICommand) DevUtils.getFieldValue(command, "realSemanticCommand");
- if (realCommand != null) {
- kids.add(createCommandNode(realCommand, event));
- }
- }
- if (command instanceof IAdaptable) {
- org.eclipse.emf.common.command.Command delegate = (org.eclipse.emf.common.command.Command) ((IAdaptable) command).getAdapter(org.eclipse.emf.common.command.Command.class);
- if (delegate != null) {
- kids.add(createCommandNode(delegate, event));
- }
- }
- return new EditPartTraceRecord(getLabel(command), getImage(command), (EditPartTraceRecord[]) kids.toArray(new EditPartTraceRecord[kids.size()]));
- }
-} \ No newline at end of file
+}
diff --git a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceContributor.java b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceContributor.java
new file mode 100644
index 000000000..f6542b74b
--- /dev/null
+++ b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceContributor.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2005 Borland Software Corporation
+ *
+ * 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:
+ * Dmitri Stadnik (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.dev;
+
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+
+/**
+ * @author dstadnik
+ */
+public interface EditPartTraceContributor {
+
+ public void contribute(List<EditPartTraceRecord> kids, EditPart editPart);
+
+ public void contribute(List<EditPartTraceRecord> kids, Request request);
+
+ public void contribute(List<EditPartTraceRecord> kids, Command command, CommandCreatedEvent event);
+}
diff --git a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceRequestFilters.java b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceRequestFilters.java
index 8e63967be..50d3238fd 100644
--- a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceRequestFilters.java
+++ b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceRequestFilters.java
@@ -19,6 +19,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -34,11 +36,17 @@ import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
public class EditPartTraceRequestFilters {
private static final Object[] NONE = new Object[0];
+
private static final String REQUEST_FILTERS_TAG = "request_filters"; //$NON-NLS-1$
+
private static final String CATEGORY_TAG = "category"; //$NON-NLS-1$
+
private static final String CATEGORY_NAME_ATTR = "name"; //$NON-NLS-1$
+
private static final String FILTER_TAG = "filter"; //$NON-NLS-1$
+
private static final String REQUEST_TYPE_ATTR = "request_type"; //$NON-NLS-1$
+
private static final String ENABLED_ATTR = "enabled"; //$NON-NLS-1$
private List<Category> categories;
@@ -46,8 +54,24 @@ public class EditPartTraceRequestFilters {
public EditPartTraceRequestFilters() {
categories = new ArrayList<Category>();
categories.add(new Category("GEF", getRequestFilters(org.eclipse.gef.RequestConstants.class)));
- categories.add(new Category("GMF",
- getRequestFilters(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.class)));
+ readExtensions();
+ }
+
+ protected void readExtensions() {
+ String id = DevPlugin.getInstance().getBundle().getSymbolicName();
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(id, "editPartRequestFilters");
+ for (int i = 0; i < elements.length; i++) {
+ if (!"category".equals(elements[i].getName())) {
+ continue;
+ }
+ try {
+ String name = elements[i].getAttribute("name");
+ EditPartRequestFiltersProvider provider = (EditPartRequestFiltersProvider) elements[i].createExecutableExtension("class");
+ categories.add(new Category(name, getRequestFilters(provider.getConstants())));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
public boolean isEnabled(String requestType) {
@@ -138,11 +162,10 @@ public class EditPartTraceRequestFilters {
}
public void edit(Shell shell) {
- CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(shell, new RequestFiltersLabelProvider(),
- new RequestFiltersContentProvider());
+ CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(shell, new RequestFiltersLabelProvider(), new RequestFiltersContentProvider());
dialog.setContainerMode(true);
dialog.setInput(categories);
- //dialog.setExpandedElements(categories.toArray(new Category[categories.size()]));
+ // dialog.setExpandedElements(categories.toArray(new Category[categories.size()]));
dialog.setInitialElementSelections(getEnabledRequestFilters());
dialog.setSorter(new ViewerSorter());
dialog.setTitle("Filtered Requests");
@@ -183,8 +206,7 @@ public class EditPartTraceRequestFilters {
Map<String, Filter> filters = new HashMap<String, Filter>();
try {
for (Field field : clazz.getDeclaredFields()) {
- if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())
- && String.class.equals(field.getType()) && !field.isSynthetic()) {
+ if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && String.class.equals(field.getType()) && !field.isSynthetic()) {
// possibly name should start with 'REQ_'
String requestType = (String) field.get(null);
if (requestType != null) {
@@ -201,7 +223,9 @@ public class EditPartTraceRequestFilters {
private static class Filter {
public Category category;
+
public String type;
+
public boolean enabled;
public Filter(String type, boolean enabled) {
@@ -213,6 +237,7 @@ public class EditPartTraceRequestFilters {
private static class Category {
public String name;
+
private Map<String, Filter> filters; // request type -> filter
public Category(String name, Map<String, Filter> filters) {
@@ -238,7 +263,8 @@ public class EditPartTraceRequestFilters {
private class RequestFiltersContentProvider implements ITreeContentProvider {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
public Object getParent(Object element) {
if (element instanceof Filter) {
@@ -272,6 +298,7 @@ public class EditPartTraceRequestFilters {
return getChildren(inputElement);
}
- public void dispose() {}
+ public void dispose() {
+ }
}
}
diff --git a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceView.java b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceView.java
index b71c89527..0d5cef67c 100644
--- a/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceView.java
+++ b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTraceView.java
@@ -139,7 +139,7 @@ public class EditPartTraceView extends ViewPart {
if (history.isEmpty()) {
throw new IllegalStateException("Command requested event was not received.");
}
- CommandCreatedEvent event = (CommandCreatedEvent) history.pop();
+ CommandCreatedEvent event = history.pop();
event.editPart = editPart;
event.request = request;
event.command = command;
@@ -157,7 +157,7 @@ public class EditPartTraceView extends ViewPart {
}
}
} else {
- CommandCreatedEvent parent = (CommandCreatedEvent) history.peek();
+ CommandCreatedEvent parent = history.peek();
if (parent.siblings == null) {
parent.siblings = new ArrayList<CommandCreatedEvent>();
}
@@ -196,7 +196,7 @@ public class EditPartTraceView extends ViewPart {
}
}
}
- EditPartTraceRecord[] akids = (EditPartTraceRecord[]) kids.toArray(new EditPartTraceRecord[kids.size()]);
+ EditPartTraceRecord[] akids = kids.toArray(new EditPartTraceRecord[kids.size()]);
return top ? new TopEditPartTraceRecord(text.toString(), DevPlugin.EVENT_IMAGE, akids, requestType) : new EditPartTraceRecord(text.toString(), DevPlugin.EVENT_IMAGE, akids);
}
diff --git a/devtools/org.eclipse.gmf.dev/EditPartTracer.aj b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTracer.aj
index 0587a51b1..1f4811d3d 100644
--- a/devtools/org.eclipse.gmf.dev/EditPartTracer.aj
+++ b/devtools/org.eclipse.gmf.dev/src/org/eclipse/gmf/dev/EditPartTracer.aj
@@ -9,16 +9,15 @@
* Contributors:
* Dmitri Stadnik (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.runtime.diagram.ui;
+package org.eclipse.gmf.dev;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -28,9 +27,9 @@ import org.eclipse.ui.PlatformUI;
*/
public aspect EditPartTracer {
- pointcut makingCommand(EditPart editPart, Request request) : (execution(Command ConnectionEditPart.getCommand(Request)) || execution(Command GraphicalEditPart.getCommand(Request))) && target(editPart) && args(request);
+ pointcut makingCommandInEditPart(EditPart editPart, Request request) : execution(Command EditPart.getCommand(Request)) && target(editPart) && args(request);
- Command around(EditPart editPart, Request request) : makingCommand(editPart, request) {
+ Command around(EditPart editPart, Request request) : makingCommandInEditPart(editPart, request) {
fireCommandRequested(editPart, request);
Map sources = new HashMap();
Command command = null;
@@ -42,6 +41,17 @@ public aspect EditPartTracer {
return command;
}
+ pointcut makingCommandInEditPolicy(EditPolicy editPolicy, Request request) : execution(Command EditPolicy.getCommand(Request)) && target(editPolicy) && args(request);
+
+ Command around(EditPolicy editPolicy, Request request) : makingCommandInEditPolicy(editPolicy, request) {
+ Command command = null;
+ try {
+ command = proceed(editPolicy, request);
+ } finally {
+ }
+ return command;
+ }
+
private static Object getTraceView() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {

Back to the top