From: Timo Mueller <timo.muel...@bmw-carit.de> 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
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java index d7021be..e255fd1 100644 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java @@ -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() { diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/SDKLocationDialog.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/SDKLocationDialog.java deleted file mode 100644 index 439d720..0000000 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/SDKLocationDialog.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * 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.actions; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -import org.yocto.sdk.ide.YoctoGeneralException; -import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom; -import org.yocto.sdk.ide.YoctoUIElement; -import org.yocto.sdk.ide.YoctoUISetting; - -public class SDKLocationDialog extends Dialog { - private String title; - private YoctoUISetting yoctoUISetting; - private YoctoUIElement elem; - - public SDKLocationDialog(Shell parentShell, String dialogTitle, YoctoUIElement elem) { - super(parentShell); - this.setElem(elem); - this.yoctoUISetting = new YoctoUISetting(elem); - this.title = dialogTitle; - setShellStyle(getShellStyle() | SWT.RESIZE); - - } - - @Override - protected Control createDialogArea(Composite parent) { - final Composite result = (Composite) super.createDialogArea(parent); - - try { - yoctoUISetting.createComposite(result); - yoctoUISetting.validateInput(SDKCheckRequestFrom.Menu, false); - } catch (YoctoGeneralException e) { - // TODO Auto-generated catch block - System.out.println("Have you ever set the project specific Yocto Settings?"); - System.out.println(e.getMessage()); - } - - return result; - } - - - @Override - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - newShell.setText(title); - } - - protected void buttonPressed(int buttonId) { - if (buttonId == IDialogConstants.OK_ID) { - //this should not be called in fact, because widget change should be called firstly! - try { - yoctoUISetting.validateInput(SDKCheckRequestFrom.Menu, true); - this.setElem(yoctoUISetting.getCurrentInput()); - super.buttonPressed(buttonId); - } catch (YoctoGeneralException e) { - // TODO Auto-generated catch block - System.out.println(e.getMessage()); - } - } - else if (buttonId == IDialogConstants.CANCEL_ID) - { - super.buttonPressed(buttonId); - } - } - - public void setElem(YoctoUIElement elem) { - this.elem = elem; - } - - public YoctoUIElement getElem() { - return elem; - } - -} -- 1.7.7.6 _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto