Bug 513121: provide an OT/Equinox feature compatible with OTRE weaving
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/.classpath b/plugins/org.eclipse.objectteams.otequinox.branding.otre/.classpath
new file mode 100644
index 0000000..4f51512
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/.project b/plugins/org.eclipse.objectteams.otequinox.branding.otre/.project
new file mode 100644
index 0000000..9f3528c
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.objectteams.otequinox.branding.otre</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.objectteams.otequinox.branding.otre/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..50b27db
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,27 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.objectteams.otdt.compiler.option.joinpoint_queries=disabled
+org.eclipse.objectteams.otdt.compiler.option.scoped_keywords=enabled
+org.eclipse.objectteams.otdt.compiler.option.weaving_scheme=OTRE
+org.eclipse.objectteams.otdt.compiler.problem.abstract_potential_relevant_role=warning
+org.eclipse.objectteams.otdt.compiler.problem.basecall=warning
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
+org.eclipse.objectteams.otdt.compiler.problem.decapsulation=warning
+org.eclipse.objectteams.otdt.compiler.problem.deprecated_path_syntax=warning
+org.eclipse.objectteams.otdt.compiler.problem.effectless_fieldaccess=warning
+org.eclipse.objectteams.otdt.compiler.problem.fragile_callin=warning
+org.eclipse.objectteams.otdt.compiler.problem.incomplete_build=error
+org.eclipse.objectteams.otdt.compiler.problem.inferred_callout=error
+org.eclipse.objectteams.otdt.compiler.problem.potential_ambiguous_playedby=warning
+org.eclipse.objectteams.otdt.compiler.problem.unsafe_liftctor=warning
+org.eclipse.objectteams.otdt.compiler.problem.unused_parammap=warning
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otequinox.branding.otre/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..354125d
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.objectteams.otequinox.branding.otre;singleton:=true
+Bundle-Version: 2.6.0.qualifier
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.ui.workbench;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.objectteams.otequinox;bundle-version="[2.3.0,3.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.objectteams.otequinox.branding.Activator
+Export-Package: org.eclipse.objectteams.otequinox.internal.branding;ot-aspect-host="org.eclipse.objectteams.otequinox.branding.otre";x-friends:="org.eclipse.ui.workbench"
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/META-INF/p2.inf b/plugins/org.eclipse.objectteams.otequinox.branding.otre/META-INF/p2.inf
new file mode 100644
index 0000000..e53dac5
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/META-INF/p2.inf
@@ -0,0 +1,5 @@
+requires.1.namespace=org.eclipse.equinox.p2.iu
+requires.1.name=org.eclipse.objectteams.otequinox.branding
+requires.1.range=[2.5.0,3.0.0)
+requires.1.min=0
+requires.1.max=0
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/about.html b/plugins/org.eclipse.objectteams.otequinox.branding.otre/about.html
new file mode 100644
index 0000000..66ef6f6
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 15, 2010</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/build.properties b/plugins/org.eclipse.objectteams.otequinox.branding.otre/build.properties
new file mode 100644
index 0000000..d3e0917
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ .,\
+ icons/,\
+ plugin.properties,\
+ about.html
+javacProjectSettings=true
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/icons/signed_adapted.gif b/plugins/org.eclipse.objectteams.otequinox.branding.otre/icons/signed_adapted.gif
new file mode 100644
index 0000000..986fa42
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/icons/signed_adapted.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/icons/unsigned_adapted.gif b/plugins/org.eclipse.objectteams.otequinox.branding.otre/icons/unsigned_adapted.gif
new file mode 100644
index 0000000..915a4e7
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/icons/unsigned_adapted.gif
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/plugin.properties b/plugins/org.eclipse.objectteams.otequinox.branding.otre/plugin.properties
new file mode 100644
index 0000000..1be1cb3
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/plugin.properties
@@ -0,0 +1,2 @@
+pluginName=OT/Equinox Branding Integration
+providerName=Eclipse.org - Object Teams
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/plugin.xml b/plugins/org.eclipse.objectteams.otequinox.branding.otre/plugin.xml
new file mode 100644
index 0000000..608cd82
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/plugin.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <team class="org.eclipse.objectteams.otequinox.internal.branding.BrandingAdaptor"
+ activation="ALL_THREADS"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif"/>
+ <basePlugin
+ id="org.eclipse.ui.workbench"
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.png"/>
+ </aspectBinding>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/branding/Activator.java b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/branding/Activator.java
new file mode 100644
index 0000000..b01be95
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/branding/Activator.java
@@ -0,0 +1,98 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2009 Stephan Herrmann.
+ *
+ * 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
+ * $Id: Activator.java 23461 2010-02-04 22:10:39Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otequinox.branding;
+
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * This bundle activator is only responsible for managing two icons,
+ * see {@link #getImage(String)}.
+ *
+ * @author stephan
+ * @since 1.4.0
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** "Signed" icon with aspect binding decoration. */
+ public static final String IMG_SIGNED_ADAPTED = "org.eclipse.objectteams.otequinox.branding.signed_adapted"; //$NON-NLS-1$
+
+ /** "Unsigned" icon with aspect binding decoration. */
+ public static final String IMG_UNSIGNED_ADAPTED = "org.eclipse.objectteams.otequinox.branding.unsigned_adapted"; //$NON-NLS-1$
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.objectteams.otequinox.branding.otre"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ private ImageRegistry imageRegistry;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Get an image identified by the given key. Supported values are
+ * {@link #IMG_SIGNED_ADAPTED} and {@link #IMG_UNSIGNED_ADAPTED}.
+ * @param key
+ * @return a cached imaged, if valid key was given, otherwise null.
+ */
+ public Image getImage(String key) {
+ if (this.imageRegistry == null)
+ initializeImageRegistry();
+ return this.imageRegistry.get(key);
+ }
+
+ private void initializeImageRegistry() {
+ this.imageRegistry = new ImageRegistry();
+ this.imageRegistry.put(IMG_SIGNED_ADAPTED, imageDescriptorFromPlugin(PLUGIN_ID, "icons/signed_adapted.gif")); //$NON-NLS-1$
+ this.imageRegistry.put(IMG_UNSIGNED_ADAPTED, imageDescriptorFromPlugin(PLUGIN_ID, "icons/unsigned_adapted.gif")); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingAdaptor.java b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingAdaptor.java
new file mode 100644
index 0000000..3b4046a
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingAdaptor.java
@@ -0,0 +1,101 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute for Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id:AboutAdaptor.java 15202 2007-01-28 11:30:50Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otequinox.internal.branding;
+
+import java.util.HashSet;
+
+import org.eclipse.objectteams.otequinox.TransformerPlugin;
+import org.eclipse.objectteams.otequinox.branding.Activator;
+import org.eclipse.swt.graphics.Image;
+
+import base org.eclipse.ui.internal.about.AboutBundleData;
+import base org.eclipse.ui.internal.about.AboutPluginsPage.BundleTableLabelProvider;
+
+/**
+ * This aspect adapts the branding of the Eclipse workbench by
+ * - adapting the about plug-ins dialog, displaying as a self-application
+ * which plug-ins have been adapted by an OT/J aspect.
+ *
+ * @author stephan
+ * @version $Id:AboutAdaptor.java 15202 2007-01-28 11:30:50Z stephan $
+ */
+@SuppressWarnings("restriction")
+public team class BrandingAdaptor
+{
+ public BrandingAdaptor() {
+ }
+
+ /** Append OT-adaptations to the version number of any adapted bundle. */
+ protected class AboutBundleAdaptor playedBy AboutBundleData
+ base when (isAdaptedBaseBundle(base))
+ {
+ callin String getVersion()
+ {
+ String adaptationString = ""; //$NON-NLS-1$
+ HashSet<String> reportedPlugins = new HashSet<String>();
+ adaptationString = BrandingMessages.BrandingAdaptor_OT_adapted_by;
+ for (String element : TransformerPlugin.getDefault().getAdaptingAspectPlugins(getID()))
+ {
+ if (!reportedPlugins.contains(element))
+ adaptationString = adaptationString+"\n* "+element; //$NON-NLS-1$
+ reportedPlugins.add(element);
+ }
+ return base.getVersion() + adaptationString;
+ }
+ getVersion <- replace getVersion;
+
+ String getID() -> String getId();
+ boolean isSigned() -> boolean isSigned();
+ boolean isSignedDetermined() -> boolean isSignedDetermined();
+ }
+
+ /**
+ * For all adapted bundles replace the singed/unsigned icons with
+ * a variant that is decorated with a aspect binding icon.
+ */
+ protected class IconAdaptor playedBy BundleTableLabelProvider {
+
+ Image getAdaptedSigningColumnImage(AboutBundleAdaptor data) <- replace Image getColumnImage(Object element, int columnIndex)
+ base when (columnIndex == 0 && isAdaptedBaseBundle(element))
+ with { data <- (AboutBundleData)element }
+
+ @SuppressWarnings("basecall")
+ callin Image getAdaptedSigningColumnImage(AboutBundleAdaptor data) {
+ if (data.isSignedDetermined()) {
+ if (data.isSigned())
+ return Activator.getDefault().getImage(Activator.IMG_SIGNED_ADAPTED);
+ else
+ return Activator.getDefault().getImage(Activator.IMG_UNSIGNED_ADAPTED);
+ }
+ return base.getAdaptedSigningColumnImage(data);
+ }
+ }
+
+ /** Is 'element' an AboutBundleData object representing a bundle that is adapted by an OT/Equinox bundle? */
+ public static boolean isAdaptedBaseBundle(Object element) {
+ // use qualified name, because AboutBundleData is a role's base class thus considered alien to this team:
+ if (element instanceof org.eclipse.ui.internal.about.AboutBundleData) {
+ String symbolicName = ((org.eclipse.ui.internal.about.AboutBundleData)element).getId();
+ return TransformerPlugin.getDefault().isAdaptedBasePlugin(symbolicName);
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingMessages.java b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingMessages.java
new file mode 100644
index 0000000..2ecacf1
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingMessages.java
@@ -0,0 +1,33 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2009 Stephan Herrmann.
+ *
+ * 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
+ * $Id: BrandingMessages.java 23461 2010-02-04 22:10:39Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otequinox.internal.branding;
+
+import org.eclipse.osgi.util.NLS;
+
+public class BrandingMessages extends NLS {
+ private static final String BUNDLE_NAME = BrandingMessages.class.getName();
+
+ public static String BrandingAdaptor_OT_adapted_by;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, BrandingMessages.class);
+ }
+
+ private BrandingMessages() {
+ // don't instantiate
+ }
+}
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingMessages.properties b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingMessages.properties
new file mode 100644
index 0000000..3d383d4
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding.otre/src/org/eclipse/objectteams/otequinox/internal/branding/BrandingMessages.properties
@@ -0,0 +1 @@
+BrandingAdaptor_OT_adapted_by=\n**** OT-adapted by:
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding/META-INF/p2.inf b/plugins/org.eclipse.objectteams.otequinox.branding/META-INF/p2.inf
new file mode 100644
index 0000000..d627be1
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otequinox.branding/META-INF/p2.inf
@@ -0,0 +1,5 @@
+requires.1.namespace=org.eclipse.equinox.p2.iu
+requires.1.name=org.eclipse.objectteams.otequinox.branding.otre
+requires.1.range=[2.5.0,3.0.0)
+requires.1.min=0
+requires.1.max=0
diff --git a/plugins/org.eclipse.objectteams.otequinox.branding/build.properties b/plugins/org.eclipse.objectteams.otequinox.branding/build.properties
index 30bfd0e..d3e0917 100644
--- a/plugins/org.eclipse.objectteams.otequinox.branding/build.properties
+++ b/plugins/org.eclipse.objectteams.otequinox.branding/build.properties
@@ -6,3 +6,4 @@
icons/,\
plugin.properties,\
about.html
+javacProjectSettings=true