summaryrefslogtreecommitdiffstats
path: root/examples/org.eclipse.swt.examples.ole.win32
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2004-09-20 18:46:47 +0000
committerGrant Gayed <ggayed>2004-09-20 18:46:47 +0000
commit4836c9504430cbc373cffbbbed3a7da6dbb39cfc (patch)
treede8fbd8e89c460ccb3024199c1b19a332a9af2aa /examples/org.eclipse.swt.examples.ole.win32
parent51f90ee7dcb56c1a6b276772459f1fa106a5ef95 (diff)
downloadeclipse.platform.swt-4836c9504430cbc373cffbbbed3a7da6dbb39cfc.tar.gz
eclipse.platform.swt-4836c9504430cbc373cffbbbed3a7da6dbb39cfc.tar.xz
eclipse.platform.swt-4836c9504430cbc373cffbbbed3a7da6dbb39cfc.zip
74268
Diffstat (limited to 'examples/org.eclipse.swt.examples.ole.win32')
-rw-r--r--examples/org.eclipse.swt.examples.ole.win32/.project1
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/plugin.xml6
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java25
3 files changed, 21 insertions, 11 deletions
diff --git a/examples/org.eclipse.swt.examples.ole.win32/.project b/examples/org.eclipse.swt.examples.ole.win32/.project
index 9ea059d7d5..ff00f68d20 100644
--- a/examples/org.eclipse.swt.examples.ole.win32/.project
+++ b/examples/org.eclipse.swt.examples.ole.win32/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.swt.examples.ole.win32</name>
<comment></comment>
<projects>
- <project>org.eclipse.swt</project>
</projects>
<buildSpec>
<buildCommand>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/plugin.xml b/examples/org.eclipse.swt.examples.ole.win32/plugin.xml
index 551c966c29..d7a9dcc973 100755
--- a/examples/org.eclipse.swt.examples.ole.win32/plugin.xml
+++ b/examples/org.eclipse.swt.examples.ole.win32/plugin.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
<!-- File written by PDE 1.0 -->
<plugin
id="org.eclipse.swt.examples.ole.win32"
@@ -8,6 +9,11 @@
class="org.eclipse.swt.examples.ole.win32.OlePlugin">
<!-- Required plugins -->
<requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui.views"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.ui.editors"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.ui"/>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
index e70dc54d00..88c8dc65d4 100755
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
+++ b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.ui.plugin.*;
+import org.osgi.framework.*;
/**
* The main plugin class to be used in the desktop.
@@ -49,18 +50,22 @@ public class OlePlugin extends AbstractUIPlugin {
/**
* Constructs an OLE plugin.
*/
- public OlePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
+ public OlePlugin() {
+ super();
plugin = this;
- resourceBundle = descriptor.getResourceBundle();
}
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ resourceBundle = Platform.getResourceBundle(getBundle());
+ }
+
/**
* Clean up
*/
- public void shutdown() throws CoreException {
- super.shutdown();
+ public void stop(BundleContext context) throws Exception {
freeResources();
+ super.stop(context);
}
/**
@@ -107,8 +112,8 @@ public class OlePlugin extends AbstractUIPlugin {
* @param exception the associated exception, or null
*/
public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
+ plugin.getLog().log(new Status(
+ IStatus.ERROR, plugin.getBundle().getSymbolicName(), 0, message, exception));
}
/**
@@ -119,7 +124,7 @@ public class OlePlugin extends AbstractUIPlugin {
images = new Image[imageLocations.length];
for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
+ images[i] = getImageFromPlugin(plugin.getBundle(), imageLocations[i]);
if (images[i] == null) {
freeResources();
logError(getResourceString("error.CouldNotLoadResources"), null);
@@ -162,10 +167,10 @@ public class OlePlugin extends AbstractUIPlugin {
* @param iconPath the path relative to the install directory
* @return the image, or null if not found
*/
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
+ private static Image getImageFromPlugin(Bundle bundle, String iconPath) {
InputStream is = null;
try {
- URL installUrl = pd.getInstallURL();
+ URL installUrl = bundle.getEntry("/");
URL url = new URL(installUrl, iconPath);
is = url.openConnection().getInputStream();
ImageData source = new ImageData(is);