Commit c133c090 authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files


refs 862
parent 97d3c606
......@@ -55,13 +55,11 @@ import org.fortiss.tooling.kernel.model.INamedElement;
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash: 808FF0487ECD7D3ED822E61D6BF846F5
* @ConQAT.Rating GREEN Hash: 20530134FF909B6F61170212FBE6C120
public abstract class ToolRunnerBase<S extends INamedElement, T> implements IToolRunner<T> {
// TODO(AW) review: this flag seems to be overwhelmingly used, is there maybe a cleaner
// solution?
/** Whether the tool should be debugged. */
/** Whether the tool should be debugged. If DEBUG == true, then generated files are not deleted. */
public static boolean DEBUG = false;
/** The logical file on which the tool will be run. */
......@@ -76,20 +74,13 @@ public abstract class ToolRunnerBase<S extends INamedElement, T> implements IToo
/** Returns the shell command that runs the tool. */
protected abstract String getToolCommand();
* Generates the physical file.
/** Generates the physical file. */
protected File generatePhysicalFile(ITextGenerator<S> textGen, String fileExtension)
throws IOException, UnknownLanguageFragmentException {
IPath location = plugin.getStateLocation();
Random randomGenerator = new Random();
// TODO(AW) review: Shall this regex remove only the trailing non-alphanumeric character
// or all non-alphanumeric characters? Isn't it possible, that ambiguities
// occur, when information-bearing characters are just skipped? I mean, are
// random numbers really safe? I don't know the complete context, so I may be
// Completely wrong ;)
String patchedPhysicalFileName = logicalFile.getName().replaceAll("[^A-Za-z0-9]", "");
File physicalFile =
new File(location.toFile(), patchedPhysicalFileName + randomGenerator.nextLong() +
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment