All of lore.kernel.org
 help / color / mirror / Atom feed
From: Atanas Gegov <atanas.gegov.oss@gmail.com>
To: yocto@yoctoproject.org
Subject: [PATCH 5/7] plugins/sdk.ide: Renamed the NewYoctoProjectPostProcess
Date: Tue, 19 Mar 2013 17:01:49 +0100	[thread overview]
Message-ID: <1363708911-13002-6-git-send-email-atanas.gegov.oss@gmail.com> (raw)
In-Reply-To: <1363708911-13002-1-git-send-email-atanas.gegov.oss@gmail.com>

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



  parent reply	other threads:[~2013-03-19 16:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Atanas Gegov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363708911-13002-6-git-send-email-atanas.gegov.oss@gmail.com \
    --to=atanas.gegov.oss@gmail.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.