Skip to contentSkip to conversation

Refactorings in org.yocto.sdk.ide plugin

PATCH Applied Atanas Gegov 2 participants 8 messages Mar 7, 2013

lore
Share & tools
lore
#0 lore raw

v3 cover Refactorings in org.yocto.sdk.ide plugin

From: Atanas Gegov <[email protected]>

Hi,

Currently the org.yocto.sdk.ide plugin has the YoctoSDKEmptyProjectNature and the YoctoSDKProjectNature. The latter is strongly coupled with the Autotools nature since this is by now the only supported build system. It would be nice if it is possible to introduce other Yocto IDE projects,e.g. projects using CMake for building.

This patch series does some refactoring in the org.yocto.sdk.ide plugin. This allows a simplified addition of further natures and enables the decoupling between YoctoSDKProjectNature and the Autotools nature.

The natures and the utils get their own packages. Some methods and members were also moved to suitable classes.

Cheers,
Atanas

Atanas Gegov (6):
Moved YoctoSDK natures to their own package
Moved functionality that does not belong to YoctoSDKProjectNature Moved utils to their own package
Moved nature-related utils in own class
Export the new subpackages of org.yocto.sdk.ide Performed a whitespaces cleanup

 plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF     |    2 +
 plugins/org.yocto.sdk.ide/plugin.xml               |    4 +-
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |   12 +-
 .../yocto/sdk/ide/YoctoSDKEmptyProjectNature.java  |   38 -
 .../org/yocto/sdk/ide/YoctoSDKProjectNature.java   |  267 -------
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |  607 ----------------
 .../ide/natures/YoctoSDKEmptyProjectNature.java    |   39 +
 .../yocto/sdk/ide/natures/YoctoSDKNatureUtils.java |   39 +
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |  111 +++
 .../ide/preferences/YoctoSDKPreferencePage.java    |    4 +-
 .../preferences/YoctoSDKProjectPropertyPage.java   |    2 +-
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |  743 ++++++++++++++++++++
 .../sdk/ide/utils/YoctoSDKUtilsConstants.java      |   18 +
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |    6 +-
 14 files changed, 969 insertions(+), 923 deletions(-)
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKEmptyProjectNature.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/6 Moved YoctoSDK natures to their own package

From: Atanas Gegov <[email protected]>

If further natures are added, they will fit into
this package and not overpopulate the org.yocto.sdk.ide package.

---
 plugins/org.yocto.sdk.ide/plugin.xml               |    4 +-
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |    2 +
 .../yocto/sdk/ide/YoctoSDKEmptyProjectNature.java  |   38 ---
 .../org/yocto/sdk/ide/YoctoSDKProjectNature.java   |  267 -------------------
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |    1 +
 .../ide/natures/YoctoSDKEmptyProjectNature.java    |   40 +++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |  275 ++++++++++++++++++++
 .../ide/preferences/YoctoSDKPreferencePage.java    |    2 +-
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |    4 +-
 9 files changed, 323 insertions(+), 310 deletions(-)
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKEmptyProjectNature.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java
plugins/org.yocto.sdk.ide/plugin.xml +2 -2
index 6548ae2..ea1a8ab 100644
@@ -24,7 +24,7 @@
       </requires-nature>
       <runtime>
          <run
-               class="org.yocto.sdk.ide.YoctoSDKProjectNature">
+               class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature">
          </run>
       </runtime>
       <builder
@@ -36,7 +36,7 @@
          point="org.eclipse.core.resources.natures">
       <runtime>
          <run
-               class="org.yocto.sdk.ide.YoctoSDKEmptyProjectNature">
+               class="org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature">
          </run>
       </runtime>
    </extension>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +2 -0
index 5f790ee..3047641 100644
@@ -19,6 +19,8 @@ import java.io.FileReader;
 import java.io.FilenameFilter;
 import java.io.IOException;
 
+import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
+
 public class YoctoSDKChecker {
 	private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
 	private static final String SYSROOTS_DIR = "sysroots";
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKEmptyProjectNature.java deleted +0 -38
deleted file mode 100644
index 8df9e86..0000000
@@ -1,38 +0,0 @@
-package org.yocto.sdk.ide;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class YoctoSDKEmptyProjectNature implements IProjectNature {
-
-	public static final  String YoctoSDK_EMPTY_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKEmptyNature";
-
-	private IProject proj;
-
-	public void configure() throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void deconfigure() throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public IProject getProject() {
-		// TODO Auto-generated method stub
-		return proj;
-	}
-
-	public void setProject(IProject project) {
-		// TODO Auto-generated method stub
-		this.proj = project;
-	}
-
-	public static void addYoctoSDKEmptyNature(IProject project, IProgressMonitor monitor) throws CoreException {
-		YoctoSDKUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor);
-	}
-
-}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java deleted +0 -267

267 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +1 -0
index 4a10d8d..35ff3d4 100644
@@ -38,6 +38,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.IScopeContext;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.osgi.service.prefs.BackingStoreException;
+import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoSDKUtils {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java new file +40 -0
new file mode 100644
index 0000000..9207e7e
@@ -0,0 +1,40 @@
+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;
+import org.yocto.sdk.ide.YoctoSDKUtils;
+
+public class YoctoSDKEmptyProjectNature implements IProjectNature {
+
+	public static final  String YoctoSDK_EMPTY_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKEmptyNature";
+
+	private IProject proj;
+
+	public void configure() throws CoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deconfigure() throws CoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public IProject getProject() {
+		// TODO Auto-generated method stub
+		return proj;
+	}
+
+	public void setProject(IProject project) {
+		// TODO Auto-generated method stub
+		this.proj = project;
+	}
+
+	public static void addYoctoSDKEmptyNature(IProject project, IProgressMonitor monitor) throws CoreException {
+		YoctoSDKUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor);
+	}
+
+}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java new file +275 -0

275 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +1 -1
index f013cf8..e94d35d 100644
@@ -33,9 +33,9 @@ import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoProfileSetting;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
+import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.YoctoSDKMessages;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
-import org.yocto.sdk.ide.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +2 -2
index f332a9a..39f7d75 100644
@@ -46,9 +46,9 @@ 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.YoctoSDKEmptyProjectNature;
+import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
+import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
-import org.yocto.sdk.ide.YoctoSDKProjectNature;
 import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoUIElement;
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v3 2/6 Moved functionality that does not belong to YoctoSDKProjectNature

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

This functionality is not directly connected to the YoctoSDKProjectNature itself. Moreover, it might also be used by other natures. Made a lot of constants private as they are used only locally. Globally used constants are moved in an own class.

---
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |    8 +-
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |  154 +++++++++++++++++-
 .../org/yocto/sdk/ide/YoctoSDKUtilsConstants.java  |   18 +++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |  166 +-------------------
 4 files changed, 176 insertions(+), 170 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +5 -3
index 3047641..bab6ade 100644
@@ -24,6 +24,7 @@ import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
 public class YoctoSDKChecker {
 	private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
 	private static final String SYSROOTS_DIR = "sysroots";
+	private static final String SDK_VERSION = "OECORE_SDK_VERSION";
 
 	public static enum SDKCheckResults {
 		SDK_PASS("", false),
@@ -148,10 +149,11 @@ public class YoctoSDKChecker {
 			String sFileName;
 
 			if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
-				sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX+elem.getStrTarget();
+				sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
 			} else {
 				//POKY TREE Mode
-				sFileName = elem.getStrToolChainRoot() + YoctoSDKProjectNature.DEFAULT_TMP_PREFIX + YoctoSDKProjectNature.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
+				sFileName = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX +
+						YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
 			}
 
 			try {
@@ -165,7 +167,7 @@ public class YoctoSDKChecker {
 						String line = null;
 
 						while ((line = input.readLine()) != null) {
-							if (line.startsWith("export "+ YoctoSDKProjectNature.SDK_VERSION)) {
+							if (line.startsWith("export "+ SDK_VERSION)) {
 								int beginIndex = 2;
 								String sVersion = "";
 								for (;;) {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +152 -2

203 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java new file +18 -0
new file mode 100644
index 0000000..2ead684
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BMW Car IT GmbH.
+ * 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:
+ * BMW Car IT - initial API and implementation
+ *******************************************************************************/
+package org.yocto.sdk.ide;
+
+public class YoctoSDKUtilsConstants {
+
+	public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-";
+	public static final String DEFAULT_TMP_PREFIX = "/tmp/";
+
+}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +1 -165

208 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v3 3/6 Moved utils to their own package

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

Made the default package (org.yocto.sdk.ide) a little bit more compact.

---
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |    2 +
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |  758 -------------------
 .../org/yocto/sdk/ide/YoctoSDKUtilsConstants.java  |   18 -
 .../ide/natures/YoctoSDKEmptyProjectNature.java    |    2 +-
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |    2 +-
 .../ide/preferences/YoctoSDKPreferencePage.java    |    2 +-
 .../preferences/YoctoSDKProjectPropertyPage.java   |    2 +-
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |  763 ++++++++++++++++++++
 .../sdk/ide/utils/YoctoSDKUtilsConstants.java      |   18 +
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |    2 +-
 10 files changed, 788 insertions(+), 781 deletions(-)
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java +2 -0
index bab6ade..74d97a0 100644
@@ -20,6 +20,8 @@ import java.io.FilenameFilter;
 import java.io.IOException;
 
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
+import org.yocto.sdk.ide.utils.YoctoSDKUtils;
+import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants;
 
 public class YoctoSDKChecker {
 	private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java deleted +0 -758

758 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtilsConstants.java deleted +0 -18
deleted file mode 100644
index 2ead684..0000000
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 BMW Car IT GmbH.
- * 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:
- * BMW Car IT - initial API and implementation
- *******************************************************************************/
-package org.yocto.sdk.ide;
-
-public class YoctoSDKUtilsConstants {
-
-	public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-";
-	public static final String DEFAULT_TMP_PREFIX = "/tmp/";
-
-}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java +1 -1
index 9207e7e..9057b8e 100644
@@ -5,7 +5,7 @@ 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.YoctoSDKUtils;
+import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
 public class YoctoSDKEmptyProjectNature implements IProjectNature {
 
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +1 -1
index 3c842bf..2c6a782 100644
@@ -24,10 +24,10 @@ 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.YoctoSDKUtils;
 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")
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +1 -1
index e94d35d..d6a7c4f 100644
@@ -34,9 +34,9 @@ import org.yocto.sdk.ide.YoctoProfileSetting;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
+import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoSDKMessages;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
-import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
 
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +1 -1
index 34c497b..8251fad 100644
@@ -29,8 +29,8 @@ import org.yocto.sdk.ide.YoctoProjectSpecificSetting;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.YoctoSDKMessages;
+import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
-import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
 
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java new file +763 -0

763 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java new file +18 -0
new file mode 100644
index 0000000..df9c882
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BMW Car IT GmbH.
+ * 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:
+ * BMW Car IT - initial API and implementation
+ *******************************************************************************/
+package org.yocto.sdk.ide.utils;
+
+public class YoctoSDKUtilsConstants {
+
+	public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-";
+	public static final String DEFAULT_TMP_PREFIX = "/tmp/";
+
+}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +1 -1
index 39f7d75..5ffd6b7 100644
@@ -48,8 +48,8 @@ import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
+import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
-import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoUIElement;
 
 
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v3 4/6 Moved nature-related utils in own class

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

Created a nature specific utils class and moved a method that is only relevant in the natures context.

---
 .../ide/natures/YoctoSDKEmptyProjectNature.java    |    3 +-
 .../yocto/sdk/ide/natures/YoctoSDKNatureUtils.java |   39 ++++++++++++++++++++
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |    2 +-
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |   20 ----------
 4 files changed, 41 insertions(+), 23 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java +1 -2
index 9057b8e..6c9a5ac 100644
@@ -5,7 +5,6 @@ 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.utils.YoctoSDKUtils;
 
 public class YoctoSDKEmptyProjectNature implements IProjectNature {
 
@@ -34,7 +33,7 @@ public class YoctoSDKEmptyProjectNature implements IProjectNature {
 	}
 
 	public static void addYoctoSDKEmptyNature(IProject project, IProgressMonitor monitor) throws CoreException {
-		YoctoSDKUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor);
+		YoctoSDKNatureUtils.addNature(project, YoctoSDK_EMPTY_NATURE_ID, monitor);
 	}
 
 }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java new file +39 -0
new file mode 100644
index 0000000..5a2a6b1
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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
+ * BMW Car IT - extracted in an own class
+ *******************************************************************************/
+package org.yocto.sdk.ide.natures;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class YoctoSDKNatureUtils {
+
+	public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException
+	{
+		IProjectDescription description = project.getDescription();
+		String[] natures = description.getNatureIds();
+
+		for (int i = 0; i < natures.length; ++i) {
+			if (natureId.equals(natures[i]))
+				return;
+		}
+
+		String[] newNatures = new String[natures.length + 1];
+		System.arraycopy(natures, 0, newNatures, 0, natures.length);
+		newNatures[natures.length] = natureId;
+		description.setNatureIds(newNatures);
+		project.setDescription(description, monitor);
+
+	}
+
+}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +1 -1
index 2c6a782..a299aa4 100644
@@ -60,7 +60,7 @@ public class YoctoSDKProjectNature implements IProjectNature {
 	}
 
 	public static void addYoctoSDKNature(IProject project, IProgressMonitor monitor) throws CoreException {
-		YoctoSDKUtils.addNature(project, YoctoSDK_NATURE_ID, monitor);
+		YoctoSDKNatureUtils.addNature(project, YoctoSDK_NATURE_ID, monitor);
 	}
 
 	public static void configureAutotoolsOptions(IProject project) {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +0 -20
index 5ccd6e2..2d3850f 100644
@@ -38,10 +38,8 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
 import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.resources.ProjectScope;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.IScopeContext;
 import org.eclipse.debug.core.DebugPlugin;
@@ -616,24 +614,6 @@ public class YoctoSDKUtils {
 
 	}
 
-	public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException
-	{
-		IProjectDescription description = project.getDescription();
-		String[] natures = description.getNatureIds();
-
-		for (int i = 0; i < natures.length; ++i) {
-			if (natureId.equals(natures[i]))
-				return;
-		}
-
-		String[] newNatures = new String[natures.length + 1];
-	    System.arraycopy(natures, 0, newNatures, 0, natures.length);
-	    newNatures[natures.length] = natureId;
-	    description.setNatureIds(newNatures);
-	    project.setDescription(description, monitor);
-
-	}
-
 	public static String getPlatformArch() 
 	{
 		String value = null;
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v3 5/6 Export the new subpackages of org.yocto.sdk.ide

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

---
 plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF |    2 ++
 1 file changed, 2 insertions(+)
plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF +2 -0
index b09abb3..0bdaa85 100644
@@ -29,6 +29,8 @@ Require-Bundle: org.eclipse.ui,
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: org.yocto.sdk.ide,
+ org.yocto.sdk.ide.natures,
+ org.yocto.sdk.ide.utils,
  org.yocto.sdk.ide.actions,
  org.yocto.sdk.ide.preferences,
  org.yocto.sdk.ide.wizard
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v3 6/6 Performed a whitespaces cleanup

In reply to Atanas Gegov

From: Atanas Gegov <[email protected]>

While moving these files into new packages
it turned out that there is a need of whitespaces cleanup.

---
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |    2 +-
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |  102 ++++++++++----------
 2 files changed, 52 insertions(+), 52 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java +1 -1
index a299aa4..fcb296d 100644
@@ -73,7 +73,7 @@ public class YoctoSDKProjectNature implements IProjectNature {
 		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;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +51 -51

244 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#7 lore raw
In reply to Atanas Gegov

Merged to eclipse-poky master. Thanks for the contribution.

Cheers,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Atanas Gegov
Sent: Thursday, March 07, 2013 6:09 AM
To: [email protected]
Subject: [yocto] [eclipse-poky][PATCHv3 0/6] Refactorings in org.yocto.sdk.ide plugin

From: Atanas Gegov <[email protected]>

Hi,

Currently the org.yocto.sdk.ide plugin has the YoctoSDKEmptyProjectNature and the YoctoSDKProjectNature. The latter is strongly coupled with the Autotools nature since this is by now the only supported build system. It would be nice if it is possible to introduce other Yocto IDE projects,e.g. projects using CMake for building.

This patch series does some refactoring in the org.yocto.sdk.ide plugin.
This allows a simplified addition of further natures and enables the decoupling between YoctoSDKProjectNature and the Autotools nature.

The natures and the utils get their own packages. Some methods and members were also moved to suitable classes.

Cheers,
Atanas

Atanas Gegov (6):
Moved YoctoSDK natures to their own package
Moved functionality that does not belong to YoctoSDKProjectNature Moved utils to their own package
Moved nature-related utils in own class
Export the new subpackages of org.yocto.sdk.ide Performed a whitespaces cleanup

 plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF     |    2 +
 plugins/org.yocto.sdk.ide/plugin.xml               |    4 +-
 .../src/org/yocto/sdk/ide/YoctoSDKChecker.java     |   12 +-
 .../yocto/sdk/ide/YoctoSDKEmptyProjectNature.java  |   38 -
 .../org/yocto/sdk/ide/YoctoSDKProjectNature.java   |  267 -------
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |  607 ----------------
 .../ide/natures/YoctoSDKEmptyProjectNature.java    |   39 +
 .../yocto/sdk/ide/natures/YoctoSDKNatureUtils.java |   39 +
 .../sdk/ide/natures/YoctoSDKProjectNature.java     |  111 +++
 .../ide/preferences/YoctoSDKPreferencePage.java    |    4 +-
 .../preferences/YoctoSDKProjectPropertyPage.java   |    2 +-
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java |  743 ++++++++++++++++++++
 .../sdk/ide/utils/YoctoSDKUtilsConstants.java      |   18 +
 .../sdk/ide/wizard/NewYoctoCProjectTemplate.java   |    6 +-
 14 files changed, 969 insertions(+), 923 deletions(-)  delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKEmptyProjectNature.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java

--
1.7.9.5

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto