Author: vrubezhny
Date: 2011-02-25 17:44:11 -0500 (Fri, 25 Feb 2011)
New Revision: 29367
Added:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPIncludeContentDescriber.java
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
Log:
JBIDE-8049
*.inc content type JSP clash with PDT
Issue is fixed. Fixed for 3.2.1
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
===================================================================
---
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2011-02-25
22:29:48 UTC (rev 29366)
+++
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2011-02-25
22:44:11 UTC (rev 29367)
@@ -21,3 +21,4 @@
vpe.toolbar.name=VPE Toolbar
+ContentType_JBossToolsINC=JBoss Tools JSP Include
\ No newline at end of file
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2011-02-25
22:29:48 UTC (rev 29366)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2011-02-25
22:44:11 UTC (rev 29367)
@@ -194,7 +194,7 @@
contributorClass="org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageContributor"
id="org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"
matchingStrategy =
"org.jboss.tools.common.core.resources.MatchingStrategyImpl"
- extensions="jsp, jspf, jspx, tag, tagf, inc">
+ extensions="jsp, jspf, jspx, tag, tagf">
<contentTypeBinding
contentTypeId="org.eclipse.jst.jsp.core.jspsource"/>
</editor>
<editor
@@ -538,13 +538,23 @@
</extension>
<extension
point="org.eclipse.core.runtime.contentTypes">
- <file-association
+ <!--file-association
content-type="org.eclipse.jst.jsp.core.jspsource"
- file-extensions="inc"/>
+ file-extensions="inc"/ -->
<file-association
content-type="org.eclipse.wst.html.core.htmlsource"
file-extensions="jsf"/>
</extension>
+
+ <extension point="org.eclipse.core.contenttype.contentTypes">
+ <content-type id="org.eclipse.jst.jsp.core.jspsource"
+ name="%ContentType_JBossToolsINC"
+ base-type="org.eclipse.core.runtime.text"
+
describer="org.jboss.tools.jst.jsp.jspeditor.JSPIncludeContentDescriber"
+ file-extensions="inc"
+ priority="normal"
+ />
+ </extension>
<extension
point="org.jboss.tools.common.model.resourceMapping">
Added:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPIncludeContentDescriber.java
===================================================================
---
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPIncludeContentDescriber.java
(rev 0)
+++
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPIncludeContentDescriber.java 2011-02-25
22:44:11 UTC (rev 29367)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.jsp.jspeditor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import org.eclipse.core.internal.content.TextContentDescriber;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.ITextContentDescriber;
+
+/**
+ * Content decriber class that helps Eclipse to detect if the *.inc file has jsp content
inside.
+ *
+ * @author Victor Rubezhny
+ *
+ */
+@SuppressWarnings("restriction")
+public class JSPIncludeContentDescriber extends TextContentDescriber implements
ITextContentDescriber {
+
+ public int describe(InputStream input, IContentDescription description) throws
IOException {
+ InputStreamReader reader = new InputStreamReader(input);
+ try {
+ return (containsJspElements(reader) ?
+ VALID :
+ INVALID);
+ } finally {
+ reader.close();
+ }
+ }
+
+ public int describe(Reader contents, IContentDescription description) throws IOException
{
+ return (containsJspElements(contents) ?
+ VALID :
+ INVALID);
+ }
+
+ private boolean containsJspElements(Reader contents) {
+ try {
+ int c = contents.read();
+ while (c != -1) {
+ if (c == '<') { // JSP Code/Tag/Directive Opener check
+ if ((c = contents.read()) == -1)
+ return false;
+ if (c == '%') { // JSP Code/Directive opened
+ return true;
+ }
+ if (c == 'j') { // JSP Tag opener check
+ if ((c = contents.read()) == -1)
+ return false;
+ if (c != 's')
+ continue;
+ if ((c = contents.read()) == -1)
+ return false;
+ if (c != 'p')
+ continue;
+ if ((c = contents.read()) == -1)
+ return false;
+ if (c != ':')
+ continue;
+
+ // Find the tag close
+ while ((c = contents.read()) != -1) {
+ if (c == '>') {
+ return true;
+ }
+ }
+ continue;
+ }
+ }
+ c = contents.read();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ // Ignore
+ }
+ return false;
+ }
+}
Property changes on:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPIncludeContentDescriber.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
===================================================================
---
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java 2011-02-25
22:29:48 UTC (rev 29366)
+++
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java 2011-02-25
22:44:11 UTC (rev 29367)
@@ -488,7 +488,13 @@
private void addNodeListenerTo(Node node) {
if (node instanceof INodeNotifier) {
INodeNotifier notifier = (INodeNotifier) node;
- if (notifier.getExistingAdapter(this) == null) {
+
+ /* yradtsevich:
+ * checking for notifier.getExistingAdapter(this) == null
+ * is not used because of JBIDE-8049 (JBIDE-8051)
+ * (PDT implementation of getExistingAdapter(Object type) works
+ * incorrectly with non Class parameters) */
+ if (!nodeNotifiers.contains(notifier)) {
notifier.addAdapter(nodeListener);
nodeNotifiers.add(notifier);
}
Modified:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
===================================================================
---
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2011-02-25
22:29:48 UTC (rev 29366)
+++
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2011-02-25
22:44:11 UTC (rev 29367)
@@ -47,7 +47,14 @@
domMapping.mapNodes(nodeMapping);
Node sourceNode = nodeMapping.getSourceNode();
- if (((INodeNotifier) sourceNode).getExistingAdapter(sorceAdapter) == null) {
+
+
+ /* yradtsevich:
+ * checking for ((INodeNotifier) sourceNode).getExistingAdapter(sorceAdapter) == null
+ * is not used because of JBIDE-8049 (JBIDE-8051)
+ * (PDT implementation of getExistingAdapter(Object type) works
+ * incorrectly with non Class parameters) */
+ if (!sourceNodes.contains(sourceNode)) {
((INodeNotifier) sourceNode).addAdapter(sorceAdapter);
sourceNodes.add(sourceNode);
}