return useTab;
}
private boolean verifyValidity(IDocument document) {
if (fLastDocument != document) {
DOMModelForPHP editorModel = null;
try {
editorModel = (DOMModelForPHP) StructuredModelManager
.getModelManager().getExistingModelForRead(document);
// The PHPMergeViewer can be used outside Editor.
// E.g. the preview page.
// In those cases, the editroModel is null.
// Do the check and return in null case.
if (editorModel == null) {
return false;
}
String baseLocation = editorModel.getBaseLocation();
// The baseLocation may be a path on disk or relative to the
// workspace root. Don't translate on-disk paths to
// in-workspace resources.
IPath basePath = new Path(baseLocation);
IFile file = null;
if (basePath.segmentCount() > 1) {
file = ResourcesPlugin.getWorkspace().getRoot()
.getFile(basePath);
if (!file.exists()) {
file = null;
}
}
if (file == null) {
return false;
}
IProject project = file.getProject();
if (fLastProject != project) {
fLastProject = project;
verifyListening();
}
} finally {
if (editorModel != null)
editorModel.releaseFromRead();
}
}
if (fLastDocument != document || preferencesChanged) {
String useTab = preferencesSupport.getPreferencesValue(