[Pydev-cvs] org.python.pydev.debug/src/org/python/pydev/debug/ui/launching AbstractLaunchShortcut.
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-04-12 19:09:43
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7211/src/org/python/pydev/debug/ui/launching Modified Files: AbstractLaunchShortcut.java Log Message: Launching: F9 will reuse an existing launch instead of creating a new one every time Index: AbstractLaunchShortcut.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/AbstractLaunchShortcut.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractLaunchShortcut.java 18 Mar 2008 17:03:01 -0000 1.15 --- AbstractLaunchShortcut.java 12 Apr 2008 19:09:38 -0000 1.16 *************** *** 183,190 **** try { ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type); ! String defaultLocation = getDefaultLocation(file); for (int i = 0; i < configs.length; i++) { String configPath = configs[i].getAttribute(Constants.ATTR_LOCATION, ""); ! if (defaultLocation.equals(configPath)) { validConfigs.add(configs[i]); } --- 183,194 ---- try { ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type); ! ! //let's see if we can find it with a location relative or not. ! String defaultLocation = getDefaultLocation(file, true); ! String defaultLocation2 = getDefaultLocation(file, false); ! for (int i = 0; i < configs.length; i++) { String configPath = configs[i].getAttribute(Constants.ATTR_LOCATION, ""); ! if (defaultLocation.equals(configPath) || defaultLocation2.equals(configPath)) { validConfigs.add(configs[i]); } *************** *** 200,204 **** * @return default string for the location field */ ! public static String getDefaultLocation(IResource[] file) { StringBuffer buffer = new StringBuffer(); --- 204,208 ---- * @return default string for the location field */ ! public static String getDefaultLocation(IResource[] file, boolean makeRelative) { StringBuffer buffer = new StringBuffer(); *************** *** 207,211 **** buffer.append("|"); } ! buffer.append(r.getRawLocation().toString()); } return buffer.toString(); --- 211,224 ---- buffer.append("|"); } ! ! String loc; ! ! if(makeRelative){ ! IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager(); ! loc = makeFileRelativeToWorkspace(file, varManager); ! }else{ ! loc = r.getRawLocation().toString(); ! } ! buffer.append(loc); } return buffer.toString(); *************** *** 222,226 **** IInterpreterManager pythonInterpreterManager = getInterpreterManager(); String projName = resource[0].getProject().getName(); ! return createDefaultLaunchConfiguration(resource, getLaunchConfigurationType(), getDefaultLocation(resource), pythonInterpreterManager, projName); } --- 235,239 ---- IInterpreterManager pythonInterpreterManager = getInterpreterManager(); String projName = resource[0].getProject().getName(); ! return createDefaultLaunchConfiguration(resource, getLaunchConfigurationType(), getDefaultLocation(resource, false), //it'll be made relative later on pythonInterpreterManager, projName); } *************** *** 280,285 **** // Build the location to a path relative to the workspace_loc ! moduleFile = resource[0].getFullPath().makeRelative().toString(); ! moduleFile = varManager.generateVariableExpression("workspace_loc", moduleFile); resourceType = resource[0].getType(); }else{ --- 293,297 ---- // Build the location to a path relative to the workspace_loc ! moduleFile = makeFileRelativeToWorkspace(resource, varManager); resourceType = resource[0].getType(); }else{ *************** *** 324,327 **** --- 336,346 ---- } + private static String makeFileRelativeToWorkspace(IResource[] resource, IStringVariableManager varManager) { + String moduleFile; + moduleFile = resource[0].getFullPath().makeRelative().toString(); + moduleFile = varManager.generateVariableExpression("workspace_loc", moduleFile); + return moduleFile; + } + /** * @return the interpreter manager associated with this shortcut (may be overridden if it is not python) |