use of org.python.pydev.shared_core.model.ErrorDescription in project Pydev by fabioz.
the class OrganizeImportsFixesUnused method beforePerformArrangeImports.
public boolean beforePerformArrangeImports(PySelection ps, PyEdit edit, IFile f) {
int oldSelection = ps.getRegion().getOffset();
IDocumentExtension4 doc = (IDocumentExtension4) ps.getDoc();
if (edit != null) {
if (!ensureParsed(edit)) {
return true;
}
// Check that the editor time is actually the same as the document time.
long docTime = doc.getModificationStamp();
if (docTime != edit.getAstModificationTimeStamp()) {
return true;
}
ErrorDescription errorDescription = edit.getErrorDescription();
if (errorDescription != null) {
// Don't remove unused imports if we have syntax errors.
return true;
}
}
try {
findAndDeleteUnusedImports(ps, edit, doc, f);
} catch (Exception e) {
Log.log(e);
}
ps.setSelection(oldSelection, oldSelection);
return true;
}
Aggregations