INIT : RTOS IDE Initialize
authorJaeMin Kim <jm.jemin.kim@samsung.com>
Tue, 14 Feb 2017 02:15:56 +0000 (11:15 +0900)
committerJaeMin Kim <jm.jemin.kim@samsung.com>
Wed, 15 Feb 2017 09:06:45 +0000 (18:06 +0900)
RTOS IDE Initialize

Change-Id: Ibdc10353e38eaa97d5870e92e68aa2dcdd2b8f38
Signed-off-by: JaeMin Kim <jm.jemin.kim@samsung.com>
58 files changed:
rtosIDE/.classpath [new file with mode: 0644]
rtosIDE/.gitignore [new file with mode: 0644]
rtosIDE/.project [new file with mode: 0644]
rtosIDE/META-INF/MANIFEST.MF [new file with mode: 0644]
rtosIDE/build.properties [new file with mode: 0644]
rtosIDE/icons/buildSample.gif [new file with mode: 0644]
rtosIDE/icons/flashSample.gif [new file with mode: 0644]
rtosIDE/icons/ic.png [new file with mode: 0644]
rtosIDE/icons/releng_gears.gif [new file with mode: 0644]
rtosIDE/icons/sample.gif [new file with mode: 0644]
rtosIDE/lib/log4j-1.2.17.jar [new file with mode: 0644]
rtosIDE/lib/slf4j-api-1.6.4.jar [new file with mode: 0644]
rtosIDE/lib/slf4j-log4j12-1.6.4.jar [new file with mode: 0644]
rtosIDE/os/win32/x86_64/rxtxParallel.dll [new file with mode: 0644]
rtosIDE/os/win32/x86_64/rxtxSerial.dll [new file with mode: 0644]
rtosIDE/plugin.xml [new file with mode: 0644]
rtosIDE/splash.bmp [new file with mode: 0644]
rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitImportWizard.java [new file with mode: 0644]
rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitProjectsImportPage.java [new file with mode: 0644]
rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitSelectWizardPage.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/Activator.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/LinuxBuildCommand.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/LinuxFlashCommand.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/Messages.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/ResourceManager.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/RtosCommandManager.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/Win32BuildCommand.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/Win32FlashCommand.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/build/BuildBuilder.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/build/BuildOption.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/build/RtosBuildWizard.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/build/RtosBuildWizardDialog.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/console/ConsoleManager.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/flash/FlashBuilder.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/flash/FlashOption.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashDialogPage.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashWizard.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashWizardDialog.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/handlers/BuildHandler.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/handlers/FlashHandler.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/handlers/TerminalHandler.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/log4j.properties [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/messages.properties [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/perspectives/TizenRTPerspective.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/util/IReporter.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/util/OSChecker.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/util/ProcUtil.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/util/Util.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/util/XMLUtil.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/util/ZipUtil.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizard.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage2.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/wizards/NewMakeDefsWizard.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/wizards/NewMakeDefsWizardPage.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/ide/wizards/TemplateData.java [new file with mode: 0644]
rtosIDE/src/org/tizen/rt/product/RtProjectNature.java [new file with mode: 0644]

diff --git a/rtosIDE/.classpath b/rtosIDE/.classpath
new file mode 100644 (file)
index 0000000..c6f97f8
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.6.4.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.6.4.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/rtosIDE/.gitignore b/rtosIDE/.gitignore
new file mode 100644 (file)
index 0000000..ba077a4
--- /dev/null
@@ -0,0 +1 @@
+bin
diff --git a/rtosIDE/.project b/rtosIDE/.project
new file mode 100644 (file)
index 0000000..490756c
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>tizen.rt.product.plugin</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/rtosIDE/META-INF/MANIFEST.MF b/rtosIDE/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..c5af698
--- /dev/null
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: RtosBuild
+Bundle-SymbolicName: tizen.rt.product.plugin;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.tizen.rt.ide.Activator
+Bundle-Vendor: rtosBuildVendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.console,
+ org.eclipse.tm.terminal.control,
+ org.eclipse.tm.terminal.view.ui,
+ org.eclipse.cdt.core,
+ org.eclipse.ui.navigator,
+ org.eclipse.ui.navigator.resources,
+ org.eclipse.jgit,
+ org.eclipse.egit.core,
+ org.eclipse.egit.ui,
+ org.eclipse.ui.forms,
+ org.eclipse.text,
+ org.eclipse.core.expressions
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: lib/slf4j-api-1.6.4.jar,
+ lib/slf4j-log4j12-1.6.4.jar,
+ lib/log4j-1.2.17.jar,
+ .
diff --git a/rtosIDE/build.properties b/rtosIDE/build.properties
new file mode 100644 (file)
index 0000000..6fa5f8b
--- /dev/null
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               icons/,\
+               lib/,\
+               lib/slf4j-api-1.6.4.jar
diff --git a/rtosIDE/icons/buildSample.gif b/rtosIDE/icons/buildSample.gif
new file mode 100644 (file)
index 0000000..302650a
Binary files /dev/null and b/rtosIDE/icons/buildSample.gif differ
diff --git a/rtosIDE/icons/flashSample.gif b/rtosIDE/icons/flashSample.gif
new file mode 100644 (file)
index 0000000..335b75a
Binary files /dev/null and b/rtosIDE/icons/flashSample.gif differ
diff --git a/rtosIDE/icons/ic.png b/rtosIDE/icons/ic.png
new file mode 100644 (file)
index 0000000..ec4e492
Binary files /dev/null and b/rtosIDE/icons/ic.png differ
diff --git a/rtosIDE/icons/releng_gears.gif b/rtosIDE/icons/releng_gears.gif
new file mode 100644 (file)
index 0000000..81fb7b4
Binary files /dev/null and b/rtosIDE/icons/releng_gears.gif differ
diff --git a/rtosIDE/icons/sample.gif b/rtosIDE/icons/sample.gif
new file mode 100644 (file)
index 0000000..34fb3c9
Binary files /dev/null and b/rtosIDE/icons/sample.gif differ
diff --git a/rtosIDE/lib/log4j-1.2.17.jar b/rtosIDE/lib/log4j-1.2.17.jar
new file mode 100644 (file)
index 0000000..068867e
Binary files /dev/null and b/rtosIDE/lib/log4j-1.2.17.jar differ
diff --git a/rtosIDE/lib/slf4j-api-1.6.4.jar b/rtosIDE/lib/slf4j-api-1.6.4.jar
new file mode 100644 (file)
index 0000000..4d23f41
Binary files /dev/null and b/rtosIDE/lib/slf4j-api-1.6.4.jar differ
diff --git a/rtosIDE/lib/slf4j-log4j12-1.6.4.jar b/rtosIDE/lib/slf4j-log4j12-1.6.4.jar
new file mode 100644 (file)
index 0000000..daa3aa1
Binary files /dev/null and b/rtosIDE/lib/slf4j-log4j12-1.6.4.jar differ
diff --git a/rtosIDE/os/win32/x86_64/rxtxParallel.dll b/rtosIDE/os/win32/x86_64/rxtxParallel.dll
new file mode 100644 (file)
index 0000000..92666dd
Binary files /dev/null and b/rtosIDE/os/win32/x86_64/rxtxParallel.dll differ
diff --git a/rtosIDE/os/win32/x86_64/rxtxSerial.dll b/rtosIDE/os/win32/x86_64/rxtxSerial.dll
new file mode 100644 (file)
index 0000000..211e006
Binary files /dev/null and b/rtosIDE/os/win32/x86_64/rxtxSerial.dll differ
diff --git a/rtosIDE/plugin.xml b/rtosIDE/plugin.xml
new file mode 100644 (file)
index 0000000..e16da6f
--- /dev/null
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.commands">
+         
+      <category
+            name="Rtos Category"
+            id="rtosBuild.commands.category">
+      </category>
+      
+      <command
+            name="Rtos Build"
+            categoryId="rtosBuild.commands.category"
+            id="rtosBuild.commands.buildCommand">
+      </command>
+      
+      <command
+            name="Rtos Flash"
+            categoryId="rtosBuild.commands.category"
+            id="rtosBuild.commands.flashCommand">
+      </command>
+      
+   </extension>
+   
+   <extension
+         point="org.eclipse.ui.handlers">
+         
+      <handler
+            commandId="rtosBuild.commands.buildCommand"
+            class="org.tizen.rt.ide.handlers.BuildHandler">
+         <enabledWhen>
+            <reference
+                  definitionId="org.tizen.rt.product.hasNature">
+            </reference>
+         </enabledWhen>
+      </handler>
+      
+      <!-- modify class-->
+      <handler
+            commandId="rtosBuild.commands.flashCommand"
+            class="org.tizen.rt.ide.handlers.FlashHandler">
+         <enabledWhen>
+            <reference
+                  definitionId="org.tizen.rt.product.hasNature">
+            </reference>
+         </enabledWhen>
+      </handler>
+      
+   </extension>
+   
+   <extension
+         point="org.eclipse.ui.bindings">
+      <key
+            commandId="rtosBuild.commands.buildCommand"
+            contextId="org.eclipse.ui.contexts.window"
+            sequence="M1+6"
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+      </key>
+      <key
+            commandId="rtosBuild.commands.flashCommand"
+            contextId="org.eclipse.ui.contexts.window"
+            sequence="M1+7"
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+      </key>      
+   </extension>
+   
+   <extension
+         point="org.eclipse.ui.menus">
+         
+      <menuContribution
+            locationURI="menu:org.eclipse.ui.main.menu?after=additions">
+         <menu
+               label="Rtos Menu"
+               mnemonic="M"
+               id="rtosBuild.menus.sampleMenu">
+            <command
+                  commandId="rtosBuild.commands.buildCommand"
+                  mnemonic="S"
+                  id="rtosBuild.menus.buildCommand">
+            </command>
+                       <command
+                  commandId="rtosBuild.commands.flashCommand"
+                  mnemonic="S"
+                  id="rtosBuild.menus.flashCommand">
+            </command>            
+         </menu>
+      </menuContribution>
+      
+      <menuContribution
+            locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+         <toolbar
+               id="rtosBuild.toolbars.rtosToolbar">
+            <command
+                  commandId="rtosBuild.commands.buildCommand"
+                  icon="icons/buildSample.gif"
+                  tooltip="build rtos project"
+                  id="rtosBuild.toolbars.buildCommand">
+            </command>
+            <command
+                  commandId="rtosBuild.commands.flashCommand"
+                  icon="icons/flashSample.gif"
+                  tooltip="flash rtos project"
+                  id="rtosBuild.toolbars.flsahCommand">
+            </command>            
+         </toolbar>
+      </menuContribution>
+      
+   </extension>
+   <extension
+         id="product"
+         point="org.eclipse.core.runtime.products">
+      <product
+            application="org.eclipse.ui.ide.workbench"
+            name="rtosEclipse">
+         <property
+               name="appName"
+               value="rtosEclipse">
+         </property>
+      </product>
+   </extension>
+   <extension
+         point="org.eclipse.ui.newWizards">
+      <category
+            id="org.tizen.rt.TizenRT"
+            name="Tizen RT">
+      </category>
+      <wizard
+            category="org.tizen.rt.TizenRT"
+            class="org.tizen.rt.ide.wizards.NewArtikProjectWizard"
+            finalPerspective="org.tizen.rt.ide.perspectives.TizenRT"
+            icon="icons/buildSample.gif"
+            id="org.tizen.rt.LocalProject"
+            name="TizenRT Project"
+            project="true">
+      </wizard>
+      <wizard
+            category="org.tizen.rt.TizenRT"
+            class="org.eclipse.egit.ui.internal.clone.RtGitImportWizard"
+            finalPerspective="org.tizen.rt.ide.perspectives.TizenRT"
+            icon="icons/buildSample.gif"
+            id="org.tizen.rt.GitProject"
+            name="TizenRT Project from Git"
+            project="true">
+      </wizard>
+      <primaryWizard
+            id="org.tizen.rt.LocalProject">
+      </primaryWizard>
+      <primaryWizard
+            id="org.tizen.rt.GitProject">
+      </primaryWizard>
+   </extension>
+   <extension
+         point="org.eclipse.ui.perspectives">
+      <perspective
+            class="org.tizen.rt.ide.perspectives.TizenRTPerspective"
+            icon="icons/releng_gears.gif"
+            id="org.tizen.rt.ide.perspectives.TizenRT"
+            name="TizenRT">
+      </perspective>
+   </extension>
+   <extension
+         point="org.eclipse.ui.navigator.viewer">
+      <viewerActionBinding
+            viewerId="org.tizen.rt.viewer.navigator">
+         <includes>
+            <actionExtension
+                  pattern="org.eclipse.ui.navigator.resources.*">
+            </actionExtension>
+         </includes>
+      </viewerActionBinding>
+      <viewerContentBinding
+            viewerId="org.tizen.rt.viewer.navigator">
+         <includes>
+            <contentExtension
+                  pattern="org.eclipse.ui.navigator.resourceContent">
+            </contentExtension>
+            <contentExtension
+                  pattern="org.eclipse.ui.navigator.resources.filters.*">
+            </contentExtension>
+            <contentExtension
+                  pattern="org.eclipse.ui.navigator.resources.linkHelper">
+            </contentExtension>
+            <contentExtension
+                  pattern="org.eclipse.ui.navigator.resources.workingSets">
+            </contentExtension>
+         </includes>
+      </viewerContentBinding>
+   </extension>
+   <extension
+         point="org.eclipse.ui.views">
+      <view
+            class="org.eclipse.ui.navigator.CommonNavigator"
+            icon="icons/sample.gif"
+            id="org.tizen.rt.viewer.navigator"
+            name="TizenRT Navigator">
+      </view>
+   </extension>
+   <extension
+         point="org.eclipse.ui.perspectiveExtensions">
+      <perspectiveExtension
+            targetID="org.eclipse.ui.resourcePerspective">
+         <view
+               id="org.tizen.rt.viewer.navigator"
+               ratio="0.5"
+               relationship="stack"
+               relative="org.eclipse.ui.navigator.ProjectExplorer">
+         </view>
+      </perspectiveExtension>
+   </extension>
+   <extension
+         point="org.eclipse.ui.navigator.navigatorContent">
+      <commonWizard
+            type="new"
+            wizardId="org.tizen.rt.LocalProject">
+         <enablement></enablement>
+      </commonWizard>
+      <commonWizard
+            type="new"
+            wizardId="org.tizen.rt.GitProject">
+         <enablement></enablement>
+      </commonWizard>
+   </extension>
+   <extension
+         id="RtProjectNature"
+         point="org.eclipse.core.resources.natures">
+      <runtime>
+         <run
+               class="org.tizen.rt.product.RtProjectNature">
+         </run>
+      </runtime>
+      <requires-nature
+            id="org.eclipse.cdt.core.cnature">
+      </requires-nature>
+   </extension>
+   <extension
+         point="org.eclipse.ui.ide.projectNatureImages">
+      <image
+            icon="icons/releng_gears.gif"
+            id="org.tizen.rt.product.RtProjectImage"
+            natureId="org.tizen.rt.product.RtProjectNature">
+      </image>
+   </extension>
+   <extension
+         point="org.eclipse.core.expressions.definitions">
+      <definition
+            id="org.tizen.rt.product.hasNature">
+         <with
+               variable="selection">
+            <and>
+               <count
+                     value="1">
+               </count>
+               <iterate
+                     ifEmpty="false"
+                     operator="and">
+                  <test
+                        property="org.eclipse.core.resources.projectNature"
+                        value="org.tizen.rt.product.RtProjectNature">
+                  </test>
+               </iterate>
+            </and>
+         </with>
+      </definition>
+   </extension>
+
+</plugin>
diff --git a/rtosIDE/splash.bmp b/rtosIDE/splash.bmp
new file mode 100644 (file)
index 0000000..861a2f1
Binary files /dev/null and b/rtosIDE/splash.bmp differ
diff --git a/rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitImportWizard.java b/rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitImportWizard.java
new file mode 100644 (file)
index 0000000..fb2b580
--- /dev/null
@@ -0,0 +1,357 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 SAP AG and others.
+ * 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:
+ *    Mathias Kinzler (SAP AG) - initial implementation
+ *    Stefan Lay (SAP AG) - improvements
+ *    
+ * Modified:
+ * @since 2017. 2. 8.
+ * Daeryong Park <bdragon.park@samsung.com>
+ * 
+ *******************************************************************************/
+package org.eclipse.egit.ui.internal.clone;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.egit.core.op.ConnectProviderOperation;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.internal.UIIcons;
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.egit.ui.internal.clone.GitCloneSourceProviderExtension.CloneSourceProvider;
+import org.eclipse.egit.ui.internal.provisional.wizards.GitRepositoryInfo;
+import org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult;
+import org.eclipse.egit.ui.internal.provisional.wizards.NoRepositoryInfoException;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.NewProjectAction;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.product.RtProjectNature;
+
+/**
+ * A wizard which allows to optionally clone a repository and to import projects from a repository.
+ */
+public class RtGitImportWizard extends AbstractGitCloneWizard implements IImportWizard {
+
+    private static final Logger logger = LoggerFactory.getLogger(RtGitImportWizard.class);
+
+    private static final String GIT_IMPORT_SECTION = "GitImportWizard"; //$NON-NLS-1$
+
+    private GitSelectRepositoryPage selectRepoPage = new GitSelectRepositoryPage();
+
+    // Modified
+    private RtGitSelectWizardPage importWithDirectoriesPage = new RtGitSelectWizardPage() {
+        @Override
+        public void setVisible(boolean visible) {
+            if (existingRepo == null && visible && (cloneDestination.cloneSettingsChanged())) {
+                setCallerRunsCloneOperation(true);
+                try {
+                    final GitRepositoryInfo repositoryInfo = currentSearchResult.getGitRepositoryInfo();
+                    performClone(repositoryInfo);
+                    importWithDirectoriesPage.getControl().getDisplay().asyncExec(new Runnable() {
+
+                        @Override
+                        public void run() {
+                            runCloneOperation(getContainer(), repositoryInfo);
+                            cloneDestination.saveSettingsForClonedRepo();
+                        }
+                    });
+                } catch (URISyntaxException e) {
+                    Activator.error(UIText.GitImportWizard_errorParsingURI, e);
+                } catch (NoRepositoryInfoException e) {
+                    Activator.error(UIText.GitImportWizard_noRepositoryInfo, e);
+                } catch (Exception e) {
+                    Activator.error(e.getMessage(), e);
+                }
+            }
+            super.setVisible(visible);
+        }
+    };
+
+    // Modified
+    private RtGitProjectsImportPage projectsImportPage = new RtGitProjectsImportPage() {
+        @Override
+        public void setVisible(boolean visible) {
+            if (visible)
+                setProjectsList(importWithDirectoriesPage.getPath());
+            super.setVisible(visible);
+        }
+    };
+
+    private GitCreateGeneralProjectPage createGeneralProjectPage = new GitCreateGeneralProjectPage() {
+        @Override
+        public void setVisible(boolean visible) {
+            if (visible)
+                setPath(importWithDirectoriesPage.getPath());
+            super.setVisible(visible);
+        }
+    };
+
+    private Repository existingRepo;
+
+    /**
+     * The default constructor
+     */
+    public RtGitImportWizard() {
+        this(null);
+    }
+
+    /**
+     * Construct the import wizard based on given repository search result. The wizard skips the repository location page in this case.
+     * @param searchResult the search result to initialize the import wizard with.
+     */
+    public RtGitImportWizard(IRepositorySearchResult searchResult) {
+        super(searchResult);
+        setWindowTitle(UIText.GitImportWizard_WizardTitle);
+        setDefaultPageImageDescriptor(UIIcons.WIZBAN_IMPORT_REPO);
+        setDialogSettings(getImportWizardDialogSettings());
+    }
+
+    @Override
+    protected void addPreClonePages() {
+        if (!hasSearchResult())
+            addPage(selectRepoPage);
+    }
+
+    @Override
+    protected void addPostClonePages() {
+        addPage(importWithDirectoriesPage);
+        addPage(projectsImportPage);
+        addPage(createGeneralProjectPage);
+    }
+
+    @Override
+    protected List<CloneSourceProvider> getCloneSourceProviders() {
+        List<CloneSourceProvider> cloneSourceProvider = super.getCloneSourceProviders();
+        cloneSourceProvider.add(0, CloneSourceProvider.LOCAL);
+        return cloneSourceProvider;
+    }
+
+    @Override
+    public void init(IWorkbench workbench, IStructuredSelection selection) {
+        // nothing to do
+    }
+
+    @Override
+    public IWizardPage getNextPage(IWizardPage page) {
+        if (page == selectRepoPage) {
+            existingRepo = selectRepoPage.getRepository();
+            importWithDirectoriesPage.setRepository(selectRepoPage.getRepository());
+            return importWithDirectoriesPage;
+        } else if (page == cloneDestination) {
+            existingRepo = null;
+            importWithDirectoriesPage.setRepository(getTargetRepository());
+            return importWithDirectoriesPage;
+        } else if (page == importWithDirectoriesPage)
+            switch (importWithDirectoriesPage.getWizardSelection()) {
+            case RtGitSelectWizardPage.EXISTING_PROJECTS_WIZARD:
+                return projectsImportPage;
+            case RtGitSelectWizardPage.NEW_WIZARD:
+                return null;
+            case RtGitSelectWizardPage.GENERAL_WIZARD:
+                return createGeneralProjectPage;
+            }
+        else if (page == createGeneralProjectPage || page == projectsImportPage)
+            return null;
+        return super.getNextPage(page);
+    }
+
+    private Repository getTargetRepository() {
+        if (existingRepo != null)
+            return existingRepo;
+        else
+            try {
+                return org.eclipse.egit.core.Activator.getDefault().getRepositoryCache()
+                        .lookupRepository(new File(cloneDestination.getDestinationFile(), Constants.DOT_GIT));
+            } catch (IOException e) {
+                Activator.error("Error looking up repository at " + cloneDestination.getDestinationFile(), e); //$NON-NLS-1$
+                return null;
+            }
+    }
+
+    @Override
+    public boolean performFinish() {
+        final List<IProject> previousProjects = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
+
+        try {
+            getContainer().run(true, true, new IRunnableWithProgress() {
+                @Override
+                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+                    importProjects(monitor);
+
+                    // Add CDT nature to current project
+                    IProject[] currentProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+                    IProject project = null;
+                    for (IProject current : currentProjects) {
+                        if (!previousProjects.contains(current)) {
+                            project = current;
+                            break;
+                        }
+                    }
+                    if (project != null) {
+                        try {
+                            RtProjectNature.addRtNature(project, monitor);
+                        } catch (CoreException e) {
+                            logger.error(e.getMessage(), e);
+                        }
+                    }
+                }
+            });
+        } catch (InvocationTargetException e) {
+            Activator.handleError(e.getCause().getMessage(), e.getCause(), true);
+            return false;
+        } catch (InterruptedException e) {
+            Activator.handleError(UIText.GitCreateProjectViaWizardWizard_AbortedMessage, e, true);
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean canFinish() {
+        switch (importWithDirectoriesPage.getWizardSelection()) {
+        case RtGitSelectWizardPage.EXISTING_PROJECTS_WIZARD:
+            return projectsImportPage.isPageComplete();
+        case RtGitSelectWizardPage.NEW_WIZARD:
+            return true;
+        case RtGitSelectWizardPage.GENERAL_WIZARD:
+            return createGeneralProjectPage.isPageComplete();
+        }
+        return super.canFinish();
+
+    }
+
+    private void importProjects(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+        switch (importWithDirectoriesPage.getWizardSelection()) {
+        case RtGitSelectWizardPage.EXISTING_PROJECTS_WIZARD: {
+            final Set<ProjectRecord> projectsToCreate = new HashSet<ProjectRecord>();
+            final List<IWorkingSet> workingSets = new ArrayList<IWorkingSet>();
+            // get the data from the pages in the UI thread
+            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+                @Override
+                public void run() {
+                    projectsToCreate.addAll(projectsImportPage.getCheckedProjects());
+                    IWorkingSet[] workingSetArray = projectsImportPage.getSelectedWorkingSets();
+                    workingSets.addAll(Arrays.asList(workingSetArray));
+                    projectsImportPage.saveWidgetValues();
+                }
+            });
+            ProjectUtils.createProjects(projectsToCreate, workingSets.toArray(new IWorkingSet[workingSets.size()]),
+                    monitor);
+            break;
+        }
+        case RtGitSelectWizardPage.NEW_WIZARD: {
+            final File[] repoDir = new File[1];
+            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+                @Override
+                public void run() {
+                    repoDir[0] = getTargetRepository().getDirectory();
+                }
+            });
+            final List<IProject> previousProjects = Arrays
+                    .asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
+            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+                @Override
+                public void run() {
+                    new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
+                }
+            });
+            IWorkspaceRunnable wsr = new IWorkspaceRunnable() {
+                @Override
+                public void run(IProgressMonitor actMonitor) throws CoreException {
+                    IProject[] currentProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+                    for (IProject current : currentProjects)
+                        if (!previousProjects.contains(current)) {
+                            ConnectProviderOperation cpo = new ConnectProviderOperation(current, repoDir[0]);
+                            cpo.execute(actMonitor);
+                        }
+                }
+            };
+            try {
+                ResourcesPlugin.getWorkspace().run(wsr, monitor);
+            } catch (CoreException e) {
+                throw new InvocationTargetException(e);
+            }
+            break;
+        }
+        case RtGitSelectWizardPage.GENERAL_WIZARD: {
+            final String[] projectName = new String[1];
+            final boolean[] defaultLocation = new boolean[1];
+            final String[] path = new String[1];
+            final File[] repoDir = new File[1];
+            // get the data from the page in the UI thread
+            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+                @Override
+                public void run() {
+                    projectName[0] = createGeneralProjectPage.getProjectName();
+                    defaultLocation[0] = createGeneralProjectPage.isDefaultLocation();
+                    path[0] = importWithDirectoriesPage.getPath();
+                    repoDir[0] = getTargetRepository().getDirectory();
+                }
+            });
+            try {
+                IWorkspaceRunnable wsr = new IWorkspaceRunnable() {
+                    @Override
+                    public void run(IProgressMonitor actMonitor) throws CoreException {
+                        final IProjectDescription desc = ResourcesPlugin.getWorkspace()
+                                .newProjectDescription(projectName[0]);
+                        desc.setLocation(new Path(path[0]));
+
+                        IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(desc.getName());
+                        prj.create(desc, actMonitor);
+                        prj.open(actMonitor);
+                        ConnectProviderOperation cpo = new ConnectProviderOperation(prj, repoDir[0]);
+                        cpo.execute(new NullProgressMonitor());
+
+                        ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_ONE, actMonitor);
+                    }
+                };
+                ResourcesPlugin.getWorkspace().run(wsr, monitor);
+            } catch (CoreException e) {
+                throw new InvocationTargetException(e);
+            }
+            break;
+        }
+        }
+    }
+
+    static IDialogSettings getImportWizardDialogSettings() {
+        IDialogSettings settings = Activator.getDefault().getDialogSettings();
+
+        IDialogSettings wizardSettings = settings.getSection(RtGitImportWizard.GIT_IMPORT_SECTION);
+        if (wizardSettings == null) {
+            wizardSettings = settings.addNewSection(RtGitImportWizard.GIT_IMPORT_SECTION);
+        }
+        return wizardSettings;
+    }
+}
diff --git a/rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitProjectsImportPage.java b/rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitProjectsImportPage.java
new file mode 100644 (file)
index 0000000..f66d485
--- /dev/null
@@ -0,0 +1,541 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
+ * Copyright (C) 2007, Martin Oberhuber (martin.oberhuber@windriver.com)
+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
+ * Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua>
+ * Copyright (C) 2010, Wim Jongman <wim.jongman@remainsoftware.com>
+ * Copyright (C) 2010, Ryan Schmitt <ryan.schmitt@boeing.com>
+ * Copyright (C) 2013, Robin Stocker <robin@nibor.org>
+ *
+ * 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
+ * 
+ * Modified:
+ * @since 2017. 2. 8.
+ * Daeryong Park <bdragon.park@samsung.com>
+ * 
+ *******************************************************************************/
+
+package org.eclipse.egit.ui.internal.clone;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.egit.core.internal.util.ProjectUtil;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.internal.GitLabelProvider;
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.egit.ui.internal.components.CachedCheckboxTreeViewer;
+import org.eclipse.egit.ui.internal.components.FilteredCheckboxTree;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PatternFilter;
+import org.eclipse.ui.dialogs.WorkingSetGroup;
+
+public class RtGitProjectsImportPage extends WizardPage {
+    private final class ProjectLabelProvider extends GitLabelProvider implements IColorProvider {
+
+        @Override
+        public Color getForeground(Object element) {
+            if (isProjectInWorkspace(((ProjectRecord) element).getProjectName()))
+                return PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_GRAY);
+            return null;
+        }
+
+        @Override
+        public Color getBackground(Object element) {
+            return null;
+        }
+    }
+
+    private final static String STORE_NESTED_PROJECTS = "GitProjectsImportPage.STORE_NESTED_PROJECTS"; //$NON-NLS-1$
+
+    /**
+     * The name of the folder containing metadata information for the workspace.
+     */
+    public static final String METADATA_FOLDER = ".metadata"; //$NON-NLS-1$
+
+    private CachedCheckboxTreeViewer projectsList;
+
+    private Button nestedProjectsCheckbox;
+
+    private boolean nestedProjects = true;
+
+    private boolean lastNestedProjects = true;
+
+    private ProjectRecord[] selectedProjects = new ProjectRecord[0];
+
+    private IProject[] wsProjects;
+
+    // The last selected path to minimize searches
+    private String lastPath;
+
+    // The last time that the file or folder at the selected path was modified
+    // to minimize searches
+    private long lastModified;
+
+    private Button selectAll;
+
+    private Button deselectAll;
+
+    private WorkingSetGroup workingSetGroup;
+
+    /**
+     * Creates a new project creation wizard page.
+     */
+    public RtGitProjectsImportPage() {
+        super(GitProjectsImportPage.class.getName());
+        setPageComplete(false);
+        setTitle(UIText.WizardProjectsImportPage_ImportProjectsTitle);
+        setDescription(UIText.WizardProjectsImportPage_ImportProjectsDescription);
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+
+        initializeDialogUnits(parent);
+
+        Composite workArea = new Composite(parent, SWT.NONE);
+        setControl(workArea);
+
+        workArea.setLayout(new GridLayout());
+        workArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+        createProjectsRoot(workArea);
+        createProjectsList(workArea);
+        createOptionsArea(workArea);
+        createWorkingSetGroup(workArea);
+        restoreWidgetValues();
+        Dialog.applyDialogFont(workArea);
+
+    }
+
+    private void createWorkingSetGroup(Composite workArea) {
+        // TODO: replace hardcoded ids once bug 245106 is fixed
+        String[] workingSetTypes = new String[] { "org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$
+                "org.eclipse.jdt.ui.JavaWorkingSetPage" //$NON-NLS-1$
+        };
+        workingSetGroup = new WorkingSetGroup(workArea, null, workingSetTypes);
+    }
+
+    /**
+     * Create the checkbox list for the found projects.
+     * @param workArea
+     */
+    private void createProjectsList(Composite workArea) {
+        Label title = new Label(workArea, SWT.NONE);
+        title.setText(UIText.WizardProjectsImportPage_ProjectsListTitle);
+
+        Composite listComposite = new Composite(workArea, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginWidth = 0;
+        layout.makeColumnsEqualWidth = false;
+        listComposite.setLayout(layout);
+
+        listComposite
+                .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));
+
+        PatternFilter filter = new PatternFilter() {
+
+            @Override
+            public boolean isElementVisible(Viewer viewer, Object element) {
+
+                if (getCheckedProjects().contains(element))
+                    return true;
+
+                if (element instanceof ProjectRecord) {
+                    ProjectRecord p = (ProjectRecord) element;
+                    if (wordMatches(p.getProjectName()))
+                        return true;
+                    String projectPath = p.getProjectSystemFile().getParent();
+                    if (projectPath.startsWith(lastPath)) {
+                        String distinctPath = projectPath.substring(lastPath.length());
+                        return wordMatches(distinctPath);
+                    } else {
+                        return wordMatches(projectPath);
+                    }
+                }
+
+                return false;
+            }
+        };
+        filter.setIncludeLeadingWildcard(true);
+
+        FilteredCheckboxTree filteredTree = new FilteredCheckboxTree(listComposite, null, SWT.NONE, filter);
+
+        filteredTree.setInitialText(UIText.WizardProjectsImportPage_filterText);
+        projectsList = filteredTree.getCheckboxTreeViewer();
+        GridData listData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
+        projectsList.getControl().setLayoutData(listData);
+        projectsList.addCheckStateListener(new ICheckStateListener() {
+
+            @Override
+            public void checkStateChanged(CheckStateChangedEvent event) {
+                ProjectRecord element = (ProjectRecord) event.getElement();
+                if (isProjectInWorkspace(element.getProjectName())) {
+                    projectsList.setChecked(element, false);
+                }
+                enableSelectAllButtons();
+            }
+        });
+
+        // a bug in the CachedCheckboxTreeView requires us to not return null
+        final Object[] children = new Object[0];
+
+        projectsList.setContentProvider(new ITreeContentProvider() {
+
+            @Override
+            public Object[] getChildren(Object parentElement) {
+                return children;
+            }
+
+            @Override
+            public Object[] getElements(Object inputElement) {
+                return selectedProjects;
+            }
+
+            @Override
+            public boolean hasChildren(Object element) {
+                return false;
+            }
+
+            @Override
+            public Object getParent(Object element) {
+                return null;
+            }
+
+            @Override
+            public void dispose() {
+                // ignore
+            }
+
+            @Override
+            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+                // ignore
+            }
+
+        });
+
+        projectsList.getTree().addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                checkPageComplete();
+            }
+        });
+
+        projectsList.setLabelProvider(new ProjectLabelProvider());
+
+        projectsList.setInput(this);
+        projectsList.setComparator(new ViewerComparator());
+        createSelectionButtons(listComposite);
+    }
+
+    /**
+     * Create the selection buttons in the listComposite.
+     * @param listComposite
+     */
+    private void createSelectionButtons(Composite listComposite) {
+        Composite buttonsComposite = new Composite(listComposite, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.marginWidth = 0;
+        layout.marginHeight = 0;
+        buttonsComposite.setLayout(layout);
+
+        buttonsComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+
+        selectAll = new Button(buttonsComposite, SWT.PUSH);
+        selectAll.setText(UIText.WizardProjectsImportPage_selectAll);
+        selectAll.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                selectAllNewProjects();
+                enableSelectAllButtons();
+                setPageComplete(true);
+            }
+        });
+        Dialog.applyDialogFont(selectAll);
+        setButtonLayoutData(selectAll);
+
+        deselectAll = new Button(buttonsComposite, SWT.PUSH);
+        deselectAll.setText(UIText.WizardProjectsImportPage_deselectAll);
+        deselectAll.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                for (TreeItem item : projectsList.getTree().getItems())
+                    projectsList.setChecked(item.getData(), false);
+                projectsList.setInput(this); // filter away selected projects
+                enableSelectAllButtons();
+                setPageComplete(false);
+            }
+        });
+        Dialog.applyDialogFont(deselectAll);
+        setButtonLayoutData(deselectAll);
+    }
+
+    private void createOptionsArea(Composite workArea) {
+        Composite optionsGroup = new Composite(workArea, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.marginBottom = 2 * layout.marginHeight;
+        layout.marginHeight = 0;
+        optionsGroup.setLayout(layout);
+        optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        nestedProjectsCheckbox = new Button(optionsGroup, SWT.CHECK);
+        nestedProjectsCheckbox.setText(UIText.GitProjectsImportPage_SearchForNestedProjects);
+        nestedProjectsCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        nestedProjectsCheckbox.setSelection(nestedProjects);
+        nestedProjectsCheckbox.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                nestedProjects = nestedProjectsCheckbox.getSelection();
+                setProjectsList(lastPath);
+            }
+        });
+    }
+
+    private void selectAllNewProjects() {
+        for (TreeItem item : projectsList.getTree().getItems()) {
+            ProjectRecord record = (ProjectRecord) item.getData();
+            if (!isProjectInWorkspace(record.getProjectName()))
+                projectsList.setChecked(item.getData(), true);
+        }
+    }
+
+    /**
+     * Create the area where you select the root directory for the projects.
+     * @param workArea Composite
+     */
+    private void createProjectsRoot(Composite workArea) {
+
+        // project specification group
+        Composite projectGroup = new Composite(workArea, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 3;
+        layout.makeColumnsEqualWidth = false;
+        layout.marginWidth = 0;
+        projectGroup.setLayout(layout);
+        projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    }
+
+    /**
+     * Update the list of projects based on path. This will not check any projects.
+     * @param path
+     */
+    void setProjectsList(final String path) {
+        // on an empty path empty selectedProjects
+        if (path == null || path.length() == 0) {
+            selectedProjects = new ProjectRecord[0];
+            projectsList.refresh(true);
+            checkPageComplete();
+            lastPath = path;
+            setErrorMessage(UIText.GitProjectsImportPage_NoProjectsMessage);
+            return;
+        }
+
+        final File directory = new File(path);
+        long modified = directory.lastModified();
+        if (path.equals(lastPath) && lastModified == modified && lastNestedProjects == nestedProjects) {
+            // since the file/folder was not modified and the path did not
+            // change, no refreshing is required
+            return;
+        }
+
+        setErrorMessage(null);
+
+        lastPath = path;
+        lastModified = modified;
+        lastNestedProjects = nestedProjects;
+
+        try {
+            getContainer().run(true, true, new IRunnableWithProgress() {
+
+                @Override
+                public void run(IProgressMonitor monitor) {
+
+                    monitor.beginTask(UIText.WizardProjectsImportPage_SearchingMessage, 100);
+                    selectedProjects = new ProjectRecord[0];
+                    Collection<File> files = new ArrayList<File>();
+                    monitor.worked(10);
+                    if (directory.isDirectory()) {
+                        boolean searchNested = nestedProjects;
+
+                        boolean found = ProjectUtil.findProjectFiles(files, directory, searchNested, monitor);
+
+                        if (!found)
+                            return;
+
+                        Iterator<File> filesIterator = files.iterator();
+                        selectedProjects = new ProjectRecord[files.size()];
+                        int index = 0;
+                        monitor.worked(50);
+                        monitor.subTask(UIText.WizardProjectsImportPage_ProcessingMessage);
+                        while (filesIterator.hasNext()) {
+                            File file = filesIterator.next();
+                            selectedProjects[index] = new ProjectRecord(file);
+                            index++;
+                        }
+
+                        if (files.isEmpty())
+                            // run in UI thread
+                            Display.getDefault().syncExec(new Runnable() {
+                                @Override
+                                public void run() {
+                                    setErrorMessage(UIText.GitProjectsImportPage_NoProjectsMessage);
+                                }
+                            });
+
+                    } else {
+                        monitor.worked(60);
+                    }
+                    monitor.done();
+                }
+
+            });
+        } catch (InvocationTargetException e) {
+            Activator.logError(e.getMessage(), e);
+        } catch (InterruptedException e) {
+            // Nothing to do if the user interrupts.
+        }
+
+        projectsList.refresh(true);
+        if (getValidProjects().length < selectedProjects.length) {
+            setMessage(UIText.WizardProjectsImportPage_projectsInWorkspace, WARNING);
+        } else {
+            setMessage(UIText.WizardProjectsImportPage_ImportProjectsDescription);
+        }
+        selectAllNewProjects();
+        enableSelectAllButtons();
+        checkPageComplete();
+    }
+
+    private void enableSelectAllButtons() {
+        int itemCount = getValidProjects().length;
+        int selectionCount = projectsList.getCheckedLeafCount();
+        selectAll.setEnabled(itemCount > selectionCount && itemCount > 0);
+        deselectAll.setEnabled(selectionCount > 0);
+    }
+
+    /**
+     * Method used for test suite.
+     * @return CheckboxTreeViewer the viewer containing all the projects found
+     */
+    public TreeViewer getProjectsList() {
+        return projectsList;
+    }
+
+    /**
+     * Retrieve all the projects in the current workspace.
+     * @return IProject[] array of IProject in the current workspace
+     */
+    private IProject[] getProjectsInWorkspace() {
+        if (wsProjects == null) {
+            wsProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+        }
+        return wsProjects;
+    }
+
+    /**
+     * Get the array of valid project records that can be imported from the source workspace or archive, selected by the user. If a project with the same name exists in both the source workspace and
+     * the current workspace, it will not appear in the list of projects to import and thus cannot be selected for import. Method declared public for test suite.
+     * @return ProjectRecord[] array of projects that can be imported into the workspace
+     */
+    public ProjectRecord[] getValidProjects() {
+        List<ProjectRecord> validProjects = new ArrayList<ProjectRecord>();
+        for (int i = 0; i < selectedProjects.length; i++) {
+            if (!isProjectInWorkspace(selectedProjects[i].getProjectName())) {
+                validProjects.add(selectedProjects[i]);
+            }
+        }
+        return validProjects.toArray(new ProjectRecord[validProjects.size()]);
+    }
+
+    /**
+     * Determine if the project with the given name is in the current workspace.
+     * @param projectName String the project name to check
+     * @return boolean true if the project with the given name is in this workspace
+     */
+    private boolean isProjectInWorkspace(String projectName) {
+        if (projectName == null) {
+            return false;
+        }
+        IProject[] workspaceProjects = getProjectsInWorkspace();
+        for (int i = 0; i < workspaceProjects.length; i++) {
+            if (projectName.equals(workspaceProjects[i].getName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @return All the currently checked projects in the projectsList tree
+     */
+    public Set<ProjectRecord> getCheckedProjects() {
+        HashSet<ProjectRecord> ret = new HashSet<ProjectRecord>();
+        for (Object selected : projectsList.getCheckedElements())
+            ret.add((ProjectRecord) selected);
+
+        return ret;
+    }
+
+    /**
+     * @return the selected working sets (may be empty)
+     */
+    public IWorkingSet[] getSelectedWorkingSets() {
+        return workingSetGroup.getSelectedWorkingSets();
+    }
+
+    private void checkPageComplete() {
+        setPageComplete(!getCheckedProjects().isEmpty());
+    }
+
+    private void restoreWidgetValues() {
+        IDialogSettings settings = getDialogSettings();
+        if (settings != null && settings.get(STORE_NESTED_PROJECTS) != null) {
+            nestedProjects = settings.getBoolean(STORE_NESTED_PROJECTS);
+            nestedProjectsCheckbox.setSelection(nestedProjects);
+            lastNestedProjects = nestedProjects;
+        }
+    }
+
+    void saveWidgetValues() {
+        IDialogSettings settings = getDialogSettings();
+        if (settings != null)
+            settings.put(STORE_NESTED_PROJECTS, nestedProjectsCheckbox.getSelection());
+    }
+
+}
diff --git a/rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitSelectWizardPage.java b/rtosIDE/src/org/eclipse/egit/ui/internal/clone/RtGitSelectWizardPage.java
new file mode 100644 (file)
index 0000000..1e2263b
--- /dev/null
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2010 SAP AG.
+ * 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:
+ *    Mathias Kinzler (SAP AG) - initial implementation
+ *    
+ * Modified:
+ * @since 2017. 2. 8.
+ * Daeryong Park <bdragon.park@samsung.com>
+ * 
+ *******************************************************************************/
+
+package org.eclipse.egit.ui.internal.clone;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.egit.ui.internal.repository.RepositoriesViewContentProvider;
+import org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider;
+import org.eclipse.egit.ui.internal.repository.tree.FolderNode;
+import org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode;
+import org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNodeType;
+import org.eclipse.egit.ui.internal.repository.tree.WorkingDirNode;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+public class RtGitSelectWizardPage extends WizardPage {
+
+    /** */
+    public static final int EXISTING_PROJECTS_WIZARD = 0;
+
+    /** */
+    public static final int NEW_WIZARD = 1;
+
+    /** */
+    public static final int GENERAL_WIZARD = 2;
+
+    // TODO check if we need/can support Import... wizard
+    // see also remarks in GitCreateProjectViaWizardWizard
+
+    private final String PREF_WIZ = getName() + "WizardSel"; //$NON-NLS-1$
+
+    private Button importExisting;
+
+    private Button newProjectWizard;
+
+    private Button generalWizard;
+
+    private TreeViewer tv;
+
+    private final Repository initialRepository;
+
+    private final String initialPath;
+
+    private int wizardSelection = EXISTING_PROJECTS_WIZARD;
+
+    /**
+     * Default constructor
+     */
+    public RtGitSelectWizardPage() {
+        super(RtGitSelectWizardPage.class.getName());
+        setTitle(UIText.GitImportWithDirectoriesPage_PageTitle);
+        setMessage(UIText.GitImportWithDirectoriesPage_PageMessage);
+        initialRepository = null;
+        initialPath = null;
+    }
+
+    /**
+     * Default constructor
+     * @param repository
+     * @param path
+     */
+    public RtGitSelectWizardPage(Repository repository, String path) {
+        super(RtGitSelectWizardPage.class.getName());
+        setTitle(UIText.GitImportWithDirectoriesPage_PageTitle);
+        setMessage(UIText.GitImportWithDirectoriesPage_PageMessage);
+        initialRepository = repository;
+        initialPath = path;
+    }
+
+    /**
+     * @return the selected path
+     */
+    public String getPath() {
+        IStructuredSelection sel = (IStructuredSelection) tv.getSelection();
+        RepositoryTreeNode node = (RepositoryTreeNode) sel.getFirstElement();
+        if (node != null && node.getType() == RepositoryTreeNodeType.FOLDER)
+            return ((File) node.getObject()).getPath();
+        if (node != null && node.getType() == RepositoryTreeNodeType.WORKINGDIR)
+            return node.getRepository().getWorkTree().getPath();
+        return null;
+    }
+
+    /**
+     * @param repo
+     */
+    public void setRepository(Repository repo) {
+        List<WorkingDirNode> input = new ArrayList<WorkingDirNode>();
+        if (repo != null)
+            input.add(new WorkingDirNode(null, repo));
+        tv.setInput(input);
+        // expand root node
+        tv.expandToLevel(2);
+        // select the working directory as default
+        tv.setSelection(new StructuredSelection(input.get(0)));
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+
+        Composite main = new Composite(parent, SWT.NO_RADIO_GROUP);
+
+        main.setLayout(new GridLayout(1, false));
+
+        SelectionListener sl = new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                tv.getTree().setEnabled(!newProjectWizard.getSelection());
+                if (importExisting.getSelection())
+                    wizardSelection = EXISTING_PROJECTS_WIZARD;
+                else if (newProjectWizard.getSelection())
+                    wizardSelection = NEW_WIZARD;
+                else if (generalWizard.getSelection())
+                    wizardSelection = GENERAL_WIZARD;
+                else
+                    wizardSelection = EXISTING_PROJECTS_WIZARD;
+                checkPage();
+            }
+        };
+
+        Group wizardType = new Group(main, SWT.SHADOW_ETCHED_IN);
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(wizardType);
+        wizardType.setText(UIText.GitSelectWizardPage_ProjectCreationHeader);
+        wizardType.setLayout(new GridLayout(1, false));
+
+        importExisting = new Button(wizardType, SWT.RADIO);
+        importExisting.setText(UIText.GitSelectWizardPage_ImportExistingButton);
+        importExisting.addSelectionListener(sl);
+
+        newProjectWizard = new Button(wizardType, SWT.RADIO);
+        newProjectWizard.setText(UIText.GitSelectWizardPage_UseNewProjectsWizardButton);
+        newProjectWizard.addSelectionListener(sl);
+        // Modified for disable
+        newProjectWizard.setEnabled(false);
+
+        generalWizard = new Button(wizardType, SWT.RADIO);
+        generalWizard.setText(UIText.GitSelectWizardPage_ImportAsGeneralButton);
+        generalWizard.addSelectionListener(sl);
+
+        IDialogSettings settings = Activator.getDefault().getDialogSettings();
+        try {
+            wizardSelection = settings.getInt(PREF_WIZ);
+        } catch (NumberFormatException e) {
+            wizardSelection = EXISTING_PROJECTS_WIZARD;
+        }
+        switch (wizardSelection) {
+        case EXISTING_PROJECTS_WIZARD:
+            importExisting.setSelection(true);
+            break;
+        case GENERAL_WIZARD:
+            generalWizard.setSelection(true);
+            break;
+        case NEW_WIZARD:
+            newProjectWizard.setSelection(true);
+            break;
+
+        }
+
+        tv = new TreeViewer(main, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+        RepositoriesViewContentProvider cp = new RepositoriesViewContentProvider();
+        tv.setContentProvider(cp);
+        GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 200).applyTo(tv.getTree());
+        tv.setLabelProvider(new RepositoriesViewLabelProvider());
+
+        tv.addSelectionChangedListener(new ISelectionChangedListener() {
+
+            @Override
+            public void selectionChanged(SelectionChangedEvent event) {
+                checkPage();
+            }
+        });
+
+        if (initialRepository != null) {
+            List<WorkingDirNode> input = new ArrayList<WorkingDirNode>();
+            WorkingDirNode node = new WorkingDirNode(null, initialRepository);
+            input.add(node);
+            tv.setInput(input);
+            // expand root node
+            tv.expandToLevel(2);
+            // select the working directory as default
+            if (initialPath == null)
+                tv.setSelection(new StructuredSelection(input.get(0)));
+            else {
+                RepositoryTreeNode parentNode = node;
+
+                IPath fullPath = new Path(initialPath);
+                IPath workdirPath = new Path(initialRepository.getWorkTree().getPath());
+                if (workdirPath.isPrefixOf(fullPath)) {
+                    IPath relPath = fullPath.removeFirstSegments(workdirPath.segmentCount());
+                    for (String segment : relPath.segments()) {
+                        for (Object child : cp.getChildren(parentNode)) {
+                            if (child instanceof FolderNode) {
+                                FolderNode childFolder = (FolderNode) child;
+                                if (childFolder.getObject().getName().equals(segment)) {
+                                    parentNode = childFolder;
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                    tv.setSelection(new StructuredSelection(parentNode));
+                }
+            }
+        }
+        tv.getTree().setEnabled(!newProjectWizard.getSelection());
+        Dialog.applyDialogFont(main);
+        setControl(main);
+
+    }
+
+    /**
+     * @return the wizard selection
+     */
+    public int getWizardSelection() {
+        return wizardSelection;
+    }
+
+    /**
+     * check routine
+     */
+    protected void checkPage() {
+
+        // we save the selected radio button in the preferences
+        IDialogSettings settings = Activator.getDefault().getDialogSettings();
+
+        settings.put(PREF_WIZ, getWizardSelection());
+
+        setErrorMessage(null);
+
+        if (newProjectWizard.getSelection()) {
+            setPageComplete(true);
+            return;
+        }
+
+        IStructuredSelection sel = (IStructuredSelection) tv.getSelection();
+        try {
+            if (sel.isEmpty()) {
+                setErrorMessage(UIText.GitImportWithDirectoriesPage_SelectFolderMessage);
+                return;
+            }
+            RepositoryTreeNode node = (RepositoryTreeNode) sel.getFirstElement();
+            if (node.getType() != RepositoryTreeNodeType.FOLDER
+                    && node.getType() != RepositoryTreeNodeType.WORKINGDIR) {
+                setErrorMessage(UIText.GitImportWithDirectoriesPage_SelectFolderMessage);
+                return;
+            }
+        } finally {
+            setPageComplete(getErrorMessage() == null);
+        }
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/Activator.java b/rtosIDE/src/org/tizen/rt/ide/Activator.java
new file mode 100644 (file)
index 0000000..972ee12
--- /dev/null
@@ -0,0 +1,75 @@
+package org.tizen.rt.ide;
+
+import org.apache.log4j.PropertyConfigurator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.tizen.rt.ide"; //$NON-NLS-1$
+
+    // The shared instance
+    private static Activator plugin;
+
+    /**
+     * The constructor
+     */
+    public Activator() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start(BundleContext context) throws Exception {
+        super.start(context);
+        PropertyConfigurator.configure(Activator.class.getResource("log4j.properties"));
+        plugin = this;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop(BundleContext context) throws Exception {
+        plugin = null;
+        super.stop(context);
+    }
+
+    /**
+     * Returns the shared instance
+     * @return the shared instance
+     */
+    public static Activator getDefault() {
+        return plugin;
+    }
+
+    /**
+     * Returns an image descriptor for the image file at the given plug-in relative path
+     * @param path the path
+     * @return the image descriptor
+     */
+    public static ImageDescriptor getImageDescriptor(String path) {
+        return imageDescriptorFromPlugin(PLUGIN_ID, path);
+    }
+
+    public static String getPluginId() {
+        return getDefault().getBundle().getSymbolicName();
+    }
+
+    public static void log(Throwable e) {
+        log(new Status(IStatus.ERROR, getPluginId(), e.getMessage(), e));
+    }
+
+    public static void log(IStatus status) {
+        getDefault().getLog().log(status);
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/LinuxBuildCommand.java b/rtosIDE/src/org/tizen/rt/ide/LinuxBuildCommand.java
new file mode 100644 (file)
index 0000000..902612a
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.console.ConsoleManager;
+import org.tizen.rt.ide.util.OSChecker;
+
+/**
+ * LinuxCommand
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class LinuxBuildCommand {
+    private final Logger logger = LoggerFactory.getLogger(LinuxBuildCommand.class);
+
+    private String BUILD_USER_HOME_PATH = System.getProperty("user.home");
+
+    private String LINUX_FIND_BUILD_OPTION[] = { "/bin/sh", "-c", "find -L " + BUILD_USER_HOME_PATH + "/tinyara/ -name defconfig" };
+    private final String WIN_FIND_BUILD_OPTION[] = { "cmd.exe", "/c", "dir c:\\users" };
+
+    // here
+    private String LINUX_BUILD_RTOS_HOME_PATH = BUILD_USER_HOME_PATH + "/tinyara"; // here
+    private String LINUX_BUILD_OPTION_PATH = LINUX_BUILD_RTOS_HOME_PATH + "/os/tools/";
+    private String LINUX_BUILD_EXECUTE_PATH = LINUX_BUILD_RTOS_HOME_PATH + "/os/";
+
+    private final String LINUX_EXECUTE_SET_BUILD_OPTION = "./configure.sh";
+    private final String LINUX_EXECUTE_BUILD = "make ";
+    private final String WIN_EXECUTE_BUILD[] = { "cmd.exe", "/c", "dir c:\\users" };
+
+    private ArrayList<String> resultBuildOptionList = new ArrayList<String>();
+    private ArrayList<String> resultBuildExecute = new ArrayList<String>();
+
+    protected ArrayList<String> executeFindBuildOption() {
+
+        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();
+            String activeProjectName = activeProject.getLocation().toString();
+            //
+            // MessageDialog.openInformation(window.getShell(), "Artik-common", activeProjectName);
+            LINUX_BUILD_RTOS_HOME_PATH = activeProjectName;
+            RtosCommandManager.rtoshome = LINUX_BUILD_RTOS_HOME_PATH;
+        } 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();
+                        String activeProjectName = activeProject.getLocation().toString();
+                        LINUX_BUILD_OPTION_PATH = LINUX_BUILD_RTOS_HOME_PATH + "/os/tools/";
+                        // MessageDialog.openInformation(window.getShell(), "Artik-common", activeProjectName);
+                        LINUX_BUILD_RTOS_HOME_PATH = activeProjectName;
+                        RtosCommandManager.rtoshome = LINUX_BUILD_RTOS_HOME_PATH;
+                    }
+                }
+            }
+        }
+
+        LINUX_FIND_BUILD_OPTION[2] = "find -L " + LINUX_BUILD_RTOS_HOME_PATH + " -name defconfig";
+
+        // second
+        LINUX_BUILD_OPTION_PATH = LINUX_BUILD_RTOS_HOME_PATH + "/os/tools/";
+        LINUX_BUILD_EXECUTE_PATH = LINUX_BUILD_RTOS_HOME_PATH + "/os/";
+
+        Process p;
+        try {
+            if (OSChecker.isWindows()) {
+                p = Runtime.getRuntime().exec(WIN_FIND_BUILD_OPTION);
+            } else {
+                // {"/bin/sh", "-c", "find -L ~/02.develop/RT/tinyara/ -name defconfig" };
+                p = Runtime.getRuntime().exec(LINUX_FIND_BUILD_OPTION);
+            }
+            p.waitFor();
+            BufferedReader reader = new BufferedReader(new InputStreamReader(
+                    p.getInputStream()));
+
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                resultBuildOptionList.add(line);
+            }
+
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        return resultBuildOptionList;
+    }
+
+    protected ArrayList<String> executeBuild(String buildOption, ConsoleManager consoleManager,
+            IProgressMonitor monitor) {
+
+        LINUX_BUILD_OPTION_PATH = RtosCommandManager.rtoshome + "/os/tools/";
+        LINUX_BUILD_EXECUTE_PATH = RtosCommandManager.rtoshome + "/os/";
+        Process p;
+        try {
+            if (OSChecker.isWindows()) {
+                p = Runtime.getRuntime().exec(WIN_EXECUTE_BUILD);
+            } else {
+                // "./configure.sh"
+                p = Runtime.getRuntime().exec(LINUX_EXECUTE_SET_BUILD_OPTION + " " + buildOption, null, new File(LINUX_BUILD_OPTION_PATH));
+            }
+            p.waitFor();
+
+            BufferedReader reader = new BufferedReader(new InputStreamReader(
+                    p.getInputStream()));
+
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                consoleManager.println(line);
+                resultBuildExecute.add(line);// output.append(line + "\n");LINUX_EXECUTE_BUILD
+            }
+
+            monitor.worked(1);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        try {
+            if (OSChecker.isWindows()) {
+                p = Runtime.getRuntime().exec(WIN_EXECUTE_BUILD);
+            } else {
+                // "./configure.sh"
+                p = Runtime.getRuntime().exec(LINUX_EXECUTE_BUILD, null, new File(LINUX_BUILD_EXECUTE_PATH));
+            }
+            p.waitFor();
+
+            BufferedReader reader = new BufferedReader(new InputStreamReader(
+                    p.getInputStream()));
+
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                consoleManager.println(line);
+                resultBuildExecute.add(line);// output.append(line + "\n");
+            }
+
+            monitor.worked(1);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        return resultBuildExecute;
+
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/LinuxFlashCommand.java b/rtosIDE/src/org/tizen/rt/ide/LinuxFlashCommand.java
new file mode 100644 (file)
index 0000000..d49dac4
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.console.ConsoleManager;
+import org.tizen.rt.ide.util.OSChecker;
+
+/**
+ * LinuxCommand
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class LinuxFlashCommand {
+    private final Logger logger = LoggerFactory.getLogger(LinuxFlashCommand.class);
+
+    private final String FLASH_USER_HOME_PATH = System.getProperty("user.home");
+
+    private final String WIN_FIND_BUILD_OPTION[] = { "cmd.exe", "/c", "dir c:\\users" };
+    private final String WIN_EXECUTE_BUILD[] = { "cmd.exe", "/c", "dir c:\\users" };
+
+    /**
+     * important PATH
+     */
+    private String LINUX_FLASH_RTOS_HOME_PATH = FLASH_USER_HOME_PATH + "/tinyara";
+    private String LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + "/build/configs/sidk_s5jt200/openocd/";
+    private final String LINUX_FIND_FLASH_OPTION[] = { "/bin/sh", "-c", "ls" + " " + LINUX_FLASH_OPTION_PATH + "*.cfg" };
+
+    private final String LINUX_EXECUTE_BUILD = "./openocd_linux64 -f";
+
+    private ArrayList<String> resultFlashOptionList = new ArrayList<String>();
+    private ArrayList<String> resultFlashExecute = new ArrayList<String>();
+
+    protected ArrayList<String> executeFindFlashOption() {
+
+        /**
+         * 
+         */
+        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();
+            String activeProjectName = activeProject.getLocation().toString();
+            //
+            // MessageDialog.openInformation(window.getShell(), "Artik-common", activeProjectName);
+            LINUX_FLASH_RTOS_HOME_PATH = activeProjectName;
+            LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + "/build/configs/sidk_s5jt200/openocd/";
+            RtosCommandManager.rtoshome = LINUX_FLASH_RTOS_HOME_PATH;
+        } 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();
+                        String activeProjectName = activeProject.getLocation().toString();
+                        LINUX_FLASH_RTOS_HOME_PATH = activeProjectName;
+                        LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + "/build/configs/sidk_s5jt200/openocd/";
+                        // MessageDialog.openInformation(window.getShell(), "Artik-common", activeProjectName);
+                        RtosCommandManager.rtoshome = LINUX_FLASH_RTOS_HOME_PATH;
+
+                    }
+                }
+            }
+        }
+
+        LINUX_FIND_FLASH_OPTION[2] = "ls" + " " + LINUX_FLASH_OPTION_PATH + "*.cfg";
+
+        // second
+        LINUX_FLASH_OPTION_PATH = RtosCommandManager.rtoshome + "/build/configs/sidk_s5jt200/openocd/";
+        /**
+         * 
+         */
+
+        resultFlashOptionList.clear();
+        Process p;
+        try {
+            if (OSChecker.isWindows()) {
+                p = Runtime.getRuntime().exec(WIN_FIND_BUILD_OPTION);
+            } else {
+                p = Runtime.getRuntime().exec(LINUX_FIND_FLASH_OPTION);
+            }
+            p.waitFor();
+            BufferedReader reader = new BufferedReader(new InputStreamReader(
+                    p.getInputStream()));
+
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                resultFlashOptionList.add(line);
+            }
+
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        return resultFlashOptionList;
+    }
+
+    protected ArrayList<String> executeFlash(String buildOption, ConsoleManager consoleManager,
+            IProgressMonitor monitor) {
+
+        LINUX_FLASH_OPTION_PATH = RtosCommandManager.rtoshome + "/build/configs/sidk_s5jt200/openocd/";
+        resultFlashExecute.clear();
+        Process p;
+        try {
+            if (OSChecker.isWindows()) {
+                p = Runtime.getRuntime().exec(WIN_EXECUTE_BUILD);
+            } else {
+                // "./openocd_linux64 -f "
+                p = Runtime.getRuntime().exec(LINUX_EXECUTE_BUILD + " " + buildOption + ".cfg", null, new File(LINUX_FLASH_OPTION_PATH));
+            }
+            p.waitFor();
+            BufferedReader reader = new BufferedReader(new InputStreamReader(
+                    p.getInputStream()));
+
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                consoleManager.println(line);
+                resultFlashExecute.add(line);// output.append(line + "\n");
+            }
+
+            monitor.worked(1);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        return resultFlashExecute;
+
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/Messages.java b/rtosIDE/src/org/tizen/rt/ide/Messages.java
new file mode 100644 (file)
index 0000000..81ad280
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * Common
+ *
+ * @since 2017. 2. 7.
+ *
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Daeryong Park <bdragon.park@samsung.com>
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.rt.ide;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.tizen.rt.ide.messages"; //$NON-NLS-1$
+
+    public static String NewArtikProjectMainWizard_window_title;
+
+    public static String NewArtikProjectMainPage_local_button_text;
+    public static String NewArtikProjectMainPage_git_button_text;
+    public static String NewArtikProjectMainPage_title;
+    public static String NewArtikProjectMainPage_desc;
+
+    public static String NewArtikProjectWizard_create_op_label;
+    public static String NewArtikProjectWizard_window_title;
+
+    public static String NewArtikProjectWizardPage_desc;
+    public static String NewArtikProjectWizardPage_title;
+
+    public static String NewArtikProjectWizardPage2_desc;
+    public static String NewArtikProjectWizardPage2_title;
+
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/ResourceManager.java b/rtosIDE/src/org/tizen/rt/ide/ResourceManager.java
new file mode 100644 (file)
index 0000000..e19ff80
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * Common
+ *
+ * @since 2017. 2. 10.
+ *
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Daeryong Park <bdragon.park@samsung.com>
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.rt.ide;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+
+public class ResourceManager {
+
+    private ResourceManager() {
+    }
+
+    public static final Color BLACK = new Color(getDisplay(), 0, 0, 0); // Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
+    public static final Color RED = new Color(getDisplay(), 255, 0, 0); // Display.getCurrent().getSystemColor(SWT.COLOR_RED);
+    public static final Color GREEN = new Color(getDisplay(), 0, 255, 0); // Display.getCurrent().getSystemColor(SWT.COLOR_GREEN);
+    public static final Color YELLOW = new Color(getDisplay(), 255, 255, 0); // Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW);
+    public static final Color BLUE = new Color(getDisplay(), 0, 0, 255); // Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
+    public static final Color MAGENTA = new Color(getDisplay(), 255, 0, 255); // Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA);
+    public static final Color CYAN = new Color(getDisplay(), 0, 255, 255); // Display.getCurrent().getSystemColor(SWT.COLOR_CYAN);
+    public static final Color WHITE = new Color(getDisplay(), 255, 255, 255); // Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
+
+    public static final Color INTENSE_BLACK = new Color(getDisplay(), 0, 0, 0); // Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
+    public static final Color INTENSE_RED = new Color(getDisplay(), 139, 0, 0); // Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED);
+    public static final Color INTENSE_GREEN = new Color(getDisplay(), 0, 100, 0);// Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
+    public static final Color INTENSE_YELLOW = new Color(getDisplay(), 250, 250, 210);// Display.getCurrent().getSystemColor(SWT.COLOR_DARK_YELLOW);
+    public static final Color INTENSE_BLUE = new Color(getDisplay(), 0, 0, 139);// Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
+    public static final Color INTENSE_MAGENTA = new Color(getDisplay(), 139, 0, 139);// Display.getCurrent().getSystemColor(SWT.COLOR_DARK_MAGENTA);
+    public static final Color INTENSE_CYAN = new Color(getDisplay(), 0, 139, 139);// Display.getCurrent().getSystemColor(SWT.COLOR_DARK_CYAN);
+    public static final Color INTENSE_WHITE = new Color(getDisplay(), 245, 245, 245);// Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
+
+    /**
+     * return {@link Display} in context return new {@link Display} if no {@link Display} in context
+     * @return SWT {@link Display} simply
+     * @see Display#getCurrent()
+     * @see Display#getDefault();
+     */
+    public static Display getDisplay() {
+        Display dp = Display.getCurrent();
+        if (null != dp) {
+            return dp;
+        }
+
+        return Display.getDefault();
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/RtosCommandManager.java b/rtosIDE/src/org/tizen/rt/ide/RtosCommandManager.java
new file mode 100644 (file)
index 0000000..130d972
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.build.BuildOption;
+import org.tizen.rt.ide.console.ConsoleManager;
+import org.tizen.rt.ide.flash.FlashOption;
+import org.tizen.rt.ide.util.OSChecker;
+
+/**
+ * RtosCommandManager
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class RtosCommandManager {
+
+    private static final String SUCCEED = "SUCCEED";
+    private static final String FAILED = "FAILED";
+
+    protected static ArrayList<BuildOption> buildOptionList = new ArrayList<BuildOption>();
+    protected static ArrayList<FlashOption> flashOptionList = new ArrayList<FlashOption>();
+    public static RtosCommandManager rtosCommandManager = null;
+    // protected static LinuxBuildCommand linuxBuildCommand = null;
+    // protected static LinuxFlashCommand LinuxFlashCommand = null;
+    public static String rtoshome = null;
+    public static String DeviceInfoOnConfiguration = null;
+
+    private static final Logger logger = LoggerFactory.getLogger(RtosCommandManager.class);
+
+    private RtosCommandManager() {
+    }
+
+    public static RtosCommandManager getDeviceEntryManager() {
+        if (rtosCommandManager == null) {
+            rtosCommandManager = new RtosCommandManager();
+        }
+
+        return rtosCommandManager;
+    }
+
+    public static boolean doUpdateOptionList() {
+
+        boolean isUpdate = false;
+
+        ArrayList<BuildOption> list = RtosCommandManager.getBuildOptions();
+
+        buildOptionListClear();
+        buildOptionList = new ArrayList<BuildOption>(list);
+
+        return isUpdate;
+
+    }
+
+    public void setHighlightListener(Shell shell, final Table table) {
+        final Color backGround1 = shell.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
+        final Color backGround2 = shell.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
+
+        table.addListener(SWT.EraseItem, new Listener() {
+
+            @Override
+            public void handleEvent(Event event) {
+                event.detail &= ~SWT.HOT;
+                if ((event.detail & SWT.SELECTED) == 0)
+                    return; /* item not selected */
+                int clientWidth = table.getClientArea().width;
+                org.eclipse.swt.graphics.GC gc = event.gc;
+                Color oldForeground = gc.getForeground();
+                Color oldBackground = gc.getBackground();
+                gc.setForeground(backGround1);
+                gc.setBackground(backGround2);
+
+                gc.fillGradientRectangle(0, event.y, clientWidth, event.height, false);
+                gc.setForeground(oldForeground);
+                gc.setBackground(oldBackground);
+                event.detail &= ~SWT.SELECTED;
+            }
+
+        });
+    }
+
+    public static ArrayList<BuildOption> getBuildOptions() {
+
+        buildOptionListClear();
+
+        // if (OSChecker.isLinux()) {
+        // LinuxBuildCommand linuxBuildCommand = new LinuxBuildCommand();
+        // List<String> result = linuxBuildCommand.executeFindBuildOption();
+        //
+        // if (result != null && result.size() != 0) {
+        // for (String s : result) {
+        // String[] tmp = s.split("configs/");
+        // if (tmp.length >= 2) {
+        // String[] tmp2 = tmp[1].split("/defconfig");
+        // buildOptionList.add(new BuildOption(tmp2[0]));
+        // }
+        // }
+        // }
+        // } else if (OSChecker.isWindows() || OSChecker.isMAC()) {
+        Win32BuildCommand linuxBuildCommand = new Win32BuildCommand();
+        List<String> result = linuxBuildCommand.executeFindBuildOption();
+
+        if (result != null && result.size() != 0) {
+            for (String s : result) {
+                buildOptionList.add(new BuildOption(s));
+            }
+        }
+        // }
+
+        return buildOptionList;
+    }
+
+    // TODO
+    public ArrayList<FlashOption> getFlashOptions() {
+        flashOptionListClear();
+
+        // if (OSChecker.isLinux()) {
+        // LinuxFlashCommand linuxFlashCommand = new LinuxFlashCommand();
+        //
+        // List<String> result = linuxFlashCommand.executeFindFlashOption();
+        // if (result.size() != 0) {
+        // for (String s : result) {
+        // String[] tmp = s.split("openocd/");
+        // if (tmp.length >= 2) {
+        // String[] tmp2 = tmp[1].split(".cfg");
+        // flashOptionList.add(new FlashOption(tmp2[0]));
+        // }
+        // }
+        // }
+        // } else {
+        Win32FlashCommand linuxFlashCommand = new Win32FlashCommand();
+        List<String> result = linuxFlashCommand.executeFindFlashOption();
+
+        if (result != null && result.size() != 0) {
+            for (String s : result) {
+                flashOptionList.add(new FlashOption(s));
+            }
+        }
+        // }
+
+        return flashOptionList;
+    }
+
+    public static void flashOptionListClear() {
+        flashOptionList.clear();
+    }
+
+    public static void buildOptionListClear() {
+        buildOptionList.clear();
+    }
+
+    /**
+     * @param Option build options
+     * @param consoleManager ConsoleManager instance
+     * @param monitor
+     * @return success or not
+     */
+    public static boolean runBuild(String Option, ConsoleManager consoleManager, IProgressMonitor monitor) {
+        if (consoleManager == null) {
+            logger.error("ConsoleManager is null");
+            return false;
+        }
+        ArrayList<String> result = null;
+        // if(OSChecker.isLinux()) {
+        // LinuxBuildCommand linuxBuildCommand = new LinuxBuildCommand();
+        // result = linuxBuildCommand.executeBuild(Option, consoleManager, monitor);
+        // } else if (OSChecker.isWindows()) {
+        Win32BuildCommand win32BuildCommand = new Win32BuildCommand();
+        result = win32BuildCommand.executeBuild(Option, consoleManager, monitor);
+        // }
+
+        return processResult(result, consoleManager);
+    }
+
+    public static boolean runFlash(String Option, ConsoleManager consoleManager, IProgressMonitor monitor) {
+        if (consoleManager == null) {
+            logger.error("ConsoleManager is null");
+            return false;
+        }
+        ArrayList<String> result = null;
+        // if (OSChecker.isLinux()) {
+        // LinuxFlashCommand linuxFlashCommand = new LinuxFlashCommand();
+        // result = linuxFlashCommand.executeFlash(Option, consoleManager, monitor);
+        // } else if (OSChecker.isWindows()) {
+        Win32FlashCommand win32BuildCommand = new Win32FlashCommand();
+        result = win32BuildCommand.executeFlash(Option, consoleManager, monitor);
+        // }
+
+        return processResult(result, consoleManager);
+    }
+
+    /**
+     * Print success status to the Console and if failed print error messages to the Console
+     * @param result
+     * @param consoleManager
+     * @return success or not
+     */
+    private static boolean processResult(ArrayList<String> result, ConsoleManager consoleManager) {
+        boolean success = result.size() == 0;
+        if (consoleManager != null) {
+            consoleManager.print("[STATUS] ", SWT.BOLD, ResourceManager.BLACK);
+            if (success) { // success
+                consoleManager.println(SUCCEED, SWT.BOLD, ResourceManager.GREEN);
+            } else { // fail
+                consoleManager.println(FAILED, SWT.BOLD, ResourceManager.RED);
+            }
+            // consoleManager.println("[RESULT]" + result.toString(), SWT.BOLD,
+            // ResourceManager.BLACK);
+        } else {
+            if (success) { // success
+                logger.debug("[STATUS] " + SUCCEED);
+            } else { // fail
+                logger.debug("[STATUS] " + FAILED);
+            }
+            // logger.debug("[RESULT]" + result);
+        }
+        return success;
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/Win32BuildCommand.java b/rtosIDE/src/org/tizen/rt/ide/Win32BuildCommand.java
new file mode 100644 (file)
index 0000000..fd59464
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.console.ConsoleManager;
+import org.tizen.rt.ide.util.ProcUtil;
+
+/**
+ * LinuxCommand
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class Win32BuildCommand {
+    private final Logger logger = LoggerFactory.getLogger(Win32BuildCommand.class);
+
+    private String BUILD_USER_HOME_PATH = System.getProperty("user.home");
+
+    private static String LINUX_BUILD_RTOS_HOME_PATH = null;
+
+    private String LINUX_BUILD_OS_HOME_PATH = "os";
+    private String LINUX_BUILD_TOOLS_PATH = "os/tools";
+
+    private final String LINUX_EXECUTE_SET_BUILD_OPTION = "configure.bat";
+    private final String LINUX_EXECUTE_BUILD = "make";
+
+    private ArrayList<String> resultBuildOptionList = new ArrayList<String>();
+    private ArrayList<String> resultBuildExecute = new ArrayList<String>();
+
+    protected ArrayList<String> executeFindBuildOption() {
+        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();
+            String activeProjectName = activeProject.getLocation().toString();
+            //
+            // MessageDialog.openInformation(window.getShell(), "Artik-common",
+            // activeProjectName);
+            LINUX_BUILD_RTOS_HOME_PATH = activeProjectName;
+            RtosCommandManager.rtoshome = LINUX_BUILD_RTOS_HOME_PATH;
+        } 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();
+                        String activeProjectName = activeProject.getLocation().toString();
+                        // MessageDialog.openInformation(window.getShell(),
+                        // "Artik-common", activeProjectName);
+                        LINUX_BUILD_RTOS_HOME_PATH = activeProjectName;
+                        RtosCommandManager.rtoshome = LINUX_BUILD_RTOS_HOME_PATH;
+                    }
+                }
+            }
+        }
+
+        File home = new File(LINUX_BUILD_RTOS_HOME_PATH, "build/configs");
+        File[] boards = home.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File arg0, String arg1) {
+                return new File(arg0, arg1).isDirectory();
+            }
+        });
+
+        if (boards != null) {
+            for (File board : boards) {
+                File[] subdirs = board.listFiles(new FilenameFilter() {
+                    @Override
+                    public boolean accept(File arg0, String arg1) {
+                        return new File(arg0, arg1).isDirectory();
+                    }
+                });
+
+                if (subdirs != null) {
+                    for (File subdir : subdirs) {
+                        File defconfig = new File(subdir, "defconfig");
+                        if (defconfig.exists()) {
+                            resultBuildOptionList.add(subdir.getName());
+                        }
+                    }
+                }
+            }
+        }
+
+        return resultBuildOptionList;
+    }
+
+    protected ArrayList<String> executeBuild(String buildOption, ConsoleManager consoleManager,
+            IProgressMonitor monitor) {
+
+        String homePath = LINUX_BUILD_RTOS_HOME_PATH + File.separator + LINUX_BUILD_OS_HOME_PATH;
+        String toolPath = LINUX_BUILD_RTOS_HOME_PATH + File.separator + LINUX_BUILD_TOOLS_PATH;
+
+        int result = ProcUtil.executeProcess(null, new String[] { LINUX_EXECUTE_SET_BUILD_OPTION, buildOption },
+                toolPath, consoleManager, resultBuildExecute);
+        monitor.worked(1);
+        if (result != 0) {
+            result = ProcUtil.executeProcess(null, new String[] { LINUX_EXECUTE_BUILD, "V=1" }, homePath,
+                    consoleManager, resultBuildExecute);
+            monitor.worked(1);
+        }
+
+        return resultBuildExecute;
+
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/Win32FlashCommand.java b/rtosIDE/src/org/tizen/rt/ide/Win32FlashCommand.java
new file mode 100644 (file)
index 0000000..db5123a
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.console.ConsoleManager;
+import org.tizen.rt.ide.util.OSChecker;
+import org.tizen.rt.ide.util.ProcUtil;
+
+/**
+ * LinuxCommand
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class Win32FlashCommand {
+    private final Logger logger = LoggerFactory.getLogger(Win32FlashCommand.class);
+
+    private final String FLASH_USER_HOME_PATH = System.getProperty("user.home");
+
+    private final String WIN_FIND_BUILD_OPTION[] = { "cmd.exe", "/c", "dir c:\\users" };
+    private final String WIN_EXECUTE_BUILD[] = { "cmd.exe", "/c", "dir c:\\users" };
+
+    /**
+     * important PATH
+     */
+    private String LINUX_FLASH_RTOS_HOME_PATH = FLASH_USER_HOME_PATH + "/tinyara";
+    private String LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + "/build/configs/sidk_s5jt200/openocd/";
+    private final String LINUX_FIND_FLASH_OPTION[] = { "/bin/sh", "-c", "ls" + " " + LINUX_FLASH_OPTION_PATH + "*.cfg" };
+
+    private final String LINUX_EXECUTE_BUILD = "./openocd_linux64 -f";
+
+    private ArrayList<String> resultFlashOptionList = new ArrayList<String>();
+    private ArrayList<String> resultFlashExecute = new ArrayList<String>();
+
+    protected ArrayList<String> executeFindFlashOption() {
+
+        /**
+         * 
+         */
+        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();
+            String activeProjectName = activeProject.getLocation().toString();
+            //
+            // MessageDialog.openInformation(window.getShell(), "Artik-common", activeProjectName);
+            LINUX_FLASH_RTOS_HOME_PATH = activeProjectName;
+            LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + "/build/configs/sidk_s5jt200/openocd/";
+            RtosCommandManager.rtoshome = LINUX_FLASH_RTOS_HOME_PATH;
+        } 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();
+                        String activeProjectName = activeProject.getLocation().toString();
+                        LINUX_FLASH_RTOS_HOME_PATH = activeProjectName;
+                        LINUX_FLASH_OPTION_PATH = LINUX_FLASH_RTOS_HOME_PATH + "/build/configs/sidk_s5jt200/openocd/";
+                        // MessageDialog.openInformation(window.getShell(), "Artik-common", activeProjectName);
+                        RtosCommandManager.rtoshome = LINUX_FLASH_RTOS_HOME_PATH;
+
+                    }
+                }
+            }
+        }
+
+        File home = new File(LINUX_FLASH_OPTION_PATH);
+        File[] cfgs = home.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File arg0, String arg1) {
+                return arg1.endsWith(".cfg");
+            }
+        });
+
+        if (cfgs != null) {
+            for (File cfg : cfgs) {
+                resultFlashOptionList.add(cfg.getName());
+            }
+        }
+
+        return resultFlashOptionList;
+    }
+
+    protected ArrayList<String> executeFlash(String buildOption, ConsoleManager consoleManager,
+            IProgressMonitor monitor) {
+
+        LINUX_FLASH_OPTION_PATH = RtosCommandManager.rtoshome + "/build/configs/sidk_s5jt200/openocd/";
+        resultFlashExecute.clear();
+
+        int result = ProcUtil.executeProcess(null, new String[] { LINUX_EXECUTE_BUILD, buildOption },
+                LINUX_FLASH_OPTION_PATH, consoleManager, resultFlashExecute);
+        monitor.worked(1);
+
+        return resultFlashExecute;
+
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/build/BuildBuilder.java b/rtosIDE/src/org/tizen/rt/ide/build/BuildBuilder.java
new file mode 100644 (file)
index 0000000..9e8fd92
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.build;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.util.Util;
+
+public class BuildBuilder {
+    // private Logger logger = LoggerFactory.getLogger(Builder.class);
+
+    public BuildBuilder() {
+
+    }
+
+    /**
+     * RTOS build Wizard
+     * @return true Success of open dialog, otherwise false
+     */
+    public boolean openBuildWizard() {
+        RtosBuildWizard rtosWizard = new RtosBuildWizard(Util.getWorkbenchWindow().getShell());
+        RtosBuildWizardDialog rtosWizardDialog = new RtosBuildWizardDialog(Util
+                .getWorkbenchWindow().getShell(), rtosWizard);
+
+        rtosWizardDialog.setHelpAvailable(true);
+        rtosWizardDialog.create();
+        int result = rtosWizardDialog.open();
+
+        if (result == Dialog.OK) {
+            return true;
+        } else {
+            // logger.error("failed to open BuildWizard ");
+        }
+        return false;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/build/BuildOption.java b/rtosIDE/src/org/tizen/rt/ide/build/BuildOption.java
new file mode 100644 (file)
index 0000000..15397bf
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.build;
+
+/**
+ * BuildOption
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class BuildOption {
+    private final String buildOption;
+
+    public BuildOption(String buildOption) {
+        this.buildOption = buildOption;
+    }
+
+    public String getBuildOption() {
+        return buildOption;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java b/rtosIDE/src/org/tizen/rt/ide/build/RtosBuildDialogPage.java
new file mode 100644 (file)
index 0000000..f419aa9
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.build;
+
+import java.util.ArrayList;
+
+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;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+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.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+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;
+
+/**
+ * DeviceGuideDialogPage Select Emulator Wizard Feature
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class RtosBuildDialogPage extends WizardPage {
+
+    private Shell shell;
+    private Table table;
+    public TableViewer tableViewer;
+
+    protected RtosBuildDialogPage(String pageName, Shell shell) {
+        super(pageName);
+        this.shell = shell;
+        setTitle("Build Project");
+        setDescription("Selection of build option page");
+        setErrorMessage(null);
+    }
+
+    @Override
+    public void performHelp() {
+
+    }
+
+    @Override
+    public void createControl(Composite parentComposite) {
+
+        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);
+
+        tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
+        tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+            public void selectionChanged(SelectionChangedEvent event) {
+                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+                for (Object o : selection.toArray()) {
+                    BuildOption bOption = (BuildOption) o;
+                    RtosBuildWizardDialog.selectionOptionName(bOption.getBuildOption());
+                }
+
+            }
+        });
+
+        table = tableViewer.getTable();
+        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);
+
+        tableViewer.setLabelProvider(new TableViewerProvider());
+        tableViewer.setContentProvider(new ArrayContentProvider());
+        tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+            @Override
+            public void doubleClick(DoubleClickEvent arg0) {
+                RtosBuildWizard wizard = (RtosBuildWizard) getWizard();
+                RtosBuildWizardDialog dialog = (RtosBuildWizardDialog) wizard.getContainer();
+                dialog.PressedFinished();
+            }
+
+        });
+
+        // get divice list & extract Device Entry detailList From XML
+        RtosCommandManager rtosCommandMAnager = RtosCommandManager.getDeviceEntryManager();
+        ArrayList<BuildOption> testList = rtosCommandMAnager.getBuildOptions();
+
+        RtosBuildWizard wizard = (RtosBuildWizard) getWizard();
+        RtosBuildWizardDialog dialog = (RtosBuildWizardDialog) wizard.getContainer();
+        if (testList.size() != 0) {
+            // set HighlightEntryList
+            rtosCommandMAnager.setHighlightListener(shell, table);
+
+            // input buildOption list
+            tableViewer.setInput(testList);
+
+            Object element = tableViewer.getElementAt(0);
+            // set Highlighting specific item with latestBuildOptionInfo.
+            tableViewer.setSelection(new StructuredSelection(element), true);
+
+            // set default buildOption
+            RtosBuildWizardDialog.selectionOptionName(((BuildOption) element).getBuildOption());
+
+            wizard.canFinish();
+        } else {
+            wizard.canFinish();
+            setDescription("There is no Option");
+        }
+
+        setHelpContextIDs(parentComposite);
+        setControl(parentComposite);
+
+    }
+
+    private void setHelpContextIDs(Composite composite) {
+        // second parameter : packagename.ID_Of_contexts.xml
+        PlatformUI.getWorkbench().getHelpSystem()
+                .setHelp(composite, "org.tizen.nativecommon.AutomationEmulatorWizard");
+    }
+
+    public void setDefaultDescription() {
+        setDescription("Selection of build option page");
+    }
+
+    private class TableViewerProvider extends LabelProvider implements ITableLabelProvider {
+
+        @Override
+        public Image getColumnImage(Object arg0, int columnIndex) {
+            return null;
+        }
+
+        @Override
+        public String getColumnText(Object element, int columnIndex) {
+            // TODO: create object in associated with Device EntryList
+            if (element instanceof BuildOption) {
+                BuildOption bOption = (BuildOption) element;
+                switch (columnIndex) {
+                case 0:
+                    return bOption.getBuildOption();
+                default:
+                    break;
+                }
+            }
+            return null;
+        }
+
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/build/RtosBuildWizard.java b/rtosIDE/src/org/tizen/rt/ide/build/RtosBuildWizard.java
new file mode 100644 (file)
index 0000000..34d3c03
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.build;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.RtosCommandManager;
+import org.tizen.rt.ide.console.ConsoleManager;
+
+/**
+ * RtosWizard
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class RtosBuildWizard extends Wizard implements IPageChangedListener {
+
+    private ConsoleManager consoleManager;
+    private Shell shell;
+    private final String GUIDE_DIALOG_NAME = "Build Option Selection";
+    private RtosBuildDialogPage rtosDialogPage = null;
+    private final Logger logger = LoggerFactory.getLogger(RtosBuildWizard.class);
+
+    public RtosBuildWizard(Shell shell) {
+        super();
+        this.setWindowTitle("Rtos Build Wizard");
+        this.setNeedsProgressMonitor(true);
+        this.shell = shell;
+        this.consoleManager = new ConsoleManager(true);
+    }
+
+    @Override
+    public boolean performFinish() {
+        IWizardContainer container = getContainer();
+        try {
+            container.run(true, false, new IRunnableWithProgress() {
+                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+                    // String selectedDeviceName =
+                    monitor.beginTask("Build", 4);
+                    String optionName = RtosBuildWizardDialog.getSelectionOptionName();
+                    consoleManager.println("Build Option : " + optionName);
+                    monitor.worked(1);
+
+                    RtosCommandManager.runBuild(optionName, consoleManager, monitor);
+                    monitor.done();
+                }
+            });
+        } catch (InvocationTargetException e) {
+            logger.error(e.getMessage(), e);
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return true;
+    }
+
+    @Override
+    public void addPages() {
+        rtosDialogPage = new RtosBuildDialogPage(GUIDE_DIALOG_NAME, shell);
+        addPage(rtosDialogPage);
+        WizardDialog dialog = (WizardDialog) getContainer();
+        dialog.addPageChangedListener(this);
+    }
+
+    @Override
+    public void pageChanged(PageChangedEvent arg0) {
+
+    }
+
+    @Override
+    public boolean canFinish() {
+        return true;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/build/RtosBuildWizardDialog.java b/rtosIDE/src/org/tizen/rt/ide/build/RtosBuildWizardDialog.java
new file mode 100644 (file)
index 0000000..cf4ad18
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.build;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.rt.ide.util.OSChecker;
+
+/**
+ * RtosBuildWizardDialog
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class RtosBuildWizardDialog extends WizardDialog {
+    private Composite parent;
+    private int x = 0;
+    private int y = 0;
+    private final int width = OSChecker.isWindows() ? 485 : 555;
+    private final int height = 450;
+    public static String selectionOptionName = "";
+    private Shell shell;
+    private Button make;
+    private Button cancel;
+
+    public RtosBuildWizardDialog(Shell parentShell, IWizard newWizard) {
+        super(parentShell, newWizard);
+        Rectangle bounds = null;
+        bounds = parentShell.getBounds();
+        setbounds(bounds);
+        setShellStyle(SWT.MODELESS | SWT.TITLE | SWT.CLOSE);
+
+    }
+
+    public void setbounds(Rectangle bounds) {
+        this.x = bounds.x + (bounds.width - width) / 2;
+        this.y = bounds.y + (bounds.height - height) / 2;
+    }
+
+    public static void selectionOptionName(String selctionOptionName) {
+        selectionOptionName = selctionOptionName;
+    }
+
+    public static String getSelectionOptionName() {
+        return selectionOptionName;
+    }
+
+    @Override
+    protected void configureShell(Shell newShell) {
+        super.configureShell(newShell);
+        this.shell = newShell;
+        newShell.setLocation(x, y);
+        newShell.setSize(width, height);
+    }
+
+    protected void PressedFinished() {
+        super.finishPressed();
+    }
+
+    // @Override
+    protected void createButtonsForButtonBar(Composite p) {
+        this.parent = p;
+        super.createButtonsForButtonBar(parent);
+
+        String LAUNCHER_LABEL = "Make";
+
+        // LAUNCHER_LABEL
+        make = getButton(IDialogConstants.FINISH_ID);
+        make.setText(LAUNCHER_LABEL);
+        make.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                // TODO: something to launch
+            }
+        });
+
+        setButtonLayoutData(make);
+        // cancel = getButton(IDialogConstants.CANCEL_ID);
+        // cancel.moveAbove(make);
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/console/ConsoleManager.java b/rtosIDE/src/org/tizen/rt/ide/console/ConsoleManager.java
new file mode 100644 (file)
index 0000000..57a817d
--- /dev/null
@@ -0,0 +1,259 @@
+/**
+ * Common
+ *
+ * @since 2017. 2. 9.
+ *
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Daeryong Park <bdragon.park@samsung.com>
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.rt.ide.console;
+
+import java.io.IOException;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.tizen.rt.ide.ResourceManager;
+
+public class ConsoleManager {
+
+    private static final String CONSOLE_NAME = "TizenRT Console";
+
+    private IConsoleManager consoleManager;
+    private String consoleName;
+    private boolean consoleFocus;
+    private MessageConsole console;
+    private Display display = Display.getDefault();
+    private MessageConsoleStream colorConsoleStream;
+
+    /**
+     * Constructs a new console manager.
+     * @param focus - true if focus on console, false if not
+     */
+    public ConsoleManager(boolean focus) {
+        this(CONSOLE_NAME, focus);
+    }
+
+    /**
+     * Constructs a new console manager.
+     * @param consoleName - the key title
+     * @param focus - true if focus on console, false if not
+     */
+    public ConsoleManager(String consoleName, boolean focus) {
+        this.consoleName = consoleName;
+        this.consoleFocus = focus;
+        this.consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+        this.console = getMessageConsole();
+    }
+
+    private MessageConsole getMessageConsole() {
+        boolean found = false;
+
+        IConsole[] consoles = consoleManager.getConsoles();
+        for (int i = 0; i < consoles.length; i++) {
+            if (this.consoleName.equals(consoles[i].getName())) {
+                console = (MessageConsole) consoles[i];
+                consoleManager.removeConsoles(new IConsole[] { console });
+                // found = true;
+                break;
+            }
+        }
+
+        if (!found) {
+            console = new MessageConsole(this.consoleName, null);
+            consoleManager.addConsoles(new IConsole[] { console });
+        }
+
+        if (this.consoleFocus) {
+            showConsoleView();
+        }
+
+        return console;
+    }
+
+    public IConsole getConsole() {
+        return console;
+    }
+
+    public void showConsoleView() {
+        consoleManager.showConsoleView(console);
+    }
+
+    /**
+     * Remove a MessageConsole instance specified key title from list, if it is present
+     * @param sessionId - a key title
+     */
+    public void removeConsole() {
+        MessageConsole console = null;
+
+        IConsole[] consoles = consoleManager.getConsoles();
+        for (int i = 0; i < consoles.length; i++) {
+            if (this.consoleName.equals(consoles[i].getName())) {
+                console = (MessageConsole) consoles[i];
+                consoleManager.removeConsoles(new IConsole[] { console });
+                break;
+            }
+        }
+    }
+
+    /**
+     * Get the output stream of the MessageConsole
+     * @return the MessageConsoleStream connected to MessageConsole
+     */
+    public MessageConsoleStream getMessageConsoleStream() {
+        return this.console.newMessageStream();
+    }
+
+    /**
+     * @param line String to display on console with no line feed
+     */
+    public void print(String line) {
+        MessageConsoleStream output = this.console.newMessageStream();
+        output.print(line);
+        try {
+            output.close();
+        } catch (IOException e) {
+            ConsolePlugin.log(e);
+        }
+    }
+
+    /**
+     * @param line String to display on console with line feed
+     */
+    public void println(String line) {
+        MessageConsoleStream output = this.console.newMessageStream();
+        output.println(line);
+        try {
+            output.close();
+        } catch (IOException e) {
+            ConsolePlugin.log(e);
+        }
+    }
+
+    /**
+     * @param fontStyle font style. Use {@link SWT#NORMAL}, {@link SWT#BOLD}, {@link SWT#ITALIC}
+     * @param color Use like {@link ResourceManager#RED}
+     */
+    private void setStringStyle(int fontStyle, Color color) {
+        // font setting
+        colorConsoleStream.setFontStyle(fontStyle);
+
+        // color setting
+        colorConsoleStream.setColor(color);
+    }
+
+    /**
+     * @param line String to display on console with no line feed
+     * @param fontStyle font style. Use {@link SWT#NORMAL}, {@link SWT#BOLD}, {@link SWT#ITALIC}
+     * @param color Use like {@link ResourceManager#RED}
+     */
+    public void print(String line, int fontStyle, Color color) {
+        colorConsoleStream = console.newMessageStream();
+        display.syncExec(new ConsoleSettingThread(fontStyle, color));
+
+        colorConsoleStream.print(line);
+        try {
+            colorConsoleStream.close();
+        } catch (IOException e) {
+            ConsolePlugin.log(e);
+        }
+    }
+
+    /**
+     * @param line String to display on console with line feed
+     * @param fontStyle font style. Use {@link SWT#NORMAL}, {@link SWT#BOLD}, {@link SWT#ITALIC}
+     * @param color Use like {@link ResourceManager#RED}
+     */
+    public void println(String line, int fontStyle, Color color) {
+        colorConsoleStream = console.newMessageStream();
+        display.syncExec(new ConsoleSettingThread(fontStyle, color));
+
+        colorConsoleStream.println(line);
+        try {
+            colorConsoleStream.close();
+        } catch (IOException e) {
+            ConsolePlugin.log(e);
+        }
+    }
+
+    /**
+     * Clear Console
+     */
+    public void clear() {
+        Runnable runnable = new Runnable() {
+            public void run() {
+                IDocument document = console.getDocument();
+                if (document != null) {
+                    document.set("");
+                }
+            }
+        };
+        Display.getDefault().syncExec(runnable);
+    }
+
+    /**
+     * Show Console View on top
+     */
+    public void show() {
+        Runnable runnable = new Runnable() {
+            public void run() {
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                String id = IConsoleConstants.ID_CONSOLE_VIEW;
+                IConsoleView view = null;
+                try {
+                    view = (IConsoleView) page.showView(id);
+                    view.display(getConsole());
+                } catch (PartInitException e) {
+                    ConsolePlugin.log(e);
+                }
+            }
+        };
+        Display.getDefault().syncExec(runnable);
+    }
+
+    // setting thread.
+    class ConsoleSettingThread extends Thread {
+        // console text setting value
+        private int fontStyle;
+        private Color color;
+
+        ConsoleSettingThread(int fontStyle, Color color) {
+            this.fontStyle = fontStyle;
+            this.color = color;
+        }
+
+        public void run() {
+            setStringStyle(this.fontStyle, this.color);
+        }
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/flash/FlashBuilder.java b/rtosIDE/src/org/tizen/rt/ide/flash/FlashBuilder.java
new file mode 100644 (file)
index 0000000..aa3541a
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.flash;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.build.RtosBuildWizard;
+import org.tizen.rt.ide.build.RtosBuildWizardDialog;
+import org.tizen.rt.ide.util.Util;
+
+public class FlashBuilder {
+    // private Logger logger = LoggerFactory.getLogger(Builder.class);
+
+    public FlashBuilder() {
+
+    }
+
+    /**
+     * RTOS build Wizard
+     * @return true Success of open dialog, otherwise false
+     */
+    public boolean openFlashWizard() {
+        RtosFlashWizard rtosWizard = new RtosFlashWizard(Util.getWorkbenchWindow().getShell());
+        RtosFlashWizardDialog rtosWizardDialog = new RtosFlashWizardDialog(Util
+                .getWorkbenchWindow().getShell(), rtosWizard);
+
+        rtosWizardDialog.setHelpAvailable(true);
+        rtosWizardDialog.create();
+        int result = rtosWizardDialog.open();
+
+        if (result == Dialog.OK) {
+            return true;
+        } else {
+            // logger.error("failed to open BuildWizard ");
+        }
+        return false;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/flash/FlashOption.java b/rtosIDE/src/org/tizen/rt/ide/flash/FlashOption.java
new file mode 100644 (file)
index 0000000..04ccd47
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.flash;
+
+/**
+ * FlashOption
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class FlashOption {
+    private final String flashOption;
+
+    public FlashOption(String flashOption) {
+        this.flashOption = flashOption;
+    }
+
+    public String getFlashOption() {
+        return flashOption;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashDialogPage.java b/rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashDialogPage.java
new file mode 100644 (file)
index 0000000..326aa2a
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.flash;
+
+import java.util.ArrayList;
+
+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;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+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.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+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;
+
+/**
+ * RtosFlashDialogPage
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class RtosFlashDialogPage extends WizardPage {
+
+    private Shell shell;
+    private Table table;
+    public TableViewer tableViewer;
+
+    protected RtosFlashDialogPage(String pageName, Shell shell) {
+        super(pageName);
+        this.shell = shell;
+        setTitle("Flash Project");
+        setDescription("Selection of Flash option page");
+        setErrorMessage(null);
+    }
+
+    @Override
+    public void performHelp() {
+
+    }
+
+    @Override
+    public void createControl(Composite parentComposite) {
+
+        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);
+
+        tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
+        tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+            public void selectionChanged(SelectionChangedEvent event) {
+                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+                for (Object o : selection.toArray()) {
+                    FlashOption bOption = (FlashOption) o;
+                    RtosFlashWizardDialog.selectionOptionName(bOption.getFlashOption());
+                }
+
+            }
+        });
+
+        table = tableViewer.getTable();
+        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("Flash 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);
+
+        tableViewer.setLabelProvider(new TableViewerProvider());
+        tableViewer.setContentProvider(new ArrayContentProvider());
+        tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+            @Override
+            public void doubleClick(DoubleClickEvent arg0) {
+                RtosFlashWizard wizard = (RtosFlashWizard) getWizard();
+                RtosFlashWizardDialog dialog = (RtosFlashWizardDialog) wizard.getContainer();
+                dialog.PressedFinished();
+            }
+
+        });
+
+        // get divice list & extract Device Entry detailList From XML
+        RtosCommandManager rtosCommandMAnager = RtosCommandManager.getDeviceEntryManager();
+        ArrayList<FlashOption> testList = rtosCommandMAnager.getFlashOptions();
+
+        RtosFlashWizard wizard = (RtosFlashWizard) getWizard();
+        RtosFlashWizardDialog dialog = (RtosFlashWizardDialog) wizard.getContainer();
+        if (testList.size() != 0) {
+            // set HighlightEntryList
+            rtosCommandMAnager.setHighlightListener(shell, table);
+
+            // input buildOption list
+            tableViewer.setInput(testList);
+
+            Object element = tableViewer.getElementAt(0);
+            // set Highlighting specific item with latestBuildOptionInfo.
+            tableViewer.setSelection(new StructuredSelection(element), true);
+
+            // set default buildOption
+            RtosFlashWizardDialog.selectionOptionName(((FlashOption) element).getFlashOption());
+
+            wizard.canFinish();
+        } else {
+            wizard.canFinish();
+            setDescription("There is no Option");
+        }
+
+        setHelpContextIDs(parentComposite);
+        setControl(parentComposite);
+
+    }
+
+    private void setHelpContextIDs(Composite composite) {
+        // second parameter : packagename.ID_Of_contexts.xml
+        PlatformUI.getWorkbench().getHelpSystem()
+                .setHelp(composite, "org.tizen.nativecommon.AutomationEmulatorWizard");
+    }
+
+    public void setDefaultDescription() {
+        setDescription("Selection of build option page");
+    }
+
+    private class TableViewerProvider extends LabelProvider implements ITableLabelProvider {
+
+        @Override
+        public Image getColumnImage(Object arg0, int columnIndex) {
+            return null;
+        }
+
+        @Override
+        public String getColumnText(Object element, int columnIndex) {
+            // TODO: create object in associated with Device EntryList
+            if (element instanceof FlashOption) {
+                FlashOption bOption = (FlashOption) element;
+                switch (columnIndex) {
+                case 0:
+                    return bOption.getFlashOption();
+                default:
+                    break;
+                }
+            }
+            return null;
+        }
+
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashWizard.java b/rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashWizard.java
new file mode 100644 (file)
index 0000000..285f387
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.flash;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.RtosCommandManager;
+import org.tizen.rt.ide.console.ConsoleManager;
+
+/**
+ * RtosFlashWizard
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class RtosFlashWizard extends Wizard implements IPageChangedListener {
+
+    private ConsoleManager consoleManager;
+    private Shell shell;
+    private final String GUIDE_DIALOG_NAME = "Flash Option Selection";
+    private RtosFlashDialogPage rtosDialogPage = null;
+    private final Logger logger = LoggerFactory.getLogger(RtosFlashWizard.class);
+
+    public RtosFlashWizard(Shell shell) {
+        super();
+        this.setWindowTitle("Rtos Flash Wizard");
+        this.setNeedsProgressMonitor(true);
+        this.shell = shell;
+        this.consoleManager = new ConsoleManager(true);
+    }
+
+    @Override
+    public boolean performFinish() {
+        IWizardContainer container = getContainer();
+        try {
+            container.run(true, false, new IRunnableWithProgress() {
+                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+                    // String selectedDeviceName =
+                    monitor.beginTask("Build", 4);
+                    String optionName = RtosFlashWizardDialog.getSelectionOptionName();
+                    consoleManager.println(optionName);
+                    monitor.worked(1);
+
+                    RtosCommandManager.runFlash(optionName, consoleManager, monitor);
+                    monitor.done();
+                }
+            });
+        } catch (InvocationTargetException e) {
+            logger.error(e.getMessage(), e);
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return true;
+    }
+
+    @Override
+    public void addPages() {
+        rtosDialogPage = new RtosFlashDialogPage(GUIDE_DIALOG_NAME, shell);
+        addPage(rtosDialogPage);
+        WizardDialog dialog = (WizardDialog) getContainer();
+        dialog.addPageChangedListener(this);
+    }
+
+    @Override
+    public void pageChanged(PageChangedEvent arg0) {
+
+    }
+
+    @Override
+    public boolean canFinish() {
+        return true;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashWizardDialog.java b/rtosIDE/src/org/tizen/rt/ide/flash/RtosFlashWizardDialog.java
new file mode 100644 (file)
index 0000000..9dd9a12
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* jm.jemin.kim <jm.jemin.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.flash;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.rt.ide.util.OSChecker;
+
+/**
+ * RtosFlashWizardDialog
+ * @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
+ */
+public class RtosFlashWizardDialog extends WizardDialog {
+    private Composite parent;
+    private int x = 0;
+    private int y = 0;
+    private final int width = OSChecker.isWindows() ? 485 : 555;
+    private final int height = 450;
+    public static String selectionOptionName = "";
+    private Shell shell;
+    private Button make;
+    private Button cancel;
+
+    public RtosFlashWizardDialog(Shell parentShell, IWizard newWizard) {
+        super(parentShell, newWizard);
+        Rectangle bounds = null;
+        bounds = parentShell.getBounds();
+        setbounds(bounds);
+        setShellStyle(SWT.MODELESS | SWT.TITLE | SWT.CLOSE);
+
+    }
+
+    public void setbounds(Rectangle bounds) {
+        this.x = bounds.x + (bounds.width - width) / 2;
+        this.y = bounds.y + (bounds.height - height) / 2;
+    }
+
+    public static void selectionOptionName(String selctionOptionName) {
+        selectionOptionName = selctionOptionName;
+    }
+
+    public static String getSelectionOptionName() {
+        return selectionOptionName;
+    }
+
+    @Override
+    protected void configureShell(Shell newShell) {
+        super.configureShell(newShell);
+        this.shell = newShell;
+        newShell.setLocation(x, y);
+        newShell.setSize(width, height);
+    }
+
+    protected void PressedFinished() {
+        super.finishPressed();
+    }
+
+    // @Override
+    protected void createButtonsForButtonBar(Composite p) {
+        this.parent = p;
+        super.createButtonsForButtonBar(parent);
+
+        String LAUNCHER_LABEL = "Flash";
+
+        // LAUNCHER_LABEL
+        make = getButton(IDialogConstants.FINISH_ID);
+        make.setText(LAUNCHER_LABEL);
+        make.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                // TODO: something to launch
+            }
+        });
+
+        setButtonLayoutData(make);
+        // cancel = getButton(IDialogConstants.CANCEL_ID);
+        // cancel.moveAbove(make);
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/handlers/BuildHandler.java b/rtosIDE/src/org/tizen/rt/ide/handlers/BuildHandler.java
new file mode 100644 (file)
index 0000000..342fbfa
--- /dev/null
@@ -0,0 +1,42 @@
+package org.tizen.rt.ide.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.tizen.rt.ide.build.BuildBuilder;
+import org.tizen.rt.ide.util.Util;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class BuildHandler extends AbstractHandler {
+
+    // private final Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+
+        Util.syncExec(new Runnable() {
+            @Override
+            public void run() {
+                // condition : rtos project or artik project
+
+                BuildBuilder rtosBuilder = new BuildBuilder();
+                boolean result = rtosBuilder.openBuildWizard();
+                if (result) {
+                    // logger.info("succeed to open rtos Builder Wizard");
+                } else {
+                    // logger.warn("fail to open rtos Builder Wizard");
+                    return;
+                }
+            }
+        });
+
+        return null;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/handlers/FlashHandler.java b/rtosIDE/src/org/tizen/rt/ide/handlers/FlashHandler.java
new file mode 100644 (file)
index 0000000..5f8beb0
--- /dev/null
@@ -0,0 +1,42 @@
+package org.tizen.rt.ide.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.tizen.rt.ide.flash.FlashBuilder;
+import org.tizen.rt.ide.util.Util;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class FlashHandler extends AbstractHandler {
+
+    // private final Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+
+        Util.syncExec(new Runnable() {
+            @Override
+            public void run() {
+                // condition : rtos project or artik project
+
+                FlashBuilder rtosBuilder = new FlashBuilder();
+                boolean result = rtosBuilder.openFlashWizard();
+                if (result) {
+                    // logger.info("succeed to open rtos Builder Wizard");
+                } else {
+                    // logger.warn("fail to open rtos Builder Wizard");
+                    return;
+                }
+            }
+        });
+
+        return null;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/handlers/TerminalHandler.java b/rtosIDE/src/org/tizen/rt/ide/handlers/TerminalHandler.java
new file mode 100644 (file)
index 0000000..dc20564
--- /dev/null
@@ -0,0 +1,100 @@
+package org.tizen.rt.ide.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
+import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
+import org.eclipse.tm.terminal.view.ui.interfaces.ITerminalsView;
+import org.eclipse.tm.terminal.view.ui.view.TerminalsView;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class TerminalHandler extends AbstractHandler {
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+        // MessageDialog.openInformation(
+        // window.getShell(),
+        // "Artik-common",
+        // "Hello, Eclipse world");
+
+        IEditorPart editorPart = window.getActivePage().getActiveEditor();
+
+        if (editorPart != null) {
+            IFileEditorInput input = (IFileEditorInput) editorPart.getEditorInput();
+            IFile file = input.getFile();
+            IProject activeProject = file.getProject();
+            String activeProjectName = activeProject.getLocation().toString();
+
+            MessageDialog.openInformation(window.getShell(), "Artik-common",
+                    activeProjectName);
+        } 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();
+                        String activeProjectName = activeProject.getLocation().toString();
+
+                        MessageDialog.openInformation(window.getShell(), "Artik-common",
+                                activeProjectName);
+                    }
+                }
+            }
+        }
+
+        IWorkbenchPart newTerminalView;
+        newTerminalView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
+        // .showView("org.eclipse.tm.terminal.view.TerminalView");
+        if (newTerminalView instanceof ITerminalsView) {
+            // Get the tab folder
+            CTabFolder tabFolder = (CTabFolder) ((TerminalsView) newTerminalView).getAdapter(CTabFolder.class);
+            if (tabFolder != null && !tabFolder.isDisposed()) {
+                // Get the list of tab items
+                CTabItem[] items = tabFolder.getItems();
+                // Loop the tab items and find the still connected ones
+                for (CTabItem item : items) {
+                    // Ignore disposed items
+                    if (item.isDisposed())
+                        continue;
+                    // Get the terminal view control
+                    ITerminalViewControl terminal = (ITerminalViewControl) item.getData();
+                    if (terminal == null || terminal.getState() != TerminalState.CONNECTED) {
+                        continue;
+                    }
+
+                    // Still connected -> Add to the list
+                    terminal.sendKey('h');
+                    terminal.sendKey('e');
+                    terminal.sendKey('l');
+                    terminal.sendKey('p');
+                    terminal.sendKey('\n');
+                }
+            }
+        }
+
+        return null;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/log4j.properties b/rtosIDE/src/org/tizen/rt/ide/log4j.properties
new file mode 100644 (file)
index 0000000..8f2e9cb
--- /dev/null
@@ -0,0 +1,9 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=DEBUG, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=[%d{yyyy.MM.dd HH:mm:ss}][%-5p] %F(%L) - %m%n
diff --git a/rtosIDE/src/org/tizen/rt/ide/messages.properties b/rtosIDE/src/org/tizen/rt/ide/messages.properties
new file mode 100644 (file)
index 0000000..fc5304d
--- /dev/null
@@ -0,0 +1,15 @@
+NewArtikProjectMainWizard_window_title=Create TizenRT Project
+
+NewArtikProjectMainPage_title=New TizenRT Project
+NewArtikProjectMainPage_desc=Select TizenRT Project Source
+NewArtikProjectMainPage_local_button_text=Create New TizenRT Project
+NewArtikProjectMainPage_git_button_text=Create TizenRT Project from Git
+
+NewArtikProjectWizard_create_op_label=Create new TizenRT project
+NewArtikProjectWizard_window_title=New TizenRT Project
+
+NewArtikProjectWizardPage_desc=New TizenRT Project
+NewArtikProjectWizardPage_title=New TizenRT Project
+
+NewArtikProjectWizardPage2_desc=Multi-page Editor File
+NewArtikProjectWizardPage2_title=This wizard creates a new file with *.defs extension that can be opened by a multi-page editor.
diff --git a/rtosIDE/src/org/tizen/rt/ide/perspectives/TizenRTPerspective.java b/rtosIDE/src/org/tizen/rt/ide/perspectives/TizenRTPerspective.java
new file mode 100644 (file)
index 0000000..08b97f0
--- /dev/null
@@ -0,0 +1,99 @@
+package org.tizen.rt.ide.perspectives;
+
+import org.eclipse.tm.terminal.view.ui.interfaces.IUIConstants;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.console.IConsoleConstants;
+
+/**
+ * This class is meant to serve as an example for how various contributions are made to a perspective. Note that some of the extension point id's are referred to as API constants while others are
+ * hardcoded and may be subject to change.
+ */
+public class TizenRTPerspective implements IPerspectiveFactory {
+
+    private IPageLayout factory;
+
+    public TizenRTPerspective() {
+        super();
+    }
+
+    public void createInitialLayout(IPageLayout factory) {
+        this.factory = factory;
+        addViews();
+        addActionSets();
+        addNewWizardShortcuts();
+        addPerspectiveShortcuts();
+        addViewShortcuts();
+    }
+
+    private void addViews() {
+        // Creates the overall folder layout.
+        // Note that each new Folder uses a percentage of the remaining EditorArea.
+
+        IFolderLayout bottom = factory.createFolder(
+                "bottomRight", // NON-NLS-1
+                IPageLayout.BOTTOM,
+                0.75f,
+                factory.getEditorArea());
+        // bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
+        bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);
+        bottom.addView("org.eclipse.tm.terminal.view.ui.TerminalsView");
+        bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
+
+        IFolderLayout topLeft = factory.createFolder(
+                "topLeft", // NON-NLS-1
+                IPageLayout.LEFT,
+                0.25f,
+                factory.getEditorArea());
+        // topLeft.addView(IPageLayout.ID_RES_NAV);
+        topLeft.addView("org.tizen.rt.viewer.navigator");
+        // topLeft.addView("org.eclipse.jdt.junit.ResultView"); //NON-NLS-1
+
+        // factory.addFastView("org.eclipse.team.ccvs.ui.RepositoriesView",0.50f); //NON-NLS-1
+        // factory.addFastView("org.eclipse.team.sync.views.SynchronizeView", 0.50f); //NON-NLS-1
+    }
+
+    private void addActionSets() {
+        // factory.addActionSet("org.eclipse.debug.ui.launchActionSet"); //NON-NLS-1
+        // factory.addActionSet("org.eclipse.debug.ui.debugActionSet"); //NON-NLS-1
+        // factory.addActionSet("org.eclipse.debug.ui.profileActionSet"); //NON-NLS-1
+        // factory.addActionSet("org.eclipse.jdt.debug.ui.JDTDebugActionSet"); //NON-NLS-1
+        // factory.addActionSet("org.eclipse.jdt.junit.JUnitActionSet"); //NON-NLS-1
+        // factory.addActionSet("org.eclipse.team.ui.actionSet"); //NON-NLS-1
+        // factory.addActionSet("org.eclipse.team.cvs.ui.CVSActionSet"); //NON-NLS-1
+        // factory.addActionSet("org.eclipse.ant.ui.actionSet.presentation"); //NON-NLS-1
+        // factory.addActionSet(JavaUI.ID_ACTION_SET);
+        // factory.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
+        factory.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); // NON-NLS-1
+    }
+
+    private void addPerspectiveShortcuts() {
+        // factory.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); //NON-NLS-1
+        // factory.addPerspectiveShortcut("org.eclipse.team.cvs.ui.cvsPerspective"); //NON-NLS-1
+        // factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //NON-NLS-1
+    }
+
+    private void addNewWizardShortcuts() {
+        factory.addNewWizardShortcut("org.tizen.rt.LocalProject");
+        factory.addNewWizardShortcut("org.tizen.rt.GitProject");
+        // factory.addNewWizardShortcut("org.eclipse.team.cvs.ui.newProjectCheckout");//NON-NLS-1
+        factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");// NON-NLS-1
+        factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");// NON-NLS-1
+    }
+
+    private void addViewShortcuts() {
+        // factory.addShowViewShortcut("org.eclipse.ant.ui.views.AntView"); //NON-NLS-1
+        // factory.addShowViewShortcut("org.eclipse.team.ccvs.ui.AnnotateView"); //NON-NLS-1
+        // factory.addShowViewShortcut("org.eclipse.pde.ui.DependenciesView"); //NON-NLS-1
+        // factory.addShowViewShortcut("org.eclipse.jdt.junit.ResultView"); //NON-NLS-1
+        // factory.addShowViewShortcut("org.eclipse.team.ui.GenericHistoryView"); //NON-NLS-1
+        factory.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
+        // factory.addShowViewShortcut(JavaUI.ID_PACKAGES);
+        // factory.addShowViewShortcut(IPageLayout.ID_RES_NAV);
+        // factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+        // factory.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+        factory.addShowViewShortcut(IUIConstants.ID); // TM Terminal View ID
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/util/IReporter.java b/rtosIDE/src/org/tizen/rt/ide/util/IReporter.java
new file mode 100644 (file)
index 0000000..f40ff2b
--- /dev/null
@@ -0,0 +1,7 @@
+package org.tizen.rt.ide.util;
+
+public interface IReporter {
+    public void info(String msg);
+
+    public void error(String msg);
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/util/OSChecker.java b/rtosIDE/src/org/tizen/rt/ide/util/OSChecker.java
new file mode 100644 (file)
index 0000000..59e85e2
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Kangho Kim <kh5325.kim@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.rt.ide.util;
+
+/**
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ * @author Gyeongseok Seo {@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ *         <ul>
+ *         <li>initial creation
+ *         <li>thanks to Yoon Kyung Koo
+ *         </ul>
+ */
+public class OSChecker {
+    //
+    // OS ID constants
+    //
+    public final static int WINDOWS = 0x0100;
+    public final static int MAC = 0x0200;
+    public final static int LINUX = 0x0400;
+    public final static int UNIX = 0x0800;
+    public final static int AIX = 0x1000;
+    public final static int SOLARIS = 0x2000;
+
+    //
+    // Vendor constants
+    //
+    public final static int SUN = 0x0001;
+    public final static int MICROSOFT = 0x0002;
+    public final static int APPLE = 0x0004;
+    public final static int IBM = 0x0008;
+
+    static int osID = 0;
+    static int vendorID = 0;
+
+    /* static initializer */
+    static {
+        /*
+         * OS                : arch      name         version
+         * solaris 7         : sparc     Solaris      2.x
+         * redhat 6.2(black) : x86       Linux        2.2.15-2.5.0
+         * redhat 6.2(ibm)   : i686      Linux        #1 Sat Feb 5 00:28:02 EST 2000.2.2.15-2.5.0
+         * win2000(jdk1.1.8) : x86       Windows NT   5.0
+         * win2000(jdk1.2.2) : x86       Windows NT   5.0       
+         * win2000(jdk1.3)   : x86       Windows 2000 5.0
+         * Mac OS 9          : PowerPC   Mac OS       9
+         * AIX 5.1           : ppc       AIX          5.1 (vendor : IBM Corporation)
+         */
+        osID = 0;
+        String osName = System.getProperty("os.name").toUpperCase();
+
+        if (osName.indexOf("WINDOWS") >= 0) {
+            osID |= OSChecker.WINDOWS;
+        } else if (osName.indexOf("MAC") >= 0) {
+            osID |= OSChecker.MAC;
+        } else if (osName.indexOf("LINUX") >= 0) {
+            osID |= OSChecker.LINUX;
+        } else if (osName.indexOf("AIX") >= 0) {
+            osID |= OSChecker.AIX;
+            osID |= OSChecker.UNIX;
+        } else if (osName.indexOf("SOLARIS") >= 0) {
+            osID |= OSChecker.SOLARIS;
+            osID |= OSChecker.UNIX;
+        }
+
+        vendorID = 0;
+        String vendorName = System.getProperty("java.vendor").toUpperCase();
+
+        if (vendorName.indexOf("IBM") >= 0) {
+            vendorID |= OSChecker.IBM;
+        } else if (vendorName.indexOf("MICROSOFT") >= 0) {
+            vendorID |= OSChecker.MICROSOFT;
+        } else if (vendorName.indexOf("APPLE") >= 0) {
+            vendorID |= OSChecker.APPLE;
+        } else if (vendorName.indexOf("SUN") >= 0) {
+            // should check if the vendor is sun in last place
+            // 'cause other vendor can port Sun's VM
+            vendorID |= OSChecker.SUN;
+        }
+    }
+
+    /* querying OS */
+    public static int getOSID() {
+        return osID;
+    }
+
+    public static boolean isWindows() {
+        return ((osID & OSChecker.WINDOWS) > 0);
+    }
+
+    public static boolean isMAC() {
+        return ((osID & OSChecker.MAC) > 0);
+    }
+
+    public static boolean isLinux() {
+        return ((osID & OSChecker.LINUX) > 0);
+    }
+
+    public static boolean isAIX() {
+        return ((osID & OSChecker.AIX) > 0);
+    }
+
+    public static boolean isSolaris() {
+        return ((osID & OSChecker.SOLARIS) > 0);
+    }
+
+    public static boolean isUnix() {
+        return ((osID & OSChecker.UNIX) > 0);
+    }
+
+    public static boolean isUnknownOS() {
+        return (osID == 0);
+    }
+
+    /* querying Vendor */
+    public static int getVendorID() {
+        return vendorID;
+    }
+
+    public static boolean byMicrosoft() {
+        return ((vendorID & OSChecker.MICROSOFT) > 0);
+    }
+
+    public static boolean byIBM() {
+        return ((vendorID & OSChecker.IBM) > 0);
+    }
+
+    public static boolean byApple() {
+        return ((vendorID & OSChecker.APPLE) > 0);
+    }
+
+    public static boolean bySun() {
+        return ((vendorID & OSChecker.SUN) > 0);
+    }
+
+    public static boolean byUnknownVendor() {
+        return (vendorID == 0);
+    }
+
+    /* querying arch */
+    public static boolean is64bit() {
+        boolean is64bit = false;
+        if (OSChecker.isWindows()) {
+            is64bit = (System.getenv("ProgramFiles(x86)") != null);
+        } else {
+            is64bit = (System.getProperty("os.arch").indexOf("64") != -1);
+        }
+        return is64bit;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/util/ProcUtil.java b/rtosIDE/src/org/tizen/rt/ide/util/ProcUtil.java
new file mode 100644 (file)
index 0000000..8d8130e
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunsik Noh <hyunsik.noh@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.rt.ide.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.console.ConsoleManager;
+
+public class ProcUtil {
+
+    protected static final Logger logger = LoggerFactory.getLogger(ProcUtil.class);
+
+    private static final String SHELL_COMMAND_LINUX = "/bin/sh"; //$NON-NLS-1$
+    private static final String SHELL_COMMAND_MINGW = "sh"; //$NON-NLS-1$
+    private static final String SHELL_COMMAND_LINUX_PARAM = "-c"; //$NON-NLS-1$
+    private static final String SHELL_COMMAND_WINDOW = "cmd"; //$NON-NLS-1$
+    private static final String SHELL_COMMAND_WINDOW_PARAM = "/c"; //$NON-NLS-1$
+
+    private static final String SHELL_WIN_PATH_NAME = "Path"; //$NON-NLS-1$
+    private static final int CMDLINEMAX = 65535;
+
+    public static String[] getCommand(String commands[], boolean isLinux) {
+        String[] fullCommand;
+
+        if (OSChecker.isWindows()) {
+            if (isLinux) {
+                fullCommand = new String[6 + commands.length];
+                fullCommand[0] = SHELL_COMMAND_WINDOW;
+                fullCommand[1] = SHELL_COMMAND_WINDOW_PARAM;
+                fullCommand[2] = "\"";
+                fullCommand[3] = SHELL_COMMAND_MINGW;
+                fullCommand[4] = SHELL_COMMAND_LINUX_PARAM;
+                System.arraycopy(commands, 0, fullCommand, 5, commands.length);
+                int idx = 5 + commands.length;
+                fullCommand[idx] = "\"";
+            } else {
+                fullCommand = new String[2 + commands.length];
+                fullCommand[0] = SHELL_COMMAND_WINDOW;
+                fullCommand[1] = SHELL_COMMAND_WINDOW_PARAM;
+                System.arraycopy(commands, 0, fullCommand, 2, commands.length);
+            }
+        } else {
+            fullCommand = new String[2 + 1];
+            fullCommand[0] = SHELL_COMMAND_LINUX;
+            fullCommand[1] = SHELL_COMMAND_LINUX_PARAM;
+            // System.arraycopy(commands, 0, fullCommand, 2, commands.length);
+            String st = "";
+            for (String cmd : commands) {
+                if (!st.isEmpty()) {
+                    st += " ";
+                }
+                st += cmd;
+            }
+            fullCommand[2] = st;
+        }
+
+        return fullCommand;
+    }
+
+    public static String[] getMinGWCommand(String command) {
+        return new String[] { SHELL_COMMAND_WINDOW, SHELL_COMMAND_WINDOW_PARAM, SHELL_COMMAND_MINGW,
+                SHELL_COMMAND_LINUX_PARAM, "\"" + command + "\"" }; //$NON-NLS-1$
+    }
+
+    public static String[] getCommand(String command) {
+        if (OSChecker.isWindows()) {
+            return new String[] { SHELL_COMMAND_WINDOW, SHELL_COMMAND_WINDOW_PARAM, command };
+        } else {
+            return new String[] { SHELL_COMMAND_LINUX, SHELL_COMMAND_LINUX_PARAM, command };
+        }
+    }
+
+    public static ProcessBuilder genProcessBuilder(ProcessBuilder pb) {
+        if (pb == null) {
+            pb = new ProcessBuilder();
+        }
+
+        if (OSChecker.isWindows()) {
+            String curEnv = System.getenv(SHELL_WIN_PATH_NAME);
+            pb.environment().put(SHELL_WIN_PATH_NAME, curEnv);
+        }
+
+        return pb;
+    }
+
+    public static int executeProcess(ProcessBuilder pb, String[] cmds, String curDir, ConsoleManager consoleManager,
+            ArrayList<String> resultBuildExecute) {
+        String sbiTrace = "[SBI] command : ";
+        for (String c : cmds) {
+            sbiTrace += c + " ";
+        }
+        logger.info(sbiTrace);
+
+        pb = genProcessBuilder(pb);
+
+        cmds = getCommand(cmds, false);
+        pb.command(cmds);
+        pb.redirectErrorStream(true);
+        if (curDir != null) {
+            File curDirFile = new File(curDir);
+            if (curDirFile.exists()) {
+                pb.directory(curDirFile);
+            }
+        }
+
+        Process proc = null;
+        BufferedReader input = null;
+        try {
+            proc = pb.start();
+
+            InputStreamReader is;
+            if (OSChecker.isWindows()) {
+                is = new InputStreamReader(proc.getInputStream());
+            } else {
+                is = new InputStreamReader(proc.getInputStream());
+            }
+            input = new BufferedReader(is, CMDLINEMAX);
+            String line = null;
+            while ((line = input.readLine()) != null) {
+                consoleManager.println(line);
+                resultBuildExecute.add(line);
+            }
+
+            proc.waitFor();
+        } catch (IOException e) {
+            logger.error("IOException occurred:", e);
+            return -1;
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+            return -1;
+        } finally {
+            if (input != null) {
+                try {
+                    input.close();
+                } catch (IOException e) {
+                    logger.error(e.getMessage(), e);
+                }
+            }
+            // IOUtil.tryClose(input);
+            if (proc != null) {
+                proc.destroy();
+            }
+        }
+
+        return proc.exitValue();
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/util/Util.java b/rtosIDE/src/org/tizen/rt/ide/util/Util.java
new file mode 100644 (file)
index 0000000..34e8159
--- /dev/null
@@ -0,0 +1,61 @@
+package org.tizen.rt.ide.util;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+public class Util {
+
+    // **********************************************************************
+    // **********************************************************************
+    // CommonUtil : Display, syncExec
+
+    /**
+     * return {@link Display} in context return new {@link Display} if no {@link Display} in context
+     * @return SWT {@link Display} simply
+     * @see Display#getCurrent()
+     * @see Display#getDefault();
+     */
+    public static Display getDisplay() {
+        Display dp = Display.getCurrent();
+        if (null != dp) {
+            return dp;
+        }
+
+        return Display.getDefault();
+    }
+
+    /**
+     * execute {@link Runnable} in SWT thread synchronously
+     * @param runnable object to execute
+     */
+    public static void syncExec(final Runnable runnable) {
+        syncExec(getDisplay(), runnable);
+    }
+
+    /**
+     * execute {@link Runnable} in SWT thread synchronously
+     * @param dp SWT <code>Display</code>
+     * @param runnable object to execute
+     */
+    public static void syncExec(final Display dp, final Runnable runnable) {
+        dp.syncExec(runnable);
+    }
+
+    // **********************************************************************
+    // **********************************************************************
+    // ViewUtil : getWorkbenchWindow
+
+    public static IWorkbenchWindow getWorkbenchWindow() {
+        final IWorkbench workbench = PlatformUI.getWorkbench();
+        final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+        if (window != null) {
+            return window;
+        }
+        if (workbench.getWorkbenchWindowCount() == 0) {
+            return null;
+        }
+        return workbench.getWorkbenchWindows()[0];
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/util/XMLUtil.java b/rtosIDE/src/org/tizen/rt/ide/util/XMLUtil.java
new file mode 100644 (file)
index 0000000..2c64276
--- /dev/null
@@ -0,0 +1,519 @@
+/*
+ * XMLUtil
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Gyeongmin Ju <gyeongmin.ju@samsung.com>
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.rt.ide.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.SAXException;
+
+public class XMLUtil {
+
+    private static final Logger logger = LoggerFactory.getLogger(XMLUtil.class);
+
+    private static class UniversalNamespaceResolver implements NamespaceContext {
+        private Element sourceDocument;
+        private String nameSpace;
+
+        public UniversalNamespaceResolver(Element document, String nameSpace) {
+            sourceDocument = document;
+            this.nameSpace = nameSpace;
+        }
+
+        @Override
+        public String getNamespaceURI(String prefix) {
+            if (prefix == null) {
+                throw new IllegalArgumentException("No prefix provided!");
+            } else if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
+                if (nameSpace == null || nameSpace.isEmpty()) {
+                    // return sourceDocument.lookupNamespaceURI(null);
+                    return sourceDocument.getNamespaceURI();
+                } else {
+                    return nameSpace;
+                }
+            } else {
+                return sourceDocument.lookupNamespaceURI(prefix);
+            }
+        }
+
+        @Override
+        public String getPrefix(String namespaceURI) {
+            return sourceDocument.lookupPrefix(namespaceURI);
+        }
+
+        @SuppressWarnings("rawtypes")
+        @Override
+        public Iterator getPrefixes(String namespaceURI) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+    }
+
+    public static boolean existChildElement(Element parentElem) {
+        NodeList nodeList = parentElem.getChildNodes();
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            Node node = nodeList.item(i);
+            if (node instanceof Element) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean isEqualNode(Node a, Node b) {
+        String a_name = a.getNodeName();
+        String b_name = b.getNodeName();
+        if (a_name != null) {
+            if (!a_name.equals(b_name)) {
+                return false;
+            }
+        } else if (b_name != null) {
+            return false;
+        }
+
+        if (a.getAttributes().getLength() != b.getAttributes().getLength()) {
+            return false;
+        }
+
+        for (int i = 0; i < a.getAttributes().getLength(); i++) {
+            Node attrNode = a.getAttributes().item(i);
+            if (attrNode instanceof Attr) {
+                Node attrNode2 = b.getAttributes().getNamedItem(((Attr) attrNode).getName());
+                if (attrNode2 == null) {
+                    return false;
+                }
+                if (!((Attr) attrNode2).getValue().equals(((Attr) attrNode).getValue())) {
+                    return false;
+                }
+            }
+        }
+
+        if (a instanceof Element) {
+            if (!existChildElement((Element) a)) {
+                String a_text = a.getTextContent();
+                String b_text = b.getTextContent();
+                if (!a_text.equals(b_text)) {
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    private static void mergeChildNode(Document doc, Element desRoot, Element srcRoot) {
+        NodeList nodeList = srcRoot.getChildNodes();
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            Node node = nodeList.item(i);
+            if (node instanceof Element) {
+                boolean exist = false;
+                Node pos = null;
+                NodeList desNodeList = desRoot.getChildNodes();
+                for (int j = 0; j < desNodeList.getLength(); j++) {
+                    Node desNode = desNodeList.item(j);
+                    if (desNode != null && desNode.getNodeName().equals(node.getNodeName())) {
+                        if (isEqualNode(node, desNode)) {
+                            mergeChildNode(doc, (Element) desNode, (Element) node);
+                            exist = true;
+                            break;
+                        } else {
+                            pos = desNode;
+                        }
+                    }
+                }
+                if (!exist) {
+                    if (pos != null) {
+                        desRoot.insertBefore(doc.importNode(node, true), pos.getNextSibling());
+                    } else {
+                        desRoot.appendChild(doc.importNode(node, true));
+                    }
+                }
+            } else if (node instanceof Text) {
+                String text = node.getTextContent();
+                if (!text.trim().isEmpty()) {
+                    // System.out.println(text);
+                }
+            }
+        }
+    }
+
+    private static void removeWhitespace(Node parentNode) {
+        NodeList nodeList = parentNode.getChildNodes();
+        if (nodeList.getLength() <= 0)
+            return;
+
+        for (int i = nodeList.getLength() - 1; i >= 0; i--) {
+            Node node = nodeList.item(i);
+            if (node instanceof Element) {
+                removeWhitespace(node);
+            } else if (node instanceof Text) {
+                String text = node.getTextContent();
+                if (text.trim().isEmpty()) {
+                    parentNode.removeChild(node);
+                }
+            }
+        }
+    }
+
+    public static Document readXML(InputStream xmlStream, boolean whiteSpace) {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setIgnoringElementContentWhitespace(!whiteSpace);
+
+        DocumentBuilder builder;
+        try {
+            builder = factory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+
+        Document doc = null;
+        try {
+            doc = builder.parse(xmlStream);
+            if (!whiteSpace) {
+                removeWhitespace(doc.getDocumentElement());
+            }
+        } catch (SAXException e) {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e) {
+        }
+
+        return doc;
+    }
+
+    public static Document readXML(InputStream xmlStream) {
+        return readXML(xmlStream, false);
+    }
+
+    public static Document readXML(File xmlFile, boolean whiteSpace) {
+        Document doc = null;
+        try {
+            doc = readXML(new FileInputStream(xmlFile), whiteSpace);
+        } catch (FileNotFoundException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        return doc;
+    }
+
+    public static Document readXML(File xmlFile) {
+        return readXML(xmlFile, false);
+    }
+
+    public static Document mergeXML(List<File> listOfFiles) {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setIgnoringElementContentWhitespace(true);
+
+        DocumentBuilder builder;
+        try {
+            builder = factory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+
+        Document newDoc = null;
+
+        for (File listOfFile : listOfFiles) {
+            Document doc;
+            try {
+                doc = builder.parse(listOfFile);
+                removeWhitespace(doc.getDocumentElement());
+            } catch (SAXException e) {
+                logger.error(e.getMessage(), e);
+                continue;
+            } catch (IOException e) {
+                logger.error(e.getMessage(), e);
+                continue;
+            }
+
+            if (newDoc == null) {
+                newDoc = doc;
+                continue;
+            }
+
+            if (doc != null) {
+                mergeChildNode(newDoc, newDoc.getDocumentElement(), doc.getDocumentElement());
+            }
+        }
+
+        return newDoc;
+    }
+
+    public static List<Element> getElementsByTag(Element parent, String tag) {
+        // Assert.notNull(parent);
+        // Assert.notNull(tag);
+
+        List<Element> result = new ArrayList<Element>();
+        NodeList nodeList = parent.getElementsByTagName(tag);
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            Node node = nodeList.item(i);
+            if (node.getNodeType() == Node.ELEMENT_NODE) {
+                result.add((Element) node);
+            }
+        }
+        return result;
+    }
+
+    public static Node getDOMNodeNS(Element elem, String xpathStr, String nameSpace) {
+        XPathFactory factory = XPathFactory.newInstance();
+        XPath xPath = factory.newXPath();
+        if (nameSpace != null) {
+            xPath.setNamespaceContext(new UniversalNamespaceResolver(elem, nameSpace));
+        }
+
+        Object node = null;
+        try {
+            node = xPath.evaluate(xpathStr, elem, XPathConstants.NODE);
+        } catch (XPathExpressionException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        if (node instanceof Node) {
+            return (Node) node;
+        } else {
+            return null;
+        }
+    }
+
+    public static Node getDOMNodeNS(Element elem, String xpathStr) {
+        return getDOMNodeNS(elem, xpathStr, XMLConstants.DEFAULT_NS_PREFIX);
+    }
+
+    public static Node getDOMNode(Element elem, String xpathStr) {
+        return getDOMNodeNS(elem, xpathStr, null);
+    }
+
+    public static NodeList getDOMNodesNS(Element elem, String xpathStr, String nameSpace) {
+        XPathFactory factory = XPathFactory.newInstance();
+        XPath xPath = factory.newXPath();
+        if (nameSpace != null) {
+            xPath.setNamespaceContext(new UniversalNamespaceResolver(elem, nameSpace));
+        }
+
+        Object node = null;
+        try {
+            node = xPath.evaluate(xpathStr, elem, XPathConstants.NODESET);
+        } catch (XPathExpressionException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        if (node instanceof NodeList) {
+            return (NodeList) node;
+        } else {
+            return null;
+        }
+    }
+
+    public static NodeList getDOMNodesNS(Element elem, String xpathStr) {
+        return getDOMNodesNS(elem, xpathStr, XMLConstants.DEFAULT_NS_PREFIX);
+    }
+
+    public static NodeList getDOMNodes(Element elem, String xpathStr) {
+        return getDOMNodesNS(elem, xpathStr, null);
+    }
+
+    public static String getDOMValueNS(Element elem, String xpathStr, String nameSpace) {
+        XPathFactory factory = XPathFactory.newInstance();
+        XPath xPath = factory.newXPath();
+        if (nameSpace != null) {
+            xPath.setNamespaceContext(new UniversalNamespaceResolver(elem, nameSpace));
+        }
+
+        Object value;
+        try {
+            value = xPath.evaluate(xpathStr, elem, XPathConstants.STRING);
+        } catch (XPathExpressionException e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+
+        if (value instanceof String) {
+            return (String) value;
+        } else {
+            return null;
+        }
+    }
+
+    public static String getDOMValueNS(Element elem, String xpathStr) {
+        return getDOMValueNS(elem, xpathStr, XMLConstants.DEFAULT_NS_PREFIX);
+    }
+
+    public static String getDOMValue(Element elem, String xpathStr) {
+        return getDOMValueNS(elem, xpathStr, null);
+    }
+
+    public static void setDOMValueNS(Element elem, String xpathStr, String value, String nameSpace) {
+        XPathFactory factory = XPathFactory.newInstance();
+        XPath xPath = factory.newXPath();
+        if (nameSpace != null) {
+            xPath.setNamespaceContext(new UniversalNamespaceResolver(elem, nameSpace));
+        }
+
+        Object node = null;
+        try {
+            node = xPath.evaluate(xpathStr, elem, XPathConstants.NODE);
+        } catch (XPathExpressionException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        if (node instanceof Node) {
+            ((Node) node).setNodeValue(value);
+        }
+    }
+
+    public static void setDOMValueNS(Element elem, String xpathStr, String value) {
+        setDOMValueNS(elem, xpathStr, value, XMLConstants.DEFAULT_NS_PREFIX);
+    }
+
+    public static void setDOMValue(Element elem, String xpathStr, String value) {
+        setDOMValueNS(elem, xpathStr, value, null);
+    }
+
+    public static String getDOMValueNS(Document doc, String xpathStr) {
+        return getDOMValueNS(doc.getDocumentElement(), xpathStr);
+    }
+
+    public static String getDOMValueNS(Document doc, String xpathStr, String nameSpace) {
+        return getDOMValueNS(doc.getDocumentElement(), xpathStr, nameSpace);
+    }
+
+    public static Node getDOMNodeNS(Document doc, String xpathStr) {
+        return getDOMNodeNS(doc.getDocumentElement(), xpathStr);
+    }
+
+    public static Node getDOMNodeNS(Document doc, String xpathStr, String nameSpace) {
+        return getDOMNodeNS(doc.getDocumentElement(), xpathStr, nameSpace);
+    }
+
+    public static String getDOMValue(Document doc, String xpathStr) {
+        return getDOMValue(doc.getDocumentElement(), xpathStr);
+    }
+
+    public static Node getDOMNode(Document doc, String xpathStr) {
+        return getDOMNode(doc.getDocumentElement(), xpathStr);
+    }
+
+    public static NodeList getDOMNodesNS(Document doc, String xpathStr) {
+        return getDOMNodesNS(doc.getDocumentElement(), xpathStr);
+    }
+
+    public static NodeList getDOMNodes(Document doc, String xpathStr) {
+        return getDOMNodes(doc.getDocumentElement(), xpathStr);
+    }
+
+    public static void setDOMValue(Document doc, String xpathStr, String value) {
+        setDOMValue(doc.getDocumentElement(), xpathStr, value);
+    }
+
+    public static void setDOMValueNS(Document doc, String xpathStr, String value) {
+        setDOMValueNS(doc.getDocumentElement(), xpathStr, value);
+    }
+
+    public static void writeTo(Document doc, Writer writer) throws IOException,
+            ParserConfigurationException {
+        DOMSource source = new DOMSource(doc);
+        StreamResult result = new StreamResult(writer);
+
+        TransformerFactory factory = TransformerFactory.newInstance();
+        factory.setAttribute("indent-number", new Integer(4));
+        Transformer transformer = null;
+        try {
+            transformer = factory.newTransformer();
+            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+            transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+        } catch (TransformerConfigurationException e) {
+            logger.error(e.getMessage(), e);
+            return;
+        }
+
+        try {
+            transformer.transform(source, result);
+        } catch (TransformerException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public static String writeToString(Document doc) {
+        StringWriter writer = new StringWriter();
+        try {
+            writeTo(doc, writer);
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        } catch (ParserConfigurationException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        return writer.getBuffer().toString();
+    }
+
+    public static void writeToFile(Document doc, String filePath) {
+        try {
+            writeTo(doc, new FileWriter(filePath));
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        } catch (ParserConfigurationException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/util/ZipUtil.java b/rtosIDE/src/org/tizen/rt/ide/util/ZipUtil.java
new file mode 100644 (file)
index 0000000..828af36
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+*  Common
+*
+* Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* Taeyoung Son <taeyoung2.son@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.rt.ide.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ZipUtil {
+
+    private static final int BUFFER_SIZE = 1024 * 2;
+
+    public static void unzip(String zipFile, String targetDir, boolean fileNameToLowerCase, IProgressMonitor monitor) throws Exception {
+        FileInputStream fis = null;
+        ZipInputStream zis = null;
+        ZipEntry zentry = null;
+
+        try {
+            fis = new FileInputStream(zipFile);
+            zis = new ZipInputStream(fis);
+
+            while ((zentry = zis.getNextEntry()) != null) {
+                String fileNameToUnzip = zentry.getName();
+
+                if (fileNameToLowerCase) {
+                    fileNameToUnzip = fileNameToUnzip.toLowerCase();
+                }
+
+                File targetFile = new File(targetDir, fileNameToUnzip);
+
+                if (zentry.isDirectory()) {
+                    File targetFileObj = new File(targetFile.getAbsolutePath());
+                    targetFileObj.mkdirs();
+                } else {
+                    File targetFileObj = new File(targetFile.getParent());
+                    targetFileObj.mkdirs();
+
+                    unzipEntry(zis, targetFile);
+                }
+
+                if (monitor != null) {
+                    monitor.subTask(fileNameToUnzip);
+                    monitor.worked(1);
+                }
+            }
+        } finally {
+            if (zis != null) {
+                zis.close();
+            }
+            if (fis != null) {
+                fis.close();
+            }
+        }
+    }
+
+    protected static File unzipEntry(ZipInputStream zis, File targetFile) throws Exception {
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(targetFile);
+
+            byte[] buffer = new byte[BUFFER_SIZE];
+            int len = 0;
+            while ((len = zis.read(buffer)) != -1) {
+                fos.write(buffer, 0, len);
+            }
+        } finally {
+            if (fos != null) {
+                fos.close();
+            }
+        }
+        targetFile.setExecutable(true);
+        return targetFile;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizard.java b/rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizard.java
new file mode 100644 (file)
index 0000000..a4ae12d
--- /dev/null
@@ -0,0 +1,309 @@
+package org.tizen.rt.ide.wizards;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.ide.undo.CreateProjectOperation;
+import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
+import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
+import org.eclipse.ui.internal.WorkbenchImages;
+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.Messages;
+import org.tizen.rt.ide.util.ZipUtil;
+import org.tizen.rt.product.RtProjectNature;
+
+/**
+ * This is a sample new wizard. Its role is to create a new file resource in the provided container. If the container resource (a folder or a project) is selected in the workspace when the wizard is
+ * opened, it will accept it as the target container. The wizard creates one file with the extension "defs". If a sample multi-page editor (also available as a template) is registered for the same
+ * extension, it will be able to open it.
+ */
+
+public class NewArtikProjectWizard extends BasicNewResourceWizard implements IExecutableExtension {
+
+    private final Logger logger = LoggerFactory.getLogger(NewArtikProjectWizard.class);
+    private NewArtikProjectWizardPage page;
+    private NewArtikProjectWizardPage2 boardPage;
+    private ISelection selection;
+    private IProject _newProject;
+
+    /**
+     * Constructor for NewMakeDefsWizard.
+     */
+    public NewArtikProjectWizard() {
+        super();
+        setNeedsProgressMonitor(true);
+        ImageDescriptor wizardBannerImage = WorkbenchImages
+                .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_NEW_WIZ);
+        setWindowTitle(Messages.NewArtikProjectWizard_window_title);
+        if (wizardBannerImage != null) {
+            setDefaultPageImageDescriptor(wizardBannerImage);
+        }
+    }
+
+    /**
+     * Adding the page to the wizard.
+     */
+
+    public void addPages() {
+        page = new NewArtikProjectWizardPage(selection);
+        addPage(page);
+        boardPage = new NewArtikProjectWizardPage2(selection);
+        addPage(boardPage);
+
+        page.setWizard(this);
+    }
+
+    /**
+     * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
+     */
+    public boolean performFinish() {
+        final String boardName = boardPage.getBoardName();
+        final String fileName = page.getProjectName();
+        final IProject newProjectHandle = page.getProjectHandle();
+        final URI location;
+        if (!page.useDefaults()) {
+            location = page.getLocationURI();
+        } else {
+            location = null;
+        }
+
+        if (newProjectHandle == null) {
+            return false;
+        }
+
+        IRunnableWithProgress op = new IRunnableWithProgress() {
+            public void run(IProgressMonitor monitor) throws InvocationTargetException {
+                try {
+                    doFinish(boardName, fileName, newProjectHandle, location, monitor);
+                } catch (CoreException e) {
+                    throw new InvocationTargetException(e);
+                } finally {
+                    monitor.done();
+                }
+            }
+        };
+        try {
+            getContainer().run(true, false, op);
+        } catch (InterruptedException e) {
+            return false;
+        } catch (InvocationTargetException e) {
+            Throwable realException = e.getTargetException();
+            MessageDialog.openError(getShell(), "Error", realException.getMessage());
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * The worker method. It will find the container, create the file if missing or just replace its contents, and open the editor on the newly created file.
+     * @param monitor
+     * @throws IOException
+     */
+
+    private void copys(File srcFile, File desFile, IProgressMonitor monitor) throws IOException {
+        java.nio.file.Path srcPath = Paths.get(srcFile.toString());
+        java.nio.file.Path desPath = Paths.get(desFile.toString());
+
+        File[] tempFiles = srcFile.listFiles();
+        if (tempFiles != null) {
+            for (File file : tempFiles) {
+                String name = file.getName();
+                java.nio.file.Path srcPath2 = srcPath.resolve(name);
+                if (Files.isSymbolicLink(srcPath2)) {
+                    continue;
+                }
+
+                java.nio.file.Path desPath2 = desPath.resolve(name);
+                Files.copy(srcPath2, desPath2, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
+                if (monitor != null) {
+                    monitor.subTask(name);
+                    monitor.worked(1);
+                }
+
+                if (file.isDirectory()) {
+                    copys(file, desPath2.toFile(), monitor);
+                }
+            }
+        }
+    }
+
+    private void doFinish(String boardName, String projectName, IProject newProjectHandle, URI location,
+            IProgressMonitor monitor) throws CoreException {
+        // create a sample file
+        monitor.beginTask("Creating " + projectName, 4);
+        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+
+        createNewProject(newProjectHandle, location, monitor);
+
+        // File tempFile = new File(
+        // System.getProperty("user.dir") + File.separator +
+        // "resources/templates" + File.separator + boardName);
+        File tempFile = new File(boardName);
+
+        if (tempFile.isDirectory()) {
+            File projFile = new File(root.getLocation().toFile(), projectName);
+
+            try {
+                copys(tempFile, projFile, monitor);
+            } catch (IOException e) {
+                logger.error(e.getMessage(), e);
+            }
+        } else if (boardName.endsWith(".zip")) {
+            try {
+                ZipUtil.unzip(tempFile.toString(), new File(root.getLocation().toFile(), projectName).toString(), false,
+                        monitor);
+            } catch (Exception e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+
+        _newProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+        monitor.worked(1);
+    }
+
+    private IProject createNewProject(IProject newProjectHandle, URI location, IProgressMonitor monitor) {
+        if (_newProject != null) {
+            return _newProject;
+        }
+
+        IWorkspace workspace = ResourcesPlugin.getWorkspace();
+        final IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
+        description.setLocationURI(location);
+
+        // create the new project operation
+        // IRunnableWithProgress op = new IRunnableWithProgress() {
+        // @Override
+        // public void run(IProgressMonitor monitor) throws
+        // InvocationTargetException {
+        CreateProjectOperation op = new CreateProjectOperation(description,
+                Messages.NewArtikProjectWizard_create_op_label);
+        try {
+            // see bug
+            // https://bugs.eclipse.org/bugs/show_bug.cgi?id=219901
+            // directly execute the operation so that the undo state is
+            // not preserved. Making this undoable resulted in too many
+            // accidental file deletions.
+            op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
+            monitor.worked(1);
+        } catch (ExecutionException e) {
+            // throw new InvocationTargetException(e);
+        }
+        // }
+        // };
+
+        try {
+            RtProjectNature.addRtNature(newProjectHandle, monitor);
+        } catch (CoreException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        // // run the new project creation operation
+        // try {
+        // getContainer().run(true, true, op);
+        // } catch (InterruptedException e) {
+        // return null;
+        // } catch (InvocationTargetException e) {
+        // Throwable t = e.getTargetException();
+        // if (t instanceof ExecutionException && t.getCause() instanceof
+        // CoreException) {
+        // CoreException cause = (CoreException) t.getCause();
+        // IStatus status = null;
+        //// if (cause.getStatus().getCode() ==
+        // IResourceStatus.CASE_VARIANT_EXISTS) {
+        //// status = BundleMakerUiUtils.newWarning(
+        //// format("The underlying file system is case insensitive. There is an
+        // existing project or directory that conflicts with '%s'",
+        //// newProjectHandle.getName()),
+        //// cause);
+        //// } else {
+        //// status = BundleMakerUiUtils.newStatus(cause, "Problems while
+        // creating the project");
+        //// }
+        // StatusAdapter statusAdapter = new StatusAdapter(status);
+        // statusAdapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY,
+        // "Project creation problems");
+        // StatusManager.getManager().handle(status, StatusManager.BLOCK);
+        // } else {
+        // IStatus status = null;
+        // StatusAdapter statusAdapter = new StatusAdapter(status);
+        // statusAdapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY,
+        // "Project creation problems");
+        // StatusManager.getManager().handle(statusAdapter, StatusManager.LOG |
+        // StatusManager.BLOCK);
+        // }
+        // return null;
+        // }
+
+        // try {
+        // BundleMakerCore.addBundleMakerNature(newProjectHandle);
+        // if (mainPage.isTransformationScriptSupportSelected()) {
+        //
+        // TransformationScriptSupport.enableTransformationScriptSupport(newProjectHandle,
+        // PreferenceConstants.getDefaultJRELibrary());
+        //
+        // }
+        // IBundleMakerProject bundleMakerProject =
+        // BundleMakerCore.getBundleMakerProject(newProjectHandle);
+        // IModifiableProjectDescription modifiableProjectDescription =
+        // bundleMakerProject
+        // .getModifiableProjectDescription();
+        // modifiableProjectDescription.setJre(mainPage.getSelectedJreId());
+        // modifiableProjectDescription.save();
+        //
+        // } catch (CoreException ex) {
+        // IStatus status = BundleMakerUiUtils.newStatus(ex, "Could not add
+        // Bundlemaker nature");
+        // StatusAdapter statusAdapter = new StatusAdapter(status);
+        // statusAdapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY,
+        // "Project creation problems");
+        // StatusManager.getManager().handle(status, StatusManager.BLOCK);
+        // return null;
+        //
+        // }
+
+        _newProject = newProjectHandle;
+
+        return _newProject;
+    }
+
+    /**
+     * We will accept the selection in the workbench to see if we can initialize from it.
+     * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+     */
+    public void init(IWorkbench workbench, IStructuredSelection selection) {
+        this.selection = selection;
+    }
+
+    @Override
+    public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+            throws CoreException {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage.java b/rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage.java
new file mode 100644 (file)
index 0000000..c390d24
--- /dev/null
@@ -0,0 +1,52 @@
+package org.tizen.rt.ide.wizards;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.tizen.rt.ide.Messages;
+
+/**
+ * The "New" wizard page allows setting the container for the new file as well as the file name. The page will only accept file name without the extension OR with the extension that matches the
+ * expected one (defs).
+ */
+
+public class NewArtikProjectWizardPage extends WizardNewProjectCreationPage {
+    private ISelection selection;
+
+    /**
+     * Constructor for SampleNewWizardPage.
+     * @param pageName
+     */
+    public NewArtikProjectWizardPage(ISelection selection) {
+        super("NewArtikProjectWizardPage");
+        setTitle(Messages.NewArtikProjectWizardPage_title);
+        setDescription(Messages.NewArtikProjectWizardPage_desc);
+        this.selection = selection;
+    }
+
+    /**
+     * Tests if the current workbench selection is a suitable container to use.
+     */
+
+    @Override
+    protected boolean validatePage() {
+        boolean r = super.validatePage();
+        if (!r) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Ensures that both text fields are set.
+     */
+
+    private void dialogChanged() {
+        updateStatus(null);
+    }
+
+    private void updateStatus(String message) {
+        setErrorMessage(message);
+        setPageComplete(validatePage());
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage2.java b/rtosIDE/src/org/tizen/rt/ide/wizards/NewArtikProjectWizardPage2.java
new file mode 100644 (file)
index 0000000..7cd602f
--- /dev/null
@@ -0,0 +1,265 @@
+package org.tizen.rt.ide.wizards;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.rt.ide.Messages;
+
+//import swing2swt.layout.BorderLayout;
+
+/**
+ * The "New" wizard page allows setting the container for the new file as well as the file name. The page will only accept file name without the extension OR with the extension that matches the
+ * expected one (defs).
+ */
+
+public class NewArtikProjectWizardPage2 extends WizardPage {
+    private final Logger logger = LoggerFactory.getLogger(NewArtikProjectWizardPage2.class);
+
+    private Table table;
+    private Label lblBoardName;
+    private Browser browser;
+
+    private ISelection selection;
+
+    /**
+     * Constructor for SampleNewWizardPage.
+     * @param pageName
+     */
+    public NewArtikProjectWizardPage2(ISelection selection) {
+        super("NewArtikProjectWizardPage2");
+        setTitle(Messages.NewArtikProjectWizardPage2_title);
+        setDescription(Messages.NewArtikProjectWizardPage2_desc);
+        this.selection = selection;
+    }
+
+    /**
+     * @see IDialogPage#createControl(Composite)
+     */
+    public void createControl(Composite parent) {
+        Composite container = new Composite(parent, SWT.NONE);
+        container.setLayout(new GridLayout(2, false));
+        Composite composite_l = new Composite(container, SWT.NONE);
+        composite_l.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));
+        composite_l.setLayout(new GridLayout(1, false));
+
+        Label lblNewLabel = new Label(composite_l, SWT.NONE);
+        lblNewLabel.setText("Board :");
+
+        table = new Table(composite_l, SWT.BORDER | SWT.FULL_SELECTION);
+        GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+        // gd_table.widthHint = 150;
+        table.setLayoutData(gd_table);
+
+        TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
+        tblclmnNewColumn.setWidth(160);
+        tblclmnNewColumn.setText("Title");
+
+        Composite composite_r = new Composite(container, SWT.NONE);
+        composite_r.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+        composite_r.setSize(320, 100);
+        composite_r.setLayout(new GridLayout(1, false));
+
+        lblBoardName = new Label(composite_r, SWT.NONE);
+        lblBoardName.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
+        lblBoardName.setText("Board Name");
+
+        browser = new Browser(composite_r, SWT.BORDER);
+        browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+        initialize();
+        dialogChanged();
+        setControl(container);
+    }
+
+    private void dispDesc(Object data) {
+        if (data != null) {
+            if (data instanceof TemplateData) {
+                TemplateData tempData = (TemplateData) data;
+
+                lblBoardName.setText(tempData.title);
+
+                File rootFile = new File(tempData.rootPath);
+
+                if (tempData.descType == null || tempData.descType.isEmpty()
+                        || tempData.descType.equals("text")) {
+                    String textContent = null;
+                    if (tempData.descSrc != null && !tempData.descSrc.isEmpty()) {
+                        try {
+                            InputStream in = new FileInputStream(new File(rootFile, tempData.descSrc));
+                            int len = in.available();
+                            byte[] str = new byte[len];
+                            in.read(str);
+                            textContent = new String(str);
+                            in.close();
+
+                            // textContent = Escape(textContent);
+                        } catch (IOException e) {
+                            logger.error(e.getMessage(), e);
+                        }
+                    }
+                    if (textContent == null) {
+                        textContent = tempData.descContent;
+                    }
+
+                    String html = "<html><body>";
+                    if (tempData.image != null && !tempData.image.isEmpty()) {
+                        html = html + "<p align=\"center\"><img src=\""
+                                + new File(rootFile, tempData.image).toURI().toString() + "\"></p>";
+                    }
+                    if (tempData.descContent != null && !tempData.descContent.isEmpty()) {
+                        html = html + "<pre>" + textContent + "</pre>";
+                    }
+                    html = html + "</body></html>";
+                    browser.setText(html);
+                } else if (tempData.descType.equals("html")) {
+                    File file = new File(rootFile, tempData.descSrc);
+                    if (file.exists()) {
+                        browser.setUrl(file.toURI().toString());
+                    } else {
+                        browser.setUrl("about:blank");
+                    }
+                }
+            } else if (data instanceof String) {
+                lblBoardName.setText((String) data);
+                browser.setUrl("about:blank");
+            }
+        } else {
+            lblBoardName.setText("");
+            browser.setUrl("about:blank");
+        }
+    }
+
+    /**
+     * Tests if the current workbench selection is a suitable container to use.
+     */
+
+    private void initialize() {
+        table.addListener(SWT.Selection, new Listener() {
+            public void handleEvent(Event e) {
+                int selection = table.getSelectionIndex();
+                Object data = table.getData(String.valueOf(selection));
+                dispDesc(data);
+                dialogChanged();
+            }
+        });
+
+        File zipFile = new File(System.getProperty("user.dir") + File.separator + "resources/templates");
+        File[] files = zipFile.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File arg0, String arg1) {
+                return arg0.isDirectory() || (arg0.isFile() && arg1.endsWith(".zip"));
+            }
+        });
+
+        if (files != null && files.length > 0) {
+            int idx = 0;
+            for (File file : files) {
+                String filename = file.getName();
+                String filename2;
+                if (filename.endsWith(".zip")) {
+                    filename2 = filename.substring(0, filename.length() - 4);
+                } else {
+                    filename2 = filename;
+                }
+
+                TemplateData tempData = null;
+                if (file.isDirectory()) {
+                    File descFile = new File(file, "desc.xml");
+                    if (descFile.exists()) {
+                        tempData = TemplateData.read(file.toString(), descFile);
+                    }
+                }
+
+                TableItem tableItem = new TableItem(table, SWT.NONE);
+                tableItem.setText(filename2);
+                Image img = null;
+                if (tempData != null) {
+                    String thumb = null;
+                    if (tempData.thumbImage != null && !tempData.thumbImage.isEmpty()) {
+                        thumb = tempData.thumbImage;
+                    } else {
+                        thumb = tempData.image;
+                    }
+                    if (thumb != null && !thumb.isEmpty()) {
+                        File thumbFile = new File(file, thumb);
+                        if (thumbFile.exists()) {
+                            img = new Image(table.getDisplay(), thumbFile.toString());
+                        }
+                    }
+                } else {
+                    Bundle bundle = Platform.getBundle("org.tizen.rt.product");
+                    URL url = FileLocator.find(bundle, new Path("icons/ic.png"), null);
+                    ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
+                    img = imageDesc.createImage();
+                }
+
+                if (img != null) {
+                    tableItem.setImage(0, img);
+                }
+
+                if (tempData != null) {
+                    table.setData(String.valueOf(idx++), tempData);
+                } else {
+                    table.setData(String.valueOf(idx++), file.toString());
+                }
+
+            }
+        }
+    }
+
+    protected boolean validatePage() {
+        return (table.getSelectionIndex() >= 0);
+    }
+
+    /**
+     * Ensures that both text fields are set.
+     */
+    private void dialogChanged() {
+        updateStatus(null);
+    }
+
+    private void updateStatus(String message) {
+        setErrorMessage(message);
+        setPageComplete(validatePage());
+    }
+
+    public String getBoardName() {
+        int selection = table.getSelectionIndex();
+        Object data = table.getData(String.valueOf(selection));
+        if (data instanceof TemplateData) {
+            TemplateData tempData = (TemplateData) data;
+
+            return new File(tempData.rootPath, tempData.templateFileName).toString();
+        } else if (data instanceof String) {
+            return (String) data;
+        }
+
+        return null;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/wizards/NewMakeDefsWizard.java b/rtosIDE/src/org/tizen/rt/ide/wizards/NewMakeDefsWizard.java
new file mode 100644 (file)
index 0000000..21c8e21
--- /dev/null
@@ -0,0 +1,137 @@
+package org.tizen.rt.ide.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.operation.*;
+import java.lang.reflect.InvocationTargetException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import java.io.*;
+import org.eclipse.ui.*;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * This is a sample new wizard. Its role is to create a new file resource in the provided container. If the container resource (a folder or a project) is selected in the workspace when the wizard is
+ * opened, it will accept it as the target container. The wizard creates one file with the extension "defs". If a sample multi-page editor (also available as a template) is registered for the same
+ * extension, it will be able to open it.
+ */
+
+public class NewMakeDefsWizard extends Wizard implements INewWizard {
+    private NewMakeDefsWizardPage page;
+    private ISelection selection;
+
+    /**
+     * Constructor for NewMakeDefsWizard.
+     */
+    public NewMakeDefsWizard() {
+        super();
+        setNeedsProgressMonitor(true);
+    }
+
+    /**
+     * Adding the page to the wizard.
+     */
+
+    public void addPages() {
+        page = new NewMakeDefsWizardPage(selection);
+        addPage(page);
+    }
+
+    /**
+     * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
+     */
+    public boolean performFinish() {
+        final String containerName = page.getContainerName();
+        final String fileName = page.getFileName();
+        IRunnableWithProgress op = new IRunnableWithProgress() {
+            public void run(IProgressMonitor monitor) throws InvocationTargetException {
+                try {
+                    doFinish(containerName, fileName, monitor);
+                } catch (CoreException e) {
+                    throw new InvocationTargetException(e);
+                } finally {
+                    monitor.done();
+                }
+            }
+        };
+        try {
+            getContainer().run(true, false, op);
+        } catch (InterruptedException e) {
+            return false;
+        } catch (InvocationTargetException e) {
+            Throwable realException = e.getTargetException();
+            MessageDialog.openError(getShell(), "Error", realException.getMessage());
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * The worker method. It will find the container, create the file if missing or just replace its contents, and open the editor on the newly created file.
+     */
+
+    private void doFinish(
+            String containerName,
+            String fileName,
+            IProgressMonitor monitor)
+            throws CoreException {
+        // create a sample file
+        monitor.beginTask("Creating " + fileName, 2);
+        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+        IResource resource = root.findMember(new Path(containerName));
+        if (!resource.exists() || !(resource instanceof IContainer)) {
+            throwCoreException("Container \"" + containerName + "\" does not exist.");
+        }
+        IContainer container = (IContainer) resource;
+        final IFile file = container.getFile(new Path(fileName));
+        try {
+            InputStream stream = openContentStream();
+            if (file.exists()) {
+                file.setContents(stream, true, true, monitor);
+            } else {
+                file.create(stream, true, monitor);
+            }
+            stream.close();
+        } catch (IOException e) {
+        }
+        monitor.worked(1);
+        monitor.setTaskName("Opening file for editing...");
+        getShell().getDisplay().asyncExec(new Runnable() {
+            public void run() {
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                try {
+                    IDE.openEditor(page, file, true);
+                } catch (PartInitException e) {
+                }
+            }
+        });
+        monitor.worked(1);
+    }
+
+    /**
+     * We will initialize file contents with a sample text.
+     */
+
+    private InputStream openContentStream() {
+        String contents = "This is the initial file contents for *.defs file that should be word-sorted in the Preview page of the multi-page editor";
+        return new ByteArrayInputStream(contents.getBytes());
+    }
+
+    private void throwCoreException(String message) throws CoreException {
+        IStatus status = new Status(IStatus.ERROR, "artik-common", IStatus.OK, message, null);
+        throw new CoreException(status);
+    }
+
+    /**
+     * We will accept the selection in the workbench to see if we can initialize from it.
+     * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+     */
+    public void init(IWorkbench workbench, IStructuredSelection selection) {
+        this.selection = selection;
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/wizards/NewMakeDefsWizardPage.java b/rtosIDE/src/org/tizen/rt/ide/wizards/NewMakeDefsWizardPage.java
new file mode 100644 (file)
index 0000000..878c98e
--- /dev/null
@@ -0,0 +1,182 @@
+package org.tizen.rt.ide.wizards;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+
+/**
+ * The "New" wizard page allows setting the container for the new file as well as the file name. The page will only accept file name without the extension OR with the extension that matches the
+ * expected one (defs).
+ */
+
+public class NewMakeDefsWizardPage extends WizardPage {
+    private Text containerText;
+
+    private Text fileText;
+
+    private ISelection selection;
+
+    /**
+     * Constructor for SampleNewWizardPage.
+     * @param pageName
+     */
+    public NewMakeDefsWizardPage(ISelection selection) {
+        super("wizardPage");
+        setTitle("Multi-page Editor File");
+        setDescription("This wizard creates a new file with *.defs extension that can be opened by a multi-page editor.");
+        this.selection = selection;
+    }
+
+    /**
+     * @see IDialogPage#createControl(Composite)
+     */
+    public void createControl(Composite parent) {
+        Composite container = new Composite(parent, SWT.NULL);
+        GridLayout layout = new GridLayout();
+        container.setLayout(layout);
+        layout.numColumns = 3;
+        layout.verticalSpacing = 9;
+        Label label = new Label(container, SWT.NULL);
+        label.setText("&Container:");
+
+        containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
+        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+        containerText.setLayoutData(gd);
+        containerText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                dialogChanged();
+            }
+        });
+
+        Button button = new Button(container, SWT.PUSH);
+        button.setText("Browse...");
+        button.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                handleBrowse();
+            }
+        });
+        label = new Label(container, SWT.NULL);
+        label.setText("&File name:");
+
+        fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        fileText.setLayoutData(gd);
+        fileText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                dialogChanged();
+            }
+        });
+        initialize();
+        dialogChanged();
+        setControl(container);
+    }
+
+    /**
+     * Tests if the current workbench selection is a suitable container to use.
+     */
+
+    private void initialize() {
+        if (selection != null && selection.isEmpty() == false
+                && selection instanceof IStructuredSelection) {
+            IStructuredSelection ssel = (IStructuredSelection) selection;
+            if (ssel.size() > 1)
+                return;
+            Object obj = ssel.getFirstElement();
+            if (obj instanceof IResource) {
+                IContainer container;
+                if (obj instanceof IContainer)
+                    container = (IContainer) obj;
+                else
+                    container = ((IResource) obj).getParent();
+                containerText.setText(container.getFullPath().toString());
+            }
+        }
+        fileText.setText("Make.defs");
+    }
+
+    /**
+     * Uses the standard container selection dialog to choose the new value for the container field.
+     */
+
+    private void handleBrowse() {
+        ContainerSelectionDialog dialog = new ContainerSelectionDialog(
+                getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
+                "Select new file container");
+        if (dialog.open() == ContainerSelectionDialog.OK) {
+            Object[] result = dialog.getResult();
+            if (result.length == 1) {
+                containerText.setText(((Path) result[0]).toString());
+            }
+        }
+    }
+
+    /**
+     * Ensures that both text fields are set.
+     */
+
+    private void dialogChanged() {
+        IResource container = ResourcesPlugin.getWorkspace().getRoot()
+                .findMember(new Path(getContainerName()));
+        String fileName = getFileName();
+
+        if (getContainerName().length() == 0) {
+            updateStatus("File container must be specified");
+            return;
+        }
+        if (container == null
+                || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
+            updateStatus("File container must exist");
+            return;
+        }
+        if (!container.isAccessible()) {
+            updateStatus("Project must be writable");
+            return;
+        }
+        if (fileName.length() == 0) {
+            updateStatus("File name must be specified");
+            return;
+        }
+        if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
+            updateStatus("File name must be valid");
+            return;
+        }
+        int dotLoc = fileName.lastIndexOf('.');
+        if (dotLoc != -1) {
+            String ext = fileName.substring(dotLoc + 1);
+            if (ext.equalsIgnoreCase("defs") == false) {
+                updateStatus("File extension must be \"defs\"");
+                return;
+            }
+        }
+        updateStatus(null);
+    }
+
+    private void updateStatus(String message) {
+        setErrorMessage(message);
+        setPageComplete(message == null);
+    }
+
+    public String getContainerName() {
+        return containerText.getText();
+    }
+
+    public String getFileName() {
+        return fileText.getText();
+    }
+}
diff --git a/rtosIDE/src/org/tizen/rt/ide/wizards/TemplateData.java b/rtosIDE/src/org/tizen/rt/ide/wizards/TemplateData.java
new file mode 100644 (file)
index 0000000..1e69560
--- /dev/null
@@ -0,0 +1,55 @@
+package org.tizen.rt.ide.wizards;
+
+import java.io.File;
+
+import org.tizen.rt.ide.util.XMLUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class TemplateData {
+    public String rootPath;
+    public String title;
+    public String image;
+    public String thumbImage;
+    public String descType;
+    public String descSrc;
+    public String descContent;
+    public String templateFileType;
+    public String templateFileName;
+
+    public static TemplateData read(String rootPath, File descFile) {
+        Document doc = XMLUtil.readXML(descFile);
+        if (doc != null) {
+            TemplateData data = new TemplateData();
+            data.rootPath = rootPath;
+
+            Element template = (Element) XMLUtil.getDOMNode(doc, "/template");
+            String title = template.getAttribute("title");
+            String image = template.getAttribute("image");
+            String thumbImage = template.getAttribute("thumb");
+
+            Element desc = (Element) XMLUtil.getDOMNode(doc, "/template/desc");
+            String descType = desc.getAttribute("type");
+            String descSrc = desc.getAttribute("src");
+            String descContent = desc.getTextContent();
+
+            Element file = (Element) XMLUtil.getDOMNode(doc, "/template/file");
+            String templateFileType = file.getAttribute("type");
+            String templateFileName = file.getAttribute("src");
+
+            data.title = title;
+            data.image = image;
+            data.thumbImage = thumbImage;
+            data.descType = descType;
+            data.descSrc = descSrc;
+            data.descContent = descContent;
+            data.templateFileType = templateFileType;
+            data.templateFileName = templateFileName;
+
+            return data;
+        }
+
+        return null;
+    }
+
+}
diff --git a/rtosIDE/src/org/tizen/rt/product/RtProjectNature.java b/rtosIDE/src/org/tizen/rt/product/RtProjectNature.java
new file mode 100644 (file)
index 0000000..874b3fa
--- /dev/null
@@ -0,0 +1,162 @@
+/**
+ * Common
+ *
+ * @since 2017. 2. 13.
+ *
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Daeryong Park <bdragon.park@samsung.com>
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.rt.product;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RtProjectNature implements IProjectNature {
+
+    public static final String RT_NATURE_ID = "org.tizen.rt.product.RtProjectNature";
+    private static final Logger logger = LoggerFactory.getLogger(RtProjectNature.class);
+
+    private IProject fProject;
+
+    public RtProjectNature() {
+    }
+
+    public RtProjectNature(IProject project) {
+        setProject(project);
+    }
+
+    public static void addRtNature(IProject project, IProgressMonitor mon) throws CoreException {
+        makeCDTProject(project, mon);
+        addNature(project, RT_NATURE_ID, mon);
+    }
+
+    public static void removeRtNature(IProject project, IProgressMonitor mon) throws CoreException {
+        removeNature(project, RT_NATURE_ID, mon);
+    }
+
+    /**
+     * Utility method for adding a nature to a project.
+     * @param project the project to add the nature
+     * @param natureId the id of the nature to assign to the project
+     * @param monitor a progress monitor to indicate the duration of the operation, or <code>null</code> if progress reporting is not required.
+     */
+    private static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
+        try {
+            if (monitor == null) {
+                monitor = new NullProgressMonitor();
+            }
+            IProjectDescription description = project.getDescription();
+            String[] prevNatures = description.getNatureIds();
+            for (String prevNature : prevNatures) {
+                if (natureId.equals(prevNature))
+                    return;
+            }
+            String[] newNatures = new String[prevNatures.length + 1];
+            System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+            newNatures[prevNatures.length] = natureId;
+            description.setNatureIds(newNatures);
+            project.setDescription(description, monitor);
+        }
+
+        catch (CoreException e) {
+            CCorePlugin.log(e);
+        }
+
+        finally {
+            monitor.done();
+        }
+    }
+
+    /**
+     * Utility method for removing a project nature from a project.
+     * @param project the project to remove the nature from
+     * @param natureId the nature id to remove
+     * @param monitor a progress monitor to indicate the duration of the operation, or <code>null</code> if progress reporting is not required.
+     */
+    private static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
+        IProjectDescription description = project.getDescription();
+        String[] prevNatures = description.getNatureIds();
+        List<String> newNatures = new ArrayList<String>(Arrays.asList(prevNatures));
+        newNatures.remove(natureId);
+        description.setNatureIds(newNatures.toArray(new String[newNatures.size()]));
+        project.setDescription(description, monitor);
+    }
+
+    private static IProject makeCDTProject(IProject projectHandle, IProgressMonitor monitor) {
+        IProject cdtProj = projectHandle;
+        try {
+            IProjectDescription description = projectHandle.getDescription();
+            cdtProj = CCorePlugin.getDefault().createCDTProject(description, projectHandle, monitor);
+        } catch (OperationCanceledException e) {
+            logger.error(e.getMessage(), e);
+        } catch (CoreException e) {
+            logger.error(e.getMessage(), e);
+        }
+        if (cdtProj != null) {
+            projectHandle = cdtProj;
+        }
+        return projectHandle;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.resources.IProjectNature#configure()
+     */
+    @Override
+    public void configure() throws CoreException {
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+     */
+    @Override
+    public void deconfigure() throws CoreException {
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.resources.IProjectNature#getProject()
+     */
+    @Override
+    public IProject getProject() {
+        return fProject;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+     */
+    @Override
+    public void setProject(IProject project) {
+        fProject = project;
+    }
+
+}