From 9604311750a22ac5e275828a1cf8c2176b4ff015 Mon Sep 17 00:00:00 2001 From: "gyeongmin.ju" Date: Fri, 17 Feb 2017 17:44:40 +0900 Subject: [PATCH] RTSDK: add kernel config cmd Change-Id: Ib80426b535506630eb3f207168e29f1d22cb3939 --- .../src/org/tizen/rt/ide/RtosCommandManager.java | 8 +-- .../src/org/tizen/rt/ide/Win32FlashCommand.java | 9 +-- .../tizen/rt/ide/build/RtosBuildDialogPage.java | 71 ++++++++++++---------- .../src/org/tizen/rt/ide/util/ProcUtil.java | 4 +- .../src/org/tizen/rt/ide/util/WorkspaceUtil.java | 43 +++++++++++++ 5 files changed, 93 insertions(+), 42 deletions(-) create mode 100644 rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/WorkspaceUtil.java diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/RtosCommandManager.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/RtosCommandManager.java index 130d972..53fa962 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/RtosCommandManager.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/RtosCommandManager.java @@ -76,7 +76,7 @@ public class RtosCommandManager { boolean isUpdate = false; - ArrayList list = RtosCommandManager.getBuildOptions(); + List list = RtosCommandManager.getBuildOptions(); buildOptionListClear(); buildOptionList = new ArrayList(list); @@ -112,7 +112,7 @@ public class RtosCommandManager { }); } - public static ArrayList getBuildOptions() { + public static List getBuildOptions() { buildOptionListClear(); @@ -210,7 +210,7 @@ public class RtosCommandManager { logger.error("ConsoleManager is null"); return false; } - ArrayList result = null; + List result = null; // if (OSChecker.isLinux()) { // LinuxFlashCommand linuxFlashCommand = new LinuxFlashCommand(); // result = linuxFlashCommand.executeFlash(Option, consoleManager, monitor); @@ -228,7 +228,7 @@ public class RtosCommandManager { * @param consoleManager * @return success or not */ - private static boolean processResult(ArrayList result, ConsoleManager consoleManager) { + private static boolean processResult(List result, ConsoleManager consoleManager) { boolean success = result.size() == 0; if (consoleManager != null) { consoleManager.print("[STATUS] ", SWT.BOLD, ResourceManager.BLACK); diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Win32FlashCommand.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Win32FlashCommand.java index db5123a..c178150 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Win32FlashCommand.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Win32FlashCommand.java @@ -30,6 +30,7 @@ import java.io.File; import java.io.FilenameFilter; import java.io.InputStreamReader; import java.util.ArrayList; +import java.util.List; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -69,10 +70,10 @@ public class Win32FlashCommand { private final String LINUX_EXECUTE_BUILD = "./openocd_linux64 -f"; - private ArrayList resultFlashOptionList = new ArrayList(); - private ArrayList resultFlashExecute = new ArrayList(); + private List resultFlashOptionList = new ArrayList(); + private List resultFlashExecute = new ArrayList(); - protected ArrayList executeFindFlashOption() { + protected List executeFindFlashOption() { /** * @@ -125,7 +126,7 @@ public class Win32FlashCommand { return resultFlashOptionList; } - protected ArrayList executeFlash(String buildOption, ConsoleManager consoleManager, + protected List executeFlash(String buildOption, ConsoleManager consoleManager, IProgressMonitor monitor) { LINUX_FLASH_OPTION_PATH = RtosCommandManager.rtoshome + "/build/configs/sidk_s5jt200/openocd/"; 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 f419aa9..9cdfd61 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 @@ -25,12 +25,11 @@ package org.tizen.rt.ide.build; -import java.util.ArrayList; +import java.io.File; +import java.io.IOException; +import java.util.List; -import org.eclipse.jface.layout.TableColumnLayout; import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ColumnPixelData; -import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -40,18 +39,21 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.PlatformUI; import org.tizen.rt.ide.RtosCommandManager; +import org.tizen.rt.ide.util.WorkspaceUtil; /** * DeviceGuideDialogPage Select Emulator Wizard Feature @@ -82,13 +84,10 @@ public class RtosBuildDialogPage extends WizardPage { Composite composite = new Composite(parentComposite, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - composite.setLayout(new GridLayout(1, false)); GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); gridData.minimumHeight = 0; composite.setLayoutData(gridData); - - TableColumnLayout layout = new TableColumnLayout(); - composite.setLayout(layout); + composite.setLayout(new GridLayout(1, false)); tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @@ -103,30 +102,38 @@ public class RtosBuildDialogPage extends WizardPage { }); table = tableViewer.getTable(); + table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); table.setHeaderVisible(true); table.setLinesVisible(true); - - TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); - TableColumn tblclmnPixel100 = tableViewerColumn.getColumn(); - layout.setColumnData(tblclmnPixel100, new ColumnPixelData(500, true, true)); - // tblclmnPixel100.setText("Name"); - tblclmnPixel100.setText("Build Options"); - - // TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE); - // TableColumn tblclmnWeight2 = tableViewerColumn_1.getColumn(); - // //Specify width using weights - // layout.setColumnData(tblclmnWeight2, new ColumnWeightData(2, - // ColumnWeightData.MINIMUM_WIDTH, true)); - // //tblclmnWeight2.setText("Resolution"); - // tblclmnWeight2.setText(AutoEmulMessages.SELECT_EMULATOR_ITEM_RESULUTION); - // - // TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewer, SWT.NONE); - // TableColumn tblclmnWeight4 = tableViewerColumn_2.getColumn(); - // //Specify width using weights - // layout.setColumnData(tblclmnWeight4, new ColumnWeightData(4, - // ColumnWeightData.MINIMUM_WIDTH, true)); - // //TODO: column.setText(resources.getString("View.Table.Column.AutoEmul")); - // tblclmnWeight4.setText(AutoEmulMessages.SELECT_EMULATOR_ITEM_STATUS); + + TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE); + tblclmnNewColumn.setWidth(500); + tblclmnNewColumn.setText("Build Options"); + + Composite composite_1 = new Composite(composite, SWT.NONE); + composite_1.setLayout(new GridLayout(2, false)); + + Button btnNewButton = new Button(composite_1, SWT.NONE); + btnNewButton.setEnabled(false); + btnNewButton.setText("Toolchain Select"); + + Button btnNewButton_1 = new Button(composite_1, SWT.NONE); + btnNewButton_1.setText("Kernel Config"); + btnNewButton_1.addSelectionListener(new SelectionListener() { + @Override + public void widgetDefaultSelected(SelectionEvent arg0) { + } + + @Override + public void widgetSelected(SelectionEvent arg0) { + try { + Runtime.getRuntime().exec(new String[]{"gnome-terminal", "--command", "make menuconfig"}, null, + new File(WorkspaceUtil.getCurrentProjectPath() + File.separator + "os")); + } catch (IOException e) { + e.printStackTrace(); + } + } + }); tableViewer.setLabelProvider(new TableViewerProvider()); tableViewer.setContentProvider(new ArrayContentProvider()); @@ -142,7 +149,7 @@ public class RtosBuildDialogPage extends WizardPage { // get divice list & extract Device Entry detailList From XML RtosCommandManager rtosCommandMAnager = RtosCommandManager.getDeviceEntryManager(); - ArrayList testList = rtosCommandMAnager.getBuildOptions(); + List testList = rtosCommandMAnager.getBuildOptions(); RtosBuildWizard wizard = (RtosBuildWizard) getWizard(); RtosBuildWizardDialog dialog = (RtosBuildWizardDialog) wizard.getContainer(); diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/ProcUtil.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/ProcUtil.java index 8d8130e..f8a2032 100644 --- a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/ProcUtil.java +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/ProcUtil.java @@ -28,7 +28,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; -import java.util.ArrayList; +import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -112,7 +112,7 @@ public class ProcUtil { } public static int executeProcess(ProcessBuilder pb, String[] cmds, String curDir, ConsoleManager consoleManager, - ArrayList resultBuildExecute) { + List resultBuildExecute) { String sbiTrace = "[SBI] command : "; for (String c : cmds) { sbiTrace += c + " "; diff --git a/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/WorkspaceUtil.java b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/WorkspaceUtil.java new file mode 100644 index 0000000..d705ab1 --- /dev/null +++ b/rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/WorkspaceUtil.java @@ -0,0 +1,43 @@ +package org.tizen.rt.ide.util; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +public class WorkspaceUtil { + + public static String getCurrentProjectPath() { + String projPath = null; + + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IEditorPart editorPart = window.getActivePage().getActiveEditor(); + if (editorPart != null) { + IFileEditorInput input = (IFileEditorInput) editorPart.getEditorInput(); + IFile file = input.getFile(); + IProject activeProject = file.getProject(); + projPath = activeProject.getLocation().toString(); + } else { + ISelectionService selectionService = window.getSelectionService(); + if (selectionService != null) { + ISelection selection = selectionService.getSelection(); + if (selection instanceof IStructuredSelection) { + Object firstElement = ((IStructuredSelection) selection).getFirstElement(); + if (firstElement instanceof IResource) { + IProject activeProject = ((IResource) firstElement).getProject(); + projPath = activeProject.getLocation().toString(); + } + } + } + } + + return projPath; + } + +} -- 2.7.4