Java Code Examples for org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getFileName()
The following examples show how to use
org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getFileName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Main.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void startLoggingSource(CompilationResult compilationResult) { if ((this.tagBits & Logger.XML) != 0) { ICompilationUnit compilationUnit = compilationResult.compilationUnit; if (compilationUnit != null) { char[] fileName = compilationUnit.getFileName(); File f = new File(new String(fileName)); if (fileName != null) { this.parameters.put(Logger.PATH, f.getAbsolutePath()); } char[][] packageName = compilationResult.packageName; if (packageName != null) { this.parameters.put( Logger.PACKAGE, new String(CharOperation.concatWith(packageName, File.separatorChar))); } CompilationUnit unit = (CompilationUnit) compilationUnit; String destinationPath = unit.destinationPath; if (destinationPath == null) { destinationPath = this.main.destinationPath; } if (destinationPath != null && destinationPath != NONE) { if (File.separatorChar == '/') { this.parameters.put(Logger.OUTPUT, destinationPath); } else { this.parameters.put(Logger.OUTPUT, destinationPath.replace('/', File.separatorChar)); } } } printTag(Logger.SOURCE, this.parameters, true, false); } }
Example 2
Source File: Main.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public String extractDestinationPathFromSourceFile(CompilationResult result) { ICompilationUnit compilationUnit = result.compilationUnit; if (compilationUnit != null) { char[] fileName = compilationUnit.getFileName(); int lastIndex = CharOperation.lastIndexOf(java.io.File.separatorChar, fileName); if (lastIndex != -1) { final String outputPathName = new String(fileName, 0, lastIndex); final File output = new File(outputPathName); if (output.exists() && output.isDirectory()) { return outputPathName; } } } return System.getProperty("user.dir"); //$NON-NLS-1$ }
Example 3
Source File: CompilationResult.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public CompilationResult(ICompilationUnit compilationUnit, int unitIndex, int totalUnitsKnown, int maxProblemPerUnit){ this.fileName = compilationUnit.getFileName(); this.compilationUnit = compilationUnit; this.unitIndex = unitIndex; this.totalUnitsKnown = totalUnitsKnown; this.maxProblemPerUnit = maxProblemPerUnit; }