RTSDK: add kernel config cmd
authorgyeongmin.ju <gyeongmin.ju@samsung.com>
Fri, 17 Feb 2017 08:44:40 +0000 (17:44 +0900)
committergyeongmin.ju <gyeongmin.ju@samsung.com>
Fri, 17 Feb 2017 08:44:40 +0000 (17:44 +0900)
Change-Id: Ib80426b535506630eb3f207168e29f1d22cb3939

rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/RtosCommandManager.java
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/Win32FlashCommand.java
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/ProcUtil.java
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/util/WorkspaceUtil.java [new file with mode: 0644]

index 130d972..53fa962 100644 (file)
@@ -76,7 +76,7 @@ public class RtosCommandManager {
 
         boolean isUpdate = false;
 
-        ArrayList<BuildOption> list = RtosCommandManager.getBuildOptions();
+        List<BuildOption> list = RtosCommandManager.getBuildOptions();
 
         buildOptionListClear();
         buildOptionList = new ArrayList<BuildOption>(list);
@@ -112,7 +112,7 @@ public class RtosCommandManager {
         });
     }
 
-    public static ArrayList<BuildOption> getBuildOptions() {
+    public static List<BuildOption> getBuildOptions() {
 
         buildOptionListClear();
 
@@ -210,7 +210,7 @@ public class RtosCommandManager {
             logger.error("ConsoleManager is null");
             return false;
         }
-        ArrayList<String> result = null;
+        List<String> 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<String> result, ConsoleManager consoleManager) {
+    private static boolean processResult(List<String> result, ConsoleManager consoleManager) {
         boolean success = result.size() == 0;
         if (consoleManager != null) {
             consoleManager.print("[STATUS] ", SWT.BOLD, ResourceManager.BLACK);
index db5123a..c178150 100644 (file)
@@ -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<String> resultFlashOptionList = new ArrayList<String>();
-    private ArrayList<String> resultFlashExecute = new ArrayList<String>();
+    private List<String> resultFlashOptionList = new ArrayList<String>();
+    private List<String> resultFlashExecute = new ArrayList<String>();
 
-    protected ArrayList<String> executeFindFlashOption() {
+    protected List<String> executeFindFlashOption() {
 
         /**
          * 
@@ -125,7 +126,7 @@ public class Win32FlashCommand {
         return resultFlashOptionList;
     }
 
-    protected ArrayList<String> executeFlash(String buildOption, ConsoleManager consoleManager,
+    protected List<String> executeFlash(String buildOption, ConsoleManager consoleManager,
             IProgressMonitor monitor) {
 
         LINUX_FLASH_OPTION_PATH = RtosCommandManager.rtoshome + "/build/configs/sidk_s5jt200/openocd/";
index f419aa9..9cdfd61 100644 (file)
 
 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<BuildOption> testList = rtosCommandMAnager.getBuildOptions();
+        List<BuildOption> testList = rtosCommandMAnager.getBuildOptions();
 
         RtosBuildWizard wizard = (RtosBuildWizard) getWizard();
         RtosBuildWizardDialog dialog = (RtosBuildWizardDialog) wizard.getContainer();
index 8d8130e..f8a2032 100644 (file)
@@ -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<String> resultBuildExecute) {
+            List<String> 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 (file)
index 0000000..d705ab1
--- /dev/null
@@ -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;
+       }
+       
+}