Author: mareshkau
Date: 2010-04-20 10:04:37 -0400 (Tue, 20 Apr 2010)
New Revision: 21552
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5946 taglib page has been added to wizard
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java 2010-04-20
13:39:34 UTC (rev 21551)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java 2010-04-20
14:04:37 UTC (rev 21552)
@@ -14,7 +14,6 @@
import java.util.Properties;
import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.common.meta.action.XAttributeData;
@@ -52,9 +51,9 @@
attributes = null;
}
- public void setWizard(IWizard wizard) {
+ public void setWizard(DefaultStandardWizard wizard) {
super.setWizard(wizard);
- this.wizard = (DefaultStandardWizard)wizard;
+ this.wizard = wizard;
}
public void createControl(Composite parent) {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java 2010-04-20
13:39:34 UTC (rev 21551)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java 2010-04-20
14:04:37 UTC (rev 21552)
@@ -12,6 +12,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.OutputStreamWriter;
import org.eclipse.core.resources.IFile;
@@ -22,6 +23,7 @@
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
@@ -31,8 +33,15 @@
import org.eclipse.wst.html.ui.internal.wizard.NewHTMLWizard;
import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
import org.eclipse.wst.sse.core.utils.StringUtils;
+import org.jboss.tools.common.meta.action.XEntityData;
+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.NewXHTMLFileWizard;
+import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardStep;
import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
+import org.jboss.tools.jst.web.model.handlers.CreateJSPFileSupport;
/**
* @author mareshkau
@@ -45,6 +54,8 @@
private WizardNewFileCreationPage fNewFilePage;
private NewXHTMLTemplatesWizardPage fNewFileTemplatesPage;
+ private NewXHTMLFileWizard newXHTMLFileWizard;
+ private NewXHTMLWizardSelectTagLibrariesPage newXHTMLWizardSelectTagLibrariesPage;
@@ -58,11 +69,15 @@
this.fNewFileTemplatesPage = new NewXHTMLTemplatesWizardPage();
addPage(this.fNewFileTemplatesPage);
+ this.newXHTMLWizardSelectTagLibrariesPage = getURISelectionPage();
+ addPage(this.newXHTMLWizardSelectTagLibrariesPage);
}
@Override
public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
super.init(aWorkbench, aSelection);
setWindowTitle(JsfUIMessages.UI_WIZARD_XHTML_NEW_TITLE);
+ setNewXHTMLFileWizard(new NewXHTMLFileWizard());
+ getNewXHTMLFileWizard().init(aWorkbench, aSelection);
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
@@ -73,6 +88,17 @@
super.addPage(page);
}
}
+ private NewXHTMLWizardSelectTagLibrariesPage getURISelectionPage() {
+ SpecialWizardSupport support = getNewXHTMLFileWizard().getFileContext().getSupport();
+ NewXHTMLWizardSelectTagLibrariesPage step = new
NewXHTMLWizardSelectTagLibrariesPage(support, 1);
+ try {
+ support.action(SpecialWizardSupport.NEXT);
+ } catch (XModelException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ step.setWizard(this);
+ return step;
+ }
@Override
public boolean performFinish() {
boolean performedOK = false;
@@ -94,6 +120,11 @@
if (file != null) {
// put template contents into file
String templateString = fNewFileTemplatesPage.getTemplateString();
+ try {
+ templateString=((CreateJSPFileSupport)getNewXHTMLFileWizard().getFileContext().getSupport()).addTaglibs(templateString);
+ } catch (IOException ex) {
+ JsfUiPlugin.getDefault().logWarning("Problems with adding taglibs",ex);
//$NON-NLS-1$
+ }
if (templateString != null) {
templateString = applyLineDelimiter(file, templateString);
// determine the encoding for the new file
@@ -152,4 +183,18 @@
});
}
}
+ /**
+ * @return the newXHTMLFileWizard
+ */
+ private NewXHTMLFileWizard getNewXHTMLFileWizard() {
+ return newXHTMLFileWizard;
+ }
+ /**
+ * @param newXHTMLFileWizard the newXHTMLFileWizard to set
+ */
+ private void setNewXHTMLFileWizard(NewXHTMLFileWizard newXHTMLFileWizard) {
+ this.newXHTMLFileWizard = newXHTMLFileWizard;
+ }
+
+
}
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-04-20
13:39:34 UTC (rev 21551)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2010-04-20
14:04:37 UTC (rev 21552)
@@ -201,6 +201,13 @@
String[] selected = toArray(ts);
return taglibs.modifyBody(body, selected);
}
+ /**
+ * Added by Maksim Areshkau, method accessor for tmodifyBody()
+ * @param content
+ */
+ public String addTaglibs(String content) throws IOException{
+ return modifyBody(content);
+ }
String[] toArray(String s) {
if(s == null || s.length() == 0) return new String[0];
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java 2010-04-20
13:39:34 UTC (rev 21551)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java 2010-04-20
14:04:37 UTC (rev 21552)
@@ -46,6 +46,7 @@
this.bot.textWithLabel("File name:").setText("test"); //$NON-NLS-1$
//$NON-NLS-2$
this.bot.button(WidgetVariables.NEXT_BUTTON).click();
this.bot.checkBox("Use XHTML Template").click(); //$NON-NLS-1$
+ this.bot.button(WidgetVariables.NEXT_BUTTON).click();
this.bot.button(WidgetVariables.FINISH_BUTTON).click();
assertEquals("Active Editor Title should be" ,"test.xhtml",
this.bot.activeEditor().getTitle()); //$NON-NLS-1$ //$NON-NLS-2$
}