Changeset 3469 for devel-tools/trunk
- Timestamp:
- Mar 8, 2008, 7:28:09 PM (13 years ago)
- Location:
- devel-tools/trunk/eclipse/org.refal.plus.rfpdt.launch/src/org/refal/plus/rfpdt/launch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel-tools/trunk/eclipse/org.refal.plus.rfpdt.launch/src/org/refal/plus/rfpdt/launch/LaunchingPlugin.java
r3449 r3469 1 1 package org.refal.plus.rfpdt.launch; 2 3 import java.util.MissingResourceException;4 import java.util.ResourceBundle;5 2 6 3 import org.eclipse.swt.widgets.Shell; … … 8 5 import org.eclipse.ui.IWorkbenchWindow; 9 6 import org.eclipse.ui.plugin.AbstractUIPlugin; 10 import org.osgi.framework.BundleContext;11 7 12 8 public class LaunchingPlugin extends AbstractUIPlugin { 13 // The shared instance.14 9 private static LaunchingPlugin plugin; 15 10 16 private ResourceBundle resourceBundle; 17 18 public LaunchingPlugin () { 19 super(); 20 plugin = this; 21 try { 22 resourceBundle = ResourceBundle.getBundle("org.refal.plus.rfpdt.launch.LaunchingPluginResources"); 23 } catch (MissingResourceException x) { 24 resourceBundle = null; 25 } 26 } 27 28 /** 29 * This method is called upon plug-in activation 30 */ 31 public void start (BundleContext context) throws Exception { 32 super.start(context); 33 } 34 35 /** 36 * This method is called when the plug-in is stopped 37 */ 38 public void stop (BundleContext context) throws Exception { 39 super.stop(context); 40 } 41 42 /** 43 * Returns the shared instance. 44 */ 45 public static LaunchingPlugin getDefault () { 46 return plugin; 47 } 48 49 /** 50 * Returns the string from the plugin's resource bundle, or 'key' if not found. 51 */ 52 public static String getResourceString (String key) { 53 ResourceBundle bundle = LaunchingPlugin.getDefault().getResourceBundle(); 54 try { 55 return (bundle != null) ? bundle.getString(key) : key; 56 } catch (MissingResourceException e) { 57 return key; 58 } 59 } 60 61 /** 62 * Returns the plugin's resource bundle, 63 */ 64 public ResourceBundle getResourceBundle () { 65 return resourceBundle; 11 private static IWorkbenchWindow getActiveWorkbenchWindow () { 12 return plugin == null ? null : plugin.getWorkbench().getActiveWorkbenchWindow(); 66 13 } 67 14 … … 71 18 public static Shell getShell () { 72 19 IWorkbenchWindow window = getActiveWorkbenchWindow(); 73 if (window != null) { 74 return window.getShell(); 75 } 76 return null; 77 } 78 79 public static IWorkbenchWindow getActiveWorkbenchWindow () { 80 return getDefault().getWorkbench().getActiveWorkbenchWindow(); 20 return window == null ? null : window.getShell(); 81 21 } 82 22 83 23 public static IWorkbenchPage getActivePage () { 84 IWorkbenchWindow w = getActiveWorkbenchWindow(); 85 if (w != null) { 86 return w.getActivePage(); 87 } 88 return null; 24 IWorkbenchWindow window = getActiveWorkbenchWindow(); 25 return window == null ? null : window.getActivePage(); 26 } 27 28 public LaunchingPlugin () { 29 super(); 30 plugin = this; 89 31 } 90 32 } -
devel-tools/trunk/eclipse/org.refal.plus.rfpdt.launch/src/org/refal/plus/rfpdt/launch/ui/RfpLaunchShortcut.java
r3468 r3469 24 24 import org.eclipse.ui.IWorkbenchPage; 25 25 import org.eclipse.ui.dialogs.ElementListSelectionDialog; 26 import org.refal.plus.rfpdt.core.builder.RfpBuilder; 26 27 import org.refal.plus.rfpdt.editor.RfpEditor; 27 28 import org.refal.plus.rfpdt.launch.IRfpLaunchConfigurationConstants; … … 57 58 } 58 59 59 static void createConfiguration (ILaunchConfigurationWorkingCopy config) {60 public static void createConfiguration (ILaunchConfigurationWorkingCopy config) { 60 61 createConfiguration(config, getResource()); 61 62 } … … 81 82 private static String getWorkingDirectory (IFile module) { 82 83 return module.getParent().getFullPath().makeRelative().toString(); 83 }84 85 private static String getModuleName (IFile module) {86 return module.getProjectRelativePath().removeFileExtension().toString().replace('/', '.');87 84 } 88 85 … … 100 97 for (ILaunchConfiguration config : configs) 101 98 if (config.getAttribute(IRfpLaunchConfigurationConstants.ATTR_MODULE_NAME, "").equals( 102 getModuleName(module))99 RfpBuilder.getModuleName(module)) 103 100 && config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "").equals( 104 101 getWorkingDirectory(module))) … … 189 186 if (module != null) { 190 187 config.setAttribute(IRfpLaunchConfigurationConstants.ATTR_PROJECT_NAME, module.getProject().getName()); 191 config.setAttribute(IRfpLaunchConfigurationConstants.ATTR_MODULE_NAME, getModuleName(module));188 config.setAttribute(IRfpLaunchConfigurationConstants.ATTR_MODULE_NAME, RfpBuilder.getModuleName(module)); 192 189 config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, getWorkingDirectory(module)); 193 190 }
Note: See TracChangeset
for help on using the changeset viewer.