Author: scabanovich
Date: 2012-02-01 19:52:32 -0500 (Wed, 01 Feb 2012)
New Revision: 38384
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/ProjectValidationContextFactory.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
Log:
JBIDE-10739
https://issues.jboss.org/browse/JBIDE-10739
Web content of project may be its root location, avoid request
project.getFolder("/"), it results in illegal argument exception.
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs 2012-02-02
00:52:32 UTC (rev 38384)
@@ -0,0 +1,8 @@
+#Fri Sep 30 12:13:50 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2012-02-02 00:24:18 UTC (rev
38383)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2012-02-02 00:52:32 UTC (rev
38384)
@@ -333,4 +333,10 @@
nature="org.eclipse.jdt.core.javanature">
</queryParticipant>
</extension>
+
+ <extension point="org.jboss.tools.common.model.classes">
+ <xclass
id="org.jboss.tools.jst.web.kb.internal.ProjectValidationContextFactory"
+ class="org.jboss.tools.jst.web.kb.internal.ProjectValidationContextFactory"/>
+ </extension>
+
</plugin>
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2012-02-02
00:24:18 UTC (rev 38383)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2012-02-02
00:52:32 UTC (rev 38384)
@@ -79,13 +79,7 @@
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.GlobalELReferenceList;
-import org.jboss.tools.common.el.core.model.ELExpression;
-import org.jboss.tools.common.el.core.model.ELInstance;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELModel;
-import org.jboss.tools.common.el.core.parser.ELParser;
import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.el.core.parser.SyntaxError;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
@@ -1005,7 +999,7 @@
IPath relativePath = Utils.getRelativePath(webRootPath,
basePath);
IPath filePath = relativePath.append(path);
- member = project.getFolder(sourcePath).getFile(filePath);
+ member = project.getFile(sourcePath.append(filePath));
if (member.exists()) {
return member;
}
@@ -1015,7 +1009,7 @@
webRootPath = projectPath.append(runtimePath);
relativePath = Utils.getRelativePath(webRootPath, basePath);
filePath = relativePath.append(path);
- member = project.getFolder(runtimePath).getFile(filePath);
+ member = project.getFile(runtimePath.append(filePath));
if (member.exists()) {
return member;
}
@@ -1038,14 +1032,14 @@
IPath sourcePath = resources[i].getSourcePath();
// Look in source environment
- member = project.getFolder(sourcePath).getFile(path);
+ member = project.getFile(sourcePath.append(path));
if(member.exists()) {
return member;
}
// Look in runtime environment
if (runtimePath.segmentCount() >= ICoreConstants.MINIMUM_FOLDER_SEGMENT_LENGTH - 1)
{
- member = project.getFolder(runtimePath).getFile(path);
+ member = project.getFile(runtimePath.append(path));
if (member.exists()) {
return member;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2012-02-02
00:24:18 UTC (rev 38383)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2012-02-02
00:52:32 UTC (rev 38384)
@@ -261,8 +261,15 @@
Map<String, IAttribute> map = new HashMap<String, IAttribute>();
for (IAttribute a: as) {
String n = a.getName();
- if(map.containsKey(n) && !(a instanceof CustomTagLibAttribute)) {
- continue;
+ if(map.containsKey(n)) {
+ IAttribute o = map.get(n);
+ int pa = (a.isPreferable() || a.isRequired()) ? 2 : 0;
+ int po = (o.isPreferable() || o.isRequired()) ? 2 : 0;
+ pa += (a instanceof CustomTagLibAttribute) ? 1 : 0;
+ po += (o instanceof CustomTagLibAttribute) ? 1 : 0;
+ if(pa <= po) {
+ continue;
+ }
}
map.put(n, a);
}
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/ProjectValidationContextFactory.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/ProjectValidationContextFactory.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/ProjectValidationContextFactory.java 2012-02-02
00:52:32 UTC (rev 38384)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.IProjectValidationContextFactory;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+
+public class ProjectValidationContextFactory implements IProjectValidationContextFactory
{
+
+ public IProjectValidationContext getContext(IProject project) {
+ IKbProject kb = KbProjectFactory.getKbProject(project, true);
+ return kb == null ? null : kb.getValidationContext();
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/ProjectValidationContextFactory.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain