[jbosstools-commits] JBoss Tools SVN: r23767 - in trunk/jst/plugins: org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jul 28 05:06:33 EDT 2010


Author: dvinnichek
Date: 2010-07-28 05:06:32 -0400 (Wed, 28 Jul 2010)
New Revision: 23767

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java
   trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java
   trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
Log:
fix https://jira.jboss.org/browse/JBIDE-6709 Page created using JSF Composite Component has wrong content.

Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java	2010-07-28 08:43:01 UTC (rev 23766)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java	2010-07-28 09:06:32 UTC (rev 23767)
@@ -182,7 +182,11 @@
 			return;
 		}
 		String body = getTemplateBody();
-		Set<String> existing = taglibs.getTaglibsFromTemplate(body);
+		setTaglibsFromTemplateBody(body);
+	}
+	
+	public void setTaglibsFromTemplateBody(String templateBody) {
+		Set<String> existing = taglibs.getTaglibsFromTemplate(templateBody);
 		StringBuffer sb = new StringBuffer();
 		Iterator<String> it = existing.iterator();
 		while(it.hasNext()) {
@@ -190,9 +194,10 @@
 			if(sb.length() > 0) sb.append(";"); //$NON-NLS-1$
 			sb.append(taglibs.getTaglibDescription(s));
 		}
-		value = sb.toString();
-		setAttributeValue(1, "taglibs", value); //$NON-NLS-1$
+		setAttributeValue(1, "taglibs", sb.toString()); //$NON-NLS-1$
 	}
+	
+	public void asd(String ast) {}
 
 	protected String modifyBody(String body) throws IOException {
 		if(getEntityData().length < 2 || taglibs == null) return body;

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java	2010-07-28 08:43:01 UTC (rev 23766)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java	2010-07-28 09:06:32 UTC (rev 23767)
@@ -63,6 +63,7 @@
 import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
 import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
 import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
+import org.jboss.tools.jst.web.model.handlers.CreateJSPFileSupport;
 import org.jboss.tools.jst.web.ui.Messages;
 import org.jboss.tools.jst.web.ui.WebUiPlugin;
 import org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
@@ -146,9 +147,12 @@
 	private TemplateStore fTemplateStore;
 	/** Checkbox for using templates. */
 	private Button fUseTemplateButton;
+	
+	private CreateJSPFileSupport fJspFileSupport;
 
-	public NewXHTMLTemplatesWizardPage() {
+	public NewXHTMLTemplatesWizardPage(CreateJSPFileSupport jspFileSupport) {
 		super("NewXHTMLTemplatesWizardPage", Messages.NewXHTMLTemplatesWizardPage_0, null); //$NON-NLS-1$
+		this.fJspFileSupport = jspFileSupport;
 		setDescription(Messages.NewXHTMLTemplatesWizardPage_0);
 	}
 
@@ -501,12 +505,12 @@
 	 * Updates the pattern viewer.
 	 */
 	void updateViewerInput() {
+		String pattern = ""; //$NON-NLS-1$
 		Template template = getSelectedTemplate();
 		if (template != null) {
-			fPatternViewer.getDocument().set(template.getPattern());
+			pattern = template.getPattern();
+			fJspFileSupport.setTaglibsFromTemplateBody(pattern);
 		}
-		else {
-			fPatternViewer.getDocument().set(""); //$NON-NLS-1$
-		}
+		fPatternViewer.getDocument().set(pattern);
 	}
 }

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java	2010-07-28 08:43:01 UTC (rev 23766)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java	2010-07-28 09:06:32 UTC (rev 23767)
@@ -35,6 +35,7 @@
 import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
 import org.jboss.tools.common.model.XModelException;
 import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.wizard.newfile.NewFileContextEx;
 import org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard;
 import org.jboss.tools.jst.web.model.handlers.CreateJSPFileSupport;
 import org.jboss.tools.jst.web.ui.Messages;
@@ -64,7 +65,10 @@
 		this.fNewFilePage.setTitle(Messages.UI_WIZARD_XHTML_NEW_TITLE);
 		this.fNewFilePage.setDescription(Messages.UI_WIZARD_XHTML_NEW_Description);
 		
-		this.fNewFileTemplatesPage = new NewXHTMLTemplatesWizardPage();
+		NewFileContextEx newFileContext = newXHTMLFileWizard.getFileContext();
+		CreateJSPFileSupport jspFileSupport = (CreateJSPFileSupport)newFileContext.getSupport();		
+		this.fNewFileTemplatesPage = new NewXHTMLTemplatesWizardPage(jspFileSupport);
+		
 		addPage(this.fNewFileTemplatesPage);
 		this.newXHTMLWizardSelectTagLibrariesPage = getURISelectionPage();
 		addPage(this.newXHTMLWizardSelectTagLibrariesPage);
@@ -118,7 +122,9 @@
 			// put template contents into file
 			String templateString = fNewFileTemplatesPage.getTemplateString();
 			try {
-				templateString=((CreateJSPFileSupport)getNewXHTMLFileWizard().getFileContext().getSupport()).addTaglibs(templateString);
+				NewFileContextEx newFileContext = newXHTMLFileWizard.getFileContext();
+				CreateJSPFileSupport jspFileSupport = (CreateJSPFileSupport)newFileContext.getSupport();
+				templateString = jspFileSupport.addTaglibs(templateString);
 			} catch (IOException ex) {
 				WebUiPlugin.getDefault().logWarning("Problems with adding taglibs",ex); //$NON-NLS-1$
 			}



More information about the jbosstools-commits mailing list