Skip to contentSkip to conversation

Enable setting yocto settings in the project properties dialog

PATCH In review [email protected] 2 participants 10 messages Dec 4, 2012 – Dec 8, 2012

lore
Share & tools
lore
#0 lore raw

cover Enable setting yocto settings in the project properties dialog

From: Timo Mueller <[email protected]>

Hi,

changing the yocto settings of a project is currently achieved through a separate dialog. This dialog can be opened via the eclipse menu bar (project -> change yocto project settings). Typically all project related settings in eclipse are located in the project properties dialog.

This patch series adds yocto settings to the project properties dialog. It also removes the separate dialog. Instead the yocto section in the project properties is opened if "change yocto project settings" is selected from the menu bar.

Best regards,
Atanas and Timo

Atanas Gegov (4):
plugins/sdk.ide: Allow using a YoctoUIElement to set the input of a
yocto settings widget
plugins/sdk.ide: Create a default YoctoUIElement from the preference
store
plugins/sdk.ide: Use new setCurrentInput method to set defaults plugins/sdk.ide: Remove fControl array that is no longer needed

Timo Mueller (4):
plugins/sdk.ide: Added empty yocto preference page to project
properties
plugins/sdk.ide: Move modification of yocto project settings to utils
class
plugins/sdk.ide: Show yocto ui setting widget in project property
page
plugins/sdk.ide: Open project properties instead of standalone yocto
settings dialog

 .../OSGI-INF/l10n/bundle.properties                |    1 +
 plugins/org.yocto.sdk.ide/plugin.xml               |   14 +++
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   67 ++++++++++++
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   54 +++++++---
 .../yocto/sdk/ide/actions/ReconfigYoctoAction.java |   64 ++---------
 .../yocto/sdk/ide/actions/SDKLocationDialog.java   |   89 ----------------
 .../ide/preferences/YoctoSDKPreferencePage.java    |   51 +---------
 .../preferences/YoctoSDKProjectPropertyPage.java   |  111 ++++++++++++++++++++
 8 files changed, 247 insertions(+), 204 deletions(-)
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/SDKLocationDialog.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/8 plugins/sdk.ide: Allow using a YoctoUIElement to set the input of a yocto settings widget

From: Atanas Gegov <[email protected]>

Currently a YoctoUIElement is used to create a YoctoUISetting widget. It is also possible to retrieve a YoctoUIElement containing the current input of the widget. This patch adds the capability to also set the input of the widget using a YoctoUIElement. Instead of using the fControl array clients can now use this method to set the input of the widget.

---
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   40 ++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java +40 -0
index b4625f6..53af8f0 100644
@@ -307,6 +307,46 @@ public class YoctoUISetting {
 		return elem;
 	}
 
+	public void setCurrentInput(YoctoUIElement elem){
+		btnSDKRoot.setSelection(false);
+		btnPokyRoot.setSelection(false);
+		if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_SDK_MODE)){
+			btnSDKRoot.setSelection(true);
+		}
+		else if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_TREE_MODE)){
+			btnPokyRoot.setSelection(true);
+		}
+
+		btnQemu.setSelection(false);
+		btnDevice.setSelection(false);
+		if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.QEMU_MODE)){
+			btnQemu.setSelection(true);
+		}
+		else if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.DEVICE_MODE)){
+			btnDevice.setSelection(true);
+		}
+
+		textRootLoc.setText(elem.getStrToolChainRoot());
+		targetArchCombo.select(elem.getIntTargetIndex());
+		if(elem.getStrTargetsArray() == null){
+			targetArchCombo.setItems(new String[]{});
+		}
+		else {
+			targetArchCombo.setItems(elem.getStrTargetsArray());
+		}
+		targetArchCombo.setText(elem.getStrTarget());
+		textKernelLoc.setText(elem.getStrQemuKernelLoc());
+		textQemuOption.setText(elem.getStrQemuOption());
+		textSysrootLoc.setText(elem.getStrSysrootLoc());
+
+		try {
+			validateInput(SDKCheckRequestFrom.Preferences, false);
+		} catch (YoctoGeneralException e) {
+			System.out.println("Have you ever set Yocto Project Reference before?");
+			System.out.println(e.getMessage());
+		}
+	}
+
 	public boolean validateInput(SDKCheckRequestFrom from, boolean bPrompt) throws YoctoGeneralException {
 		YoctoUIElement elem = getCurrentInput();
 		boolean pass = true;
Signature · 1 line
1.7.7.6
#2 lore raw

PATCH 2/8 plugins/sdk.ide: Create a default YoctoUIElement from the preference store

From: Atanas Gegov <[email protected]>

Adds a method to create a YoctoUIElement that contains the content of the yocto settings stored in the plugin's default preference store.

---
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   25 ++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +25 -0
index 749fac7..16035fd 100644
@@ -465,6 +465,31 @@ public class YoctoSDKUtils {
 		return elem;
 	}
 
+	/* Load default IDE wide POKY Preference settings into YoctoUIElement */
+	public static YoctoUIElement getDefaultElemFromStore()
+	{
+		IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore();
+		YoctoUIElement elem = new YoctoUIElement();
+		if (store.getDefaultString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE))
+			elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
+		else
+			elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
+
+		elem.setStrToolChainRoot(store.getDefaultString(PreferenceConstants.TOOLCHAIN_ROOT));
+		elem.setStrTarget(store.getDefaultString(PreferenceConstants.TOOLCHAIN_TRIPLET));
+		elem.setIntTargetIndex(store.getDefaultInt(PreferenceConstants.TARGET_ARCH_INDEX));
+		elem.setStrQemuKernelLoc(store.getDefaultString(PreferenceConstants.QEMU_KERNEL));
+		elem.setStrQemuOption(store.getDefaultString(PreferenceConstants.QEMU_OPTION));
+		elem.setStrSysrootLoc(store.getDefaultString(PreferenceConstants.SYSROOT));
+
+		if (store.getDefaultString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE))
+			elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
+		else
+			elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
+
+		return elem;
+	}
+
 	public static String qemuTargetTranslate(String strTargetArch) 
 	{
 		String qemu_target = "";
Signature · 1 line
1.7.7.6
#3 lore raw

PATCH 3/8 plugins/sdk.ide: Use new setCurrentInput method to set defaults

From: Atanas Gegov <[email protected]>

Removes the error prone method of using the fControls array and uses the new YoctoUIElement interface.

Improved method of setting default preferences (globally)

---
 .../ide/preferences/YoctoSDKPreferencePage.java    |   51 +------------------
 1 files changed, 3 insertions(+), 48 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +3 -48
index b75bdc1..d1c1a72 100644
@@ -89,58 +89,13 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 			return false;
 		}		
 	}
-	
+
 	/*
 	 * @see PreferencePage#performDefaults()
 	 */
 	protected void performDefaults() {
-		IPreferenceStore store= getPreferenceStore();
-		ArrayList<Control> arrControls =  this.yoctoUISetting.getfControls();
-		
-		for (int i = 0; i < arrControls.size(); i++)
-		{
-			Control control = arrControls.get(i);
-			String[] controlData = (String[])control.getData();
-			String sKey = controlData[0];
-			if (control instanceof Button)
-			{
-				sKey = sKey.substring(0, sKey.lastIndexOf("_"));
-			}
-			String sValue = store.getDefaultString(sKey);
-			if (control instanceof Button)
-			{
-				if (sValue.equalsIgnoreCase("true"))
-				{
-					if (controlData[0].endsWith("_1")) //the 1st radio button of the group
-						((Button)control).setSelection(true);
-					else
-						((Button)control).setSelection(false);//the 2nd radio button of the group
-				}
-				else
-				{
-					if (controlData[0].endsWith("_1")) //the 1st radio button of the group
-						((Button)control).setSelection(false);
-					else
-						((Button)control).setSelection(true);//the 2nd radio button of the group
-				}
-			}
-			else if (control instanceof Text)
-			{
-				((Text)control).setText(sValue);
-			}
-			else if (control instanceof Combo)
-			{
-				if (!sValue.isEmpty())
-					((Combo)control).select(Integer.valueOf(sValue).intValue());
-			}
-		}
-
-		try {
-			yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
-		} catch (YoctoGeneralException e) {
-			System.out.println("Have you ever set Yocto Project Reference before?");
-			System.out.println(e.getMessage());
-		}
+		YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromStore();
+		yoctoUISetting.setCurrentInput(defaultElement);
 		super.performDefaults();
 	}
 
Signature · 1 line
1.7.7.6
#4 lore raw

PATCH 4/8 plugins/sdk.ide: Remove fControl array that is no longer needed

From: Atanas Gegov <[email protected]>

The setCurrentInput method replaces the functionality that was provided by the fControl array.

---
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java +0 -14
index 53af8f0..0fbfde0 100644
@@ -43,7 +43,6 @@ import org.yocto.sdk.ide.preferences.PreferenceConstants;
 public class YoctoUISetting {
 
 	private static final String ENV_SCRIPT_FILE_PREFIX = "environment-setup-";
-	private ArrayList<Control> fControls;
 
 	private SelectionListener fSelectionListener;
 	private ModifyListener fModifyListener;
@@ -66,7 +65,6 @@ public class YoctoUISetting {
 
 	public YoctoUISetting(YoctoUIElement elem)
 	{
-		fControls = new ArrayList<Control>();
 		yoctoUIElement = elem;
 		elem.setStrTargetsArray(getTargetArray(elem));
 
@@ -88,11 +86,8 @@ public class YoctoUISetting {
 
 	private Control addControls(Control fControl, final String sKey, String sValue)
 	{
-
 		fControl.setData(new String[]{sKey,sValue});
-		fControls.add(fControl);
 		return fControl;
-
 	}
 
 	private Control addRadioButton(Composite parent, String label, String key, boolean bSelected) {
@@ -375,15 +370,6 @@ public class YoctoUISetting {
 		return pass;
 	}
 
-
-	public void setfControls(ArrayList<Control> fControls) {
-		this.fControls = fControls;
-	}
-
-	public ArrayList<Control> getfControls() {
-		return fControls;
-	}
-
 	private void updateQemuControlState()
 	{
 		boolean bQemuMode = btnQemu.getSelection();
Signature · 1 line
1.7.7.6
#5 lore raw

PATCH 5/8 plugins/sdk.ide: Added empty yocto preference page to project properties

From: Timo Mueller <[email protected]>

Adds an empty preference page to projects with the YoctoSDKNature. This preference page is shown in the standard project properties dialog and will later allow modifying the yocto settings of the project.

---
 .../OSGI-INF/l10n/bundle.properties                |    1 +
 plugins/org.yocto.sdk.ide/plugin.xml               |   14 +++++++++
 .../preferences/YoctoSDKProjectPropertyPage.java   |   29 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties +1 -0
index d0bf9b7..a7172be 100644
@@ -5,5 +5,6 @@ command.name = ReconfigureYoctoProject
 command.label.0 = Change Yocto Project Settings
 command.mnemonic = C
 projectType.name.0 = Yocto Project ADT Project
+projectProperties.label.0 = Yocto Project Settings
 Bundle-Vendor = yoctoproject.org
 Bundle-Name = Yocto Plugin IDE
plugins/org.yocto.sdk.ide/plugin.xml +14 -0
index c540b9b..6548ae2 100644
@@ -180,5 +180,19 @@
             id="org.yocto.sdk.ide.YoctoConsole">
       </CBuildConsole>
    </extension>
+   <extension
+         point="org.eclipse.ui.propertyPages">
+      <page
+            adaptable="true"
+            class="org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage"
+            id="org.yocto.sdk.ide.page"
+            name="%projectProperties.label.0"
+            objectClass="org.eclipse.core.resources.IProject">
+         <filter
+               name="projectNature"
+               value="org.yocto.sdk.ide.YoctoSDKNature">
+         </filter>
+      </page>
+   </extension>
 
 </plugin>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java new file +29 -0
new file mode 100644
index 0000000..265c8dc
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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 GmbH - initial implementation
+ *******************************************************************************/
+package org.yocto.sdk.ide.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class YoctoSDKProjectPropertyPage extends PropertyPage implements
+		IWorkbenchPropertyPage {
+
+	public YoctoSDKProjectPropertyPage() {
+	}
+
+	@Override
+	protected Control createContents(Composite parent) {
+		return null;
+	}
+
+}
Signature · 1 line
1.7.7.6
#6 lore raw

PATCH 6/8 plugins/sdk.ide: Move modification of yocto project settings to utils class

From: Timo Mueller <[email protected]>

Saving yocto project settings is currently only used by the "Change Yocto Project Settings" command. To allow other UI elements (e.g. project property pages) to modify the yocto settings of a project the functionality has been extraced to a separate method and moved to the utils class.

---
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   42 ++++++++++++++++++++
 .../yocto/sdk/ide/actions/ReconfigYoctoAction.java |   41 ++-----------------
 2 files changed, 46 insertions(+), 37 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +42 -0
index 16035fd..7ea4262 100644
@@ -22,10 +22,12 @@ import java.util.HashMap;
 import java.util.Iterator;
 
 import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ConsoleOutputStream;
 import org.eclipse.cdt.core.envvar.IContributedEnvironment;
 import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
 import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
 import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.resources.IConsole;
 import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
 import org.eclipse.cdt.core.settings.model.ICProjectDescription;
 import org.eclipse.core.resources.IProject;
@@ -75,6 +77,7 @@ public class YoctoSDKUtils {
 	private static final String DEFAULT_SYSROOT_PREFIX = "--sysroot=";
 	private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot=";
 	private static final String SYSROOTS_DIR = "sysroots";
+	private static final String CONSOLE_MESSAGE  = "Menu.SDK.Console.Configure.Message";
 
 	public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {		
 		
@@ -418,6 +421,45 @@ public class YoctoSDKUtils {
 			elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
 		return elem;
 	}
+	
+	/* Save YoctoUIElement to project settings */
+	public static void saveElemToProjectEnv(IProject project, YoctoUIElement elem)
+	{
+		ConsoleOutputStream consoleOutStream = null;
+		
+		try {
+			YoctoSDKProjectNature.setEnvironmentVariables(project, elem);
+			YoctoSDKProjectNature.configureAutotoolsOptions(project);
+			IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
+			console.start(project);
+			consoleOutStream = console.getOutputStream();
+			String messages = YoctoSDKMessages.getString(CONSOLE_MESSAGE);
+			consoleOutStream.write(messages.getBytes());
+		}
+		catch (CoreException e)
+		{
+			System.out.println(e.getMessage());
+		}
+		catch (IOException e)
+		{
+			System.out.println(e.getMessage());
+		}
+		catch (YoctoGeneralException e)
+		{
+			System.out.println(e.getMessage());
+		}
+		finally {
+			if (consoleOutStream != null) {
+				try {
+					consoleOutStream.flush();
+					consoleOutStream.close();
+				}
+				catch (IOException e) {
+					// ignore
+				}
+			}
+		}
+	}
 
 	/* Load IDE wide POKY Preference settings into Preference Store */
 	public static void saveElemToStore(YoctoUIElement elem)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java +4 -37

64 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#7 lore raw

PATCH 7/8 plugins/sdk.ide: Show yocto ui setting widget in project property page

From: Timo Mueller <[email protected]>

The yocto property page in a project's properties dialog will now show the yocto settings that are also used in the global yocto preferences dialog. On save the defined values will be stored to the project's environment.

---
 .../preferences/YoctoSDKProjectPropertyPage.java   |   88 +++++++++++++++++++-
 1 files changed, 85 insertions(+), 3 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +85 -3
index 265c8dc..92d476a 100644
@@ -1,5 +1,6 @@
 /*******************************************************************************
  * Copyright (c) 2012 BMW Car IT GmbH.
+ * Copyright (c) 2010 Intel.
  * 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
@@ -7,23 +8,104 @@
  *
  * Contributors:
  * BMW Car IT GmbH - initial implementation
+ * Intel - initial API implementation (copied from YoctoSDKPreferencePage)
  *******************************************************************************/
 package org.yocto.sdk.ide.preferences;
 
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbenchPropertyPage;
 import org.eclipse.ui.dialogs.PropertyPage;
+import org.yocto.sdk.ide.YoctoGeneralException;
+import org.yocto.sdk.ide.YoctoSDKUtils;
+import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
+import org.yocto.sdk.ide.YoctoUIElement;
+import org.yocto.sdk.ide.YoctoUISetting;
 
 public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 		IWorkbenchPropertyPage {
 
-	public YoctoSDKProjectPropertyPage() {
-	}
+	private YoctoUISetting yoctoUISetting;
+	private IProject project = null;
 
 	@Override
 	protected Control createContents(Composite parent) {
-		return null;
+		YoctoUIElement uiElement = loadUIElement();
+		this.yoctoUISetting = new YoctoUISetting(uiElement);
+
+		initializeDialogUnits(parent);
+		final Composite result = new Composite(parent, SWT.NONE);
+
+		try {
+			yoctoUISetting.createComposite(result);
+			yoctoUISetting
+					.validateInput(SDKCheckRequestFrom.Preferences, false);
+			Dialog.applyDialogFont(result);
+			return result;
+		} catch (YoctoGeneralException e) {
+			System.out.println("Have you ever set Yocto Project Reference before?");
+			System.out.println(e.getMessage());
+			return result;
+		}
+	}
+
+	private IProject getProject() {
+		if (project != null) {
+			return project;
+		}
+
+		IAdaptable adaptable = getElement();
+		if (adaptable == null) {
+			throw new IllegalStateException("Project can only be retrieved after properties page has been set up.");
+		}
+
+		project = (IProject) adaptable.getAdapter(IProject.class);
+		return project;
+	}
+
+	private YoctoUIElement loadUIElement() {
+		YoctoUIElement uiElement = YoctoSDKUtils.getElemFromProjectEnv(getProject());
+
+		if (uiElement.getStrToolChainRoot().isEmpty()
+				|| uiElement.getStrTarget().isEmpty()) {
+			// No project environment has been set yet, use the Preference
+			// values
+			uiElement = YoctoSDKUtils.getElemFromStore();
+		}
+
+		return uiElement;
+	}
+
+	/*
+	 * @see PreferencePage#performDefaults()
+	 */
+	@Override
+	protected void performDefaults() {
+		YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromStore();
+		yoctoUISetting.setCurrentInput(defaultElement);
+		super.performDefaults();
 	}
 
+	/*
+	 * @see IPreferencePage#performOk()
+	 */
+	@Override
+	public boolean performOk() {
+		try {
+			yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true);
+
+			YoctoUIElement elem = yoctoUISetting.getCurrentInput();
+			YoctoSDKUtils.saveElemToProjectEnv(getProject(), elem);
+
+			return super.performOk();
+		} catch (YoctoGeneralException e) {
+			// TODO Auto-generated catch block
+			System.out.println(e.getMessage());
+			return false;
+		}
+	}
 }
Signature · 1 line
1.7.7.6
#8 lore raw

PATCH 8/8 plugins/sdk.ide: Open project properties instead of standalone yocto settings dialog

From: Timo Mueller <[email protected]>

As the yocto settings can now be set via the project's property pages, the "Change Yocto Project Settings" will now open the property page instead of showing the a standalone dialog.

---
 .../yocto/sdk/ide/actions/ReconfigYoctoAction.java |   29 ++----
 .../yocto/sdk/ide/actions/SDKLocationDialog.java   |   89 --------------------
 2 files changed, 10 insertions(+), 108 deletions(-)
 delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/SDKLocationDialog.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java +10 -19
index d7021be..e255fd1 100644
@@ -14,16 +14,13 @@ import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction;
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.widgets.Shell;
-import org.yocto.sdk.ide.YoctoSDKMessages;
-import org.yocto.sdk.ide.YoctoSDKUtils;
-import org.yocto.sdk.ide.YoctoUIElement;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.yocto.sdk.ide.YoctoSDKPlugin;
 
 
 @SuppressWarnings("restriction")
 public class ReconfigYoctoAction extends InvokeAction {
-    private static final String DIALOG_TITLE  = "Menu.SDK.Dialog.Title";
-
 	
 	public void run(IAction action) {
 		IContainer container = getSelectedContainer();
@@ -32,19 +29,13 @@ public class ReconfigYoctoAction extends InvokeAction {
 
 		IProject project = container.getProject();
 
-		//Try to get the per project configuration first
-		YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
-		if (elem.getStrToolChainRoot().isEmpty()|| elem.getStrTarget().isEmpty()){
-			// No project environment has been set yet, use the Preference values
-			elem = YoctoSDKUtils.getElemFromStore();
-		} 
-
-		SDKLocationDialog optionDialog = new SDKLocationDialog(new Shell(), YoctoSDKMessages.getString(DIALOG_TITLE), elem);
-		optionDialog.open();
-		elem = optionDialog.getElem();
-		if (elem.getStrToolChainRoot() != null) {
-			YoctoSDKUtils.saveElemToProjectEnv(project, elem);
-		}
+		PreferenceDialog dialog =
+				PreferencesUtil.createPropertyDialogOn(YoctoSDKPlugin.getActiveWorkbenchShell(), 
+														project,
+														"org.yocto.sdk.ide.page",
+														null,
+														null);
+		dialog.open();
 	}
 
 	public void dispose() {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/SDKLocationDialog.java deleted +0 -89

89 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#9 lore raw
In reply to [email protected]

Hi Timo,

Great patch set and merged to eclipse-poky master.

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Tuesday, December 04, 2012 1:22 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [PATCH 0/8][eclipse-poky] Enable setting yocto settings in the project properties dialog

From: Timo Mueller <[email protected]>

Hi,

changing the yocto settings of a project is currently achieved through a separate dialog. This dialog can be opened via the eclipse menu bar (project -> change yocto project settings). Typically all project related settings in eclipse are located in the project properties dialog.

This patch series adds yocto settings to the project properties dialog. It also removes the separate dialog. Instead the yocto section in the project properties is opened if "change yocto project settings" is selected from the menu bar.

Best regards,
Atanas and Timo

Atanas Gegov (4):
plugins/sdk.ide: Allow using a YoctoUIElement to set the input of a
yocto settings widget
plugins/sdk.ide: Create a default YoctoUIElement from the preference
store
plugins/sdk.ide: Use new setCurrentInput method to set defaults plugins/sdk.ide: Remove fControl array that is no longer needed

Timo Mueller (4):
plugins/sdk.ide: Added empty yocto preference page to project
properties
plugins/sdk.ide: Move modification of yocto project settings to utils
class
plugins/sdk.ide: Show yocto ui setting widget in project property
page
plugins/sdk.ide: Open project properties instead of standalone yocto
settings dialog

 .../OSGI-INF/l10n/bundle.properties                |    1 +
 plugins/org.yocto.sdk.ide/plugin.xml               |   14 +++
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   67 ++++++++++++
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   54 +++++++---
 .../yocto/sdk/ide/actions/ReconfigYoctoAction.java |   64 ++---------
 .../yocto/sdk/ide/actions/SDKLocationDialog.java   |   89 ----------------
 .../ide/preferences/YoctoSDKPreferencePage.java    |   51 +---------
 .../preferences/YoctoSDKProjectPropertyPage.java   |  111 ++++++++++++++++++++
 8 files changed, 247 insertions(+), 204 deletions(-)  delete mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/SDKLocationDialog.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java

--
1.7.7.6

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