List of usage examples for org.eclipse.jdt.internal.core.util Util getJavaLikeExtensions
public static char[][] getJavaLikeExtensions()
From source file:org.eclipse.jdt.internal.core.search.indexing.IndexManager.java
License:Open Source License
private boolean hasJavaLikeNamesChanged() { char[][] currentNames = Util.getJavaLikeExtensions(); int current = currentNames.length; char[][] prevNames = readJavaLikeNamesFile(); if (prevNames == null) { if (VERBOSE && current != 1) Util.verbose("No Java like names found and there is atleast one non-default javaLikeName", //$NON-NLS-1$ System.err);/*from ww w . j a v a 2s .c o m*/ return (current != 1); //Ignore if only java } int prev = prevNames.length; if (current != prev) { if (VERBOSE) Util.verbose("Java like names have changed", System.err); //$NON-NLS-1$ return true; } if (current > 1) { // Sort the current java like names. // Copy the array to avoid modifying the Util static variable System.arraycopy(currentNames, 0, currentNames = new char[current][], 0, current); Util.sort(currentNames); } // The JavaLikeNames would have been sorted before getting stored in the file, // hence just do a direct compare. for (int i = 0; i < current; i++) { if (!CharOperation.equals(currentNames[i], prevNames[i])) { if (VERBOSE) Util.verbose("Java like names have changed", System.err); //$NON-NLS-1$ return true; } } return false; }
From source file:org.eclipse.jdt.internal.core.search.indexing.IndexManager.java
License:Open Source License
private void writeJavaLikeNamesFile() { BufferedWriter writer = null; String pathName = getJavaPluginWorkingLocation().toOSString(); try {// w w w . ja v a2 s .co m char[][] currentNames = Util.getJavaLikeExtensions(); int length = currentNames.length; if (length > 1) { // Sort the current java like names. // Copy the array to avoid modifying the Util static variable System.arraycopy(currentNames, 0, currentNames = new char[length][], 0, length); Util.sort(currentNames); } File javaLikeNamesFile = new File(pathName, "javaLikeNames.txt"); //$NON-NLS-1$ writer = new BufferedWriter(new FileWriter(javaLikeNamesFile)); for (int i = 0; i < length - 1; i++) { writer.write(currentNames[i]); writer.write('\n'); } if (length > 0) writer.write(currentNames[length - 1]); } catch (IOException ignored) { if (VERBOSE) Util.verbose("Failed to write javaLikeNames file", System.err); //$NON-NLS-1$ } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { // ignore } } } }