From fe5f0118dafad2d6fde9bfc5bc5ff2227a36b9a0 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Thu, 30 Jan 2014 16:12:03 -0600 Subject: [PATCH] Issue #2312 Java 6 compatibility, fix legend menus. Former-commit-id: 2853536477d39459de3cbb4eef7670734cfad5f8 --- .../export/handler/ExportImageHandler.java | 3 +-- .../viz/ui/cmenu/ContextMenuManager.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java index 97a1f3cf78..d6d72e4226 100644 --- a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java +++ b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java @@ -21,7 +21,6 @@ package com.raytheon.uf.viz.image.export.handler; import java.awt.image.BufferedImage; -import java.io.Closeable; import java.io.File; import java.io.IOException; import java.util.Arrays; @@ -191,7 +190,7 @@ public class ExportImageHandler extends AbstractImageCaptureHandler { } ImageWriter writer = iter.next(); - Closeable stream = null; + FileImageOutputStream stream = null; try { if (images.size() == 1) { stream = new FileImageOutputStream(options.getFileLocation()); diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ContextMenuManager.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ContextMenuManager.java index bdae72718a..4c232e3b4d 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ContextMenuManager.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ContextMenuManager.java @@ -37,6 +37,8 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.Separator; +import org.osgi.framework.Bundle; +import org.osgi.framework.wiring.BundleWiring; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.drawables.ResourcePair; @@ -51,9 +53,11 @@ import com.raytheon.viz.ui.UiPlugin; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Nov 10, 2006 chammack Initial Creation. + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Nov 10, 2006 chammack Initial Creation. + * Jan 20, 2014 2312 bsteffen Use OSGi to load classes instead of + * register buddy. * * * @@ -96,7 +100,12 @@ public class ContextMenuManager { o = config[j].createExecutableExtension("actionClass"); Class c = null; if (capInterface != null) { - c = Class.forName(capInterface); + String bundleName = extensions[i].getContributor() + .getName(); + Bundle bundle = Platform.getBundle(bundleName); + BundleWiring wiring = bundle + .adapt(BundleWiring.class); + c = wiring.getClassLoader().loadClass(capInterface); } else { // if there's no interface but there is an action, // the action applies to all resources