forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r226792 - in /forrest/trunk/tools/eclipse/plugins/org.apache.forrest: ./ conf/ src/org/apache/forrest/eclipse/views/ src/org/apache/forrest/eclipse/wizards/
Date Mon, 01 Aug 2005 14:12:42 GMT
Author: rgardler
Date: Mon Aug  1 07:12:20 2005
New Revision: 226792

URL: http://svn.apache.org/viewcvs?rev=226792&view=rev
Log:
Add a page to the new project wizard that allows specification of some values in the skinconf.xml
- technique allows new XML config files to be easily configured in the same way (thanks to
Anil Ramnanan, fixes FOR-590)

Added:
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/conf/siteconfig.xml   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/SiteOptionsPage.java
  (with props)
Modified:
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/plugin.xml
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteXMLView.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewProjectWizard.java

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/conf/siteconfig.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/conf/siteconfig.xml?rev=226792&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/conf/siteconfig.xml (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/conf/siteconfig.xml Mon Aug  1
07:12:20 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<siteConfigDialog>
+  <!-- This is where you specify the configuration options for the New Project Wizard
 
+       For the configFile element, the location attribute points to the location 
+       of the configuration file to be edited.
+
+	   For the field element here ar te meanings of the attributes
+	   name = The name of the field attribute
+	   label = The label that will show up on the form in the wizard
+	   type = The type of control for this field. Currently supports only text and boolean
+	   required = specifies if this field is required
+	   tag = The XML tag in the configuration file that represents this configuration element
+	   description = The description of this configuration element. Shows up as a tooltip.
+	   default = The default value of this configuration element.
+	   
+  -->
+
+  <configFile location="src/documentation/skinconf.xml">
+  <field name="groupName" label ="Group Name" type="text" required="true" tag="group-name"
description="The name of the Group this site belongs to:" default="default"/>
+  <field name="projectName" label ="Project Name" type="text" required="true" tag="project-name"
description="The name of the Group this site belongs to:" default="default"/>
+  <field name="copyrightLink" label ="Copyright Link" type="text" required="true" tag="copyright-link"
description="Link to the copyright statement for this site" default="default"/>
+  <field name="vendor" label ="vendor" type="text" required="true" tag="vendor" description="The
name of the Vendor that produced this site" default="default"/>
+  <field name="year" label ="year" type="text" required="true" tag="year" description="Copyright
Year" default="default"/>
+  <field name="pdfLink" label ="Disable PDF Link" type="boolean" default="true" tag="disable-pdf-link"
description="Create a link to PDF pages" requiredPlugins="org.apache.forrest.plugin.output.PDF"/>
+  <field name="PODLink" label ="Disable POD Link" type="boolean" default="false" tag="disable-pod-link"
description="Create a link to POD pages" requiredPlugins="org.apache.forrest.plugin.output.POD"/>
+  <field name="PrintLink" label ="Disable Print Link" type="boolean" default="false" tag="disable-print-link"
description="Create a link to Print pages" requiredPlugins="org.apache.forrest.plugin.output.POD"/>
+  <field name="TextLink" label ="Disable Text Link" type="boolean" default="false" tag="disable-txt-link"
description="Create a link to Text pages:" requiredPlugins="org.apache.forrest.plugin.output.POD"/>
+  <field name="xmlLink" label ="Disable XML Link" type="boolean" default="false" tag="disable-xml-link"
description="The xml source link makes it possible to access the xml rendition of the source"
requiredPlugins="org.apache.forrest.plugin.output.POD"/>
+  </configFile>
+</siteConfigDialog>
\ No newline at end of file

Propchange: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/conf/siteconfig.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/plugin.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/plugin.xml?rev=226792&r1=226791&r2=226792&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/plugin.xml (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/plugin.xml Mon Aug  1 07:12:20
2005
@@ -45,6 +45,7 @@
       <import plugin="org.eclipse.debug.ui"/>
       <import plugin="org.eclipse.wst.internet.webbrowser"/>
       <import plugin="org.apache.forrest.eclipse.servletEngine"/>
+      <import plugin="org.eclipse.ui.views"/>
    </requires>
 
 

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteXMLView.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteXMLView.java?rev=226792&r1=226791&r2=226792&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteXMLView.java
(original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteXMLView.java
Mon Aug  1 07:12:20 2005
@@ -46,6 +46,8 @@
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheetPage;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -192,6 +194,17 @@
 		hookContextMenu();
 	}
 
+	  /* (non-Javadoc)
+     * Method declared on IAdaptable
+     */
+    public Object getAdapter(Class adapter) {
+       
+        if (adapter.equals(IPropertySheetPage.class)) {
+            return getPropertySheet();
+        }
+        return super.getAdapter(adapter);
+    }
+	
 	private void hookContextMenu() {
 		MenuManager menuMgr = new MenuManager("#PopupMenu");
 		menuMgr.setRemoveAllWhenShown(true);
@@ -281,5 +294,9 @@
 	protected String getFilename() {
 		return Utilities.getPathToXDocs() + java.io.File.separator + "site.xml";
 	}
+	
+	protected IPropertySheetPage getPropertySheet() {
+	        return new PropertySheetPage();
+	    }
 
 }

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java?rev=226792&r1=226791&r2=226792&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java
(original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java
Mon Aug  1 07:12:20 2005
@@ -37,6 +37,9 @@
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 
 
@@ -57,6 +60,7 @@
 	private IStructuredSelection selection ;
 	private Vector selectedPlugins;
 	
+	
 	/**
 	 * Create the new page.
 	 * @param selection 
@@ -126,13 +130,8 @@
 	    activateViewPosition.bottom =  new FormAttachment(59, 1000, 0);
 	    activateView.setLayoutData(activateViewPosition);
 	    activateView.setSelection(false);
-	   
-	   
-	   
 	    selectedPlugins = new Vector();
-	    
 	    availablePluginsListViewer = new ListViewer(container);
-	    
 	    availablePluginsListViewer.setContentProvider(new IStructuredContentProvider() {
 	        public Object[] getElements(Object inputElement) {
 	          Vector v = (Vector)inputElement;
@@ -231,7 +230,7 @@
 	    selectedPluginsListViewer.getControl().setLayoutData(selectedPluginsListViewerPosition);
 		selectedPluginsListViewer.setInput(selectedPlugins);
 	    setControl(container);
-
+	 
 	}
 	
 	public boolean getActivateViewValue() {
@@ -247,6 +246,5 @@
 		  } 
 		}
 		return pluginList.substring(0,(pluginList.length()-1)); 
-		
 	}	 
 }

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewProjectWizard.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewProjectWizard.java?rev=226792&r1=226791&r2=226792&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewProjectWizard.java
(original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewProjectWizard.java
Mon Aug  1 07:12:20 2005
@@ -23,6 +23,7 @@
 
 import org.apache.forrest.eclipse.ForrestPlugin;
 import org.apache.forrest.eclipse.actions.Utilities;
+import org.apache.forrest.eclipse.views.DOMUtilities;
 import org.apache.log4j.Logger;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
@@ -38,6 +39,11 @@
 import org.eclipse.ui.IWorkbenchWizard;
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
 
 /**
  * Create a new Content Package project.
@@ -51,9 +57,11 @@
 			.getLogger(NewProjectWizard.class);
 
 	private WizardNewProjectCreationPage page;
-	
-	private ActivatePluginsPage pluginPage; 
-	
+
+	private ActivatePluginsPage pluginPage;
+
+	private SiteOptionsPage siteOptionsPage;
+
 	private String projectPath;
 
 	/**
@@ -64,7 +72,7 @@
 		setWindowTitle("New Content Package");
 		setNeedsProgressMonitor(true);
 	}
-	
+
 	/**
 	 * Adding the page to the wizard.
 	 */
@@ -74,21 +82,26 @@
 		page.setTitle("New");
 		page.setDescription("Create a new Content Package.");
 		addPage(page);
+		siteOptionsPage = new SiteOptionsPage();
+		siteOptionsPage.setTitle("Site Options");
+		siteOptionsPage.setDescription("Site Options ");
+		addPage(siteOptionsPage);
 		pluginPage = new ActivatePluginsPage();
 		pluginPage.setTitle("Activate Plugins");
 		pluginPage.setDescription("Activate Plugins");
 		addPage(pluginPage);
-		
+
 	}
 
 	/**
-	 * This method is called when 'Finish' button is pressed in
-	 * the wizard. We will create an operation and run it
-	 * using wizard as execution context.
+	 * This method is called when 'Finish' button is pressed in the wizard. We
+	 * will create an operation and run it using wizard as execution context.
 	 */
 	public boolean performFinish() {
-		WorkspaceModifyOperation op= new WorkspaceModifyOperation() {
-			protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException,
InterruptedException {
+		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+			protected void execute(IProgressMonitor monitor)
+					throws CoreException, InvocationTargetException,
+					InterruptedException {
 				finishPage(monitor);
 			}
 		};
@@ -96,85 +109,127 @@
 			getContainer().run(false, true, op);
 		} catch (InvocationTargetException e) {
 			return false; // TODO: should open error dialog and log
-		} catch  (InterruptedException e) {
+		} catch (InterruptedException e) {
 			return false; // canceled
 		}
 		return true;
 	}
-	
-	private void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException
{
+
+	private void finishPage(IProgressMonitor monitor)
+			throws InterruptedException, CoreException {
 		if (monitor == null) {
-			monitor= new NullProgressMonitor();
+			monitor = new NullProgressMonitor();
 		}
-		
+
 		int exitValue = -1;
-		try {		
+		try {
 			String strName = page.getProjectName();
-			monitor.beginTask("Creating "+ strName + " Forrest Project", 3);
+			monitor.beginTask("Creating " + strName + " Forrest Project", 3);
+
+			IProject project = page.getProjectHandle();
+			IPath locationPath = page.getLocationPath();
 
-			IProject project= page.getProjectHandle();
-			IPath locationPath= page.getLocationPath();
-		
 			// create the project
-			IProjectDescription desc= project.getWorkspace().newProjectDescription(project.getName());
+			IProjectDescription desc = project.getWorkspace()
+					.newProjectDescription(project.getName());
 			if (!page.useDefaults()) {
 				desc.setLocation(locationPath);
 			}
 			project.create(desc, new SubProgressMonitor(monitor, 1));
 			project.open(new SubProgressMonitor(monitor, 1));
-			
+
 			// seed the project
 			ForrestPlugin plugin = ForrestPlugin.getDefault();
-			
+
 			String strPath = locationPath.toOSString();
-			String cmdString =  null;
-			
+			String cmdString = null;
+
 			if (System.getProperty("os.name").toLowerCase().startsWith("linux")) {
 				cmdString = "forrest -Dbasedir=" + strPath + "/" + strName
 						+ " seed";
-			} else if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
-				cmdString = "cmd /c forrest -Dbasedir=" + strPath + "\\" + strName
-						+ " seed";
+			} else if (System.getProperty("os.name").toLowerCase().startsWith(
+					"windows")) {
+				cmdString = "cmd /c forrest -Dbasedir=" + strPath + "\\"
+						+ strName + " seed";
 			}
-			
+
 			try {
-		      String lineRead = null;
-			  Process seedProc = Runtime.getRuntime().exec(cmdString);
-		      BufferedReader reader = new BufferedReader(new InputStreamReader(seedProc.getInputStream()));
-		      while((lineRead = reader.readLine()) != null) {
-				if (logger.isDebugEnabled()) {
-					logger.debug("finishPage(IProgressMonitor)" + lineRead);
+				String lineRead = null;
+				Process seedProc = Runtime.getRuntime().exec(cmdString);
+				BufferedReader reader = new BufferedReader(
+						new InputStreamReader(seedProc.getInputStream()));
+				while ((lineRead = reader.readLine()) != null) {
+					if (logger.isDebugEnabled()) {
+						logger.debug("finishPage(IProgressMonitor)" + lineRead);
+					}
 				}
-              }
-			  exitValue = seedProc.exitValue();
+				exitValue = seedProc.exitValue();
 			} catch (IOException e) {
 				// TODO Auto-generated catch block
 				logger.error("finishPage(IProgressMonitor)", e);
 			}
-			
+
 			project.refreshLocal(IProject.DEPTH_INFINITE, monitor);
-			
+
 			if (pluginPage.getActivateViewValue()) {
-				Utilities.activateForrestProperty(strPath + "\\" + strName +  "\\forrest.properties"
,"project.skin=leather-dev");
-				Utilities.addForrestPluginProperty(strPath + "\\" + strName +  "\\forrest.properties","org.apache.forrest.plugin.output.viewHelper.xhtml,org.apache.forrest.plugin.internal.view");
+				Utilities.activateForrestProperty(strPath + "\\" + strName
+						+ "\\forrest.properties", "project.skin=leather-dev");
+				Utilities
+						.addForrestPluginProperty(
+								strPath + "\\" + strName
+										+ "\\forrest.properties",
+								"org.apache.forrest.plugin.output.viewHelper.xhtml,org.apache.forrest.plugin.internal.view");
 			}
-			Utilities.addForrestPluginProperty(strPath + "\\" + strName +  "\\forrest.properties",
pluginPage.getSelectedPlugins());
-			
-			// TODO: change to the perspective specified in the plugin.xml			
+			Utilities.addForrestPluginProperty(strPath + "\\" + strName
+					+ "\\forrest.properties", pluginPage.getSelectedPlugins());
+			updateConfig(strPath + "/" + strName + "/");
 		} finally {
 			monitor.done();
 		}
 	}
 
+
 	/**
-	 * We will accept the selection in the workbench to see if
-	 * we can initialize from it.
+	 * This updated a configuration file based on the settings in siteconfig.xml  
+	 * 
+	 */
+	public void updateConfig(String path) {
+		Document document = siteOptionsPage.getOptionsValue();
+		NodeList configList = document.getElementsByTagName("configFile");
+		for (int y = 0; y < configList.getLength(); y++) {
+			Element config = (Element) configList.item(y);
+			Document configDoc = DOMUtilities.loadDOM(path
+					+ config.getAttribute("location"));
+			NodeList itemList = document.getElementsByTagName("field");
+			for (int x = 0; x < itemList.getLength(); x++) {
+				Element oneItem = (Element) itemList.item(x);
+				String argument1 = oneItem.getAttribute("tag");
+				NodeList configNodes = configDoc.getElementsByTagName(argument1);
+				for (int i = 0; i < configNodes.getLength(); i++) {
+					Element configItem = (Element) configNodes.item(i);
+					String argument2 = configItem.getNodeName();
+					if (argument1.equals(argument2)){
+						Text value = (Text) configItem.getFirstChild();
+						value.setData(oneItem.getAttribute("default"));
+					}
+				}
+				
+			}
+			
+					DOMUtilities.SaveDOM(configDoc, path
+					+ config.getAttribute("location"));
+			// TODO: change to the perspective specified in the plugin.xml
+		}
+
+	}
+
+	/**
+	 * We will accept the selection in the workbench to see if we can initialize
+	 * from it.
+	 * 
 	 * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
 	 */
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 	}
 
-	
-
-	
 }

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/SiteOptionsPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/SiteOptionsPage.java?rev=226792&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/SiteOptionsPage.java
(added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/SiteOptionsPage.java
Mon Aug  1 07:12:20 2005
@@ -0,0 +1,148 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation or its licensors,
+ * as applicable.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.forrest.eclipse.wizards;
+
+import org.apache.forrest.eclipse.ForrestPlugin;
+import org.apache.forrest.eclipse.views.DOMUtilities;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * The "Set Options" wizard page allows you to select configuration options for
+ * the project
+ * 
+ * 
+ */
+
+public class SiteOptionsPage extends WizardPage {
+
+	protected Document document;
+	protected String projectName;
+	protected String path;
+	protected String xDocPath;
+	protected IProject activeProject;
+	protected Text[] textField;
+	protected Button[] buttonField;
+	protected Button buttonSaveDefaults;
+
+	/**
+	 * Create the new page.
+	 * 
+	 * @param selection
+	 * @param selection
+	 * @param pageName
+	 */
+	public SiteOptionsPage() {
+		super("wizardPage");
+		setTitle("SetOptions");
+		setDescription("This allows you to set options for your new Forrest Project.");
+
+	}
+
+	/**
+	 * @see IDialogPage#createControl(Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite container = new Composite(parent, SWT.NULL);
+		GridLayout layout = new GridLayout();
+		container.setLayout(layout);
+		layout.numColumns = 2;
+		layout.verticalSpacing = 9;
+
+		// path = ForrestPlugin.getDefault().getStateLocation()+
+		// "/conf/siteconfig.xml";
+		path = ForrestPlugin.getDefault().getPluginPreferences().getString(
+				"FORREST_HOME")
+				+ "/tools/eclipse/plugins/org.apache.forrest/conf/siteconfig.xml";
+		document = DOMUtilities.loadDOM(path);
+		NodeList itemList = document.getElementsByTagName("field");
+		textField = new Text[50];
+		buttonField = new Button[50];
+				 
+		if (itemList.getLength() > 0) {
+			for (int i = 0; i < itemList.getLength(); i++) {
+				Element oneItem = (Element) itemList.item(i);
+				Label label = new Label(container, SWT.NONE);
+				label.setText(oneItem.getAttribute("label"));
+				GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+				label.setLayoutData(data);
+				if (oneItem.getAttribute("type").equals("text")) {
+					data = new GridData(GridData.FILL_HORIZONTAL);
+					textField[i] = new Text(container, SWT.NONE);
+					textField[i].setText(oneItem.getAttribute("default"));
+					textField[i].setToolTipText(oneItem
+							.getAttribute("description"));
+					textField[i].setLayoutData(data);
+					
+				}
+				if (oneItem.getAttribute("type").equals("boolean")) {
+					data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+					buttonField[i] = new Button(container, SWT.CHECK);
+					if (oneItem.getAttribute("default").equals("true")) {
+					buttonField[i].setSelection(true);}
+					else {
+						buttonField[i].setSelection(false);
+					}
+					buttonField[i].setToolTipText(oneItem
+							.getAttribute("description"));
+					buttonField[i].setLayoutData(data);
+				}
+			}
+		}
+		Label label = new Label(container, SWT.NONE);
+		label.setText("Save these selections as your default settings");
+		buttonSaveDefaults = new Button(container, SWT.CHECK);
+		container.pack();
+		setControl(container);
+
+	}
+
+	public Document getOptionsValue() {
+		NodeList itemList = document.getElementsByTagName("field");
+		if (itemList.getLength() > 0) {
+			for (int i = 0; i < itemList.getLength(); i++) {
+				Element oneItem = (Element) itemList.item(i);
+				if (oneItem.getAttribute("type").equals("text")) {
+				oneItem.setAttribute("default",textField[i].getText());
+				}
+				if (oneItem.getAttribute("type").equals("boolean")) {
+					if (buttonField[i].getSelection()) {
+						oneItem.setAttribute("default","true");}
+						else {
+							oneItem.setAttribute("default","false");
+						}
+				}
+			}
+		}
+		if (buttonSaveDefaults.getSelection()) {
+		DOMUtilities.SaveDOM(document, path);
+		}
+		return document;
+	}
+
+}
\ No newline at end of file

Propchange: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/SiteOptionsPage.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message