diff options
author | david_williams | 2005-02-09 23:42:12 +0000 |
---|---|---|
committer | david_williams | 2005-02-09 23:42:12 +0000 |
commit | e5a3701e14aaddcd7aaa17abe9a13a5f0f5ad546 (patch) | |
tree | 112c50a26f1b1688e6aaaacd49957755127a4492 /bundles/org.eclipse.wst.html.core | |
parent | 5839e8f9dfefcbc774b0932ffd57af208002c9ca (diff) | |
download | webtools.sourceediting-e5a3701e14aaddcd7aaa17abe9a13a5f0f5ad546.tar.gz webtools.sourceediting-e5a3701e14aaddcd7aaa17abe9a13a5f0f5ad546.tar.xz webtools.sourceediting-e5a3701e14aaddcd7aaa17abe9a13a5f0f5ad546.zip |
simple cleanup of unit tests and logged exceptions
Diffstat (limited to 'bundles/org.eclipse.wst.html.core')
2 files changed, 27 insertions, 23 deletions
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java index ca6de3109a..1b112c286e 100644 --- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java +++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java @@ -96,13 +96,7 @@ public class HTMLDocumentTypeAdapter extends DocumentTypeAdapterImpl implements XMLModel model = document.getModel(); if (model == null) return; // error - if (model.isReinitializationNeeded()) { - // we're may be looping. Even if not, - // if we're going to be reinitialized, - // no need to worry about document type - // this pass. - return; - } + IFile file = getFile(model); // find DOCTYPE delcaration and Public ID @@ -241,14 +235,17 @@ public class HTMLDocumentTypeAdapter extends DocumentTypeAdapterImpl implements } return publicId; } - + private IFile getFile(IStructuredModel model) { + IFile result = null; String location = model.getBaseLocation(); - IPath path = new Path(location); - if (!path.toFile().exists() && path.segmentCount() > 1) { - return ResourcesPlugin.getWorkspace().getRoot().getFile(path); + if (location != null) { + IPath path = new Path(location); + if (!path.toFile().exists() && path.segmentCount() > 1) { + result = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + } } - return null; + return result; } /** diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java index dbb4a3768a..994e939b1f 100644 --- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java +++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java @@ -49,8 +49,11 @@ public class ModelQueryAdapterFactoryForHTML extends AbstractAdapterFactory impl /** * ModelQueryAdapterFactoryForHTML constructor comment. - * @param adapterKey java.lang.Object - * @param registerAdapters boolean + * + * @param adapterKey + * java.lang.Object + * @param registerAdapters + * boolean */ public ModelQueryAdapterFactoryForHTML(Object adapterKey, boolean registerAdapters) { super(adapterKey, registerAdapters); @@ -69,12 +72,14 @@ public class ModelQueryAdapterFactoryForHTML extends AbstractAdapterFactory impl IStructuredModel model = stateNotifier = xmlNode.getModel(); stateNotifier.addModelStateListener(this); String baseLocation = null; - File file = new Path(model.getBaseLocation()).toFile(); - if(file.exists()) { - baseLocation = file.getAbsolutePath(); - } - else { - baseLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(model.getBaseLocation()).toString(); + String modelsBaseLocation = model.getBaseLocation(); + if (modelsBaseLocation != null) { + File file = new Path(modelsBaseLocation).toFile(); + if (file.exists()) { + baseLocation = file.getAbsolutePath(); + } else { + baseLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(modelsBaseLocation).toString(); + } } if (Debug.displayInfo) System.out.println("----------------ModelQueryAdapterFactoryForHTML... baseLocation : " + baseLocation); //$NON-NLS-1$ @@ -92,7 +97,7 @@ public class ModelQueryAdapterFactoryForHTML extends AbstractAdapterFactory impl protected void updateResolver(IStructuredModel model) { String baseLocation = model.getBaseLocation(); IFile baseFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(model.getBaseLocation())); - if(baseFile != null) { + if (baseFile != null) { baseLocation = baseFile.getLocation().toString(); } modelQueryAdapterImpl.setIdResolver(new XMLCatalogIdResolver(baseLocation, model.getResolver())); @@ -111,7 +116,8 @@ public class ModelQueryAdapterFactoryForHTML extends AbstractAdapterFactory impl } /** - * @see IModelStateListener#modelDirtyStateChanged(IStructuredModel, boolean) + * @see IModelStateListener#modelDirtyStateChanged(IStructuredModel, + * boolean) */ public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty) { } @@ -123,7 +129,8 @@ public class ModelQueryAdapterFactoryForHTML extends AbstractAdapterFactory impl } /** - * @see IModelStateListener#modelResourceMoved(IStructuredModel, IStructuredModel) + * @see IModelStateListener#modelResourceMoved(IStructuredModel, + * IStructuredModel) */ public void modelResourceMoved(IStructuredModel oldModel, IStructuredModel newModel) { stateNotifier.removeModelStateListener(this); |