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/27 16:49:58 UTC
svn commit: r225531 - in
/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse:
actions/Utilities.java views/SiteXMLView.java
wizards/ActivatePluginsPage.java wizards/NewProjectWizard.java
Author: rgardler
Date: Wed Jul 27 07:49:46 2005
New Revision: 225531
URL: http://svn.apache.org/viewcvs?rev=225531&view=rev
Log:
Allow the selection of plugins when creating a new project (also removed various unused imports and improved some javadoc code) (thanks to Anil Ramnanan, FOR-585)
Modified:
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/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
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=225531&r1=225530&r2=225531&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 Wed Jul 27 07:49:46 2005
@@ -163,8 +163,10 @@
}
/**
- * Adds a new plugin to the plugin property in forrest.properties
- *
+ * Adds a plugin or plugins to the project.required.plugins property in forrest.properties
+ * @param path - path to the forrest.properties file
+ * @param pluginName - a comma separated list of plugins to add
+ *
*/
static public void addForrestPluginProperty(String path, String pluginName){
try {
@@ -174,11 +176,9 @@
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" );
+ outFile = outFile + str + "," + pluginName + System.getProperty( "line.separator" );
+ } else {
+ outFile = outFile + str + System.getProperty( "line.separator" );
}
}
in.close();
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=225531&r1=225530&r2=225531&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 Wed Jul 27 07:49:46 2005
@@ -41,11 +41,7 @@
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;
@@ -117,12 +113,13 @@
for (int i = 0; i < files.length; i++) {
strFilename = new File(files[i]);
filePath = strFilename.getPath();
+ File file = new File(filePath);
Node insertionElement = (Element) event.item.getData();
- Element element = document.createElement("NewElement");
+ Element element = document.createElement(file.getName());
relativePath = filePath.substring(xDocPath.length());
element.setAttribute("href", relativePath);
- element.setAttribute("description", relativePath);
- element.setAttribute("label", relativePath);
+ element.setAttribute("description", file.getName());
+ element.setAttribute("label", file.getName());
insertionElement.appendChild(element);
treeViewer.refresh();
}
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=225531&r1=225530&r2=225531&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 Wed Jul 27 07:49:46 2005
@@ -16,14 +16,30 @@
*/
package org.apache.forrest.eclipse.wizards;
+
+import java.util.Iterator;
+import java.util.Vector;
+
import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
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
@@ -34,8 +50,13 @@
public class ActivatePluginsPage extends WizardPage {
private Button activateView;
+ private ListViewer availablePluginsListViewer;
+ private Button removeButton;
+ private Label activateLabel;
+ private ListViewer selectedPluginsListViewer;
+ private IStructuredSelection selection ;
+ private Vector selectedPlugins;
-
/**
* Create the new page.
* @param selection
@@ -50,21 +71,182 @@
}
/**
+ * Returns a list of plugins available for use with Forrest
+ *
+ */
+ private Vector getAvailablePlugins() {
+
+ Vector availablePlugins = new Vector();
+ availablePlugins.add("org.apache.forrest.plugin.input.dtdx");
+ availablePlugins.add("org.apache.forrest.plugin.input.excel");
+ availablePlugins.add("org.apache.forrest.plugin.input.feeder");
+ availablePlugins.add("org.apache.forrest.plugin.input.listLocations");
+ availablePlugins.add("org.apache.forrest.plugin.input.OpenOffice.org");
+ availablePlugins.add("org.apache.forrest.plugin.input.PhotoGallery");
+ availablePlugins.add("org.apache.forrest.plugin.input.projectInfo");
+ availablePlugins.add("org.apache.forrest.plugin.input.simplifiedDocbook");
+ availablePlugins.add("org.apache.forrest.plugin.input.wiki");
+ availablePlugins.add("org.rblasch.forrest.plugin.input.pod");
+ availablePlugins.add("org.apache.forrest.plugin.output.pdf");
+ availablePlugins.add("s5");
+ availablePlugins.add("org.apache.forrest.plugin.internal.IMSManifest");
+ availablePlugins.add("org.apache.forrest.plugin.input.Daisy");
+ availablePlugins.add("org.apache.forrest.plugin.input.logs");
+ availablePlugins.add("org.apache.forrest.plugin.output.Chart");
+ availablePlugins.add("org.apache.forrest.plugin.output.htmlArea");
+ availablePlugins.add("org.apache.forrest.plugin.internal.view");
+ return availablePlugins;
+
+ }
+ /**
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
+ parent.setSize(593, 364);
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);
+ FormLayout containerLayout = new FormLayout();
+ container.setLayout(containerLayout);
+ activateLabel = new Label(container, SWT.NULL);
+ FormData activateLabelPosition = new FormData();
+ activateLabelPosition.width = 73;
+ activateLabelPosition.height = 13;
+ activateLabelPosition.left = new FormAttachment(9, 1000, 0);
+ activateLabelPosition.right = new FormAttachment(132, 1000, 0);
+ activateLabelPosition.top = new FormAttachment(17, 1000, 0);
+ activateLabelPosition.bottom = new FormAttachment(53, 1000, 0);
+ activateLabel.setLayoutData(activateLabelPosition);
+ activateLabel.setText("Activate Views ");
+ activateView = new Button (container, SWT.CHECK);
+ FormData activateViewPosition = new FormData();
+ activateViewPosition.width = 13;
+ activateViewPosition.height = 16;
+ activateViewPosition.left = new FormAttachment(140, 1000, 0);
+ activateViewPosition.right = new FormAttachment(162, 1000, 0);
+ activateViewPosition.top = new FormAttachment(15, 1000, 0);
+ 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;
+ return v.toArray();
+ }
+ public void dispose() {
+
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+
+ FormData availablePluginsListViewerPosition = new FormData();
+ availablePluginsListViewerPosition.width = 235;
+ availablePluginsListViewerPosition.height = 305;
+ availablePluginsListViewerPosition.left = new FormAttachment(17, 1000, 0);
+ availablePluginsListViewerPosition.right = new FormAttachment(419, 1000, 0);
+ availablePluginsListViewerPosition.top = new FormAttachment(86, 1000, 0);
+ availablePluginsListViewerPosition.bottom = new FormAttachment(924, 1000, 0);
+ availablePluginsListViewer.getControl().setLayoutData(availablePluginsListViewerPosition);
+ availablePluginsListViewer.setInput(getAvailablePlugins());
+
+ Button addButton = new Button(container, SWT.PUSH);
+ FormData addButtonPosition = new FormData();
+ addButtonPosition.width = 42;
+ addButtonPosition.height = 23;
+ addButtonPosition.left = new FormAttachment(466, 1000, 0);
+ addButtonPosition.right = new FormAttachment(537, 1000, 0);
+ addButtonPosition.top = new FormAttachment(199, 1000, 0);
+ addButtonPosition.bottom = new FormAttachment(262, 1000, 0);
+ addButton.setLayoutData(addButtonPosition);
+ addButton.setText("Add->");
+ addButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ for (Iterator iterator = selection.iterator(); iterator
+ .hasNext();) {
+ selectedPlugins.add(iterator.next());
+
+ }
+ selectedPluginsListViewer.refresh();
+
+ }
+ });
+
+
+ removeButton = new Button(container, SWT.PUSH | SWT.CENTER);
+ FormData removeButtonPosition = new FormData();
+ removeButtonPosition.width = 62;
+ removeButtonPosition.height = 23;
+ removeButtonPosition.left = new FormAttachment(447, 1000, 0);
+ removeButtonPosition.top = new FormAttachment(314, 1000, 0);
+ removeButtonPosition.right = new FormAttachment(552, 1000, 0);
+ removeButtonPosition.bottom = new FormAttachment(377, 1000, 0);
+ removeButton.setLayoutData(removeButtonPosition);
+ removeButton.setText("Remove ");
+ removeButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection)selectedPluginsListViewer.getSelection();
+ String plugin = selection.getFirstElement().toString();
+ selectedPlugins.remove(plugin);
+ selectedPluginsListViewer.refresh();
+ }
+ });
+
+ availablePluginsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ selection = (IStructuredSelection)event.getSelection();
+ }
+ });
+
+ selectedPluginsListViewer = new ListViewer(container);
+ selectedPluginsListViewer.setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ Vector v = (Vector)inputElement;
+ return v.toArray();
+ }
+ public void dispose() {
+
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ FormData selectedPluginsListViewerPosition = new FormData();
+ selectedPluginsListViewerPosition.width = 224;
+ selectedPluginsListViewerPosition.height = 303;
+ selectedPluginsListViewerPosition.left = new FormAttachment(570, 1000, 0);
+ selectedPluginsListViewerPosition.right = new FormAttachment(953, 1000, 0);
+ selectedPluginsListViewerPosition.top = new FormAttachment(72, 1000, 0);
+ selectedPluginsListViewerPosition.bottom = new FormAttachment(905, 1000, 0);
+ selectedPluginsListViewer.getControl().setLayoutData(selectedPluginsListViewerPosition);
+ selectedPluginsListViewer.setInput(selectedPlugins);
setControl(container);
-
+
}
public boolean getActivateViewValue() {
return activateView.getSelection();
}
-
+ public String getSelectedPlugins() {
+ String pluginList = "";
+ if (selectedPlugins != null) {
+ for (Iterator iterator = selectedPlugins.iterator(); iterator
+ .hasNext();) {
+ pluginList= (pluginList + iterator.next().toString() + ",");
+ }
+ }
+ 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=225531&r1=225530&r2=225531&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 Wed Jul 27 07:49:46 2005
@@ -16,8 +16,6 @@
*/
package org.apache.forrest.eclipse.wizards;
-import org.apache.log4j.Logger;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -25,26 +23,19 @@
import org.apache.forrest.eclipse.ForrestPlugin;
import org.apache.forrest.eclipse.actions.Utilities;
+import org.apache.log4j.Logger;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
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;
@@ -140,10 +131,10 @@
if (System.getProperty("os.name").toLowerCase().startsWith("linux")) {
cmdString = "forrest -Dbasedir=" + strPath + "/" + strName
- + " seedTestBusiness";
+ + " seed";
} else if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
cmdString = "cmd /c forrest -Dbasedir=" + strPath + "\\" + strName
- + " seedTestBusiness";
+ + " seed";
}
try {
@@ -167,9 +158,7 @@
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
+ Utilities.addForrestPluginProperty(strPath + "\\" + strName + "\\forrest.properties", pluginPage.getSelectedPlugins());
// TODO: change to the perspective specified in the plugin.xml
} finally {