Menu

BackportEclipse32

Remo

Backport to Eclipse 3.2

Since Databinding is a 3.2 fe3 feature, and many forms enhancements were made in 3.3 too, it is recommended to use Eclipse 3.3 if at any way possible.
IIf there is no possible way, you can use the Eclipse 3.2 backport. It brings a special patched ve backport of Eclipse databinding, which will even support emf databinding.

It is maintained in a branch 320_backport in the repository. Check it out, compile against Eclipse 3.2 and run the examples.
Be aware, that the examples only run when the swt native dlls (windows) are contained in the library path, e.g. add something like this to your vm arguments:
-Djava.library.path=d:\develop\swt320libs

Eclipse >= 3.3 automatically sets a default realm when starting the workbench. Eclipse 3.2 does not know databinding, thus it does not. You need to add code to do this, e.g. in the main method of your rcp application; if you use feature or plugins, you need to set the real early in the startup process or wrap all binding calls into a runnable and start it with Realm.runWithDefault().

Nice things about the backport

  • the newest possible implementations of databinding were patched and ported, thus you get a lot of functionality even from Eclipse 3.4 for free
  • RCPForms 3.2 backport is api compatible to RCPForms head; thus your investments are safe, rcpforms encapsulates the differences between 3.2 and 3.4. Just recompile your code against rcpforms 3.4 and you are done.
  • EMF Databinding will work with 3.2 backport !
  • we save you a lot of time and know how to do the backport yourself

Not so nice things

  • well, since there are loads of differences in Eclipse 3.2 vs. Eclipse 3.4 concerning data binding, form header decorations and the like, some rcpforms features wont work too well on Eclipse 3.2 backport.
  • The backport will not be maintained by us. If you don't deliver patches, you have to stay with whats there at the moment.
  • info decorator for fields is not available since not supported by Eclipse 3.2
  • Warning and error messages in the Form Decoration look a bit ugly; we just used what was there in Eclipse 3.2, but enhanced it by hacking a tooltip with all error messages in the form heading.
  • table support has several limitations; only the things we needed are backported. The main use case of configuring a table works; some cell editors do not work optimally. Still you will do better fixing these bugs and sending patches than doing it all on your own.
  • Databinding backport is quite hacked to get the most out of it; we took the following versions and combined them:
  • org.eclipse.core.databinding tag R3_4, patched the Activator class and manifest.mf
  • org.eclipse.core.databinding.beans tag R3_4
  • org.eclipse.jface.databinding tag R3_3
  • org.eclipse.emf.databinding 1.0.0.v200808251517

Patch for org.eclipse.core.databinding:

Index: src/org/eclipse/core/internal/databinding/Activator.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/Activator.java,v
retrieving revision 1.2
diff -u -r1.2 Activator.java
--- src/org/eclipse/core/internal/databinding/Activator.java    11 Apr 2008 22:18:08 -0000    1.2
+++ src/org/eclipse/core/internal/databinding/Activator.java    8 Apr 2009 10:26:50 -0000
@@ -11,29 +11,16 @@

 package org.eclipse.core.internal.databinding;

-import java.util.ArrayList;
-
-import org.eclipse.core.databinding.util.ILogger;
-import org.eclipse.core.databinding.util.Policy;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.framework.log.FrameworkLogEntry;
-import org.osgi.framework.BundleActivator;
+import org.eclipse.core.runtime.Plugin;
 import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;

 /**
- * @since 3.3
- *
+ * The activator class controls the plug-in life cycle
  */
-public class Activator implements BundleActivator {
-    /**
-     * The plug-in ID
-     */
-    public static final String PLUGIN_ID = "org.eclipse.core.databinding"; //$NON-NLS-1$
+public class Activator extends Plugin {

-    private volatile static ServiceTracker _frameworkLogTracker;
+    // The shared instance
+    private static Activator plugin;

     /**
      * The constructor
@@ -41,62 +28,37 @@
     public Activator() {
     }

+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+     * )
+     */
     public void start(BundleContext context) throws Exception {
-        _frameworkLogTracker = new ServiceTracker(context, FrameworkLog.class.getName(), null);
-        _frameworkLogTracker.open();
-
-        Policy.setLog(new ILogger() {
-
-            public void log(IStatus status) {
-                ServiceTracker frameworkLogTracker = _frameworkLogTracker;
-                FrameworkLog log = frameworkLogTracker == null ? null : (FrameworkLog) frameworkLogTracker.getService();
-                if (log != null) {
-                    log.log(createLogEntry(status));
-                } else {
-                    // fall back to System.err
-                    System.err.println(status.getPlugin() + " - " + status.getCode() + " - " + status.getMessage());  //$NON-NLS-1$//$NON-NLS-2$
-                    if( status.getException() != null ) {
-                        status.getException().printStackTrace(System.err);
-                    }
-                }
-            }
-
-        });
+        super.start(context);
+        plugin = this;
     }
-
-    // Code copied from PlatformLogWriter.getLog(). Why is logging an IStatus so
-    // hard?
-    FrameworkLogEntry createLogEntry(IStatus status) {
-        Throwable t = status.getException();
-        ArrayList childlist = new ArrayList();
-
-        int stackCode = t instanceof CoreException ? 1 : 0;
-        // ensure a substatus inside a CoreException is properly logged
-        if (stackCode == 1) {
-            IStatus coreStatus = ((CoreException) t).getStatus();
-            if (coreStatus != null) {
-                childlist.add(createLogEntry(coreStatus));
-            }
-        }
-
-        if (status.isMultiStatus()) {
-            IStatus[] children = status.getChildren();
-            for (int i = 0; i < children.length; i++) {
-                childlist.add(createLogEntry(children[i]));
-            }
-        }

-        FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()]));
-
-        return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children);
+    /*
+     * (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);
     }

-
-    public void stop(BundleContext context) throws Exception {
-        if (_frameworkLogTracker != null) {
-            _frameworkLogTracker.close();
-            _frameworkLogTracker = null;
-        }
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault() {
+        return plugin;
     }

 }
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.core.databinding/META-INF/MANIFEST.MF,v
retrieving revision 1.14
diff -u -r1.14 MANIFEST.MF
--- META-INF/MANIFEST.MF    11 Apr 2008 22:18:08 -0000    1.14
+++ META-INF/MANIFEST.MF    8 Apr 2009 10:26:50 -0000
@@ -22,7 +22,9 @@
  org.eclipse.core.internal.databinding.observable.masterdetail;x-friends:="org.eclipse.jface.tests.databinding",
  org.eclipse.core.internal.databinding.observable.tree;x-friends:="org.eclipse.jface.databinding,org.eclipse.jface.tests.databinding",
  org.eclipse.core.internal.databinding.validation;x-friends:="org.eclipse.jface.tests.databinding"
-Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)"
+Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.osgi,
+ org.eclipse.core.runtime;bundle-version="3.2.0"
 Import-Package-Comment: see http://wiki.eclipse.org/
 Import-Package: com.ibm.icu.text,
  org.osgi.framework;version="[1.4.0,2.0.0)";resolution:=optional,
@@ -31,4 +33,5 @@
 Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
  J2SE-1.4
 Bundle-Activator: org.eclipse.core.internal.databinding.Activator
-Bundle-ActivationPolicy: lazy
+Eclipse-LazyStart: true
+

Related

Documentation: Home
Documentation: MainPreconditions

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.