You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2005/07/26 13:25:01 UTC

svn commit: r225272 - in /forrest/trunk/tools/eclipse/plugins/org.apache.forrest: ./ src/org/apache/forrest/eclipse/actions/ src/org/apache/forrest/eclipse/job/ src/org/apache/forrest/eclipse/popup/actions/ src/org/apache/forrest/eclipse/views/ src/org...

Author: rgardler
Date: Tue Jul 26 04:24:00 2005
New Revision: 225272

URL: http://svn.apache.org/viewcvs?rev=225272&view=rev
Log:
Enable views when seeding a new project, initial drag and drop support for tabs and site editors, Locationmap view (thanks to Anil Ramnanan, fixes FOR-582)

Added:
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/ForrestPropertiesView.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/LocationmapView.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElement.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElementPage.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElement.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElementPage.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDoc.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDocPage.java   (with props)
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/new_view.fv
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/view_build.xml   (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/actions/Utilities.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildSite.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildWARSite.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StartForrest.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StopForrest.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteDropListener.java
    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/views/TabsXMLView.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewProjectWizard.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewSiteElementPage.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewTabElementPage.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewXDoc.java

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=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/plugin.xml (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/plugin.xml Tue Jul 26 04:24:00 2005
@@ -71,6 +71,11 @@
             category="org.apache.forrest.eclipse"
             name="XDoc File"
             id="org.apache.forrest.eclipse.wizards.NewXDoc"/>
+      <wizard
+            category="org.apache.forrest.eclipse"
+            class="org.apache.forrest.eclipse.wizards.NewViewDoc"
+            id="org.apache.forrest.eclipse.wizards.NewViewDoc"
+            name="View Doc"/>
    </extension>
    <extension
          point="org.eclipse.ui.popupMenus">
@@ -140,6 +145,16 @@
            icon="icons/start.png"
            id="TabsXML"
            name="TabsXML"/>
+     <view
+           category="Forrest"
+           class="org.apache.forrest.eclipse.views.ForrestPropertiesView"
+           id="properties.editor"
+           name="properties.editor"/>
+     <view
+           category="Forrest"
+           class="org.apache.forrest.eclipse.views.LocationmapView"
+           id="Locationmap"
+           name="Locationmap"/>
   </extension>
   
    <extension

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java Tue Jul 26 04:24:00 2005
@@ -17,8 +17,11 @@
 package org.apache.forrest.eclipse.actions;
 
 import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -63,6 +66,24 @@
     }
      
 	/**
+     * Retrieve the relative path to the Content directory.
+     * @retuen platform specific path to Content directory
+     */
+	public static String getPathToContent() {
+        if (logger.isDebugEnabled()) {
+            logger.debug("getPathToContent() - start");
+        }
+
+        // FIXME: get this value from the package config file (forrest.properties)
+        String path = "src" + java.io.File.separator + "documentation"
+                + java.io.File.separator + "content" ;
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("getPathToContent() - end");
+        }
+        return path;
+    }
+	/**
 	 * @param directory
 	 * @return @throws
 	 *         FileNotFoundException
@@ -113,6 +134,60 @@
 		}	
 		
 	}; 
+	
+	
+	/**
+	 * Sets a property as active in a .properties file. 
+	 * @return true if the port is available
+	 */ 
+	static public void activateForrestProperty(String path, String property){
+		 try {
+		       BufferedReader in = new BufferedReader(new FileReader(path));
+		       String str;
+		       String outFile = null;
+		       while ((str = in.readLine()) != null) {
+		           if (str.startsWith("#" + property)) {
+		    	   outFile = outFile + property + System.getProperty( "line.separator" );
+		    	   }
+		           else
+		           {
+		           outFile = outFile + str + System.getProperty( "line.separator" );
+		           }
+		       }
+		        in.close();
+		        BufferedWriter out = new BufferedWriter(new FileWriter(path));
+		        out.write(outFile);
+		        out.close();
+		       } catch (IOException e) {
+		    }
+		
+	}
+	/**
+	 * Adds a new plugin to the plugin property in forrest.properties 
+	 * 
+	 */ 
+	static public void addForrestPluginProperty(String path, String pluginName){
+		 try {
+		       BufferedReader in = new BufferedReader(new FileReader(path));
+		       String str;
+		       String outFile = null;
+		       while ((str = in.readLine()) != null) {
+		           String[] tokens = str.split("=");
+		           if (tokens[0].startsWith("project.required.plugins")) {
+		    	   outFile = outFile + str + "," + pluginName+ System.getProperty( "line.separator" );
+		    	   }
+		           else
+		           {
+		           outFile = outFile + str + System.getProperty( "line.separator" );
+		           }
+		        }
+		        in.close();
+		        BufferedWriter out = new BufferedWriter(new FileWriter(path));
+		        out.write(outFile);
+		        out.close();
+		       } catch (IOException e) {
+		    }	
+	}
 
 	/**
 	 * @param cmdString

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java Tue Jul 26 04:24:00 2005
@@ -131,7 +131,7 @@
 					userMsg = "Unable to install required server plugins";
 					status = new Status(Status.ERROR, ForrestPlugin.ID,
 							EXCEPTION_ANT_RUNNING, userMsg, e);
-				} else if (errMsg.contains(BUILD_FORREST_ERROR_MESSAGE)) {
+				} else if (errMsg.equalsIgnoreCase(BUILD_FORREST_ERROR_MESSAGE)) {
                     userMsg = "Your installation of Forrest, at " + fhome + ", has not been correctly built.";
                     status = new Status(Status.ERROR, ForrestPlugin.ID,
                             ForrestRunner.EXCEPTION_FORREST, userMsg, e);

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildSite.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildSite.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildSite.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildSite.java Tue Jul 26 04:24:00 2005
@@ -31,7 +31,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
 
@@ -41,7 +40,8 @@
 	private IProject activeProject;
 	
 	/**
-	 * Constructor for Action1.
+	 * Constructor for Build Site Action. This action builds a static
+     * version of th site bu calling "forrest site".
 	 */
 	public BuildSite() {
 		super();

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildWARSite.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildWARSite.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildWARSite.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/BuildWARSite.java Tue Jul 26 04:24:00 2005
@@ -31,7 +31,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
 

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StartForrest.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StartForrest.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StartForrest.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StartForrest.java Tue Jul 26 04:24:00 2005
@@ -31,7 +31,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
 

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StopForrest.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StopForrest.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StopForrest.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/popup/actions/StopForrest.java Tue Jul 26 04:24:00 2005
@@ -25,7 +25,6 @@
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IActionDelegate;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
 

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/ForrestPropertiesView.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/ForrestPropertiesView.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/ForrestPropertiesView.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/ForrestPropertiesView.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,203 @@
+/*
+ * Copyright 1999-2005 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.views;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Vector;
+
+import org.apache.forrest.eclipse.wizards.NewSiteElement;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.DropTargetListener;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * A table view for forrest.properties files. 
+ */
+public class ForrestPropertiesView extends NavigationView {
+	
+	private Table table;
+	private TableViewer tableViewer;
+	
+	//	 Set the table column property names
+	private final String ACTIVE_PROPERTY 		= "Active";
+	private final String PROPERTY_NAME_COLUMN 	= "Property";
+	private final String PROPERTY_VALUE_COLUMN 	= "Value";
+	
+
+	// Set column names
+	private String[] columnNames = new String[] { 
+			ACTIVE_PROPERTY, 
+			PROPERTY_NAME_COLUMN,
+			PROPERTY_VALUE_COLUMN
+			
+			};
+	// Combo box choices
+	static final String[] OWNERS_ARRAY = { "?", "Nancy", "Larry", "Joe" };
+
+	/**
+	 * The constructor.
+	 */
+	public ForrestPropertiesView() {
+	}
+
+	/**
+	 * This is a callback that will allow us to create the viewer and initialize
+	 * it.
+	 */
+	public void createPartControl(Composite parent) {
+		createTable(parent);
+		createTableViewer();
+	
+	}
+
+	
+	private void showMessage(String message) {
+		MessageDialog.openInformation(treeViewer.getControl().getShell(),
+				"Sample View", message);
+	}
+
+	protected String getFilename() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * Create the Table
+	 */
+	private void createTable(Composite parent) {
+		int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | 
+					SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+
+		final int NUMBER_COLUMNS = 3;
+
+		table = new Table(parent, style);
+		
+		GridData gridData = new GridData(GridData.FILL_BOTH);
+		gridData.grabExcessVerticalSpace = true;
+		gridData.horizontalSpan = 3;
+		table.setLayoutData(gridData);		
+					
+		table.setLinesVisible(true);
+		table.setHeaderVisible(true);
+
+		// 1st column with image/checkboxes - NOTE: The SWT.CENTER has no effect!!
+		TableColumn column = new TableColumn(table, SWT.CENTER, 0);		
+		column.setText("ACTIVE");
+		column.setWidth(20);
+		
+		// 2nd column with task Description
+		column = new TableColumn(table, SWT.LEFT, 1);
+		column.setText("PROPERTY");
+		column.setWidth(400);
+		// Add listener to column so tasks are sorted by description when clicked 
+		column.addSelectionListener(new SelectionAdapter() {
+       	
+			public void widgetSelected(SelectionEvent e) {
+				
+			}
+		});
+
+
+		// 3rd column with task Owner
+		column = new TableColumn(table, SWT.LEFT, 2);
+		column.setText("VALUE");
+		column.setWidth(100);
+		// Add listener to column so tasks are sorted by owner when clicked
+		column.addSelectionListener(new SelectionAdapter() {
+       	
+			public void widgetSelected(SelectionEvent e) {
+				
+			}
+		});
+
+		
+	}
+
+	/**
+	 * Create the TableViewer 
+	 */
+	private void createTableViewer() {
+
+		tableViewer = new TableViewer(table);
+		tableViewer.setUseHashlookup(true);
+		
+		tableViewer.setColumnProperties(columnNames);
+
+		// Create the cell editors
+		CellEditor[] editors = new CellEditor[columnNames.length];
+
+		// Column 1 : Completed (Checkbox)
+		editors[0] = new CheckboxCellEditor(table);
+
+		// Column 2 : Description (Free text)
+		TextCellEditor textEditor = new TextCellEditor(table);
+		((Text) textEditor.getControl()).setTextLimit(60);
+		editors[1] = textEditor;
+		
+		// Column 3 : Owner (Combo Box) 
+		editors[2] = textEditor;
+
+			// Assign the cell editors to the viewer 
+		tableViewer.setCellEditors(editors);
+	
+	}
+	
+}

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

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/LocationmapView.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/LocationmapView.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/LocationmapView.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/LocationmapView.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,298 @@
+/*
+ * Copyright 1999-2005 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.views;
+
+
+
+import java.util.ArrayList;
+
+import org.apache.forrest.eclipse.actions.Utilities;
+import org.apache.forrest.eclipse.wizards.NewLocationElement;
+import org.apache.forrest.eclipse.wizards.NewMatchElement;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * A tree view for locationmap.xml files. The view handles drag and
+ * drop from the navigator and supports a number of context 
+ * menus for editing. 
+ */
+public class LocationmapView extends ViewPart implements IMenuListener,
+        ISelectionListener {
+    protected TreeViewer treeViewer;
+    protected Document document;
+    protected String projectName;
+    protected String path;
+    protected String contentPath;
+    protected IStructuredSelection treeSelection;
+    protected IProject activeProject;
+	private Action AddMatch;
+	private Action AddLocation;
+	private Action RemoveElement;
+	private Action SaveDocument;
+    
+	/**
+	 * The constructor.
+	 */
+	public LocationmapView() {
+	}
+	/**
+	 * This is a callback that will allow us to create the viewer and initialize
+	 * it.
+	 */
+	public void createPartControl(Composite parent) {
+		treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+		getSite().setSelectionProvider(treeViewer);
+		treeViewer.setContentProvider(new ITreeContentProvider() {
+			public Object[] getChildren(Object element) {
+				ArrayList ch = new ArrayList();
+				NodeList nl = ((Node) element).getChildNodes();
+				for (int i = 0; i < nl.getLength(); i++)
+					if (nl.item(i).getNodeType() == Node.ELEMENT_NODE)
+						ch.add(nl.item(i));
+				return ch.toArray();
+			}
+
+			public Object getParent(Object element) {
+				return ((Node) element).getParentNode();
+			}
+
+			public Object[] getElements(Object element) {
+				return getChildren(element);
+			}
+
+			public boolean hasChildren(Object element) {
+				return getChildren(element).length > 0;
+			}
+
+			public void dispose() {
+			}
+
+			public void inputChanged(Viewer viewer, Object old_input,
+					Object new_input) {
+			}
+		});
+		treeViewer.setLabelProvider(new LabelProvider() {
+			public String getText(Object element) {
+				if (element instanceof Attr)
+					return "@" + ((Attr) element).getNodeName() + " " +((Attr) element).getNodeValue();
+				else
+					return ((Node) element).getNodeName();
+			}
+		});
+		getViewSite().getPage().addSelectionListener(this);
+		treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+		public void selectionChanged(SelectionChangedEvent event) {
+					if (event.getSelection() instanceof IStructuredSelection) {
+					IStructuredSelection selection = (IStructuredSelection) event
+							.getSelection();
+					treeSelection = selection;
+					Element element = (Element) selection.getFirstElement();
+					AddLocation.setEnabled(false);
+					AddMatch.setEnabled(false);
+					if (element.getNodeName().equals("locator")){
+						AddLocation.setEnabled(false);
+						AddMatch.setEnabled(true);
+					} 
+					if (element.getNodeName().equals("match")){
+						AddLocation.setEnabled(true);
+						AddMatch.setEnabled(false);		
+					}
+					
+				}
+			}
+		});
+	
+		//System.out.println(document.toString());
+		if (path != null) { document = DOMUtilities.loadDOM(path);}
+		treeViewer.setInput(document);
+		makeActions();
+		hookContextMenu();
+	}
+
+	public void setFocus() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void menuAboutToShow(IMenuManager manager) {
+		// TODO Auto-generated method stub
+
+	}
+
+    private void hookContextMenu() {
+		MenuManager menuMgr = new MenuManager("#PopupMenu");
+		menuMgr.setRemoveAllWhenShown(true);
+		menuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager manager) {
+            LocationmapView.this.fillContextMenu(manager);
+			}
+		});
+		Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
+		treeViewer.getControl().setMenu(menu);
+		getSite().registerContextMenu(menuMgr, treeViewer);
+	}
+
+
+
+		private void fillContextMenu(IMenuManager manager) {
+			manager.add(AddMatch);
+			manager.add(AddLocation);
+			manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+			manager.add(RemoveElement);
+			manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+			manager.add(SaveDocument);
+		}
+	
+		private void makeActions() {
+		AddMatch = new Action() {
+			public void run() {
+				if (treeSelection != null) {
+					NewMatchElement elementCreation_ = new NewMatchElement(treeSelection,document);
+					elementCreation_.init(PlatformUI.getWorkbench(), null); // initializes the wizard
+					WizardDialog dialog = new WizardDialog(treeViewer.getControl().getShell(), elementCreation_);
+					dialog.open();
+				treeViewer.refresh();
+				}
+			}
+		};
+		AddMatch.setText("Add Match");
+		AddMatch.setToolTipText("Add Element tooltip");
+		AddMatch.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+			getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+		
+			
+		
+		AddLocation = new Action() {
+			public void run() {
+				if (treeSelection != null) {
+					NewLocationElement elementCreation_ = new NewLocationElement(treeSelection,document);
+					elementCreation_.init(PlatformUI.getWorkbench(), null); // initializes the wizard
+					WizardDialog dialog = new WizardDialog(treeViewer.getControl().getShell(), elementCreation_);
+					dialog.open();
+				treeViewer.refresh();
+				}
+			}
+		};
+		AddLocation.setText("Add Location");
+		AddLocation.setToolTipText("Add Element tooltip");
+		AddLocation.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+			getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+		
+		RemoveElement = new Action() {
+			public void run() {
+				if (treeSelection != null) {
+					//TODO: Code to remove Element does here.
+					Node deletionElement = (Element) treeSelection.getFirstElement();	
+					Node deletionParent = deletionElement.getParentNode();
+					deletionParent.removeChild(deletionElement);
+					treeViewer.refresh();
+					
+				}
+			}
+		};
+		RemoveElement.setText("DeleteElement");
+		RemoveElement.setToolTipText("Delete Element");
+		RemoveElement.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+				getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+		
+		SaveDocument = new Action() {
+			public void run() {
+				DOMUtilities.SaveDOM(document,path);
+			}
+		};
+		
+		SaveDocument.setText("Save");
+		SaveDocument.setToolTipText("Save XML Document");
+		SaveDocument.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+				getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+	}
+
+	private void showMessage(String message) {
+		MessageDialog.openInformation(
+			treeViewer.getControl().getShell(),
+			"Sample View",
+			message);
+	}
+
+    /**
+     * Get the name of the file this editor view represents.
+     * This name does not include the path. For example.
+     * 'site.xml' or 'tabs.xml'
+     * @return the name (without pat) of the document to view
+     */
+    protected String getFilename() {
+        return "locationmap.xml";
+    }
+    /**
+     * When the selection in the navigator view is changed 
+     * we look to see if the new selection is an IProject.
+     * If it is then we load the locationmap.xml file into this
+     * LocationmapView.
+     */
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+        if (selection instanceof IStructuredSelection) {
+            Object first = ((IStructuredSelection) selection).getFirstElement();
+            IResource resource = (IResource) first;
+            if (resource instanceof IProject) {
+                activeProject = (IProject) resource;
+                projectName = activeProject.getProject().getName();
+                contentPath = (activeProject.getProject().getLocation()
+                        .toString()
+                        + java.io.File.separator
+                        + Utilities.getPathToContent()
+                        + java.io.File.separator) ;
+                path = contentPath + getFilename();
+                document = DOMUtilities.loadDOM(path);
+                treeViewer.setInput(document);
+            }
+        }
+    }
+	
+}

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

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java Tue Jul 26 04:24:00 2005
@@ -40,6 +40,7 @@
     protected Document document;
     protected String projectName;
     protected String path;
+    protected String xDocPath;
     protected IStructuredSelection treeSelection;
     protected IProject activeProject;
 
@@ -93,11 +94,10 @@
             if (resource instanceof IProject) {
                 activeProject = (IProject) resource;
                 projectName = activeProject.getProject().getName();
-                path = (activeProject.getProject().getLocation()
+                xDocPath = (activeProject.getProject().getLocation()
                         .toString()
-                        + java.io.File.separator
-                        + Utilities.getPathToXDocs()
-                        + java.io.File.separator + getFilename());
+                        + java.io.File.separator);
+                path = xDocPath + getFilename();
                 document = DOMUtilities.loadDOM(path);
                 treeViewer.setInput(document);
             }
@@ -105,10 +105,12 @@
     }
 
     /**
-     * Get the name of the file this editor view represents.
+     * Get the anme and path of the file this editor view represents.
      * This name does not include the path. For example.
      * 'site.xml' or 'tabs.xml'
      * @return the name (without pat) of the document to view
      */
     protected abstract String getFilename();
+    
+   
 }

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteDropListener.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteDropListener.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteDropListener.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/SiteDropListener.java Tue Jul 26 04:24:00 2005
@@ -24,27 +24,24 @@
 import org.eclipse.swt.dnd.DropTargetListener;
 import org.eclipse.swt.widgets.Display;
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
 /**
  * Handles dropping of files onto the siteXMLView.
  *
  */
-public class SiteDropListener implements DropTargetListener {
+public class SiteDropListener extends SiteXMLView implements DropTargetListener {
 
 
-    TreeViewer treeViewer;
 
-    Document document;
-    
-    String projectName;
-    
+    protected NavigationView view;
+    protected Document activeDocument;
     final Display display = Display.getDefault();
     
-    public SiteDropListener(String projectName, Document document, TreeViewer treeViewer) {
+    public SiteDropListener() {
         // TODO Auto-generated constructor stub
-        this.treeViewer = treeViewer;
-        this.document = document;
-        this.projectName = projectName;
+    	activeDocument = document; 
     }
 
     public void dragEnter(DropTargetEvent event) {
@@ -75,19 +72,20 @@
             String[] files = (String[]) event.data;
             File strFilename;
             String filePath = null;
-            String localItemPath;
-            String itemPath;
+            String relativePath = null;
             for (int i = 0; i < files.length; i++) {
                 strFilename = new File(files[i]);
                 filePath = strFilename.getPath();
-                localItemPath = filePath.substring(filePath
-                        .indexOf("xdocs")
-                        + "xdocs".length() + 1);
-                itemPath = filePath.substring(Utilities
-                        .getPathToXDocs().length() + 2);
-                //TODO: Code to add element from drag and drop goes here
-       
-                
+                strFilename = new File(files[i]);
+                filePath = strFilename.getPath();
+                Node insertionElement = (Element) event.item.getData();	
+		        Element element = activeDocument.createElement("NewElement");
+		        relativePath = filePath.substring(xDocPath.length());  
+		        element.setAttribute("href", relativePath);
+		    	element.setAttribute("description", relativePath);
+		    	element.setAttribute("label", relativePath);
+		    	insertionElement.appendChild(element);
+		    	treeViewer.refresh();
             }
         }
     }

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=225272&r1=225271&r2=225272&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 Tue Jul 26 04:24:00 2005
@@ -16,10 +16,10 @@
  */
 package org.apache.forrest.eclipse.views;
 
-
-
+import java.io.File;
 import java.util.ArrayList;
 
+import org.apache.forrest.eclipse.actions.Utilities;
 import org.apache.forrest.eclipse.wizards.NewSiteElement;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuListener;
@@ -37,9 +37,15 @@
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.DropTargetListener;
 import org.eclipse.swt.dnd.FileTransfer;
 import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.IWorkbenchActionConstants;
@@ -50,15 +56,16 @@
 import org.w3c.dom.NodeList;
 
 /**
- * A tree view for site.xml files. The view handles drag and
- * drop from the navigator and supports a number of context 
- * menus for editing. 
+ * A tree view for site.xml files. The view handles drag and drop from the
+ * navigator and supports a number of context menus for editing.
  */
 public class SiteXMLView extends NavigationView {
 	private Action AddElement;
+
 	private Action RemoveElement;
+
 	private Action SaveDocument;
-	
+
 	/**
 	 * The constructor.
 	 */
@@ -70,11 +77,65 @@
 	 * it.
 	 */
 	public void createPartControl(Composite parent) {
-		treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+		treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL
+				| SWT.V_SCROLL);
 		getSite().setSelectionProvider(treeViewer);
 		int operations = DND.DROP_COPY | DND.DROP_MOVE;
-		Transfer[] types = new Transfer[] { FileTransfer.getInstance()};
-		treeViewer.addDropSupport(operations, types, new SiteDropListener(projectName ,document, treeViewer));
+		Transfer[] types = new Transfer[] { FileTransfer.getInstance() };
+
+		treeViewer.addDropSupport(operations, types, new DropTargetListener() {
+
+			public void dragEnter(DropTargetEvent event) {
+				// TODO Auto-generated method stub
+
+			}
+
+			public void dragLeave(DropTargetEvent event) {
+				// TODO Auto-generated method stub
+
+			}
+
+			public void dragOperationChanged(DropTargetEvent event) {
+				// TODO Auto-generated method stub
+
+			}
+
+			public void dragOver(DropTargetEvent event) {
+				// TODO Auto-generated method stub
+
+			}
+
+			/**
+			 * Handle files that are dropped into the site tree.
+			 */
+			public void drop(DropTargetEvent event) {
+				if (event.data instanceof String[]) {
+					String[] files = (String[]) event.data;
+					File strFilename;
+					String filePath = null;
+					String relativePath = null;
+					for (int i = 0; i < files.length; i++) {
+						strFilename = new File(files[i]);
+						filePath = strFilename.getPath();
+						Node insertionElement = (Element) event.item.getData();
+						Element element = document.createElement("NewElement");
+						relativePath = filePath.substring(xDocPath.length());
+						element.setAttribute("href", relativePath);
+						element.setAttribute("description", relativePath);
+						element.setAttribute("label", relativePath);
+						insertionElement.appendChild(element);
+						treeViewer.refresh();
+					}
+				}
+			}
+
+			public void dropAccept(DropTargetEvent event) {
+				// TODO Auto-generated method stub
+
+			}
+
+		});
+
 		treeViewer.setContentProvider(new ITreeContentProvider() {
 			public Object[] getChildren(Object element) {
 				ArrayList ch = new ArrayList();
@@ -108,37 +169,38 @@
 		treeViewer.setLabelProvider(new LabelProvider() {
 			public String getText(Object element) {
 				if (element instanceof Attr)
-					return "@" + ((Attr) element).getNodeName() + " " +((Attr) element).getNodeValue();
+					return "@" + ((Attr) element).getNodeName() + " "
+							+ ((Attr) element).getNodeValue();
 				else
 					return ((Node) element).getNodeName();
 			}
 		});
 		getViewSite().getPage().addSelectionListener(this);
 		
-		
 		treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-		
-		public void selectionChanged(SelectionChangedEvent event) {
-					if (event.getSelection() instanceof IStructuredSelection) {
+
+			public void selectionChanged(SelectionChangedEvent event) {
+				if (event.getSelection() instanceof IStructuredSelection) {
 					IStructuredSelection selection = (IStructuredSelection) event
 							.getSelection();
 					treeSelection = selection;
+
 				}
 			}
 		});
-	
-		//System.out.println(document.toString());
+
+		// System.out.println(document.toString());
 		treeViewer.setInput(document);
 		makeActions();
 		hookContextMenu();
 	}
 
-    private void hookContextMenu() {
+	private void hookContextMenu() {
 		MenuManager menuMgr = new MenuManager("#PopupMenu");
 		menuMgr.setRemoveAllWhenShown(true);
 		menuMgr.addMenuListener(new IMenuListener() {
 			public void menuAboutToShow(IMenuManager manager) {
-            SiteXMLView.this.fillContextMenu(manager);
+				SiteXMLView.this.fillContextMenu(manager);
 			}
 		});
 		Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
@@ -146,77 +208,81 @@
 		getSite().registerContextMenu(menuMgr, treeViewer);
 	}
 
-		private void fillContextMenu(IMenuManager manager) {
-			manager.add(AddElement);
-			manager.add(RemoveElement);
-			manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-			manager.add(SaveDocument);
-		}
-	
-		private void makeActions() {
+	private void fillContextMenu(IMenuManager manager) {
+		manager.add(AddElement);
+		manager.add(RemoveElement);
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+		manager.add(SaveDocument);
+	}
+
+	private void makeActions() {
 		AddElement = new Action() {
 			public void run() {
 				if (treeSelection != null) {
-				NewSiteElement elementCreation_ = new NewSiteElement(treeSelection,document);
-				elementCreation_.init(PlatformUI.getWorkbench(), null); // initializes the wizard
-				WizardDialog dialog = new WizardDialog(treeViewer.getControl().getShell(), elementCreation_);
-				dialog.open(); // This opens a dialog
-				treeViewer.refresh();
+					NewSiteElement elementCreation_ = new NewSiteElement(
+							treeSelection, document);
+					elementCreation_.init(PlatformUI.getWorkbench(), null); // initializes
+																			// the
+																			// wizard
+					WizardDialog dialog = new WizardDialog(treeViewer
+							.getControl().getShell(), elementCreation_);
+					dialog.open(); // This opens a dialog
+					treeViewer.refresh();
 				}
 			}
 		};
 		AddElement.setText("Add Element");
 		AddElement.setToolTipText("Add Element tooltip");
-		AddElement.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
-			getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
-		
+		AddElement.setImageDescriptor(PlatformUI.getWorkbench()
+				.getSharedImages().getImageDescriptor(
+						ISharedImages.IMG_OBJS_INFO_TSK));
+
 		RemoveElement = new Action() {
 			public void run() {
 				if (treeSelection != null) {
-					//TODO: Code to remove Element does here.
-					Node deletionElement = (Element) treeSelection.getFirstElement();	
+					// TODO: Code to remove Element does here.
+					Node deletionElement = (Element) treeSelection
+							.getFirstElement();
 					Node deletionParent = deletionElement.getParentNode();
 					deletionParent.removeChild(deletionElement);
 					treeViewer.refresh();
-					
+
 				}
 			}
 		};
 		RemoveElement.setText("DeleteElement");
 		RemoveElement.setToolTipText("Delete Element");
-		RemoveElement.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
-				getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
-		
+		RemoveElement.setImageDescriptor(PlatformUI.getWorkbench()
+				.getSharedImages().getImageDescriptor(
+						ISharedImages.IMG_OBJS_INFO_TSK));
+
 		SaveDocument = new Action() {
 			public void run() {
-				DOMUtilities.SaveDOM(document,path);
+				DOMUtilities.SaveDOM(document, path);
 			}
 		};
-		
+
 		SaveDocument.setText("Save");
 		SaveDocument.setToolTipText("Save XML Document");
-		SaveDocument.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
-				getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+		SaveDocument.setImageDescriptor(PlatformUI.getWorkbench()
+				.getSharedImages().getImageDescriptor(
+						ISharedImages.IMG_OBJS_INFO_TSK));
 	}
 
 	private void showMessage(String message) {
-		MessageDialog.openInformation(
-			treeViewer.getControl().getShell(),
-			"Sample View",
-			message);
+		MessageDialog.openInformation(treeViewer.getControl().getShell(),
+				"Sample View", message);
 	}
 
+	/**
+	 * Get the name of the file this editor view represents. This name does not
+	 * include the path. For example. 'site.xml' or 'tabs.xml'
+	 * 
+	 * @return the name (without pat) of the document to view
+	 */
 
-    /**
-     * Get the name of the file this editor view represents.
-     * This name does not include the path. For example.
-     * 'site.xml' or 'tabs.xml'
-     * @return the name (without pat) of the document to view
-     */
-    protected String getFilename() {
-        return "site.xml";
-    }
+	protected String getFilename() {
+		return Utilities.getPathToXDocs() + java.io.File.separator + "site.xml";
+	}
 
-   
-	
 }

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/TabsXMLView.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/TabsXMLView.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/TabsXMLView.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/TabsXMLView.java Tue Jul 26 04:24:00 2005
@@ -20,6 +20,7 @@
 
 import java.util.ArrayList;
 
+import org.apache.forrest.eclipse.actions.Utilities;
 import org.apache.forrest.eclipse.wizards.NewTabElement;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuListener;
@@ -221,7 +222,7 @@
      * @return the name (without pat) of the document to view
      */
     protected String getFilename() {
-        return "tabs.xml";
+    	return Utilities.getPathToXDocs() + java.io.File.separator + "tabs.xml";
     }
 	
 }

Added: 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=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,70 @@
+/*
+ * 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.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * The "Activate Plugin" wizard page allows you to select Plugins that  
+ * you would like to use in a particular project
+ * 
+ * 
+ */
+
+public class ActivatePluginsPage extends WizardPage {
+    
+	private Button activateView;
+	
+
+	/**
+	 * Create the new page.
+	 * @param selection 
+	 * @param selection 
+	 * @param pageName
+	 */
+	public ActivatePluginsPage() {
+		super("wizardPage");
+		setTitle("ActivatePlugins");
+		setDescription("This allows you to activate plugins for your new Forrest Project.");
+		
+	}
+
+	/**
+	 * @see IDialogPage#createControl(Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite container = new Composite(parent, SWT.NULL);
+	    container.setLayout(new GridLayout(2, false));
+	    new Label(container, SWT.NULL).setText("Activate Views ");
+	    activateView = new Button (container, SWT.CHECK);
+	    activateView.setSelection(false);
+	    setControl(container);
+	   	
+	}
+	
+	public boolean getActivateViewValue() {
+		return activateView.getSelection();
+	}
+	
+	
+}
\ No newline at end of file

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

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElement.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElement.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElement.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElement.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,110 @@
+/*
+ * 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 java.lang.reflect.InvocationTargetException;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Create a new Location Element project.
+ */
+
+public class NewLocationElement extends Wizard implements INewWizard {
+	protected IStructuredSelection selection;
+	private Document document;
+	
+	
+	/**
+	 * Logger for this class
+	 */
+	private static final Logger logger = Logger
+			.getLogger(NewLocationElement.class);
+
+	private NewLocationElementPage page;
+
+	/**
+	 * Constructor for New Location Element.
+	 * @param treeSelection 
+	 * @param document 
+	 */
+	public NewLocationElement(IStructuredSelection treeSelection, Document newDocument) {
+		super();
+		setWindowTitle("New Element");
+		setNeedsProgressMonitor(true);
+		selection= treeSelection;
+		document = newDocument;
+	}
+	
+	/**
+	 * Adding the page to the wizard.
+	 */
+
+	public void addPages() {
+		page = new NewLocationElementPage();
+		addPage(page);
+	}
+
+	/**
+	 * 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 {
+				 Node insertionElement = (Element) selection.getFirstElement();	
+		    	  Element element = document.createElement("location");
+		    	  element.setAttribute("src", page.getLocation());
+		    	  insertionElement.appendChild(element);
+							}
+		};
+		try {
+			getContainer().run(false, true, op);
+		} catch (InvocationTargetException e) {
+			return false; // TODO: should open error dialog and log
+		} catch  (InterruptedException e) {
+			return false; // canceled
+		}
+		return true;
+	}
+	
+	
+	public void createControl(Composite parent) {
+		// TODO Auto-generated method stub
+		
+	}
+
+
+	
+	public void init(IWorkbench workbench, IStructuredSelection selection) {
+		// TODO Auto-generated method stub
+		
+	}
+}
+

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

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElementPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElementPage.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElementPage.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewLocationElementPage.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,80 @@
+/*
+ * 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.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.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * The "New Element" wizard page allows you to insert a 
+ * new element into the site.xml file and specify the element
+ * name, location, path and descriotion.
+ * 
+ */
+
+public class NewLocationElementPage extends WizardPage {
+    
+	private Text locationText;
+	
+
+	/**
+	 * Create the new page.
+	 * @param selection 
+	 * @param selection 
+	 * @param pageName
+	 */
+	public NewLocationElementPage() {
+		super("wizardPage");
+		setTitle("New Location Element");
+		setDescription("This wizard creates a new Location element in locationmap.xml.");
+		
+	}
+
+	/**
+	 * @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;
+		Label label = new Label(container, SWT.NULL);
+		label.setText("Location Source:");
+
+		locationText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		locationText.setLayoutData(gd);
+				
+
+		setControl(container);
+	}
+	
+	
+	
+	
+	public String getLocation() {
+		return locationText.getText();
+	}
+	
+}
\ No newline at end of file

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

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElement.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElement.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElement.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElement.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,110 @@
+/*
+ * 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 java.lang.reflect.InvocationTargetException;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Create a new Match Element project.
+ */
+
+public class NewMatchElement extends Wizard implements INewWizard {
+	protected IStructuredSelection selection;
+	private Document document;
+	
+	
+	/**
+	 * Logger for this class
+	 */
+	private static final Logger logger = Logger
+			.getLogger(NewMatchElement.class);
+
+	private NewMatchElementPage page;
+
+	/**
+	 * Constructor for New Site Element.
+	 * @param treeSelection 
+	 * @param document 
+	 */
+	public NewMatchElement(IStructuredSelection treeSelection, Document newDocument) {
+		super();
+		setWindowTitle("New Element");
+		setNeedsProgressMonitor(true);
+		selection= treeSelection;
+		document = newDocument;
+	}
+	
+	/**
+	 * Adding the page to the wizard.
+	 */
+
+	public void addPages() {
+		page = new NewMatchElementPage();
+		addPage(page);
+	}
+
+	/**
+	 * 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 {
+				 Node insertionElement = (Element) selection.getFirstElement();	
+		    	  Element element = document.createElement("match");
+		    	  element.setAttribute("pattern", page.getPattern());
+		    	  insertionElement.appendChild(element);
+							}
+		};
+		try {
+			getContainer().run(false, true, op);
+		} catch (InvocationTargetException e) {
+			return false; // TODO: should open error dialog and log
+		} catch  (InterruptedException e) {
+			return false; // canceled
+		}
+		return true;
+	}
+	
+	
+	public void createControl(Composite parent) {
+		// TODO Auto-generated method stub
+		
+	}
+
+
+	
+	public void init(IWorkbench workbench, IStructuredSelection selection) {
+		// TODO Auto-generated method stub
+		
+	}
+}
+

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

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElementPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElementPage.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElementPage.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewMatchElementPage.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,76 @@
+/*
+ * 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.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.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * The "New Match Element" wizard page allows you to insert a 
+ * new Match element into the locationmap.xml file and specify the element
+ * name, location, path and descriotion.
+ * 
+ */
+
+public class NewMatchElementPage extends WizardPage {
+    
+	private Text patternText;
+		
+
+	/**
+	 * Create the new page.
+	 * @param selection 
+	 * @param selection 
+	 * @param pageName
+	 */
+	public NewMatchElementPage() {
+		super("wizardPage");
+		setTitle("New Match Element");
+		setDescription("This wizard creates a new Match element in locationmap.xml.");
+		
+	}
+
+	/**
+	 * @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;
+		Label label = new Label(container, SWT.NULL);
+		label.setText("&Pattern:");
+
+		patternText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		patternText.setLayoutData(gd);
+		setControl(container);
+	}
+	
+	public String getPattern() {
+		return patternText.getText();
+	}
+	
+	
+}
\ No newline at end of file

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

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=225272&r1=225271&r2=225272&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 Tue Jul 26 04:24:00 2005
@@ -24,6 +24,7 @@
 import java.lang.reflect.InvocationTargetException;
 
 import org.apache.forrest.eclipse.ForrestPlugin;
+import org.apache.forrest.eclipse.actions.Utilities;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.runtime.CoreException;
@@ -33,11 +34,17 @@
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+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.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWizard;
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
 
@@ -53,6 +60,10 @@
 			.getLogger(NewProjectWizard.class);
 
 	private WizardNewProjectCreationPage page;
+	
+	private ActivatePluginsPage pluginPage; 
+	
+	private String projectPath;
 
 	/**
 	 * Constructor for ContentPackageWizard.
@@ -72,6 +83,11 @@
 		page.setTitle("New");
 		page.setDescription("Create a new Content Package.");
 		addPage(page);
+		pluginPage = new ActivatePluginsPage();
+		pluginPage.setTitle("Activate Plugins");
+		pluginPage.setDescription("Activate Plugins");
+		addPage(pluginPage);
+		
 	}
 
 	/**
@@ -124,10 +140,10 @@
 			
 			if (System.getProperty("os.name").toLowerCase().startsWith("linux")) {
 				cmdString = "forrest -Dbasedir=" + strPath + "/" + strName
-						+ " seed";
+						+ " seedTestBusiness";
 			} else if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
 				cmdString = "cmd /c forrest -Dbasedir=" + strPath + "\\" + strName
-						+ " seed";
+						+ " seedTestBusiness";
 			}
 			
 			try {
@@ -147,20 +163,20 @@
 			
 			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");
+			}
+			
+			
 			// TODO: configure your page / nature
-	
+			
 			// TODO: change to the perspective specified in the plugin.xml			
 		} finally {
 			monitor.done();
 		}
 	}
 
-	private void throwCoreException(String message) throws CoreException {
-		IStatus status =
-			new Status(IStatus.ERROR, "org.burrokeet.application", IStatus.OK, message, null);
-		throw new CoreException(status);
-	}
-
 	/**
 	 * We will accept the selection in the workbench to see if
 	 * we can initialize from it.
@@ -168,4 +184,8 @@
 	 */
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 	}
+
+	
+
+	
 }

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewSiteElementPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewSiteElementPage.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewSiteElementPage.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewSiteElementPage.java Tue Jul 26 04:24:00 2005
@@ -16,7 +16,6 @@
  */
 package org.apache.forrest.eclipse.wizards;
 
-import org.eclipse.jface.dialogs.IDialogPage;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewTabElementPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewTabElementPage.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewTabElementPage.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewTabElementPage.java Tue Jul 26 04:24:00 2005
@@ -16,7 +16,6 @@
  */
 package org.apache.forrest.eclipse.wizards;
 
-import org.eclipse.jface.dialogs.IDialogPage;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDoc.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDoc.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDoc.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDoc.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,187 @@
+/*
+ * 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 java.lang.reflect.InvocationTargetException;
+
+import org.apache.forrest.eclipse.ForrestPlugin;
+import org.eclipse.ant.core.AntRunner;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * Create a new View
+ * resource in the provided container. If the container resource
+ * (a folder or a project) is selected in the workspace 
+ * when the wizard is opened, it will accept it as the target
+ * container. The wizard creates one file with the extension
+ * "fv". When created the file is opened in the default editor.
+ */
+
+public class NewViewDoc extends Wizard implements INewWizard {
+	protected NewViewDocPage page;
+	protected ISelection selection;
+	protected String resourceAntScript = "/src/org/apache/forrest/template/view_build.xml";
+
+	/**
+	 * Constructor for NewViewDoc.
+	 */
+	public NewViewDoc() {
+		super();
+		setNeedsProgressMonitor(true);
+	}
+	
+	/**
+	 * Adding the page to the wizard.
+	 */
+	public void addPages() {
+		page = new NewViewDocPage(selection);
+		addPage(page);
+	}
+
+	/**
+	 * 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() {
+		final String containerName = page.getContainerName();
+		final String fileName = page.getFileName();
+		IRunnableWithProgress op = new IRunnableWithProgress() {
+			public void run(IProgressMonitor monitor) throws InvocationTargetException {
+				try {
+					doFinish(containerName, fileName, monitor);
+				} catch (CoreException e) {
+					throw new InvocationTargetException(e);
+				} finally {
+					monitor.done();
+				}
+			}
+		};
+		try {
+			getContainer().run(true, false, op);
+		} catch (InterruptedException e) {
+			return false;
+		} catch (InvocationTargetException e) {
+			Throwable realException = e.getTargetException();
+			MessageDialog.openError(getShell(), "Error", realException.getMessage());
+			return false;
+		}
+		return true;
+	}
+	
+	/**
+	 * The worker method. It will find the container, create the
+	 * file if missing or just replace its contents, and open
+	 * the editor on the newly created file.
+	 */
+
+	private void doFinish(
+		String containerName,
+		String fileName,
+		IProgressMonitor monitor)
+		throws CoreException {
+		// create a sample file
+		monitor.beginTask("Creating " + fileName, 2);
+		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+		IResource resource = root.findMember(new Path(containerName));
+		if (!resource.exists() || !(resource instanceof IContainer)) {
+			throwCoreException("Container \"" + containerName + "\" does not exist.");
+		}
+		
+        createFile(resource, fileName, monitor);
+	    
+	    IContainer container = (IContainer) resource;
+	    final IFile file = container.getFile(new Path(fileName));
+		
+		monitor.worked(1);
+		monitor.setTaskName("Opening file for editing...");
+		getShell().getDisplay().asyncExec(new Runnable() {
+			public void run() {
+				IWorkbenchPage page =
+					PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+				try {
+					IDE.openEditor(page, file, true);
+				} catch (PartInitException e) {
+				}
+			}
+		});
+		monitor.worked(1);
+	}
+	
+	/*
+	 * Create the file and put the template data into it.
+	 */
+	protected void createFile(
+			IResource resource, 
+			String fileName, 
+			IProgressMonitor monitor) 
+	throws CoreException {
+		AntRunner runner = new AntRunner();
+		ForrestPlugin plugin = ForrestPlugin.getDefault();
+		String strPluginDir = plugin.getBundle().getLocation();
+		if (strPluginDir.startsWith("update@")) {
+			strPluginDir = strPluginDir.substring(8);
+		}
+		runner.setBuildFileLocation(strPluginDir + resourceAntScript);
+		String strPath = resource.getLocation().toOSString();
+		StringBuffer sb = new StringBuffer("-Dresource.dir=");
+		sb.append(strPath);
+		sb.append(" ");
+		sb.append("-Dresource.name=");
+		sb.append(fileName);
+		runner.setArguments(sb.toString());
+		runner.run(monitor);
+	    resource.refreshLocal(IProject.DEPTH_INFINITE, monitor);
+	}
+
+	private void throwCoreException(String message) throws CoreException {
+		IStatus status =
+			new Status(IStatus.ERROR, "org.apache.forrest.eclipse", IStatus.OK, message, null);
+		throw new CoreException(status);
+	}
+
+	/**
+	 * 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) {
+		this.selection = selection;
+	}
+}
\ No newline at end of file

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

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDocPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDocPage.java?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDocPage.java (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewViewDocPage.java Tue Jul 26 04:24:00 2005
@@ -0,0 +1,181 @@
+/*
+ * 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.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.events.*;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.eclipse.jface.viewers.*;
+
+/**
+ * The "New" wizard page allows setting the container for
+ * the new Forrest:View file as well as the file name. The page
+ * will only accept file name without the extension OR
+ * with the extension that matches the expected one (fv).
+ */
+
+public class NewViewDocPage extends WizardPage {
+    // FIXME: get these config settings from forrest.properties
+	public String projectXDocsDir = "/src/documentation/content/xdocs";
+	public String default_filename = "new_view.fv"; 
+	public String required_file_extension = "fv"; 
+	private Text containerText;
+	private Text fileText;
+	protected ISelection selection;
+
+	/**
+	 * Create the new page.
+	 * @param pageName
+	 */
+	public NewViewDocPage(ISelection selection) {
+		super("wizardPage");
+		setTitle("Forrest:View File");
+		setDescription("This wizard creates a new Forrest:View file with *.fv extension.");
+		this.selection = selection;
+	}
+
+	/**
+	 * @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 = 3;
+		layout.verticalSpacing = 9;
+		Label label = new Label(container, SWT.NULL);
+		label.setText("&Container:");
+
+		containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		containerText.setText(projectXDocsDir);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		containerText.setLayoutData(gd);
+		containerText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				dialogChanged();
+			}
+		});
+
+		Button button = new Button(container, SWT.PUSH);
+		button.setText("Browse...");
+		button.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				handleBrowse();
+			}
+		});
+		label = new Label(container, SWT.NULL);
+		label.setText("&File name:");
+
+		fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		fileText.setLayoutData(gd);
+		fileText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				dialogChanged();
+			}
+		});
+		initialize();
+		dialogChanged();
+		setControl(container);
+	}
+	
+	/**
+	 * Tests if the current workbench selection is a suitable
+	 * container to use.
+	 */
+	
+	private void initialize() {
+		if (selection!=null && selection.isEmpty()==false && selection instanceof IStructuredSelection) {
+			IStructuredSelection ssel = (IStructuredSelection)selection;
+			if (ssel.size()>1) return;
+			Object obj = ssel.getFirstElement();
+			if (obj instanceof IResource) {
+				IContainer container;
+				if (obj instanceof IContainer)
+					container = (IContainer)obj;
+				else
+					container = ((IResource)obj).getParent();
+				containerText.setText(container.getFullPath().toString());
+			}
+		}
+		fileText.setText(default_filename);
+	}
+	
+	/**
+	 * Uses the standard container selection dialog to
+	 * choose the new value for the container field.
+	 */
+
+	private void handleBrowse() {
+		ContainerSelectionDialog dialog =
+			new ContainerSelectionDialog(
+				getShell(),
+				ResourcesPlugin.getWorkspace().getRoot(),
+				false,
+				"Select new file container");
+		if (dialog.open() == ContainerSelectionDialog.OK) {
+			Object[] result = dialog.getResult();
+			if (result.length == 1) {
+				containerText.setText(((Path)result[0]).toOSString());
+			}
+		}
+	}
+	
+	/**
+	 * Ensures that both text fields are set.
+	 */
+
+	private void dialogChanged() {
+		String container = getContainerName();
+		String fileName = getFileName();
+
+		if (container.length() == 0) {
+			updateStatus("File container must be specified");
+			return;
+		}
+		if (fileName.length() == 0) {
+			updateStatus("File name must be specified");
+			return;
+		}
+		int dotLoc = fileName.lastIndexOf('.');
+		if (dotLoc != -1) {
+			String ext = fileName.substring(dotLoc + 1);
+			if (ext.equalsIgnoreCase(required_file_extension) == false) {
+				updateStatus("File extension must be \"" + required_file_extension + "\"");
+				return;
+			}
+		}
+		updateStatus(null);
+	}
+
+	private void updateStatus(String message) {
+		setErrorMessage(message);
+		setPageComplete(message == null);
+	}
+
+	public String getContainerName() {
+		return containerText.getText();
+	}
+	public String getFileName() {
+		return fileText.getText();
+	}
+}
\ No newline at end of file

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

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewXDoc.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewXDoc.java?rev=225272&r1=225271&r2=225272&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewXDoc.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/NewXDoc.java Tue Jul 26 04:24:00 2005
@@ -39,7 +39,6 @@
 import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWizard;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.ide.IDE;

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/new_view.fv
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/new_view.fv?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/new_view.fv (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/new_view.fv Tue Jul 26 04:24:00 2005
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document> 
+  <header> 
+    <title>@title@</title> 
+  </header> 
+  <body> 
+    <!--  Add your content here -->
+  </body>
+</document>

Added: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/view_build.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/view_build.xml?rev=225272&view=auto
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/view_build.xml (added)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/view_build.xml Tue Jul 26 04:24:00 2005
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project default="newView" basedir="." 
+  name="Forrest Eclipse Plugin Resource Management">
+
+  <description>
+    Targets for the creation and management of Forrest site resources.
+  </description>
+  	
+  <property name="resource.dir" value=""/>
+  <property name="resource.name" value=""/>
+
+  <property name="title" value="New View"/>
+  
+  <target name="_initFilterTokens_newView"
+  	description="Initialise the filter tokens for creating a new XDoc file">
+  	<filter token="title" value="${title}"/>
+  </target>
+	
+  <!-- ============================================ -->
+  <!-- Create a new View                            -->
+  <!-- ============================================ -->
+  <target name="newView"
+  	description="Create a new View in the resource directory"
+  	depends="_initFilterTokens_newView">
+  	<mkdir dir="${resource.dir}"/>
+  	<copy file="new_view.fv" 
+  		  tofile="${resource.dir}/${resource.name}" 
+  		  filtering="yes"/>
+  </target>
+</project>
\ No newline at end of file

Propchange: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/template/view_build.xml
------------------------------------------------------------------------------
    svn:eol-style = native