All of lore.kernel.org
 help / color / mirror / Atom feed
* [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature
@ 2013-03-19 16:01 Atanas Gegov
  2013-03-19 16:01 ` [PATCH 1/7] plugins/sdk.ide: Prepared templates for autotools nature Atanas Gegov
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

Hi,

this patch series does a refactoring in the project natures. It does not add new
functionality. In detail, this means the following:

Initially, the org.yocto.sdk.ide plugin defined 2 natures:
1/ YoctoSDKProjectNature (every template project has this nature,
strongly coupled with Autotools)
2/ YoctoSDKEmptyProjectNature (additional nature for empty projects)

With this change there are now 3 natures available:
1/ YoctoSDKProjectNature (the "basic" nature,
every Yocto IDE project has this nature)
2/ YoctoSDKAutotoolsProjectNature (requires YoctoSDKProjectNature,
strongly coupled with Autotools, all existing template projects get it)
3/ YoctoSDKEmptyProjectNature (additional nature for empty projects,
requires YoctoSDKProjectNature)

Now it is possible to introduce new type of Yocto projects that
for example use CMake instead of Autotools. These projects still
have the YoctoSDKProjectNature which provides the right environment,
the cross-development profiles, etc.

Cheers,
Atanas

P.S: This patch series apply on the current master "Remove clutter project templates"
(5e20d3c32072ddd91dceb8b2b793ef13f25b915e). However, it should be updated if the
patch currently discussed on the mailing list "[yocto][PATCH v2][eclipse-poky][master]
Add more comprehensive error message for invalid project name" is applied before this
patch series.

Atanas Gegov (7):
  plugins/sdk.ide: Prepared templates for autotools nature
  plugins/sdk.ide: Added a new YoctoSDKAutotoolsProjectNature
  plugins/sdk.ide: Added a check method for the global target profie
  plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature
  plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess
  plugins/sdk.ide: Improved usage of strings in class
  plugins/sdk.ide: Extracted error message to YoctoSDKMessages

 .../OSGI-INF/l10n/bundle.properties                |    1 +
 plugins/org.yocto.sdk.ide/plugin.xml               |   28 ++++++-
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |   13 +++
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |    3 +-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   86 ++++++++++++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70 ----------------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../NewYoctoAutotoolsProjectPostProcess.java       |   81 ++++++++++++++++++
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   84 +++++++++++--------
 .../sdk/ide/wizard/NewYoctoProjectPostProcess.java |   73 -----------------
 .../projecttemplates/EmptyCPPProject/template.xml  |    1 +
 .../projecttemplates/EmptyCProject/template.xml    |    1 +
 .../HelloWorldCAutotoolsProject/template.xml       |    3 +-
 .../HelloWorldCGTKProject/template.xml             |    3 +-
 .../HelloWorldCPPAutotoolsProject/template.xml     |    3 +-
 15 files changed, 268 insertions(+), 188 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] plugins/sdk.ide: Prepared templates for autotools nature
  2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
@ 2013-03-19 16:01 ` Atanas Gegov
  2013-03-19 16:01 ` [PATCH 2/7] plugins/sdk.ide: Added a new YoctoSDKAutotoolsProjectNature Atanas Gegov
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

Added an extra variable to the templates and the
creating process. They are now prepared for a new
autotools nature.
---
 plugins/org.yocto.sdk.ide/plugin.xml               |    4 ++++
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |    3 +++
 .../projecttemplates/EmptyCPPProject/template.xml  |    1 +
 .../projecttemplates/EmptyCProject/template.xml    |    1 +
 .../HelloWorldCAutotoolsProject/template.xml       |    1 +
 .../HelloWorldCGTKProject/template.xml             |    1 +
 .../HelloWorldCPPAutotoolsProject/template.xml     |    1 +
 7 files changed, 12 insertions(+)

diff --git a/plugins/org.yocto.sdk.ide/plugin.xml b/plugins/org.yocto.sdk.ide/plugin.xml
index 8e8daac..1fbca80 100644
--- a/plugins/org.yocto.sdk.ide/plugin.xml
+++ b/plugins/org.yocto.sdk.ide/plugin.xml
@@ -142,6 +142,10 @@
                external="true"
                name="isEmptyProject">
          </simple>
+         <simple
+               external="true"
+               name="isAutotoolsProject">
+         </simple>
       </processType>
       <processType
             name="NewYoctoProjectPostProcess"
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
index 5ffd6b7..35fb821 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
@@ -70,8 +70,11 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
 		String artifactExtension = args[2].getSimpleValue();
 		String isCProjectValue = args[3].getSimpleValue();
 		String isEmptyProjetValue = args[4].getSimpleValue();
+		String isAutotoolsProjectValue = args[5].getSimpleValue();
 		boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue();
 		boolean isEmptryProject = Boolean.valueOf(isEmptyProjetValue).booleanValue();
+		boolean isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue();
+
 		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
 		try {
 			if (projectName.contains(" ")) {
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml
index e1b2338..0f0a7e8 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPProject/template.xml
@@ -9,6 +9,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="false" /> 
 		<simple name="isEmptyProject" value="true" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 </template>
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml
index f5c595c..8f821af 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCProject/template.xml
@@ -10,6 +10,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="true" /> 
 		<simple name="isEmptyProject" value="true" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 </template>
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml
index 52ac355..ca58158 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml
@@ -55,6 +55,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="true" /> 
 		<simple name="isEmptyProject" value="false" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 	<process type="org.eclipse.cdt.core.CreateSourceFolder">
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
index e552a54..bbcf153 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
@@ -55,6 +55,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="true" /> 
 		<simple name="isEmptyProject" value="false" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 	<process type="org.eclipse.cdt.core.CreateSourceFolder">
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml
index a6bac07..7ec9e05 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml
@@ -55,6 +55,7 @@
 		<simple name="artifactExtension" value="exe" /> 
 		<simple name="isCProject" value="false" /> 
 		<simple name="isEmptyProject" value="false" />
+		<simple name="isAutotoolsProject" value="true" />
 	</process>
 
 	<process type="org.eclipse.cdt.core.CreateSourceFolder">
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] plugins/sdk.ide: Added a new YoctoSDKAutotoolsProjectNature
  2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
  2013-03-19 16:01 ` [PATCH 1/7] plugins/sdk.ide: Prepared templates for autotools nature Atanas Gegov
@ 2013-03-19 16:01 ` Atanas Gegov
  2013-03-19 16:01 ` [PATCH 3/7] plugins/sdk.ide: Added a check method for the global target profie Atanas Gegov
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

This nature is intended for Yocto projects that use
Autotools as a build system. It requires the YoctoSDKProjectNature
and will be used by the existing templates.
---
 .../OSGI-INF/l10n/bundle.properties                |    1 +
 plugins/org.yocto.sdk.ide/plugin.xml               |   18 ++++++++-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   41 ++++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java

diff --git a/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties
index a7172be..3d491fb 100644
--- a/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties
+++ b/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties
@@ -1,6 +1,7 @@
 #Properties file for org.Yocto.sdk.ide
 page.name.0 = Yocto Project ADT
 extension.name.0 = YoctoSDKNature
+extension.name.1 = YoctoSDKAutotoolsNature
 command.name = ReconfigureYoctoProject
 command.label.0 = Change Yocto Project Settings
 command.mnemonic = C
diff --git a/plugins/org.yocto.sdk.ide/plugin.xml b/plugins/org.yocto.sdk.ide/plugin.xml
index 1fbca80..f21434b 100644
--- a/plugins/org.yocto.sdk.ide/plugin.xml
+++ b/plugins/org.yocto.sdk.ide/plugin.xml
@@ -19,12 +19,25 @@
          id="YoctoSDKNature"
          name="%extension.name.0"
          point="org.eclipse.core.resources.natures">
+      <runtime>
+         <run
+               class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature">
+         </run>
+      </runtime>
+   </extension>
+   <extension
+         id="YoctoSDKAutotoolsNature"
+         name="%extension.name.1"
+         point="org.eclipse.core.resources.natures">
+      <requires-nature
+            id="org.yocto.sdk.ide.YoctoSDKNature">
+      </requires-nature>
       <requires-nature
             id="org.eclipse.cdt.autotools.core.autotoolsNatureV2">
       </requires-nature>
       <runtime>
          <run
-               class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature">
+               class="org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature">
          </run>
       </runtime>
       <builder
@@ -34,6 +47,9 @@
    <extension
          id="YoctoSDKEmptyNature"
          point="org.eclipse.core.resources.natures">
+      <requires-nature
+            id="org.yocto.sdk.ide.YoctoSDKNature">
+      </requires-nature>
       <runtime>
          <run
                class="org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature">
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
new file mode 100644
index 0000000..ac73878
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Intel Corporation.
+ * 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:
+ * Intel - initial API and implementation
+ *******************************************************************************/
+package org.yocto.sdk.ide.natures;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.yocto.sdk.ide.YoctoSDKPlugin;
+
+public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
+	public static final  String YoctoSDK_AUTOTOOLS_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature";
+
+	private IProject proj;
+
+	public void configure() throws CoreException {
+	}
+
+	public void deconfigure() throws CoreException {
+	}
+
+	public IProject getProject() {
+		return proj;
+	}
+
+	public void setProject(IProject project) {
+		this.proj = project;
+	}
+
+	public static void addYoctoSDKAutotoolsNature(IProject project, IProgressMonitor monitor) throws CoreException {
+		YoctoSDKNatureUtils.addNature(project, YoctoSDK_AUTOTOOLS_NATURE_ID, monitor);
+	}
+}
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] plugins/sdk.ide: Added a check method for the global target profie
  2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
  2013-03-19 16:01 ` [PATCH 1/7] plugins/sdk.ide: Prepared templates for autotools nature Atanas Gegov
  2013-03-19 16:01 ` [PATCH 2/7] plugins/sdk.ide: Added a new YoctoSDKAutotoolsProjectNature Atanas Gegov
@ 2013-03-19 16:01 ` Atanas Gegov
  2013-03-19 16:01 ` [PATCH 4/7] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature Atanas Gegov
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

Added an own method (copied code) in YoctoSDKChecker
that checks the validity of the globally selected
profile. This method will be used in the next patch
and will replace duplicated code.
---
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java
index 74d97a0..92db72a 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java
@@ -19,6 +19,7 @@ import java.io.FileReader;
 import java.io.FilenameFilter;
 import java.io.IOException;
 
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants;
@@ -98,6 +99,18 @@ public class YoctoSDKChecker {
 		}
 	};
 
+	public static void checkIfGloballySelectedYoctoProfileIsValid() throws YoctoGeneralException {
+		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
+		IPreferenceStore selectedProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+		YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selectedProfileStore);
+
+		SDKCheckResults result = checkYoctoSDK(elem);
+		if (result != SDKCheckResults.SDK_PASS){
+			String strErrorMsg =  getErrorMessage(result, SDKCheckRequestFrom.Wizard);
+			throw new YoctoGeneralException(strErrorMsg);
+		}
+	}
+
 	public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {
 		if (elem.getStrToolChainRoot().isEmpty())
 			return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY;
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature
  2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
                   ` (2 preceding siblings ...)
  2013-03-19 16:01 ` [PATCH 3/7] plugins/sdk.ide: Added a check method for the global target profie Atanas Gegov
@ 2013-03-19 16:01 ` Atanas Gegov
  2013-03-19 16:01 ` [PATCH 5/7] plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess Atanas Gegov
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

The YoctoSDKProjectNature remains the basic nature for all
Yocto projects in the IDE. The projects using Autotools
(all templates) get the YoctoSDKProjectNature and additionally
the YoctoSDKAutotoolsProjectNature. The process
NewYoctoCProjectTemplate is adapted accordingly.
---
 plugins/org.yocto.sdk.ide/plugin.xml               |    2 +-
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   45 +++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |   70 -----------------
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |    6 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |   81 +++++++++++---------
 5 files changed, 96 insertions(+), 108 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/plugin.xml b/plugins/org.yocto.sdk.ide/plugin.xml
index f21434b..35e34b4 100644
--- a/plugins/org.yocto.sdk.ide/plugin.xml
+++ b/plugins/org.yocto.sdk.ide/plugin.xml
@@ -91,7 +91,7 @@
                            type="org.eclipse.core.resources.IResource">
                         <test
                               property="org.eclipse.core.resources.projectNature"
-                              value="org.yocto.sdk.ide.YoctoSDKNature">
+                              value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature">
                         </test>
                      </adapt>
                   </iterate>
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
index ac73878..767c005 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java
@@ -10,15 +10,31 @@
  *******************************************************************************/
 package org.yocto.sdk.ide.natures;
 
+import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
+import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectNature;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
+import org.yocto.sdk.ide.YoctoUIElement;
+import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
 public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
 	public static final  String YoctoSDK_AUTOTOOLS_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature";
 
+	private static final String DEFAULT_HOST_STR = "host";
+	private static final String DEFAULT_TARGET_STR = "target";
+	private static final String DEFAULT_BUILD_STR = "build";
+	private static final String DEFAULT_AUTOGEN_OPT_STR = "autogenOpts";
+
+	private static final String DEFAULT_CONFIGURE_STR = "configure";
+	private static final String DEFAULT_AUTOGEN_STR = "autogen";
+	private static final String DEFAULT_LIBTOOL_SYSROOT_PREFIX = " --with-libtool-sysroot=";
+
 	private IProject proj;
 
 	public void configure() throws CoreException {
@@ -38,4 +54,33 @@ public class YoctoSDKAutotoolsProjectNature implements IProjectNature {
 	public static void addYoctoSDKAutotoolsNature(IProject project, IProgressMonitor monitor) throws CoreException {
 		YoctoSDKNatureUtils.addNature(project, YoctoSDK_AUTOTOOLS_NATURE_ID, monitor);
 	}
+
+	public static void configureAutotoolsOptions(IProject project) {
+		IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+		IConfiguration icfg = info.getDefaultConfiguration();
+		YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
+		String sysroot_str = elem.getStrSysrootLoc();
+		String id = icfg.getId();
+		String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
+		String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
+		String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
+		String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS");
+
+		String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 "
+				+ CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
+		String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+		String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
+		IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
+		String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS");
+
+		cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
+		cfg.setOption(DEFAULT_BUILD_STR, YoctoSDKUtils.splitString(strConfigure, "--build="));
+		cfg.setOption(DEFAULT_HOST_STR, YoctoSDKUtils.splitString(strConfigure, "--host="));
+		cfg.setOption(DEFAULT_TARGET_STR, YoctoSDKUtils.splitString(strConfigure, "--target="));
+		cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
+		cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
+
+		AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
+		AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+	}
 }
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java
index fcb296d..51926fb 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java
@@ -10,39 +10,15 @@
  *******************************************************************************/
 package org.yocto.sdk.ide.natures;
 
-import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
-import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectNature;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.yocto.sdk.ide.YoctoGeneralException;
-import org.yocto.sdk.ide.YoctoProfileElement;
-import org.yocto.sdk.ide.YoctoSDKChecker;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
-import org.yocto.sdk.ide.YoctoUIElement;
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
-import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
-
-@SuppressWarnings("restriction")
 public class YoctoSDKProjectNature implements IProjectNature {
 	public static final  String YoctoSDK_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature";
 
-	private static final String DEFAULT_HOST_STR = "host";
-	private static final String DEFAULT_TARGET_STR = "target";
-	private static final String DEFAULT_BUILD_STR = "build";
-	private static final String DEFAULT_AUTOGEN_OPT_STR = "autogenOpts";
-
-	private static final String DEFAULT_CONFIGURE_STR = "configure";
-	private static final String DEFAULT_AUTOGEN_STR = "autogen";
-	private static final String DEFAULT_LIBTOOL_SYSROOT_PREFIX = " --with-libtool-sysroot=";
-
 	private IProject proj;
 
 	public void configure() throws CoreException {
@@ -62,50 +38,4 @@ public class YoctoSDKProjectNature implements IProjectNature {
 	public static void addYoctoSDKNature(IProject project, IProgressMonitor monitor) throws CoreException {
 		YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID, monitor);
 	}
-
-	public static void configureAutotoolsOptions(IProject project) {
-		IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
-		IConfiguration icfg = info.getDefaultConfiguration();
-		YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
-		String sysroot_str = elem.getStrSysrootLoc();
-		String id = icfg.getId();
-		String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
-		String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
-		String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
-		String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS");
-
-		String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 "
-		+ CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
-		String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
-		String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
-		IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
-		String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS");
-
-		cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
-		cfg.setOption(DEFAULT_BUILD_STR, YoctoSDKUtils.splitString(strConfigure, "--build="));
-		cfg.setOption(DEFAULT_HOST_STR, YoctoSDKUtils.splitString(strConfigure, "--host="));
-		cfg.setOption(DEFAULT_TARGET_STR, YoctoSDKUtils.splitString(strConfigure, "--target="));
-		cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
-		cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
-
-		AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
-		AutotoolsConfigurationManager.getInstance().saveConfigs(project);
-	}
-
-	public static void configureAutotools(IProject project) throws YoctoGeneralException {
-		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-		YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
-		IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-		YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-		SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
-		if (result != SDKCheckResults.SDK_PASS){
-			String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-			throw new YoctoGeneralException(strErrorMsg);
-		}
-		else
-		{
-			YoctoSDKUtils.setEnvironmentVariables(project, elem);
-			configureAutotoolsOptions(project);
-		}
-	}
 }
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
index bd781b3..1e2e424 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
@@ -54,8 +54,8 @@ import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoSDKMessages;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoUIElement;
+import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
-import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoSDKUtils {
@@ -427,7 +427,9 @@ public class YoctoSDKUtils {
 
 		try {
 			setEnvironmentVariables(project, elem);
-			YoctoSDKProjectNature.configureAutotoolsOptions(project);
+			if(project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) {
+				YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+			}
 			IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
 			console.start(project);
 			consoleOutStream = console.getOutputStream();
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
index 35fb821..b520047 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
@@ -25,6 +25,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
 import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
 import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
 import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
 import org.eclipse.cdt.managedbuilder.core.BuildException;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@@ -44,8 +45,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
 import org.yocto.sdk.ide.YoctoGeneralException;
 import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoSDKChecker;
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
-import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
+import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
@@ -72,7 +72,7 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
 		String isEmptyProjetValue = args[4].getSimpleValue();
 		String isAutotoolsProjectValue = args[5].getSimpleValue();
 		boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue();
-		boolean isEmptryProject = Boolean.valueOf(isEmptyProjetValue).booleanValue();
+		boolean isEmptyProject = Boolean.valueOf(isEmptyProjetValue).booleanValue();
 		boolean isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue();
 
 		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
@@ -101,19 +101,8 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
 				pca.setArtifactExtension(artifactExtension);
 				info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject);
 
-				AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-				// For each IConfiguration, create a corresponding Autotools Configuration
-				IConfiguration[] cfgs = pca.getConfigs();
-				for (int i = 0; i < cfgs.length; ++i) {
-					IConfiguration cfg = cfgs[i];
-					AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
-				}
-				AutotoolsConfigurationManager.getInstance().saveConfigs(project);
-				if(isEmptryProject) {
-					YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
-				}
-				YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
-				YoctoSDKProjectNature.configureAutotools(project);
+				addNatures(project, false, isEmptyProject, isAutotoolsProject, monitor);
+
 				info.setValid(true);
 				ManagedBuildManager.saveBuildInfo(project, true);
 
@@ -122,31 +111,19 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
 				
 				IWorkspace workspace = ResourcesPlugin.getWorkspace();
 				turnOffAutoBuild(workspace);
-				YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-				IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
-				YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
-				SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(elem);
-				if (result != SDKCheckResults.SDK_PASS){
-					String strErrorMsg =  YoctoSDKChecker.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
-					throw new YoctoGeneralException(strErrorMsg);
-				}
-				AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
-				if(isEmptryProject) {
-					YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
-				}
-				
-				YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
-				YoctoSDKProjectNature.configureAutotools(project);
-				
-				AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+
+				YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
+
+				addNatures(project, true, isEmptyProject, isAutotoolsProject, monitor);
+
 				//restoreAutoBuild(workspace);
 				IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
 				IDiscoveredPathInfo pathInfo = manager.getDiscoveredInfo(project);
 				if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
 				    IPerProjectDiscoveredPathInfo projectPathInfo =
 				    	(IPerProjectDiscoveredPathInfo) pathInfo;
-				    projectPathInfo.setIncludeMap(new LinkedHashMap());
-				    projectPathInfo.setSymbolMap(new LinkedHashMap());    
+				    projectPathInfo.setIncludeMap(new LinkedHashMap<String, Boolean>());
+				    projectPathInfo.setSymbolMap(new LinkedHashMap<String, SymbolEntry>());
 				    manager.removeDiscoveredInfo(project);    
 				}
 			}
@@ -170,6 +147,40 @@ public class NewYoctoCProjectTemplate extends ProcessRunner {
 		}
 	}
 
+	private void addNatures(IProject project, boolean projectExists, boolean isEmptyProject,
+			boolean isAutotoolsProject, IProgressMonitor monitor)
+					throws CoreException, YoctoGeneralException {
+		YoctoSDKProjectNature.addYoctoSDKNature(project, monitor);
+
+		YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
+
+		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
+		YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
+
+		IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
+		YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
+		YoctoSDKUtils.setEnvironmentVariables(project, elem);
+
+		if (isEmptyProject) {
+			YoctoSDKEmptyProjectNature.addYoctoSDKEmptyNature(project, monitor);
+		}
+
+		if (isAutotoolsProject) {
+			AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
+
+			if(!projectExists) {
+				// For each IConfiguration, create a corresponding Autotools Configuration
+				for (IConfiguration cfg : pca.getConfigs()) {
+					AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
+				}
+				AutotoolsConfigurationManager.getInstance().saveConfigs(project);
+			}
+
+			YoctoSDKAutotoolsProjectNature.addYoctoSDKAutotoolsNature(project, monitor);
+			YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
+		}
+	}
+
 	protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException {
 		IWorkspaceDescription workspaceDesc = workspace.getDescription();
 		savedAutoBuildingValue = workspaceDesc.isAutoBuilding();
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess
  2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
                   ` (3 preceding siblings ...)
  2013-03-19 16:01 ` [PATCH 4/7] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature Atanas Gegov
@ 2013-03-19 16:01 ` Atanas Gegov
  2013-03-19 16:01 ` [PATCH 6/7] plugins/sdk.ide: Improved usage of strings in class Atanas Gegov
  2013-03-19 16:01 ` [PATCH 7/7] plugins/sdk.ide: Extracted error message to YoctoSDKMessages Atanas Gegov
  6 siblings, 0 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

Renamed the NewYoctoProjectPostProcess to
NewYoctoAutotoolsProjectPostProcess as it is actually
relevant for Autotools-based projects. Added a check
for the apropriate project nature in the the "process"
method of NewYoctoAutotoolsProjectPostProcess.
---
 plugins/org.yocto.sdk.ide/plugin.xml               |    4 +-
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |    2 +-
 .../NewYoctoAutotoolsProjectPostProcess.java       |   77 ++++++++++++++++++++
 .../sdk/ide/wizard/NewYoctoProjectPostProcess.java |   73 -------------------
 .../HelloWorldCAutotoolsProject/template.xml       |    2 +-
 .../HelloWorldCGTKProject/template.xml             |    2 +-
 .../HelloWorldCPPAutotoolsProject/template.xml     |    2 +-
 7 files changed, 83 insertions(+), 79 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java

diff --git a/plugins/org.yocto.sdk.ide/plugin.xml b/plugins/org.yocto.sdk.ide/plugin.xml
index 35e34b4..8613f43 100644
--- a/plugins/org.yocto.sdk.ide/plugin.xml
+++ b/plugins/org.yocto.sdk.ide/plugin.xml
@@ -164,8 +164,8 @@
          </simple>
       </processType>
       <processType
-            name="NewYoctoProjectPostProcess"
-            processRunner="org.yocto.sdk.ide.wizard.NewYoctoProjectPostProcess">
+            name="NewYoctoAutotoolsProjectPostProcess"
+            processRunner="org.yocto.sdk.ide.wizard.NewYoctoAutotoolsProjectPostProcess">
          <simple
                name="projectName">
          </simple>
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index 8596123..dbd00ae 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -98,5 +98,5 @@ LaunchConfig.BuildScope.Value = ${projects:}
 LaunchConfig.Location.Attr = org.eclipse.ui.externaltools.ATTR_LOCATION
 LaunchConfig.Arguments.Attr = org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS;
 
-
+AutotoolsProjectPostProcess.WrongProjectNature = {0} is not an Autotools project
 
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
new file mode 100644
index 0000000..9bc042a
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Intel Corporation.
+ * 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:
+ * Intel - initial API and implementation
+ *******************************************************************************/
+package org.yocto.sdk.ide.wizard;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
+import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
+import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
+import org.eclipse.cdt.core.templateengine.process.processes.Messages;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.yocto.sdk.ide.YoctoSDKMessages;
+import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
+
+public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
+
+	public NewYoctoAutotoolsProjectPostProcess() {}
+
+	public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+
+		String projectName = args[0].getSimpleValue();
+
+		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+		try {
+			if (!project.exists()) {
+				throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$
+			} else if (!project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) {
+				throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + //$NON-NLS-1$
+						YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.WrongProjectNature", //$NON-NLS-1$
+								projectName));
+			} else {
+				IPath path = project.getLocation();
+				String path_str = path.toString();
+				String autogen_cmd = "chmod +x " + path_str + "/autogen.sh";
+				try {
+					Runtime rt = Runtime.getRuntime();
+					Process proc = rt.exec(autogen_cmd);
+					InputStream stdin = proc.getInputStream();
+					InputStreamReader isr = new InputStreamReader(stdin);
+					BufferedReader br = new BufferedReader(isr);
+					String line = null;
+					String error_message = "";
+
+					while ( (line = br.readLine()) != null) {
+						error_message = error_message + line;
+					}
+
+					int exitVal = proc.waitFor();
+					if (exitVal != 0) {
+						throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName);
+					}
+				} catch (Throwable t) {
+					t.printStackTrace();
+
+				}
+			}
+		}
+		catch (Exception e)
+		{
+			throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$
+		}
+	}
+}
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java
deleted file mode 100644
index d028ee6..0000000
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectPostProcess.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Intel Corporation.
- * 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:
- * Intel - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.ide.wizard;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.eclipse.cdt.core.templateengine.TemplateCore;
-import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
-import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
-import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
-import org.eclipse.cdt.core.templateengine.process.processes.Messages;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-
-@SuppressWarnings("restriction")
-public class NewYoctoProjectPostProcess extends ProcessRunner {
-	
-	public NewYoctoProjectPostProcess() {}
-	
-	public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
-
-		String projectName = args[0].getSimpleValue();
-		
-		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-		try {
-			if (!project.exists()) {
-					throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$
-				} else {
-					IPath path = project.getLocation();
-					String path_str = path.toString();
-					String autogen_cmd = "chmod +x " + path_str + "/autogen.sh";
-					try {
-						Runtime rt = Runtime.getRuntime();
-						Process proc = rt.exec(autogen_cmd);
-						InputStream stdin = proc.getInputStream();
-						InputStreamReader isr = new InputStreamReader(stdin);
-						BufferedReader br = new BufferedReader(isr);
-						String line = null;
-						String error_message = "";
-						
-						while ( (line = br.readLine()) != null) {
-							error_message = error_message + line;
-						}
-						
-						int exitVal = proc.waitFor();
-						if (exitVal != 0) {
-							throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName);
-						} 
-					} catch (Throwable t) {
-						t.printStackTrace();
-						
-					}
-				}
-		}
-		catch (Exception e)
-		{
-			throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$
-		} 
-	}
-}
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml
index ca58158..b22d1ea 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml
@@ -135,7 +135,7 @@
         </complex-array>
 	</process>
 
-	<process type="org.yocto.sdk.ide.NewYoctoProjectPostProcess">
+	<process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
 		<simple name="projectName" value="$(projectName)" /> 
 	</process>
 
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
index bbcf153..7a41ac3 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKProject/template.xml
@@ -135,7 +135,7 @@
         </complex-array>
 	</process>
 
-	<process type="org.yocto.sdk.ide.NewYoctoProjectPostProcess">
+	<process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
 		<simple name="projectName" value="$(projectName)" /> 
 	</process>
 </template>
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml
index 7ec9e05..3e8972b 100644
--- a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml
@@ -135,7 +135,7 @@
         </complex-array>
 	</process>
 
-	<process type="org.yocto.sdk.ide.NewYoctoProjectPostProcess">
+	<process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
 		<simple name="projectName" value="$(projectName)" /> 
 	</process>
 </template>
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] plugins/sdk.ide: Improved usage of strings in class
  2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
                   ` (4 preceding siblings ...)
  2013-03-19 16:01 ` [PATCH 5/7] plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess Atanas Gegov
@ 2013-03-19 16:01 ` Atanas Gegov
  2013-03-19 16:01 ` [PATCH 7/7] plugins/sdk.ide: Extracted error message to YoctoSDKMessages Atanas Gegov
  6 siblings, 0 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

Extracted string constants. Added missing
NON-NLS-1 declarations.
---
 .../NewYoctoAutotoolsProjectPostProcess.java       |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
index 9bc042a..cb187e9 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
@@ -11,6 +11,7 @@
 package org.yocto.sdk.ide.wizard;
 
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
@@ -28,6 +29,9 @@ import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
 
 public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 
+	public static final String CHMOD_COMMAND = "chmod +x "; //$NON-NLS-1$
+	public static final String AUTOGEN_SCRIPT_NAME = "autogen.sh"; //$NON-NLS-1$
+
 	public NewYoctoAutotoolsProjectPostProcess() {}
 
 	public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
@@ -45,7 +49,7 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 			} else {
 				IPath path = project.getLocation();
 				String path_str = path.toString();
-				String autogen_cmd = "chmod +x " + path_str + "/autogen.sh";
+				String autogen_cmd = CHMOD_COMMAND + path_str + File.separator + AUTOGEN_SCRIPT_NAME;
 				try {
 					Runtime rt = Runtime.getRuntime();
 					Process proc = rt.exec(autogen_cmd);
@@ -53,7 +57,7 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 					InputStreamReader isr = new InputStreamReader(stdin);
 					BufferedReader br = new BufferedReader(isr);
 					String line = null;
-					String error_message = "";
+					String error_message = ""; //$NON-NLS-1$
 
 					while ( (line = br.readLine()) != null) {
 						error_message = error_message + line;
@@ -61,7 +65,7 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 
 					int exitVal = proc.waitFor();
 					if (exitVal != 0) {
-						throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName);
+						throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName); //$NON-NLS-1$
 					}
 				} catch (Throwable t) {
 					t.printStackTrace();
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] plugins/sdk.ide: Extracted error message to YoctoSDKMessages
  2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
                   ` (5 preceding siblings ...)
  2013-03-19 16:01 ` [PATCH 6/7] plugins/sdk.ide: Improved usage of strings in class Atanas Gegov
@ 2013-03-19 16:01 ` Atanas Gegov
  6 siblings, 0 replies; 8+ messages in thread
From: Atanas Gegov @ 2013-03-19 16:01 UTC (permalink / raw)
  To: yocto

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

Improved the i18n ability.
---
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |    1 +
 .../NewYoctoAutotoolsProjectPostProcess.java       |    8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index dbd00ae..f2cf76b 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -99,4 +99,5 @@ LaunchConfig.Location.Attr = org.eclipse.ui.externaltools.ATTR_LOCATION
 LaunchConfig.Arguments.Attr = org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS;
 
 AutotoolsProjectPostProcess.WrongProjectNature = {0} is not an Autotools project
+AutotoolsProjectPostProcess.ChmodFailure = Failed to make autogen.sh executable for project: {0}
 
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
index cb187e9..f467dac 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java
@@ -65,16 +65,16 @@ public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
 
 					int exitVal = proc.waitFor();
 					if (exitVal != 0) {
-						throw new ProcessFailureException("Failed to make autogen.sh executable for project: " + projectName); //$NON-NLS-1$
+						throw new ProcessFailureException(
+								YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.ChmodFailure", //$NON-NLS-1$
+										projectName));
 					}
 				} catch (Throwable t) {
 					t.printStackTrace();
 
 				}
 			}
-		}
-		catch (Exception e)
-		{
+		} catch (Exception e) {
 			throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$
 		}
 	}
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-19 16:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19 16:01 [eclipse-poky][PATCH 0/7] Introducing a YoctoSDKAutotoolsProjectNature Atanas Gegov
2013-03-19 16:01 ` [PATCH 1/7] plugins/sdk.ide: Prepared templates for autotools nature Atanas Gegov
2013-03-19 16:01 ` [PATCH 2/7] plugins/sdk.ide: Added a new YoctoSDKAutotoolsProjectNature Atanas Gegov
2013-03-19 16:01 ` [PATCH 3/7] plugins/sdk.ide: Added a check method for the global target profie Atanas Gegov
2013-03-19 16:01 ` [PATCH 4/7] plugins/sdk.ide: Switch to YoctoSDKAutotoolsProjectNature Atanas Gegov
2013-03-19 16:01 ` [PATCH 5/7] plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess Atanas Gegov
2013-03-19 16:01 ` [PATCH 6/7] plugins/sdk.ide: Improved usage of strings in class Atanas Gegov
2013-03-19 16:01 ` [PATCH 7/7] plugins/sdk.ide: Extracted error message to YoctoSDKMessages Atanas Gegov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.