Changeset 1780
- Timestamp:
- 12/20/07 13:41:38 (1 year ago)
- Files:
-
- trunk/libselinux.linux.x86/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/libselinux.linux.x86/build.properties (modified) (1 diff)
- trunk/libselinux.linux.x86/src/com/tresys/framework/compiler/linkage/SELinuxjava.java (deleted)
- trunk/libselinux.linux.x86_64/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/libselinux.linux.x86_64/build.properties (modified) (1 diff)
- trunk/libselinux.linux.x86_64/src/com/tresys/framework/compiler/linkage/SELinuxjava.java (deleted)
- trunk/libselinux.place.holder/src/com/tresys/framework/compiler/linkage/SELinuxjava.java (deleted)
- trunk/libselinuxjava-plugin/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/libselinuxjava-plugin/build.properties (modified) (2 diffs)
- trunk/libselinuxjava-plugin/src/com/tresys/framework/compiler/linkage/libselinuxjava_plugin.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libselinux.linux.x86/META-INF/MANIFEST.MF
r1779 r1780 9 9 Eclipse-PlatformFilter: (& (osgi.os=linux) (osgi.arch=x86)) 10 10 Require-Bundle: org.eclipse.core.runtime.compatibility 11 Bundle-ClassPath: libselinuxjava.jar12 11 Export-Package: com.tresys.framework.compiler.linkage.libselinuxjava trunk/libselinux.linux.x86/build.properties
r1779 r1780 1 source. libselinuxjava.jar= src/2 output. libselinuxjava.jar= bin/1 source.. = src/ 2 output.. = bin/ 3 3 bin.includes = META-INF/,\ 4 libselinuxjava.jar,\4 .,\ 5 5 libselinuxjava/libselinuxjava.so 6 source.libselinuxjava.jar = src/trunk/libselinux.linux.x86_64/META-INF/MANIFEST.MF
r1779 r1780 10 10 Require-Bundle: org.eclipse.core.runtime.compatibility 11 11 Export-Package: com.tresys.framework.compiler.linkage.libselinuxjava 12 Bundle-ClassPath: libselinuxjava.jartrunk/libselinux.linux.x86_64/build.properties
r1779 r1780 1 source. libselinuxjava.jar= src/2 output. libselinuxjava.jar= bin/1 source.. = src/ 2 output.. = bin/ 3 3 bin.includes = META-INF/,\ 4 libselinuxjava.jar,\4 .,\ 5 5 libselinuxjava/libselinuxjava.so 6 source.libselinuxjava.jar = src/trunk/libselinuxjava-plugin/META-INF/MANIFEST.MF
r1779 r1780 13 13 org.eclipse.core.runtime 14 14 Bundle-Activator: com.tresys.framework.compiler.linkage.libselinuxjava_plugin 15 Bundle-ClassPath: lib rary.jar15 Bundle-ClassPath: libselinux.jar trunk/libselinuxjava-plugin/build.properties
r1779 r1780 1 source.library.jar = src/ 2 output.library.jar = bin/ 1 output.libselinux.jar = bin/ 3 2 bin.includes = META-INF/,\ 4 lib rary.jar,\3 libselinux.jar,\ 5 4 plugin.properties 6 5 src.includes = .classpath,\ … … 9 8 build.properties,\ 10 9 src/ 11 jars.compile.order = library.jar 12 source.library.jar = src/ 10 jars.compile.order = libselinux.jar 11 source.libselinux.jar = src/ 12 source.libselinux.jar = src/ 13 13 trunk/libselinuxjava-plugin/src/com/tresys/framework/compiler/linkage/libselinuxjava_plugin.java
r1630 r1780 11 11 package com.tresys.framework.compiler.linkage; 12 12 13 import java.io.IOException; 14 import java.net.URL; 15 16 import org.eclipse.core.runtime.Platform; 13 17 import org.eclipse.core.runtime.Plugin; 18 import org.eclipse.core.runtime.Status; 19 import org.eclipse.jface.dialogs.MessageDialog; 20 import org.eclipse.swt.widgets.Display; 21 import org.eclipse.ui.PlatformUI; 22 import org.osgi.framework.Bundle; 14 23 import org.osgi.framework.BundleContext; 15 24 … … 17 26 extends Plugin 18 27 { 28 // The plug-in ID 29 private static final String PLUGIN_ID = "com.tresys.libselinux"; 19 30 20 31 static private libselinuxjava_plugin m_default; 32 private boolean m_bIsLoaded = false; 21 33 22 34 public libselinuxjava_plugin () … … 35 47 { 36 48 super.start (context); 49 50 loadLibs (context); 37 51 } 38 52 … … 44 58 } 45 59 60 public boolean isLoaded () 61 { 62 return m_bIsLoaded; 63 } 64 65 /** 66 * Convenience method which returns the unique identifier of this plugin. 67 */ 68 public static String getUniqueIdentifier() 69 { 70 if (getDefault() == null) 71 { 72 // If the default instance is not yet initialized, 73 // return a static identifier. This identifier must 74 // match the plugin id defined in plugin.xml 75 return PLUGIN_ID; 76 } 77 return getDefault().getBundle().getSymbolicName(); 78 } 79 80 /** 81 * Check if a specific debugging option is turned on 82 * see http://wiki.eclipse.org/index.php/FAQ_How_do_I_use_the_platform_debug_tracing_facility%3F 83 * for more information and .options file in project for what is debugable 84 * settable in the launch configuration 'tracing' tab 85 * @param i_sDebugOption 86 * @return 87 */ 88 public boolean isDebugging (String i_sDebugOption) 89 { 90 if (!isDebugging ()) 91 return false; 92 93 String sOption = Platform.getDebugOption (getUniqueIdentifier () + i_sDebugOption); 94 return ("true".equals (sOption)); //$NON-NLS-1$ 95 } 96 97 private void loadLibs (BundleContext context) 98 { 99 // list of libs to load. On most systems will only need to load the last 4. 100 // but, there are cases when the others are needed. If they are there, load them 101 // if not, don't worry about it. 102 String [] aLibs = { 103 "selinuxjava" //$NON_NLS-1$ 104 }; 105 106 for (int i = 0; i < aLibs.length; i++) 107 { 108 try 109 { 110 String sLibName = "libselinuxjava/" + System.mapLibraryName (aLibs[i]); 111 Bundle i_bundle = context.getBundle (); 112 URL selinuxResource = i_bundle.getResource(sLibName); //$NON-NLS-1$ 113 String sPath = null; 114 if (selinuxResource != null) 115 sPath = Platform.asLocalURL(selinuxResource).getPath(); 116 117 if (sPath != null) 118 { 119 System.load (sPath); 120 m_bIsLoaded = true; 121 } 122 } 123 catch (UnsatisfiedLinkError ule) 124 { 125 Status status = new Status (Status.ERROR, getUniqueIdentifier (), "Unable to load lib: " + aLibs[i], ule); 126 getLog ().log (status); 127 } 128 catch (IOException ioe) 129 { 130 Status status = new Status (Status.ERROR, getUniqueIdentifier (), "Unable to load lib: " + aLibs[i], ioe); 131 getLog ().log (status); 132 } 133 } 134 135 if (!isLoaded ()) 136 { 137 Display.getDefault().syncExec( 138 new Runnable() 139 { 140 public void run() 141 { 142 MessageDialog waitBox = new MessageDialog( 143 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 144 "Missing libselinuxjava", null, 145 "Missing libselinuxjava, correct this problem before creating projects", 146 MessageDialog.ERROR, new String[] { "OK"}, 1); 147 148 waitBox.open(); 149 } 150 }); 151 152 } 153 } 154 155 46 156 }
