[Esbox-commits] r168 - in trunk/org.indt.esbox.ui: META-INF src/org/indt/esbox/ui src/org/indt/esbox/ui/wizards
raul at garage.maemo.org
raul at garage.maemo.org
Tue Oct 23 01:15:42 EEST 2007
Author: raul
Date: 2007-10-23 01:15:42 +0300 (Tue, 23 Oct 2007)
New Revision: 168
Modified:
trunk/org.indt.esbox.ui/META-INF/MANIFEST.MF
trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/UIActivator.java
trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxCommonProjectWizard.java
trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxMainWizardPage.java
Log:
Modified: trunk/org.indt.esbox.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.indt.esbox.ui/META-INF/MANIFEST.MF 2007-10-22 22:09:31 UTC (rev 167)
+++ trunk/org.indt.esbox.ui/META-INF/MANIFEST.MF 2007-10-22 22:15:42 UTC (rev 168)
@@ -16,7 +16,9 @@
org.eclipse.cdt.managedbuilder.ui,
org.eclipse.core.filesystem,
org.eclipse.cdt.managedbuilder.gnu.ui,
- com.jcraft.jsch
+ com.jcraft.jsch,
+ org.eclipse.cdt.managedbuilder.xlc.ui,
+ org.eclipse.cdt.make.ui
Eclipse-LazyStart: true
Export-Package: org.indt.esbox.ui,
org.indt.esbox.ui.connection,
Modified: trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/UIActivator.java
===================================================================
--- trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/UIActivator.java 2007-10-22 22:09:31 UTC (rev 167)
+++ trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/UIActivator.java 2007-10-22 22:15:42 UTC (rev 168)
@@ -10,16 +10,23 @@
*******************************************************************************/
package org.indt.esbox.ui;
+import java.util.ArrayList;
+import java.util.List;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
+import org.eclipse.cdt.core.templateengine.TemplateInfo;
+import org.eclipse.cdt.core.templateengine.TemplateInitializationException;
+import org.eclipse.cdt.managedbuilder.gnu.ui.GnuUIPlugin;
+import org.eclipse.cdt.ui.templateengine.Template;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.indt.esbox.core.ErrorLogger;
import org.indt.esbox.core.env.ESboxEnvironmentVariableManager;
+import org.indt.esbox.core.templateengine.ESboxTemplateEngine;
import org.osgi.framework.BundleContext;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
-import org.eclipse.cdt.managedbuilder.gnu.ui.GnuUIPlugin;
/**
* The activator class controls the plug-in life cycle
@@ -127,4 +134,21 @@
return ESboxEnvironmentVariableManager.getDefault();
}
+ /**
+ * Returns all the templates, no filtering is done.
+ */
+ public Template[] getTemplates() {
+ TemplateInfo[] templateInfoArray = ESboxTemplateEngine.getDefault().getTemplateInfos();
+ List/*<Template>*/ templatesList = new ArrayList/*<Template>*/();
+ for (int i=0; i<templateInfoArray.length; i++) {
+ try {
+ templatesList.add(new Template(templateInfoArray[i]));
+ } catch (TemplateInitializationException tie) {
+ CCorePlugin.log(tie);
+ }
+ }
+
+ return (Template[]) templatesList.toArray(new Template[templatesList.size()]);
+ }
+
}
Modified: trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxCommonProjectWizard.java
===================================================================
--- trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxCommonProjectWizard.java 2007-10-22 22:09:31 UTC (rev 167)
+++ trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxCommonProjectWizard.java 2007-10-22 22:15:42 UTC (rev 168)
@@ -18,9 +18,14 @@
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
+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.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
+import org.eclipse.cdt.core.settings.model.ICSourceEntry;
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
import org.eclipse.cdt.managedbuilder.ui.wizards.CfgHolder;
import org.eclipse.cdt.ui.CUIPlugin;
@@ -44,6 +49,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -241,9 +247,12 @@
}
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);
@@ -255,6 +264,22 @@
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()
Modified: trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxMainWizardPage.java
===================================================================
--- trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxMainWizardPage.java 2007-10-22 22:09:31 UTC (rev 167)
+++ trunk/org.indt.esbox.ui/src/org/indt/esbox/ui/wizards/ESboxMainWizardPage.java 2007-10-22 22:15:42 UTC (rev 168)
@@ -13,11 +13,9 @@
import java.io.File;
import java.util.List;
-import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
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.templateengine.TemplateEngineUI;
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
import org.eclipse.cdt.ui.wizards.IWizardWithMemory;
@@ -65,11 +63,13 @@
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$
- private static final String EXE_PROJTYPE = "org.eclipse.cdt.build.core.buildArtefactType.exe"; //$NON-NLS-1$
- private static final String MAKE_PROJTYPE = "org.eclipse.cdt.build.makefile.projectType"; //$NON-NLS-1$
// constants
private static final int SIZING_TEXT_FIELD_WIDTH = 250;
@@ -243,17 +243,23 @@
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 = TemplateEngineUI.getDefault().getTemplates();
+ 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(EXE_PROJTYPE)) {
+ if (projectType.equals(AUTOMAKE_PROJECT_TYPE)) {
tip = new TreeItem(tipExe, SWT.NONE);
- } else if (projectType.equals(MAKE_PROJTYPE)) {
+ } 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);
More information about the Esbox-commits
mailing list