From b683c6c6dd9f0581ceec3c7aab1d4eebc256aaba Mon Sep 17 00:00:00 2001 From: "gyeongmin.ju" Date: Wed, 29 Mar 2017 14:50:32 +0900 Subject: [PATCH] RTSDK: improve toolchain selection ux on build dialog 1. display current toolchain path. 2. add clear toolchain button Change-Id: I8e4578dda4c4b944e1cebda49b8c09275183a783 Signed-off-by: gyeongmin.ju --- .../src/org/tizen/rt/ide/Messages.java | 3 + .../tizen/rt/ide/build/RtosBuildDialogPage.java | 87 ++++++++++++++++++---- .../src/org/tizen/rt/ide/messages.properties | 31 ++++---- 3 files changed, 88 insertions(+), 33 deletions(-) diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java index 7fd7298..82519e4 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Messages.java @@ -64,6 +64,9 @@ public class Messages extends NLS { public static String FlashHandler_NotFoundBuildInfo; public static String LaunchShortcut_NotFoundBuildInfo; + public static String RtosBuildDialogPage_text_text; + public static String RtosBuildDialogPage_lblNewLabel_text; + public static String RtosBuildDialogPage_clearToolchainBtn_text; static { diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java index 73c5dae..a4b994b 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java @@ -29,9 +29,12 @@ package org.tizen.rt.ide.build; import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.util.List; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.DoubleClickEvent; @@ -61,6 +64,10 @@ import org.eclipse.swt.widgets.TableColumn; import org.tizen.rt.ide.Messages; import org.tizen.rt.ide.RtosCommandManager; import org.tizen.rt.ide.util.ResourceUtil; +import org.tizen.rt.ide.util.SDKUtil; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.events.SelectionAdapter; /** * DeviceGuideDialogPage Select Emulator Wizard Feature @@ -80,6 +87,10 @@ public class RtosBuildDialogPage extends WizardPage { private Button selectToolchainBtn; private Button kernelConfigBtn; private Browser browser; + private Text toolchainText; + private Composite composite; + private Label lblNewLabel; + private Button clearToolchainBtn; protected RtosBuildDialogPage(String pageName, Shell shell) { super(pageName); @@ -125,6 +136,7 @@ public class RtosBuildDialogPage extends WizardPage { @Override public void selectionChanged(SelectionChangedEvent event) { selectToolchainBtn.setEnabled(false); + clearToolchainBtn.setEnabled(false); IStructuredSelection selection = (IStructuredSelection) event.getSelection(); for (Object o : selection.toArray()) { String board = (String) o; @@ -133,7 +145,9 @@ public class RtosBuildDialogPage extends WizardPage { List testList = RtosCommandManager.getBuildOptions(board); buildOptionTableViewer.setInput(testList); if (testList != null && !testList.isEmpty()) { - selectToolchainBtn.setEnabled(testList.get(0).getSetEnv()); + boolean isActive = testList.get(0).getSetEnv(); + selectToolchainBtn.setEnabled(isActive); + clearToolchainBtn.setEnabled(isActive); } } } @@ -196,32 +210,56 @@ public class RtosBuildDialogPage extends WizardPage { browser.setJavascriptEnabled(false); browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - // Button group area - Composite btnGroupComposite = new Composite(container, SWT.NONE); - btnGroupComposite.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false, 2, 1)); - RowLayout btnLayout = new RowLayout(SWT.HORIZONTAL); - btnLayout.marginLeft = 0; - btnLayout.spacing = 5; - btnLayout.pack = false; - btnGroupComposite.setLayout(btnLayout); + composite = new Composite(container, SWT.NONE); + composite.setLayout(new GridLayout(4, false)); + composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + lblNewLabel = new Label(composite, SWT.NONE); + lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblNewLabel.setText(Messages.RtosBuildDialogPage_lblNewLabel_text); + + toolchainText = new Text(composite, SWT.BORDER); + toolchainText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + toolchainText.setEditable(false); - selectToolchainBtn = new Button(btnGroupComposite, SWT.NONE); + selectToolchainBtn = new Button(composite, SWT.NONE); selectToolchainBtn.setText(Messages.RtosBuildDialogPage_ToolchainButtonText); selectToolchainBtn.setEnabled(false); - selectToolchainBtn.addSelectionListener(new SelectionListener() { - @Override - public void widgetDefaultSelected(SelectionEvent arg0) { - } + clearToolchainBtn = new Button(composite, SWT.NONE); + clearToolchainBtn.setText(Messages.RtosBuildDialogPage_clearToolchainBtn_text); + clearToolchainBtn.setEnabled(false); + + selectToolchainBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SHEET); dialog.setMessage(Messages.RtosBuildDialogPage_ToolchainDialogMessage); String toolchainPath = dialog.open(); - RtosBuildWizardDialog.selectionToolchain(toolchainPath); + if (toolchainPath != null) { + toolchainText.setText(toolchainPath); + RtosBuildWizardDialog.selectionToolchain(toolchainPath); + } + } + }); + + clearToolchainBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + toolchainText.setText(""); + RtosBuildWizardDialog.selectionToolchain(null); } }); + // Button group area + Composite btnGroupComposite = new Composite(container, SWT.NONE); + btnGroupComposite.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false, 2, 1)); + RowLayout btnLayout = new RowLayout(SWT.HORIZONTAL); + btnLayout.marginLeft = 0; + btnLayout.spacing = 5; + btnLayout.pack = false; + btnGroupComposite.setLayout(btnLayout); + kernelConfigBtn = new Button(btnGroupComposite, SWT.NONE); kernelConfigBtn.setText(Messages.RtosBuildDialogPage_KernelConfigButtonText); kernelConfigBtn.setEnabled(false); @@ -242,10 +280,29 @@ public class RtosBuildDialogPage extends WizardPage { } }); + initialize(); + dialogChanged(); + setControl(parentComposite); } /** + * Tests if the current workbench selection is a suitable container to use. + */ + private void initialize() { + String toolchainPath = RtosBuildWizardDialog.getSelectionToolchain(); + if (toolchainPath != null) { + toolchainText.setText(RtosBuildWizardDialog.getSelectionToolchain()); + } else { + toolchainText.setText(""); + } + } + + private void dialogChanged() { + + } + + /** * @return the shell */ public Shell getShell() { diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties index fb6764c..382cbde 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/messages.properties @@ -1,33 +1,28 @@ -NewArtikProjectWizard_CreateOperationLabel=Create new TizenRT project -NewArtikProjectWizard_WindowTitle=New TizenRT Project - -NewArtikProjectWizardPage_Description=Create a TizenRT project in the workspace or in an external location -NewArtikProjectWizardPage_Title=Create a TizenRT Project - +#Eclipse modern messages class +#Wed Mar 29 14:25:05 KST 2017 +FlashHandler_NotFoundBuildInfo=Flash can not be performed. Please build it first. +LaunchShortcut_NotFoundBuildInfo=Debug can not be performed. Please build it first. NewArtikProjectWizardPage2_Description=Select one of the available board templates to generate a fully-functioning project -NewArtikProjectWizardPage2_Title=Select a Board Template -NewArtikProjectWizardPage2_LabelBoard=Board : +NewArtikProjectWizardPage2_LabelBoard=Board \: NewArtikProjectWizardPage2_LabelBoardName=Board Name NewArtikProjectWizardPage2_NameColumn=Name - +NewArtikProjectWizardPage2_Title=Select a Board Template +NewArtikProjectWizardPage_Description=Create a TizenRT project in the workspace or in an external location +NewArtikProjectWizardPage_Title=Create a TizenRT Project +NewArtikProjectWizard_CreateOperationLabel=Create new TizenRT project +NewArtikProjectWizard_WindowTitle=New TizenRT Project RtosBuildDialogPage_BoardNameColumn=Boards RtosBuildDialogPage_Description=Select one of the available board and build option for build RtosBuildDialogPage_KconfigErrorMessage=Could not execute kconfig RtosBuildDialogPage_KernelConfigButtonText=Kernel Config RtosBuildDialogPage_OptionNameColumn=Build Options RtosBuildDialogPage_Title=Build Project -RtosBuildDialogPage_ToolchainButtonText=Toolchain Path Select +RtosBuildDialogPage_ToolchainButtonText=Browse RtosBuildDialogPage_ToolchainDialogMessage=Select the toolchain path - +RtosBuildDialogPage_clearToolchainBtn_text=Clear +RtosBuildDialogPage_lblNewLabel_text=Toolchain Path\: RtosBuildWizard_WindowTitle=Rtos Build - RtosFlashDialogPage_Description=Select one of the available flash option for flashing RtosFlashDialogPage_OptionNameColumn=Flash Options RtosFlashDialogPage_Title=Flash Project - RtosFlashWizard_WindowTitle=Rtos Flash - -FlashHandler_NotFoundBuildInfo=Flash can not be performed. Please build it first. - -LaunchShortcut_NotFoundBuildInfo=Debug can not be performed. Please build it first. - -- 2.7.4