[Esbox-commits] r183 - in trunk/org.indt.esbox.python.ui: . META-INF src/org/indt/esbox/python/ui src/org/indt/esbox/python/ui/wizards

carolina at garage.maemo.org carolina at garage.maemo.org
Fri Oct 26 02:31:48 EEST 2007


Author: carolina
Date: 2007-10-26 02:31:47 +0300 (Fri, 26 Oct 2007)
New Revision: 183

Added:
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/ESboxPythonProjectNature.java
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonCommonProjectWizard.java
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonConfigWizardPage.java
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonMainWizardPage.java
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/PythonProjectWizard.java
Removed:
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectNature.java
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectWizard.java
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/NewPythonProjectWizardPage.java
Modified:
   trunk/org.indt.esbox.python.ui/META-INF/MANIFEST.MF
   trunk/org.indt.esbox.python.ui/plugin.xml
   trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/PythonUIActivator.java
Log:
Fixing some details on Python Wizard

Modified: trunk/org.indt.esbox.python.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.indt.esbox.python.ui/META-INF/MANIFEST.MF	2007-10-25 19:24:42 UTC (rev 182)
+++ trunk/org.indt.esbox.python.ui/META-INF/MANIFEST.MF	2007-10-25 23:31:47 UTC (rev 183)
@@ -21,6 +21,7 @@
  org.eclipse.cdt.make.ui,
  org.indt.esbox.ui,
  org.python.pydev,
- org.python.pydev.core
+ org.python.pydev.core,
+ org.eclipse.team.cvs.ui
 Eclipse-LazyStart: true
 Bundle-Localization: plugin

Modified: trunk/org.indt.esbox.python.ui/plugin.xml
===================================================================
--- trunk/org.indt.esbox.python.ui/plugin.xml	2007-10-25 19:24:42 UTC (rev 182)
+++ trunk/org.indt.esbox.python.ui/plugin.xml	2007-10-25 23:31:47 UTC (rev 183)
@@ -6,7 +6,7 @@
       <wizard
             canFinishEarly="false"
             category="org.python.pydev.PythonCategory"
-            class="org.indt.esbox.python.ui.wizards.ESboxPythonProjectWizard"
+            class="org.indt.esbox.python.ui.wizards.PythonProjectWizard"
             finalPerspective="org.python.pydev.plugin.PythonPerspective"
             preferredPerspectives="org.python.pydev.plugin.PythonPerspective"
             hasPages="true"

Copied: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/ESboxPythonProjectNature.java (from rev 180, trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectNature.java)
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/ESboxPythonProjectNature.java	                        (rev 0)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/ESboxPythonProjectNature.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -0,0 +1,193 @@
+package org.indt.esbox.python.ui;
+/*******************************************************************************
+ * Copyright (c) 2007 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+ *    Paulo Romulo (paulo at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+ *    Carolina Nogueira (carolina at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+ *******************************************************************************/
+import java.io.File;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.QualifiedName;
+import org.indt.esbox.core.CoreActivator;
+
+
+public class ESboxPythonProjectNature implements IProjectNature {
+
+	private IProject project;
+	private static ESboxPythonProjectNature instance;
+			
+	/*
+	 * id of ESbox Python Project
+	 * org.indt.esbox.core.esboxPythonNature
+	 */
+	public static final String ESBOX_PYTHON_NATURE_ID = CoreActivator.getUniqueIdentifier() + ".esboxPythonNature";
+	
+   /**
+     * constant that stores the name of the python version we are using for the project with this nature
+     */
+    private QualifiedName customizedLocation = null;
+    
+    private ESboxPythonProjectNature() {}
+    
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static  ESboxPythonProjectNature getDefault() {
+		return instance;
+	}	
+  
+    public synchronized QualifiedName getCustomizedLocationQualifiedName() {
+        if(customizedLocation == null){
+            //we need to do this because the plugin ID may not be known on '' time
+        	customizedLocation = new QualifiedName(CoreActivator.PLUGIN_ID, "ESBOXPYTHON_PROJECT_CUSTOMIZED_LOCATION");
+        }
+        return customizedLocation;
+    }
+    
+    /**
+	 * Adds the ESbox Python project nature to a given project.
+	 * @param _project the project to add the nature.
+	 * @param _monitor a progress monitor to indicate the duration of the operation,
+	 *            or <code>null</code> if progress reporting is not required.
+	 * @throws CoreException if something goes wrong.
+	 */
+	public static void addESboxPythonNature(final IProject project, final IProgressMonitor monitor) throws CoreException {
+		ESboxPythonProjectNature.getDefault().addNature(project, ESBOX_PYTHON_NATURE_ID, monitor);		
+	}
+
+	/** 
+	 * Removes the ESbox Python project nature to a given project.
+	 * @param project the project to add the nature.
+	 * @param mon a progress monitor to indicate the duration of the operation,
+	 *            or <code>null</code> if progress reporting is not required.
+	 * @throws CoreException if something goes wrong.
+	 */
+	public static void removeESboxPythonNature(IProject project, IProgressMonitor mon) throws CoreException {
+		ESboxPythonProjectNature.getDefault().removeNature(project, ESBOX_PYTHON_NATURE_ID, mon);
+	}
+
+	/**
+	 * Utility method for adding a nature to a project.
+	 * 
+	 * @param project the project to add the nature
+	 * @param natureId the id of the nature to assign to the project
+	 * @param monitor a progress monitor to indicate the duration of the operation,
+	 * or <code>null</code> if progress reporting is not required. 
+	 */
+	public void addNature(IProject project, String natureId,
+			IProgressMonitor monitor) throws CoreException {
+		IProjectDescription description = project.getDescription();
+		if (description.hasNature(natureId))
+			return;
+		String[] ids = description.getNatureIds();
+		String[] newIds = new String[ids.length + 1];
+		System.arraycopy(ids, 0, newIds, 0, ids.length);
+		newIds[ids.length] = natureId;
+		description.setNatureIds(newIds);
+		project.setDescription(description, null);
+	}
+
+
+	/**
+	 * Utility method for removing a project nature from a project.
+	 * 
+	 * @param proj
+	 *            the project to remove the nature from
+	 * @param natureId
+	 *            the nature id to remove
+	 * @param monitor
+	 *            a progress monitor to indicate the duration of the operation,
+	 *            or <code>null</code> if progress reporting is not required.
+	 */
+	public void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
+		IProjectDescription description = project.getDescription();
+		if (!description.hasNature(natureId))
+			return;
+		String[] ids = description.getNatureIds();
+		for (int i = 0; i < ids.length; ++i) {
+			if (ids[i].equals(natureId)) {
+				String[] newIds = new String[ids.length - 1];
+				System.arraycopy(ids, 0, newIds, 0, i);
+				System.arraycopy(ids, i + 1, newIds, i, ids.length - i - 1);
+				description.setNatureIds(newIds);
+				project.setDescription(description, null);
+			}
+		}				
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.resources.IProjectNature#configure()
+	 */
+	public void configure() throws CoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+	 */
+	public void deconfigure() throws CoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.resources.IProjectNature#getProject()
+	 */
+	public IProject getProject() {
+		return project;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+	 */
+	public void setProject(IProject project) {
+		this.project = project;
+	}
+	
+	/**
+	 * 
+	 * @param project
+	 * @return
+	 */
+	public boolean isESboxPythonProject(IProject project) {		
+	    if(project != null && project.isOpen()){
+	    	try {	        	
+	            IProjectNature n = project.getNature(ESBOX_PYTHON_NATURE_ID);	            
+		        if(n instanceof ESboxPythonProjectNature){
+		            return true;
+		        }
+		    } catch (CoreException e) {
+		        PythonUIActivator.getDefault().log(e);
+		    }
+	    }	   
+	    return false;
+	}
+
+	public void setCustomizedLocation(final IProject _project, final boolean _customizedLocation) throws CoreException {
+		_project.setPersistentProperty(getDefault().getCustomizedLocationQualifiedName(), Boolean.toString(_customizedLocation));
+	}
+
+	public boolean getCustomizedLocation(final IProject _project) throws CoreException {
+		String result = _project.getPersistentProperty(getDefault().getCustomizedLocationQualifiedName());
+		if (result != null) {
+			return Boolean.parseBoolean(result);
+		} else { // When the plug-in is upgraded from versions before 0.1.2
+			return true;	
+		}
+	}
+
+}

Modified: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/PythonUIActivator.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/PythonUIActivator.java	2007-10-25 19:24:42 UTC (rev 182)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/PythonUIActivator.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -13,12 +13,14 @@
 
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.indt.esbox.core.ErrorLogger;
 import org.indt.esbox.ui.UIActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.Preferences;
 
 /**
  * The activator class controls the plug-in life cycle
@@ -27,6 +29,8 @@
 
 	// The plug-in ID
 	public static final String PLUGIN_ID = "org.indt.esbox.python.ui";
+	
+	private static final int DEFAULT_TIMEOUT = 60;
 
 	// The shared instance
 	private static PythonUIActivator plugin;
@@ -122,10 +126,19 @@
 			public AbstractUIPlugin getPlugin() {
 				return UIActivator.getDefault();
 			}
-
 		}
-
 		return new UIErrorLogger();
 	}
 
+	
+	/**
+	 * Return the shell sessions preferences node in the instance scope
+	 */
+	public Preferences getInstancePreferences() {
+		return new InstanceScope().getNode(getBundle().getSymbolicName());
+	}
+	
+	public int getTimeout() {
+		return DEFAULT_TIMEOUT;
+	}	
 }

Added: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonCommonProjectWizard.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonCommonProjectWizard.java	                        (rev 0)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonCommonProjectWizard.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -0,0 +1,584 @@
+package org.indt.esbox.python.ui.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
+import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
+import org.eclipse.cdt.managedbuilder.ui.wizards.CfgHolder;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.newui.UIMessages;
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.eclipse.cdt.ui.templateengine.TemplateEngineUIUtil;
+import org.eclipse.cdt.ui.templateengine.pages.UIWizardPage;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+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.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.indt.esbox.core.CoreActivator;
+import org.indt.esbox.core.ESboxPreferenceConstants;
+import org.indt.esbox.core.ESboxProjectProperties;
+import org.indt.esbox.core.ErrorLogger;
+import org.indt.esbox.core.scratchbox.ScratchboxException;
+import org.indt.esbox.core.scratchbox.ScratchboxFacade;
+import org.indt.esbox.python.ui.ESboxPythonProjectNature;
+import org.indt.esbox.ui.ESboxConfigHandler;
+import org.indt.esbox.ui.UIActivator;
+import org.python.pydev.plugin.PydevPlugin;
+import org.python.pydev.plugin.nature.PythonNature;
+import org.python.pydev.ui.perspective.PythonPerspectiveFactory;
+
+public abstract class ESboxPythonCommonProjectWizard extends Wizard implements INewWizard {
+
+	 private IWorkbench workbench;
+	 protected IStructuredSelection selection;  
+	
+	private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$
+	private static final String PROP_VAL = PROPERTY + ".debug"; //$NON-NLS-1$
+	private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$
+	private static final String OP_ERROR= "CProjectWizard.op_error"; //$NON-NLS-1$
+	private static final String title= CUIPlugin.getResourceString(OP_ERROR + ".title"); //$NON-NLS-1$
+	private static final String message= CUIPlugin.getResourceString(OP_ERROR + ".message"); //$NON-NLS-1$
+	private static final String[] EMPTY_ARR = new String[0]; 
+	
+	protected IConfigurationElement fConfigElement;
+	protected CfgHolder[] cfgs = new CfgHolder[0];
+	protected ESboxPythonMainWizardPage fMainPage;
+	protected ESboxPythonConfigWizardPage configPage;
+	
+	protected IProject newProject;
+	private String wz_title;
+	private String wz_desc;
+	
+	private boolean existingPath = false;
+	private String lastProjectName = null;
+	private IPath lastProjectLocation = null;
+	private ESboxConfigHandler esboxHandler;
+	private IWizardPage[] templatePages;
+	
+	protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
+	
+	/**
+	 * Construct a new wizard.
+	 */
+	public ESboxPythonCommonProjectWizard() {
+		this(UIMessages.getString("NewModelProjectWizard.0"),UIMessages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Construct a new wizard with the given title and description.
+	 * @param title the title of the wizard.
+	 * @param desc the description of the wizard.
+	 */
+	public ESboxPythonCommonProjectWizard(String title, String desc) {
+		super();
+		setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
+		setNeedsProgressMonitor(true);
+		setForcePreviousAndNextButtons(true);
+		wz_title = title;
+		wz_desc = desc;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+	 */
+    public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
+        this.workbench = workbench;
+        this.selection = currentSelection;
+        initializeDefaultPageImageDescriptor();
+    }
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.wizard.Wizard#addPages()
+	 */
+	public void addPages() {
+		fMainPage= new ESboxPythonMainWizardPage(CUIPlugin.getResourceString(PREFIX));		
+		fMainPage.setTitle(wz_title);
+		fMainPage.setDescription(wz_desc);
+		esboxHandler = fMainPage.getHandler();
+		addPage(fMainPage);
+		
+	}
+
+	/**
+	 * @return true if user has changed settings since project creation
+	 */
+	private boolean isChanged() {
+
+		if (!fMainPage.getProjectName().equals(lastProjectName))
+			return true;
+			
+		IPath projectLocation = fMainPage.getProjectLocation();
+		if (projectLocation == null) {
+			if (lastProjectLocation != null)
+				return true;
+		} else if (!projectLocation.equals(lastProjectLocation))
+			return true;
+		
+		return true; 
+	}
+	
+    /**
+     * Set Python logo to top bar
+     */
+    protected void initializeDefaultPageImageDescriptor() {
+        ImageDescriptor desc = PydevPlugin.imageDescriptorFromPlugin(PydevPlugin.getPluginID(), "icons/python_logo.png");//$NON-NLS-1$
+        setDefaultPageImageDescriptor(desc);
+    }
+
+
+	/**
+	 * Remove created project either after error
+	 * or if user returned back from config page. 
+	 */
+	private void clearProject() {
+		if (lastProjectName == null) return;
+		try {
+			ResourcesPlugin.getWorkspace().getRoot().getProject(lastProjectName).delete(!existingPath, true, null);
+		} catch (CoreException ignore) {}
+		newProject = null;
+		lastProjectName = null;
+		lastProjectLocation = null;
+	}
+	
+	private boolean invokeRunnable(IRunnableWithProgress runnable) {
+		IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(runnable);
+		try {
+			getContainer().run(true, true, op);
+		} catch (InvocationTargetException e) {
+			CUIPlugin.errorDialog(getShell(), title, message, e.getTargetException(), false);
+			clearProject();
+			return false;
+		} catch  (InterruptedException e) {
+			clearProject();
+			return false;
+		}
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
+	 */
+	public boolean performFinish() {
+
+		// create project if it is not created yet
+//		if (getProject(fMainPage.isCurrent(), true) == null) 
+//			return false;
+//		try {
+		createNewProject();
+		// Switch to default perspective
+		IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+
+		try {
+			workbench.showPerspective(PythonPerspectiveFactory.PERSPECTIVE_ID, window);
+		} catch (WorkbenchException we) {
+			we.printStackTrace();
+		}
+			//setCreated();
+			
+//		} catch (Exception e) {
+//			// TODO log or display a message
+//			e.printStackTrace();
+//			return false;
+//		}
+//		BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
+//		selectAndReveal(newProject);
+		return true;
+	}
+	
+	protected boolean setCreated() throws CoreException {
+		setSourceFolder();
+		
+		ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();		
+		ICProjectDescription des = mngr.getProjectDescription(newProject, false);
+				
+		if (des != null) {
+			if(des.isCdtProjectCreating()){
+				des = mngr.getProjectDescription(newProject, true);
+				des.setCdtProjectCreated();
+				mngr.setProjectDescription(newProject, des, false, null);
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	private void setSourceFolder() throws CModelException {
+		ICProject cProject = CoreModel.getDefault().create(newProject);
+		IPath projPath = newProject.getFullPath();
+		String targetPath = "src";
+		
+		IPathEntry[] entries = cProject.getRawPathEntries();
+		List/*<IPathEntry>*/ newEntries = new ArrayList/*<IPathEntry>*/(entries.length + 1);
+
+		int projectEntryIndex= -1;
+		IPath path = projPath.append(targetPath);
+
+		newEntries.add(CoreModel.newSourceEntry(path));
+
+		cProject.setRawPathEntries((IPathEntry[])newEntries.toArray(new IPathEntry[newEntries.size()]), new NullProgressMonitor());
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.wizard.Wizard#performCancel()
+	 */
+    public boolean performCancel() {
+    	clearProject();
+        return true;
+    }
+
+	public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+		fConfigElement= config;
+	}
+
+	private IRunnableWithProgress getRunnable(boolean _defaults, final boolean onFinish) {
+		final boolean defaults = _defaults;
+		return new IRunnableWithProgress() {
+			public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
+				getShell().getDisplay().syncExec(new Runnable() {
+					public void run() { 
+						try {
+							newProject = createIProject(lastProjectName, lastProjectLocation);
+						    if (newProject != null)
+							  setProject(newProject, new NullProgressMonitor());							  
+						} catch (CoreException e) {	e.printStackTrace(); CUIPlugin.getDefault().log(e); }
+					}
+				});
+			}
+		};
+	}
+
+	/**
+	 * 
+	 */	
+	public IProject createIProject(final String name, final IPath location) throws CoreException{
+		if (newProject != null)	return newProject;
+
+		IWorkspace workspace = ResourcesPlugin.getWorkspace();
+		IWorkspaceRoot root = workspace.getRoot();
+		final IProject newProjectHandle = root.getProject(name);
+		
+		if (!newProjectHandle.exists()) {
+			IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
+			if(location != null) {
+				description.setLocation(location);			
+			}
+			newProject = createNewProject();
+		} else {
+			IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+				public void run(IProgressMonitor monitor) throws CoreException {
+					newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+				}
+			};
+			NullProgressMonitor monitor = new NullProgressMonitor();
+			workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor);
+			newProject = newProjectHandle;
+		}
+        
+		// Open the project if we have to
+		if (!newProject.isOpen()) {
+			newProject.open(new NullProgressMonitor());
+		}
+		return continueCreation(newProject);	
+	}
+	
+    /**
+     * Creates a project resource given the project handle and description.
+     * 
+     * @param description the project description to create a project resource for
+     * @param projectHandle the project handle to create a project resource for
+     * @param monitor the progress monitor to show visual progress with
+     * @param projectType
+     * 
+     * @exception CoreException if the operation fails
+     * @exception OperationCanceledException if the operation is canceled
+     */
+    private void createProject(IProjectDescription description, IProject projectHandle, IProgressMonitor monitor, String projectType) throws CoreException, OperationCanceledException {
+        try {
+            monitor.beginTask("", 2000); //$NON-NLS-1$
+
+            projectHandle.create(description, new SubProgressMonitor(monitor, 1000));
+
+            if (monitor.isCanceled()){
+                throw new OperationCanceledException();
+            }
+
+            projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000));
+
+            String projectPythonpath = null;
+            //also, after creating the project, create a default source folder and add it to the pythonpath.
+            if(fMainPage.shouldCreatSourceFolder()){
+                IFolder folder = projectHandle.getFolder("src");
+                folder.create(true, true, monitor);
+            
+                projectPythonpath = folder.getFullPath().toString();
+            }            
+            //we should rebuild the path even if there's no source-folder (this way we will re-create the astmanager)
+            PythonNature.addNature(projectHandle, null, projectType, projectPythonpath);            
+        } finally {
+            monitor.done();
+        }
+    }
+
+    /**
+     * Creates a new project resource with the entered name.
+     * 
+     * @return the created project resource, or <code>null</code> if the project was not created
+     */
+    private IProject createNewProject() {    	
+        // get a project handle
+        final IProject newProjectHandle = fMainPage.getProjectHandle();
+                
+        // get a project descriptor
+        IPath newPath = Platform.getLocation();
+//        IPath newPath = fMainPage.getLocationPath();
+//        if (defaultPath.equals(newPath)){
+//            newPath = null;
+//        }
+        
+        IWorkspace workspace = ResourcesPlugin.getWorkspace();
+        final IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
+        description.setLocation(newPath);
+
+        
+        final String projectType = "python";
+        // define the operation to create a new project
+        WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+            protected void execute(IProgressMonitor monitor) throws CoreException {
+                createProject(description, newProjectHandle, monitor, projectType);
+            }
+        };
+
+        // run the operation to create a new project
+        try {
+            getContainer().run(true, true, op);
+        } catch (InterruptedException e) {
+            return null;
+        } catch (InvocationTargetException e) {
+            Throwable t = e.getTargetException();
+            if (t instanceof CoreException) {
+                if (((CoreException) t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
+                    MessageDialog.openError(getShell(), "IDEWorkbenchMessages.CreateProjectWizard_errorTitle", "IDEWorkbenchMessages.CreateProjectWizard_caseVariantExistsError");
+                } else {
+                    ErrorDialog.openError(getShell(), "IDEWorkbenchMessages.CreateProjectWizard_errorTitle", null, ((CoreException) t).getStatus());
+                }
+            } else {
+                // Unexpected runtime exceptions and errors may still occur.
+                PydevPlugin.log(IStatus.ERROR, t.toString(), t);
+                MessageDialog.openError(getShell(), "IDEWorkbenchMessages.CreateProjectWizard_errorTitle", t.getMessage());
+            }
+            return null;
+        }
+        
+        newProject = newProjectHandle;
+        
+        return newProjectHandle;
+    }
+	
+	protected abstract IProject continueCreation(IProject prj); 
+	public abstract String[] getNatures();
+	
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
+	 */
+	public IWizardPage getNextPage(IWizardPage page) {
+		if (page == fMainPage) {
+			configPage = new ESboxPythonConfigWizardPage(esboxHandler);
+			configPage.setWizard(this);
+			
+			Template template = fMainPage.getHandler().getTemplate();				
+			templatePages = template.getTemplateWizardPages(fMainPage, configPage, this);
+			
+			for (int i = 0; i < templatePages.length; i++) {
+				IWizardPage templatePage = templatePages[i];
+				templatePage.setImageDescriptor(UIActivator.getImageDescriptor("./icons/new_maemo_prj_wiz.gif"));
+				this.addPage(templatePage);
+			}
+			this.addPage(configPage);
+		}
+		return super.getNextPage(page);
+	}
+	
+	public void dispose() {
+		fMainPage.dispose();
+	}
+
+    /**
+     * Returns last project name used for creation
+     */
+	public String getLastProjectName() {
+		return lastProjectName;
+	}
+
+	public IPath getLastProjectLocation() {
+		return lastProjectLocation;
+	}
+
+	public IProject getLastProject() {
+		return newProject;
+	}
+
+	// Methods below should provide data for language check
+	public String[] getLanguageIDs (){
+		return EMPTY_ARR;
+	}
+	public String[] getContentTypeIDs (){
+		return EMPTY_ARR;
+	}
+	public String[] getExtensions (){
+		return EMPTY_ARR;
+	}
+	
+	public void setProject(IProject project, IProgressMonitor monitor) throws CoreException {			
+		ESboxProjectProperties projectProperties = ESboxProjectProperties.getInstance();
+		
+		projectProperties.setMaemoSDK(project, esboxHandler.getSdkInfo().getVersion());
+		projectProperties.setPlatform(project, esboxHandler.getPlatformInfo().getName());
+		projectProperties.setTargetName(project, esboxHandler.getTargetName());
+		
+		doPostProcess(project);
+		
+	}
+	
+	public String getBuildSystemId(){
+		return null;
+	}
+	
+	protected void doPostProcess(IProject prj) {
+
+		configureScratchbox();
+		if (newProject != null)
+			configureTemplate();
+	}
+
+	private void configureScratchbox() {
+		String targetName = esboxHandler.getTargetName();
+		List<String> targets = null;
+		try {
+			targets = ScratchboxFacade.getInstance().getTargets();
+			if (!targets.contains(targetName)) {
+				String title = "Scratchbox target creation";
+				String message = "There is no suitable Scratchbox target for your project settings. " +
+						"Do you wish to create it?";
+				boolean canCreateTarget = MessageDialog.openQuestion(getShell(), title, message);
+				if (canCreateTarget)
+					createScratchboxTarget();
+			}
+		} catch (ScratchboxException e) {
+			ErrorLogger errorLogger = UIActivator.getDefault().getErrorLogger();
+			errorLogger.logAndShowError("Scratchbox error", e);
+			clearProject();
+		}
+	}
+	
+	private void createScratchboxTarget() {
+		
+	}
+	
+	private void configureTemplate() {
+		Template template = getInitializedTemplate(getMainPageData());
+		if(template == null)
+			return;
+
+		List configs = new ArrayList();
+		for(int i = 0; i < cfgs.length; i++){
+			configs.add(cfgs[i].getConfiguration());
+		}
+		template.getTemplateInfo().setConfigurations(configs);
+
+		IStatus[] statuses = template.executeTemplateProcesses(null, false);
+	    if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) {
+	    	TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException());
+	    }
+	}
+	
+	public Template getInitializedTemplate(Map map) {		
+		Template template = esboxHandler.getTemplate();
+		
+		if(template != null){
+			Map/*<String, String>*/ valueStore = template.getValueStore();
+			for(int i=0; i < templatePages.length; i++) {
+				IWizardPage page = templatePages[i];
+				if (page instanceof UIWizardPage)
+					valueStore.putAll(((UIWizardPage)page).getPageData());
+			}
+			if (map != null) {
+				valueStore.putAll(map);
+			}
+		}
+		return template;
+	}
+	
+	private Map getMainPageData() {
+		Map data = new HashMap();
+		String projName = fMainPage.getProjectName();
+		projName = projName != null ? projName.trim() : "";  //$NON-NLS-1$ 
+		data.put("projectName", projName); //$NON-NLS-1$
+		data.put("baseName", getBaseName(projName)); //$NON-NLS-1$
+		data.put("baseNameUpper", getBaseName(projName).toUpperCase() ); //$NON-NLS-1$
+		data.put("baseNameLower", getBaseName(projName).toLowerCase() ); //$NON-NLS-1$
+		data.put("projectLocation",newProject.getLocation().toOSString());
+		data.put("targetName", ESboxProjectProperties.getInstance().getTargetName(newProject));
+		data.put("sboxRoot", CoreActivator.getDefault().getPreferenceStore().getString(ESboxPreferenceConstants.SBOX_SANDBOX.toString()));
+		String location = fMainPage.getProjectLocationPath();
+		if(location == null)
+			location = "";  //$NON-NLS-1$
+		data.put("location", location); //getProjectLocation().toPortableString()); //$NON-NLS-1$
+		return data;
+	}
+	
+	private String getBaseName(String name) {
+		String baseName = name;
+		int dot = baseName.lastIndexOf('.');
+		if (dot != -1) {
+			baseName = baseName.substring(dot + 1);
+		}
+		dot = baseName.indexOf(' ');
+		if (dot != -1) {
+			baseName = baseName.substring(0, dot);
+		}
+		return baseName;
+	}
+	
+}

Added: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonConfigWizardPage.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonConfigWizardPage.java	                        (rev 0)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonConfigWizardPage.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -0,0 +1,269 @@
+/*******************************************************************************
+ * Copyright (c) 2007 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+ *    Carolina Nogueira de Souza (carolina at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.indt.esbox.python.ui.wizards;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.ui.wizards.CfgHolder;
+import org.eclipse.cdt.ui.newui.UIMessages;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.indt.esbox.core.ErrorLogger;
+import org.indt.esbox.core.scratchbox.ScratchboxException;
+import org.indt.esbox.core.scratchbox.ScratchboxFacade;
+import org.indt.esbox.ui.ESboxConfigHandler;
+import org.indt.esbox.ui.UIActivator;
+
+public class ESboxPythonConfigWizardPage extends WizardPage {
+
+	public static final String PAGE_ID = "org.indt.esbox.ui.wizard.ConfigWizardPage"; //$NON-NLS-1$
+	private static final String TITLE = UIMessages.getString("CConfigWizardPage.0"); //$NON-NLS-1$
+	private static final String MESSAGE = UIMessages.getString("CConfigWizardPage.1"); //$NON-NLS-1$
+	private static final String COMMENT = UIMessages.getString("CConfigWizardPage.12"); //$NON-NLS-1$
+	private static final String EMPTY_STR = "";  //$NON-NLS-1$
+	
+	private Table table;
+	//private CheckboxTableViewer tv;
+	private Label l_projtype;
+	private Label l_chain;
+	private Label l_platform;
+	private Label l_maemoSDK;
+	private Composite parent;
+	private TableColumn column;
+
+	private String propertyId;
+	public boolean isVisible = false;
+	private ESboxConfigHandler esboxHandler;
+	public boolean pagesLoaded = false;
+	
+	/**
+	 * Constructor.
+	 * @param esboxHandler handler of ESbox project configuration.
+	 */
+	public ESboxPythonConfigWizardPage(ESboxConfigHandler esboxHandler) {
+        super(UIMessages.getString("CDTConfigWizardPage.0")); //$NON-NLS-1$
+        setPageComplete(false);
+        setImageDescriptor(UIActivator.getImageDescriptor("./icons/new_maemo_prj_wiz.gif"));
+        setPageComplete(true);
+        this.esboxHandler = esboxHandler;        
+    }
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite p) {
+		parent = new Composite(p, SWT.NONE);
+		parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+		parent.setLayout(new GridLayout(3, false));
+		
+		setupLabel(parent, UIMessages.getString("CConfigWizardPage.4"), 1, GridData.BEGINNING); //$NON-NLS-1$
+		l_projtype = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
+		setupLabel(parent, UIMessages.getString("CConfigWizardPage.5"), 1, GridData.BEGINNING); //$NON-NLS-1$
+		l_chain = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
+		setupLabel(parent, "Platform:", 1, GridData.BEGINNING); //$NON-NLS-1$
+		l_platform = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
+		setupLabel(parent, "Maemo SDK:", 1, GridData.BEGINNING); //$NON-NLS-1$
+		l_maemoSDK = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
+		setupLabel(parent, "Targets: ", 3, GridData.BEGINNING); //$NON-NLS-1$
+		
+		table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+		GridData gd = new GridData(GridData.FILL_BOTH);
+		gd.horizontalSpan = 2;
+		table.setLayoutData(gd);
+		column = new TableColumn(table,SWT.LEFT);
+		table.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				// target selected
+				setErrorMessage(null);
+				setMessage(MESSAGE);
+				esboxHandler.setTargetName(table.getSelection()[0].getText());
+				setPageComplete(true);
+			}
+		});		
+		
+		Composite c = new Composite(parent, SWT.NONE);
+		c.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+		c.setLayout(new GridLayout(1, false));
+
+		// dummy placeholder
+		new Label(c, 0).setLayoutData(new GridData(GridData.FILL_BOTH));
+		
+		Button b3 = new Button(c, SWT.PUSH);
+		b3.setText(UIMessages.getString("CConfigWizardPage.13")); //$NON-NLS-1$
+		b3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		b3.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+			//	advancedDialog();
+			}});
+		
+		Group gr = new Group(parent, SWT.NONE);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		gr.setLayoutData(gd);
+		gr.setLayout(new FillLayout());
+		Label lb = new Label(gr, SWT.NONE);
+		lb.setText(COMMENT);
+	}
+	
+
+	/**
+	 * 
+	 * @param handler
+	 * @return
+	 */
+	static public CfgHolder[] getDefaultCfgs(ESboxConfigHandler handler) {
+		IToolChain tc = handler.getESboxToolChain();		 
+		ArrayList out = new ArrayList(2);
+		IProjectType pt = handler.getProjectType();
+		CfgHolder[] cfgs = null;
+		
+		if (pt != null) 
+			cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tc, pt));
+		else {
+			cfgs = new CfgHolder[1];
+			cfgs[0] = new CfgHolder(tc, null);	
+		}
+					
+		for (int j=0; j<cfgs.length; j++) {
+			if (cfgs[j].isSystem() || !cfgs[j].isSupported()) continue;
+			out.add(cfgs[j]);
+		}
+		
+		return (CfgHolder[])out.toArray(new CfgHolder[out.size()]);
+	}
+	
+    /**
+     * Returns whether this page's controls currently all contain valid 
+     * values.
+     *
+     * @return <code>true</code> if all controls are valid, and
+     *   <code>false</code> if at least one is invalid
+     */
+    public boolean isCustomPageComplete() {
+    	if (!isVisible) return true;
+    	
+		if (table.getItemCount() == 0) {
+			String message = UIMessages.getString("CConfigWizardPage.10");
+			setErrorMessage(message); //$NON-NLS-1$
+			setMessage(message);
+			return false;
+		}
+        return true;
+    }
+
+    /**
+     * Set the visibility of this wizard page.
+     */
+    public void setVisible(boolean visible) {
+    	isVisible = visible;
+		if (visible && esboxHandler != null) {
+			initTable();
+			
+			l_projtype.setText(esboxHandler.getTemplate().getLabel());
+			l_chain.setText(esboxHandler.getESboxToolChain().getName());
+			l_platform.setText(esboxHandler.getPlatformInfo().getName());
+			l_maemoSDK.setText(esboxHandler.getSdkInfo().toString());
+			setPageComplete(isCustomPageComplete());
+		}
+		parent.setVisible(visible);
+		if (visible) update();
+    }
+    
+    private void initTable() {
+    	if (table.getItems().length > 0)
+    		return;
+    	List<String> targets = null;
+		String projectTargetName = "";
+		try {
+			targets = ScratchboxFacade.getInstance().getTargets();
+			projectTargetName = esboxHandler.createTargetName();
+		} catch (ScratchboxException e) {
+			ErrorLogger errorLogger = UIActivator.getDefault().getErrorLogger();
+			errorLogger.logAndShowError("Scratchbox error", e);
+		} catch (Exception e) {			
+			e.printStackTrace();
+		}
+		TableItem line = null;
+		//sorts the target list
+		Object[] targetsName = targets.toArray();		
+		Arrays.sort(targetsName);
+		int projectTargetIndex = -1;
+		for (int i = 0; i < targetsName.length; i++) {
+			//sets the values of the lines			
+			String element = (String)targetsName[i];			
+			line = new TableItem(table, SWT.NONE);			
+			line.setText(element);
+			if (element.equals(projectTargetName)) {
+				projectTargetIndex = i;
+			}
+		}		
+		if (projectTargetIndex < 0) {
+			String localMessage = "There is no suitable target for your project. Please, select an target for your project";
+			setErrorMessage(localMessage);
+			setMessage(localMessage);
+			setPageComplete(false);
+			projectTargetIndex = 0;
+		}
+		column.pack();
+		table.setSelection(projectTargetIndex);
+		esboxHandler.setTargetName(table.getSelection()[0].getText());
+    }
+
+    	//------------------------
+    private Label setupLabel(Composite c, String name, int span, int mode) {
+		Label l = new Label(c, SWT.NONE);
+		l.setText(name);
+		GridData gd = new GridData(mode);
+		gd.horizontalSpan = span;
+		l.setLayoutData(gd);
+		Composite p = l.getParent();
+		l.setFont(p.getFont());
+		return l;
+	}
+
+	public String getName() { return TITLE; }
+	public Control getControl() { return parent; }
+	public String getTitle()   { return TITLE; }
+	
+		@Override
+	public boolean isPageComplete() {
+		return super.isPageComplete() && (getErrorMessage() == null);
+	}
+
+
+	protected void update() {
+		getWizard().getContainer().updateButtons();
+		getWizard().getContainer().updateMessage();
+		getWizard().getContainer().updateTitleBar();
+	}	
+
+}

Added: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonMainWizardPage.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonMainWizardPage.java	                        (rev 0)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonMainWizardPage.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -0,0 +1,567 @@
+package org.indt.esbox.python.ui.wizards;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.ui.newui.UIMessages;
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.eclipse.cdt.ui.wizards.EntryDescriptor;
+import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
+import org.eclipse.cdt.ui.wizards.IWizardWithMemory;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.PlatformUI;
+import org.indt.esbox.core.maemosdk.MaemoSDKEngine;
+import org.indt.esbox.core.maemosdk.MaemoSDKInfo;
+import org.indt.esbox.core.platform.PlatformEngine;
+import org.indt.esbox.core.platform.PlatformInfo;
+import org.indt.esbox.ui.ESboxConfigHandler;
+import org.indt.esbox.ui.UIActivator;
+import org.indt.esbox.ui.wizards.ESboxProjectContentsArea;
+import org.indt.esbox.ui.wizards.ESboxProjectContentsArea.IErrorMessageReporter;
+
+public class ESboxPythonMainWizardPage extends WizardPage implements IWizardItemsListListener {
+
+	private static final Image IMG_CATEGORY = CPluginImages.get(CPluginImages.IMG_OBJS_SEARCHFOLDER);
+	private static final Image IMG_ITEM = CPluginImages.get(CPluginImages.IMG_OBJS_VARIABLE);
+	private static final Image IMG_MAEMO_SDK = CPluginImages.get(CPluginImages.IMG_OBJS_LIBRARY);
+	private static final Image IMG_PLATFORM = CPluginImages.get(CPluginImages.IMG_VIEW_BUILD);
+
+	private static final String AUTOMAKE_PROJECT_TYPE = UIActivator.PLUGIN_ID + ".projectType.automake";
+	private static final String MAKEFILE_PROJECT_TYPE = UIActivator.PLUGIN_ID + ".projectType.makefile";
+	private static final String CPP_PROJECT_TYPE = UIActivator.PLUGIN_ID + ".projectType.cpp";
+
+	public static final String PAGE_ID = "org.indt.esbox.ui.wizard.ProjectWizardPage"; //$NON-NLS-1$
+	public static final String DESC = "EntryDescriptor"; //$NON-NLS-1$ 
+	private static final String HELP_CTX = "org.eclipse.ui.ide.new_project_wizard_page_context"; //$NON-NLS-1$
+	
+    // constants
+    private static final int SIZING_TEXT_FIELD_WIDTH = 250;
+    
+	// widgets
+	private Text projectNameField;
+	private Tree treeProjectTypes;
+	private Tree treePlatform;
+	private Tree treeSDK;
+    private Button checkSrcFolder;  
+    private boolean checkSrcFolderSelected = true;
+    
+	// initial value stores
+	private String initialProjectFieldValue;
+
+	private ESboxConfigHandler esboxHandler;
+	private ESboxProjectContentsArea locationArea;   
+
+	/**
+	 * Creates a new project creation wizard page.
+	 *
+	 * @param pageName the name of this page
+	 */
+	public ESboxPythonMainWizardPage(String pageName) {
+		super(pageName);
+		setPageComplete(false);        
+		setImageDescriptor(UIActivator.getImageDescriptor("./icons/new_maemo_prj_wiz.gif"));
+		esboxHandler = new ESboxConfigHandler();
+	}
+	  /** (non-Javadoc)
+     * Method declared on IDialogPage.
+     */
+    public void createControl(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NULL);
+        composite.setFont(parent.getFont());
+
+        initializeDialogUnits(parent);
+        PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CTX);
+
+        composite.setLayout(new GridLayout());
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+        createProjectNameGroup(composite);
+        locationArea = new ESboxProjectContentsArea(getErrorReporter(), composite);
+        if(initialProjectFieldValue != null) {
+			locationArea.updateProjectName(initialProjectFieldValue);
+		}
+        
+		// Scale the button based on the rest of the dialog
+		setButtonLayoutData(locationArea.getBrowseButton());
+		
+		createDynamicGroup(composite); 
+		
+		setPageComplete(validatePage());
+        // Show description on opening
+        setErrorMessage(null);
+        setMessage(null);
+        setControl(composite);
+    }
+    
+    private void createDynamicGroup(Composite parent) {
+        Composite c = new Composite(parent, SWT.NONE);
+        c.setFont(parent.getFont());
+        c.setLayoutData(new GridData(GridData.FILL_BOTH));
+    	c.setLayout(new GridLayout(2, true));    	
+    	    	
+    	createLeftSide(c);
+    	
+    	createRigthSide(c);     
+    }
+    
+    private void createRigthSide(Composite parent) {
+        Composite right = new Composite(parent, SWT.NONE);
+        right.setLayoutData(new GridData(GridData.FILL_BOTH));
+        right.setLayout(new GridLayout());
+        
+        Label l2 = new Label(right, SWT.NONE);
+        l2.setText("Platforms:"); 
+        l2.setFont(parent.getFont());
+        l2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+                
+        treePlatform = new Tree(right, SWT.SINGLE | SWT.BORDER);        
+        treePlatform.setLayoutData(new GridData(GridData.FILL_BOTH));
+        treePlatform.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				TreeItem[] ti = treePlatform.getSelection();
+				if (ti.length > 0)
+					esboxHandler.setPlatformInfo((PlatformInfo)ti[0].getData());
+				setPageComplete(validatePage());
+			}});
+        
+        fillTreePlatform();
+        
+        Label l3 = new Label(right, SWT.NONE);
+        l3.setText("SDKs:"); 
+        l3.setFont(parent.getFont());
+        l3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+                
+        treeSDK = new Tree(right, SWT.SINGLE | SWT.BORDER);
+        treeSDK.setLayoutData(new GridData(GridData.FILL_BOTH));
+        treeSDK.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				TreeItem[] ti = treeSDK.getSelection();
+				if (ti.length > 0)
+					esboxHandler.setSdkInfo((MaemoSDKInfo)ti[0].getData());
+				setPageComplete(validatePage());
+			}});
+        
+        fillTreeMaemoSDK();
+    }
+    
+    private void fillTreePlatform() {
+    	List platforms = PlatformEngine.getInstance().getPlatforms();	
+    	for (Object object : platforms) {
+    		PlatformInfo platformInfo = (PlatformInfo)object;
+    		TreeItem ti = new TreeItem(treePlatform, SWT.NONE);
+    		ti.setText(platformInfo.toString());
+    		ti.setData(platformInfo);
+    		ti.setImage(IMG_PLATFORM);    		
+		}   	
+    	
+    }
+    
+    private void fillTreeMaemoSDK() {
+    	List maemoSDKs = MaemoSDKEngine.getInstance().getMaemoSDKS();	
+    	for (Object object : maemoSDKs) {
+    		MaemoSDKInfo maemoSDKInfo = (MaemoSDKInfo)object;
+    		TreeItem ti = new TreeItem(treeSDK, SWT.NONE);
+    		ti.setText(maemoSDKInfo.toString());
+    		ti.setData(maemoSDKInfo);
+    		ti.setImage(IMG_MAEMO_SDK);    		
+		}   	
+    	
+    }
+                                   
+    
+    private void createLeftSide(Composite parent) {
+    	Composite left = new Composite(parent, SWT.NONE);
+        left.setLayoutData(new GridData(GridData.FILL_BOTH));
+        left.setLayout(new GridLayout());
+    	        
+        Label l1 = new Label(left, SWT.NONE);
+        l1.setText(UIMessages.getString("CMainWizardPage.0")); //$NON-NLS-1$
+        l1.setFont(parent.getFont());
+        l1.setLayoutData(new GridData(GridData.BEGINNING));
+            	
+        treeProjectTypes = new Tree(left, SWT.SINGLE | SWT.BORDER);
+        treeProjectTypes.setLayoutData(new GridData(GridData.FILL_BOTH));
+        treeProjectTypes.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				TreeItem[] ti = treeProjectTypes.getSelection();
+				if (ti.length > 0)
+					esboxHandler.setTemplate((Template)ti[0].getData());
+				setPageComplete(validatePage());
+			}});
+        treeProjectTypes.getAccessible().addAccessibleListener(
+				 new AccessibleAdapter() {                       
+	                 public void getName(AccessibleEvent e) {
+	                         e.result = UIMessages.getString("CMainWizardPage.0"); //$NON-NLS-1$
+	                 }
+	             }
+			 );
+        
+        fillProjectTypeTree();
+    }
+    
+    private void fillProjectTypeTree() {
+    	TreeItem tipExe = new TreeItem(treeProjectTypes, SWT.NONE);
+    	tipExe.setText("Automake Projects");
+    	tipExe.setImage(IMG_CATEGORY); 
+    	
+    	TreeItem tipMake = new TreeItem(treeProjectTypes, SWT.NONE);
+    	tipMake.setText("Makefile Projects");
+    	tipMake.setImage(IMG_CATEGORY); 
+    	
+    	TreeItem tipCpp = new TreeItem(treeProjectTypes, SWT.NONE);
+    	tipCpp.setText("C++ Hildon Projects");
+    	tipCpp.setImage(IMG_CATEGORY); 
+
+    	Template[] templates = UIActivator.getDefault().getTemplates();
+    	for (int i = 0; i < templates.length; i++) {    		
+			Template template = templates[i];
+			if (isESboxTemplate(template.getTemplateInfo().getTemplateId())) {
+				String projectType = template.getTemplateInfo().getProjectType();
+				TreeItem tip = null;
+				if (projectType.equals(AUTOMAKE_PROJECT_TYPE)) {
+					tip = new TreeItem(tipExe, SWT.NONE);	    		
+				} else if (projectType.equals(MAKEFILE_PROJECT_TYPE)) {
+					tip = new TreeItem(tipMake, SWT.NONE);	
+				} else if (projectType.equals(CPP_PROJECT_TYPE)) {
+					tip = new TreeItem(tipCpp, SWT.NONE);	
+				}
+				tip.setText(template.getLabel());
+	    		tip.setData(template);
+	    		tip.setImage(IMG_ITEM); 			
+			}
+		}    	
+    }
+    
+    private boolean isESboxTemplate(String template) {
+    	return template.startsWith(UIActivator.PLUGIN_ID);
+    }
+    
+    /**
+	 * Get an error reporter for the receiver.
+	 * @return IErrorMessageReporter
+	 */
+	private IErrorMessageReporter getErrorReporter() {
+		return new IErrorMessageReporter(){
+			public void reportError(String errorMessage) {
+				setErrorMessage(errorMessage);
+				boolean valid = errorMessage == null;
+				if(valid) valid = validatePage();
+				setPageComplete(valid);
+			}
+		};
+	}
+	    
+    /**
+     * Creates the project name specification controls.
+     *
+     * @param parent the parent composite
+     */
+    private final void createProjectNameGroup(Composite parent) {
+        // project specification group
+        Composite projectGroup = new Composite(parent, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        projectGroup.setLayout(layout);
+        projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        // new project label
+        Label projectLabel = new Label(projectGroup, SWT.NONE);
+        projectLabel.setText(UIMessages.getString("CMainWizardPage.8")); //$NON-NLS-1$
+        projectLabel.setFont(parent.getFont());
+
+        // new project name entry field
+        projectNameField = new Text(projectGroup, SWT.BORDER);
+        GridData data = new GridData(GridData.FILL_HORIZONTAL);
+        data.widthHint = SIZING_TEXT_FIELD_WIDTH;
+        projectNameField.setLayoutData(data);
+        projectNameField.setFont(parent.getFont());
+
+        // Set the initial value first before listener
+        // to avoid handling an event during the creation.
+        if (initialProjectFieldValue != null) {
+			projectNameField.setText(initialProjectFieldValue);
+		}
+        projectNameField.addListener(SWT.Modify, new Listener() {
+	        public void handleEvent(Event e) {
+		    	locationArea.updateProjectName(getProjectNameFieldValue());
+	            setPageComplete(validatePage());
+	        }
+	    });
+        
+        Font font = parent.getFont();
+        checkSrcFolder = new Button(projectGroup , SWT.CHECK);
+		checkSrcFolder.setText("Cr&eate default 'src' folder");
+		checkSrcFolder.setSelection(true);
+		checkSrcFolder.setFont(font);
+		checkSrcFolder.addSelectionListener( new SelectionAdapter() {
+			public void widgetDefaultSelected(SelectionEvent e) {
+				if(e.widget == checkSrcFolder){
+					checkSrcFolderSelected = checkSrcFolder.getSelection();
+				}					
+			}        	
+		});
+    }
+
+	public boolean shouldCreatSourceFolder() {
+		return checkSrcFolderSelected;
+	}
+
+    
+    /**
+     * Creates a project resource handle for the current project name field value.
+     * <p>
+     * This method does not create the project resource; this is the responsibility
+     * of <code>IProject::create</code> invoked by the new project resource wizard.
+     * </p>
+     *
+     * @return the new project resource handle
+     */
+    protected IProject getProjectHandle() {
+    	return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
+    }
+
+    /**
+     * Returns the current project name as entered by the user, or its anticipated
+     * initial value.
+     *
+     * @return the project name, its anticipated initial value, or <code>null</code>
+     *   if no project name is known
+     */
+    
+    public String getProjectName() {
+        if (projectNameField == null) {
+			return initialProjectFieldValue;
+		}
+        return getProjectNameFieldValue();
+    }
+
+    public IPath getProjectLocation() {
+    	return new Path(locationArea.getProjectLocation());
+    }
+
+    public String getProjectLocationPath() {
+    	return locationArea.getProjectLocation();
+    }
+
+    /**
+     * Returns the value of the project name field
+     * with leading and trailing spaces removed.
+     * 
+     * @return the project name in the field
+     */
+    private String getProjectNameFieldValue() {
+        if (projectNameField == null) {
+			return ""; //$NON-NLS-1$
+		}
+
+        return projectNameField.getText().trim();
+    }
+
+    /**
+     * Sets the initial project name that this page will use when
+     * created. The name is ignored if the createControl(Composite)
+     * method has already been called. Leading and trailing spaces
+     * in the name are ignored.
+     * Providing the name of an existing project will not necessarily 
+     * cause the wizard to warn the user.  Callers of this method 
+     * should first check if the project name passed already exists 
+     * in the workspace.
+     * 
+     * @param name initial project name for this page
+     * 
+     * @see IWorkspace#validateName(String, int)
+     * 
+     */
+    public void setInitialProjectName(String name) {
+        if (name == null) {
+			initialProjectFieldValue = null;
+		} else {
+            initialProjectFieldValue = name.trim();
+            if(locationArea != null) {
+				locationArea.updateProjectName(name.trim());
+			}
+        }
+    }
+
+    /**
+     * Returns whether this page's controls currently all contain valid 
+     * values.
+     *
+     * @return <code>true</code> if all controls are valid, and
+     *   <code>false</code> if at least one is invalid
+     */
+    protected boolean validatePage() {
+        IWorkspace workspace = ResourcesPlugin.getWorkspace();
+		setMessage(null);
+
+        String projectFieldContents = getProjectNameFieldValue();
+        if (projectFieldContents.length() == 0) {
+            setErrorMessage(UIMessages.getString("CMainWizardPage.9")); //$NON-NLS-1$
+            return false;
+        }
+
+        IStatus nameStatus = workspace.validateName(projectFieldContents,
+                IResource.PROJECT);
+        if (!nameStatus.isOK()) {
+            setErrorMessage(nameStatus.getMessage());
+            return false;
+        }
+
+        boolean bad = true; // should we treat existing project as error
+        
+        IProject handle = getProjectHandle();
+        
+        if (handle.exists()) {
+        	if (getWizard() instanceof IWizardWithMemory) {
+        		IWizardWithMemory w = (IWizardWithMemory)getWizard();
+        		if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName()))
+        			bad = false;
+        	}
+        	if (bad) { 
+        		setErrorMessage(UIMessages.getString("CMainWizardPage.10")); //$NON-NLS-1$
+        	    return false;
+        	}
+        }
+
+        if (bad) { // skip this check if project already created 
+        	IPath p = getProjectLocation();
+        	if (p == null) {
+        		p = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+        		p = p.append(getProjectName());
+        	}
+        	File f = p.toFile();
+        	if (f.exists()) {
+        		if (f.isDirectory()) {
+        			setMessage(UIMessages.getString("CMainWizardPage.7"), DialogPage.WARNING); //$NON-NLS-1$
+	        		return true;
+        		} else {
+        			setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$
+	        		return false;
+        		}
+        	}
+        }
+        
+        if (!locationArea.isDefault()) {
+            IStatus locationStatus = workspace.validateProjectLocationURI(handle,
+                    locationArea.getProjectLocationURI());
+            if (!locationStatus.isOK()) {
+                setErrorMessage(locationStatus.getMessage());
+                return false;
+            }
+        }
+
+        if (treeProjectTypes.getItemCount() == 0) {
+        	setErrorMessage(UIMessages.getString("CMainWizardPage.3")); //$NON-NLS-1$
+        	return false;
+        }        
+        
+        if (treePlatform.getItemCount() == 0) {
+        	setErrorMessage("No platforms available. Project cannot be created"); 
+        	return false;
+        }
+        
+        if (treeSDK.getItemCount() == 0) {
+        	setErrorMessage("No Maemo SDKs available. Project cannot be created");
+        	return false;
+        }
+        
+
+		TreeItem[] tis = treeProjectTypes.getSelection();
+		if (tis == null || tis.length == 0) {
+        	setErrorMessage("No project type selected");
+        	return false;
+		}
+		
+		tis = treePlatform.getSelection();
+		if (tis == null || tis.length == 0) {
+        	setErrorMessage("No platform selected");
+        	return false;
+		}
+		
+		tis = treeSDK.getSelection();
+		if (tis == null || tis.length == 0) {
+        	setErrorMessage("No Maemo SDK selected");
+        	return false;
+		}		
+                             
+        setErrorMessage(null);
+        return true;
+    }
+
+    /*
+     * see @DialogPage.setVisible(boolean)
+     */
+    public void setVisible(boolean visible) {
+        super.setVisible(visible);
+        if (visible) projectNameField.setFocus();
+    }
+
+    /**
+     * Returns the useDefaults.
+     * @return boolean
+     */
+    public boolean useDefaults() {
+        return locationArea.isDefault();
+    }
+
+	public static EntryDescriptor getDescriptor(Tree _tree) {		
+		TreeItem[] sel = _tree.getSelection();
+		if (sel == null || sel.length == 0) 
+			return null;
+		else
+			return (EntryDescriptor)sel[0].getData(DESC);
+	}
+	
+	public void toolChainListChanged(int count) {
+		setPageComplete(validatePage());
+	}
+
+	public boolean isCurrent() { 
+		return isCurrentPage(); 
+	}
+	
+	private static Image calcImage(EntryDescriptor ed) {
+		if (ed.getImage() != null) return ed.getImage();
+		if (ed.isCategory()) return IMG_CATEGORY;
+		return IMG_ITEM;
+	}
+	
+	public ESboxConfigHandler getHandler() {
+		return esboxHandler; 
+	}
+	
+	@Override
+	public IWizardPage getNextPage() {
+		// TODO Auto-generated method stub
+		return super.getNextPage();
+	}
+	
+	
+}

Deleted: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectNature.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectNature.java	2007-10-25 19:24:42 UTC (rev 182)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectNature.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -1,300 +0,0 @@
-package org.indt.esbox.python.ui.wizards;
-/*******************************************************************************
- * Copyright (c) 2007 INdT.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
- *    Paulo Romulo (paulo at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
- *    Carolina Nogueira (carolina at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
- *******************************************************************************/
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-import org.indt.esbox.core.CoreActivator;
-import org.indt.esbox.python.ui.PythonUIActivator;
-
-
-public class ESboxPythonProjectNature implements IProjectNature {
-
-	private IProject project;
-	
-	private static ESboxPythonProjectNature instance;
-	
-	
-	
-	/*
-	 * id of ESbox Python Project
-	 * org.indt.esbox.core.esboxPythonNature
-	 */
-	public final String ESBOX_PYTHON_NATURE_ID = CoreActivator.getUniqueIdentifier() + ".esboxPythonNature";
-	
-	public  final String DEFAULT_PRIVATE_KEY_FILE = System.getProperty("user.home") + File.separator + ".ssh" + File.separator + "id_dsa";
-	
-    /**
-     * constant that stores the name of the python version we are using for the project with this nature
-     */
-    private QualifiedName projectSessionLocation = null;
-    
-    private QualifiedName projectConnection = null;
-    
-    private QualifiedName projectRemotePath = null;
-    
-    private QualifiedName projectPrivateKeyFile = null;
-    
-    private QualifiedName customizedLocation = null;
-    
-    private ESboxPythonProjectNature() {}
-    
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static  ESboxPythonProjectNature getDefault() {
-		return instance;
-	}	
-    
-    public synchronized QualifiedName getProjectSessionNameQualifiedName() {
-        if(projectSessionLocation == null){
-            //we need to do this because the plugin ID may not be known on '' time
-        	projectSessionLocation = new QualifiedName(CoreActivator.PLUGIN_ID, "ESBOX_PYTHON_PROJECT_SESSION_NAME");
-        }
-        return projectSessionLocation;
-    }
-    
-    public synchronized QualifiedName getProjectConnectionQualifiedName() {
-        if(projectConnection == null){
-            //we need to do this because the plugin ID may not be known on '' time
-        	projectConnection = new QualifiedName(CoreActivator.PLUGIN_ID, "ESBOX_PYTHON_PROJECT_CONNECTION");
-        }
-        return projectConnection;
-    }
-    
-    public synchronized QualifiedName getProjectRemotePathQualifiedName() {
-        if(projectRemotePath == null){
-            //we need to do this because the plugin ID may not be known on '' time
-        	projectRemotePath = new QualifiedName(CoreActivator.PLUGIN_ID, "ESBOX_PYTHON_PROJECT_REMOTE_PATH");
-        }
-        return projectRemotePath;
-    }
-    
-    public synchronized QualifiedName getPrivateKeyFileQualifiedName() {
-        if(projectPrivateKeyFile == null){
-            //we need to do this because the plugin ID may not be known on '' time
-        	projectPrivateKeyFile = new QualifiedName(CoreActivator.PLUGIN_ID, "ESBOX_PYTHON_PROJECT_PRIVATE_KEY_FILE");
-        }
-        return projectPrivateKeyFile;
-    }
-    
-    public synchronized QualifiedName getCustomizedLocationQualifiedName() {
-        if(customizedLocation == null){
-            //we need to do this because the plugin ID may not be known on '' time
-        	customizedLocation = new QualifiedName(CoreActivator.PLUGIN_ID, "ESBOXPYTHON_PROJECT_CUSTOMIZED_LOCATION");
-        }
-        return customizedLocation;
-    }
-    
-    /**
-	 * Adds the ESbox Python project nature to a given project.
-	 * @param _project the project to add the nature.
-	 * @param _monitor a progress monitor to indicate the duration of the operation,
-	 *            or <code>null</code> if progress reporting is not required.
-	 * @throws CoreException if something goes wrong.
-	 */
-	public void addESboxPythonNature(final IProject _project, final String _location, final IProgressMonitor _monitor) throws CoreException {
-		ESboxPythonProjectNature.getDefault().addNature(_project, ESBOX_PYTHON_NATURE_ID, _monitor, _location);		
-	}
-
-	/** 
-	 * Removes the ESbox Python project nature to a given project.
-	 * @param project the project to add the nature.
-	 * @param mon a progress monitor to indicate the duration of the operation,
-	 *            or <code>null</code> if progress reporting is not required.
-	 * @throws CoreException if something goes wrong.
-	 */
-	public void removeESboxPythonNature(IProject project, IProgressMonitor mon) throws CoreException {
-		removeNature(project, ESBOX_PYTHON_NATURE_ID, mon);
-	}
-
-	/**
-	 * Utility method for adding a nature to a project.
-	 * 
-	 * @param proj
-	 *            the project to add the nature
-	 * @param _natureId
-	 *            the id of the nature to assign to the project
-	 * @param _monitor
-	 *            a progress monitor to indicate the duration of the operation,
-	 *            or <code>null</code> if progress reporting is not required.
-	 *  
-	 */
-	public void addNature(final IProject _project,
-			final String _natureId, final IProgressMonitor _monitor,
-			final String _location) throws CoreException {
-		
-		IProjectDescription description = _project.getDescription(); 
-		if (description.hasNature(_natureId)){
-			return;
-		}
-		String[] ids 	= description.getNatureIds();
-		String[] newIds = new String[ids.length + 1];
-		System.arraycopy(ids, 0, newIds, 0, ids.length);
-		newIds[ids.length] = _natureId;
-		description.setNatureIds(newIds);
-		_project.setDescription(description, null);
-		
-		ESboxPythonProjectNature.getDefault().setProjectPrivateKeyFile(_project, DEFAULT_PRIVATE_KEY_FILE);
-		ESboxPythonProjectNature.getDefault().setProjectSessionLocation(_project, _location);
-		ESboxPythonProjectNature.getDefault().setCustomizedLocation(_project, false);
-	}
-
-	/**
-	 * Utility method for removing a project nature from a project.
-	 * 
-	 * @param proj
-	 *            the project to remove the nature from
-	 * @param natureId
-	 *            the nature id to remove
-	 * @param monitor
-	 *            a progress monitor to indicate the duration of the operation,
-	 *            or <code>null</code> if progress reporting is not required.
-	 */
-	public void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
-		IProjectDescription description = project.getDescription();
-		if (!description.hasNature(natureId))
-			return;
-		String[] ids = description.getNatureIds();
-		for (int i = 0; i < ids.length; ++i) {
-			if (ids[i].equals(natureId)) {
-				String[] newIds = new String[ids.length - 1];
-				System.arraycopy(ids, 0, newIds, 0, i);
-				System.arraycopy(ids, i + 1, newIds, i, ids.length - i - 1);
-				description.setNatureIds(newIds);
-				project.setDescription(description, null);
-			}
-		}
-		
-		setProjectRemotePath(project, null);
-		setProjectSessionLocation(project, null);	
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.resources.IProjectNature#configure()
-	 */
-	public void configure() throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.resources.IProjectNature#deconfigure()
-	 */
-	public void deconfigure() throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.resources.IProjectNature#getProject()
-	 */
-	public IProject getProject() {
-		return project;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
-	 */
-	public void setProject(IProject project) {
-		this.project = project;
-	}
-	
-	/**
-	 * 
-	 * @param project
-	 * @return
-	 */
-	public boolean isESboxPythonProject(IProject project) {		
-	    if(project != null && project.isOpen()){
-	    	try {	        	
-	            IProjectNature n = project.getNature(ESBOX_PYTHON_NATURE_ID);	            
-		        if(n instanceof ESboxPythonProjectNature){
-		            return true;
-		        }
-		    } catch (CoreException e) {
-		        PythonUIActivator.getDefault().log(e);
-		    }
-	    }	   
-	    return false;
-	}
-	
-	public String getProjectSessionLocation(IProject project) throws CoreException {
-		return project.getPersistentProperty(getDefault().getProjectSessionNameQualifiedName());
-	}
-	
-	public void setProjectSessionLocation(IProject project, String location) throws CoreException {		
-//		Connection previousConnection = getProjectConnection(project);
-//		if((previousConnection != null) && previousConnection.isEstablished())
-//			previousConnection.close();
-//		previousConnection = null;
-//		project.setPersistentProperty(getProjectSessionNameQualifiedName(),location);
-//		if(location == null) {
-//			setProjectConnection(project, null);
-//			return;
-//		}
-//		SessionLocation sessionLocation = null;
-//		try { 
-//			sessionLocation = (SessionLocation) KnownSessions.getInstance().getSession(location);			
-//			setProjectConnection(project, sessionLocation.openConnection(new NullProgressMonitor()));
-//		} catch(SSHException e) {
-//			setProjectConnection(project,null);
-//			CoreActivator.getDefault().showError(e, "Error", "Cannot open SSH session to host " + sessionLocation.toString());			
-//		}		
-	}
-	
-//	public  Connection getProjectConnection(IProject project) throws CoreException {
-//		return (Connection)project.getSessionProperty(getProjectConnectionQualifiedName());
-//	}
-//	
-//	public  void setProjectConnection(IProject project, Connection connection) throws CoreException {		
-//		project.setSessionProperty(getProjectConnectionQualifiedName(),connection);
-//	}
-	
-	public String getProjectRemotePath(IProject project) throws CoreException {		
-		return project.getPersistentProperty(getDefault().getProjectRemotePathQualifiedName());
-	}
-	
-	public void setProjectRemotePath(IProject project, String remotePath) throws CoreException {		
-		project.setPersistentProperty(getDefault().getProjectRemotePathQualifiedName(),remotePath);
-	}
-	
-	public String getProjectPrivateKeyFile(IProject project) throws CoreException {		
-		return project.getPersistentProperty(getDefault().getPrivateKeyFileQualifiedName());
-	}
-	
-	public void setProjectPrivateKeyFile(IProject project, String privateKeyFileName) throws CoreException {		
-		project.setPersistentProperty(getDefault().getPrivateKeyFileQualifiedName(),privateKeyFileName);
-	}
-
-	public void setCustomizedLocation(final IProject _project, final boolean _customizedLocation) throws CoreException {
-		_project.setPersistentProperty(getDefault().getCustomizedLocationQualifiedName(), Boolean.toString(_customizedLocation));
-	}
-
-	public boolean getCustomizedLocation(final IProject _project) throws CoreException {
-		String result = _project.getPersistentProperty(getDefault().getCustomizedLocationQualifiedName());
-		if (result != null) {
-			return Boolean.parseBoolean(result);
-		} else { // When the plug-in is upgraded from versions before 0.1.2
-			return true;	
-		}
-	}
-
-}

Deleted: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectWizard.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectWizard.java	2007-10-25 19:24:42 UTC (rev 182)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/ESboxPythonProjectWizard.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -1,320 +0,0 @@
-package org.indt.esbox.python.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
-import org.python.pydev.plugin.PydevPlugin;
-import org.python.pydev.plugin.nature.PythonNature;
-import org.python.pydev.ui.perspective.PythonPerspectiveFactory;
-
-public class ESboxPythonProjectWizard extends Wizard implements INewWizard {
-	 	
-	     private IWorkbench workbench;
-	     
-	  //   private ISessionLocation session;
-	     
-	     private boolean isNewSession;
-	     
-	     protected IStructuredSelection selection;    
-	     
-	     protected IProject generatedProject;
-	     
-	 	protected NewPythonProjectWizardPage projectPage;
-	 	
-	// 	protected SessionSelectionPage sessionSelectionPage;
-	 	
-	 	//protected ConfigurationWizardMainPage newSessionPage;
-	 	
-	 	protected WizardNewProjectReferencePage referencePage;
-	 	
-	 	public ESboxPythonProjectWizard() {
-	 		super();
-	 		setNeedsProgressMonitor(true);
-	 	}
-	 	
-	 	/*
-	 	 * (non-Javadoc)
-	 	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
-	 	 */
-	     public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
-	         this.workbench = workbench;
-	         this.selection = currentSelection;
-	         initializeDefaultPageImageDescriptor();
-	     }
-
-	     /**
-	      * Add wizard pages to the instance
-	      * 
-	      * @see org.eclipse.jface.wizard.IWizard#addPages()
-	      */
-	     public void addPages() {   
-	     	projectPage = new NewPythonProjectWizardPage("ESbox Project Page");
-	     	projectPage.setTitle("Python Maemo Project");
-	     	projectPage.setDescription("Creates a new Python Maemo Project");
-	         addPage(projectPage);
-	         
-//	         ISessionLocation[] sessions = KnownSessions.getInstance().getSessions();
-//	         if(sessions.length > 0) {
-//	             sessionSelectionPage = new SessionSelectionPage("Python Maemo Session Selection Page","Python Maemo Project",null);        
-//	             sessionSelectionPage.setDescription("Select a session for your Python Maemo project");
-//	             addPage(sessionSelectionPage);        
-//	         }
-//	         
-//	         newSessionPage = new ConfigurationWizardMainPage("Python Maemo New Session Page","Python Maemo Project",null);
-//	         newSessionPage.setDescription("Create a session for your Python Maemo project");
-//	         addPage(newSessionPage);
-	                
-	         // only add page if there are already projects in the workspace
-	         if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0) {
-	             referencePage = new WizardNewProjectReferencePage("Reference Page");
-	             referencePage.setTitle("Reference page");
-	             referencePage.setDescription("Select referenced projects");
-	             addPage(referencePage);
-	         }
-
-	     }
-
-	     /**
-	      * Creates a project resource given the project handle and description.
-	      * 
-	      * @param description the project description to create a project resource for
-	      * @param projectHandle the project handle to create a project resource for
-	      * @param monitor the progress monitor to show visual progress with
-	      * @param projectType
-	      * 
-	      * @exception CoreException if the operation fails
-	      * @exception OperationCanceledException if the operation is canceled
-	      */
-	     private void createProject(IProjectDescription description, IProject projectHandle, IProgressMonitor monitor, String projectType) throws CoreException, OperationCanceledException {
-	         try {
-	             monitor.beginTask("", 2000); //$NON-NLS-1$
-
-	             projectHandle.create(description, new SubProgressMonitor(monitor, 1000));
-
-	             if (monitor.isCanceled()){
-	                 throw new OperationCanceledException();
-	             }
-
-	             projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000));
-
-	             String projectPythonpath = null;
-	             //also, after creating the project, create a default source folder and add it to the pythonpath.
-	             if(projectPage.shouldCreatSourceFolder()){
-	                 IFolder folder = projectHandle.getFolder("src");
-	                 folder.create(true, true, monitor);
-	             
-	                 projectPythonpath = folder.getFullPath().toString();
-	             }
-	             
-	             //we should rebuild the path even if there's no source-folder (this way we will re-create the astmanager)
-	             PythonNature.addNature(projectHandle, null, projectType, projectPythonpath);
-	             ESboxPythonProjectNature.getDefault().addESboxPythonNature(projectHandle, /*session.getLocation(false)*/null,monitor);
-	         } finally {
-	             monitor.done();
-	         }
-	     }
-
-	     /**
-	      * Creates a new project resource with the entered name.
-	      * 
-	      * @return the created project resource, or <code>null</code> if the project was not created
-	      */
-	     private IProject createNewProject() {    	
-	         // get a project handle
-	         final IProject newProjectHandle = projectPage.getProjectHandle();
-	                 
-	         // get a project descriptor
-	         IPath defaultPath = Platform.getLocation();
-	         IPath newPath = projectPage.getLocationPath();
-	         if (defaultPath.equals(newPath)){
-	             newPath = null;
-	         }
-	         
-	         IWorkspace workspace = ResourcesPlugin.getWorkspace();
-	         final IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
-	         description.setLocation(newPath);
-	         
-	         // update the referenced project if provided
-	         if (referencePage != null) {
-	             IProject[] refProjects = referencePage.getReferencedProjects();
-	             if (refProjects.length > 0)
-	                 description.setReferencedProjects(refProjects);
-	         }
-
-	         final String projectType = "python";
-	         // define the operation to create a new project
-	         WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-	             protected void execute(IProgressMonitor monitor) throws CoreException {
-	                 createProject(description, newProjectHandle, monitor, projectType);
-	             }
-	         };
-
-	         // run the operation to create a new project
-	         try {
-	             getContainer().run(true, true, op);
-	         } catch (InterruptedException e) {
-	             return null;
-	         } catch (InvocationTargetException e) {
-	             Throwable t = e.getTargetException();
-	             if (t instanceof CoreException) {
-	                 if (((CoreException) t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
-	                     MessageDialog.openError(getShell(), "IDEWorkbenchMessages.CreateProjectWizard_errorTitle", "IDEWorkbenchMessages.CreateProjectWizard_caseVariantExistsError");
-	                 } else {
-	                     ErrorDialog.openError(getShell(), "IDEWorkbenchMessages.CreateProjectWizard_errorTitle", null, ((CoreException) t).getStatus());
-	                 }
-	             } else {
-	                 // Unexpected runtime exceptions and errors may still occur.
-	                 PydevPlugin.log(IStatus.ERROR, t.toString(), t);
-	                 MessageDialog.openError(getShell(), "IDEWorkbenchMessages.CreateProjectWizard_errorTitle", t.getMessage());
-	             }
-	             return null;
-	         }
-	         
-	         generatedProject = newProjectHandle;
-	         
-	         return newProjectHandle;
-	     }
-
-	     /**
-	      * The user clicked Finish button
-	      * 
-	      * Launches another thread to create Python project. A progress monitor is shown in the UI thread.
-	      */
-	     public boolean performFinish() {
-	     	checkRepository();
-	         createNewProject();
-
-	         // Switch to default perspective
-	         IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
-
-	         try {
-	             workbench.showPerspective(PythonPerspectiveFactory.PERSPECTIVE_ID, window);
-	         } catch (WorkbenchException we) {
-	             we.printStackTrace();
-	         }
-	                 
-	         return true;
-	     }
-
-	     /**
-	      * Set Python logo to top bar
-	      */
-	     protected void initializeDefaultPageImageDescriptor() {
-	         ImageDescriptor desc = PydevPlugin.imageDescriptorFromPlugin(PydevPlugin.getPluginID(), "icons/python_logo.png");//$NON-NLS-1$
-	         setDefaultPageImageDescriptor(desc);
-	     }
-
-	     /*
-	      * (non-Javadoc)
-	      * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
-	      */
-	 	public IWizardPage getNextPage(IWizardPage page) {
-//	 		if (page == sessionSelectionPage) {
-//	 			if (sessionSelectionPage.getLocation() == null) {
-//	 				return newSessionPage;
-//	 			} else {
-//	 				try {
-//	 					session = getLocation();					
-//	 					newSessionPage.setPageComplete(true);
-//	 					return super.getNextPage(newSessionPage);
-//	 				} catch (SSHException e) {
-//	 					PythonUIActivator.getDefault().log(e);
-//	 				}				
-//	 			}			
-//	 		} else { 
-//	 			if (page == newSessionPage) {
-//	 				try {
-//	 					session = getLocation();
-//	 				} catch (SSHException e) {
-//	 					PythonUIActivator.getDefault().log(e);
-//	 				}
-//	 			}
-//	 		}		
-	 		return super.getNextPage(page);
-	 	}  
-	 	
-	 	@Override
-	 	public boolean performCancel() {
-//	 		if (session != null && isNewSession) {
-//	 			KnownSessions.getInstance().disposeSession(session);
-//	 			session = null;
-//	 		}	
-	 		return super.performCancel();
-	 		
-	 	}  
-	 	
-	 	private void checkRepository() {	
-//	 		if (isNewSession) {
-//	 			KnownSessions.getInstance().addSession(session, true /* broadcast */);
-//	 		}
-	 	}
-	 	
-//	 	private ISessionLocation getLocation() throws SSHException {
-//	 		// If the location page has a location, use it.
-//	 		if (sessionSelectionPage != null) {
-//	 			ISessionLocation newLocation = sessionSelectionPage.getLocation();
-//	 			if (newLocation != null) {
-//	 				return recordLocation(newLocation);
-//	 			}
-//	 		}
-//	 		
-//	 		// Otherwise, get the location from the create location page
-//	 		final ISessionLocation[] locations = new ISessionLocation[] { null };
-//	 		final SSHException[] exception = new SSHException[] { null };
-//	 		getShell().getDisplay().syncExec(new Runnable() {
-//	 			public void run() {
-//	 				try {
-//	 					locations[0] = newSessionPage.getLocation();
-//	 				} catch (SSHException e) {
-//	 					exception[0] = e;
-//	 				}
-//	 			}
-//	 		});
-//	 		if (exception[0] != null) {
-//	 			throw exception[0];
-//	 		}
-//	 		return recordLocation(locations[0]);
-//	 	}
-
-//	 	private ISessionLocation recordLocation(ISessionLocation newSession) {
-//	 		if (newSession == null) return session;
-//	 		if (session == null || !newSession.equals(session)) {
-//	 			if (session != null && isNewSession) {
-//	 				// Dispose of the previous location
-//	 				KnownSessions.getInstance().disposeSession(session);
-//	 			}
-//	 			session = newSession;
-//	 			isNewSession = !KnownSessions.getInstance().isKnownSession(newSession.getLocation(false));
-//	 			if (isNewSession) {
-//	 				// Add the location silently so we can work with it
-//	 				session = KnownSessions.getInstance().addSession(session, false /* silently */);
-//	 			}
-//	 		}
-//	 		return session;
-//	 	}
-}

Deleted: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/NewPythonProjectWizardPage.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/NewPythonProjectWizardPage.java	2007-10-25 19:24:42 UTC (rev 182)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/NewPythonProjectWizardPage.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -1,710 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 INdT.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
- *     Carolina Nogueira de Souza (carolina at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
- *******************************************************************************/
-package org.indt.esbox.python.ui.wizards;
-
-import java.util.List;
-
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.ui.newui.UIMessages;
-import org.eclipse.cdt.ui.templateengine.Template;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
-import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
-import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
-import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils;
-import org.indt.esbox.core.maemosdk.MaemoSDKEngine;
-import org.indt.esbox.core.maemosdk.MaemoSDKInfo;
-import org.indt.esbox.core.platform.PlatformEngine;
-import org.indt.esbox.core.platform.PlatformInfo;
-import org.indt.esbox.ui.ESboxConfigHandler;
-import org.indt.esbox.ui.UIActivator;
-import org.indt.esbox.ui.wizards.ESboxProjectContentsArea;
-import org.indt.esbox.ui.wizards.ESboxProjectContentsArea.IErrorMessageReporter;
-
-/**
- * @author Raul Fernandes Herbster - raulherbster at embedded dot ufcg dot com dot br
- *
- */
-public class NewPythonProjectWizardPage extends WizardPage {
-
-	// Whether to use default or custom project location
-	private boolean useDefaults = true;
-
-	// initial value stores
-	private String initialProjectFieldValue;
-	private IPath initialLocationFieldValue;
-
-	// the value the user has entered
-	private String customLocationFieldValue;
-
-	// widgets
-	private Tree treeProjectTypes;
-	private Tree treePlatform;
-	private Tree treeSDK;
-	private Text projectNameField;
-	private Text locationPathField;
-	private Label locationLabel;
-	private Button browseButton;    
-	private Button checkSrcFolder;    
-	private boolean checkSrcFolderSelected = true;
-
-	private ESboxConfigHandler esboxHandler;
-	private ESboxProjectContentsArea locationArea;   
-
-	private static final Image IMG_CATEGORY = CPluginImages.get(CPluginImages.IMG_OBJS_SEARCHFOLDER);
-	private static final Image IMG_ITEM = CPluginImages.get(CPluginImages.IMG_OBJS_VARIABLE);
-	private static final Image IMG_MAEMO_SDK = CPluginImages.get(CPluginImages.IMG_OBJS_LIBRARY);
-	private static final Image IMG_PLATFORM = CPluginImages.get(CPluginImages.IMG_VIEW_BUILD);
-
-	private static final String AUTOMAKE_PROJECT_TYPE = UIActivator.PLUGIN_ID + ".projectType.automake";
-	private static final String MAKEFILE_PROJECT_TYPE = UIActivator.PLUGIN_ID + ".projectType.makefile";
-	private static final String CPP_PROJECT_TYPE = UIActivator.PLUGIN_ID + ".projectType.cpp";
-	
-
-	private static final String HELP_CTX = "org.eclipse.ui.ide.new_project_wizard_page_context"; //$NON-NLS-1$
-
-	private Listener nameModifyListener = new Listener() {
-		public void handleEvent(Event e) {
-			setLocationForSelection();
-			setPageComplete(validatePage());
-		}
-	};
-
-	private Listener locationModifyListener = new Listener() {
-		public void handleEvent(Event e) {
-			setPageComplete(validatePage());
-		}
-	};
-
-	// constants
-	private static final int SIZING_TEXT_FIELD_WIDTH = 250;
-
-	/**
-	 * Creates a new project creation wizard page.
-	 *
-	 * @param pageName the name of this page
-	 */
-	public NewPythonProjectWizardPage(String pageName) {
-		super(pageName);
-		setPageComplete(false);
-		initialLocationFieldValue = Platform.getLocation();
-		customLocationFieldValue = ""; //$NON-NLS-1$
-	}
-
-	/* (non-Javadoc)
-	 * Method declared on IWizardPage
-	 */
-	public boolean canFlipToNextPage() {
-		// Already know there is a next page...
-		return isPageComplete();
-	}
-
-	/* (non-Javadoc)
-	 * Method declared on IDialogPage.
-	 */
-	public void createControl(Composite parente) {
-		Composite composite = new Composite(parente, SWT.NULL);
-		composite.setLayout(new GridLayout());
-		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-		composite.setFont(parente.getFont());
-
-		PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
-				IIDEHelpContextIds.NEW_PROJECT_WIZARD_PAGE);
-		createOptions(composite);
-		validatePage();
-
-		// Show description on opening
-		setErrorMessage(null);
-		setMessage(null);
-		setControl(composite);
-	}
-
-
-	private void createOptions(Composite parent) {
-
-		Composite composite = new Composite(parent, SWT.NULL);
-		composite.setFont(parent.getFont());
-
-		initializeDialogUnits(parent);
-		PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CTX);
-
-		composite.setLayout(new GridLayout());
-		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
-		createProjectNameGroup(composite);
-		locationArea = new ESboxProjectContentsArea(getErrorReporter(), composite);
-		if(initialProjectFieldValue != null) {
-			locationArea.updateProjectName(initialProjectFieldValue);
-		}
-
-		// Scale the button based on the rest of the dialog
-		setButtonLayoutData(locationArea.getBrowseButton());
-
-		createDynamicGroup(composite); 
-	}
-
-	private void createDynamicGroup(Composite parent) {
-		Composite c = new Composite(parent, SWT.NONE);
-		c.setFont(parent.getFont());
-		c.setLayoutData(new GridData(GridData.FILL_BOTH));
-		c.setLayout(new GridLayout(2, true));    	
-
-		createLeftSide(c);
-
-		createRigthSide(c);     
-	}
-
-	private void createLeftSide(Composite parent) {
-		Composite left = new Composite(parent, SWT.NONE);
-		left.setLayoutData(new GridData(GridData.FILL_BOTH));
-		left.setLayout(new GridLayout());
-
-		Label l1 = new Label(left, SWT.NONE);
-		l1.setText(UIMessages.getString("CMainWizardPage.0")); //$NON-NLS-1$
-		l1.setFont(parent.getFont());
-		l1.setLayoutData(new GridData(GridData.BEGINNING));
-
-		treeProjectTypes = new Tree(left, SWT.SINGLE | SWT.BORDER);
-		treeProjectTypes.setLayoutData(new GridData(GridData.FILL_BOTH));
-		treeProjectTypes.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				TreeItem[] ti = treeProjectTypes.getSelection();
-				if (ti.length > 0)
-					esboxHandler.setTemplate((Template)ti[0].getData());
-				setPageComplete(validatePage());
-			}});
-		treeProjectTypes.getAccessible().addAccessibleListener(
-				new AccessibleAdapter() {                       
-					public void getName(AccessibleEvent e) {
-						e.result = UIMessages.getString("CMainWizardPage.0"); //$NON-NLS-1$
-					}
-				}
-		);
-
-		fillProjectTypeTree();
-	}
-
-    private void createRigthSide(Composite parent) {
-        Composite right = new Composite(parent, SWT.NONE);
-        right.setLayoutData(new GridData(GridData.FILL_BOTH));
-        right.setLayout(new GridLayout());
-        
-        Label l2 = new Label(right, SWT.NONE);
-        l2.setText("Platforms:"); 
-        l2.setFont(parent.getFont());
-        l2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-                
-        treePlatform = new Tree(right, SWT.SINGLE | SWT.BORDER);        
-        treePlatform.setLayoutData(new GridData(GridData.FILL_BOTH));
-        treePlatform.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				TreeItem[] ti = treePlatform.getSelection();
-				if (ti.length > 0)
-					esboxHandler.setPlatformInfo((PlatformInfo)ti[0].getData());
-				setPageComplete(validatePage());
-			}});
-        
-        fillTreePlatform();
-        
-        Label l3 = new Label(right, SWT.NONE);
-        l3.setText("SDKs:"); 
-        l3.setFont(parent.getFont());
-        l3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-                
-        treeSDK = new Tree(right, SWT.SINGLE | SWT.BORDER);
-        treeSDK.setLayoutData(new GridData(GridData.FILL_BOTH));
-        treeSDK.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				TreeItem[] ti = treeSDK.getSelection();
-				if (ti.length > 0)
-					esboxHandler.setSdkInfo((MaemoSDKInfo)ti[0].getData());
-				setPageComplete(validatePage());
-			}});
-        
-        fillTreeMaemoSDK();
-    }
-
-	private void fillProjectTypeTree() {
-		TreeItem tipExe = new TreeItem(treeProjectTypes, SWT.NONE);
-		tipExe.setText("Automake Projects");
-		tipExe.setImage(IMG_CATEGORY); 
-
-		TreeItem tipMake = new TreeItem(treeProjectTypes, SWT.NONE);
-		tipMake.setText("Makefile Projects");
-		tipMake.setImage(IMG_CATEGORY); 
-
-		TreeItem tipCpp = new TreeItem(treeProjectTypes, SWT.NONE);
-		tipCpp.setText("C++ Hildon Projects");
-		tipCpp.setImage(IMG_CATEGORY); 
-
-		Template[] templates = UIActivator.getDefault().getTemplates();
-		for (int i = 0; i < templates.length; i++) {    		
-			Template template = templates[i];
-			if (isESboxTemplate(template.getTemplateInfo().getTemplateId())) {
-				String projectType = template.getTemplateInfo().getProjectType();
-				TreeItem tip = null;
-				if (projectType.equals(AUTOMAKE_PROJECT_TYPE)) {
-					tip = new TreeItem(tipExe, SWT.NONE);	    		
-				} else if (projectType.equals(MAKEFILE_PROJECT_TYPE)) {
-					tip = new TreeItem(tipMake, SWT.NONE);	
-				} else if (projectType.equals(CPP_PROJECT_TYPE)) {
-					tip = new TreeItem(tipCpp, SWT.NONE);	
-				}
-				tip.setText(template.getLabel());
-				tip.setData(template);
-				tip.setImage(IMG_ITEM); 			
-			}
-		}    	
-	}
-	
-	private void fillTreePlatform() {
-		List platforms = PlatformEngine.getInstance().getPlatforms();	
-		for (Object object : platforms) {
-			PlatformInfo platformInfo = (PlatformInfo)object;
-			TreeItem ti = new TreeItem(treePlatform, SWT.NONE);
-			ti.setText(platformInfo.toString());
-			ti.setData(platformInfo);
-			ti.setImage(IMG_PLATFORM);    		
-		}   	
-
-	}
-
-	private void fillTreeMaemoSDK() {
-		List maemoSDKs = MaemoSDKEngine.getInstance().getMaemoSDKS();	
-		for (Object object : maemoSDKs) {
-			MaemoSDKInfo maemoSDKInfo = (MaemoSDKInfo)object;
-			TreeItem ti = new TreeItem(treeSDK, SWT.NONE);
-			ti.setText(maemoSDKInfo.toString());
-			ti.setData(maemoSDKInfo);
-			ti.setImage(IMG_MAEMO_SDK);    		
-		}   	
-
-	}
-	
-    private boolean isESboxTemplate(String template) {
-    	return template.startsWith(UIActivator.PLUGIN_ID);
-    }
-
-
-	/**
-	 * Get an error reporter for the receiver.
-	 * @return IErrorMessageReporter
-	 */
-	private IErrorMessageReporter getErrorReporter() {
-		return new IErrorMessageReporter(){
-			public void reportError(String errorMessage) {
-				setErrorMessage(errorMessage);
-				boolean valid = errorMessage == null;
-				if(valid) valid = validatePage();
-				setPageComplete(valid);
-			}
-		};
-	}
-
-
-	private final void createProjectProperties(Composite parent) {
-		Font font = parent.getFont();
-		// project specification group
-		Composite projectGroup = new Composite(parent, SWT.NONE);
-		GridLayout layout = new GridLayout();
-		layout.numColumns = 3;
-		projectGroup.setLayout(layout);
-		projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		projectGroup.setFont(font);
-
-		checkSrcFolder = new Button(projectGroup , SWT.CHECK);
-		checkSrcFolder.setText("Cr&eate default 'src' folder");
-		checkSrcFolder.setSelection(true);
-		checkSrcFolder.setFont(font);
-		checkSrcFolder.addSelectionListener( new SelectionAdapter() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-				if(e.widget == checkSrcFolder){
-					checkSrcFolderSelected = checkSrcFolder.getSelection();
-				}					
-			}        	
-		});
-
-		GridData labelData = new GridData();
-		labelData.horizontalSpan = 3;
-		checkSrcFolder.setLayoutData(labelData);
-	}
-
-	/**
-	 * Creates the project location specification controls.
-	 *
-	 * @param parent the parent composite
-	 */
-	private final void createProjectLocationGroup(Composite parent) {
-		Font font = parent.getFont();
-		// project specification group
-		Composite projectGroup = new Composite(parent, SWT.NONE);
-		GridLayout layout = new GridLayout();
-		layout.numColumns = 3;
-		projectGroup.setLayout(layout);
-		projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		projectGroup.setFont(font);
-
-		final Button useDefaultsButton = new Button(projectGroup, SWT.CHECK
-				| SWT.RIGHT);
-		useDefaultsButton.setText(IDEWorkbenchMessages.ProjectLocationSelectionDialog_useDefaultLabel);
-		useDefaultsButton.setSelection(useDefaults);
-		useDefaultsButton.setFont(font);
-
-		GridData buttonData = new GridData();
-		buttonData.horizontalSpan = 3;
-		useDefaultsButton.setLayoutData(buttonData);
-
-		createUserSpecifiedProjectLocationGroup(projectGroup, !useDefaults);
-
-		SelectionListener listener = new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				useDefaults = useDefaultsButton.getSelection();
-				browseButton.setEnabled(!useDefaults);
-				locationPathField.setEnabled(!useDefaults);
-				locationLabel.setEnabled(!useDefaults);
-				if (useDefaults) {
-					customLocationFieldValue = locationPathField.getText();
-					setLocationForSelection();
-				} else {
-					locationPathField.setText(customLocationFieldValue);
-				}
-			}
-		};
-		useDefaultsButton.addSelectionListener(listener);
-	}
-
-	/**
-	 * Creates the project name specification controls.
-	 *
-	 * @param parent the parent composite
-	 */
-	private final void createProjectNameGroup(Composite parent) {
-		Font font = parent.getFont();
-		// project specification group
-		Composite projectGroup = new Composite(parent, SWT.NONE);
-		GridLayout layout = new GridLayout();
-		layout.numColumns = 2;
-		projectGroup.setLayout(layout);
-		projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-		// new project label
-		Label projectLabel = new Label(projectGroup, SWT.NONE);
-		projectLabel.setFont(font);
-		projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
-
-		// new project name entry field
-		projectNameField = new Text(projectGroup, SWT.BORDER);
-		GridData data = new GridData(GridData.FILL_HORIZONTAL);
-		data.widthHint = SIZING_TEXT_FIELD_WIDTH;
-		projectNameField.setLayoutData(data);
-		projectNameField.setFont(font);
-
-		// Set the initial value first before listener
-		// to avoid handling an event during the creation.
-		if (initialProjectFieldValue != null) {
-			projectNameField.setText(initialProjectFieldValue);
-		}
-		projectNameField.addListener(SWT.Modify, nameModifyListener);
-	}
-
-	/**
-	 * Creates the project location specification controls.
-	 *
-	 * @param projectGroup the parent composite
-	 * @param enabled the initial enabled state of the widgets created
-	 */
-	private void createUserSpecifiedProjectLocationGroup(
-			Composite projectGroup, boolean enabled) {
-		Font font = projectGroup.getFont();
-		// location label
-		locationLabel = new Label(projectGroup, SWT.NONE);
-		locationLabel.setFont(font);
-		locationLabel.setText(IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationLabel);
-		locationLabel.setEnabled(enabled);
-
-		// project location entry field
-		locationPathField = new Text(projectGroup, SWT.BORDER);
-		GridData data = new GridData(GridData.FILL_HORIZONTAL);
-		data.widthHint = SIZING_TEXT_FIELD_WIDTH;
-		locationPathField.setLayoutData(data);
-		locationPathField.setFont(font);
-		locationPathField.setEnabled(enabled);
-
-		// browse button
-		browseButton = new Button(projectGroup, SWT.PUSH);
-		browseButton.setFont(font);
-		browseButton.setText(IDEWorkbenchMessages.ProjectLocationSelectionDialog_browseLabel);
-		browseButton.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent event) {
-				handleLocationBrowseButtonPressed();
-			}
-		});
-
-		browseButton.setEnabled(enabled);
-
-		// Set the initial value first before listener
-		// to avoid handling an event during the creation.
-		if (initialLocationFieldValue != null) {
-			locationPathField.setText(initialLocationFieldValue.toOSString());
-		}
-		locationPathField.addListener(SWT.Modify, locationModifyListener);
-	}
-
-	/**
-	 * Returns the current project location path as entered by 
-	 * the user, or its anticipated initial value.
-	 *
-	 * @return the project location path, its anticipated initial value, or <code>null</code>
-	 *   if no project location path is known
-	 */
-	protected IPath getLocationPath() {
-		if (useDefaults) {
-			return initialLocationFieldValue;
-		}
-
-		return new Path(getProjectLocationFieldValue());
-	}
-
-	/**
-	 * Creates a project resource handle for the current project name field value.
-	 * <p>
-	 * This method does not create the project resource; this is the responsibility
-	 * of <code>IProject::create</code> invoked by the new project resource wizard.
-	 * </p>
-	 *
-	 * @return the new project resource handle
-	 */
-	protected IProject getProjectHandle() {
-		return ResourcesPlugin.getWorkspace().getRoot().getProject(
-				getProjectName());
-	}
-
-	/**
-	 * Returns the current project name as entered by the user, or its anticipated
-	 * initial value.
-	 *
-	 * @return the project name, its anticipated initial value, or <code>null</code>
-	 *   if no project name is known
-	 */
-	protected String getProjectName() {
-		if (projectNameField == null) {
-			return initialProjectFieldValue;
-		}
-
-		return getProjectNameFieldValue();
-	}
-
-	/**
-	 * Returns the value of the project name field
-	 * with leading and trailing spaces removed.
-	 * 
-	 * @return the project name in the field
-	 */
-	private String getProjectNameFieldValue() {
-		if (projectNameField == null) {
-			return IDEResourceInfoUtils.EMPTY_STRING;
-		} 
-		return projectNameField.getText().trim();
-	}
-
-	/**
-	 * Returns the value of the project location field
-	 * with leading and trailing spaces removed.
-	 * 
-	 * @return the project location directory in the field
-	 */
-	private String getProjectLocationFieldValue() {
-		if (locationPathField == null) {
-			return IDEResourceInfoUtils.EMPTY_STRING;
-		} 
-		return locationPathField.getText().trim();
-	}
-
-	/**
-	 *	Open an appropriate directory browser
-	 */
-	private void handleLocationBrowseButtonPressed() {
-		DirectoryDialog dialog = new DirectoryDialog(locationPathField
-				.getShell());
-		dialog.setMessage(IDEWorkbenchMessages.ProjectLocationSelectionDialog_directoryLabel);
-
-		String dirName = getProjectLocationFieldValue();
-		if (dirName.length() > 0) { 
-			if (IDEResourceInfoUtils.exists(dirName)) {
-				dialog.setFilterPath(new Path(dirName).toOSString());
-			}
-		}
-
-		String selectedDirectory = dialog.open();
-		if (selectedDirectory != null) {
-			customLocationFieldValue = selectedDirectory;
-			locationPathField.setText(customLocationFieldValue);
-		}
-	}
-
-	/**
-	 * Returns whether the currently specified project
-	 * content directory points to an exising project
-	 */
-	private boolean isExistingProjectLocation() {
-		IPath path = getLocationPath();
-		path = path.append(IProjectDescription.DESCRIPTION_FILE_NAME);
-		return path.toFile().exists();
-	}
-
-	/**
-	 * Sets the initial project name that this page will use when
-	 * created. The name is ignored if the createControl(Composite)
-	 * method has already been called. Leading and trailing spaces
-	 * in the name are ignored.
-	 * 
-	 * @param name initial project name for this page
-	 */
-	/* package */void setInitialProjectName(String name) {
-		if (name == null) {
-			initialProjectFieldValue = null;
-		} else {
-			initialProjectFieldValue = name.trim();
-		}
-	}
-
-	/**
-	 * Set the location to the default location if we are set to useDefaults.
-	 */
-	private void setLocationForSelection() {
-		if (useDefaults) {
-			IPath defaultPath = Platform.getLocation().append(
-					getProjectNameFieldValue());
-			locationPathField.setText(defaultPath.toOSString());
-		}
-	}
-
-	/**
-	 * Returns whether this page's controls currently all contain valid 
-	 * values.
-	 *
-	 * @return <code>true</code> if all controls are valid, and
-	 *   <code>false</code> if at least one is invalid
-	 */
-	private boolean validatePage() {
-		IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();
-
-		String projectFieldContents = getProjectNameFieldValue();
-		if (projectFieldContents.equals("")) { //$NON-NLS-1$
-			setErrorMessage(null);
-			setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty);
-			return false;
-		}
-
-		IStatus nameStatus = workspace.validateName(projectFieldContents,
-				IResource.PROJECT);
-		if (!nameStatus.isOK()) {
-			setErrorMessage(nameStatus.getMessage());
-			return false;
-		}
-
-		String locationFieldContents = getProjectLocationFieldValue();
-
-		if (locationFieldContents.equals("")) { //$NON-NLS-1$
-			setErrorMessage(null);
-			setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectLocationEmpty);
-			return false;
-		}
-
-		IPath path = new Path(""); //$NON-NLS-1$
-		if (!path.isValidPath(locationFieldContents)) {
-			setErrorMessage(IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError);
-			return false;
-		}
-		if (!useDefaults
-				&& Platform.getLocation().isPrefixOf(
-						new Path(locationFieldContents))) {
-			//IDEWorkbenchMessages.WizardNewProjectCreationPage_defaultLocationError
-			setErrorMessage("Project contents cannot be inside workspace directory");
-			return false;
-		}
-
-		if (getProjectHandle().exists()) {
-			setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage);
-			return false;
-		}
-
-		if (isExistingProjectLocation()) {
-			//IDEWorkbenchMessages.WizardNewProjectCreationPage_projectLocationExistsMessage
-			setErrorMessage("Another project exists at the specified content directory.");
-			return false;
-		}
-
-		setErrorMessage(null);
-		setMessage(null);
-		return true;
-	}
-
-	/*
-	 * see @DialogPage.setVisible(boolean)
-	 */
-	public void setVisible(boolean visible) {
-		super.setVisible(visible);
-		if (visible) {
-			projectNameField.setFocus();
-		}
-	}
-
-	/**
-	 * 
-	 * @return
-	 */
-	public boolean shouldCreatSourceFolder() {
-		return checkSrcFolderSelected;
-	}
-
-	public void widgetDefaultSelected(SelectionEvent e) {
-		if(e.widget == checkSrcFolder){
-			checkSrcFolderSelected = checkSrcFolder.getSelection();
-		}		
-	}
-
-	public void widgetSelected(SelectionEvent e) {
-		// TODO Auto-generated method stub
-
-	}
-
-}
\ No newline at end of file

Added: trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/PythonProjectWizard.java
===================================================================
--- trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/PythonProjectWizard.java	                        (rev 0)
+++ trunk/org.indt.esbox.python.ui/src/org/indt/esbox/python/ui/wizards/PythonProjectWizard.java	2007-10-25 23:31:47 UTC (rev 183)
@@ -0,0 +1,62 @@
+package org.indt.esbox.python.ui.wizards;
+
+/*******************************************************************************
+ * Copyright (c) 2007 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+ *******************************************************************************/
+import javax.management.monitor.Monitor;
+
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.indt.esbox.core.ESboxProjectNature;
+import org.indt.esbox.python.ui.ESboxPythonProjectNature;
+import org.python.pydev.plugin.nature.PythonNature;
+
+/**
+ * A wizard to create an ESbox Project.
+ */
+public class PythonProjectWizard extends ESboxPythonCommonProjectWizard {
+	
+	/**
+	 * Constructor.
+	 * Creates a wizard to new ESbox projects.
+	 */
+	public PythonProjectWizard() {
+		super("Python Maemo Project", "Create a Maemo project inside Scratchbox");
+	}
+	
+	@Override
+	public void addPages() {		
+		super.addPages();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.indt.esbox.ui.wizards.ESboxCommonProjectWizard#getNatures()
+	 */
+	public String[] getNatures() {
+		return new String[] { PythonNature.PYTHON_NATURE_ID , ESboxPythonProjectNature.ESBOX_PYTHON_NATURE_ID };
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.indt.esbox.ui.wizards.ESboxCommonProjectWizard#continueCreation(org.eclipse.core.resources.IProject)
+	 */
+	protected IProject continueCreation(IProject prj) {
+		try {			
+			ESboxPythonProjectNature.addESboxPythonNature(prj, new NullProgressMonitor());
+			
+		} catch (CoreException e) {
+			
+		}
+		return prj;
+	}
+}



More information about the Esbox-commits mailing list