List of usage examples for org.eclipse.jdt.internal.core CompilationUnit getPrimary
@Override
public ICompilationUnit getPrimary()
From source file:com.github.parzonka.ccms.engine.SortElementsOperation.java
License:Open Source License
/** * @see org.eclipse.jdt.internal.core.JavaModelOperation#executeOperation() *//*from w w w . j a va 2 s . c o m*/ @Override protected void executeOperation() throws JavaModelException { try { beginTask(Messages.operation_sortelements, getMainAmountOfWork()); final CompilationUnit copy = (CompilationUnit) this.elementsToProcess[0]; final ICompilationUnit unit = copy.getPrimary(); final IBuffer buffer = copy.getBuffer(); if (buffer == null) { return; } final char[] bufferContents = buffer.getCharacters(); final String result = processElement(unit, bufferContents); if (!CharOperation.equals(result.toCharArray(), bufferContents)) { copy.getBuffer().setContents(result); } worked(1); } finally { done(); } }