Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornitind2007-09-06 23:32:47 +0000
committernitind2007-09-06 23:32:47 +0000
commita3f57c5009286169b5c72fd60801336fa96fd8f3 (patch)
treeabcd83cea40065ae1841410be9424125e34e414e /bundles/org.eclipse.jst.jsp.core/src/org
parent2943d643c8eb4fc551e6c8702cf6d82aa2f1a6aa (diff)
downloadwebtools.sourceediting-a3f57c5009286169b5c72fd60801336fa96fd8f3.tar.gz
webtools.sourceediting-a3f57c5009286169b5c72fd60801336fa96fd8f3.tar.xz
webtools.sourceediting-a3f57c5009286169b5c72fd60801336fa96fd8f3.zip
[196020] IllegalArgumentException rebuilding project
Diffstat (limited to 'bundles/org.eclipse.jst.jsp.core/src/org')
-rw-r--r--bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java49
-rw-r--r--bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java5
-rw-r--r--bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java4
-rw-r--r--bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchSupport.java2
-rw-r--r--bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/modelquery/ModelQueryAdapterFactoryForJSP.java65
5 files changed, 57 insertions, 68 deletions
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java
index 526fbbab0b..efcaf81ad3 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java
@@ -71,7 +71,6 @@ import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.core.internal.util.URIResolver;
import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
@@ -1932,40 +1931,28 @@ public class JSPTranslator {
protected void handleIncludeFile(String filename) {
if (filename != null && fProcessIncludes) {
- IPath basePath = new Path(getBaseLocation());
- IPath localRoot = TaglibIndex.getContextRoot(basePath);
- String uri = StringUtils.strip(filename);
- String filePath = null;
- if(uri.startsWith(Path.ROOT.toString())) {
- filePath = localRoot.append(uri).toString();
- }
- else {
- filePath = basePath.removeLastSegments(1).append(uri).toString();
- }
-
- if (!getIncludes().contains(filePath) && getBaseLocation() != null && !filePath.equals(getBaseLocation())) {
- getIncludes().push(filePath);
- JSPIncludeRegionHelper helper = new JSPIncludeRegionHelper(this);
- helper.parse(filePath);
- getIncludes().pop();
+ IPath basePath = getModelPath();
+ if(basePath != null) {
+ IPath localRoot = TaglibIndex.getContextRoot(basePath);
+ String uri = StringUtils.strip(filename);
+ String filePath = null;
+ if(uri.startsWith(Path.ROOT.toString())) {
+ filePath = localRoot.append(uri).toString();
+ }
+ else {
+ filePath = basePath.removeLastSegments(1).append(uri).toString();
+ }
+
+ if (!getIncludes().contains(filePath) && !filePath.equals(basePath.toString())) {
+ getIncludes().push(filePath);
+ JSPIncludeRegionHelper helper = new JSPIncludeRegionHelper(this);
+ helper.parse(filePath);
+ getIncludes().pop();
+ }
}
}
}
- private URIResolver getResolver() {
- return (fStructuredModel != null) ? fStructuredModel.getResolver() : null;
- }
-
- /**
- *
- * @return java.lang.String
- */
- private String getBaseLocation() {
- if (getResolver() == null)
- return null;
- return getResolver().getFileBaseLocation();
- }
-
private Stack getIncludes() {
if (fIncludes == null)
fIncludes = new Stack();
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java
index abe91146df..2276bf98ad 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java
@@ -24,6 +24,7 @@ import org.eclipse.jst.jsp.core.internal.util.FileContentCache;
import org.eclipse.wst.sse.core.internal.document.StructuredDocumentFactory;
import org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker;
import org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionHandler;
+import org.eclipse.wst.sse.core.internal.ltk.parser.TagMarker;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
@@ -467,9 +468,9 @@ class XMLJSPRegionHelper implements StructuredDocumentRegionHandler {
return false;
}
if (prefix.length() > 0) {
- Object[] prefixes = fLocalParser.getNestablePrefixes().toArray();
+ TagMarker[] prefixes = (TagMarker[]) fLocalParser.getNestablePrefixes().toArray(new TagMarker[0]);
for (int i = 0; i < prefixes.length; i++) {
- if (prefix.equals(prefixes[i])) {
+ if (prefix.equals(prefixes[i].getTagName())) {
return true;
}
}
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java
index fa0ca87396..399d50a522 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java
@@ -178,7 +178,7 @@ public class JSPIndexManager {
private void deleteIndex(IFile folder) {
// cleanup index
- IndexManager im = JavaModelManager.getJavaModelManager().getIndexManager();
+ IndexManager im = JavaModelManager.getIndexManager();
IPath folderPath = folder.getFullPath();
IPath indexLocation = JSPSearchSupport.getInstance().computeIndexLocation(folderPath);
im.removeIndex(indexLocation);
@@ -505,7 +505,7 @@ public class JSPIndexManager {
// https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=5091
// makes sure IndexManager is aware of our indexes
void saveIndexes() {
- IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager();
+ IndexManager indexManager = JavaModelManager.getIndexManager();
IPath jspModelWorkingLocation = JSPSearchSupport.getInstance().getModelJspPluginWorkingLocation();
File folder = new File(jspModelWorkingLocation.toOSString());
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchSupport.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchSupport.java
index 1d8ac9f48c..398982ab0e 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchSupport.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchSupport.java
@@ -488,7 +488,7 @@ public class JSPSearchSupport {
// pa_TODO need to add to java path too, so JDT search support knows
// there should be a non internal way to do this.
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77564
- JavaModelManager.getJavaModelManager().getIndexManager().indexLocations.put(containerPath, indexLocation);
+ JavaModelManager.getIndexManager().indexLocations.put(containerPath, indexLocation);
//}
return indexLocation;
}
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/modelquery/ModelQueryAdapterFactoryForJSP.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/modelquery/ModelQueryAdapterFactoryForJSP.java
index efa71faaeb..ed902009fe 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/modelquery/ModelQueryAdapterFactoryForJSP.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/modelquery/ModelQueryAdapterFactoryForJSP.java
@@ -10,11 +10,8 @@
*******************************************************************************/
package org.eclipse.jst.jsp.core.internal.modelquery;
-import java.io.File;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
import org.eclipse.wst.sse.core.internal.provisional.AbstractAdapterFactory;
@@ -60,38 +57,34 @@ public class ModelQueryAdapterFactoryForJSP extends AbstractAdapterFactory imple
* createAdapter method comment.
*/
protected INodeAdapter createAdapter(INodeNotifier target) {
-
if (Debug.displayInfo)
System.out.println("-----------------------ModelQueryAdapterFactoryForJSP.createAdapter" + target); //$NON-NLS-1$
if (modelQueryAdapterImpl == null) {
if (target instanceof IDOMNode) {
IDOMNode xmlNode = (IDOMNode) target;
IStructuredModel model = stateNotifier = xmlNode.getModel();
- String baseLocation = model.getBaseLocation();
- // continue only if the location is known
- if (baseLocation != null) {
+ if (model.getBaseLocation() != null) {
stateNotifier.addModelStateListener(this);
- File file = new Path(model.getBaseLocation()).toFile();
- if (file.exists()) {
- baseLocation = file.getAbsolutePath();
- }
- else {
- IPath basePath = new Path(model.getBaseLocation());
- IPath derivedPath = null;
- if (basePath.segmentCount() > 1)
- derivedPath = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath).getLocation();
- else
- derivedPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(basePath);
- if (derivedPath != null) {
- baseLocation = derivedPath.toString();
- }
- }
- URIResolver resolver = new XMLCatalogIdResolver(baseLocation, model.getResolver());
-
- ModelQuery modelQuery = createModelQuery(model, resolver);
- modelQuery.setEditMode(ModelQuery.EDIT_MODE_UNCONSTRAINED);
- modelQueryAdapterImpl = new JSPModelQueryAdapterImpl(new CMDocumentCache(), modelQuery, resolver);
}
+
+ org.eclipse.wst.sse.core.internal.util.URIResolver resolver = model.getResolver();
+ if (Debug.displayInfo)
+ System.out.println("----------------ModelQueryAdapterFactoryForJSP... baseLocation : " + resolver.getFileBaseLocation()); //$NON-NLS-1$
+
+ /**
+ * XMLCatalogIdResolver currently requires a filesystem
+ * location string. Customarily this will be what is in the
+ * deprecated SSE URIResolver and required by the Common URI
+ * Resolver.
+ */
+ URIResolver idResolver = null;
+ if (resolver != null) {
+ idResolver = new XMLCatalogIdResolver(resolver.getFileBaseLocation(), resolver);
+ }
+
+ ModelQuery modelQuery = createModelQuery(model, idResolver);
+ modelQuery.setEditMode(ModelQuery.EDIT_MODE_UNCONSTRAINED);
+ modelQueryAdapterImpl = new JSPModelQueryAdapterImpl(new CMDocumentCache(), modelQuery, idResolver);
}
}
return modelQueryAdapterImpl;
@@ -152,14 +145,22 @@ public class ModelQueryAdapterFactoryForJSP extends AbstractAdapterFactory imple
protected void updateResolver(IStructuredModel model) {
String baseLocation = model.getBaseLocation();
- Path path = new Path(model.getBaseLocation());
- if (path.segmentCount() > 1) {
- IFile baseFile = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- if (baseFile.isAccessible()) {
+ IFile baseFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(model.getBaseLocation()));
+ if (baseFile != null) {
+ if (baseFile.getLocation() != null) {
baseLocation = baseFile.getLocation().toString();
- modelQueryAdapterImpl.setIdResolver(new XMLCatalogIdResolver(baseLocation, model.getResolver()));
}
+ if (baseLocation == null && baseFile.getLocationURI() != null) {
+ baseLocation = baseFile.getLocationURI().toString();
+ }
+ if (baseLocation == null) {
+ baseLocation = baseFile.getFullPath().toString();
+ }
+ }
+ else {
+ baseLocation = model.getBaseLocation();
}
+ modelQueryAdapterImpl.setIdResolver(new XMLCatalogIdResolver(baseLocation, model.getResolver()));
}
public void modelAboutToBeReinitialized(IStructuredModel structuredModel) {

Back to the top