X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=ide%2Fplugins%2Forg.argeo.slc.ide.osgi.ui%2Fsrc%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2FSlcIdeUiPlugin.java;fp=ide%2Fplugins%2Forg.argeo.slc.ide.osgi.ui%2Fsrc%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2FSlcIdeUiPlugin.java;h=0000000000000000000000000000000000000000;hb=5d23d1d3000b870b0ce9c9dea2bd9dc50dc03ef5;hp=3570a61136049d2833868c6d37662176444f6f76;hpb=6227518f97c4697d83637eea4c76047235101491;p=gpl%2Fargeo-slc.git diff --git a/ide/plugins/org.argeo.slc.ide.osgi.ui/src/org/argeo/slc/ide/ui/SlcIdeUiPlugin.java b/ide/plugins/org.argeo.slc.ide.osgi.ui/src/org/argeo/slc/ide/ui/SlcIdeUiPlugin.java deleted file mode 100644 index 3570a6113..000000000 --- a/ide/plugins/org.argeo.slc.ide.osgi.ui/src/org/argeo/slc/ide/ui/SlcIdeUiPlugin.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.argeo.slc.ide.ui; - -import java.net.URL; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.pde.core.plugin.TargetPlatform; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class SlcIdeUiPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String ID = "org.argeo.slc.ide.ui"; - - // The shared instance - private static SlcIdeUiPlugin plugin; - - /** - * The constructor - */ - public SlcIdeUiPlugin() { - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - DebugPlugin.getDefault() - .addDebugEventListener(new DebugEventListener()); - - String location = TargetPlatform.getLocation(); - System.out.println(location); - } - - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static SlcIdeUiPlugin getDefault() { - return plugin; - } - - public Image getImage(String relativeURL) { - ImageRegistry imageRegistry = getImageRegistry(); - Image image = imageRegistry.get(relativeURL); - if (image == null) { - URL imageURL = getBundle().getEntry(relativeURL); - ImageDescriptor descriptor = ImageDescriptor - .createFromURL(imageURL); - image = descriptor.createImage(); - imageRegistry.put(relativeURL, image); - } - return image; - } - - protected static class DebugEventListener implements IDebugEventSetListener { - public void handleDebugEvents(DebugEvent[] events) { - if (events == null) - return; - - for (int i = 0; i < events.length; i++) { - DebugEvent event = events[i]; - if (event == null) - continue; - Object source = event.getSource(); - if (source instanceof IProcess - && event.getKind() == DebugEvent.TERMINATE) { - IProcess process = (IProcess) source; -// if (process == null) -// continue; - ILaunch launch = process.getLaunch(); - if (launch != null) - refreshOsgiBootLaunch(launch); - } - } - } - - protected void refreshOsgiBootLaunch(ILaunch launch) { - try { - if (launch == null) - return; - IResource[] resources = launch.getLaunchConfiguration() - .getMappedResources(); - if (resources == null) - return; - if (resources.length > 0) { - IResource propertiesFile = resources[0]; - if (propertiesFile.getParent() == null) - return; - propertiesFile.getParent().refreshLocal( - IResource.DEPTH_INFINITE, null); - // System.out.println("Refreshed " - // + propertiesFile.getParent()); - } - } catch (CoreException e) { - e.printStackTrace(); - } - - } - - } - -}