Lines 57-62
Link Here
|
57 |
import org.openide.ErrorManager; |
57 |
import org.openide.ErrorManager; |
58 |
import java.text.Format; |
58 |
import java.text.Format; |
59 |
import java.text.MessageFormat; |
59 |
import java.text.MessageFormat; |
|
|
60 |
import org.openide.modules.InstalledFileLocator; |
60 |
|
61 |
|
61 |
/** Common utilities. |
62 |
/** Common utilities. |
62 |
* |
63 |
* |
Lines 292-303
Link Here
|
292 |
} |
293 |
} |
293 |
|
294 |
|
294 |
/**This finds script in some binaries storage directories. |
295 |
/**This finds script in some binaries storage directories. |
295 |
* Because there is no supported way in IDE to find |
296 |
* Currently uses modules/bin/ directories. |
296 |
* anything in IDE, this is "hope to work" only. |
|
|
297 |
* The method reads patterns from bundle. The keys |
298 |
* are in form findRunnableScript_{number}. The numbers |
299 |
* have to be continuous from 0. First break means |
300 |
* stop for reading patterns. |
301 |
* |
297 |
* |
302 |
* In fact, it is not possible to find out whether |
298 |
* In fact, it is not possible to find out whether |
303 |
* the script is executable (except executing it), |
299 |
* the script is executable (except executing it), |
Lines 310-340
Link Here
|
310 |
* |
306 |
* |
311 |
*/ |
307 |
*/ |
312 |
public static File findRunnableScript(String scriptName) { |
308 |
public static File findRunnableScript(String scriptName) { |
313 |
String formatBundleKeyPattern = "findRunnableScript_"; |
309 |
return InstalledFileLocator.getDefault().locate("modules/bin/" + scriptName, "org.netbeans.modules.cpplite.CPPSupport", false); // NOI18N |
314 |
int counter = 0; |
|
|
315 |
String[] patterns = new String[] { |
316 |
System.getProperty("netbeans.home"), |
317 |
System.getProperty("netbeans.user"), |
318 |
System.getProperty("user.home"), |
319 |
File.separator, |
320 |
}; |
321 |
|
322 |
while (true) { |
323 |
String key = formatBundleKeyPattern + counter++; |
324 |
String pattern = Utils.getLocalized(key); |
325 |
|
326 |
if (pattern == key) |
327 |
break; //XXX!! |
328 |
Format formatPattern = new MessageFormat(pattern); |
329 |
String directory = formatPattern.format(patterns); |
330 |
File script = new File(directory, scriptName); |
331 |
|
332 |
if (script.isFile()) { |
333 |
return script; |
334 |
} |
335 |
} |
336 |
|
337 |
return null; |
338 |
} |
310 |
} |
339 |
|
311 |
|
340 |
public static Object newInstance(Class clazz, Object[] params) throws NoSuchMethodException, |
312 |
public static Object newInstance(Class clazz, Object[] params) throws NoSuchMethodException, |