Merge sources from S-Core's RSA git (release) 2.0alpha master 2.0_alpha
authorJenkins <taeyoung2.son@samsung.com>
Tue, 18 Sep 2012 04:28:05 +0000 (13:28 +0900)
committerJenkins <taeyoung2.son@samsung.com>
Tue, 18 Sep 2012 04:28:05 +0000 (13:28 +0900)
Change-Id: I9dfaedd4c2127af3999b0050ea56289d3f87a113

86 files changed:
builder/customTargets.xml [deleted file]
cfsnippets/META-INF/MANIFEST.MF
cfsnippets/src/org/cfeclipse/cfml/snippets/preferences/CFMLPreferenceConstants.java
cfsnippets/src/org/cfeclipse/cfml/snippets/views/snips/SnipFileDialog.java
cfsnippets/src/org/cfeclipse/cfml/snippets/views/snips/SnipReader.java [changed mode: 0644->0755]
cfsnippets/src/org/cfeclipse/cfml/snippets/views/snips/SnipTreeView.java
cfsnippets/src/org/cfeclipse/cfml/snippets/views/snips/SnipWriter.java
org.eclipse.linuxtools.cdt.libhover.glibc/.gitignore [new file with mode: 0644]
org.eclipse.linuxtools.cdt.libhover/.gitignore [new file with mode: 0644]
org.tizen.nativecommon.feature/feature.xml
org.tizen.nativecommon/META-INF/MANIFEST.MF
org.tizen.nativecommon/OSGI-INF/l10n/bundle.properties
org.tizen.nativecommon/plugin.xml
org.tizen.nativecommon/schema/org.tizen.nativecommon.store.exsd [new file with mode: 0644]
org.tizen.nativecommon/schema/org.tizen.nativecommon.unittest.handler.exsd [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/Activator.java
org.tizen.nativecommon/src/org/tizen/nativecommon/ApplicationConfiguration.java [new file with mode: 0755]
org.tizen.nativecommon/src/org/tizen/nativecommon/ApplicationConfigurationAdapterFactory.java [new file with mode: 0755]
org.tizen.nativecommon/src/org/tizen/nativecommon/IXMLStore.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/PathUtil.java
org.tizen.nativecommon/src/org/tizen/nativecommon/ProjectDirtyChecker.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/ProjectUtil.java
org.tizen.nativecommon/src/org/tizen/nativecommon/TizenNativeException.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/apihover/BrowserInformationControl.java
org.tizen.nativecommon/src/org/tizen/nativecommon/apihover/IndexFileInfo.java
org.tizen.nativecommon/src/org/tizen/nativecommon/apihover/IndexFinder.java
org.tizen.nativecommon/src/org/tizen/nativecommon/apihover/doxygen/DoxygenHandler.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileGenObjectAction.java [deleted file]
org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileGenerator.java [deleted file]
org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileManagedBuildToolInfo.java [deleted file]
org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileSelectConfDialog.java [deleted file]
org.tizen.nativecommon/src/org/tizen/nativecommon/build/CheckCancelJob.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonBuildCommandLauncher.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonBuildConstants.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonBuildPackageObjectAction.java [deleted file]
org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonConfigurationManager.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonProjectDependentBuilder.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonProjectDependentPackager.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/GCCSpecsRunSIProvider.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/ProjectTypeManager.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/SmartBuildInterface.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/model/SBIModel.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/template/engine/SetSBITarget.java
org.tizen.nativecommon/src/org/tizen/nativecommon/build/ui/AbstractDynamicAnalysisPropertyTab.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/build/ui/PlatformSettingTab.java [changed mode: 0644->0755]
org.tizen.nativecommon/src/org/tizen/nativecommon/build/ui/projectBuildArtefactType.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/CProjectLaunchCommand.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/CppProjectLaunchCommand.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/IProjectLaunchCommand.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenAttachDelegate.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenCommandFactory.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenCoredumpDelegate.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenDebugger.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenDeviceProcessList.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchCommand.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchConfiguration.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchConfigurationConstants.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchDelegate.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchMessages.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchMessages.properties
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenMIProcessAdapter.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenProcessInfo.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenUIThreadForConfirmMessage.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenDebuggerForCoreTab.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenDebuggerPage.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenDebuggerPageForCore.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenDebuggerTab.java
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationForAttachTabGroup.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationForCoreTabGroup.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationTabGroup.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenMainTab.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationAttachLaunchShortcut.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationCoredumpLaunchShortcut.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationLaunchShortcut.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenLaunchShortcut.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/templateengine/process/TizenCreateSourceFolder.java
org.tizen.nativecommon/src/org/tizen/nativecommon/ui/ConfigurationCombo.java
org.tizen.nativecommon/src/org/tizen/nativecommon/ui/PerspectiveFactory.java
org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/IUnitTestHandler.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestProjectInfo.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestRegistry.java [new file with mode: 0644]
org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestSettingsPage.java [new file with mode: 0644]
package/build.linux
package/pkginfo.manifest
packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_armel.tar [deleted file]
packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_i386.tar [deleted file]

diff --git a/builder/customTargets.xml b/builder/customTargets.xml
deleted file mode 100644 (file)
index 6a42e92..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-<project name="Build specific targets and properties" default="noDefault">
-
-       <!-- ===================================================================== -->
-       <!-- Run a given ${target} on all elements being built -->
-       <!-- Add on <ant> task for each top level element being built. -->
-       <!-- ===================================================================== -->
-       <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
-       <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
-
-       <import file="${allElementsFile}" />
-       <target name="allElements">
-               <ant antfile="${genericTargets}" target="${target}">
-                       <property name="type" value="${topLevelElementType}"/>
-                       <property name="id" value="${topLevelElementId}"/>
-               </ant>
-       </target>
-
-       <target
-               name="assemble.${topLevelElementId}.linux.gtk.x86">
-               <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
-       </target>
-       <target
-               name="assemble.${topLevelElementId}.win32.win32.x86">
-               <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
-       </target>
-       
-       <!-- ===================================================================== -->
-       <!-- ===================================================================== -->
-       <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
-               <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
-               <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
-       </target>
-
-       <target name="checkLocalBase">
-               <available file="${base}" property="skipBase" />
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Check out map files from correct repository -->
-       <!-- Replace values for mapsCheckoutTag as desired. -->
-       <!-- ===================================================================== -->
-       <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
-               <property name="mapsCheckoutTag" value="HEAD" />
-               <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
-       </target>
-
-       <target name="checkLocalMaps">
-               <available property="skipMaps" file="${buildDirectory}/maps" />
-       </target>
-
-       <target name="tagMapFiles" if="tagMaps">
-               <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
-       </target>
-
-       <!-- ===================================================================== -->
-
-       <target name="clean" unless="noclean">
-               <antcall target="allElements">
-                       <param name="target" value="cleanElement" />
-               </antcall>
-       </target>
-
-       <target name="gatherLogs">
-               <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
-               <antcall target="allElements">
-                       <param name="target" value="gatherLogs" />
-               </antcall>
-               <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
-                       <fileset dir="${buildDirectory}/features">
-                               <include name="**/*.log.zip" />
-                       </fileset>
-               </unzip>
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do before setup -->
-       <!-- ===================================================================== -->
-       <target name="preSetup">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after setup but before starting the build proper -->
-       <!-- ===================================================================== -->
-       <target name="postSetup">
-               <antcall target="getBaseComponents" />
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do before fetching the build elements -->
-       <!-- ===================================================================== -->
-       <target name="preFetch">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after fetching the build elements -->
-       <!-- ===================================================================== -->
-       <target name="postFetch">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do before the repositories are being processed -->
-       <!-- ===================================================================== -->
-       <target name="preProcessRepos">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after the repositories have been processed -->
-       <!-- ===================================================================== -->
-       <target name="postProcessRepos">
-       </target>
-       
-       <!-- ===================================================================== -->
-       <!-- Steps to do before generating the build scripts. -->
-       <!-- ===================================================================== -->
-       <target name="preGenerate">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after generating the build scripts. -->
-       <!-- ===================================================================== -->
-       <target name="postGenerate">
-               <antcall target="clean" />
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do before running the build.xmls for the elements being built. -->
-       <!-- ===================================================================== -->
-       <target name="preProcess">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after running the build.xmls for the elements being built. -->
-       <!-- ===================================================================== -->
-       <target name="postProcess">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do before running assemble. -->
-       <!-- ===================================================================== -->
-       <target name="preAssemble">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after  running assemble. -->
-       <!-- ===================================================================== -->
-       <target name="postAssemble">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do before running package. -->
-       <!-- ===================================================================== -->
-       <target name="prePackage">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after  running package. -->
-       <!-- ===================================================================== -->
-       <target name="postPackage">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do after the build is done. -->
-       <!-- ===================================================================== -->
-       <target name="postBuild">
-               <antcall target="gatherLogs" />
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do to test the build results -->
-       <!-- ===================================================================== -->
-       <target name="test">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Steps to do to publish the build results -->
-       <!-- ===================================================================== -->
-       <target name="publish">
-       </target>
-
-       <!-- ===================================================================== -->
-       <!-- Default target                                                        -->
-       <!-- ===================================================================== -->
-       <target name="noDefault">
-               <echo message="You must specify a target when invoking this file" />
-       </target>
-
-</project>
index 3de5e5d..3d9784b 100644 (file)
@@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.ui,
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,
  JavaSE-1.6
-Import-Package: org.tizen.common.properties,
+Import-Package: org.tizen.common.core.application,
  org.apache.commons.logging,
  org.eclipse.core.resources,
  org.eclipse.jface.text,
index 49c1ea5..e1f3691 100644 (file)
@@ -1,15 +1,13 @@
 package org.cfeclipse.cfml.snippets.preferences;
 
-import java.io.File;
-
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.ui.internal.Workbench;
 import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
-import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.core.application.InstallPathConfig;
 
 public class CFMLPreferenceConstants {
 
-       public static final String SNIPPETS_PATH = InstallPathConfig.getSDKPath() + File.separatorChar + "IDE" + File.separatorChar + "resources" + File.separatorChar + "tools" + File.separatorChar + "snippets";
+       public static final String SNIPPETS_PATH = InstallPathConfig.getSnippetsPath();
 
        public static final String P_SNIPPETS_PATH = "_snippetsPath";
        public static final String P_TAB_WIDTH = "_tabWidth";
index 3d92341..0b1ded6 100644 (file)
@@ -69,6 +69,8 @@ public class SnipFileDialog extends Dialog {
        private String templateExtensionValue = "cfm";\r
        private SnipWriter writer;\r
        \r
+       private String originalFileName = null;\r
+\r
        private Button useAsTemplateButton;\r
 \r
        /**\r
@@ -89,9 +91,9 @@ public class SnipFileDialog extends Dialog {
                \r
                super(parent);\r
                if (snippetNameInitialValue != null){\r
-                       snippetNameValue = snippetNameInitialValue;\r
+                       snippetNameValue = originalFileName = snippetNameInitialValue;\r
                }\r
-               \r
+\r
                if (snippetKeyComboInitialValue != null){\r
                        snippetKeyComboValue = snippetKeyComboInitialValue;\r
                }\r
@@ -358,9 +360,8 @@ public class SnipFileDialog extends Dialog {
            if (useAsTemplateButton.getSelection() && templateExtensionText.getText().trim().equals("")) {\r
                templateExtensionText.setText("cfm");\r
            }\r
-               writer.writeSnippet(snippetNameText.getText(),snippetKeyComboText.getText(),snippetDescriptionText.getText(), snippetStartText.getText(),snippetEndText.getText(),useAsTemplateButton.getSelection(),templateExtensionText.getText());\r
-               \r
-               \r
+\r
+           writer.writeSnippet(snippetNameText.getText(),snippetKeyComboText.getText(),snippetDescriptionText.getText(), snippetStartText.getText(),snippetEndText.getText(),useAsTemplateButton.getSelection(),templateExtensionText.getText(), originalFileName);\r
                \r
                close();\r
                treeView.refresh();\r
index 41a83bc..ba31d84 100644 (file)
@@ -74,6 +74,7 @@ import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IEditorPart;\r
 import org.eclipse.ui.IFileEditorInput;\r
 import org.eclipse.ui.IWorkbenchActionConstants;\r
+import org.eclipse.ui.PlatformUI;\r
 import org.eclipse.ui.part.ViewPart;\r
 import org.cfeclipse.snippet.snipex.Library;\r
 import org.cfeclipse.snippet.snipex.SnipEx;\r
@@ -129,8 +130,10 @@ public class SnipTreeView extends ViewPart
        protected Action exportToSnipEx;\r
        protected Action openSnipExPage;\r
        \r
+       private Composite parent;\r
        /** the root directory */\r
        protected File root;\r
+       private final String SNIPPETS_HELP_CONTEXT = "org.tizen.ide.native.snippets_context";\r
        \r
        private CFMLPropertyManager propertyManager;\r
        \r
@@ -164,8 +167,10 @@ public class SnipTreeView extends ViewPart
        /*\r
         * @see IWorkbenchPart#createPartControl(Composite)\r
         */\r
-       public void createPartControl(Composite parent) \r
+       public void createPartControl(Composite p)\r
        {\r
+               parent = p;\r
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, SNIPPETS_HELP_CONTEXT);\r
                //Create a grid layout object so the text and treeviewer\r
                GridLayout layout = new GridLayout();\r
                layout.numColumns = 1;\r
@@ -188,7 +193,7 @@ public class SnipTreeView extends ViewPart
                \r
                \r
                //Create the tree viewer as a child of the composite parent\r
-               treeViewer = new TreeViewer(parent);\r
+               treeViewer = new TreeViewer(parent, SWT.SINGLE);\r
                treeViewer.setContentProvider(new SnipTreeViewContentProvider(getRootInput()));\r
                labelProvider = new SnipTreeViewLabelProvider();\r
                treeViewer.setLabelProvider(labelProvider);\r
@@ -837,6 +842,11 @@ public class SnipTreeView extends ViewPart
        /*\r
         * @see IWorkbenchPart#setFocus()\r
         */\r
-       public void setFocus(){;}\r
+       public void setFocus(){\r
+               if(parent != null)\r
+               {\r
+                       parent.setFocus();\r
+               }\r
+       }\r
 }\r
 \r
index e794ec4..ac035d7 100644 (file)
@@ -60,7 +60,11 @@ public class SnipWriter {
                }\r
        }\r
        \r
-       \r
+       private String getFullPath(String name)\r
+       {\r
+               return parentFolder.toString() + File.separator + name + fileExtension;\r
+       }\r
+\r
        public void writeSnippet(String snippetName, String snippetKeyCombo, String snippetDescription, String startText, String endText, boolean useAsTemplate, String templateExtension) {\r
                \r
                \r
@@ -94,6 +98,47 @@ public class SnipWriter {
                        e.printStackTrace(System.err);\r
                }\r
        }\r
+\r
+\r
+       public void writeSnippet(String snippetName, String snippetKeyCombo, String snippetDescription,\r
+                       String startText, String endText, boolean useAsTemplate, String templateExtension, String originalFileName) {\r
+               \r
+               File snippetFile = new File(getFullPath(snippetName));\r
+               \r
+               if(originalFileName.length() != 0)\r
+               {\r
+                       File oldFile = new File(getFullPath(originalFileName));\r
+                       oldFile.renameTo(snippetFile);\r
+               }\r
+               String snippetContents = createFormattedSnip(snippetName,snippetDescription, startText,endText,useAsTemplate,templateExtension);\r
+               try {\r
+                   \r
+                       if (!snippetFile.isFile()) {\r
+                               snippetFile.createNewFile();\r
+                       }\r
+                       FileWriter writer = new FileWriter(snippetFile);\r
+                       writer.write(snippetContents);\r
+                       writer.close();\r
+                       if (snippetKeyCombo.length() > 0) {\r
+                           SnipKeyCombos snipKeyCombos = new SnipKeyCombos();\r
+\r
+                               String filepath = snippetFile.getAbsolutePath().replaceAll("\\\\","/");\r
+                               String basePath = snipBase.toString();\r
+                               \r
+                               String relativePath = filepath.replaceFirst(basePath,"");\r
+                               \r
+                           String sequence = snipKeyCombos.getSequence(relativePath);\r
+                           \r
+                           if (sequence != null){\r
+                               snipKeyCombos.clearKeyCombo(sequence);\r
+                           }\r
+                           snipKeyCombos.setKeyCombo(snippetKeyCombo,relativePath);\r
+                       }\r
+               }\r
+               catch (IOException e) {\r
+                       e.printStackTrace(System.err);\r
+               }\r
+       }\r
        \r
        \r
        \r
diff --git a/org.eclipse.linuxtools.cdt.libhover.glibc/.gitignore b/org.eclipse.linuxtools.cdt.libhover.glibc/.gitignore
new file mode 100644 (file)
index 0000000..8d94ef8
--- /dev/null
@@ -0,0 +1,5 @@
+bin
+@dot
+javaCompiler...args
+build.xml
+target
diff --git a/org.eclipse.linuxtools.cdt.libhover/.gitignore b/org.eclipse.linuxtools.cdt.libhover/.gitignore
new file mode 100644 (file)
index 0000000..8d94ef8
--- /dev/null
@@ -0,0 +1,5 @@
+bin
+@dot
+javaCompiler...args
+build.xml
+target
index d8bf7c5..ba59bd9 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <feature
       id="org.tizen.nativecommon.feature"
-      label="Tizen Native common"
+      label="Tizen Native Common"
       version="1.0.0.qualifier"
-      provider-name="Samsung"
+      provider-name="Tizen"
       plugin="org.tizen.base.platform"
       license-feature="org.tizen.base.feature">
 
@@ -12,8 +12,7 @@
    </description>
 
    <copyright>
-      Copyright (c) 2010-2011, Samsung Electronics Co., LTD. All rights
-reserved.
+      Copyright (c)
    </copyright>
 
    <license url="http://www.example.com/license">
index a5a95c4..8f54849 100644 (file)
@@ -26,6 +26,9 @@ Import-Package: org.eclipse.cdt.codan.core,
  org.eclipse.cdt.core.templateengine.process,
  org.eclipse.cdt.core.templateengine.process.processes,
  org.eclipse.cdt.debug.core,
+ org.eclipse.cdt.debug.core.cdi,
+ org.eclipse.cdt.debug.core.cdi.model,
+ org.eclipse.cdt.debug.internal.ui.launch,
  org.eclipse.cdt.debug.mi.core,
  org.eclipse.cdt.debug.mi.core.cdi,
  org.eclipse.cdt.debug.mi.core.command.factories,
@@ -42,6 +45,7 @@ Import-Package: org.eclipse.cdt.codan.core,
  org.eclipse.cdt.internal.ui.text.contentassist,
  org.eclipse.cdt.internal.ui.util,
  org.eclipse.cdt.internal.ui.viewsupport,
+ org.eclipse.cdt.launch,
  org.eclipse.cdt.launch.internal.ui,
  org.eclipse.cdt.launch.ui,
  org.eclipse.cdt.make.core.scannerconfig,
@@ -59,31 +63,44 @@ Import-Package: org.eclipse.cdt.codan.core,
  org.eclipse.cdt.ui.newui,
  org.eclipse.cdt.ui.text,
  org.eclipse.cdt.ui.text.contentassist,
+ org.eclipse.cdt.ui.wizards,
  org.eclipse.cdt.utils.spawner,
  org.eclipse.cdt.utils.ui.controls,
  org.eclipse.core.expressions,
+ org.eclipse.core.internal.dtree,
+ org.eclipse.core.internal.events,
+ org.eclipse.core.internal.resources,
+ org.eclipse.core.internal.watson,
  org.eclipse.core.resources,
  org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
  org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
  org.eclipse.jface.internal.text.html,
  org.eclipse.jface.text,
  org.eclipse.jface.text.contentassist,
  org.eclipse.ui.console,
  org.eclipse.ui.navigator.resources,
  org.tizen.common.connection,
- org.tizen.common.console,
- org.tizen.common.properties,
+ org.tizen.common.connection.ui,
+ org.tizen.common.core.application,
+ org.tizen.common.ui.view.console,
  org.tizen.common.util,
  org.tizen.sdblib
-Export-Package: org.tizen.nativecommon.apihover,
+Export-Package: org.tizen.nativecommon,
+ org.tizen.nativecommon.apihover,
  org.tizen.nativecommon.build,
  org.tizen.nativecommon.build.exception,
  org.tizen.nativecommon.build.model,
  org.tizen.nativecommon.build.obs,
  org.tizen.nativecommon.build.ui,
  org.tizen.nativecommon.launch,
- org.tizen.nativecommon.launch.ui
-Bundle-Vendor: Samsung
+ org.tizen.nativecommon.launch.ui,
+ org.tizen.nativecommon.launch.ui.shortcut,
+ org.tizen.nativecommon.templateengine.process,
+ org.tizen.nativecommon.ui.actions,
+ org.tizen.nativecommon.unittest
+Bundle-Vendor: %Bundle-Vendor
 Bundle-ClassPath: jericho-html-3.1.jar,
  xpp3-1.1.4.jar,
  xstream-1.3.1.jar,
index 3ea4db6..fe98cc0 100644 (file)
@@ -1,3 +1,8 @@
+Bundle-Vendor = Samsung Electronics
+
+Common.toolbar.label=Tizen Native
+Manager.toolbar.label=Tizen Native Manager
+
 # context menu label
 Packaging.menu=Build Package
 Packaging.menu.rpm=RPM
index 0d967f1..8bcca22 100644 (file)
             class="org.tizen.nativecommon.build.ui.TizenSettingsPage"
             id="org.tizen.nativecommon.build.ui.TizenSettingsPage"
             name="Tizen Settings">
-         <enabledWhen>                 
-             <adapt type="org.eclipse.core.resources.IProject">
-               <and>
-                         <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"/>
-                         <test property="org.tizen.nativecommon.isTizenProject"/>
+         <enabledWhen>
+            <adapt type="org.eclipse.core.resources.IProject">
+                <and>
+                    <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"/>
+                    <test property="org.tizen.nativecommon.isTizenProject"/>
                 </and>
-                    </adapt> 
+            </adapt>
          </enabledWhen>
       </page>
+      <page
+         category="org.eclipse.cdt.managedbuilder.ui.properties.Page_head_build"
+         class="org.tizen.nativecommon.unittest.UnitTestSettingsPage"
+         id="org.tizen.nativecommon.unittest.UnitTestSettingsPage"
+         name="Tizen Settings"
+         objectClass="org.eclipse.core.resources.IProject">
+      <enabledWhen>
+            <adapt
+                  type="org.eclipse.core.resources.IResource">
+               <test
+                     property="org.eclipse.core.resources.projectNature"
+                     value="org.tizen.tizentest.nature">
+               </test>
+            </adapt>
+       </enabledWhen>
+      </page>
    </extension>
    <extension
          point="org.eclipse.core.expressions.propertyTesters">
          </simple>
       </processType>
    </extension>
-   <extension
-         point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
-      <toolChain
-            id="com.samsung.slp.nativeide.toolchain.sbi.gnu.base"
-            isAbstract="true"
-            isToolChainSupported="org.tizen.nativecommon.build.SBIToolChainChecker"
-            osList="linux,win32">
-         <targetPlatform
-               binaryParser="org.eclipse.cdt.core.ELF"
-               id="com.samsung.slp.nativeide.target.sbi.gnu.platform.base"
-               osList="linux,win32">
-         </targetPlatform>
-         <tool
-               id="com.samsung.slp.nativeide.tool.sbi.gnu.archiver.base"
-               natureFilter="both"
-               superClass="cdt.managedbuild.tool.gnu.archiver">
-         </tool>
-         <tool
-               id="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.compiler.base"
-               isAbstract="true"
-               superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
-            <option
-                  id="sbi.gnu.cpp.compiler.option.target"
-                  name="SLP-Target"
-                  valueType="userObjs">
-            </option>
-         </tool>
-         <tool
-               id="com.samsung.slp.nativeide.tool.sbi.gnu.c.compiler.base"
-               isAbstract="true"
-               superClass="cdt.managedbuild.tool.gnu.c.compiler">
-            <option
-                  id="sbi.gnu.c.compiler.option.target"
-                  name="SLP-Target"
-                  valueType="userObjs">
-            </option>
-         </tool>
-         <tool
-               id="com.samsung.slp.nativeide.tool.sbi.gnu.c.linker.base"
-               isAbstract="true"
-               superClass="cdt.managedbuild.tool.gnu.c.linker">
-         </tool>
-         <tool
-               id="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.linker.base"
-               isAbstract="true"
-               superClass="cdt.managedbuild.tool.gnu.cpp.linker">
-         </tool>
-         <tool
-               id="com.samsung.tizen.nativeapp.tool.sbi.gnu.assembler.base"
-               superClass="cdt.managedbuild.tool.gnu.assembler">
-         </tool>
-      </toolChain>
-   </extension>
-
-     <!-- 2 -->
    <extension
          point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
       <toolChain
          </targetPlatform>
          <tool
                id="org.tizen.nativeide.tool.sbi.gnu.archiver.base"
+               isAbstract="true"
+               name="Archiver"
                natureFilter="both"
                superClass="cdt.managedbuild.tool.gnu.archiver">
          </tool>
          <tool
                id="org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.base"
                isAbstract="true"
+               name="C++ Compiler"
                superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
             <option
                   id="sbi.gnu.cpp.compiler.option"
          <tool
                id="org.tizen.nativeide.tool.sbi.gnu.c.compiler.base"
                isAbstract="true"
+               name="C Compiler"
                superClass="cdt.managedbuild.tool.gnu.c.compiler">
             <option
                   id="sbi.gnu.c.compiler.option"
          <tool
                id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"
                isAbstract="true"
+               name="C Linker"
                superClass="cdt.managedbuild.tool.gnu.c.linker">
          </tool>
          <tool
                id="org.tizen.nativeide.tool.sbi.gnu.cpp.linker.base"
                isAbstract="true"
+               name="C++ Linker"
                superClass="cdt.managedbuild.tool.gnu.cpp.linker">
          </tool>
          <tool
                id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base"
+               isAbstract="true"
+               name="Assembler"
                superClass="cdt.managedbuild.tool.gnu.assembler">
          </tool>
       </toolChain>
    </extension>
 
     <extension
-        point="org.eclipse.ui.popupMenus">
-        <!--
-        <objectContribution
-            adaptable="false"
-            id="org.tizen.nativecommon.build.generateBuildDataObjectContribution"
-            objectClass="org.eclipse.core.resources.IProject">
-            <action
-                class="org.tizen.nativecommon.build.BuildDataFileGenObjectAction"
-                enablesFor="1"
-                id="org.tizen.nativecommon.build.generateBuildData"
-                label="Generate Build Data"
-                menubarPath="buildGroup">
-            </action>
-            <visibility>
-                <objectState
-                    name="projectNature"
-                    value="org.eclipse.cdt.managedbuilder.core.managedBuildNature">
-                </objectState>
-            </visibility>
-        </objectContribution>
-        -->
+        point="org.eclipse.ui.popupMenus">        
         <objectContribution
                adaptable="true"
                id="org.tizen.nativecommon.ui.buildConfigContribution"
             point="org.tizen.common.connection.tools">
         <tools
             packagename="gdbserver"
-            sourcepath="/SDK/develop-tool">
+            sourcepath="/on-demand">
         </tools>
     </extension>
     <extension
                             name="TizenCreateSourceFolder"
                             processRunner="org.tizen.nativecommon.templateengine.process.TizenCreateSourceFolder">
                             <simple name="projectName"/>
-                            <simple name="path"/>
+                            <complexArray
+                                  name="pathList">
+                               <baseType>
+                                  <simple
+                                        name="path">
+                                  </simple>
+                               </baseType>
+                            </complexArray>
                       </processType>
                 </extension>
 <!-- template end -->
    </extension>
 <!-- navitgator content end -->
 <!-- menu start -->
-                <extension
-                      point="org.eclipse.ui.menus">
-                      <menuContribution
-                              locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
-                              <toolbar
-                                  id="org.tizen.nativecommon.ui.toolbar">
-                                  <control
-                                      class="org.tizen.nativecommon.ui.ConfigurationLabel"
-                                      id="org.tizen.nativecommon.ui.ConfigurationLabel">
-                                      <visibleWhen
-                                          checkEnabled="false">
-                                          <with variable="activeWorkbenchWindow.activePerspective">
-                                              <or>
-                                                  <equals value="org.tizen.nativeapp.perspective">
-                                                  </equals>
-                                              </or>
-                                          </with>
-                                      </visibleWhen>
-                                  </control>
-                                  <control
-                                      class="org.tizen.nativecommon.ui.SpaceLabel"
-                                      id="org.tizen.nativecommon.ui.SpaceLabel">
-                                      <visibleWhen
-                                          checkEnabled="false">
-                                          <with variable="activeWorkbenchWindow.activePerspective">
-                                              <or>
-                                                  <equals value="org.tizen.nativeapp.perspective">
-                                                  </equals>
-                                              </or>
-                                          </with>
-                                      </visibleWhen>
-                                  </control>
-                                  <control
-                                      class="org.tizen.nativecommon.ui.ConfigurationCombo"
-                                      id="org.tizen.nativecommon.ui.ConfigurationCombo">
-                                      <visibleWhen
-                                          checkEnabled="false">
-                                          <with variable="activeWorkbenchWindow.activePerspective">
-                                              <or>
-                                                  <equals value="org.tizen.nativeapp.perspective">
-                                                  </equals>
-                                              </or>
-                                          </with>
-                                      </visibleWhen>
-                                  </control>
-                                  <separator
-                                      name="org.tizen.nativecommon.ui.separtor"
-                                      visible="true">
-                                  </separator>
-                                  <control
-                                      class="org.tizen.nativecommon.ui.ConnectionLabel"
-                                      id="org.tizen.nativecommon.ui.ConnectionLabel">
-                                      <visibleWhen
-                                          checkEnabled="false">
-                                          <with variable="activeWorkbenchWindow.activePerspective">
-                                              <or>
-                                                  <equals value="org.tizen.nativeapp.perspective">
-                                                  </equals>
-                                              </or>
-                                          </with>
-                                      </visibleWhen>
-                                  </control>
-                                  <control
-                                      class="org.tizen.nativecommon.ui.SpaceLabel"
-                                      id="org.tizen.nativecommon.ui.SpaceLabel">
-                                      <visibleWhen
-                                          checkEnabled="false">
-                                          <with variable="activeWorkbenchWindow.activePerspective">
-                                              <or>
-                                                  <equals value="org.tizen.nativeapp.perspective">
-                                                  </equals>
-                                              </or>
-                                          </with>
-                                      </visibleWhen>
-                                  </control>
-                                  <control
-                                      class="org.tizen.nativecommon.ui.ConnectionCombo"
-                                      id="org.tizen.nativecommon.ui.ConnectionCombo">
-                                      <visibleWhen
-                                          checkEnabled="false">
-                                          <with variable="activeWorkbenchWindow.activePerspective">
-                                              <or>
-                                                  <equals value="org.tizen.nativeapp.perspective">
-                                                  </equals>
-                                              </or>
-                                          </with>
-                                      </visibleWhen>
-                                  </control>
-                              </toolbar>
-                          </menuContribution>
-                </extension>
+    <extension
+          point="org.eclipse.ui.menus">
+          <menuContribution
+                  locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+                  <toolbar
+                      label="%Common.toolbar.label"
+                      id="org.tizen.nativecommon.ui.toolbar">
+                      <control
+                          class="org.tizen.nativecommon.ui.ConfigurationLabel"
+                          id="org.tizen.nativecommon.ui.ConfigurationLabel">
+                          <visibleWhen
+                              checkEnabled="false">
+                              <with variable="activeWorkbenchWindow.activePerspective">
+                                  <or>
+                                      <equals value="org.tizen.nativeapp.perspective">
+                                      </equals>
+                                  </or>
+                              </with>
+                          </visibleWhen>
+                      </control>
+                      <control
+                          class="org.tizen.nativecommon.ui.SpaceLabel"
+                          id="org.tizen.nativecommon.ui.SpaceLabel">
+                          <visibleWhen
+                              checkEnabled="false">
+                              <with variable="activeWorkbenchWindow.activePerspective">
+                                  <or>
+                                      <equals value="org.tizen.nativeapp.perspective">
+                                      </equals>
+                                  </or>
+                              </with>
+                          </visibleWhen>
+                      </control>
+                      <control
+                          class="org.tizen.nativecommon.ui.ConfigurationCombo"
+                          id="org.tizen.nativecommon.ui.ConfigurationCombo">
+                          <visibleWhen
+                              checkEnabled="false">
+                              <with variable="activeWorkbenchWindow.activePerspective">
+                                  <or>
+                                      <equals value="org.tizen.nativeapp.perspective">
+                                      </equals>
+                                  </or>
+                              </with>
+                          </visibleWhen>
+                      </control>
+                      <separator
+                          name="org.tizen.nativecommon.ui.separtor"
+                          visible="true">
+                      </separator>
+                      <control
+                          class="org.tizen.nativecommon.ui.ConnectionLabel"
+                          id="org.tizen.nativecommon.ui.ConnectionLabel">
+                          <visibleWhen
+                              checkEnabled="false">
+                              <with variable="activeWorkbenchWindow.activePerspective">
+                                  <or>
+                                      <equals value="org.tizen.nativeapp.perspective">
+                                      </equals>
+                                  </or>
+                              </with>
+                          </visibleWhen>
+                      </control>
+                      <control
+                          class="org.tizen.nativecommon.ui.SpaceLabel"
+                          id="org.tizen.nativecommon.ui.SpaceLabel">
+                          <visibleWhen
+                              checkEnabled="false">
+                              <with variable="activeWorkbenchWindow.activePerspective">
+                                  <or>
+                                      <equals value="org.tizen.nativeapp.perspective">
+                                      </equals>
+                                  </or>
+                              </with>
+                          </visibleWhen>
+                      </control>
+                      <control
+                          class="org.tizen.nativecommon.ui.ConnectionCombo"
+                          id="org.tizen.nativecommon.ui.ConnectionCombo">
+                          <visibleWhen
+                              checkEnabled="false">
+                              <with variable="activeWorkbenchWindow.activePerspective">
+                                  <or>
+                                      <equals value="org.tizen.nativeapp.perspective">
+                                      </equals>
+                                  </or>
+                              </with>
+                          </visibleWhen>
+                      </control>
+                  </toolbar>
+              </menuContribution>
+    </extension>
 <!-- menu end -->
 <!-- apihover start -->
    <extension-point id="org.tizen.nativeapp.documentation" name="Documentation" schema="apihover_documentation.exsd"/>
+   <extension-point id="org.tizen.nativecommon.store" name="manifest store" schema="schema/org.tizen.nativecommon.store.exsd"/>
+   <extension-point id="org.tizen.nativecommon.unittest.handler" name="Unit Test Handler" schema="schema/org.tizen.nativecommon.unittest.handler.exsd"/>
    <extension
          point="org.eclipse.cdt.ui.textHovers">
       <hover
       </provider>
     </extension>
 <!-- api hover end -->
+    <extension
+        point="org.eclipse.ui.menus">
+        <menuContribution
+            locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+            <toolbar
+                id="org.tizen.nativecommon.manager.mgrtoolbar"
+                label="%Manager.toolbar.label">
+            </toolbar>
+        </menuContribution>
+    </extension>
+<!-- launch start -->
+    <extension
+        point="org.eclipse.debug.core.launchConfigurationTypes">
+        <launchConfigurationType
+              delegate="org.tizen.nativecommon.launch.TizenLaunchDelegate"
+              id="org.tizen.nativecommon.launch.TizenLaunchConfigurationType"
+              name="Tizen Native Application"
+              public="true"/>
+        <launchConfigurationType
+            delegate="org.tizen.nativecommon.launch.TizenAttachDelegate"
+            id="org.tizen.nativecommon.launch.TizenAttachConfigurationType"
+            name="Tizen Debug Application - Attach"
+            public="true"/>
+        <launchConfigurationType
+            delegate="org.tizen.nativecommon.launch.TizenCoredumpDelegate"
+            id="org.tizen.nativecommon.launch.TizenCoredumpConfigurationType"
+            name="Tizen Debug Application - Coredump"
+            public="true"/>
+    </extension>
+    <extension
+        point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+        <launchConfigurationTypeImage
+            icon="icons/Tizen_Native_Application_ConfigurationType_Image.gif"
+            configTypeID="org.tizen.nativecommon.launch.TizenLaunchConfigurationType"
+            id="org.tizen.nativecommon.launch.TizenLaunchConfigurationType.image"/>
+        <launchConfigurationTypeImage
+            icon="icons/Tizen_Native_Application_ConfigurationType_Image_Attach.gif"
+            configTypeID="org.tizen.nativecommon.launch.TizenAttachConfigurationType"
+            id="org.tizen.nativecommon.launch.TizenAttachConfigurationType.image"/>
+        <launchConfigurationTypeImage
+            icon="icons/Tizen_Native_Application_ConfigurationType_Image_Core.gif"
+            configTypeID="org.tizen.nativecommon.launch.TizenCoredumpConfigurationType"
+            id="org.tizen.nativecommon.launch.TizenCoredumpConfigurationType.image"/>
+    </extension>
+    <extension
+        point="org.eclipse.debug.core.launchDelegates">
+        <launchDelegate
+            delegate="org.tizen.nativecommon.launch.TizenLaunchDelegate"
+            id="org.tizen.nativecommon.launch.TizenLaunchDelegate"
+            modes="run,debug"
+            name="Tizen Native Application"
+            delegateDescription="This launcher supports running Tizen Native application on device"
+            sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+            sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
+            type="org.tizen.nativecommon.launch.TizenLaunchConfigurationType"/>
+        <launchDelegate
+            delegate="org.tizen.nativecommon.launch.TizenAttachDelegate"
+            id="org.tizen.nativecommon.launch.TizenAttachDelegate"
+            modes="debug"
+            name="Tizen Debug Application - Attach"
+            delegateDescription="This launcher supports attach debugging Tizen application on device"
+            sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+            sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
+            type="org.tizen.nativecommon.launch.TizenAttachConfigurationType"/>
+        <launchDelegate
+            delegate="org.tizen.nativecommon.launch.TizenCoredumpDelegate"
+            id="org.tizen.nativecommon.launch.TizenCoredumpDelegate"
+            modes="debug"
+            name="Tizen Debug Application - Coredump"
+            delegateDescription="This launcher supports coredump debugging Tizen application"
+            sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+            sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
+            type="org.tizen.nativecommon.launch.TizenCoredumpConfigurationType"/>
+    </extension>
+    <extension
+        point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+        <launchConfigurationTabGroup
+            class="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationTabGroup"
+            id="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationTabGroup"
+            type="org.tizen.nativecommon.launch.TizenLaunchConfigurationType"/>
+        <launchConfigurationTabGroup
+            class="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationForAttachTabGroup"
+            id="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationForAttachTabGroup"
+            type="org.tizen.nativecommon.launch.TizenAttachConfigurationType"/>
+        <launchConfigurationTabGroup
+            class="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationForCoreTabGroup"
+            id="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationForCoreTabGroup"
+            type="org.tizen.nativecommon.launch.TizenCoredumpConfigurationType"/>
+    </extension>
+    <extension
+        point="org.eclipse.debug.ui.launchConfigurationTabs">
+        <tab
+            id="org.tizen.nativecommon.launch.ui.TizenMainTab"
+            group="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationTabGroup"
+            name="Tizen Main Tab"
+            class="org.tizen.nativecommon.launch.ui.TizenMainTab">
+            <associatedDelegate delegate="org.tizen.nativecommon.launch.TizenLaunchDelegate"/>
+        </tab>
+        <tab
+            id="org.tizen.nativecommon.launch.ui.TizenMainTab"
+            group="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationForAttachTabGroup"
+            name="Tizen Main Tab"
+            class="org.tizen.nativecommon.launch.ui.TizenMainTab">
+            <associatedDelegate delegate="org.tizen.nativecommon.launch.TizenAttachDelegate"/>
+        </tab>
+        <tab
+            id="org.tizen.nativecommon.launch.ui.TizenMainTab"
+            group="org.tizen.nativecommon.launch.ui.TizenLaunchConfigurationForCoreTabGroup"
+            name="Tizen Main Tab"
+            class="org.tizen.nativecommon.launch.ui.TizenMainTab">
+            <associatedDelegate delegate="org.tizen.nativecommon.launch.TizenCoredumpDelegate"/>
+        </tab>
+    </extension>
+    <extension
+        point="org.eclipse.debug.ui.launchShortcuts">
+        <shortcut
+            label="Tizen Native Application"
+            icon="icons/Tizen_Native_Application_ConfigurationType_Image.gif"
+            modes="run,debug"
+            class="org.tizen.nativecommon.launch.ui.shortcut.TizenApplicationLaunchShortcut"
+            id="org.tizen.nativecommon.launch.ui.shortcut.TizenApplicationLaunchShortcut">
+        <contextualLaunch>
+            <enablement>
+                <with variable="selection">
+                <count value="1"/>
+                <iterate>
+                    <and>
+                        <or>
+                            <instanceof value="org.eclipse.cdt.core.model.IBinary"/>
+                            <instanceof value="org.eclipse.cdt.core.model.ICProject"/>
+                            <test
+                                forcePluginActivation="true"
+                                property="org.eclipse.cdt.launch.isExecutable"/>
+                            <test
+                                forcePluginActivation="true"
+                                property="org.eclipse.cdt.launch.isCProject"/>
+                            <and>
+                                <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+                                <adapt type="org.eclipse.core.resources.IResource">
+                                    <adapt type="org.eclipse.cdt.core.model.ICElement"/>
+                                </adapt>
+                            </and>
+                        </or>
+                        <not>
+                            <adapt type="org.eclipse.core.resources.IResource">
+                                <test
+                                    property="org.eclipse.core.resources.projectNature"
+                                    value="org.tizen.tizentest.nature">
+                                </test>
+                            </adapt>
+                        </not>
+                    </and>
+                </iterate>
+                </with>
+            </enablement>
+        </contextualLaunch>
+        <description
+            mode="run"
+            description="Runs a Tizen Native application"/>
+        <description
+            mode="debug"
+            description="Debugs a Tizen Native application"/>
+        <configurationType
+            id="org.tizen.nativecommon.launch.TizenLaunchConfigurationType">
+        </configurationType>
+        </shortcut>
+        <shortcut
+            label="Tizen Native Application - Attach"
+            icon="icons/Tizen_Native_Application_ConfigurationType_Image_Attach.gif"
+            modes="debug"
+            class="org.tizen.nativecommon.launch.ui.shortcut.TizenApplicationAttachLaunchShortcut"
+            id="org.tizen.nativecommon.launch.ui.shortcut.TizenApplicationAttachLaunchShortcut">
+        <contextualLaunch>
+            <enablement>
+                <with variable="selection">
+                <count value="1"/>
+                <iterate>
+                    <and>
+                        <or>
+                            <instanceof value="org.eclipse.cdt.core.model.IBinary"/>
+                            <instanceof value="org.eclipse.cdt.core.model.ICProject"/>
+                            <test
+                                forcePluginActivation="true"
+                                property="org.eclipse.cdt.launch.isExecutable"/>
+                            <test
+                                forcePluginActivation="true"
+                                property="org.eclipse.cdt.launch.isCProject"/>
+                            <and>
+                                <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+                                <adapt type="org.eclipse.core.resources.IResource">
+                                    <adapt type="org.eclipse.cdt.core.model.ICElement"/>
+                                </adapt>
+                            </and>
+                        </or>
+                        <not>
+                            <adapt type="org.eclipse.core.resources.IResource">
+                                <test
+                                    property="org.eclipse.core.resources.projectNature"
+                                    value="org.tizen.tizentest.nature">
+                                </test>
+                            </adapt>
+                        </not>
+                    </and>
+                </iterate>
+                </with>
+            </enablement>
+        </contextualLaunch>
+        <description
+            mode="debug"
+            description="Debugs a Tizen application"/>
+        <configurationType
+            id="org.tizen.nativecommon.launch.TizenAttachConfigurationType">
+        </configurationType>
+        </shortcut>
+        <shortcut
+            label="Tizen Native Application - Coredump"
+            icon="icons/Tizen_Native_Application_ConfigurationType_Image_Core.gif"
+            modes="debug"
+            class="org.tizen.nativecommon.launch.ui.shortcut.TizenApplicationCoredumpLaunchShortcut"
+            id="org.tizen.nativecommon.launch.ui.shortcut.TizenApplicationCoredumpLaunchShortcut">
+        <contextualLaunch>
+            <enablement>
+                <with variable="selection">
+                <count value="1"/>
+                <iterate>
+                    <and>
+                        <or>
+                            <instanceof value="org.eclipse.cdt.core.model.IBinary"/>
+                            <instanceof value="org.eclipse.cdt.core.model.ICProject"/>
+                            <test
+                                forcePluginActivation="true"
+                                property="org.eclipse.cdt.launch.isExecutable"/>
+                            <test
+                                forcePluginActivation="true"
+                                property="org.eclipse.cdt.launch.isCProject"/>
+                            <and>
+                                <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+                                <adapt type="org.eclipse.core.resources.IResource">
+                                    <adapt type="org.eclipse.cdt.core.model.ICElement"/>
+                                </adapt>
+                            </and>
+                        </or>
+                        <not>
+                            <adapt type="org.eclipse.core.resources.IResource">
+                                <test
+                                    property="org.eclipse.core.resources.projectNature"
+                                    value="org.tizen.tizentest.nature">
+                                </test>
+                            </adapt>
+                        </not>
+                    </and>
+                </iterate>
+                </with>
+            </enablement>
+        </contextualLaunch>
+        <description
+            mode="debug"
+            description="Debugs a Tizen Native application"/>
+        <configurationType
+            id="org.tizen.nativecommon.launch.TizenCoredumpConfigurationType">
+        </configurationType>
+        </shortcut>
+    </extension>
+<!-- launch end -->
+
+<!-- adapters for removing dependency among plugins -->
+    <extension
+          point="org.eclipse.core.runtime.adapters">
+       <factory
+             adaptableType="org.eclipse.core.resources.IProject"
+             class="org.tizen.nativecommon.ApplicationConfigurationAdapterFactory">
+          <adapter
+                type="org.tizen.common.IApplicationConfiguration">
+          </adapter>
+       </factory>
+    </extension>
 </plugin>
diff --git a/org.tizen.nativecommon/schema/org.tizen.nativecommon.store.exsd b/org.tizen.nativecommon/schema/org.tizen.nativecommon.store.exsd
new file mode 100644 (file)
index 0000000..531c751
--- /dev/null
@@ -0,0 +1,125 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.tizen.nativecommon" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.tizen.nativecommon" id="org.tizen.nativecommon.store" name="manifest store"/>
+      </appinfo>
+      <documentation>
+         This extension point is used for generating XMLStore.  XMLStore loads/ stores data from/ to xml file.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice minOccurs="1" maxOccurs="unbounded">
+            <element ref="store"/>
+         </choice>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a fully qualified identifier of the target extension point
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  an optional identifier of the extension instance
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  an optional name of the extension instance
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="store">
+      <complexType>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a fully qualified name of the Java class implementing org.tizen.nativecommon.IXMLStore
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.tizen.nativecommon.IXMLStore"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  A unique id of this xml store.
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         Following is an example of creation xml store:
+
+&lt;p&gt;
+&lt;pre&gt;
+      &lt;extension
+            point=&quot;org.tizen.nativecommon.store&quot;&gt;
+         &lt;store
+               class=&quot;org.tizen.nativecpp.ManifestStore&quot;
+               id=&quot;org.tizen.nativecpp.ManifetStore&quot;&gt;
+         &lt;/store&gt;
+         &lt;store
+               class=&quot;org.tizen.nativecpp.ApplicationStore&quot;
+               id=&quot;org.tizen.nativecpp.ApplicationStore&quot;&gt;
+         &lt;/store&gt;
+      &lt;/extension&gt;
+      &lt;/p&gt;
+&lt;/pre&gt;
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         The value of the class attribute must represent a class that implements org.tizen.nativecommon.IXMLStore. For using this classes to process XML files, users should load this extension point and create class in the source code.
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>
diff --git a/org.tizen.nativecommon/schema/org.tizen.nativecommon.unittest.handler.exsd b/org.tizen.nativecommon/schema/org.tizen.nativecommon.unittest.handler.exsd
new file mode 100644 (file)
index 0000000..0c0c685
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.tizen.nativecommon" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.tizen.nativecommon" id="org.tizen.nativecommon.unittest.handler" name="Unit Test Handler"/>
+      </appinfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice>
+            <element ref="handler" minOccurs="1" maxOccurs="5"/>
+         </choice>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="handler">
+      <complexType>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.tizen.nativecommon.unittest.IUnitTestHandler"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="targetArtefactType" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="templateName" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="targetType" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>
index 38bad14..74e76ba 100644 (file)
@@ -10,7 +10,8 @@ import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 import org.tizen.nativecommon.apihover.SLPCodeAssistPreferencePage;
-import org.tizen.nativecommon.build.model.SBIModel;
+import org.tizen.nativecommon.build.CommonBuildConstants;
+import org.tizen.nativecommon.unittest.UnitTestRegistry;
 
 
 /**
@@ -21,6 +22,8 @@ public class Activator extends AbstractUIPlugin {
        // The plug-in ID
        public static final String PLUGIN_ID = "org.tizen.nativecommon"; //$NON-NLS-1$
 
+    public static final String SIGN_RUN_CHECK_KEY = "org.tizen.nativeappcommon.signing.runcheckkey";
+
        // The shared instance
        private static Activator plugin;
        
@@ -34,7 +37,9 @@ public class Activator extends AbstractUIPlugin {
                disableCodeAnalysisProblems("org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem");
                disableCodeAnalysisProblems("org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem");
                disableCodeAnalysisProblems("org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem");
-       }
+               
+               UnitTestRegistry.initializeUnitTestRegistry();
+       }       
 
        /*
         * (non-Javadoc)
@@ -44,9 +49,9 @@ public class Activator extends AbstractUIPlugin {
                super.start(context);
                initDefaults(); // for apihover
                plugin = this;
-               if (!SBIModel.isInitialized()) {
-                       SBIModel.initialize();
-               }
+
+               /* Set "Build Automatically" menu false by default */
+               ProjectUtil.enableAutoBuild(!CommonBuildConstants.DEFAULT_AUTOBUILD);
        }
 
        /*
@@ -93,5 +98,8 @@ public class Activator extends AbstractUIPlugin {
                }
                return;
        }
+       
+       
+
 
 }
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/ApplicationConfiguration.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/ApplicationConfiguration.java
new file mode 100755 (executable)
index 0000000..206dc0a
--- /dev/null
@@ -0,0 +1,76 @@
+/*\r
+* ApplicationConfiguration.java\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact:\r
+* Kangho Kim <kh5325.kim@samsung.com>\r
+*  \r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+* Contributors:\r
+* - S-Core Co., Ltd\r
+*\r
+*/ \r
+package org.tizen.nativecommon;\r
+\r
+import org.eclipse.core.resources.IProject;\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.tizen.common.IApplicationConfiguration;\r
+import org.tizen.common.TizenProjectType;\r
+\r
+/**\r
+ * An implementation of IApplicationConfiguration.\r
+ * \r
+ * See also {@link IAdaptable}\r
+ * @author Kangho Kim{@literal <kh5325.kim@samsung.com>} (S-Core)\r
+ */\r
+public class ApplicationConfiguration implements IApplicationConfiguration, IAdaptable {\r
+    private IProject project;\r
+\r
+    public ApplicationConfiguration(IProject project) {\r
+        this.project = project;\r
+    }\r
+\r
+    @Override\r
+    @SuppressWarnings("rawtypes")\r
+    public Object getAdapter(Class adapter) {\r
+        return Platform.getAdapterManager().getAdapter(this, adapter);\r
+    }\r
+\r
+    @Override\r
+    public String getDefaultConfiguration() {\r
+        return ProjectUtil.getDefaultConfiguration(project).getName();\r
+    }\r
+\r
+    @Override\r
+    public String getBinaryName() {\r
+        return ProjectUtil.getBinaryName(project);\r
+    }\r
+\r
+    @Override\r
+    public String generateAppId() {\r
+        IXMLStore xmlManager = ProjectUtil.getXmlStore(project);\r
+        String appId = null;\r
+        if (xmlManager != null)\r
+            appId = xmlManager.generateAppId();\r
+\r
+        return appId;\r
+    }\r
+\r
+    @Override\r
+    public TizenProjectType getTizenProjectType() {\r
+        return ProjectUtil.getTizenProjectType(project);\r
+    }\r
+}
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/ApplicationConfigurationAdapterFactory.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/ApplicationConfigurationAdapterFactory.java
new file mode 100755 (executable)
index 0000000..8ea8f0e
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * ApplicationConfigurationAdapterFactory.java
+ *
+ * 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.nativecommon;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.tizen.common.IApplicationConfiguration;
+
+public class ApplicationConfigurationAdapterFactory implements IAdapterFactory {
+
+    @SuppressWarnings("rawtypes")
+    @Override
+    public Object getAdapter(Object adaptableObject, Class adapterType) {
+        if (adapterType == IApplicationConfiguration.class) {
+            return new ApplicationConfiguration((IProject)adaptableObject);
+        }
+        return null;
+    }
+
+    @SuppressWarnings("rawtypes")
+    @Override
+    public Class[] getAdapterList() {
+        return new Class[] { IApplicationConfiguration.class };
+    }
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/IXMLStore.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/IXMLStore.java
new file mode 100644 (file)
index 0000000..93cf93c
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+*  Native Cpp
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Kangho Kim <kh5325.kim@samsung.com>
+* Ho Namkoong <ho.namkoong@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.nativecommon;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.tizen.common.TizenProjectType;
+
+/**
+ * IXMLStore 
+ * 
+ * This is an interface for xml store class.
+ * For implementing this interface, use extension point org.tizen.nativecommon.store. 
+ *  
+ * @author Ho Namkoong{@literal <ho.namkoong@samsung.com>} (S-Core)
+ */
+public interface IXMLStore {
+    
+    /**
+     * extension point id for implementing this interface.
+     */
+    public static final String EXSD_STORE_EXTENSION_POINT_ID = "org.tizen.nativecommon.store";
+    
+    /**
+     * class id of NewAppXmlStore which implements this interface.
+     * @see org.tizen.nativecommon.ProjectUtil#getXmlStore
+     */
+    public static final String EXSD_APP_XML_STORE_CLASS_ID = "org.tizen.nativecpp.misc.core.NewAppXmlStore";
+    
+    /**
+     * class id of NewManifestXmlStore which implements this interface.
+     */
+    public static final String EXSD_MANIFEST_XML_STORE_CLASS_ID = "org.tizen.nativecpp.misc.core.NewManifestXmlStore";
+    
+    /**
+     * Set project of this xml store.  
+     * @param project  - project in which xml is stored.
+     */
+    public void setProject(IProject project);
+    
+    /**
+     * parsing xml files and load to this xml store.
+     */
+    public boolean loadXml();
+    
+    /**
+     * Return icon file list of this xml store.
+     * @return list of icon files.
+     */
+    public List<String> getIconFileList();
+    
+    /**
+     * Add appid list to the xml store.  
+     * @param appIdList  - app id list to add this xml store.
+     * @deprecated Not used anymore for multi app process. We will remove this method after enough test.
+     */
+    @Deprecated
+    public void addAppIdList(List<String> appIdList);
+    
+    /**
+     * merge app data.  
+     * @param refAppXml  - xml store app data of which is merged into this xml store.
+     */
+    public void mergeAppData(IXMLStore refAppXml);
+    
+    /**
+     * Store this xml store to the file.
+     * @param multiAppFile  - files to store this xml store
+     * @return true if store is success, fales if not.
+     */
+    public boolean storeXml(final IFile multiAppFile);
+    
+    /**
+     * get xml data id of this xml store.
+     * @return xml data id.
+     * @deprecated Now, we implement this method in NewManifestXMLStore.
+     * However, NewManifestXMLStore will not be used anymore.
+     * Soon, NewApplicationXMLStore will implement this method. 
+     */
+    @Deprecated
+    public String getXMLDataId();
+    
+    /**
+     * merge privilege data.  
+     * @param refManifestl  - xml store privilege data of which is merged into this xml store.
+     */
+    public void mergePrivData(IXMLStore refManifest);
+
+    /**
+     * Generates and returns 10-digit application id.
+     */
+    public String generateAppId();
+    
+    /**
+     * Resets application id.
+     */
+    public boolean resetAppId();
+    
+    /**
+     * Returns application type.
+     * @return application type.
+     */
+    public TizenProjectType getApplicationType();
+    
+    /**
+     * Returns application's executable files.
+     * @return application's executable files.
+     */
+    public List<String> getExecutableNames();
+}
index 2b4466d..7a63bfa 100644 (file)
@@ -25,6 +25,7 @@
 
 package org.tizen.nativecommon;
 
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.tizen.common.util.OSChecker;
 
@@ -38,11 +39,44 @@ public class PathUtil {
         else if(OSChecker.isWindows()) {
             if(path.matches("/[[a-z][A-Z]]/.*")) {
                 char alphabet = path.charAt(1);
-                return new Path(path.replaceFirst("/[[a-z][A-Z]]/", alphabet + ":/")).toOSString();                
+                return new Path(path.replaceFirst("/[[a-z][A-Z]]/", alphabet + ":/")).toOSString();
             }
             else return new Path(path).toOSString();
         }
         else return path;
     }
 
+    /**
+     * Checks whether path1 is the same as path2.
+     * @return <code>true</code> if path1 is the same as path2, and <code>false</code> otherwise
+     *
+     * Similar to IPath.equals(Object obj), but takes case sensitivity of the file system
+     * into account.
+     * @see org.eclipse.cdt.utils.PathUtil#PathUtil()
+     */
+    public static boolean equalPath(IPath path1, IPath path2) {
+        // Check leading separators
+        if (path1.isAbsolute() != path2.isAbsolute() || path1.isUNC() != path2.isUNC()) {
+            return false;
+        }
+        int i = path1.segmentCount();
+        // Check segment count
+        if (i != path2.segmentCount())
+            return false;
+        // Check segments in reverse order - later segments more likely to differ
+        boolean caseSensitive = !OSChecker.isWindows();
+        while (--i >= 0) {
+            if (!(caseSensitive ?
+                    path1.segment(i).equals(path2.segment(i)) :
+                    path1.segment(i).equalsIgnoreCase(path2.segment(i)))) {
+                return false;
+            }
+        }
+        // Check device last (least likely to differ)
+        if (path1.getDevice() == null) {
+            return path2.getDevice() == null;
+        } else {
+            return path1.getDevice().equalsIgnoreCase(path2.getDevice());
+        }
+    }
 }
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/ProjectDirtyChecker.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/ProjectDirtyChecker.java
new file mode 100644 (file)
index 0000000..20bb3cf
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+* ProjectDirtyChecker.java
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5225.kim@samsung.com>
+* Gun Kim <gune.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.nativecommon;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.internal.dtree.AbstractDataTreeNode;
+import org.eclipse.core.internal.dtree.DeltaDataTree;
+import org.eclipse.core.internal.events.BuildCommand;
+import org.eclipse.core.internal.events.BuilderPersistentInfo;
+import org.eclipse.core.internal.events.ResourceComparator;
+import org.eclipse.core.internal.resources.ICoreConstants;
+import org.eclipse.core.internal.resources.Project;
+import org.eclipse.core.internal.resources.Workspace;
+import org.eclipse.core.internal.watson.ElementTree;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+
+@SuppressWarnings({ "restriction" })
+public class ProjectDirtyChecker {
+       IProject project;
+       List<String> deltaFilterDataList;
+       
+       public ProjectDirtyChecker(IProject project) {
+               this.project = project;
+       }
+       public void setDeltaFilter( List<String> deltaFilterDataList){
+               this.deltaFilterDataList = deltaFilterDataList;
+       }
+       
+       public boolean isDirtyProject() {
+               if ( getOldTree(project, getBuilder(project)) == null ) {
+                       return true;
+               }
+               AbstractDataTreeNode deltaNode = getDeltaTreeNode();
+               if (deltaNode != null) {
+                       for( AbstractDataTreeNode node : deltaNode.getChildren() ) {
+                               if ( isContainDeltaFilterDataList(node) == false ) {
+                                       return true;
+                               }
+                       }
+                       return false;
+               }
+               else {
+                       return false;
+               }
+       }
+       
+       public AbstractDataTreeNode getDeltaTreeNode() {
+               ElementTree oldTree = getOldTree(project, getBuilder(project));
+               ElementTree currentTree = ((Workspace) project.getWorkspace()).getElementTree();
+               AbstractDataTreeNode deltaNode = null;
+               
+               if ( oldTree != null ) {
+                       DeltaDataTree currentDelta = currentTree.getDataTree().forwardDeltaWith(oldTree.getDataTree(), ResourceComparator.getBuildComparator());
+                       deltaNode = currentDelta.findNodeAt(project.getFullPath());
+               }
+               
+               return deltaNode;
+       }
+       
+       private boolean isContainDeltaFilterDataList( AbstractDataTreeNode deltaNode ) {
+               String splitData[] = null;
+               String deltaName = deltaNode.getName();
+               for ( String deltaFilterData : deltaFilterDataList ) {
+                       splitData = deltaFilterData.split("/");
+                       if ( splitData.length == 1 ) {
+                               if ( deltaName.equals(splitData[0]) ) {
+                                       return true;
+                               }
+                       }
+                       else if (splitData.length > 1 ) {
+                               if ( multiDepthChecker(splitData, deltaNode) ) {
+                                       return true;
+                               }
+                       }
+               }
+               return false;
+       }
+       
+       private boolean multiDepthChecker(String[] splitData, AbstractDataTreeNode deltaNode) {
+               String deltaName = deltaNode.getName();
+               AbstractDataTreeNode[] childrenNode = null;
+
+               if ( deltaName.equals(splitData[0]) ) {
+                       for ( int i = 1 ; i < splitData.length ; i++ ) {
+                               childrenNode = deltaNode.getChildren();
+                               for ( int j = 0 ; j < childrenNode.length ; j++ ) {
+                                       if ( childrenNode[j].getName().equals(splitData[i]) ) {
+                                               deltaNode = childrenNode[j];
+                                               break;
+                                       }
+                                       if ( j == childrenNode.length - 1) {
+                                               return false;
+                                       }
+                               }
+                               if ( i == splitData.length - 1) {
+                                       return true;
+                               }
+                       }
+               }
+               
+               return false;
+       }
+       
+       private IncrementalProjectBuilder getBuilder(IProject targetProj) {
+               ICommand[] commands = ((Project) targetProj).internalGetDescription().getBuildSpec(false);
+               IncrementalProjectBuilder targetBuilder = (IncrementalProjectBuilder) ((BuildCommand) commands[0]).getBuilders();
+               return targetBuilder;
+       }
+       
+       private ElementTree getOldTree(IProject targetProj, IncrementalProjectBuilder builder) {
+               ElementTree oldTree = null;
+               if (builder != null) {
+                       try {
+                               Class<?> c = Class.forName("org.eclipse.core.internal.events.InternalBuilder");
+                               Method m = c.getDeclaredMethod("getLastBuiltTree");
+                               m.setAccessible(true);
+                               oldTree = (ElementTree) m.invoke(builder);
+                       } catch (Exception e) {
+                               e.printStackTrace();
+                       }
+               } else {
+                       ArrayList<?> infos = null;
+                       try {
+                               infos = (ArrayList<?>) targetProj.getSessionProperty(ICoreConstants.K_BUILD_LIST);
+                       } catch (CoreException e) {
+                               e.printStackTrace();
+                       }
+                       BuilderPersistentInfo nameMatch = null;
+                       if ( infos != null ) {
+                               for ( Iterator<?> it = infos.iterator() ; it.hasNext() ; ) {
+                                       BuilderPersistentInfo info = (BuilderPersistentInfo) it.next();
+                                       String builderName = null;
+                                       try {
+                                               builderName = targetProj.getDescription().getBuildSpec()[0].getBuilderName();
+                                       } catch (CoreException e) {
+                                               e.printStackTrace();
+                                       }
+                                       if ( info.getBuilderName().equals(builderName) ) {
+                                               if ( nameMatch == null )
+                                                       nameMatch = info;
+                                       }
+                               }
+                               if ( nameMatch != null ) {
+                                       oldTree = nameMatch.getLastBuiltTree();
+                               }
+                       }
+               }
+               return oldTree;
+       }
+}
index 1fadb4a..886693d 100644 (file)
 
 package org.tizen.nativecommon;
 
+import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.make.core.IMakeBuilderInfo;
+import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.PlatformUI;
+import org.tizen.common.TizenProjectType;
+import org.tizen.common.util.PluginUtil;
+import org.tizen.common.util.log.Logger;
+import org.tizen.nativecommon.launch.CppProjectLaunchCommand;
+import org.tizen.nativecommon.launch.IProjectLaunchCommand;
 
 public class ProjectUtil {
-       private static IProject getProject(final Object[] elements) {
-               for( Object element : elements ){
-                       if (element instanceof IAdaptable) {
-                               IResource r = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
-                               if (r != null) {
-                                       return r.getProject();
-                               }
-                       }
-               }
-
-               return null;
-       }
-
-       public static IProject getProject(Object sourcePart, Object selection){
-               IProject tempProj = null;
-               if (selection instanceof IStructuredSelection) {
-                       tempProj = getProject(((IStructuredSelection) selection).toArray());
-               }
-
-               if( tempProj == null){
-                       if (sourcePart instanceof IEditorPart) {
-                               tempProj = getProject(new Object[] { ((IEditorPart)sourcePart).getEditorInput()});
-                       }
-               }
-
-               if( tempProj == null){
-                       return null;
-               }
-
-               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( tempProj );
-               if (info != null) {
-                       return tempProj;
-               } else {
-                       return null;
-               }
-       }
-
-       public static IProject getProject(){
-               IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-               if( page == null){
-                       return null;
-               }
-
-               IEditorPart editorPart = page.getActiveEditor();
-               ISelection selection = page.getSelection();
-
-               return getProject(editorPart, selection);
-       }
+    private static IProject getProject(final Object[] elements) {
+        for (Object element : elements) {
+            if (element instanceof IAdaptable) {
+                IResource r = (IResource) ((IAdaptable) element)
+                        .getAdapter(IResource.class);
+                if (r != null) {
+                    return r.getProject();
+                }
+            }
+        }
+
+        return null;
+    }
+
+    public static IProject getProject(Object sourcePart, Object selection) {
+        IProject tempProj = null;
+        if (selection instanceof IStructuredSelection) {
+            tempProj = getProject(((IStructuredSelection) selection).toArray());
+        }
+
+        if (tempProj == null) {
+            if (sourcePart instanceof IEditorPart) {
+                tempProj = getProject(new Object[] { ((IEditorPart) sourcePart)
+                        .getEditorInput() });
+            }
+        }
+
+        if (tempProj == null) {
+            return null;
+        }
+
+        IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(tempProj);
+        if (info != null) {
+            return tempProj;
+        } else {
+            return null;
+        }
+    }
+
+    public static IProject getProject() {
+        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        if (page == null) {
+            return null;
+        }
+
+        IEditorPart editorPart = page.getActiveEditor();
+        ISelection selection = page.getSelection();
+
+        return getProject(editorPart, selection);
+    }
+
+    public static IProject getProject(ILaunchConfiguration config) throws CoreException {
+        String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
+        if (projectName == null || projectName.equals(""))
+            return null;
+        return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+    }
+
+    public static String getArtefactName(IProject project) {
+        IConfiguration configuration = ManagedBuildManager.getBuildInfo(project).getDefaultConfiguration();
+        String artifactName = null;
+        if (configuration != null) {
+            artifactName = configuration.getArtifactName();
+
+            if ("${ProjName}".equals(artifactName))
+                return project.getName();
+            else
+                return artifactName;
+        }
+        return null;
+    }
+
+    public static IConfiguration getDefaultConfiguration(IProject project) {
+        IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
+        if (buildInfo != null)
+            return buildInfo.getDefaultConfiguration();
+        return null;
+    }
+
+    public static String getArtifactExtension(IProject project) {
+        IConfiguration configuration = getDefaultConfiguration(project);
+        if (configuration != null)
+            return configuration.getArtifactExtension();
+        return null;
+    }
+
+    public static String getBinaryPrefix(IProject project) {
+        IConfiguration configuration = getDefaultConfiguration(project);
+        if (configuration != null) {
+            String ext = getArtifactExtension(project);
+            return configuration.getOutputPrefix( configuration.getOutputExtension(ext));
+        }
+        return null;
+    }
+
+    public static String getBinaryName(IProject project) {
+        String binary = getArtefactName(project);
+        if (binary == null)
+            return null;
+        String ext = getArtifactExtension(project);
+        if (ext != null)
+            binary = binary.concat(".").concat(ext);
+        String prefix = getBinaryPrefix(project);
+        if (prefix != null)
+            binary = prefix.concat(binary);
+        return binary;
+    }
+
+    public static String getExecutableName(ILaunchConfiguration config) throws CoreException {
+        IPath exeFile = CDebugUtils.verifyProgramPath(config);
+        String exename = null;
+        exename = exeFile.toFile().getName();
+        return exename;
+    }
+
+    public static void refreshResources(IProject project) throws CoreException {
+        if(!project.isSynchronized(IResource.DEPTH_INFINITE))
+            project.refreshLocal(IResource.DEPTH_INFINITE, null);
+    }
+
+    public static String getProjectArtefactType(IProject project) {
+        IManagedBuildInfo info =  ManagedBuildManager.getBuildInfo( project);
+        if ( info == null)
+            return null;
+        IConfiguration cfg =info.getDefaultConfiguration();
+        if ( cfg == null)
+            return null;
+        IManagedProject managedProject = cfg.getManagedProject();
+        if ( managedProject == null)
+            return null;
+        IProjectType projectType = managedProject.getProjectType();
+        if ( projectType == null)
+            return null;
+        IBuildPropertyValue buildArtefactType =  projectType.getBuildArtefactType();
+        if ( buildArtefactType == null)
+            return null;
+
+        return buildArtefactType.getId();
+    }
+
+    public static TizenProjectType getTizenProjectType(IProject project) {
+        IProjectLaunchCommand manifest = getProjectManifest(project);
+
+        if (manifest != null)
+            return manifest.getNativeProjectType();
+
+        return null;
+    }
+
+    public static IProjectLaunchCommand getProjectManifest(IProject project) {
+        IProjectLaunchCommand manifest = null;
+
+        // In case of c project, not implement yet
+        //manifest = (IProjectLaunchCommand)project.getAdapter(CProjectLaunchCommand.class);
+        //if (manifest != null)
+        //    return manifest;
+        manifest = (IProjectLaunchCommand)project.getAdapter(CppProjectLaunchCommand.class);
+        if (manifest != null)
+            return manifest;
+
+        return null;
+    }
+
+    /**
+     * Set project "build automatically" menu enable.
+     * Instead of the method, can also use plugin_customization.ini org.eclipse.core.resources/description.autobuilding=true/false
+     * @param enable
+     * @return isAutoBuilding
+     * @throws CoreException
+     */
+    public static boolean enableAutoBuild(boolean enable) throws CoreException {
+        IWorkspace workspace= ResourcesPlugin.getWorkspace();
+        IWorkspaceDescription desc = workspace.getDescription();
+        boolean isAutoBuilding = desc.isAutoBuilding();
+        if (isAutoBuilding != enable) {
+            desc.setAutoBuilding(enable);
+            workspace.setDescription(desc);
+        }
+        return isAutoBuilding;
+    }
+
+    /**
+     * Set build on resource save.
+     * Change the boolean value on "C/C++ Build -> Behaviour -> Build on resource save"
+     * @see org.tizen.nativecommon.build.CommonBuildConstants#DEFAULT_AUTOBUILD
+     * @param project
+     * @param enable
+     * @throws CoreException
+     */
+    public static void enableProjectAutoBuild(IProject project, boolean enable) throws CoreException {
+        IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+        IConfiguration cfg = info.getDefaultConfiguration();
+
+        if (cfg == null)
+            return;
+
+        IBuilder bldr = cfg.getEditableBuilder();
+        bldr.setAutoBuildEnable(enable);
+        bldr.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "all"); //$NON-NLS-1$
+        ManagedBuildManager.saveBuildInfo(project, true);
+    }
+
+    /**
+     * Returns <code>IXMLStore</code>
+     * 
+     * This is to get the cpp manifest store in case of tizen cpp projects.
+     * @param project
+     * @return IXMLStore
+     */
+    public static IXMLStore getXmlStore(IProject project) {
+        return getXmlStore(project, IXMLStore.EXSD_MANIFEST_XML_STORE_CLASS_ID);
+    }
+
+    /**
+     * Returns <code>IXMLStore</code>
+     * 
+     * This is to get the cpp app manifest store in case of tizen cpp projects.
+     * @deprecated Use org.tizen.nativecommon.ProjectUtil#getXmlStore instead.
+     * @param project
+     * @return IXMLStore
+     */
+    public static IXMLStore getAppXmlStore(IProject project) {
+        return getXmlStore(project, IXMLStore.EXSD_APP_XML_STORE_CLASS_ID);
+    }
+
+    private static IXMLStore getXmlStore(IProject project, String loadClassId) {
+        IXMLStore xmlManager = null;
+
+        try {
+            xmlManager = (IXMLStore)PluginUtil.loadClass(IXMLStore.EXSD_STORE_EXTENSION_POINT_ID, loadClassId);
+        } catch (CoreException e) {
+            Logger.error("Exception occurred while creating class (extension point : " + IXMLStore.EXSD_STORE_EXTENSION_POINT_ID + 
+                    " , class ID: " + loadClassId, e);
+        }
+        xmlManager.setProject(project);
+        xmlManager.loadXml();
+        return xmlManager;
+
+    }
 }
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/TizenNativeException.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/TizenNativeException.java
new file mode 100644 (file)
index 0000000..f53e9e0
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+* NativeCommon
+*
+* 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.nativecommon;
+
+
+public class TizenNativeException extends Exception {
+
+    private static final long serialVersionUID = 7613337471602038311L;
+
+    public TizenNativeException() {
+        super();
+    }
+
+    public TizenNativeException(String message) {
+        super(message);
+    }
+}
index 8588bbe..47b1ce9 100644 (file)
@@ -68,7 +68,7 @@ import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Slider;
 
-import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.core.application.InstallPathConfig;
 import org.tizen.common.util.FileUtil;
 import org.tizen.nativecommon.apihover.doxygen.DoxygenHandler;
 
index d94aa76..1de842a 100644 (file)
@@ -26,7 +26,7 @@
 
 package org.tizen.nativecommon.apihover;
 
-import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.core.application.InstallPathConfig;
 
 public class IndexFileInfo {
        private String name;
index 42c7f61..d6e492d 100644 (file)
@@ -42,7 +42,7 @@ import org.eclipse.cdt.ui.IFunctionSummary;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.Platform;
 
-import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.core.application.InstallPathConfig;
 
 //import org.linuxplatform.connection.api.EnvironmentControl;
 
index 2255fd2..dc75d19 100644 (file)
@@ -35,7 +35,7 @@ import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Platform;
 import org.osgi.framework.Bundle;
 
-import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.core.application.InstallPathConfig;
 import org.tizen.common.util.FileUtil;
 import org.tizen.common.util.OSChecker;
 
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileGenObjectAction.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileGenObjectAction.java
deleted file mode 100644 (file)
index 4d08a18..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-*  NativeApp
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@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.nativecommon.build;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-
-public class BuildDataFileGenObjectAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
-
-       protected IWorkbenchWindow window;
-       BuildDataFileSelectConfDialog configDlg;
-       protected IProject project;
-       
-       public BuildDataFileGenObjectAction() {
-               this.window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-       }
-       
-       @Override
-       public void run(IAction action) {               
-               configDlg = new BuildDataFileSelectConfDialog(window.getShell(), project);
-               configDlg.open();
-       }
-
-       @Override
-       public void selectionChanged(IAction action, ISelection selection) {
-               Object obj = null;
-               
-               if (selection instanceof TreeSelection) {
-                       TreeSelection _selection = (TreeSelection)selection;
-                       
-                       if (_selection != null) {
-                               obj = _selection.getFirstElement();
-                       }
-               }
-               
-               if (obj != null) {
-                       if (obj instanceof IProject) {
-                               this.project = (IProject) obj;
-                       }
-               }
-       }
-       
-       @Override
-       public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-               // do nothing
-       }
-
-       @Override
-       public void dispose() {
-               // do nothing
-       }
-
-       @Override
-       public void init(IWorkbenchWindow window) {             
-       }
-               
-}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileGenerator.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileGenerator.java
deleted file mode 100644 (file)
index 14a6614..0000000
+++ /dev/null
@@ -1,3774 +0,0 @@
-/*
-*  NativeApp
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@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.nativecommon.build;
-
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-import java.util.Map.Entry;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.settings.model.CSourceEntry;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICSettingEntry;
-import org.eclipse.cdt.core.settings.model.ICSourceEntry;
-import org.eclipse.cdt.core.settings.model.util.CDataUtil;
-import org.eclipse.cdt.core.settings.model.util.IPathSettingsContainerVisitor;
-import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
-import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IBuildObject;
-import org.eclipse.cdt.managedbuilder.core.IBuilder;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IFileInfo;
-import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
-import org.eclipse.cdt.managedbuilder.core.IInputType;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
-import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
-import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOutputType;
-import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
-import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
-import org.eclipse.cdt.managedbuilder.internal.core.Tool;
-import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
-import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
-import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
-import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCalculator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyPreBuild;
-import org.eclipse.cdt.managedbuilder.makegen.gnu.IManagedBuildGnuToolInfo;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
-import org.tizen.nativecommon.build.ProjectTypeManager;
-import org.tizen.nativecommon.build.exception.SBIException;
-
-
-public class BuildDataFileGenerator {
-       
-       public class testDependencyGroupInfo {
-               //  Member Variables
-               String groupBuildVar;
-               boolean conditionallyInclude;
-//             ArrayList groupFiles;
-               
-               //  Constructor
-               public testDependencyGroupInfo(String groupName, boolean bConditionallyInclude) {
-                       groupBuildVar = groupName;
-                       conditionallyInclude = bConditionallyInclude;
-                       //  Note: not yet needed
-//                     groupFiles = null;
-               }
-       }
-
-       /**
-        * This class walks the delta supplied by the build system to determine
-        * what resources have been changed. The logic is very simple. If a
-        * buildable resource (non-header) has been added or removed, the directories
-        * in which they are located are "dirty" so the makefile fragments for them
-        * have to be regenerated.
-        * <p>
-        * The actual dependencies are recalculated as a result of the build step
-        * itself. We are relying on make to do the right things when confronted
-        * with a dependency on a moved header file. That said, make will treat
-        * the missing header file in a dependency rule as a target it has to build
-        * unless told otherwise. These dummy targets are added to the makefile
-        * to avoid a missing target error.
-        */
-       public class ResourceDeltaVisitor implements IResourceDeltaVisitor {
-               private final BuildDataFileGenerator generator;
-//             private IManagedBuildInfo info;
-               private final IConfiguration config;
-
-               /**
-                * The constructor
-                */
-               public ResourceDeltaVisitor(BuildDataFileGenerator generator, IManagedBuildInfo info) {
-                       this.generator = generator;
-                       this.config = info.getDefaultConfiguration();
-               }
-
-               public ResourceDeltaVisitor(BuildDataFileGenerator generator, IConfiguration cfg) {
-                       this.generator = generator;
-                       this.config = cfg;
-               }
-
-               /* (non-Javadoc)
-                * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
-                */
-               public boolean visit(IResourceDelta delta) throws CoreException {
-                       // Should the visitor keep iterating in current directory
-                       boolean keepLooking = false;
-                       IResource resource = delta.getResource();
-                       IResourceInfo rcInfo = config.getResourceInfo(resource.getProjectRelativePath(), false);
-                       IFolderInfo fo = null;
-                       boolean isSource = isSource(resource.getProjectRelativePath());
-                       if(rcInfo instanceof IFolderInfo){
-                               fo = (IFolderInfo)rcInfo;
-                       }
-                       // What kind of resource change has occurred
-                       if(/*!rcInfo.isExcluded() && */isSource){
-                               if (resource.getType() == IResource.FILE) {
-                                       String ext = resource.getFileExtension();
-                                       switch (delta.getKind()) {
-                                               case IResourceDelta.ADDED:
-                                                       if (!generator.isGeneratedResource(resource)) {
-                                                               // This is a source file so just add its container
-                                                               if (fo == null || fo.buildsFileType(ext)) {
-                                                                       generator.appendModifiedSubdirectory(resource);
-                                                               }
-                                                       }
-                                                       break;
-                                               case IResourceDelta.REMOVED:
-                                                       // we get this notification if a resource is moved too
-                                                       if (!generator.isGeneratedResource(resource)) {
-                                                               // This is a source file so just add its container
-                                                               if (fo == null || fo.buildsFileType(ext)) {
-                                                                       generator.appendDeletedFile(resource);
-                                                                       generator.appendModifiedSubdirectory(resource);
-                                                               }
-                                                       }
-                                                       break;
-                                               default:
-                                                       keepLooking = true;
-                                                       break;
-                                       }
-                               }
-
-                               if (resource.getType() == IResource.FOLDER) {
-                                       // I only care about delete event
-                                       switch (delta.getKind()) {
-                                               case IResourceDelta.REMOVED:
-                                                       if (!generator.isGeneratedResource(resource)) {
-                                                               generator.appendDeletedSubdirectory((IContainer)resource);
-                                                       }
-                                                       break;
-                                       }
-                               }
-                       }
-                       if (resource.getType() == IResource.PROJECT) {
-                               // If there is a zero-length delta, something the project depends on has changed so just call make
-                               IResourceDelta[] children = delta.getAffectedChildren();
-                               if (children != null && children.length > 0) {
-                                       keepLooking = true;
-                               }
-                       } else {
-                               // If the resource is part of the generated directory structure don't recurse
-                               if (resource.getType() == IResource.ROOT ||
-                                               (isSource && !generator.isGeneratedResource(resource))) {
-                                       keepLooking = true;
-                               }
-                       }
-
-                       return keepLooking;
-               }
-       }
-       
-       /**
-        * This class is used to recursively walk the project and determine which
-        * modules contribute buildable source files.
-        */
-       protected class ResourceProxyVisitor implements IResourceProxyVisitor {
-               private final BuildDataFileGenerator generator;
-               private final IConfiguration config;
-//             private IManagedBuildInfo info;
-
-               /**
-                * Constructs a new resource proxy visitor to quickly visit project
-                * resources.
-                */
-               public ResourceProxyVisitor(BuildDataFileGenerator generator, IManagedBuildInfo info) {
-                       this.generator = generator;
-                       this.config = info.getDefaultConfiguration();
-               }
-
-               public ResourceProxyVisitor(BuildDataFileGenerator generator, IConfiguration cfg) {
-                       this.generator = generator;
-                       this.config = cfg;
-               }
-
-               /* (non-Javadoc)
-                * @see org.eclipse.core.resources.IResourceProxyVisitor#visit(org.eclipse.core.resources.IResourceProxy)
-                */
-               public boolean visit(IResourceProxy proxy) throws CoreException {
-                       // No point in proceeding, is there
-                       if (generator == null) {
-                               return false;
-                       }
-
-                       IResource resource = proxy.requestResource();
-                       boolean isSource = isSource(resource.getProjectRelativePath());
-
-                       // Is this a resource we should even consider
-                       if (proxy.getType() == IResource.FILE) {
-                               // If this resource has a Resource Configuration and is not excluded or
-                               // if it has a file extension that one of the tools builds, add the sudirectory to the list
-//                             boolean willBuild = false;
-                               IResourceInfo rcInfo = config.getResourceInfo(resource.getProjectRelativePath(), false);
-                               if (isSource/* && !rcInfo.isExcluded()*/) {
-                                       boolean willBuild = false;
-                                       if(rcInfo instanceof IFolderInfo){
-                                               String ext = resource.getFileExtension();
-                                               if (((IFolderInfo)rcInfo).buildsFileType(ext) &&
-                                                               // If this file resource is a generated resource, then it is uninteresting
-                                                               !generator.isGeneratedResource(resource)) {
-                                                       willBuild = true;
-                                               }
-                                       } else {
-                                               willBuild = true;
-                                       }
-
-                                       if(willBuild)
-                                               generator.appendBuildSubdirectory(resource);
-                               }
-//                             if (willBuild) {
-//                                     if ((resConfig == null) || (!(resConfig.isExcluded()))) {
-//                                             generator.appendBuildSubdirectory(resource);
-//                                     }
-//                             }
-                               return false;
-                       } else if (proxy.getType() == IResource.FOLDER){
-
-                               if(!isSource || generator.isGeneratedResource(resource))
-                                       return false;
-                               return true;
-                       }
-
-                       // Recurse into subdirectories
-                       return true;
-               }
-
-       }
-       
-       public final String AT = "@";   //$NON-NLS-1$
-       public final String COLON = ":";        //$NON-NLS-1$
-       public final int COLS_PER_LINE = 80;
-       public final String COMMENT_SYMBOL = "#";       //$NON-NLS-1$
-    public final String DOLLAR_SYMBOL = "$";        //$NON-NLS-1$ 
-       public final String DEP_EXT = "d";      //$NON-NLS-1$
-       public final String DEPFILE_NAME = "subdir.dep";        //$NON-NLS-1$
-       public final String DOT = ".";  //$NON-NLS-1$
-    public final String DASH = "-"; //$NON-NLS-1$   
-       public final String ECHO = "echo";      //$NON-NLS-1$
-       public final String IN_MACRO = "$<";    //$NON-NLS-1$
-       public final String LINEBREAK = "\\\n"; //$NON-NLS-1$
-       public final String LOGICAL_AND = "&&"; //$NON-NLS-1$
-       public final String MAKEFILE_DEFS = "makefile.defs"; //$NON-NLS-1$
-       public final String MAKEFILE_INIT = "makefile.init"; //$NON-NLS-1$
-       public final String MAKEFILE_NAME = "makefile"; //$NON-NLS-1$
-       public final String MAKEFILE_TARGETS = "makefile.targets"; //$NON-NLS-1$
-    public final String MAKE = "$(MAKE)";   //$NON-NLS-1$ 
-    public final String NO_PRINT_DIR = "--no-print-directory";      //$NON-NLS-1$ 
-
-       public final String MODFILE_NAME = "subdir.mk"; //$NON-NLS-1$
-       public final String NEWLINE = System.getProperty("line.separator");     //$NON-NLS-1$
-       public final String OBJECTS_MAKFILE = "objects.mk"; //$NON-NLS-1$
-       public final String OUT_MACRO = "$@";   //$NON-NLS-1$
-       public final String ROOT = "..";        //$NON-NLS-1$
-       public final String SEPARATOR = "/";    //$NON-NLS-1$
-       public final String SINGLE_QUOTE = "'"; //$NON-NLS-1$
-       public final String SRCSFILE_NAME = "sources.mk"; //$NON-NLS-1$ 
-       public final String TAB = "\t"; //$NON-NLS-1$
-       public final String WHITESPACE = " ";   //$NON-NLS-1$
-       public final String WILDCARD = "%";     //$NON-NLS-1$
-       
-       // Generation error codes
-       public final int SPACES_IN_PATH = 0;
-       public final int NO_SOURCE_FOLDERS = 1;
-
-       
-       // String constants for makefile contents and messages
-       private final String COMMENT = "MakefileGenerator.comment";     //$NON-NLS-1$
-       //private static final String AUTO_DEP = COMMENT + ".autodeps"; //$NON-NLS-1$
-       //private static final String MESSAGE = "ManagedMakeBuilder.message";   //$NON-NLS-1$
-       //private static final String BUILD_ERROR = MESSAGE + ".error"; //$NON-NLS-1$
-
-       //private static final String DEP_INCL = COMMENT + ".module.dep.includes";      //$NON-NLS-1$
-       private final String HEADER = COMMENT + ".header"; //$NON-NLS-1$
-
-       protected final String MESSAGE_FINISH_BUILD = ManagedMakeMessages.getResourceString("MakefileGenerator.message.finish.build");  //$NON-NLS-1$
-       protected final String MESSAGE_FINISH_FILE = ManagedMakeMessages.getResourceString("MakefileGenerator.message.finish.file");    //$NON-NLS-1$
-       protected final String MESSAGE_START_BUILD = ManagedMakeMessages.getResourceString("MakefileGenerator.message.start.build");    //$NON-NLS-1$
-       protected final String MESSAGE_START_FILE = ManagedMakeMessages.getResourceString("MakefileGenerator.message.start.file");      //$NON-NLS-1$
-       protected final String MESSAGE_START_DEPENDENCY = ManagedMakeMessages.getResourceString("MakefileGenerator.message.start.dependency");  //$NON-NLS-1$
-       protected final String MESSAGE_NO_TARGET_TOOL = ManagedMakeMessages.getResourceString("MakefileGenerator.message.no.target");   //$NON-NLS-1$
-       //private static final String MOD_INCL = COMMENT + ".module.make.includes";     //$NON-NLS-1$
-       private final String MOD_LIST = COMMENT + ".module.list";       //$NON-NLS-1$
-       private final String MOD_VARS = COMMENT + ".module.variables";  //$NON-NLS-1$
-       private final String MOD_RULES = COMMENT + ".build.rule";       //$NON-NLS-1$
-       private final String BUILD_TOP = COMMENT + ".build.toprules";   //$NON-NLS-1$
-       private final String ALL_TARGET = COMMENT + ".build.alltarget"; //$NON-NLS-1$
-       private final String MAINBUILD_TARGET = COMMENT + ".build.mainbuildtarget";     //$NON-NLS-1$
-       private final String BUILD_TARGETS = COMMENT + ".build.toptargets";     //$NON-NLS-1$
-       private final String SRC_LISTS = COMMENT + ".source.list";      //$NON-NLS-1$
-
-       private final String EMPTY_STRING = ""; //$NON-NLS-1$
-       private final String[] EMPTY_STRING_ARRAY = new String[0];
-
-       private final String OBJS_MACRO = "OBJS";       //$NON-NLS-1$
-       private final String MACRO_ADDITION_ADDPREFIX_HEADER = "${addprefix ";  //$NON-NLS-1$
-       private final String MACRO_ADDITION_ADDPREFIX_SUFFIX = "," + WHITESPACE + LINEBREAK;    //$NON-NLS-1$
-       private final String MACRO_ADDITION_PREFIX_SUFFIX = "+=" + WHITESPACE + LINEBREAK;      //$NON-NLS-1$
-       private final String PREBUILD = "pre-build"; //$NON-NLS-1$
-       private final String MAINBUILD = "main-build"; //$NON-NLS-1$
-       private final String POSTBUILD = "post-build"; //$NON-NLS-1$
-       private final String SECONDARY_OUTPUTS = "secondary-outputs"; //$NON-NLS-1$
-       
-       public String ECHO_BLANK_LINE = ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE;
-       private final IPath DOT_SLASH_PATH = new Path("./");  //$NON-NLS-1$
-
-       // Enumerations
-       public static final int
-                       PROJECT_RELATIVE = 1,
-                       PROJECT_SUBDIR_RELATIVE = 2,
-                       ABSOLUTE = 3;
-
-       class ToolInfoHolder {
-               ITool[] buildTools;
-               boolean[] buildToolsUsed;
-               BuildDataFileManagedBuildToolInfo[] gnuToolInfos;
-               Set<String> outputExtensionsSet;
-               List<IPath> dependencyMakefiles;
-       }
-       
-       // Local variables needed by generator
-       private String buildTargetName;
-       private String buildTargetExt;
-       private IConfiguration config;
-       private IBuilder builder;
-//     private ITool[] buildTools;
-//     private boolean[] buildToolsUsed;
-//     private testManagedBuildToolInfo[] gnuToolInfos;
-       private PathSettingsContainer toolInfos;
-       private Vector<IResource> deletedFileList;
-       private Vector<IResource> deletedDirList;
-//     private IManagedBuildInfo info;
-//     private IConfiguration cfg
-       private Vector<IResource> invalidDirList;
-       /** Collection of Folders in which sources files have been modified */
-       private Collection<IContainer> modifiedList;
-       private IProgressMonitor monitor;
-       private IProject project;
-       private IResource[] projectResources;
-       private Vector<String> ruleList;
-       private Vector<String> depLineList;                             //  String's of additional dependency lines
-       private Vector<String> depRuleList;                             //  String's of rules for generating dependency files
-       /** Collection of Containers which contribute source files to the build */
-       private Collection<IContainer> subdirList;
-       private IPath topBuildDir;                              //  Build directory - relative to the workspace
-//     private Set outputExtensionsSet;
-       //=== Maps of macro names (String) to values (List)
-       //  Map of source file build variable names to a List of source file Path's
-       private final HashMap<String, List<IPath>> buildSrcVars = new HashMap<String, List<IPath>>();
-       //  Map of output file build variable names to a List of output file Path's
-       private final HashMap<String, List<IPath>> buildOutVars = new HashMap<String, List<IPath>>();
-       //  Map of dependency file build variable names to a List of testDependencyGroupInfo objects
-       private final HashMap<String, testDependencyGroupInfo> buildDepVars = new HashMap<String, testDependencyGroupInfo>();
-       private final LinkedHashMap<String, String> topBuildOutVars = new LinkedHashMap<String, String>();
-       // Dependency file variables
-//     private Vector dependencyMakefiles;             //  IPath's - relative to the top build directory or absolute
-
-       private ICSourceEntry srcEntries[];
-
-       public BuildDataFileGenerator() {
-               super();
-       }
-       
-       public IPath getBuildWorkingDir() {
-               if (topBuildDir != null) {
-                       return topBuildDir.removeFirstSegments(1);
-               }
-               return null;
-       }
-       
-       public boolean isGeneratedResource(IResource resource) {
-               // Is this a generated directory ...
-               IPath path = resource.getProjectRelativePath();
-               //TODO: fix to use builder output dir instead
-               String[] configNames = ManagedBuildManager.getBuildInfo(project).getConfigurationNames();
-               for (String name : configNames) {
-                       IPath root = new Path(name);
-                       // It is if it is a root of the resource pathname
-                       if (root.isPrefixOf(path)) return true;
-               }
-
-               return false;
-       }       
-       
-       public MultiStatus regenerateMakefiles(StringBuffer buffer) throws CoreException {
-               MultiStatus status;             
-               //String targetName = SLPConfigurationManager.getBuildTargetName(config);
-               String targetName = CommonConfigurationManager.getBuildTargetName(config);
-               String commandDelimiter = "";
-               if (System.getProperty("os.name").startsWith("Windows")) {
-                       commandDelimiter = "&";
-               } else {
-                       commandDelimiter = ";";
-               }
-               // Visit the resources in the project           
-               ResourceProxyVisitor visitor = new ResourceProxyVisitor(this, config);
-               project.accept(visitor, IResource.NONE);
-               
-               // See if the user has cancelled the build
-
-               // Populate the makefile if any buildable source files have been found in the project
-               if (getSubdirList().isEmpty()) {
-                       String info = ManagedMakeMessages.getFormattedString("MakefileGenerator.warning.no.source", project.getName()); //$NON-NLS-1$
-                       updateMonitor(info);
-                       status = new MultiStatus(
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.INFO,
-                                       new String(),
-                                       null);
-                       status.add(new Status (
-                                       IStatus.INFO,
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       NO_SOURCE_FOLDERS,
-                                       info,
-                                       null));
-                       return status;
-               }                       
-               
-               buffer.append("[" + config.getName() + "]\n");
-               // Create the top-level directory for the build output
-               //topBuildDir = createDirectory(config.getName());
-
-               // Get the list of subdirectories
-               // sources.mk
-               IPath srcsFilePath = topBuildDir.append(SRCSFILE_NAME);
-               IFile srcsFileHandle = null;
-               //IFile srcsFileHandle = createFile(srcsFilePath);
-               buildSrcVars.clear();
-               buildOutVars.clear();
-               buildDepVars.clear();
-               topBuildOutVars.clear();
-               
-               String sourcesLoc = srcsFilePath.lastSegment();
-               buffer.append("<FILE::" + sourcesLoc + ">\n");
-               buffer.append(populateSourcesMakefile(srcsFileHandle));
-               buffer.append("</FILE::" + sourcesLoc + ">\n");
-               
-               // Now populate the module makefiles
-               for (IResource res : getSubdirList()) {
-                       IContainer subDir = (IContainer)res;
-                       try {
-                               String FragmentMakefileLoc = subDir.getProjectRelativePath().append(MODFILE_NAME).toString();
-                               buffer.append("<FILE::" + FragmentMakefileLoc + ">\n");
-                               buffer.append(populateFragmentMakefile(subDir));
-                               buffer.append("</FILE::" + FragmentMakefileLoc + ">\n");
-                       } catch (CoreException e) {
-                               // Probably should ask user if they want to continue
-                               continue;
-                       }
-               }
-
-               // Calculate the inputs and outputs of the Tools to be generated in the main makefile
-               calculateToolInputsOutputs();
-
-               // Create the top-level makefile
-               IPath makefilePath = topBuildDir.append(MAKEFILE_NAME);
-               IFile makefileHandle = null;
-               //IFile makefileHandle = createFile(makefilePath);
-               
-               String makefileLoc = makefilePath.lastSegment();
-               buffer.append("<FILE::" + makefileLoc + ">\n");
-               buffer.append(populateTopMakefile(makefileHandle, true));
-               buffer.append("</FILE::" + makefileLoc + ">\n");        
-               
-
-               // Now finish up by adding all the object files
-               IPath objFilePath = topBuildDir.append(OBJECTS_MAKFILE);
-               IFile objsFileHandle = null;
-               //IFile objsFileHandle = createFile(objFilePath);
-               
-               String objFileLoc = objFilePath.lastSegment();
-               buffer.append("<FILE::" + objFileLoc + ">\n");
-               buffer.append(populateObjectsMakefile(objsFileHandle));
-               buffer.append("</FILE::" + objFileLoc + ">\n");
-               
-               buffer.append("<EXECUTE::build>\n");
-               buffer.append("cd $(CONFIG_PATH)"+commandDelimiter);
-               buffer.append(String.format("$(SBI_PATH) action %s -- make -options=\"clean\" \n", 
-                               targetName ));
-               buffer.append("cd $(CONFIG_PATH)"+commandDelimiter);
-               buffer.append(String.format("$(SBI_PATH) action %s -- make -options=\"all\" \n", 
-                               targetName ));
-               buffer.append("</EXECUTE::build>\n");
-               buffer.append("<EXECUTE::buildpackage>\n");
-               buffer.append("cd $(CONFIG_PATH)"+commandDelimiter);
-               buffer.append(String.format("$(SBI_PATH) action %s -- make -options=\"clean\" \n", 
-                               targetName ));
-               buffer.append("cd $(CONFIG_PATH)"+commandDelimiter);
-               buffer.append(String.format("$(SBI_PATH) action %s -- make -options=\"all\" \n", 
-                               targetName ));          
-               //CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project);
-               CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(project);
-               IPath configPath = project.getLocation().append(config.getName());
-               String packageOption = packager.getPackageOption(config, "DEB").replace(configPath.toString(), "$(CONFIG_PATH)");
-               buffer.append(String.format("$(SBI_PATH) action %s -- buildpackage %s\n",
-                               targetName, packageOption));
-               buffer.append("</EXECUTE::buildpackage>\n");                                                    
-               buffer.append("[/" + config.getName() + "]\n");         
-
-               // How did we do
-               if (!getInvalidDirList().isEmpty()) {
-                       status = new MultiStatus (
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.WARNING,
-                                       new String(),
-                                       null);
-                       // Add a new status for each of the bad folders
-                       // TODO: fix error message
-                       for (IResource dir : getInvalidDirList()) {
-                               status.add(new Status (
-                                               IStatus.WARNING,
-                                               ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                               SPACES_IN_PATH,
-                                               dir.getFullPath().toString(),
-                                               null));
-                       }
-               } else {
-                       status = new MultiStatus(
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.OK,
-                                       new String(),
-                                       null);
-               }
-               return status;
-       }
-       
-       
-       public MultiStatus regenerateMakefilesForPlatformBuild() throws CoreException {
-               MultiStatus status;             
-               String targetName = CommonConfigurationManager.getBuildTargetName(config);
-
-               // Visit the resources in the project           
-               ResourceProxyVisitor visitor = new ResourceProxyVisitor(this, config);
-               project.accept(visitor, IResource.NONE);
-               
-               // See if the user has cancelled the build
-
-               // Populate the makefile if any buildable source files have been found in the project
-               if (getSubdirList().isEmpty()) {
-                       String info = ManagedMakeMessages.getFormattedString("MakefileGenerator.warning.no.source", project.getName()); //$NON-NLS-1$
-                       updateMonitor(info);
-                       status = new MultiStatus(
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.INFO,
-                                       new String(),
-                                       null);
-                       status.add(new Status (
-                                       IStatus.INFO,
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       NO_SOURCE_FOLDERS,
-                                       info,
-                                       null));
-                       return status;
-               }                       
-               
-               // Create the top-level directory for the build output
-               topBuildDir = createDirectory("PlatformBuild");
-
-               // Get the list of subdirectories
-               // sources.mk
-               IPath srcsFilePath = topBuildDir.append(SRCSFILE_NAME);
-               IFile srcsFileHandle = createFile(srcsFilePath);
-               buildSrcVars.clear();
-               buildOutVars.clear();
-               buildDepVars.clear();
-               topBuildOutVars.clear();
-
-               populateSourcesMakefile(srcsFileHandle);
-               
-               // Now populate the module makefiles
-               for (IResource res : getSubdirList()) {
-                       IContainer subDir = (IContainer)res;
-                       try {
-
-                               StringBuffer makeBuf = populateFragmentMakefile(subDir);
-
-                               // Calculate the new directory relative to the build output
-                               IPath moduleRelativePath = subDir.getProjectRelativePath();
-                               IPath buildRoot = getBuildWorkingDir();
-                               if (buildRoot == null) continue;
-
-                               IPath moduleOutputPath = buildRoot.append(moduleRelativePath);                          // Now create the directory
-                               IPath moduleOutputDir = createDirectory(moduleOutputPath.toString());
-
-                               // Create a module makefile
-                               IFile modMakefile = createFile(moduleOutputDir.append(MODFILE_NAME));
-                               
-                               // Modify 
-                               makeBuf = modifyMakefileForPlatformBuild( makeBuf );
-                               
-                               // Save the files
-                               Util.save(makeBuf, modMakefile);
-                       } catch (CoreException e) {
-                               // Probably should ask user if they want to continue
-                               continue;
-                       }
-               }
-
-               // Calculate the inputs and outputs of the Tools to be generated in the main makefile
-               calculateToolInputsOutputs();
-
-               // Create the top-level makefile
-               StringBuffer makeBuf = populateTopMakefile(null, true);
-               makeBuf = modifyMakefileForPlatformBuild( makeBuf );
-               IPath makefilePath = topBuildDir.append(MAKEFILE_NAME);
-               IFile makefileHandle = createFile(makefilePath);
-               Util.save(makeBuf, makefileHandle);
-
-
-               // Now finish up by adding all the object files
-               IPath objFilePath = topBuildDir.append(OBJECTS_MAKFILE);
-               IFile objsFileHandle = createFile(objFilePath);
-               populateObjectsMakefile(objsFileHandle);
-
-               // How did we do
-               if (!getInvalidDirList().isEmpty()) {
-                       status = new MultiStatus (
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.WARNING,
-                                       new String(),
-                                       null);
-                       // Add a new status for each of the bad folders
-                       // TODO: fix error message
-                       for (IResource dir : getInvalidDirList()) {
-                               status.add(new Status (
-                                               IStatus.WARNING,
-                                               ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                               SPACES_IN_PATH,
-                                               dir.getFullPath().toString(),
-                                               null));
-                       }
-               } else {
-                       status = new MultiStatus(
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.OK,
-                                       new String(),
-                                       null);
-               }
-               return status;
-       }
-       
-       
-       // Change content for platform build
-       protected StringBuffer modifyMakefileForPlatformBuild( StringBuffer makeBuf )
-       {
-               String totalStr = makeBuf.toString();
-               String projectPath = project.getLocation().toString();
-               String targetID = CommonConfigurationManager.getBuildTargetName(config);
-               String rootStrapPath, CCompilerPath, CXXCompilerPath;
-               
-               try {
-                       rootStrapPath = SmartBuildInterface.getInstance().getRootstrapPath(targetID);
-                       CCompilerPath = SmartBuildInterface.getInstance().getCCompilerPath(targetID);
-                       CXXCompilerPath = SmartBuildInterface.getInstance().getCXXCompilerPath(targetID);
-               } catch (SBIException e) {
-                       return makeBuf;
-               }
-
-               if (System.getProperty("os.name").startsWith("Windows")) {
-                       projectPath = projectPath.toString().replace("/", "\\");
-               } 
-               
-               // change compiler command
-               totalStr = totalStr.replace(CCompilerPath,"gcc");
-               totalStr = totalStr.replace(CXXCompilerPath,"g++");
-               totalStr = totalStr.replace("i386-linux-gnueabi-g++","g++");
-               totalStr = totalStr.replace("arm-linux-gnueabi-g++","g++");
-               totalStr = totalStr.replace("i386-linux-gnueabi-gcc","gcc");
-               totalStr = totalStr.replace("arm-linux-gnueabi-gcc","gcc");
-               
-               // remove --sysroot option
-               totalStr = totalStr.replace( String.format("--sysroot=\"%s\"", rootStrapPath), "" ); 
-               
-               // remove other sysroot prefix
-               totalStr = totalStr.replace( rootStrapPath, "" ); 
-               
-               // modify project path to relative path
-               totalStr = totalStr.replace( projectPath, ".." );
-               
-               return new StringBuffer(totalStr);
-       }
-
-       
-       
-       private Vector<IResource> getInvalidDirList() {
-               if (invalidDirList == null) {
-                       invalidDirList = new Vector<IResource>();
-               }
-               return invalidDirList;
-       }
-       
-       protected StringBuffer populateObjectsMakefile(IFile fileHandle) throws CoreException {
-
-               // Master list of "object" dependencies, i.e. dependencies between input files and output files.
-               StringBuffer macroBuffer = new StringBuffer();
-               List<String> valueList;
-               macroBuffer.append(addDefaultHeader());
-
-               // Map of macro names (String) to its definition (List of Strings)
-               HashMap<String, List<String>> outputMacros = new HashMap<String, List<String>>();
-
-               // Add the predefined LIBS, USER_OBJS macros
-
-               // Add the libraries this project depends on
-               valueList = new ArrayList<String>();
-               String[] libs = config.getLibs(buildTargetExt);
-               for (String lib : libs) {
-                       valueList.add(lib);
-               }
-               outputMacros.put("LIBS", valueList);    //$NON-NLS-1$
-
-               // Add the extra user-specified objects
-               valueList = new ArrayList<String>();
-               String[] userObjs = config.getUserObjects(buildTargetExt);
-               for (String obj : userObjs) {
-                       valueList.add(obj);
-               }
-               outputMacros.put("USER_OBJS", valueList);       //$NON-NLS-1$
-
-               //  Write every macro to the file
-               for (Entry<String, List<String>> entry : outputMacros.entrySet()) {
-                       macroBuffer.append(entry.getKey() + " :=");     //$NON-NLS-1$
-                       valueList = entry.getValue();
-                       for (String path : valueList) {
-                               // These macros will also be used within commands.
-                               // Make all the slashes go forward so they aren't
-                               // interpreted as escapes and get lost.
-                               // See https://bugs.eclipse.org/163672.
-                               path = path.replace('\\', '/');
-
-                               path = ensurePathIsGNUMakeTargetRuleCompatibleSyntax(path);
-
-                               macroBuffer.append(WHITESPACE);
-                               macroBuffer.append(path);
-                       }
-                       // terminate the macro definition line
-                       macroBuffer.append(NEWLINE);
-                       // leave a blank line before the next macro
-                       macroBuffer.append(NEWLINE);
-               }
-
-               // For now, just save the buffer that was populated when the rules were created
-               if (fileHandle != null) {
-                       Util.save(macroBuffer, fileHandle);
-               }
-
-               return macroBuffer;
-       }
-       
-       protected StringBuffer populateSourcesMakefile(IFile fileHandle) throws CoreException {
-               // Add the comment
-               StringBuffer buffer = addDefaultHeader();
-
-               // Determine the set of macros
-               toolInfos.accept(new IPathSettingsContainerVisitor() {
-
-                       public boolean visit(PathSettingsContainer container){
-                               ToolInfoHolder h = (ToolInfoHolder)container.getValue();
-                               ITool[] buildTools = h.buildTools;
-                               HashSet<String> handledInputExtensions = new HashSet<String>();
-                               String buildMacro;
-                               for (ITool buildTool : buildTools) {
-                                       if(buildTool.getCustomBuildStep())
-                                               continue;
-                                       // Add the known sources macros
-                                       String[] extensionsList = buildTool.getAllInputExtensions();
-                                       for (String ext : extensionsList) {
-                                               // create a macro of the form "EXTENSION_SRCS :="
-                                               String extensionName = ext;
-                                               if(//!getOutputExtensions().contains(extensionName) &&
-                                                       !handledInputExtensions.contains(extensionName)) {
-                                                       handledInputExtensions.add(extensionName);
-                                                       buildMacro = getSourceMacroName(extensionName).toString();
-                                                       if (!buildSrcVars.containsKey(buildMacro)) {
-                                                               buildSrcVars.put(buildMacro, new ArrayList<IPath>());
-                                                       }
-                                                       // Add any generated dependency file macros
-                                                       IManagedDependencyGeneratorType depType = buildTool.getDependencyGeneratorForExtension(extensionName);
-                                                       if (depType != null) {
-                                                               int calcType = depType.getCalculatorType();
-                                                               if (calcType == IManagedDependencyGeneratorType.TYPE_COMMAND ||
-                                                                       calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS ||
-                                                                       calcType == IManagedDependencyGeneratorType.TYPE_PREBUILD_COMMANDS) {
-                                                                       buildMacro = getDepMacroName(extensionName).toString();
-                                                                       if (!buildDepVars.containsKey(buildMacro)) {
-                                                                               buildDepVars.put(buildMacro, new testDependencyGroupInfo(buildMacro,
-                                                                                               (calcType != IManagedDependencyGeneratorType.TYPE_PREBUILD_COMMANDS)));
-                                                                       }
-                                                                       if (!buildOutVars.containsKey(buildMacro)) {
-                                                                               buildOutVars.put(buildMacro, new ArrayList<IPath>());
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       // Add the specified output build variables
-                                       IOutputType[] outTypes = buildTool.getOutputTypes();
-                                       if (outTypes != null && outTypes.length > 0) {
-                                               for (IOutputType outputType : outTypes) {
-                                                       buildMacro = outputType.getBuildVariable();
-                                                       if (!buildOutVars.containsKey(buildMacro)) {
-                                                               buildOutVars.put(buildMacro, new ArrayList<IPath>());
-                                                       }
-                                               }
-                                       } else {
-                                               // For support of pre-CDT 3.0 integrations.
-                                               buildMacro = OBJS_MACRO;
-                                               if (!buildOutVars.containsKey(buildMacro)) {
-                                                       buildOutVars.put(buildMacro, new ArrayList<IPath>());
-                                               }
-                                       }
-                               }
-                               return true;
-                       }
-               });
-               // Add the macros to the makefile
-               for (Entry<String, List<IPath>> entry : buildSrcVars.entrySet()) {
-                       String macroName = entry.getKey();
-                       buffer.append(macroName + WHITESPACE + ":=" + WHITESPACE + NEWLINE);    //$NON-NLS-1$
-               }
-               Set<Entry<String, List<IPath>>> set = buildOutVars.entrySet();
-               for (Entry<String, List<IPath>> entry : set) {
-                       String macroName = entry.getKey();
-                       buffer.append(macroName + WHITESPACE + ":=" + WHITESPACE + NEWLINE);    //$NON-NLS-1$
-               }
-
-               // Add a list of subdirectories to the makefile
-               buffer.append(NEWLINE + addSubdirectories());
-
-               // Save the file
-               if (fileHandle != null) {
-                       Util.save(buffer, fileHandle);
-               }
-               
-               return buffer;
-       }
-       
-       protected StringBuffer populateTopMakefile(IFile fileHandle, boolean rebuild) throws CoreException {
-               StringBuffer buffer = new StringBuffer();
-
-               // Add the header
-               buffer.append(addTopHeader());
-
-               // Add the macro definitions
-               buffer.append(addMacros());
-
-               // List to collect needed build output variables
-               List<String> outputVarsAdditionsList = new ArrayList<String>();
-
-               // Determine target rules
-               StringBuffer targetRules = addTargets(outputVarsAdditionsList, rebuild);
-
-               // Add outputMacros that were added to by the target rules
-               buffer.append(writeTopAdditionMacros(outputVarsAdditionsList, getTopBuildOutputVars()));
-
-               // Add target rules
-               buffer.append(targetRules);
-
-               // Save the file
-               if (fileHandle != null) {
-                       Util.save(buffer, fileHandle);
-               }
-               
-               return buffer;
-       }
-       
-       protected StringBuffer writeTopAdditionMacros(List<String> varList, HashMap<String, String> varMap) {
-               StringBuffer buffer = new StringBuffer();
-               // Add the comment
-               buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_VARS) + NEWLINE);
-
-               for (int i=0; i<varList.size(); i++) {
-                       String addition = varMap.get(varList.get(i));
-                       StringBuffer currentBuffer = new StringBuffer();
-                       currentBuffer.append(addition);
-                       currentBuffer.append(NEWLINE);
-
-                       // append the contents of the buffer to the master buffer for the whole file
-                       buffer.append(currentBuffer);
-               }
-               return buffer.append(NEWLINE);
-       }
-       
-       private StringBuffer addTargets(List<String> outputVarsAdditionsList, boolean rebuild) {
-               StringBuffer buffer = new StringBuffer();
-
-//             IConfiguration config = info.getDefaultConfiguration();
-
-               // Assemble the information needed to generate the targets
-               String prebuildStep = config.getPrebuildStep();
-               try{
-                       //try to resolve the build macros in the prebuild step
-                       prebuildStep = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                       prebuildStep,
-                                       EMPTY_STRING,
-                                       WHITESPACE,
-                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                       config);
-               } catch (BuildMacroException e){
-               }
-               prebuildStep = prebuildStep.trim(); // Remove leading and trailing whitespace (and control characters)
-
-               String postbuildStep = config.getPostbuildStep();
-               try{
-                       //try to resolve the build macros in the postbuild step
-                       postbuildStep = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                       postbuildStep,
-                                       EMPTY_STRING,
-                                       WHITESPACE,
-                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                       config);
-
-               } catch (BuildMacroException e){
-               }
-               postbuildStep = postbuildStep.trim(); // Remove leading and trailing whitespace (and control characters)
-               String preannouncebuildStep = config.getPreannouncebuildStep();
-               String postannouncebuildStep = config.getPostannouncebuildStep();
-               String targets = rebuild ? "clean all" : "all"; //$NON-NLS-1$ //$NON-NLS-2$
-
-               ITool targetTool = config.calculateTargetTool();
-//             if (targetTool == null) {
-//                     targetTool = info.getToolFromOutputExtension(buildTargetExt);
-//             }
-
-               // Get all the projects the build target depends on
-               // If this configuration produces a static archive, building the archive doesn't depend on the output
-               // from any of the referenced configurations
-               IConfiguration[] refConfigs = new IConfiguration[0];
-               if (config.getBuildArtefactType() == null || !ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_STATICLIB.equals(config.getBuildArtefactType().getId()))
-                       refConfigs = ManagedBuildManager.getReferencedConfigurations(config);
-
-/*             try {
-                       refdProjects = project.getReferencedProjects();
-               } catch (CoreException e) {
-                       // There are 2 exceptions; the project does not exist or it is not open
-                       // and neither conditions apply if we are building for it ....
-               }
-*/
-        // If a prebuild step exists, redefine the all target to be
-               // all: {pre-build} main-build
-               // and then reset the "traditional" all target to main-build
-               // This will allow something meaningful to happen if the generated
-               // makefile is
-               // extracted and run standalone via "make all"
-               //
-               String defaultTarget = "all:"; //$NON-NLS-1$
-               if (prebuildStep.length() > 0) {
-
-                       // Add the comment for the "All" target
-                       buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(ALL_TARGET) + NEWLINE);
-
-                       buffer.append(defaultTarget + WHITESPACE);
-                       buffer.append(PREBUILD + WHITESPACE);
-
-                       // Reset defaultTarget for now and for subsequent use, below
-                       defaultTarget = MAINBUILD;
-                       buffer.append(defaultTarget);
-
-                       // Update the defaultTarget, main-build, by adding a colon, which is
-                       // needed below
-                       defaultTarget = defaultTarget.concat(COLON);
-                       buffer.append(NEWLINE + NEWLINE);
-
-                       // Add the comment for the "main-build" target
-                       buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MAINBUILD_TARGET) + NEWLINE);
-               }
-               else
-                       // Add the comment for the "All" target
-                       buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(ALL_TARGET) + NEWLINE);
-
-               // Write out the all target first in case someone just runs make
-               // all: <target_name> or mainbuild: <target_name>
-
-               String outputPrefix = EMPTY_STRING;
-               if (targetTool != null) {
-                       outputPrefix = targetTool.getOutputPrefix();
-               }
-               buffer.append(defaultTarget + WHITESPACE + outputPrefix
-                               + ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName));
-               if (buildTargetExt.length() > 0) {
-                       buffer.append(DOT + buildTargetExt);
-               }
-
-               // Add the Secondary Outputs to the all target, if any
-               IOutputType[] secondaryOutputs = config.getToolChain().getSecondaryOutputs();
-               if (secondaryOutputs.length > 0) {
-                       buffer.append(WHITESPACE + SECONDARY_OUTPUTS);
-               }
-
-               buffer.append(NEWLINE + NEWLINE);
-
-               /*
-                * The build target may depend on other projects in the workspace. These
-                * are captured in the deps target: deps: <cd <Proj_Dep_1/build_dir>;
-                * $(MAKE) [clean all | all]>
-                */
-//             Vector managedProjectOutputs = new Vector(refdProjects.length);
-//             if (refdProjects.length > 0) {
-               Vector<String> managedProjectOutputs = new Vector<String>(refConfigs.length);
-               if (refConfigs.length > 0) {
-                       boolean addDeps = true;
-//                     if (refdProjects != null) {
-                               for (IConfiguration depCfg : refConfigs) {
-//                                     IProject dep = refdProjects[i];
-                                       if(!depCfg.isManagedBuildOn())
-                                               continue;
-
-//                                     if (!dep.exists()) continue;
-                                       if (addDeps) {
-                                               buffer.append("dependents:" + NEWLINE); //$NON-NLS-1$
-                                               addDeps = false;
-                                       }
-                                       String buildDir = depCfg.getOwner().getLocation().toString();
-                                       String depTargets = targets;
-//                                     if (ManagedBuildManager.manages(dep)) {
-                                               // Add the current configuration to the makefile path
-//                                             IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(dep);
-                                               buildDir += SEPARATOR + depCfg.getName();
-
-                                               // Extract the build artifact to add to the dependency list
-                                               String depTarget = depCfg.getArtifactName();
-                                               String depExt = depCfg.getArtifactExtension();
-
-                                               try{
-                                                       //try to resolve the build macros in the artifact extension
-                                                       depExt = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                       depExt,
-                                                                       "", //$NON-NLS-1$
-                                                                       " ", //$NON-NLS-1$
-                                                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                                                       depCfg);
-                                               } catch (BuildMacroException e){
-                                               }
-
-                                               try{
-                                                       //try to resolve the build macros in the artifact name
-                                                       String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                       depTarget,
-                                                                       "", //$NON-NLS-1$
-                                                                       " ", //$NON-NLS-1$
-                                                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                                                       depCfg);
-                                                       if((resolved = resolved.trim()).length() > 0)
-                                                               depTarget = resolved;
-                                               } catch (BuildMacroException e){
-                                               }
-
-                                               String depPrefix = depCfg.getOutputPrefix(depExt);
-                                               if (depCfg.needsRebuild()) {
-                                                       depTargets = "clean all"; //$NON-NLS-1$
-                                               }
-                                               String dependency = buildDir + SEPARATOR + depPrefix + depTarget;
-                                               if (depExt.length() > 0) {
-                                                       dependency += DOT + depExt;
-                                               }
-                                               dependency = escapeWhitespaces(dependency);
-                                               managedProjectOutputs.add(dependency);
-                                       //}
-                                       buffer.append(TAB + "-cd" + WHITESPACE + escapeWhitespaces(buildDir) + WHITESPACE + LOGICAL_AND + WHITESPACE + "$(MAKE) " + depTargets + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
-                               }
-//                     }
-                       buffer.append(NEWLINE);
-               }
-
-               // Add the targets tool rules
-               buffer.append(addTargetsRules(targetTool,
-                               outputVarsAdditionsList, managedProjectOutputs, (postbuildStep.length() > 0)));
-
-               // Add the prebuild step target, if specified
-               if (prebuildStep.length() > 0) {
-                       buffer.append(PREBUILD + COLON + NEWLINE);
-                       if (preannouncebuildStep.length() > 0) {
-                               buffer.append(TAB + DASH + AT + escapedEcho(preannouncebuildStep));
-                       }
-                       buffer.append(TAB + DASH + prebuildStep + NEWLINE);
-                       buffer.append(TAB + DASH + AT + ECHO_BLANK_LINE + NEWLINE);
-               }
-
-               // Add the postbuild step, if specified
-               if (postbuildStep.length() > 0) {
-                       buffer.append(POSTBUILD + COLON + NEWLINE);
-                       if (postannouncebuildStep.length() > 0) {
-                               buffer.append(TAB + DASH + AT + escapedEcho(postannouncebuildStep));
-                       }
-                       buffer.append(TAB + DASH + postbuildStep + NEWLINE);
-                       buffer.append(TAB + DASH + AT + ECHO_BLANK_LINE + NEWLINE);
-               }
-
-               // Add the Secondary Outputs target, if needed
-               if (secondaryOutputs.length > 0) {
-                       buffer.append(SECONDARY_OUTPUTS + COLON);
-                       Vector<String> outs2 = calculateSecondaryOutputs(secondaryOutputs);
-                       for (int i=0; i<outs2.size(); i++) {
-                               buffer.append(WHITESPACE + "$(" + outs2.get(i) + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-                       }
-                       buffer.append(NEWLINE + NEWLINE);
-               }
-
-               // Add all the needed dummy and phony targets
-               buffer.append(".PHONY: all clean dependents" + NEWLINE); //$NON-NLS-1$
-               buffer.append(".SECONDARY:"); //$NON-NLS-1$
-               if (prebuildStep.length() > 0) {
-                       buffer.append(WHITESPACE + MAINBUILD + WHITESPACE + PREBUILD);
-               }
-               if (postbuildStep.length() > 0) {
-                       buffer.append(WHITESPACE + POSTBUILD);
-               }
-               buffer.append(NEWLINE);
-               for (String output : managedProjectOutputs) {
-                       buffer.append(output + COLON + NEWLINE);
-               }
-               buffer.append(NEWLINE);
-
-               // Include makefile.targets supplemental makefile
-               buffer.append("-include " + ROOT + SEPARATOR + MAKEFILE_TARGETS + NEWLINE); //$NON-NLS-1$
-
-               return buffer;
-       }
-       
-       protected Vector<String> calculateSecondaryOutputs(IOutputType[] secondaryOutputs) {
-               ToolInfoHolder h = (ToolInfoHolder)toolInfos.getValue();
-               ITool[] buildTools = h.buildTools;
-               Vector<String> buildVars = new Vector<String>();
-               for (int i=0; i<buildTools.length; i++) {
-                       // Add the specified output build variables
-                       IOutputType[] outTypes = buildTools[i].getOutputTypes();
-                       if (outTypes != null && outTypes.length > 0) {
-                               for (int j=0; j<outTypes.length; j++) {
-                                       IOutputType outType = outTypes[j];
-                                       //  Is this one of the secondary outputs?
-                                       //  Look for an outputType with this ID, or one with a superclass with this id
-                                       thisType:
-                                       for (int k = 0; k < secondaryOutputs.length; k++) {
-                                               IOutputType matchType = outType;
-                                               do {
-                                                       if (matchType.getId().equals(secondaryOutputs[k].getId())) {
-                                                               buildVars.add(outType.getBuildVariable());
-                                                               break thisType;
-                                                       }
-                                                       matchType = matchType.getSuperClass();
-                                               } while (matchType != null);
-                                       }
-                               }
-                       }
-               }
-               return buildVars;
-       }
-       
-       protected StringBuffer addTopHeader() {
-               return addDefaultHeader();
-       }
-
-       private StringBuffer addMacros() {
-               StringBuffer buffer = new StringBuffer();
-
-               // Add the ROOT macro
-               //buffer.append("ROOT := .." + NEWLINE); //$NON-NLS-1$
-               //buffer.append(NEWLINE);
-
-               // include makefile.init supplementary makefile
-               buffer.append("-include " + ROOT + SEPARATOR + MAKEFILE_INIT + NEWLINE); //$NON-NLS-1$
-               buffer.append(NEWLINE);
-
-               // Get the clean command from the build model
-               buffer.append("RM := "); //$NON-NLS-1$
-
-               // support macros in the clean command
-               String cleanCommand = config.getCleanCommand();
-
-               try {
-                       cleanCommand = ManagedBuildManager.getBuildMacroProvider()
-                                       .resolveValueToMakefileFormat(config.getCleanCommand(),
-                                                       EMPTY_STRING, WHITESPACE,
-                                                       IBuildMacroProvider.CONTEXT_CONFIGURATION, config);
-               } catch (BuildMacroException e) {
-               }
-
-               buffer.append(cleanCommand + NEWLINE);
-
-               buffer.append(NEWLINE);
-
-               // Now add the source providers
-               buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(SRC_LISTS) + NEWLINE);
-               buffer.append("-include sources.mk" + NEWLINE); //$NON-NLS-1$
-
-               // Add includes for each subdir in child-subdir-first order (required for makefile rule matching to work).
-               List<String> subDirList = new ArrayList<String>();
-               for (IContainer subDir : getSubdirList()) {
-                       IPath projectRelativePath = subDir.getProjectRelativePath();
-                       if(!projectRelativePath.toString().equals("")) //$NON-NLS-1$
-                               subDirList.add(0, projectRelativePath.toString());
-               }
-               Collections.sort(subDirList, Collections.reverseOrder());
-               for (String dir : subDirList) {
-                       buffer.append("-include " + escapeWhitespaces(dir) + SEPARATOR + "subdir.mk"+ NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
-               }
-               buffer.append("-include subdir.mk" + NEWLINE); //$NON-NLS-1$
-
-               buffer.append("-include objects.mk" + NEWLINE + NEWLINE); //$NON-NLS-1$
-
-               // Include generated dependency makefiles if non-empty AND a "clean" has not been requested
-               if (!buildDepVars.isEmpty()) {
-                       buffer.append("ifneq ($(MAKECMDGOALS),clean)" + NEWLINE); //$NON-NLS-1$
-
-                       for (Entry<String, testDependencyGroupInfo> entry : buildDepVars.entrySet()) {
-                               String depsMacro = entry.getKey();
-                               testDependencyGroupInfo info = entry.getValue();
-                               buffer.append("ifneq ($(strip $(" + depsMacro + ")),)" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
-                               if (info.conditionallyInclude) {
-                                       buffer.append("-include $(" + depsMacro + ")" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
-                               } else {
-                                       buffer.append("include $(" + depsMacro + ")" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
-                               }
-                               buffer.append("endif" + NEWLINE); //$NON-NLS-1$
-                       }
-
-                       buffer.append("endif" + NEWLINE + NEWLINE); //$NON-NLS-1$
-               }
-
-               // Include makefile.defs supplemental makefile
-               buffer.append("-include " + ROOT + SEPARATOR + MAKEFILE_DEFS + NEWLINE); //$NON-NLS-1$
-
-
-               return (buffer.append(NEWLINE));
-       }
-       
-       private StringBuffer addTargetsRules(ITool targetTool,
-                       List<String> outputVarsAdditionsList, Vector<String> managedProjectOutputs, boolean postbuildStep) {
-               StringBuffer buffer = new StringBuffer();
-               // Add the comment
-               buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(BUILD_TOP) + NEWLINE);
-
-               ToolInfoHolder h = (ToolInfoHolder)toolInfos.getValue();
-               ITool[] buildTools = h.buildTools;
-               boolean[] buildToolsUsed = h.buildToolsUsed;
-               //  Get the target tool and generate the rule
-               if (targetTool != null) {
-                       // Note that the name of the target we pass to addRuleForTool does not
-                       // appear to be used there (and tool outputs are consulted directly), but
-                       // we quote it anyway just in case it starts to use it in future.
-                       if (addRuleForTool(targetTool, buffer, true,
-                                       ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName), buildTargetExt,
-                                       outputVarsAdditionsList, managedProjectOutputs, postbuildStep)) {
-                               //  Mark the target tool as processed
-                               for (int i=0; i<buildTools.length; i++) {
-                                       if (targetTool == buildTools[i]) {
-                                               buildToolsUsed[i] = true;
-                                       }
-                               }
-                       }
-               } else {
-                       buffer.append(TAB + AT + escapedEcho(MESSAGE_NO_TARGET_TOOL + WHITESPACE + OUT_MACRO));
-               }
-
-               //  Generate the rules for all Tools that specify InputType.multipleOfType, and any Tools that
-               //  consume the output of those tools.  This does not apply to pre-3.0 integrations, since
-               //  the only "multipleOfType" tool is the "target" tool
-               for (int i=0; i<buildTools.length; i++) {
-                       ITool tool = buildTools[i];
-                       IInputType type = tool.getPrimaryInputType();
-                       if (type != null && type.getMultipleOfType()) {
-                               if (!buildToolsUsed[i]) {
-                                       addRuleForTool(tool, buffer, false, null, null, outputVarsAdditionsList, null, false);
-                                       //  Mark the target tool as processed
-                                       buildToolsUsed[i] = true;
-                                       // Look for tools that consume the output
-                                       generateRulesForConsumers(tool, outputVarsAdditionsList, buffer);
-                               }
-                       }
-               }
-
-               // Add the comment
-               buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(BUILD_TARGETS) + NEWLINE);
-
-               // Always add a clean target
-               buffer.append("clean:" + NEWLINE); //$NON-NLS-1$
-               buffer.append(TAB + "-$(RM)" + WHITESPACE); //$NON-NLS-1$
-               for (Entry<String, List<IPath>> entry : buildOutVars.entrySet()) {
-                       String macroName = entry.getKey();
-                       buffer.append("$(" + macroName + ")");  //$NON-NLS-1$   //$NON-NLS-2$
-               }
-               String outputPrefix = EMPTY_STRING;
-               if (targetTool != null) {
-                       outputPrefix = targetTool.getOutputPrefix();
-               }
-               String completeBuildTargetName = outputPrefix + buildTargetName;
-               if (buildTargetExt.length() > 0) {
-                       completeBuildTargetName = completeBuildTargetName + DOT + buildTargetExt;
-               }
-               if (completeBuildTargetName.contains(" ")) { //$NON-NLS-1$
-                       buffer.append(WHITESPACE + "\"" + completeBuildTargetName + "\"");  //$NON-NLS-1$       //$NON-NLS-2$
-               } else {
-                       buffer.append(WHITESPACE + completeBuildTargetName);
-               }
-               buffer.append(NEWLINE);
-               buffer.append(TAB + DASH + AT + ECHO_BLANK_LINE + NEWLINE);
-
-               return buffer;
-       }
-       
-        private void generateRulesForConsumers(ITool generatingTool, List<String> outputVarsAdditionsList, StringBuffer buffer) {
-               //  Generate a build rule for any tool that consumes the output of this tool
-                ToolInfoHolder h = (ToolInfoHolder)toolInfos.getValue();
-                ITool[] buildTools = h.buildTools;
-                boolean[] buildToolsUsed = h.buildToolsUsed;
-               IOutputType[] outTypes = generatingTool.getOutputTypes();
-               for (IOutputType outType : outTypes) {
-                       String[] outExts = outType.getOutputExtensions(generatingTool);
-                       String outVariable = outType.getBuildVariable();
-                       if (outExts != null) {
-                               for (String outExt : outExts) {
-                                       for (int k=0; k<buildTools.length; k++) {
-                                               ITool tool = buildTools[k];
-                                               if (!buildToolsUsed[k]) {
-                                                       // Also has to match build variables if specified
-                                                       IInputType inType = tool.getInputType(outExt);
-                                                       if (inType != null) {
-                                                               String inVariable = inType.getBuildVariable();
-                                                               if ((outVariable == null && inVariable == null) ||
-                                                                   (outVariable != null && inVariable != null &&
-                                                                        outVariable.equals(inVariable))) {
-                                                                       if (addRuleForTool(buildTools[k], buffer, false, null, null,
-                                                                                       outputVarsAdditionsList, null, false)) {
-                                                                               buildToolsUsed[k] = true;
-                                                                               // Look for tools that consume the output
-                                                                               generateRulesForConsumers(buildTools[k], outputVarsAdditionsList, buffer);
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       
-       protected void calculateToolInputsOutputs() {
-
-               toolInfos.accept(new IPathSettingsContainerVisitor(){
-                       public boolean visit(PathSettingsContainer container){
-                               ToolInfoHolder h = (ToolInfoHolder)container.getValue();
-                               ITool[] buildTools = h.buildTools;
-                               BuildDataFileManagedBuildToolInfo[] gnuToolInfos = h.gnuToolInfos;
-                               //  We are "done" when the information for all tools has been calculated,
-                               //  or we are not making any progress
-                               boolean done = false;
-                               boolean lastChance = false;
-                               int[] doneState = new int[buildTools.length];
-
-                               // Identify the target tool
-                               ITool targetTool = config.calculateTargetTool();
-               //              if (targetTool == null) {
-               //                      targetTool = info.getToolFromOutputExtension(buildTargetExt);
-               //              }
-
-                               //  Initialize the tool info array and the done state
-
-                               if(buildTools.length != 0 && buildTools[0].getCustomBuildStep())
-                                       return true;
-
-                               for (int i=0; i<buildTools.length; i++) {
-                                       if ((buildTools[i] == targetTool)) {
-                                               String ext = config.getArtifactExtension();
-                                               //try to resolve the build macros in the artifact extension
-                                               try{
-                                                       ext = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                       ext,
-                                                                       "", //$NON-NLS-1$
-                                                                       " ", //$NON-NLS-1$
-                                                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                                                       config);
-                                               } catch (BuildMacroException e){
-                                               }
-
-                                               String name = config.getArtifactName();
-                                               //try to resolve the build macros in the artifact name
-                                               try{
-                                                       String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                       name,
-                                                                       "", //$NON-NLS-1$
-                                                                       " ", //$NON-NLS-1$
-                                                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                                                       config);
-                                                       if((resolved = resolved.trim()).length() > 0)
-                                                               name = resolved;
-                                               } catch (BuildMacroException e){
-                                               }
-
-                                               gnuToolInfos[i] = new BuildDataFileManagedBuildToolInfo(project, buildTools[i], true,
-                                                               name, ext);
-                                       } else {
-                                               gnuToolInfos[i] = new BuildDataFileManagedBuildToolInfo(project, buildTools[i], false, null, null);
-                                       }
-                                       doneState[i] = 0;
-                               }
-
-                               //  Initialize the build output variable to file additions map
-                               LinkedHashMap<String, String> map = getTopBuildOutputVars();
-                               Set<Entry<String, List<IPath>>> set = buildOutVars.entrySet();
-                               for (Entry<String, List<IPath>> entry : set) {
-                                       String macroName = entry.getKey();
-                                       addMacroAdditionPrefix(map, macroName, "", false);      //$NON-NLS-1$
-                               }
-
-                               // Set of input extensions for which macros have been created so far
-                               HashSet<String> handledDepsInputExtensions = new HashSet<String>();
-                               HashSet<String> handledOutsInputExtensions = new HashSet<String>();
-
-                               while (!done) {
-                                       int[] testState = new int[doneState.length];
-                                       for (int i=0; i<testState.length; i++) testState[i] = 0;
-
-                                       //  Calculate inputs
-                                       for (int i=0; i<gnuToolInfos.length; i++) {
-                                               if (gnuToolInfos[i].areInputsCalculated()) {
-                                                       testState[i]++;
-                                               } else {
-                                                       if (gnuToolInfos[i].calculateInputs(BuildDataFileGenerator.this, config, projectResources, h, lastChance)) {
-                                                               testState[i]++;
-                                                       }
-                                               }
-                                       }
-                                       //  Calculate dependencies
-                                       for (int i=0; i<gnuToolInfos.length; i++) {
-                                               if (gnuToolInfos[i].areDependenciesCalculated()) {
-                                                       testState[i]++;
-                                               } else {
-                                                       if (gnuToolInfos[i].calculateDependencies(BuildDataFileGenerator.this, config, handledDepsInputExtensions, h, lastChance)) {
-                                                               testState[i]++;
-                                                       }
-                                               }
-                                       }
-                                       //  Calculate outputs
-                                       for (int i=0; i<gnuToolInfos.length; i++) {
-                                               if (gnuToolInfos[i].areOutputsCalculated()) {
-                                                       testState[i]++;
-                                               } else {
-                                                       if (gnuToolInfos[i].calculateOutputs(BuildDataFileGenerator.this, config, handledOutsInputExtensions, lastChance)) {
-                                                               testState[i]++;
-                                                       }
-                                               }
-                                       }
-                                       //  Are all calculated?  If so, done.
-                                       done = true;
-                                       for (int element : testState) {
-                                               if (element != 3) {
-                                                       done = false;
-                                                       break;
-                                               }
-                                       }
-
-                                       //  Test our "done" state vs. the previous "done" state.
-                                       //  If we have made no progress, give it a "last chance" and then quit
-                                       if (!done) {
-                                               done = true;
-                                               for (int i=0; i<testState.length; i++) {
-                                                       if (testState[i] != doneState[i]) {
-                                                               done = false;
-                                                               break;
-                                                       }
-                                               }
-                                       }
-                                       if (done) {
-                                               if (!lastChance) {
-                                                       lastChance = true;
-                                                       done = false;
-                                               }
-                                       }
-                                       if (!done) {
-                                               doneState = testState;
-                                       }
-                               }
-                               return true;
-                       }
-               });
-       }
-       
-       protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTargetTool, String targetName, String targetExt,
-                       List<String> outputVarsAdditionsList, Vector<String> managedProjectOutputs, boolean bEmitPostBuildStepCall) {
-
-               //  Get the tool's inputs and outputs
-               Vector<String> inputs = new Vector<String>();
-               Vector<String> dependencies = new Vector<String>();
-               Vector<String> outputs = new Vector<String>();
-               Vector<String> enumeratedPrimaryOutputs = new Vector<String>();
-               Vector<String> enumeratedSecondaryOutputs = new Vector<String>();
-               Vector<String> outputVariables = new Vector<String>();
-               Vector<String> additionalTargets = new Vector<String>();
-               String outputPrefix = EMPTY_STRING;
-
-               if (!getToolInputsOutputs(tool, inputs, dependencies, outputs,
-                               enumeratedPrimaryOutputs, enumeratedSecondaryOutputs,
-                               outputVariables, additionalTargets, bTargetTool, managedProjectOutputs)) {
-                       return false;
-               }
-
-               //  If we have no primary output, make all of the secondary outputs the primary output
-               if (enumeratedPrimaryOutputs.size() == 0) {
-                       enumeratedPrimaryOutputs = enumeratedSecondaryOutputs;
-                       enumeratedSecondaryOutputs.clear();
-               }
-
-               //  Add the output variables for this tool to our list
-               outputVarsAdditionsList.addAll(outputVariables);
-
-               //  Create the build rule
-               String buildRule = EMPTY_STRING;
-               String outflag = tool.getOutputFlag();
-
-               String primaryOutputs = EMPTY_STRING;
-               String primaryOutputsQuoted = EMPTY_STRING;
-               boolean first = true;
-               for (int i=0; i<enumeratedPrimaryOutputs.size(); i++) {
-                       String output = enumeratedPrimaryOutputs.get(i);
-                       if (!first) {
-                               primaryOutputs += WHITESPACE;
-                               primaryOutputsQuoted += WHITESPACE;
-                       }
-                       first = false;
-                       primaryOutputs += output;
-                       primaryOutputsQuoted += ensurePathIsGNUMakeTargetRuleCompatibleSyntax(output);
-               }
-
-               buildRule += (primaryOutputsQuoted + COLON + WHITESPACE);
-
-               first = true;
-               String calculatedDependencies = EMPTY_STRING;
-               for (int i=0; i<dependencies.size(); i++) {
-                       String input = dependencies.get(i);
-                       if (!first) calculatedDependencies += WHITESPACE;
-                       first = false;
-                       calculatedDependencies += input;
-               }
-               buildRule += calculatedDependencies;
-
-               // We can't have duplicates in a makefile
-               if (getRuleList().contains(buildRule)) {
-               }
-               else {
-                       getRuleList().add(buildRule);
-                       buffer.append(buildRule + NEWLINE);
-                       if (bTargetTool) {
-                               buffer.append(TAB + AT + escapedEcho(MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO));
-                       }
-                       buffer.append(TAB + AT + escapedEcho(tool.getAnnouncement()));
-
-                       // Get the command line for this tool invocation
-                       String[] flags;
-                       try {
-                               flags = tool.getToolCommandFlags(null,null);
-                       } catch( BuildException ex ) {
-                               // TODO  report error
-                               flags = EMPTY_STRING_ARRAY;
-                       }
-                       String command = tool.getToolCommand();
-                       try{
-                               //try to resolve the build macros in the tool command
-                               String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(command,
-                                               EMPTY_STRING,
-                                               WHITESPACE,
-                                               IBuildMacroProvider.CONTEXT_FILE,
-                                               new FileContextData(null,null,null,tool));
-                               if((resolvedCommand = resolvedCommand.trim()).length() > 0)
-                                       command = resolvedCommand;
-
-                       } catch (BuildMacroException e){
-                       }
-                       String[] cmdInputs = inputs.toArray(new String[inputs.size()]);
-                       IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
-                       IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo( tool, command,
-                                       flags, outflag, outputPrefix, primaryOutputs, cmdInputs, tool.getCommandLinePattern() );
-
-                       // The command to build
-                       String buildCmd = null;
-                       if( cmdLInfo == null ) {
-                               String toolFlags;
-                               try {
-                                       toolFlags = tool.getToolCommandFlagsString(null,null);
-                               } catch( BuildException ex ) {
-                                       // TODO report error
-                                       toolFlags = EMPTY_STRING;
-                               }
-                               buildCmd = command + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE + IN_MACRO;
-                       }
-                       else buildCmd = cmdLInfo.getCommandLine();
-
-            // resolve any remaining macros in the command after it has been
-            // generated
-            try {
-                String resolvedCommand = ManagedBuildManager
-                        .getBuildMacroProvider().resolveValueToMakefileFormat(
-                                buildCmd,
-                                EMPTY_STRING,
-                                WHITESPACE,
-                                IBuildMacroProvider.CONTEXT_FILE,
-                                new FileContextData(null, null, null, tool));
-                if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
-                    buildCmd = resolvedCommand;
-
-            } catch (BuildMacroException e) {
-            }
-
-
-                       //buffer.append(TAB + AT + escapedEcho(buildCmd));
-                       //buffer.append(TAB + AT + buildCmd);
-                       buffer.append(TAB + buildCmd);
-
-                       // TODO
-                       // NOTE WELL:  Dependency file generation is not handled for this type of Tool
-
-                       // Echo finished message
-                       buffer.append(NEWLINE);
-                       buffer.append(TAB + AT + escapedEcho((bTargetTool ? MESSAGE_FINISH_BUILD : MESSAGE_FINISH_FILE) + WHITESPACE + OUT_MACRO));
-                       buffer.append(TAB + AT + ECHO_BLANK_LINE);
-
-                       // If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build
-                   // Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke
-                   // the makefile originally
-                   if (bEmitPostBuildStepCall) {
-                       buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + POSTBUILD + NEWLINE + NEWLINE);
-                   }
-                   else {
-                               // Just emit a blank line
-                               buffer.append(NEWLINE);
-                   }
-               }
-
-               // If we have secondary outputs, output dependency rules without commands
-               if (enumeratedSecondaryOutputs.size() > 0 || additionalTargets.size() > 0) {
-                       String primaryOutput = enumeratedPrimaryOutputs.get(0);
-                       Vector<String> addlOutputs = new Vector<String>();
-                       addlOutputs.addAll(enumeratedSecondaryOutputs);
-                       addlOutputs.addAll(additionalTargets);
-                       for (int i=0; i<addlOutputs.size(); i++) {
-                               String output = addlOutputs.get(i);
-                               String depLine = output + COLON + WHITESPACE + primaryOutput + WHITESPACE + calculatedDependencies + NEWLINE;
-                               if (!getDepLineList().contains(depLine)) {
-                                       getDepLineList().add(depLine);
-                                       buffer.append(depLine);
-                               }
-                       }
-                       buffer.append(NEWLINE);
-               }
-               return true;
-       }
-       
-       protected boolean getToolInputsOutputs(ITool tool,
-                       Vector<String> inputs, Vector<String> dependencies, Vector<String> outputs,
-                       Vector<String> enumeratedPrimaryOutputs, Vector<String> enumeratedSecondaryOutputs,
-                       Vector<String> outputVariables, Vector<String> additionalTargets,
-                       boolean bTargetTool, Vector<String> managedProjectOutputs) {
-                ToolInfoHolder h = (ToolInfoHolder)toolInfos.getValue();
-                ITool[] buildTools = h.buildTools;
-                BuildDataFileManagedBuildToolInfo[] gnuToolInfos = h.gnuToolInfos;
-               //  Get the information regarding the tool's inputs and outputs from the objects
-               //  created by calculateToolInputsOutputs
-               BuildDataFileManagedBuildToolInfo toolInfo = null;
-               for (int i=0; i<buildTools.length; i++) {
-                       if (tool == buildTools[i]) {
-                               toolInfo = gnuToolInfos[i];
-                               break;
-                       }
-               }
-               if (toolInfo == null) return false;
-
-               //  Populate the output Vectors
-               inputs.addAll(toolInfo.getCommandInputs());
-               outputs.addAll(toolInfo.getCommandOutputs());
-               enumeratedPrimaryOutputs.addAll(toolInfo.getEnumeratedPrimaryOutputs());
-               enumeratedSecondaryOutputs.addAll(toolInfo.getEnumeratedSecondaryOutputs());
-               outputVariables.addAll(toolInfo.getOutputVariables());
-
-               Vector<String> unprocessedDependencies = toolInfo.getCommandDependencies();
-               for (String path : unprocessedDependencies) {
-                       dependencies.add(ensurePathIsGNUMakeTargetRuleCompatibleSyntax(path));
-               }
-               additionalTargets.addAll(toolInfo.getAdditionalTargets());
-
-               if (bTargetTool && managedProjectOutputs != null) {
-                       for (String output : managedProjectOutputs) {
-                               dependencies.add(output);
-                       }
-               }
-               return true;
-       }
-
-       public LinkedHashMap<String, String> getTopBuildOutputVars() {
-               return topBuildOutVars;
-       }
-       
-       public void initialize(int buildKind, IConfiguration cfg, IBuilder builder, IProgressMonitor monitor) {
-               // Save the project so we can get path and member information
-               this.project = cfg.getOwner().getProject();
-               if(builder == null){
-                       builder = cfg.getEditableBuilder();
-               }
-               try {
-                       projectResources = project.members();
-               } catch (CoreException e) {
-                       projectResources = null;
-               }
-               // Save the monitor reference for reporting back to the user
-               this.monitor = monitor;
-               // Get the build info for the project
-//             this.info = info;
-               // Get the name of the build target
-               buildTargetName = cfg.getArtifactName();
-               // Get its extension
-               buildTargetExt = cfg.getArtifactExtension();
-
-               try{
-                       //try to resolve the build macros in the target extension
-                       buildTargetExt = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                       buildTargetExt,
-                                       "", //$NON-NLS-1$
-                                       " ", //$NON-NLS-1$
-                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                       builder);
-               } catch (BuildMacroException e){
-               }
-
-               try{
-                       //try to resolve the build macros in the target name
-                       String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                       buildTargetName,
-                                       "", //$NON-NLS-1$
-                                       " ", //$NON-NLS-1$
-                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                       builder);
-                       if (resolved!=null) {
-                               resolved = resolved.trim();
-                               if(resolved.length() > 0)
-                                       buildTargetName = resolved;
-                       }
-               } catch (BuildMacroException e){
-               }
-
-
-               if (buildTargetExt == null) {
-                       buildTargetExt = new String();
-               }
-               // Cache the build tools
-               config = cfg;
-               this.builder = builder;
-
-               initToolInfos();
-               //set the top build dir path
-               topBuildDir = project.getFolder(cfg.getName()).getFullPath();
-
-               srcEntries = config.getSourceEntries();
-               if(srcEntries.length == 0){
-                       srcEntries = new ICSourceEntry[]{new CSourceEntry(Path.EMPTY, null, ICSettingEntry.RESOLVED | ICSettingEntry.VALUE_WORKSPACE_PATH)};
-               } else {
-                       ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(config);
-                       srcEntries = CDataUtil.resolveEntries(srcEntries, cfgDes);
-               }
-       }
-       
-       private void initToolInfos(){
-               toolInfos = PathSettingsContainer.createRootContainer();
-
-               IResourceInfo rcInfos[] = config.getResourceInfos();
-               for (IResourceInfo rcInfo : rcInfos) {
-                       if(rcInfo.isExcluded() /*&& !((ResourceInfo)rcInfo).isRoot()*/)
-                               continue;
-
-                       ToolInfoHolder h = getToolInfo(rcInfo.getPath(), true);
-                       if(rcInfo instanceof IFolderInfo){
-                               IFolderInfo fo = (IFolderInfo)rcInfo;
-                               h.buildTools = fo.getFilteredTools();
-                               h.buildToolsUsed = new boolean[h.buildTools.length];
-                               h.gnuToolInfos = new BuildDataFileManagedBuildToolInfo[h.buildTools.length];
-                       } else {
-                               IFileInfo fi = (IFileInfo)rcInfo;
-                               h.buildTools = fi.getToolsToInvoke();
-                               h.buildToolsUsed = new boolean[h.buildTools.length];
-                               h.gnuToolInfos = new BuildDataFileManagedBuildToolInfo[h.buildTools.length];
-                       }
-               }
-       }
-
-       protected boolean isSource(IPath path){
-               return !CDataUtil.isExcluded(path, srcEntries);
-       }
-       
-       protected void appendModifiedSubdirectory(IResource resource) {
-               IContainer container = resource.getParent();
-
-                       if (!getModifiedList().contains(container)) {
-                               getModifiedList().add(container);
-                       }
-       }
-       
-       private Collection<IContainer> getModifiedList() {
-               if (modifiedList == null)
-                       modifiedList = new LinkedHashSet<IContainer>();
-               return modifiedList;
-       }
-       
-       protected void appendDeletedFile(IResource resource) {
-               // Cache this for now
-               getDeletedFileList().add(resource);
-       }
-       
-       private Vector<IResource> getDeletedFileList() {
-               if (deletedFileList == null) {
-                       deletedFileList = new Vector<IResource>();
-               }
-               return deletedFileList;
-       }
-
-       protected void appendDeletedSubdirectory(IContainer container) {
-               // No point in adding a folder if the parent is already there
-               IContainer parent = container.getParent();
-               if (!getDeletedDirList().contains(container) &&
-                               !getDeletedDirList().contains(parent)) {
-                       getDeletedDirList().add(container);
-               }
-       }
-       
-       private Vector<IResource> getDeletedDirList() {
-               if (deletedDirList == null) {
-                       deletedDirList = new Vector<IResource>();
-               }
-               return deletedDirList;
-       }
-       
-       protected void appendBuildSubdirectory(IResource resource) {
-               IContainer container = resource.getParent();
-               // Only add the container once
-               if (!getSubdirList().contains(container))
-                       getSubdirList().add(container);
-       }
-       
-       private Collection<IContainer> getSubdirList() {
-               if (subdirList == null)
-                       subdirList = new LinkedHashSet<IContainer>();
-               return subdirList;
-       }
-       
-       protected void updateMonitor(String msg) {
-               if (monitor!= null && !monitor.isCanceled()) {
-                       monitor.subTask(msg);
-                       monitor.worked(1);
-               }
-       }
-       
-       private IPath createDirectory(String dirName) throws CoreException {
-               // Create or get the handle for the build directory
-               IFolder folder = project.getFolder(dirName);
-               if (!folder.exists()) {
-                       // Make sure that parent folders exist
-                       IPath parentPath = (new Path(dirName)).removeLastSegments(1);
-                       // Assume that the parent exists if the path is empty
-                       if (!parentPath.isEmpty()) {
-                               IFolder parent = project.getFolder(parentPath);
-                               if (!parent.exists()) {
-                                       createDirectory(parentPath.toString());
-                               }
-                       }
-
-                       // Now make the requested folder
-                       try {
-                               folder.create(true, true, null);
-                       }
-                       catch (CoreException e) {
-                               if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
-                                       folder.refreshLocal(IResource.DEPTH_ZERO, null);
-                               else
-                                       throw e;
-                       }
-
-                       // Make sure the folder is marked as derived so it is not added to CM
-                       if (!folder.isDerived()) {
-                               folder.setDerived(true);
-                       }
-               }
-
-               return folder.getFullPath();
-       }
-
-       /**
-        * Return or create the makefile needed for the build. If we are creating
-        * the resource, set the derived bit to true so the CM system ignores
-        * the contents. If the resource exists, respect the existing derived
-        * setting.
-        */
-       private IFile createFile(IPath makefilePath) throws CoreException {
-               // Create or get the handle for the makefile
-               IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot();
-               IFile newFile = root.getFileForLocation(makefilePath);
-               if (newFile == null) {
-                       newFile = root.getFile(makefilePath);
-               }
-               // Create the file if it does not exist
-               ByteArrayInputStream contents = new ByteArrayInputStream(new byte[0]);
-               try {
-                       newFile.create(contents, false, new SubProgressMonitor(monitor, 1));
-                       // Make sure the new file is marked as derived
-                       if (!newFile.isDerived()) {
-                               newFile.setDerived(true);
-                       }
-
-               }
-               catch (CoreException e) {
-                       // If the file already existed locally, just refresh to get contents
-                       if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
-                               newFile.refreshLocal(IResource.DEPTH_ZERO, null);
-                       else
-                               throw e;
-               }
-
-               return newFile;
-       }
-       
-       protected StringBuffer addDefaultHeader() {
-               StringBuffer buffer = new StringBuffer();
-               outputCommentLine(buffer);
-               buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(HEADER) + NEWLINE);
-               outputCommentLine(buffer);
-               buffer.append(NEWLINE);
-               return buffer;
-       }
-       
-       protected void outputCommentLine(StringBuffer buffer) {
-               for (int i = 0; i < COLS_PER_LINE; i++) {
-                       buffer.append(COMMENT_SYMBOL);
-               }
-               buffer.append(NEWLINE);
-       }
-       
-       public StringBuffer getSourceMacroName(String extensionName) {
-               StringBuffer macroName = new StringBuffer();
-
-               // We need to handle case sensitivity in file extensions (e.g. .c vs .C), so if the
-               // extension was already upper case, tack on an "UPPER_" to the macro name.
-               // In theory this means there could be a conflict if you had for example,
-               // extensions .c_upper, and .C, but realistically speaking the chances of this are
-               // practically nil so it doesn't seem worth the hassle of generating a truly
-               // unique name.
-               if(extensionName.equals(extensionName.toUpperCase())) {
-                       macroName.append(extensionName.toUpperCase() + "_UPPER");       //$NON-NLS-1$
-               } else {
-                       // lower case... no need for "UPPER_"
-                       macroName.append(extensionName.toUpperCase());
-               }
-               macroName.append("_SRCS");      //$NON-NLS-1$
-               return macroName;
-       }
-       
-       public StringBuffer getDepMacroName(String extensionName) {
-               StringBuffer macroName = new StringBuffer();
-
-               // We need to handle case sensitivity in file extensions (e.g. .c vs .C), so if the
-               // extension was already upper case, tack on an "UPPER_" to the macro name.
-               // In theory this means there could be a conflict if you had for example,
-               // extensions .c_upper, and .C, but realistically speaking the chances of this are
-               // practically nil so it doesn't seem worth the hassle of generating a truly
-               // unique name.
-               if(extensionName.equals(extensionName.toUpperCase())) {
-                       macroName.append(extensionName.toUpperCase() + "_UPPER");       //$NON-NLS-1$
-               } else {
-                       // lower case... no need for "UPPER_"
-                       macroName.append(extensionName.toUpperCase());
-               }
-               macroName.append("_DEPS");      //$NON-NLS-1$
-               return macroName;
-       }
-       
-       static public String escapeWhitespaces(String path) {
-               // Escape the spaces in the path/filename if it has any
-               String[] segments = path.split("\\s"); //$NON-NLS-1$
-               if (segments.length > 1) {
-                       StringBuffer escapedPath = new StringBuffer();
-                       for (int index = 0; index < segments.length; ++index) {
-                               escapedPath.append(segments[index]);
-                               if (index + 1 < segments.length) {
-                                       escapedPath.append("\\ "); //$NON-NLS-1$
-                               }
-                       }
-                       return escapedPath.toString().trim();
-               } else {
-                       return path;
-               }
-       }
-       
-       /*************************************************************************
-        *   S O U R C E S (sources.mk)   M A K E F I L E   M E T H O D S
-        ************************************************************************/
-
-       private StringBuffer addSubdirectories() {
-               StringBuffer buffer = new StringBuffer();
-               // Add the comment
-               buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_LIST) + NEWLINE);
-
-               buffer.append("SUBDIRS := " + LINEBREAK); //$NON-NLS-1$
-
-               // Get all the module names
-               for (IResource container : getSubdirList()) {
-                       updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.adding.source.folder", container.getFullPath().toString()));    //$NON-NLS-1$
-                       // Check the special case where the module is the project root
-                       if (container.getFullPath() == project.getFullPath()) {
-                               buffer.append(DOT + WHITESPACE + LINEBREAK);
-                       } else {
-                               IPath path = container.getProjectRelativePath();
-                               buffer.append(escapeWhitespaces(path.toString()) +  WHITESPACE + LINEBREAK);
-                       }
-               }
-
-               buffer.append(NEWLINE);
-               return buffer;
-       }
-       
-       /*************************************************************************
-        *   M A K E F I L E S   P O P U L A T I O N   M E T H O D S
-        ************************************************************************/
-
-       /**
-        * This method generates a "fragment" make file (subdir.mk).
-        * One of these is generated for each project directory/subdirectory
-        * that contains source files.
-        */
-       protected StringBuffer populateFragmentMakefile(IContainer module) throws CoreException {
-               // Calculate the new directory relative to the build output
-               IPath moduleRelativePath = module.getProjectRelativePath();
-               IPath buildRoot = getBuildWorkingDir();
-               StringBuffer makeBuf = new StringBuffer();
-               if (buildRoot == null) {
-                       return makeBuf;
-               }
-
-               IPath moduleOutputPath = buildRoot.append(moduleRelativePath);
-               updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.gen.source.makefile", moduleOutputPath.toString()));    //$NON-NLS-1$
-
-               // Now create the directory
-               //IPath moduleOutputDir = createDirectory(moduleOutputPath.toString());
-
-               // Create a module makefile
-               //IFile modMakefile = createFile(moduleOutputDir.append(MODFILE_NAME));         
-               makeBuf.append(addFragmentMakefileHeader());
-               makeBuf.append(addSources(module));
-
-               // Save the files
-               //Util.save(makeBuf, modMakefile);
-               
-               return makeBuf;
-       }
-       
-       protected StringBuffer addFragmentMakefileHeader() {
-               return addDefaultHeader();
-       }
-       
-       protected StringBuffer addSources(IContainer module) throws CoreException {
-               // Calculate the new directory relative to the build output
-               IPath moduleRelativePath = module.getProjectRelativePath();
-               String relativePath = moduleRelativePath.toString();
-               relativePath += relativePath.length() == 0 ? "" : SEPARATOR;  //$NON-NLS-1$
-
-               // For build macros in the configuration, create a map which will map them
-               // to a string which holds its list of sources.
-               LinkedHashMap<String, String> buildVarToRuleStringMap = new LinkedHashMap<String, String>();
-
-               // Add statements that add the source files in this folder,
-               // and generated source files, and generated dependency files
-               // to the build macros
-               for (Entry<String, List<IPath>> entry : buildSrcVars.entrySet()) {
-                       String macroName = entry.getKey();
-                       addMacroAdditionPrefix(buildVarToRuleStringMap, macroName, null, false);
-
-               }
-               for (Entry<String, List<IPath>> entry : buildOutVars.entrySet()) {
-                       String macroName = entry.getKey();
-                       addMacroAdditionPrefix(buildVarToRuleStringMap, macroName, "./" + relativePath, false);   //$NON-NLS-1$
-               }
-
-               // String buffers
-               StringBuffer buffer = new StringBuffer();       // Return buffer
-               StringBuffer ruleBuffer = new StringBuffer(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_RULES) + NEWLINE);
-
-               // Visit the resources in this folder and add each one to a sources macro, and generate a build rule, if appropriate
-               IResource[] resources = module.members();
-
-               IResourceInfo rcInfo;
-               IFolder folder = project.getFolder(config.getName());
-
-               for (IResource resource : resources) {
-                       if (resource.getType() == IResource.FILE) {
-                               // Check whether this resource is excluded from build
-                               IPath rcProjRelPath = resource.getProjectRelativePath();
-                               if(!isSource(rcProjRelPath))
-                                       continue;
-                               rcInfo = config.getResourceInfo(rcProjRelPath, false);
-//                             if( (rcInfo.isExcluded()) )
-//                                     continue;
-                               addFragmentMakefileEntriesForSource(buildVarToRuleStringMap, ruleBuffer,
-                                               folder, relativePath, resource, getPathForResource(resource), rcInfo, null, false);
-                       }
-               }
-
-               // Write out the macro addition entries to the buffer
-               buffer.append(writeAdditionMacros(buildVarToRuleStringMap));
-               return buffer.append(ruleBuffer + NEWLINE);
-       }
-       
-       protected void addMacroAdditionPrefix(LinkedHashMap<String, String> map, String macroName, String relativePath, boolean addPrefix) {
-               // there is no entry in the map, so create a buffer for this macro
-               StringBuffer tempBuffer = new StringBuffer();
-               tempBuffer.append(macroName + WHITESPACE + MACRO_ADDITION_PREFIX_SUFFIX);
-               if (addPrefix) {
-                       tempBuffer.append(MACRO_ADDITION_ADDPREFIX_HEADER + relativePath + MACRO_ADDITION_ADDPREFIX_SUFFIX);
-               }
-
-               // have to store the buffer in String form as StringBuffer is not a sublcass of Object
-               map.put(macroName, tempBuffer.toString());
-       }
-       
-       protected IPath getPathForResource(IResource resource) {
-               return new Path(resource.getLocationURI().getPath());
-       }
-       
-       protected void addFragmentMakefileEntriesForSource (LinkedHashMap<String, String> buildVarToRuleStringMap, StringBuffer ruleBuffer,
-                       IFolder folder, String relativePath, IResource resource, IPath sourceLocation, IResourceInfo rcInfo,
-                       String varName, boolean generatedSource) {
-
-               //  Determine which tool, if any, builds files with this extension
-               String ext = sourceLocation.getFileExtension();
-               ITool tool = null;
-
-               //TODO: remove
-//             IResourceConfiguration resConfig = null;
-//             if(rcInfo instanceof IFileInfo){
-//                     resConfig = (IFileInfo)rcInfo;
-//             }
-               //end remove
-
-               //  Use the tool from the resource configuration if there is one
-               if (rcInfo instanceof IFileInfo) {
-                       IFileInfo fi = (IFileInfo)rcInfo;
-                       ITool[] tools = fi.getToolsToInvoke();
-                       if (tools != null && tools.length > 0) {
-                               tool = tools[0];
-//                             if(!tool.getCustomBuildStep())
-                                       addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
-                       }
-               }
-
-               ToolInfoHolder h = getToolInfo(rcInfo.getPath());
-               ITool buildTools[] = h.buildTools;
-
-//             if(tool == null){
-//                     for (int j=0; j<buildTools.length; j++) {
-//                             if (buildTools[j].buildsFileType(ext)) {
-//                                     if (tool == null) {
-//                                             tool = buildTools[j];
-//                                     }
-//                                     addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
-//                                     break;
-//                             }
-//                     }
-//             }
-//
-//             if(tool == null && rcInfo.getPath().segmentCount() != 0){
-               if(tool == null){
-                       h = getToolInfo(Path.EMPTY);
-                       buildTools = h.buildTools;
-
-                       for (ITool buildTool : buildTools) {
-                               if (buildTool.buildsFileType(ext)) {
-                                       tool = buildTool;
-                                       addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
-                                       break;
-                               }
-                       }
-               }
-
-               if (tool != null) {
-                       //  Generate the rule to build this source file
-                       IInputType primaryInputType = tool.getPrimaryInputType();
-                       IInputType inputType = tool.getInputType(ext);
-                       if ((primaryInputType != null && !primaryInputType.getMultipleOfType()) ||
-                               (inputType == null && tool != config.calculateTargetTool()))    {
-
-                               // Try to add the rule for the file
-                               Vector<IPath> generatedOutputs = new Vector<IPath>();           //  IPath's - build directory relative
-                               Vector<IPath> generatedDepFiles = new Vector<IPath>();  //  IPath's - build directory relative or absolute
-                               addRuleForSource(relativePath, ruleBuffer, resource, sourceLocation, rcInfo, generatedSource, generatedDepFiles, generatedOutputs);
-
-                               // If the rule generates a dependency file(s), add the file(s) to the variable
-                               if (generatedDepFiles.size() > 0) {
-                                       for (int k=0; k<generatedDepFiles.size(); k++) {
-                                               IPath generatedDepFile = generatedDepFiles.get(k);
-                                               addMacroAdditionFile(
-                                                       buildVarToRuleStringMap,
-                                                       getDepMacroName(ext).toString(),
-                                                       (generatedDepFile.isAbsolute() ? "" : "./") + //$NON-NLS-1$ //$NON-NLS-2$
-                                                       generatedDepFile.toString());
-                                       }
-                               }
-
-                               // If the generated outputs of this tool are input to another tool,
-                               // 1. add the output to the appropriate macro
-                               // 2. If the tool does not have multipleOfType input, generate the rule.
-
-                               IOutputType outType = tool.getPrimaryOutputType();
-                               String buildVariable = null;
-                               if (outType != null) {
-                                       if (tool.getCustomBuildStep()) {
-                                               // TODO: This is somewhat of a hack since a custom build step
-                                               //       tool does not currently define a build variable
-                                               if (generatedOutputs.size() > 0) {
-                                                       IPath firstOutput = generatedOutputs.get(0);
-                                                       String firstExt = firstOutput.getFileExtension();
-                                                       ToolInfoHolder tmpH = getFolderToolInfo(rcInfo.getPath());
-                                                       ITool[] tmpBuildTools = tmpH.buildTools;
-                                                       for (ITool tmpBuildTool : tmpBuildTools) {
-                                                               if (tmpBuildTool.buildsFileType(firstExt)) {
-                                                                       String bV = tmpBuildTool.getPrimaryInputType().getBuildVariable();
-                                                                       if (bV.length() > 0) {
-                                                                               buildVariable = bV;
-                                                                               break;
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       } else {
-                                               buildVariable = outType.getBuildVariable();
-                                       }
-                               } else {
-                                       // For support of pre-CDT 3.0 integrations.
-                                       buildVariable = OBJS_MACRO;
-                               }
-
-                               for (int k=0; k<generatedOutputs.size(); k++) {
-                                       IPath generatedOutput;
-                                       IResource generateOutputResource;
-                                       if (generatedOutputs.get(k).isAbsolute()) {
-                                               // TODO:  Should we use relative paths when possible (e.g., see MbsMacroSupplier.calculateRelPath)
-                                               generatedOutput = generatedOutputs.get(k);
-                                               //  If this file has an absolute path, then the generateOutputResource will not be correct
-                                               //  because the file is not under the project.  We use this resource in the calls to the dependency generator
-                                               generateOutputResource = project.getFile(generatedOutput);
-                                       } else {
-                                               generatedOutput = getPathForResource(project).append(getBuildWorkingDir()).append(generatedOutputs.get(k));
-                                               generateOutputResource = project.getFile(getBuildWorkingDir().append(generatedOutputs.get(k)));
-                                       }
-                                       IResourceInfo nextRcInfo;
-                                       if(rcInfo instanceof IFileInfo){
-                                               nextRcInfo = config.getResourceInfo(rcInfo.getPath().removeLastSegments(1), false);
-                                       } else {
-                                               nextRcInfo = rcInfo;
-                                       }
-                                       addFragmentMakefileEntriesForSource(buildVarToRuleStringMap, ruleBuffer,
-                                                       folder, relativePath, generateOutputResource, generatedOutput, nextRcInfo, buildVariable, true);
-                               }
-                       }
-               } else {
-                       //  If this is a secondary input, add it to build vars
-                       if (varName == null) {
-                               for (ITool buildTool : buildTools) {
-                                       if (buildTool.isInputFileType(ext)) {
-                                               addToBuildVar(buildVarToRuleStringMap, ext, varName, relativePath, sourceLocation, generatedSource);
-                                               break;
-                                       }
-                               }
-                       }
-                       //  If this generated output is identified as a secondary output, add the file to the build variable
-                       else {
-                               IOutputType[] secondaryOutputs = config.getToolChain().getSecondaryOutputs();
-                               if (secondaryOutputs.length > 0) {
-                                       if (isSecondaryOutputVar(h, secondaryOutputs, varName)) {
-                                               addMacroAdditionFile(buildVarToRuleStringMap, varName, relativePath, sourceLocation, generatedSource);
-                                       }
-                               }
-                       }
-               }
-       }
-       
-       protected boolean isSecondaryOutputVar(ToolInfoHolder h, IOutputType[] secondaryOutputs, String varName) {
-               ITool[] buildTools = h.buildTools;
-               for (ITool buildTool : buildTools) {
-                       // Add the specified output build variables
-                       IOutputType[] outTypes = buildTool.getOutputTypes();
-                       if (outTypes != null && outTypes.length > 0) {
-                               for (IOutputType outType : outTypes) {
-                                       //  Is this one of the secondary outputs?
-                                       //  Look for an outputType with this ID, or one with a superclass with this id
-                                       for (IOutputType secondaryOutput : secondaryOutputs) {
-                                               IOutputType matchType = outType;
-                                               do {
-                                                       if (matchType.getId().equals(secondaryOutput.getId())) {
-                                                               if (outType.getBuildVariable().equals(varName)) {
-                                                                       return true;
-                                                               }
-                                                       }
-                                                       matchType = matchType.getSuperClass();
-                                               } while (matchType != null);
-                                       }
-                               }
-                       }
-               }
-               return false;
-       }
-       
-       protected void addMacroAdditionFile(HashMap<String, String> map, String macroName, String filename) {
-               StringBuffer buffer = new StringBuffer();
-               buffer.append(map.get(macroName));
-
-               // escape whitespace in the filename
-               filename = escapeWhitespaces(filename);
-
-               buffer.append(filename + WHITESPACE + LINEBREAK);
-               // re-insert string in the map
-               map.put(macroName, buffer.toString());
-       }
-       
-       protected void addMacroAdditionFile(HashMap<String, String> map, String macroName,
-                       String relativePath, IPath sourceLocation, boolean generatedSource) {
-               //  Add the source file path to the makefile line that adds source files to the build variable
-               String srcName;
-               IPath projectLocation = getPathForResource(project);
-               IPath dirLocation = projectLocation;
-               if (generatedSource) {
-                       dirLocation = dirLocation.append(getBuildWorkingDir());
-               }
-               if (dirLocation.isPrefixOf(sourceLocation)) {
-                       IPath srcPath = sourceLocation.removeFirstSegments(dirLocation.segmentCount()).setDevice(null);
-                       if (generatedSource) {
-                               srcName = "./" + srcPath.toString();     //$NON-NLS-1$
-                       } else {
-                               srcName = ROOT + "/" + srcPath.toString();     //$NON-NLS-1$
-                       }
-               } else {
-                       if (generatedSource && !sourceLocation.isAbsolute()) {
-                               srcName = "./" + relativePath + sourceLocation.lastSegment().toString();        //$NON-NLS-1$
-                       } else {
-                               // TODO:  Should we use relative paths when possible (e.g., see MbsMacroSupplier.calculateRelPath)
-                               srcName = sourceLocation.toString();
-                       }
-               }
-               addMacroAdditionFile(map, macroName, srcName);
-       }
-       
-       public void addMacroAdditionFiles(HashMap<String, String> map, String macroName, Vector<String> filenames) {
-               StringBuffer buffer = new StringBuffer();
-               buffer.append(map.get(macroName));
-               for (int i=0; i<filenames.size(); i++) {
-                       String filename = filenames.get(i);
-                       if (filename.length() > 0) {
-                               buffer.append(filename + WHITESPACE + LINEBREAK);
-                       }
-               }
-               // re-insert string in the map
-               map.put(macroName, buffer.toString());
-       }
-       
-       protected void addToBuildVar (LinkedHashMap<String, String> buildVarToRuleStringMap, String ext,
-                       String varName, String relativePath, IPath sourceLocation, boolean generatedSource) {
-               List<IPath> varList = null;
-               if (varName == null) {
-                       // Get the proper source build variable based upon the extension
-                       varName = getSourceMacroName(ext).toString();
-                       varList = buildSrcVars.get(varName);
-               } else {
-                       varList = buildOutVars.get(varName);
-               }
-               //  Add the resource to the list of all resources associated with a variable.
-               //  Do not allow duplicates - there is no reason to and it can be 'bad' -
-               //  e.g., having the same object in the OBJS list can cause duplicate symbol errors from the linker
-               if ((varList != null) && !(varList.contains(sourceLocation))) {
-                       //  Since we don't know how these files will be used, we store them using a "location"
-                       //  path rather than a relative path
-                       varList.add(sourceLocation);
-                       if (!buildVarToRuleStringMap.containsKey(varName)) {
-                               //  TODO - is this an error?
-                       } else {
-                               //  Add the resource name to the makefile line that adds resources to the build variable
-                               addMacroAdditionFile(buildVarToRuleStringMap, varName, relativePath, sourceLocation, generatedSource);
-                       }
-               }
-       }
-       
-       private ToolInfoHolder getToolInfo(IPath path){
-               return getToolInfo(path, false);
-       }
-       
-       private ToolInfoHolder getToolInfo(IPath path, boolean create){
-               PathSettingsContainer child = toolInfos.getChildContainer(path, create, create);
-               ToolInfoHolder h = null;
-               if(child != null){
-                       h = (ToolInfoHolder)child.getValue();
-                       if(h == null && create){
-                               h = new ToolInfoHolder();
-                               child.setValue(h);
-                       }
-               }
-               return h;
-       }
-       
-       private ToolInfoHolder getFolderToolInfo(IPath path){
-               IResourceInfo rcInfo = config.getResourceInfo(path, false);
-               while(rcInfo instanceof IFileInfo){
-                       path = path.removeLastSegments(1);
-                       rcInfo = config.getResourceInfo(path, false);
-               }
-               return getToolInfo(path, false);
-       }
-       
-       protected StringBuffer writeAdditionMacros(LinkedHashMap<String, String> map) {
-               StringBuffer buffer = new StringBuffer();
-               // Add the comment
-               buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_VARS) + NEWLINE);
-
-               for (String macroString : map.values()) {
-                       // Check if we added any files to the rule
-                       // Currently, we do this by comparing the end of the rule buffer to MACRO_ADDITION_PREFIX_SUFFIX
-                       if (!(macroString.endsWith(MACRO_ADDITION_PREFIX_SUFFIX))) {
-                               StringBuffer currentBuffer = new StringBuffer();
-
-                               // Remove the final "/"
-                               if (macroString.endsWith(LINEBREAK)) {
-                                       macroString = macroString.substring(0, (macroString
-                                                       .length() - 2))
-                                                       + NEWLINE;
-                               }
-                               currentBuffer.append(macroString);
-
-                               currentBuffer.append(NEWLINE);
-
-                               // append the contents of the buffer to the master buffer for
-                               // the whole file
-                               buffer.append(currentBuffer);
-                       }
-               }
-               return buffer.append(NEWLINE);
-       }
-       
-       protected void addRuleForSource(String relativePath, StringBuffer buffer, IResource resource,
-                       IPath sourceLocation, IResourceInfo rcInfo,
-                       boolean generatedSource, Vector<IPath> generatedDepFiles, Vector<IPath> enumeratedOutputs) {
-
-               String fileName = sourceLocation.removeFileExtension().lastSegment();
-               String inputExtension = sourceLocation.getFileExtension();
-               String outputExtension = null;
-
-               ITool tool = null;
-               if( rcInfo instanceof IFileInfo) {
-                       IFileInfo fi = (IFileInfo)rcInfo;
-                       ITool[] tools = fi.getToolsToInvoke();
-                       if (tools != null && tools.length > 0) {
-                               tool = tools[0];
-                       }
-               } else {
-                       IFolderInfo foInfo = (IFolderInfo)rcInfo;
-                       tool = foInfo.getToolFromInputExtension(inputExtension);
-               }
-
-               ToolInfoHolder h = getToolInfo(rcInfo.getPath());
-
-               if (tool!=null)
-                       outputExtension = tool.getOutputExtension(inputExtension);
-               if(outputExtension == null)
-                       outputExtension = EMPTY_STRING;
-
-               //  Get the dependency generator information for this tool and file extension
-               IManagedDependencyGenerator oldDepGen = null;           //  This interface is deprecated but still supported
-               IManagedDependencyGenerator2 depGen = null;                     //  This is the recommended interface
-               IManagedDependencyInfo depInfo = null;
-               IManagedDependencyCommands depCommands = null;
-               IManagedDependencyPreBuild depPreBuild = null;
-               IPath[] depFiles = null;
-               boolean doDepGen = false;
-               {
-                       IManagedDependencyGeneratorType t = null;
-                       if (tool!=null)
-                               t = tool.getDependencyGeneratorForExtension(inputExtension);
-                       if (t != null) {
-                               int calcType = t.getCalculatorType();
-                               if (calcType <= IManagedDependencyGeneratorType.TYPE_OLD_TYPE_LIMIT) {
-                                       oldDepGen = (IManagedDependencyGenerator)t;
-                                       doDepGen = (calcType == IManagedDependencyGeneratorType.TYPE_COMMAND);
-                                       if (doDepGen) {
-                                               IPath depFile = Path.fromOSString(relativePath + fileName + DOT + DEP_EXT);
-                                               getDependencyMakefiles(h).add(depFile);
-                                               generatedDepFiles.add(depFile);
-                                       }
-                               } else {
-                                       depGen = (IManagedDependencyGenerator2)t;
-                                       doDepGen = (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS);
-                                       IBuildObject buildContext = rcInfo;//(resConfig != null) ? (IBuildObject)resConfig : (IBuildObject)config;
-
-                                       depInfo = depGen.getDependencySourceInfo(resource.getProjectRelativePath(), resource, buildContext, tool, getBuildWorkingDir());
-
-                                       if (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS) {
-                                               depCommands = (IManagedDependencyCommands)depInfo;
-                                               depFiles = depCommands.getDependencyFiles();
-                                       } else if (calcType == IManagedDependencyGeneratorType.TYPE_PREBUILD_COMMANDS) {
-                                               depPreBuild = (IManagedDependencyPreBuild)depInfo;
-                                               depFiles = depPreBuild.getDependencyFiles();
-                                       }
-                                       if (depFiles != null) {
-                                               for (IPath depFile : depFiles) {
-                                                       getDependencyMakefiles(h).add(depFile);
-                                                       generatedDepFiles.add(depFile);
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               // Figure out the output paths
-               String optDotExt = EMPTY_STRING;
-               if (outputExtension != null && outputExtension.length() > 0)
-                       optDotExt = DOT + outputExtension;
-
-               Vector<IPath> ruleOutputs = new Vector<IPath>();
-               Vector<IPath> enumeratedPrimaryOutputs = new Vector<IPath>();           // IPaths relative to the top build directory
-               Vector<IPath> enumeratedSecondaryOutputs = new Vector<IPath>(); // IPaths relative to the top build directory
-               calculateOutputsForSource(tool, relativePath, resource, sourceLocation, ruleOutputs, enumeratedPrimaryOutputs, enumeratedSecondaryOutputs);
-               enumeratedOutputs.addAll(enumeratedPrimaryOutputs);
-               enumeratedOutputs.addAll(enumeratedSecondaryOutputs);
-               String primaryOutputName = null;
-               if (enumeratedPrimaryOutputs.size() > 0) {
-                       primaryOutputName = escapeWhitespaces(enumeratedPrimaryOutputs.get(0).toString());
-               } else {
-                       primaryOutputName = escapeWhitespaces(relativePath + fileName + optDotExt);
-               }
-               String otherPrimaryOutputs = EMPTY_STRING;
-               for (int i=1; i<enumeratedPrimaryOutputs.size(); i++) {         // Starting with 1 is intentional
-                       otherPrimaryOutputs += WHITESPACE + escapeWhitespaces(enumeratedPrimaryOutputs.get(i).toString());
-               }
-
-               // Output file location needed for the file-specific build macros
-               IPath outputLocation = Path.fromOSString(primaryOutputName);
-               if (!outputLocation.isAbsolute()) {
-                       outputLocation = getPathForResource(project).append(getBuildWorkingDir()).append(primaryOutputName);
-               }
-
-               // A separate rule is needed for the resource in the case where explicit file-specific macros
-               // are referenced, or if the resource contains special characters in its path (e.g., whitespace)
-
-               /* fix for 137674
-                *
-                * We only need an explicit rule if one of the following is true:
-                * - The resource is linked, and its full path to its real location contains special characters
-                * - The resource is not linked, but its project relative path contains special characters
-               */
-
-               boolean resourceNameRequiresExplicitRule = (resource.isLinked() && containsSpecialCharacters(sourceLocation
-                               .toString()))
-                               || (!resource.isLinked() && containsSpecialCharacters(resource
-                                               .getProjectRelativePath().toString()));
-
-               boolean needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
-                       BuildMacroProvider.getReferencedExplitFileMacros(tool).length > 0
-                               || BuildMacroProvider.getReferencedExplitFileMacros(tool
-                                               .getToolCommand(), IBuildMacroProvider.CONTEXT_FILE,
-                                               new FileContextData(sourceLocation, outputLocation,
-                                                               null, tool)).length > 0;
-
-               // Get and resolve the command
-               String cmd = tool.getToolCommand();
-
-               try {
-                       String resolvedCommand = null;
-                       if (!needExplicitRuleForFile) {
-                               resolvedCommand = ManagedBuildManager.getBuildMacroProvider()
-                                               .resolveValueToMakefileFormat(
-                                                               cmd,
-                                                               EMPTY_STRING,
-                                                               WHITESPACE,
-                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                               new FileContextData(sourceLocation,
-                                                                               outputLocation, null, tool));
-                       } else {
-                               // if we need an explicit rule then don't use any builder
-                               // variables, resolve everything
-                               // to explicit strings
-                               resolvedCommand = ManagedBuildManager.getBuildMacroProvider()
-                                               .resolveValue(
-                                                               cmd,
-                                                               EMPTY_STRING,
-                                                               WHITESPACE,
-                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                               new FileContextData(sourceLocation,
-                                                                               outputLocation, null, tool));
-                       }
-
-                       if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
-                               cmd = resolvedCommand;
-
-               } catch (BuildMacroException e) {
-               }
-
-               String defaultOutputName = EMPTY_STRING;
-               String primaryDependencyName = EMPTY_STRING;
-               String patternPrimaryDependencyName = EMPTY_STRING;
-               String home = (generatedSource)? DOT : ROOT;
-               String resourcePath = null;
-               boolean patternRule = true;
-               boolean isItLinked = false;
-               if(resource.isLinked(IResource.CHECK_ANCESTORS)) {
-                       // it IS linked, so use the actual location
-                       isItLinked = true;
-                       resourcePath = sourceLocation.toString();
-                       // Need a hardcoded rule, not a pattern rule, as a linked file
-                       // can reside in any path
-                       defaultOutputName = escapeWhitespaces(relativePath + fileName + optDotExt);
-                       primaryDependencyName = escapeWhitespaces(resourcePath);
-                       patternRule = false;
-               } else {
-                       // Use the relative path (not really needed to store per se but in the future someone may want this)
-                       resourcePath = relativePath;
-                       // The rule and command to add to the makefile
-                       if( rcInfo instanceof IFileInfo || needExplicitRuleForFile) {
-                               // Need a hardcoded rule, not a pattern rule
-                               defaultOutputName = escapeWhitespaces(resourcePath + fileName + optDotExt);
-                               patternRule = false;
-                       } else {
-                               defaultOutputName = relativePath + WILDCARD + optDotExt;
-                       }
-                       primaryDependencyName = escapeWhitespaces(home + SEPARATOR + resourcePath + fileName + DOT + inputExtension);
-                       patternPrimaryDependencyName = home + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
-               } // end fix for PR 70491
-
-               //  If the tool specifies a dependency calculator of TYPE_BUILD_COMMANDS, ask whether
-               //  the dependency commands are "generic" (i.e., we can use a pattern rule)
-               boolean needExplicitDependencyCommands = false;
-               if (depCommands != null) {
-                       needExplicitDependencyCommands = !depCommands.areCommandsGeneric();
-               }
-
-               //  If we still think that we are using a pattern rule, check a few more things
-               if (patternRule) {
-                       patternRule = false;
-                       //  Make sure that at least one of the rule outputs contains a %.
-                       for (int i=0; i<ruleOutputs.size(); i++) {
-                               String ruleOutput = ruleOutputs.get(i).toString();
-                               if (ruleOutput.indexOf('%') >= 0) {
-                                       patternRule = true;
-                                       break;
-                               }
-                       }
-                       if (patternRule) {
-                               patternRule = !needExplicitDependencyCommands;
-                       }
-               }
-
-               // Begin building the rule for this source file
-               String buildRule = EMPTY_STRING;
-
-               if (patternRule) {
-                       if (ruleOutputs.size() == 0) {
-                               buildRule += defaultOutputName;
-                       } else {
-                               boolean first = true;
-                               for (int i=0; i<ruleOutputs.size(); i++) {
-                                       String ruleOutput = ruleOutputs.get(i).toString();
-                                       if (ruleOutput.indexOf('%') >= 0) {
-                                               if (first) {
-                                                       first = false;
-                                               } else {
-                                                       buildRule += WHITESPACE;
-                                               }
-                                               buildRule += ruleOutput;
-                                       }
-                               }
-                       }
-               } else {
-                       buildRule += primaryOutputName;
-               }
-
-               String buildRuleDependencies = primaryDependencyName;
-               String patternBuildRuleDependencies = patternPrimaryDependencyName;
-
-               // Other additional inputs
-               // Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
-               IPath[] addlDepPaths = tool.getAdditionalDependencies();
-               for (IPath addlDepPath : addlDepPaths) {
-                       // Translate the path from project relative to build directory relative
-                       IPath addlPath = addlDepPath;
-                       if (!(addlPath.toString().startsWith("$("))) {          //$NON-NLS-1$
-                               if (!addlPath.isAbsolute()) {
-                                       IPath tempPath = project.getLocation().append(new Path(ensureUnquoted(addlPath.toString())));
-                                       if (tempPath != null) {
-                                               addlPath = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), tempPath);
-                                       }
-                               }
-                       }
-                       String suitablePath = ensurePathIsGNUMakeTargetRuleCompatibleSyntax(addlPath.toString());
-                       buildRuleDependencies += WHITESPACE + suitablePath;
-                       patternBuildRuleDependencies += WHITESPACE + suitablePath;
-               }
-
-               buildRule += COLON + WHITESPACE + (patternRule ? patternBuildRuleDependencies : buildRuleDependencies);
-
-               // No duplicates in a makefile.  If we already have this rule, don't add it or the commands to build the file
-               if (getRuleList().contains(buildRule)) {
-                       //  TODO:  Should we assert that this is a pattern rule?
-               }
-               else {
-                       getRuleList().add(buildRule);
-
-                       // Echo starting message
-                       buffer.append(buildRule + NEWLINE);
-                       buffer.append(TAB + AT + escapedEcho(MESSAGE_START_FILE + WHITESPACE + IN_MACRO));
-                       buffer.append(TAB + AT + escapedEcho(tool.getAnnouncement()));
-
-                       // If the tool specifies a dependency calculator of TYPE_BUILD_COMMANDS, ask whether
-                       // there are any pre-tool commands.
-                       if (depCommands != null) {
-                               String[] preToolCommands = depCommands.getPreToolDependencyCommands();
-                               if (preToolCommands != null && preToolCommands.length > 0) {
-                                       for (String preCmd : preToolCommands) {
-                                               try {
-                                                       String resolvedCommand;
-                                                       IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
-                                                       if (!needExplicitRuleForFile) {
-                                                               resolvedCommand = provider.resolveValueToMakefileFormat(
-                                                                                               preCmd,
-                                                                                               EMPTY_STRING,
-                                                                                               WHITESPACE,
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(sourceLocation,
-                                                                                                               outputLocation, null, tool));
-                                                       } else {
-                                                               // if we need an explicit rule then don't use any builder
-                                                               // variables, resolve everything to explicit strings
-                                                               resolvedCommand = provider.resolveValue(
-                                                                                               preCmd,
-                                                                                               EMPTY_STRING,
-                                                                                               WHITESPACE,
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(sourceLocation,
-                                                                                                               outputLocation, null, tool));
-                                                       }
-                                                       if (resolvedCommand != null)
-                                                               buffer.append(resolvedCommand + NEWLINE);
-                                               } catch (BuildMacroException e) {
-                                               }
-                                       }
-                               }
-                       }
-
-                       // Generate the command line
-
-                       Vector<String> inputs = new Vector<String>();
-                       inputs.add(IN_MACRO);
-
-                       // Other additional inputs
-                       // Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
-                       IPath[] addlInputPaths = getAdditionalResourcesForSource(tool);
-                       for (IPath addlInputPath : addlInputPaths) {
-                               // Translate the path from project relative to build directory relative
-                               IPath addlPath = addlInputPath;
-                               if (!(addlPath.toString().startsWith("$("))) {          //$NON-NLS-1$
-                                       if (!addlPath.isAbsolute()) {
-                                               IPath tempPath = getPathForResource(project).append(addlPath);
-                                               if (tempPath != null) {
-                                                       addlPath = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), tempPath);
-                                               }
-                                       }
-                               }
-                               inputs.add(addlPath.toString());
-                       }
-                       String[] inputStrings = inputs.toArray(new String[inputs.size()]);
-
-                       String[] flags = null;
-                       // Get the tool command line options
-                       try {
-                               flags = tool.getToolCommandFlags(sourceLocation, outputLocation);
-                       } catch( BuildException ex ) {
-                               // TODO add some routines to catch this
-                               flags = EMPTY_STRING_ARRAY;
-                       }
-
-                       // If we have a TYPE_BUILD_COMMANDS dependency generator, determine if there are any options that
-                       // it wants added to the command line
-                       if (depCommands != null) {
-                               flags = addDependencyOptions(depCommands, flags);
-                       }
-
-                       IManagedCommandLineInfo cmdLInfo = null;
-                       String outflag = null;
-                       String outputPrefix = null;
-
-                       if( rcInfo instanceof IFileInfo || needExplicitRuleForFile || needExplicitDependencyCommands) {
-                               outflag = tool.getOutputFlag();
-                               outputPrefix = tool.getOutputPrefix();
-
-                               // Call the command line generator
-                               IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
-                               cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix,
-                                               OUT_MACRO + otherPrimaryOutputs, inputStrings, tool.getCommandLinePattern() );
-
-                       } else {
-                               outflag = tool.getOutputFlag();//config.getOutputFlag(outputExtension);
-                               outputPrefix = tool.getOutputPrefix();//config.getOutputPrefix(outputExtension);
-
-                               // Call the command line generator
-                               cmdLInfo = generateToolCommandLineInfo(tool, inputExtension, flags, outflag, outputPrefix,
-                                               OUT_MACRO + otherPrimaryOutputs, inputStrings, sourceLocation, outputLocation );
-                       }
-
-                       // The command to build
-                       String buildCmd;
-                       if (cmdLInfo != null) {
-                               buildCmd = cmdLInfo.getCommandLine();
-                       } else {
-                               StringBuffer buildFlags = new StringBuffer();
-                               for (String flag : flags) {
-                                       if( flag != null ) {
-                                               buildFlags.append( flag + WHITESPACE );
-                                       }
-                               }
-                               buildCmd = cmd + WHITESPACE + buildFlags.toString().trim() + WHITESPACE + outflag + WHITESPACE +
-                                       outputPrefix + OUT_MACRO + otherPrimaryOutputs + WHITESPACE + IN_MACRO;
-                       }
-
-            // resolve any remaining macros in the command after it has been
-            // generated
-                       try {
-                               String resolvedCommand;
-                               IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
-                               if (!needExplicitRuleForFile) {
-                                       resolvedCommand = provider.resolveValueToMakefileFormat(
-                                                                       buildCmd,
-                                                                       EMPTY_STRING,
-                                                                       WHITESPACE,
-                                                                       IBuildMacroProvider.CONTEXT_FILE,
-                                                                       new FileContextData(sourceLocation,
-                                                                                       outputLocation, null, tool));
-                               } else {
-                                       // if we need an explicit rule then don't use any builder
-                                       // variables, resolve everything to explicit strings
-                                       resolvedCommand = provider.resolveValue(
-                                                                       buildCmd,
-                                                                       EMPTY_STRING,
-                                                                       WHITESPACE,
-                                                                       IBuildMacroProvider.CONTEXT_FILE,
-                                                                       new FileContextData(sourceLocation,
-                                                                                       outputLocation, null, tool));
-                               }
-
-                               if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
-                                       buildCmd = resolvedCommand;
-
-                       } catch (BuildMacroException e) {
-                       }
-
-                       //buffer.append(TAB + AT + escapedEcho(buildCmd));
-                       //buffer.append(TAB + AT + buildCmd);
-                       buffer.append(TAB + buildCmd);
-
-                       // Determine if there are any dependencies to calculate
-                       if (doDepGen) {
-                               // Get the dependency rule out of the generator
-                               String[] depCmds = null;
-                               if (oldDepGen != null) {
-                                       depCmds = new String[1];
-                                       depCmds[0] = oldDepGen.getDependencyCommand(resource, ManagedBuildManager.getBuildInfo(project));
-                               } else {
-                                       if (depCommands != null) {
-                                               depCmds = depCommands.getPostToolDependencyCommands();
-                                       }
-                               }
-
-                               if (depCmds != null) {
-                                       for (String depCmd : depCmds) {
-                               // Resolve any macros in the dep command after it has been generated.
-                               // Note:  do not trim the result because it will strip out necessary tab characters.
-                                               buffer.append(WHITESPACE + LOGICAL_AND + WHITESPACE + LINEBREAK);
-                               try {
-                                                       if (!needExplicitRuleForFile) {
-                                                               depCmd = ManagedBuildManager.getBuildMacroProvider()
-                                                                               .resolveValueToMakefileFormat(
-                                                                                               depCmd,
-                                                                                               EMPTY_STRING,
-                                                                                               WHITESPACE,
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(sourceLocation,
-                                                                                                               outputLocation, null,
-                                                                                                               tool));
-                                                       }
-
-                                                       else {
-                                                               depCmd = ManagedBuildManager.getBuildMacroProvider()
-                                                                               .resolveValue(
-                                                                                               depCmd,
-                                                                                               EMPTY_STRING,
-                                                                                               WHITESPACE,
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(sourceLocation,
-                                                                                                               outputLocation, null,
-                                                                                                               tool));
-                                                       }
-
-                                               } catch (BuildMacroException e) {
-                                               }
-
-                                               buffer.append(depCmd);
-                                       }
-                               }
-                       }
-
-                       // Echo finished message
-                       buffer.append(NEWLINE);
-                       buffer.append(TAB + AT + escapedEcho(MESSAGE_FINISH_FILE + WHITESPACE + IN_MACRO));
-                       buffer.append(TAB + AT + ECHO_BLANK_LINE + NEWLINE);
-               }
-
-               // Determine if there are calculated dependencies
-               IPath[] addlDeps = null;                // IPath's that are relative to the build directory
-               IPath[] addlTargets = null;             // IPath's that are relative to the build directory
-               String calculatedDependencies = null;
-               boolean addedDepLines = false;
-               String depLine;
-               if (oldDepGen != null && oldDepGen.getCalculatorType() != IManagedDependencyGeneratorType.TYPE_COMMAND) {
-                       addlDeps = oldCalculateDependenciesForSource(oldDepGen, tool, relativePath, resource);
-               } else {
-                       if (depGen != null && depGen.getCalculatorType() == IManagedDependencyGeneratorType.TYPE_CUSTOM) {
-                               if (depInfo instanceof IManagedDependencyCalculator) {
-                                       IManagedDependencyCalculator depCalculator = (IManagedDependencyCalculator)depInfo;
-                                       addlDeps = calculateDependenciesForSource(depCalculator);
-                                       addlTargets = depCalculator.getAdditionalTargets();
-                               }
-                       }
-               }
-
-               if (addlDeps != null && addlDeps.length > 0) {
-                       calculatedDependencies = new String();
-                       for (IPath addlDep : addlDeps) {
-                               calculatedDependencies += WHITESPACE + escapeWhitespaces(addlDep.toString());
-                       }
-               }
-
-               if (calculatedDependencies != null) {
-                       depLine = primaryOutputName + COLON + calculatedDependencies + NEWLINE;
-                       if (!getDepLineList().contains(depLine)) {
-                               getDepLineList().add(depLine);
-                               addedDepLines = true;
-                               buffer.append(depLine);
-                       }
-               }
-
-               // Add any additional outputs here using dependency lines
-               Vector<IPath> addlOutputs = new Vector<IPath>();
-               if (enumeratedPrimaryOutputs.size() > 1) {
-                       // Starting with 1 is intentional in order to skip the primary output
-                       for (int i=1; i<enumeratedPrimaryOutputs.size(); i++) addlOutputs.add(enumeratedPrimaryOutputs.get(i));
-               }
-               addlOutputs.addAll(enumeratedSecondaryOutputs);
-               if (addlTargets != null) {
-                       for (IPath addlTarget : addlTargets)
-                               addlOutputs.add(addlTarget);
-               }
-               for (int i=0; i<addlOutputs.size(); i++) {
-                       depLine = escapeWhitespaces(addlOutputs.get(i).toString()) + COLON + WHITESPACE + primaryOutputName;
-                       if (calculatedDependencies != null) depLine += calculatedDependencies;
-                       depLine += NEWLINE;
-                       if (!getDepLineList().contains(depLine)) {
-                               getDepLineList().add(depLine);
-                               addedDepLines = true;
-                               buffer.append(depLine);
-                       }
-               }
-               if (addedDepLines) {
-                       buffer.append(NEWLINE);
-               }
-
-               //  If we are using a dependency calculator of type TYPE_PREBUILD_COMMANDS,
-               //  get the rule to build the dependency file
-               if (depPreBuild != null && depFiles != null) {
-                       addedDepLines = false;
-                       String[] preBuildCommands = depPreBuild.getDependencyCommands();
-                       if (preBuildCommands != null) {
-                               depLine = "";           //$NON-NLS-1$
-                               //  Can we use a pattern rule?
-                               patternRule = !isItLinked && !needExplicitRuleForFile && depPreBuild.areCommandsGeneric();
-                               //  Begin building the rule
-                               for (int i=0; i<depFiles.length; i++) {
-                                       if (i > 0) depLine += WHITESPACE;
-                                       if (patternRule) {
-                                               optDotExt = EMPTY_STRING;
-                                               String depExt = depFiles[i].getFileExtension();
-                                               if (depExt != null && depExt.length() > 0)
-                                               optDotExt = DOT + depExt;
-                                               depLine += escapeWhitespaces(relativePath + WILDCARD + optDotExt);
-                                       } else {
-                                               depLine += escapeWhitespaces((depFiles[i]).toString());
-                                       }
-                               }
-                               depLine += COLON + WHITESPACE + (patternRule ? patternBuildRuleDependencies : buildRuleDependencies);
-                               if (!getDepRuleList().contains(depLine)) {
-                                       getDepRuleList().add(depLine);
-                                       addedDepLines = true;
-                                       buffer.append(depLine + NEWLINE);
-                                       buffer.append(TAB + AT + escapedEcho(MESSAGE_START_DEPENDENCY + WHITESPACE + OUT_MACRO));
-                                       for (String preBuildCommand : preBuildCommands) {
-                                               depLine = preBuildCommand;
-                                               // Resolve macros
-                               try {
-                                                       if (!needExplicitRuleForFile) {
-                                                               depLine = ManagedBuildManager.getBuildMacroProvider()
-                                                                               .resolveValueToMakefileFormat(
-                                                                                               depLine,
-                                                                                               EMPTY_STRING,
-                                                                                               WHITESPACE,
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(sourceLocation,
-                                                                                                               outputLocation, null,
-                                                                                                               tool));
-                                                       }
-
-                                                       else {
-                                                               depLine = ManagedBuildManager.getBuildMacroProvider()
-                                                                               .resolveValue(
-                                                                                               depLine,
-                                                                                               EMPTY_STRING,
-                                                                                               WHITESPACE,
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(sourceLocation,
-                                                                                                               outputLocation, null,
-                                                                                                               tool));
-                                                       }
-
-                                               } catch (BuildMacroException e) {
-                                               }
-                                               //buffer.append(TAB + AT + escapedEcho(depLine));
-                                               //buffer.append(TAB + AT + depLine + NEWLINE);
-                                               buffer.append(TAB + depLine + NEWLINE);
-                                       }
-                               }
-                               if (addedDepLines) {
-                                       buffer.append(TAB + AT + ECHO_BLANK_LINE + NEWLINE);
-                               }
-                       }
-               }
-       }
-       
-       private List<IPath> getDependencyMakefiles(ToolInfoHolder h) {
-               if (h.dependencyMakefiles == null) {
-                       h.dependencyMakefiles = new ArrayList<IPath>();
-               }
-               return h.dependencyMakefiles;
-       }
-       
-       protected void calculateOutputsForSource(ITool tool, String relativePath, IResource resource,
-                       IPath sourceLocation, Vector<IPath> ruleOutputs, Vector<IPath> enumeratedPrimaryOutputs, Vector<IPath> enumeratedSecondaryOutputs) {
-               String inExt = sourceLocation.getFileExtension();
-               String outExt = tool.getOutputExtension(inExt);
-               IResourceInfo rcInfo = tool.getParentResourceInfo();
-
-               IOutputType[] outTypes = tool.getOutputTypes();
-               if (outTypes != null && outTypes.length > 0) {
-                       for (IOutputType type : outTypes) {
-                               boolean primaryOutput = (type == tool.getPrimaryOutputType());
-                               //if (primaryOutput && ignorePrimary) continue;
-                               String outputPrefix = type.getOutputPrefix();
-
-                // Resolve any macros in the outputPrefix
-                // Note that we cannot use file macros because if we do a clean
-                // we need to know the actual name of the file to clean, and
-                // cannot use any builder variables such as $@. Hence we use the
-                // next best thing, i.e. configuration context.
-
-                // figure out the configuration we're using
-//                IBuildObject toolParent = tool.getParent();
-//                IConfiguration config = null;
-                // if the parent is a config then we're done
-//                if (toolParent instanceof IConfiguration)
-//                    config = (IConfiguration) toolParent;
-//                else if (toolParent instanceof IToolChain) {
-//                    // must be a toolchain
-//                    config = (IConfiguration) ((IToolChain) toolParent)
-//                            .getParent();
-//                }
-//
-//                else if (toolParent instanceof IResourceConfiguration) {
-//                    config = (IConfiguration) ((IResourceConfiguration) toolParent)
-//                            .getParent();
-//                }
-
-//                else {
-//                    // bad
-//                    throw new AssertionError(
-//                            "tool parent must be one of configuration, toolchain, or resource configuration");
-//                }
-
-//                if (config != null) {
-
-                    try {
-
-                       if(containsSpecialCharacters(sourceLocation.toString()))
-                       {
-                               outputPrefix = ManagedBuildManager
-                            .getBuildMacroProvider()
-                            .resolveValue(
-                                    outputPrefix,
-                                    "", //$NON-NLS-1$
-                                    " ", //$NON-NLS-1$
-                                    IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                    config);
-                       }
-                       else {
-                        outputPrefix = ManagedBuildManager
-                                .getBuildMacroProvider()
-                                .resolveValueToMakefileFormat(
-                                        outputPrefix,
-                                        "", //$NON-NLS-1$
-                                        " ", //$NON-NLS-1$
-                                        IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                        config);
-                       }
-                    }
-
-                    catch (BuildMacroException e) {
-                    }
-
-//                }
-
-
-
-                               boolean multOfType = type.getMultipleOfType();
-                               IOption option = tool.getOptionBySuperClassId(type.getOptionId());
-                               IManagedOutputNameProvider nameProvider = type.getNameProvider();
-                               String[] outputNames = type.getOutputNames();
-
-                               //  1.  If the tool is the build target and this is the primary output,
-                               //      use artifact name & extension
-                               //      Not appropriate here...
-                               //  2.  If an option is specified, use the value of the option
-                               if (option != null) {
-                                       try {
-                                               List<String> outputList = new ArrayList<String>();
-                                               int optType = option.getValueType();
-                                               if (optType == IOption.STRING) {
-                                                       outputList.add(outputPrefix + option.getStringValue());
-                                               } else if (
-                                                               optType == IOption.STRING_LIST ||
-                                                               optType == IOption.LIBRARIES ||
-                                                               optType == IOption.OBJECTS ||
-                                                               optType == IOption.INCLUDE_FILES ||
-                                                               optType == IOption.LIBRARY_PATHS ||
-                                                               optType == IOption.LIBRARY_FILES ||
-                                                               optType == IOption.MACRO_FILES) {
-                                                       @SuppressWarnings("unchecked")
-                                                       List<String> value = (List<String>)option.getValue();
-                                                       outputList = value;
-                                                       ((Tool)tool).filterValues(optType, outputList);
-                                                       // Add outputPrefix to each if necessary
-                                                       if (outputPrefix.length() > 0) {
-                                                               for (int j=0; j<outputList.size(); j++) {
-                                                                       outputList.set(j, outputPrefix + outputList.get(j));
-                                                               }
-                                                       }
-                                               }
-                                               for (int j=0; j<outputList.size(); j++) {
-                                                       String outputName = outputList.get(j);
-
-
-
-                                                       // try to resolve the build macros in the output
-                                                       // names
-                                                       try {
-
-                                                               String resolved = null;
-
-                                                               if (containsSpecialCharacters(sourceLocation.toString()))
-                                                               {
-                                                                       resolved = ManagedBuildManager
-                                                                                       .getBuildMacroProvider()
-                                                                                       .resolveValue(
-                                                                                                       outputName,
-                                                                                                       "", //$NON-NLS-1$
-                                                                                                       " ", //$NON-NLS-1$
-                                                                                                       IBuildMacroProvider.CONTEXT_FILE,
-                                                                                                       new FileContextData(
-                                                                                                                       sourceLocation,
-                                                                                                                       null, option, tool));
-                                                               }
-
-                                                               else {
-                                                                       resolved = ManagedBuildManager
-                                                                                       .getBuildMacroProvider()
-                                                                                       .resolveValueToMakefileFormat(
-                                                                                                       outputName,
-                                                                                                       "", //$NON-NLS-1$
-                                                                                                       " ", //$NON-NLS-1$
-                                                                                                       IBuildMacroProvider.CONTEXT_FILE,
-                                                                                                       new FileContextData(
-                                                                                                                       sourceLocation,
-                                                                                                                       null, option, tool));
-                                                               }
-
-                                                               if((resolved = resolved.trim()).length() > 0)
-                                                                       outputName = resolved;
-                                                       } catch (BuildMacroException e){
-                                                       }
-
-                                                       IPath outPath = Path.fromOSString(outputName);
-                                                       //  If only a file name is specified, add the relative path of this output directory
-                                                       if (outPath.segmentCount() == 1) {
-                                                               outPath = Path.fromOSString(relativePath + outputList.get(j));
-                                                       }
-                                                       if (primaryOutput) {
-                                                               ruleOutputs.add(j, outPath);
-                                                               enumeratedPrimaryOutputs.add(j, resolvePercent(outPath, sourceLocation));
-                                                       } else {
-                                                               ruleOutputs.add(outPath);
-                                                               enumeratedSecondaryOutputs.add(resolvePercent(outPath, sourceLocation));
-                                                       }
-                                               }
-                                       } catch( BuildException ex ) {}
-                               } else
-                               //  3.  If a nameProvider is specified, call it
-                               if (nameProvider != null) {
-                                       IPath[] inPaths = new IPath[1];
-                                       inPaths[0] = sourceLocation;
-                                       IPath[] outPaths = nameProvider.getOutputNames(tool, inPaths);
-                                       for (int j=0; j<outPaths.length; j++) {
-                                               IPath outPath = outPaths[j];
-                                               String outputName = outPaths[j].toString();
-
-
-                                               // try to resolve the build macros in the output names
-                                               try {
-
-                                                       String resolved = null;
-
-                                                       if (containsSpecialCharacters(sourceLocation.toString()))
-                                                       {
-                                                               resolved = ManagedBuildManager
-                                                                               .getBuildMacroProvider()
-                                                                               .resolveValue(
-                                                                                               outputName,
-                                                                                               "", //$NON-NLS-1$
-                                                                                               " ", //$NON-NLS-1$
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(
-                                                                                                               sourceLocation, null,
-                                                                                                               option, tool));
-                                                       }
-
-                                                       else {
-                                                               resolved = ManagedBuildManager
-                                                                               .getBuildMacroProvider()
-                                                                               .resolveValueToMakefileFormat(
-                                                                                               outputName,
-                                                                                               "", //$NON-NLS-1$
-                                                                                               " ", //$NON-NLS-1$
-                                                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                                                               new FileContextData(
-                                                                                                               sourceLocation, null,
-                                                                                                               option, tool));
-                                                       }
-
-                                                       if ((resolved = resolved.trim()).length() > 0)
-                                                               outputName = resolved;
-                                               } catch (BuildMacroException e) {
-                                               }
-
-                                               //  If only a file name is specified, add the relative path of this output directory
-                                               if (outPath.segmentCount() == 1) {
-                                                       outPath = Path.fromOSString(relativePath + outPath.toString());
-                                               }
-                                               if (primaryOutput) {
-                                                       ruleOutputs.add(j, outPath);
-                                                       enumeratedPrimaryOutputs.add(j, resolvePercent(outPath, sourceLocation));
-                                               } else {
-                                                       ruleOutputs.add(outPath);
-                                                       enumeratedSecondaryOutputs.add(resolvePercent(outPath, sourceLocation));
-                                               }
-                                       }
-                               } else
-                               //  4.  If outputNames is specified, use it
-                               if (outputNames != null) {
-                                       for (int j = 0; j < outputNames.length; j++) {
-                                               String outputName = outputNames[j];
-                                               try{
-                                                       //try to resolve the build macros in the output names
-                                                       String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                       outputName,
-                                                                       "", //$NON-NLS-1$
-                                                                       " ", //$NON-NLS-1$
-                                                                       IBuildMacroProvider.CONTEXT_FILE,
-                                                                       new FileContextData(sourceLocation, null, option, tool));
-                                                       if((resolved = resolved.trim()).length() > 0)
-                                                               outputName = resolved;
-                                               } catch (BuildMacroException e){
-                                               }
-
-                                               IPath outPath = Path.fromOSString(outputName);
-                                               //  If only a file name is specified, add the relative path of this output directory
-                                               if (outPath.segmentCount() == 1) {
-                                                       outPath = Path.fromOSString(relativePath + outPath.toString());
-                                               }
-                                               if (primaryOutput) {
-                                                       ruleOutputs.add(j, outPath);
-                                                       enumeratedPrimaryOutputs.add(j, resolvePercent(outPath, sourceLocation));
-                                               } else {
-                                                       ruleOutputs.add(outPath);
-                                                       enumeratedSecondaryOutputs.add(resolvePercent(outPath, sourceLocation));
-                                               }
-                                       }
-                               } else {
-                               //  5.  Use the name pattern to generate a transformation macro
-                               //      so that the source names can be transformed into the target names
-                               //      using the built-in string substitution functions of <code>make</code>.
-                                       if (multOfType) {
-                                               // This case is not handled - a nameProvider or outputNames must be specified
-                                               // TODO - report error
-                                       } else {
-                                               String namePattern = type.getNamePattern();
-                                               IPath namePatternPath = null;
-                                               if (namePattern == null || namePattern.length() == 0) {
-                                                       namePattern = relativePath + outputPrefix + IManagedBuilderMakefileGenerator.WILDCARD;
-                                                       if (outExt != null && outExt.length() > 0) {
-                                                               namePattern += DOT + outExt;
-                                                       }
-                                                       namePatternPath = Path.fromOSString(namePattern);
-                                               }
-                                               else {
-                                                       if (outputPrefix.length() > 0) {
-                                                               namePattern = outputPrefix + namePattern;
-                                                       }
-                                                       namePatternPath = Path.fromOSString(namePattern);
-                                                       //  If only a file name is specified, add the relative path of this output directory
-                                                       if (namePatternPath.segmentCount() == 1) {
-                                                               namePatternPath = Path.fromOSString(relativePath + namePatternPath.toString());
-                                                       }
-                                               }
-
-                                               if (primaryOutput) {
-                                                       ruleOutputs.add(0, namePatternPath);
-                                                       enumeratedPrimaryOutputs.add(0, resolvePercent(namePatternPath, sourceLocation));
-                                               } else {
-                                                       ruleOutputs.add(namePatternPath);
-                                                       enumeratedSecondaryOutputs.add(resolvePercent(namePatternPath, sourceLocation));
-                                               }
-                                       }
-                               }
-                       }
-               } else {
-                       // For support of pre-CDT 3.0 integrations.
-                       // NOTE WELL:  This only supports the case of a single "target tool"
-                       //     that consumes exactly all of the object files, $OBJS, produced
-                       //     by other tools in the build and produces a single output.
-                       //     In this case, the output file name is the input file name with
-                       //     the output extension.
-
-                       //if (!ignorePrimary) {
-                               String outPrefix = tool.getOutputPrefix();
-                               IPath outPath = Path.fromOSString(relativePath + outPrefix + WILDCARD);
-                               outPath = outPath.addFileExtension(outExt);
-                               ruleOutputs.add(0, outPath);
-                               enumeratedPrimaryOutputs.add(0, resolvePercent(outPath, sourceLocation));
-                       //}
-               }
-       }
-       
-       public static String ensureUnquoted(String path) {
-               boolean doubleQuoted = path.startsWith("\"") && path.endsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
-               boolean singleQuoted = path.startsWith("'") && path.endsWith("'"); //$NON-NLS-1$ //$NON-NLS-2$
-               return doubleQuoted || singleQuoted ? path.substring(1,path.length()-1) : path;
-       }
-       
-       static public boolean containsSpecialCharacters(String path)
-       {
-               return path.matches(".*(\\s|[\\{\\}\\(\\)\\$\\@%=;]).*"); //$NON-NLS-1$
-       }
-       
-       public IPath getTopBuildDir() {
-               return getPathForResource(project).append(getBuildWorkingDir());
-       }
-       
-       public String ensurePathIsGNUMakeTargetRuleCompatibleSyntax(String path) {
-               return escapeWhitespaces(ensureUnquoted(path));
-       }
-       
-       protected Vector<String> getRuleList() {
-               if (ruleList == null) {
-                       ruleList = new Vector<String>();
-               }
-               return ruleList;
-       }
-       
-       public String escapedEcho(String string) {
-               String escapedString = string.replaceAll("'", "'\"'\"'");  //$NON-NLS-1$ //$NON-NLS-2$
-               return ECHO + WHITESPACE + SINGLE_QUOTE + escapedString + SINGLE_QUOTE + NEWLINE;
-       }
-       
-       private String[] addDependencyOptions(IManagedDependencyCommands depCommands, String[] flags) {
-               String[] depOptions = depCommands.getDependencyCommandOptions();
-               if (depOptions != null && depOptions.length > 0) {
-                       int flagsLen = flags.length;
-                       String[] flagsCopy = new String[flags.length + depOptions.length];
-                       for (int i=0; i<flags.length; i++) {
-                               flagsCopy[i] = flags[i];
-                       }
-                       for (int i=0; i<depOptions.length; i++) {
-                               flagsCopy[i + flagsLen] = depOptions[i];
-                       }
-                       flags = flagsCopy;
-               }
-               return flags;
-       }
-       
-       protected IPath[] getAdditionalResourcesForSource(ITool tool) {
-               List<IPath> allRes = new ArrayList<IPath>();
-               IInputType[] types = tool.getInputTypes();
-               for (IInputType type : types) {
-                       //  Additional resources come from 2 places.
-                       //  1.  From AdditionalInput childen
-                       IPath[] res = type.getAdditionalResources();
-                       for (IPath re : res) {
-                               allRes.add(re);
-                       }
-                       //  2.  From InputTypes that other than the primary input type
-                       if (!type.getPrimaryInput() && type != tool.getPrimaryInputType()) {
-                               String var = type.getBuildVariable();
-                               if (var != null && var.length() > 0) {
-                                       allRes.add(Path.fromOSString("$(" + type.getBuildVariable() + ")"));   //$NON-NLS-1$ //$NON-NLS-2$
-                               } else {
-                                       //  Use file extensions
-                                       String[] typeExts = type.getSourceExtensions(tool);
-                                       for (IResource projectResource : projectResources) {
-                                               if (projectResource.getType() == IResource.FILE) {
-                                                       String fileExt = projectResource.getFileExtension();
-                                                       if(fileExt == null) {
-                                                               fileExt = "";  //$NON-NLS-1$
-                                                       }
-                                                       for (String typeExt : typeExts) {
-                                                               if (fileExt.equals(typeExt)) {
-                                                                       allRes.add(projectResource.getProjectRelativePath());
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               //  If an assignToOption has been specified, set the value of the option to the inputs
-                               IOption assignToOption = tool.getOptionBySuperClassId(type.getAssignToOptionId());
-                               IOption option = tool.getOptionBySuperClassId(type.getOptionId());
-                               if (assignToOption != null && option == null) {
-                                       try {
-                                               int optType = assignToOption.getValueType();
-                                               IResourceInfo rcInfo = tool.getParentResourceInfo();
-                                               if (rcInfo != null) {
-                                                       if (optType == IOption.STRING) {
-                                                               String optVal = "";        //$NON-NLS-1$
-                                                               for (int j=0; j<allRes.size(); j++) {
-                                                                       if (j != 0) {
-                                                                               optVal += " ";     //$NON-NLS-1$
-                                                                       }
-                                                                       String resPath = allRes.get(j).toString();
-                                                                       if (!resPath.startsWith("$(")) {   //$NON-NLS-1$
-                                                                               IResource addlResource = project.getFile(resPath);
-                                                                               if (addlResource != null) {
-                                                                                       IPath addlPath = addlResource.getLocation();
-                                                                                       if (addlPath != null) {
-                                                                                               resPath = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), addlPath).toString();
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                                       optVal += ManagedBuildManager.calculateRelativePath(getTopBuildDir(), Path.fromOSString(resPath)).toString();
-                                                               }
-                                                               ManagedBuildManager.setOption(rcInfo, tool, assignToOption, optVal);
-                                                       } else if (
-                                                                       optType == IOption.STRING_LIST ||
-                                                                       optType == IOption.LIBRARIES ||
-                                                                       optType == IOption.OBJECTS ||
-                                                                       optType == IOption.INCLUDE_FILES ||
-                                                                       optType == IOption.LIBRARY_PATHS ||
-                                                                       optType == IOption.LIBRARY_FILES ||
-                                                                       optType == IOption.MACRO_FILES) {
-                                                               //TODO: do we need to do anything with undefs here?
-                                                               //  Note that the path(s) must be translated from project relative
-                                                               //  to top build directory relative
-                                                               String[] paths = new String[allRes.size()];
-                                                               for (int j=0; j<allRes.size(); j++) {
-                                                                       paths[j] = allRes.get(j).toString();
-                                                                       if (!paths[j].startsWith("$(")) {   //$NON-NLS-1$
-                                                                               IResource addlResource = project.getFile(paths[j]);
-                                                                               if (addlResource != null) {
-                                                                                       IPath addlPath = addlResource.getLocation();
-                                                                                       if (addlPath != null) {
-                                                                                               paths[j] = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), addlPath).toString();
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                               }
-                                                               ManagedBuildManager.setOption(rcInfo, tool, assignToOption, paths);
-                                                       } else if (optType == IOption.BOOLEAN) {
-                                                               boolean b = false;
-                                                               if (allRes.size() > 0) b = true;
-                                                               ManagedBuildManager.setOption(rcInfo, tool, assignToOption, b);
-                                                       } else if (optType == IOption.ENUMERATED) {
-                                                               if (allRes.size() > 0) {
-                                                                       String s = allRes.get(0).toString();
-                                                                       ManagedBuildManager.setOption(rcInfo, tool, assignToOption, s);
-                                                               }
-                                                       }
-                                                       allRes.clear();
-                                               }
-                                       } catch( BuildException ex ) {
-                                       }
-                               }
-                       }
-               }
-               return allRes.toArray(new IPath[allRes.size()]);
-       }
-       
-       private IManagedCommandLineInfo generateToolCommandLineInfo(ITool tool, String sourceExtension, String[] flags,
-                       String outputFlag, String outputPrefix, String outputName, String[] inputResources, IPath inputLocation, IPath outputLocation ){
-
-               String cmd = tool.getToolCommand();
-               //try to resolve the build macros in the tool command
-               try{
-                       String resolvedCommand = null;
-
-                       if ((inputLocation != null && inputLocation.toString().indexOf(" ") != -1) || //$NON-NLS-1$
-                                       (outputLocation != null && outputLocation.toString().indexOf(" ") != -1) ) //$NON-NLS-1$
-                       {
-                               resolvedCommand = ManagedBuildManager
-                                               .getBuildMacroProvider().resolveValue(
-                                                               cmd,
-                                                               "", //$NON-NLS-1$
-                                                               " ", //$NON-NLS-1$
-                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                               new FileContextData(inputLocation,
-                                                                               outputLocation, null,
-                                                                               tool));
-                       }
-
-                       else {
-                               resolvedCommand = ManagedBuildManager
-                                               .getBuildMacroProvider()
-                                               .resolveValueToMakefileFormat(
-                                                               cmd,
-                                                               "", //$NON-NLS-1$
-                                                               " ", //$NON-NLS-1$
-                                                               IBuildMacroProvider.CONTEXT_FILE,
-                                                               new FileContextData(inputLocation,
-                                                                               outputLocation, null,
-                                                                               tool));
-                       }
-                       if((resolvedCommand = resolvedCommand.trim()).length() > 0)
-                               cmd = resolvedCommand;
-
-               } catch (BuildMacroException e){
-               }
-
-               IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
-               return gen.generateCommandLineInfo( tool, cmd,
-                               flags, outputFlag, outputPrefix, outputName, inputResources,
-                               tool.getCommandLinePattern() );
-
-       }
-       
-       protected IPath[] oldCalculateDependenciesForSource(IManagedDependencyGenerator depGen, ITool tool, String relativePath, IResource resource) {
-               Vector<IPath> deps = new Vector<IPath>();
-               int type = depGen.getCalculatorType();
-
-               switch (type) {
-
-               case IManagedDependencyGeneratorType.TYPE_INDEXER:
-               case IManagedDependencyGeneratorType.TYPE_EXTERNAL:
-                       IResource[] res = depGen.findDependencies(resource, project);
-                       if (res != null) {
-                               for (IResource re : res) {
-                                       IPath dep = null;
-                                       if (re != null) {
-                                               IPath addlPath = re.getLocation();
-                                               if (addlPath != null) {
-                                                       dep = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), addlPath);
-                                               }
-                                       }
-                                       if (dep != null) {
-                                               deps.add(dep);
-                                       }
-                               }
-                       }
-                       break;
-
-               case IManagedDependencyGeneratorType.TYPE_NODEPS:
-               default:
-                       break;
-               }
-               return deps.toArray(new IPath[deps.size()]);
-       }
-       
-       protected Vector<String> getDepLineList() {
-               if (depLineList == null) {
-                       depLineList = new Vector<String>();
-               }
-               return depLineList;
-       }
-       
-       protected IPath[] calculateDependenciesForSource(IManagedDependencyCalculator depCalculator) {
-               IPath[] addlDeps = depCalculator.getDependencies();
-               if (addlDeps != null) {
-                       for (int i=0; i<addlDeps.length; i++) {
-                               if (!addlDeps[i].isAbsolute()) {
-                                       // Convert from project relative to build directory relative
-                                       IPath absolutePath = project.getLocation().append(addlDeps[i]);
-                                       addlDeps[i] = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), absolutePath);
-                               }
-                       }
-               }
-               return addlDeps;
-       }
-       
-       protected Vector<String> getDepRuleList() {
-               if (depRuleList == null) {
-                       depRuleList = new Vector<String>();
-               }
-               return depRuleList;
-       }
-       
-       protected IPath resolvePercent(IPath outPath, IPath sourceLocation) {
-               //  Get the input file name
-               String fileName = sourceLocation.removeFileExtension().lastSegment();
-               //  Replace the % with the file name
-               String outName = outPath.toOSString().replaceAll("%", fileName); //$NON-NLS-1$
-               IPath result = Path.fromOSString(outName);
-               return DOT_SLASH_PATH.isPrefixOf(outPath) ? DOT_SLASH_PATH.append(result) : result;
-       }
-       
-       public HashMap<String, List<IPath>> getBuildOutputVars() {
-               return buildOutVars;
-       }
-       
-       public Set<String> getOutputExtensions(ToolInfoHolder h) {
-               if (h.outputExtensionsSet == null) {
-                       // The set of output extensions which will be produced by this tool.
-                       // It is presumed that this set is not very large (likely < 10) so
-                       // a HashSet should provide good performance.
-                       h.outputExtensionsSet = new HashSet<String>();
-
-                       // For each tool for the target, lookup the kinds of sources it outputs
-                       // and add that to our list of output extensions.
-                       for (ITool tool : h.buildTools) {
-                               String[] outputs = tool.getAllOutputExtensions();
-                               if (outputs != null) {
-                                       h.outputExtensionsSet.addAll(Arrays.asList(outputs));
-                               }
-                       }
-               }
-               return h.outputExtensionsSet;
-       }
-       
-       public List<String> getBuildVariableList(ToolInfoHolder h, String variable, int locationType, IPath directory, boolean getAll) {
-               BuildDataFileManagedBuildToolInfo[] gnuToolInfos = h.gnuToolInfos;
-               boolean done = true;
-               for (int i=0; i<gnuToolInfos.length; i++) {
-                       if (!gnuToolInfos[i].areOutputVariablesCalculated()) {
-                               done = false;
-                       }
-               }
-               if (!done && getAll) return null;
-               List<IPath> list = buildSrcVars.get(variable);
-               if (list == null) {
-                       list = buildOutVars.get(variable);
-               }
-
-               List<String> fileList = null;
-               if (list != null) {
-                       //  Convert the items in the list to the location-type wanted by the caller,
-                       //  and to a string list
-                       IPath dirLocation = null;
-                       if (locationType != ABSOLUTE) {
-                               dirLocation = project.getLocation();
-                               if (locationType == PROJECT_SUBDIR_RELATIVE) {
-                                       dirLocation = dirLocation.append(directory);
-                               }
-                       }
-                       for (int i=0; i<list.size(); i++) {
-                               IPath path = list.get(i);
-                               if (locationType != ABSOLUTE) {
-                                       if (dirLocation!=null && dirLocation.isPrefixOf(path)) {
-                                               path = path.removeFirstSegments(dirLocation.segmentCount()).setDevice(null);
-                                       }
-                               }
-                               if ( fileList == null ) {
-                                       fileList = new Vector<String>();
-                               }
-                               fileList.add(path.toString());
-                       }
-               }
-
-               return fileList;
-       }
-}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileManagedBuildToolInfo.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileManagedBuildToolInfo.java
deleted file mode 100644 (file)
index edd5079..0000000
+++ /dev/null
@@ -1,1032 +0,0 @@
-/*
-*  NativeApp
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@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.nativecommon.build;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IInputType;
-import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IOutputType;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
-import org.eclipse.cdt.managedbuilder.internal.core.Tool;
-import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
-import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
-import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCalculator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
-import org.eclipse.cdt.managedbuilder.makegen.gnu.IManagedBuildGnuToolInfo;
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.tizen.nativecommon.build.BuildDataFileGenerator.ToolInfoHolder;
-
-
-public class BuildDataFileManagedBuildToolInfo implements IManagedBuildGnuToolInfo {
-       
-       /*
-        * Members
-        */
-       private IProject project;
-       private Tool tool;
-       private boolean bIsTargetTool;
-       private String targetName;
-       private String targetExt;
-       private boolean inputsCalculated = false;
-       private boolean outputsCalculated = false;
-       private boolean outputVariablesCalculated = false;
-       private boolean dependenciesCalculated = false;
-       private Vector<String> commandInputs = new Vector<String>();
-       private Vector<String> enumeratedInputs = new Vector<String>();
-       private Vector<String> commandOutputs = new Vector<String>();
-       private Vector<String> enumeratedPrimaryOutputs = new Vector<String>();
-       private Vector<String> enumeratedSecondaryOutputs = new Vector<String>();
-       private Vector<String> outputVariables = new Vector<String>();
-       private Vector<String> commandDependencies = new Vector<String>();
-       private Vector<String> additionalTargets = new Vector<String>();
-       //private Vector enumeratedDependencies = new Vector();
-       // Map of macro names (String) to values (List)
-       
-       /*
-        * Constructor
-        */
-       public BuildDataFileManagedBuildToolInfo(IProject project, ITool tool, boolean targetTool, String name, String ext) {
-               this.project = project;
-               this.tool = (Tool)tool;
-               bIsTargetTool = targetTool;
-               if (bIsTargetTool) {
-                       targetName = name;
-                       targetExt = ext;
-               }
-       }
-       
-       /*
-        * IManagedBuildGnuToolInfo Methods
-        */
-       public boolean areInputsCalculated() {
-               return inputsCalculated;
-       }
-
-       //  Command inputs are top build directory relative
-       public Vector<String> getCommandInputs() {
-               return commandInputs;
-       }
-
-       //  Enumerated inputs are project relative
-       public Vector<String> getEnumeratedInputs() {
-               return enumeratedInputs;
-       }
-
-       public boolean areOutputsCalculated() {
-               return outputsCalculated;
-       }
-
-       //  Command outputs are top build directory relative
-       public Vector<String> getCommandOutputs() {
-               return commandOutputs;
-       }
-
-       public Vector<String> getEnumeratedPrimaryOutputs() {
-               return enumeratedPrimaryOutputs;
-       }
-
-       public Vector<String> getEnumeratedSecondaryOutputs() {
-               return enumeratedSecondaryOutputs;
-       }
-
-       public Vector<String> getOutputVariables() {
-               return outputVariables;
-       }
-
-       public boolean areOutputVariablesCalculated() {
-               return outputVariablesCalculated;
-       }
-
-       public boolean areDependenciesCalculated() {
-               return dependenciesCalculated;
-       }
-
-       //  Command dependencies are top build directory relative
-       public Vector<String> getCommandDependencies() {
-               return commandDependencies;
-       }
-
-       //  Additional targets are top build directory relative
-       public Vector<String> getAdditionalTargets() {
-               return additionalTargets;
-       }
-
-       //public Vector getEnumeratedDependencies() {
-       //      return enumeratedDependencies;
-       //}
-
-       public boolean isTargetTool() {
-               return bIsTargetTool;
-       }
-       
-       /*
-        * Other Methods
-        */
-       
-       public boolean calculateInputs(BuildDataFileGenerator makeGen, IConfiguration config, IResource[] projResources, ToolInfoHolder h, boolean lastChance) {
-               // Get the inputs for this tool invocation
-               // Note that command inputs that are also dependencies are also added to the command dependencies list
-               
-               /* The priorities for determining the names of the inputs of a tool are:
-                *  1.  If an option is specified, use the value of the option.
-                *  2.  If a build variable is specified, use the files that have been added to the build variable as
-                *      the output(s) of other build steps.
-                *  3.  Use the file extensions and the resources in the project 
-                */
-               boolean done = true;
-               Vector<String> myCommandInputs = new Vector<String>();                  // Inputs for the tool command line
-               Vector<String> myCommandDependencies = new Vector<String>();    // Dependencies for the make rule
-               Vector<String> myEnumeratedInputs = new Vector<String>();               // Complete list of individual inputs
-
-               IInputType[] inTypes = tool.getInputTypes();
-               if (inTypes != null && inTypes.length > 0) {
-                       for (IInputType type : inTypes) {
-                               Vector<String> itCommandInputs = new Vector<String>();                  // Inputs for the tool command line for this input-type
-                               Vector<String> itCommandDependencies = new Vector<String>();    // Dependencies for the make rule for this input-type
-                               Vector<String> itEnumeratedInputs = new Vector<String>();               // Complete list of individual inputs for this input-type                               
-                               String variable = type.getBuildVariable();
-                               boolean primaryInput = type.getPrimaryInput();
-                               boolean useFileExts = false;
-                               IOption option = tool.getOptionBySuperClassId(type.getOptionId());
-                               IOption assignToOption = tool.getOptionBySuperClassId(type.getAssignToOptionId());
-                               
-                               //  Option?
-                               if (option != null) {
-                                       try {
-                                               List<String> inputs = new ArrayList<String>();
-                                               int optType = option.getValueType();
-                                               if (optType == IOption.STRING) {
-                                                       inputs.add(option.getStringValue());
-                                               } else if (
-                                                               optType == IOption.STRING_LIST ||
-                                                               optType == IOption.LIBRARIES ||
-                                                               optType == IOption.OBJECTS ||
-                                                               optType == IOption.INCLUDE_FILES ||
-                                                               optType == IOption.LIBRARY_PATHS ||
-                                                               optType == IOption.LIBRARY_FILES ||
-                                                               optType == IOption.MACRO_FILES) {
-                                                       @SuppressWarnings("unchecked")
-                                                       List<String> valueList = (List<String>)option.getValue();
-                                                       inputs = valueList;
-                                                       tool.filterValues(optType, inputs);
-                                                       tool.filterValues(optType, inputs);
-                                               }
-                                               for (int j=0; j<inputs.size(); j++) {
-                                                       String inputName = inputs.get(j);
-                                                       
-                               
-                                                       try {
-                                                               // try to resolve the build macros in the output
-                                                               // names
-
-                                                               String resolved = null;
-
-                                                               // does the input name contain spaces?
-                                                               // TODO: support other special characters
-                                                               if (inputName.indexOf(" ") != -1) //$NON-NLS-1$
-                                                               {
-                                                                       // resolve to string
-                                                                       resolved = ManagedBuildManager
-                                                                                       .getBuildMacroProvider()
-                                                                                       .resolveValue(
-                                                                                                       inputName,
-                                                                                                       "", //$NON-NLS-1$
-                                                                                                       " ", //$NON-NLS-1$
-                                                                                                       IBuildMacroProvider.CONTEXT_OPTION,
-                                                                                                       new OptionContextData(
-                                                                                                                       option,
-                                                                                                                       tool));
-                                                               } else {
-
-                                                                       // resolve to makefile variable format
-                                                                       resolved = ManagedBuildManager
-                                                                                       .getBuildMacroProvider()
-                                                                                       .resolveValueToMakefileFormat(
-                                                                                                       inputName,
-                                                                                                       "", //$NON-NLS-1$
-                                                                                                       " ", //$NON-NLS-1$
-                                                                                                       IBuildMacroProvider.CONTEXT_OPTION,
-                                                                                                       new OptionContextData(
-                                                                                                                       option,
-                                                                                                                       tool));
-                                                               }
-
-                                                               if ((resolved = resolved.trim()).length() > 0)
-                                                                       inputName = resolved;
-                                                       } catch (BuildMacroException e) {
-                                                       }
-       
-                                                       if (primaryInput) {
-                                                               itCommandDependencies.add(j, inputName);
-                                                       } else {
-                                                               itCommandDependencies.add(inputName);
-                                                       }
-                                                       // NO - itCommandInputs.add(inputName);
-                                                       // NO - itEnumeratedInputs.add(inputName);
-                                               }
-                                       } catch( BuildException ex ) {
-                                       }
-                                       
-                               } else {
-
-                                       //  Build Variable?
-                                       if (variable.length() > 0) {
-                                               String cmdVariable = variable = "$(" + variable + ")";                  //$NON-NLS-1$   //$NON-NLS-2$
-                                               itCommandInputs.add(cmdVariable);
-                                               if (primaryInput) {
-                                                       itCommandDependencies.add(0, cmdVariable);
-                                               } else {
-                                                       itCommandDependencies.add(cmdVariable);
-                                               }
-                                               // If there is an output variable with the same name, get
-                                               // the files associated with it.
-                                               List<String> outMacroList = makeGen.getBuildVariableList(h, variable, BuildDataFileGenerator.PROJECT_RELATIVE,
-                                                               null, true);
-                                               if (outMacroList != null) {
-                                                       itEnumeratedInputs.addAll(outMacroList);
-                                               } else {
-                                                       // If "last chance", then calculate using file extensions below
-                                                       if (lastChance) {
-                                                               useFileExts = true;
-                                                       } else {
-                                                               done = false;
-                                                               break;
-                                                       }
-                                               }
-                                       }
-                                       
-                                       //  Use file extensions
-                                       if (variable.length() == 0 || useFileExts) {
-                                               //if (type.getMultipleOfType()) {
-                                                       // Calculate EnumeratedInputs using the file extensions and the resources in the project
-                                                       // Note:  This is only correct for tools with multipleOfType == true, but for other tools
-                                                       //        it gives us an input resource for generating default names
-                                                       // Determine the set of source input macros to use
-                                                       HashSet<String> handledInputExtensions = new HashSet<String>();
-                                                       String[] exts = type.getSourceExtensions(tool);
-                                                       if (projResources != null) {
-                                                               for (IResource rc : projResources) {
-                                                                       if (rc.getType() == IResource.FILE) {
-                                                                               String fileExt = rc.getFileExtension();
-                                                                               
-                                                                               // fix for NPE, bugzilla 99483
-                                                                               if(fileExt == null)
-                                                                               {
-                                                                                       fileExt = "";  //$NON-NLS-1$
-                                                                               }
-                                                                               
-                                                                               for (int k=0; k<exts.length; k++) {
-                                                                                       if (fileExt.equals(exts[k])) {
-                                                                                               if (!useFileExts) {
-                                                                                                       if(!handledInputExtensions.contains(fileExt)) {
-                                                                                                               handledInputExtensions.add(fileExt);
-                                                                                                               String buildMacro = "$(" + makeGen.getSourceMacroName(fileExt).toString() + ")";        //$NON-NLS-1$ //$NON-NLS-2$
-                                                                                                               itCommandInputs.add(buildMacro);
-                                                                                                               if (primaryInput) {
-                                                                                                                       itCommandDependencies.add(0, buildMacro);
-                                                                                                               } else {
-                                                                                                                       itCommandDependencies.add(buildMacro);
-                                                                                                               }
-                                                                                                       }
-                                                                                               }
-                                                                                               if (type.getMultipleOfType() || itEnumeratedInputs.size() == 0) {
-                                                                                                       //  Add a path that is relative to the project directory
-                                                                                                       itEnumeratedInputs.add(rc.getProjectRelativePath().toString());
-                                                                                               }
-                                                                                               break;
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                               }
-                                                       }
-                                               //}
-                                       }
-                               }
-                               
-                               // Get any additional inputs specified in the manifest file or the project file
-                               IAdditionalInput[] addlInputs = type.getAdditionalInputs();
-                               if (addlInputs != null) {
-                                       for (int j=0; j<addlInputs.length; j++) {
-                                               IAdditionalInput addlInput = addlInputs[j];
-                                               int kind = addlInput.getKind();
-                                               if (kind == IAdditionalInput.KIND_ADDITIONAL_INPUT ||
-                                                       kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
-                                                       String[] paths = addlInput.getPaths();
-                                                       if (paths != null) {
-                                                               for (int k = 0; k < paths.length; k++) {
-                                                                       String path = paths[k];
-                                                                       itEnumeratedInputs.add(path);
-                                                                       // Translate the path from project relative to build directory relative
-                                                                       if (!(path.startsWith("$("))) {         //$NON-NLS-1$
-                                                                               IResource addlResource = project.getFile(path);
-                                                                               if (addlResource != null) {
-                                                                                       IPath addlPath = addlResource.getLocation();
-                                                                                       if (addlPath != null) {
-                                                                                               path = ManagedBuildManager.calculateRelativePath(makeGen.getTopBuildDir(), addlPath).toString();
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                                       itCommandInputs.add(path);
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                               
-                               //  If the assignToOption attribute is specified, set the input(s) as the value of that option
-                               if (assignToOption != null && option == null) {
-                                       try {
-                                               int optType = assignToOption.getValueType();
-                                               if (optType == IOption.STRING) {
-                                                       String optVal = "";        //$NON-NLS-1$
-                                                       for (int j=0; j<itCommandInputs.size(); j++) {
-                                                               if (j != 0) {
-                                                                       optVal += " ";     //$NON-NLS-1$
-                                                               }
-                                                               optVal += itCommandInputs.get(j);
-                                                       }
-                                                       ManagedBuildManager.setOption(config, tool, assignToOption, optVal);                                                    
-                                               } else if (
-                                                               optType == IOption.STRING_LIST ||
-                                                               optType == IOption.LIBRARIES ||
-                                                               optType == IOption.OBJECTS ||
-                                                               optType == IOption.INCLUDE_FILES ||
-                                                               optType == IOption.LIBRARY_PATHS ||
-                                                               optType == IOption.LIBRARY_FILES ||
-                                                               optType == IOption.MACRO_FILES) {
-                                                       //TODO: do we need to do anything with undefs here?
-                                                       //  Mote that when using the enumerated inputs, the path(s) must be translated from project relative 
-                                                       //  to top build directory relative
-                                                       String[] paths = new String[itEnumeratedInputs.size()];
-                                                       for (int j=0; j<itEnumeratedInputs.size(); j++) {
-                                                               paths[j] = itEnumeratedInputs.get(j);
-                                                               IResource enumResource = project.getFile(paths[j]);
-                                                               if (enumResource != null) {
-                                                                       IPath enumPath = enumResource.getLocation();
-                                                                       if (enumPath != null) {
-                                                                               paths[j] = ManagedBuildManager.calculateRelativePath(makeGen.getTopBuildDir(), enumPath).toString();
-                                                                       }
-                                                               }                                                               
-                                                       }
-                                                       ManagedBuildManager.setOption(config, tool, assignToOption, paths);
-                                               } else if (optType == IOption.BOOLEAN) {
-                                                       if (itEnumeratedInputs.size() > 0) {
-                                                               ManagedBuildManager.setOption(config, tool, assignToOption, true);
-                                                       } else {
-                                                               ManagedBuildManager.setOption(config, tool, assignToOption, false);
-                                                       }
-                                               } else if (optType == IOption.ENUMERATED) {
-                                                       if (itCommandInputs.size() > 0) {
-                                                               ManagedBuildManager.setOption(config, tool, assignToOption, itCommandInputs.firstElement());
-                                                       }
-                                               }
-                                               itCommandInputs.removeAllElements();
-                                               //itEnumeratedInputs.removeAllElements();
-                                       } catch( BuildException ex ) {
-                                       }
-                               }
-                               
-                               myCommandInputs.addAll(itCommandInputs);
-                               myCommandDependencies.addAll(itCommandDependencies);
-                               myEnumeratedInputs.addAll(itEnumeratedInputs);
-                       }
-               } else {
-                       // For support of pre-CDT 3.0 integrations.
-                       if (bIsTargetTool) {
-                               // NOTE WELL:  This only supports the case of a single "target tool"
-                               //      with the following characteristics:
-                               // 1.  The tool consumes exactly all of the object files produced
-                               //     by other tools in the build and produces a single output
-                               // 2.  The target name comes from the configuration artifact name
-                               // The rule looks like:
-                               //    <targ_prefix><target>.<extension>: $(OBJS) <refd_project_1 ... refd_project_n>
-                               myCommandInputs.add("$(OBJS)");                  //$NON-NLS-1$          
-                               myCommandInputs.add("$(USER_OBJS)");     //$NON-NLS-1$          
-                               myCommandInputs.add("$(LIBS)");                  //$NON-NLS-1$
-                       } else {
-                               // Rule will be generated by addRuleForSource
-                       }
-               }               
-               
-               if (done) {
-                       commandInputs.addAll(myCommandInputs);
-                       commandDependencies.addAll(0, myCommandDependencies);
-                       enumeratedInputs.addAll(myEnumeratedInputs);
-                       inputsCalculated = true;
-                       return true;
-               }
-                               
-               return false;           
-       }
-       
-        /*
-        * The priorities for determining the names of the outputs of a tool are:
-        *  1.  If the tool is the build target and primary output, use artifact name & extension
-        *  2.  If an option is specified, use the value of the option
-        *  3.  If a nameProvider is specified, call it
-        *  4.  If outputNames is specified, use it
-        *  5.  Use the name pattern to generate a transformation macro 
-        *      so that the source names can be transformed into the target names 
-        *      using the built-in string substitution functions of <code>make</code>.
-        *      
-        * NOTE: If an option is not specified and this is not the primary output type, the outputs
-        *       from the type are not added to the command line     
-        */  
-       public boolean calculateOutputs(BuildDataFileGenerator makeGen, IConfiguration config, HashSet<String> handledInputExtensions, boolean lastChance) {
-
-               boolean done = true;
-               Vector<String> myCommandOutputs = new Vector<String>();
-               Vector<String> myEnumeratedPrimaryOutputs = new Vector<String>();
-               Vector<String> myEnumeratedSecondaryOutputs = new Vector<String>();
-           HashMap<String, List<IPath>> myOutputMacros = new HashMap<String, List<IPath>>();
-               //  The next two fields are used together
-               Vector<String> myBuildVars = new Vector<String>();
-               Vector<Vector<String>> myBuildVarsValues = new Vector<Vector<String>>();
-               
-               // Get the outputs for this tool invocation
-               IOutputType[] outTypes = tool.getOutputTypes();
-               if (outTypes != null && outTypes.length > 0) {
-                       for (int i=0; i<outTypes.length; i++) {
-                               Vector<String> typeEnumeratedOutputs = new Vector<String>();
-                               IOutputType type = outTypes[i];
-                               String outputPrefix = type.getOutputPrefix();
-                               
-                               // Resolve any macros in the outputPrefix
-                               // Note that we cannot use file macros because if we do a clean
-                // we need to know the actual name of the file to clean, and
-                // cannot use any builder variables such as $@. Hence we use the
-                // next best thing, i.e. configuration context.
-
-                               if (config != null) {
-
-                                       try {
-                                               outputPrefix = ManagedBuildManager
-                                                               .getBuildMacroProvider()
-                                                               .resolveValueToMakefileFormat(
-                                                                               outputPrefix,
-                                                                               "", //$NON-NLS-1$
-                                                                               " ", //$NON-NLS-1$
-                                                                               IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                                                               config);
-                                       }
-
-                                       catch (BuildMacroException e) {
-                                       }
-                               }
-                               
-                               
-                               String variable = type.getBuildVariable();
-                               boolean multOfType = type.getMultipleOfType();
-                               boolean primaryOutput = (type == tool.getPrimaryOutputType());
-                               IOption option = tool.getOptionBySuperClassId(type.getOptionId());
-                               IManagedOutputNameProvider nameProvider = type.getNameProvider();
-                               String[] outputNames = type.getOutputNames();
-                               
-                               //  1.  If the tool is the build target and this is the primary output, 
-                               //      use artifact name & extension
-                               if (bIsTargetTool && primaryOutput) {
-                                       String outputName = outputPrefix + targetName; 
-                                       if (targetExt.length() > 0) {
-                                               outputName += (DOT + targetExt);
-                                       }
-                                       myCommandOutputs.add(outputName);
-                                       typeEnumeratedOutputs.add(outputName);
-                                       //  But this doesn't use any output macro...
-                               } else 
-                               //  2.  If an option is specified, use the value of the option
-                               if (option != null) {
-                                       try {
-                                               List<String> outputs = new ArrayList<String>();
-                                               int optType = option.getValueType();
-                                               if (optType == IOption.STRING) {
-                                                       outputs.add(outputPrefix + option.getStringValue());
-                                               } else if (
-                                                               optType == IOption.STRING_LIST ||
-                                                               optType == IOption.LIBRARIES ||
-                                                               optType == IOption.OBJECTS ||
-                                                               optType == IOption.INCLUDE_FILES ||
-                                                               optType == IOption.LIBRARY_PATHS ||
-                                                               optType == IOption.LIBRARY_FILES ||
-                                                               optType == IOption.MACRO_FILES) {
-                                                       @SuppressWarnings("unchecked")
-                                                       List<String> value = (List<String>)option.getValue();
-                                                       outputs = value;
-                                                       tool.filterValues(optType, outputs);
-                                                       // Add outputPrefix to each if necessary
-                                                       if (outputPrefix.length() > 0) {
-                                                               for (int j=0; j<outputs.size(); j++) {
-                                                                       outputs.set(j, outputPrefix + outputs.get(j));
-                                                               }
-                                                       }
-                                               }
-                                               for (int j=0; j<outputs.size(); j++) {
-                                                       String outputName = outputs.get(j); 
-                                                       try{
-                                                               //try to resolve the build macros in the output names
-                                                               String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                               outputName,
-                                                                               "", //$NON-NLS-1$
-                                                                               " ", //$NON-NLS-1$
-                                                                               IBuildMacroProvider.CONTEXT_OPTION,
-                                                                               new OptionContextData(option, tool));
-                                                               if((resolved = resolved.trim()).length() > 0)
-                                                                       outputs.set(j, resolved);
-                                                       } catch (BuildMacroException e){
-                                                       }
-                                               }
-                                               
-                                               // NO - myCommandOutputs.addAll(outputs);
-                                               typeEnumeratedOutputs.addAll(outputs);
-                                               if (variable.length() > 0) {
-                                                       List<IPath> outputPaths = new ArrayList<IPath>();
-                                                       for (int j=0; j<outputs.size(); j++) {
-                                                               outputPaths.add(Path.fromOSString(outputs.get(j)));
-                                                       }
-                                                       if (myOutputMacros.containsKey(variable)) {
-                                                               List<IPath> currList = myOutputMacros.get(variable);
-                                                               currList.addAll(outputPaths);
-                                                               myOutputMacros.put(variable, currList);
-                                                       } else {
-                                                               myOutputMacros.put(variable, outputPaths);
-                                                       }
-                                               }
-                                       } catch( BuildException ex ) {
-                                       }
-                               } else 
-                               //  3.  If a nameProvider is specified, call it
-                               if (nameProvider != null) {
-                                       // The inputs must have been calculated before we can do this
-                                       IPath[] outNames = null;
-                                       if (!inputsCalculated) {
-                                               done = false;
-                                       } else {
-                                               Vector<String> inputs = getEnumeratedInputs();
-                                               IPath[] inputPaths = new IPath[inputs.size()];
-                                               for (int j=0; j<inputPaths.length; j++) {
-                                                       inputPaths[j] = Path.fromOSString(inputs.get(j));
-                                               }
-                                               outNames = nameProvider.getOutputNames(tool, inputPaths);
-                                               if (outNames != null) {
-                                                       for (int j=0; j<outNames.length; j++) {
-                                                               String outputName = outNames[j].toString(); 
-                                                               try{
-                                                                       //try to resolve the build macros in the output names
-                                                                       String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                                       outputName,
-                                                                                       "", //$NON-NLS-1$
-                                                                                       " ", //$NON-NLS-1$
-                                                                                       IBuildMacroProvider.CONTEXT_CONFIGURATION,
-                                                                                       config);
-                                                                       if((resolved = resolved.trim()).length() > 0) {
-                                                                               outputName = resolved;
-                                                                               outNames[j] = Path.fromOSString(resolved);
-                                                                       }
-                                                               } catch (BuildMacroException e){
-                                                               }
-
-                                                               if (primaryOutput) {
-                                                                       myCommandOutputs.add(outputName);
-                                                               }
-                                                               typeEnumeratedOutputs.add(outputName);
-                                                       }
-                                               }
-                                       }
-                                       if (variable.length() > 0 && outNames != null) {
-                                               if (myOutputMacros.containsKey(variable)) {
-                                                       List<IPath> currList = myOutputMacros.get(variable);
-                                                       currList.addAll(Arrays.asList(outNames));
-                                                       myOutputMacros.put(variable, currList);
-                                               } else {
-                                                       myOutputMacros.put(variable, new ArrayList<IPath>(Arrays.asList(outNames)));
-                                               }
-                                       }
-                               } else
-                               //  4.  If outputNames is specified, use it
-                               if (outputNames != null) {
-                                       if (outputNames.length > 0) {
-                                               for (int j=0; j<outputNames.length; j++) {
-                                                       String outputName = outputNames[j]; 
-                                                       try{
-                                                               //try to resolve the build macros in the output names
-                                                               String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
-                                                                               outputName,
-                                                                               "", //$NON-NLS-1$
-                                                                               " ", //$NON-NLS-1$
-                                                                               IBuildMacroProvider.CONTEXT_OPTION,
-                                                                               new OptionContextData(option, tool));
-                                                               if((resolved = resolved.trim()).length() > 0)
-                                                                       outputNames[j] = resolved;
-                                                       } catch (BuildMacroException e){
-                                                       }
-                                               }
-                                               List<String> namesList = Arrays.asList(outputNames);
-                                               if (primaryOutput) {
-                                                       myCommandOutputs.addAll(namesList);
-                                               }
-                                               typeEnumeratedOutputs.addAll(namesList);
-                                               if (variable.length() > 0) {
-                                                       List<IPath> outputPaths = new ArrayList<IPath>();
-                                                       for (int j=0; j<namesList.size(); j++) {
-                                                               outputPaths.add(Path.fromOSString(namesList.get(j)));
-                                                       }
-                                                       if (myOutputMacros.containsKey(variable)) {
-                                                               List<IPath> currList = myOutputMacros.get(variable);
-                                                               currList.addAll(outputPaths);
-                                                               myOutputMacros.put(variable, currList);
-                                                       } else {
-                                                               myOutputMacros.put(variable, outputPaths);
-                                                       }
-                                               }
-                                       }
-                               } else {
-                               //  5.  Use the name pattern to generate a transformation macro 
-                               //      so that the source names can be transformed into the target names 
-                               //      using the built-in string substitution functions of <code>make</code>.
-                                       if (multOfType) {
-                                               // This case is not handled - a nameProvider or outputNames must be specified
-                                               List<String> errList = new ArrayList<String>();
-                                               errList.add(ManagedMakeMessages.getResourceString("MakefileGenerator.error.no.nameprovider"));  //$NON-NLS-1$
-                                               myCommandOutputs.addAll(errList);
-                                       } else {
-                                               String namePattern = type.getNamePattern();
-                                               if (namePattern == null || namePattern.length() == 0) {
-                                                       namePattern = outputPrefix + IManagedBuilderMakefileGenerator.WILDCARD;
-                                                       String outExt = (type.getOutputExtensions(tool))[0];
-                                                       if (outExt != null && outExt.length() > 0) {
-                                                               namePattern += DOT + outExt;
-                                                       }
-                                               }
-                                               else if (outputPrefix.length() > 0) {
-                                                       namePattern = outputPrefix + namePattern;
-                                               }
-                                               
-                                               // Calculate the output name
-                                               // The inputs must have been calculated before we can do this
-                                               if (!inputsCalculated) {
-                                                       done = false;
-                                               } else {
-                                                       Vector<String> inputs = getEnumeratedInputs();
-                                                       String fileName;
-                                                       if (inputs.size() > 0) {
-                                                               //  Get the input file name
-                                                               fileName = (Path.fromOSString(inputs.get(0))).removeFileExtension().lastSegment();
-                                                               //  Check if this is a build macro.  If so, use the raw macro name.
-                                                               if (fileName.startsWith("$(") && fileName.endsWith(")")) {      //$NON-NLS-1$ //$NON-NLS-2$
-                                                                       fileName = fileName.substring(2,fileName.length()-1);
-                                                               }
-                                                       } else {
-                                                               fileName = "default"; //$NON-NLS-1$
-                                                       }
-                                                       //  Replace the % with the file name
-                                                       if (primaryOutput) {
-                                                               myCommandOutputs.add(namePattern.replaceAll("%", fileName)); //$NON-NLS-1$
-                                                       }
-                                                       typeEnumeratedOutputs.add(namePattern.replaceAll("%", fileName)); //$NON-NLS-1$
-                                                       if (variable.length() > 0) {
-                                                               List<IPath> outputs = new ArrayList<IPath>();
-                                                               outputs.add(Path.fromOSString(fileName));
-                                                               if (myOutputMacros.containsKey(variable)) {
-                                                                       List<IPath> currList = myOutputMacros.get(variable);
-                                                                       currList.addAll(outputs);
-                                                                       myOutputMacros.put(variable, currList);
-                                                               } else {
-                                                                       myOutputMacros.put(variable, outputs);
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }                                       
-                               if (variable.length() > 0) {
-                                       myBuildVars.add(variable);
-                                       myBuildVarsValues.add(typeEnumeratedOutputs);
-                               }
-                               if (primaryOutput) {
-                                       myEnumeratedPrimaryOutputs.addAll(typeEnumeratedOutputs);
-                               } else {
-                                       myEnumeratedSecondaryOutputs.addAll(typeEnumeratedOutputs);
-                               }
-                       }
-               } else {
-                       if (bIsTargetTool) {
-                               String outputPrefix = tool.getOutputPrefix();
-                               String outputName = outputPrefix + targetName; 
-                               if (targetExt.length() > 0) {
-                                       outputName += (DOT + targetExt);
-                               }
-                               myCommandOutputs.add(outputName);
-                               myEnumeratedPrimaryOutputs.add(outputName);
-                       } else {
-                               // For support of pre-CDT 3.0 integrations.
-                               // NOTE WELL:  This only supports the case of a single "target tool"
-                               //     that consumes exactly all of the object files, $OBJS, produced
-                               //     by other tools in the build and produces a single output
-                       }
-               }
-               
-               //  Add the output macros of this tool to the buildOutVars map 
-               Set<Entry<String, List<IPath>>> entrySet = myOutputMacros.entrySet();
-               for (Entry<String, List<IPath>> entry : entrySet) {
-                       String macroName = entry.getKey();
-                       List<IPath> newMacroValue = entry.getValue();
-                       HashMap<String, List<IPath>> map = makeGen.getBuildOutputVars(); 
-                       if (map.containsKey(macroName)) {
-                               List<IPath> macroValue = map.get(macroName);
-                               macroValue.addAll(newMacroValue);
-                               map.put(macroName, macroValue);
-                       } else {
-                               map.put(macroName, newMacroValue);
-                       }
-               }
-               outputVariablesCalculated = true;
-
-               if (done) {
-                       commandOutputs.addAll(myCommandOutputs);
-                       enumeratedPrimaryOutputs.addAll(myEnumeratedPrimaryOutputs);
-                       enumeratedSecondaryOutputs.addAll(myEnumeratedSecondaryOutputs);
-                       outputVariables.addAll(myOutputMacros.keySet());
-                       outputsCalculated = true;
-                       for (int i=0; i<myBuildVars.size(); i++) {
-                               makeGen.addMacroAdditionFiles(makeGen.getTopBuildOutputVars(), myBuildVars.get(i), myBuildVarsValues.get(i)); 
-                       }                       
-                       return true;
-               }
-                               
-               return false;           
-       }
-
-       private boolean callDependencyCalculator (BuildDataFileGenerator makeGen, IConfiguration config, HashSet<String> handledInputExtensions, 
-                       IManagedDependencyGeneratorType depGen, String[] extensionsList, Vector<String> myCommandDependencies, HashMap<String, List<IPath>> myOutputMacros,
-                       Vector<String> myAdditionalTargets, ToolInfoHolder h, boolean done) {
-               
-               int calcType = depGen.getCalculatorType();
-               switch (calcType) {
-               case IManagedDependencyGeneratorType.TYPE_COMMAND:
-               case IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS:
-                       // iterate over all extensions that the tool knows how to handle
-                       for (int i=0; i<extensionsList.length; i++) {
-                               String extensionName = extensionsList[i];
-                               
-                               // Generated files should not appear in the list.
-                               if(!makeGen.getOutputExtensions(h).contains(extensionName) && !handledInputExtensions.contains(extensionName)) {
-                                       handledInputExtensions.add(extensionName);
-                                       String depExt = IManagedBuilderMakefileGenerator.DEP_EXT;
-                                       if (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS) {
-                                               IManagedDependencyGenerator2 depGen2 = (IManagedDependencyGenerator2)depGen;
-                                               String xt = depGen2.getDependencyFileExtension(config, tool);
-                                               if (xt != null && xt.length() > 0) depExt = xt;
-                                       }
-                                       String depsMacroEntry = calculateSourceMacro(makeGen, extensionName, depExt,
-                                                       IManagedBuilderMakefileGenerator.WILDCARD);
-
-                                       List<IPath> depsList = new ArrayList<IPath>();
-                                       depsList.add(Path.fromOSString(depsMacroEntry));
-                                       String depsMacro = makeGen.getDepMacroName(extensionName).toString();
-                                       if (myOutputMacros.containsKey(depsMacro)) {
-                                               List<IPath> currList = myOutputMacros.get(depsMacro);
-                                               currList.addAll(depsList);
-                                               myOutputMacros.put(depsMacro, currList);
-                                       } else {
-                                               myOutputMacros.put(depsMacro, depsList);
-                                       }
-                               }
-                       }                                                                                       
-                       break;
-
-               case IManagedDependencyGeneratorType.TYPE_INDEXER:
-               case IManagedDependencyGeneratorType.TYPE_EXTERNAL:
-               case IManagedDependencyGeneratorType.TYPE_CUSTOM:
-                       // The inputs must have been calculated before we can do this
-                       if (!inputsCalculated) {
-                               done = false;
-                       } else {
-                               Vector<String> inputs = getEnumeratedInputs();
-
-                               if (calcType == IManagedDependencyGeneratorType.TYPE_CUSTOM) {
-                                       IManagedDependencyGenerator2 depGen2 = (IManagedDependencyGenerator2)depGen;
-                                       IManagedDependencyInfo depInfo = null;
-                                       for (int i=0; i<inputs.size(); i++) {
-                                               
-                                               depInfo = depGen2.getDependencySourceInfo(
-                                                               Path.fromOSString(inputs.get(i)), config, tool, makeGen.getBuildWorkingDir());
-                                               
-                                               if (depInfo instanceof IManagedDependencyCalculator) {
-                                                       IManagedDependencyCalculator depCalc = (IManagedDependencyCalculator)depInfo;
-                                                       IPath[] depPaths = depCalc.getDependencies();
-                                                       if (depPaths != null) {
-                                                               for (int j=0; j<depPaths.length; j++) {
-                                                                       if (!depPaths[j].isAbsolute()) {
-                                                                               //  Convert from project relative to build directory relative
-                                                                               IPath absolutePath = project.getLocation().append(depPaths[j]);
-                                                                               depPaths[j] = ManagedBuildManager.calculateRelativePath(
-                                                                                               makeGen.getTopBuildDir(), absolutePath);
-                                                                       }
-                                                                       myCommandDependencies.add(depPaths[j].toString());
-                                                               }
-                                                       }                                                               
-                                                       IPath[] targetPaths = depCalc.getAdditionalTargets();
-                                                       if (targetPaths != null) {
-                                                               for (int j=0; j<targetPaths.length; j++) {
-                                                                       myAdditionalTargets.add(targetPaths[j].toString());
-                                                               }
-                                                       }                                                               
-                                               }
-                                       }
-                               } else {
-                                       IManagedDependencyGenerator oldDepGen = (IManagedDependencyGenerator)depGen;
-                                       for (String input : inputs) {
-                                               IResource[] outNames = oldDepGen.findDependencies(project.getFile(input), project);
-                                               if (outNames != null) {
-                                                       for (IResource outName : outNames) {
-                                                               myCommandDependencies.add(outName.toString());
-                                                       }
-                                               }                                                               
-                                       }                                                               
-                               }
-                       }
-                       break;
-
-               default:
-                       break;
-               }
-               
-               return done;
-       }
-       
-       public boolean calculateDependencies(BuildDataFileGenerator makeGen, IConfiguration config, HashSet<String> handledInputExtensions, ToolInfoHolder h, boolean lastChance) {
-               // Get the dependencies for this tool invocation
-               boolean done = true;
-               Vector<String> myCommandDependencies = new Vector<String>();
-               Vector<String> myAdditionalTargets = new Vector<String>();
-               //Vector myEnumeratedDependencies = new Vector();
-           HashMap<String, List<IPath>> myOutputMacros = new HashMap<String, List<IPath>>();
-
-               IInputType[] inTypes = tool.getInputTypes();
-               if (inTypes != null && inTypes.length > 0) {
-                       for (int i=0; i<inTypes.length; i++) {
-                               IInputType type = inTypes[i];
-                               
-                               // Handle dependencies from the dependencyCalculator
-                               IManagedDependencyGeneratorType depGen = type.getDependencyGenerator();
-                               String[] extensionsList = type.getSourceExtensions(tool);
-                               if (depGen != null) {
-                                       done = callDependencyCalculator (makeGen, config, handledInputExtensions, 
-                                                       depGen, extensionsList, myCommandDependencies, myOutputMacros,
-                                                       myAdditionalTargets, h, done);
-                               }
-                               
-                               // Add additional dependencies specified in AdditionalInput elements
-                               IAdditionalInput[] addlInputs = type.getAdditionalInputs();
-                               if (addlInputs != null && addlInputs.length > 0) {
-                                       for (int j=0; j<addlInputs.length; j++) {
-                                               IAdditionalInput addlInput = addlInputs[j];
-                                               int kind = addlInput.getKind();
-                                               if (kind == IAdditionalInput.KIND_ADDITIONAL_DEPENDENCY ||
-                                                       kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
-                                                       String[] paths = addlInput.getPaths();
-                                                       if (paths != null) {
-                                                               for (int k = 0; k < paths.length; k++) {
-                                                                       // Translate the path from project relative to
-                                                                       // build directory relative
-                                                                       String path = paths[k];
-                                                                       if (!(path.startsWith("$("))) {         //$NON-NLS-1$
-                                                                               IResource addlResource = project.getFile(path);
-                                                                               if (addlResource != null) {
-                                                                                       IPath addlPath = addlResource.getLocation();
-                                                                                       if (addlPath != null) {
-                                                                                               path = ManagedBuildManager.calculateRelativePath(makeGen.getTopBuildDir(), addlPath).toString();
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                                       myCommandDependencies.add(path);
-                                                                       //myEnumeratedInputs.add(path);
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               } else {
-                       if (bIsTargetTool) {
-                               // For support of pre-CDT 3.0 integrations.
-                               // NOTE WELL:  This only supports the case of a single "target tool"
-                               //      with the following characteristics:
-                               // 1.  The tool consumes exactly all of the object files produced
-                               //     by other tools in the build and produces a single output
-                               // 2.  The target name comes from the configuration artifact name
-                               // The rule looks like:
-                               //    <targ_prefix><target>.<extension>: $(OBJS) <refd_project_1 ... refd_project_n>
-                               myCommandDependencies.add("$(OBJS)");                    //$NON-NLS-1$          
-                               myCommandDependencies.add("$(USER_OBJS)");       //$NON-NLS-1$          
-                       } else {
-                               // Handle dependencies from the dependencyCalculator
-                               IManagedDependencyGeneratorType depGen = tool.getDependencyGenerator();
-                               String[] extensionsList = tool.getAllInputExtensions();
-                               if (depGen != null) {
-                                       done = callDependencyCalculator (makeGen, config, handledInputExtensions, 
-                                                       depGen, extensionsList, myCommandDependencies, myOutputMacros,
-                                                       myAdditionalTargets, h, done);
-                               }
-                               
-                       }
-               }
-               
-               //  Add the output macros of this tool to the buildOutVars map 
-               Set<Entry<String, List<IPath>>> entrySet = myOutputMacros.entrySet();
-               for (Entry<String, List<IPath>> entry : entrySet) {
-                       String macroName = entry.getKey();
-                       List<IPath> newMacroValue = entry.getValue();
-                       HashMap<String, List<IPath>> map = makeGen.getBuildOutputVars(); 
-                       if (map.containsKey(macroName)) {
-                               List<IPath> macroValue = map.get(macroName);
-                               macroValue.addAll(newMacroValue);
-                               map.put(macroName, macroValue);
-                       } else {
-                               map.put(macroName, newMacroValue);
-                       }
-               }
-               
-               if (done) {
-                       commandDependencies.addAll(myCommandDependencies);
-                       additionalTargets.addAll(myAdditionalTargets);
-                       //enumeratedDependencies.addAll(myEnumeratedDependencies);
-                       dependenciesCalculated = true;
-                       return true;
-               }
-                               
-               return false;           
-       }
-
-
-       /*
-        * Calculate the source macro for the given extension
-        */
-       protected String calculateSourceMacro(BuildDataFileGenerator makeGen, String srcExtensionName, String outExtensionName, String wildcard) {
-               StringBuffer macroName = makeGen.getSourceMacroName(srcExtensionName);
-               String OptDotExt = ""; //$NON-NLS-1$
-               if (outExtensionName != null) {
-                   OptDotExt = DOT + outExtensionName; 
-               } else
-                       if (tool.getOutputExtension(srcExtensionName) != "") //$NON-NLS-1$
-                               OptDotExt = DOT + tool.getOutputExtension(srcExtensionName); 
-                                  
-               // create rule of the form
-               // OBJS = $(macroName1: ../%.input1=%.output1) ... $(macroNameN: ../%.inputN=%.outputN)
-               StringBuffer objectsBuffer = new StringBuffer();
-               objectsBuffer.append(IManagedBuilderMakefileGenerator.WHITESPACE + "$(" + macroName +                                   //$NON-NLS-1$
-                       IManagedBuilderMakefileGenerator.COLON + IManagedBuilderMakefileGenerator.ROOT +
-                       IManagedBuilderMakefileGenerator.SEPARATOR + IManagedBuilderMakefileGenerator.WILDCARD +                        
-                               DOT + srcExtensionName + "=" + wildcard + OptDotExt + ")" );    //$NON-NLS-1$ //$NON-NLS-2$
-        return objectsBuffer.toString();
-       }
-}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileSelectConfDialog.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/build/BuildDataFileSelectConfDialog.java
deleted file mode 100644 (file)
index dbe81b3..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
-*  NativeApp
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@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.nativecommon.build;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-import org.tizen.nativecommon.Activator;
-import org.tizen.nativecommon.build.CommonBuildMessages;
-import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativecommon.build.exception.SBIException;
-
-
-public class BuildDataFileSelectConfDialog extends Dialog {
-       private IWorkbenchWindow window;
-       private IProject project;       
-       private IConfiguration[] configurations;
-       private ArrayList<IConfiguration> sortConfigurations;
-       private IConfiguration defaultConfiguration;
-       private Combo configurationCombo;
-       private boolean isWin32 = false;
-       private static String BUILD_DATA_FILE = ".build_data";
-
-       protected BuildDataFileSelectConfDialog(Shell parentShell,  IProject project) {
-               super(parentShell);
-               this.project = project;
-               this.window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-               if (System.getProperty("os.name").startsWith("Windows")) {
-                       isWin32 = true;
-               }
-       }
-
-       @Override
-       protected void configureShell(Shell newShell) {
-               super.configureShell(newShell);         
-               
-               configurations = ManagedBuildManager.getBuildInfo(project).getManagedProject().getConfigurations();
-               defaultConfiguration = ManagedBuildManager.getBuildInfo(project).getDefaultConfiguration();
-               
-               newShell.setText("Selection default configuration");            
-               newShell.setLocation(400, 350);
-               newShell.setSize(350, 200);
-       }
-       
-       @Override
-       protected Control createDialogArea(Composite parent) {          
-               
-               Composite composite = new Composite( parent, SWT.NONE);
-               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-               composite.setLayout(new GridLayout(1, false));
-               
-               Label spaceLabel = new Label(composite, SWT.NONE);
-               spaceLabel.setText("");
-               
-               Label mainLabel = new Label(composite, SWT.NONE);
-               mainLabel.setText(" Select default configuration used by \"sbi_build\".");
-               
-               createSelectionConfiguration(composite);                
-                               
-               return null;
-       }
-       
-       private void createSelectionConfiguration(Composite parent) {
-               ArrayList<String> configurationNames = new ArrayList<String>();
-               int index = 0;
-               for (int i = 0 ; i < configurations.length ; i++) {
-                       IConfiguration config = configurations[i];
-                       String configName = config.getName();
-                       if (configName.equals(defaultConfiguration.getName())) {
-                               index = i;
-                       }
-                       configurationNames.add(configName);
-               }               
-               
-               Composite composite = new Composite( parent, SWT.NONE );
-               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-               composite.setLayout(new GridLayout(2, false));
-               
-               Label configurationText = new Label(composite, SWT.NONE);
-               configurationText.setText("Configuration : ");
-               
-               configurationCombo = new Combo(composite, SWT.READ_ONLY);
-               if (!configurationNames.isEmpty()) {
-                       configurationCombo.setItems(configurationNames.toArray(new String[0]));         
-                       configurationCombo.select(index);
-               }
-       }
-       
-       @Override
-       protected void okPressed() {
-               IStatus status = null;
-               int index = configurationCombo.getSelectionIndex();
-               ArrayList<IConfiguration> notDefaultConfigurations = new ArrayList<IConfiguration>();
-               sortConfigurations = new ArrayList<IConfiguration>();           
-               String selectedConfiguration = configurationCombo.getItem(index);               
-               
-               // sort configurations (default configuration is first)
-               for ( IConfiguration config : configurations) {                 
-                       if (selectedConfiguration.equals(config.getName())) {
-                               sortConfigurations.add(config);
-                       } else {
-                               notDefaultConfigurations.add(config);
-                       }
-               }               
-               sortConfigurations.addAll(notDefaultConfigurations);
-               
-               ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
-               try {
-                       dialog.run(true, true, new IRunnableWithProgress() {
-                               @Override
-                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                               InterruptedException {
-                                       monitor.beginTask(CommonBuildMessages.GENERATE_BUILD_DATA, -1);                                 
-                                       try {
-                                               IPath buildDataPath = project.getFullPath().append(".build_data");
-                                               IPath projectPath = project.getLocation();                                              
-                                               String baseRootStrapPath = SmartBuildInterface.getInstance().getBaseRootstrapPath();
-                                               StringBuffer buffer = new StringBuffer();                                               
-                                               IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot();
-                                               IFile buildDataFile = root.getFile(buildDataPath);      
-                                               
-                                               if (buildDataFile.exists()) {
-                                                       buildDataFile.delete(true, new SubProgressMonitor(monitor, 1));
-                                               }
-                                               
-                                               // Create the file if it does not exist
-                                               ByteArrayInputStream contents = new ByteArrayInputStream(new byte[0]);
-                                       
-                                               buildDataFile.create(contents, true, new SubProgressMonitor(monitor, 1));
-                                               // Make sure the new file is marked as derived
-                                               if (!buildDataFile.isDerived()) {
-                                                       buildDataFile.setDerived(true);
-                                               }                                                               
-                                               
-                                               for (IConfiguration cfg : sortConfigurations) {                                                 
-                                                       BuildDataFileGenerator gen = new BuildDataFileGenerator();
-                                                       gen.initialize(0, cfg, null, monitor);                                                  
-                                                       gen.regenerateMakefiles(buffer);
-                                                       
-                                                       // if "Release" , generate "PlatformBuild"
-                                                       if ( cfg.getName().equals("Release") ) {
-                                                               gen.regenerateMakefilesForPlatformBuild();
-                                                       }
-                                               }
-                                               
-                                               String totalStr = buffer.toString();
-                                               if (isWin32) {
-                                                       totalStr = totalStr.replace(projectPath.toString().replace("/", "\\"), "$(PROJECT_PATH)");
-                                                       totalStr = totalStr.replace(baseRootStrapPath.replace("\\", "/"), "$(ROOTSTRAP_BASE_PATH)");
-                                               } else {
-                                                       totalStr = totalStr.replace(projectPath.toString(), "$(PROJECT_PATH)");
-                                                       totalStr = totalStr.replace(baseRootStrapPath, "$(ROOTSTRAP_BASE_PATH)");
-                                               }
-                                               buffer = new StringBuffer();
-                                               buffer.append(totalStr);
-       
-                                               Util.save(buffer, buildDataFile);
-                                               
-                                               // if "Release" configuration , generate makefiles in "PlatformBuild" directory
-                                               for (IConfiguration cfg : sortConfigurations) {                                                 
-                                                       if ( cfg.getName().equals("Release") ) {
-                                                               BuildDataFileGenerator gen = new BuildDataFileGenerator();
-                                                               gen.initialize(0, cfg, null, monitor);                                                  
-                                                               gen.regenerateMakefilesForPlatformBuild();
-                                                       }
-                                               }
-
-                                       } catch (CoreException e) {
-                                               // TODO Auto-generated catch block
-                                               e.printStackTrace();
-                                       }               
-                                       monitor.done();
-                                       
-                               }
-                       });
-               } catch (Exception e) {
-                       e.printStackTrace();    
-               }
-               
-               File resultScriptFile = new File(project.getLocation().toString() + File.separatorChar + BUILD_DATA_FILE); 
-               if (resultScriptFile != null && resultScriptFile.exists())
-               {
-                       String message;
-                       message = CommonBuildMessages.SUCCESS_GENERATE_BUILD_DATA + "\n";                                       
-                       status = new Status(Status.OK, Activator.PLUGIN_ID, message);
-                       resultScriptFile.setExecutable(true);
-               }
-               else
-                       status = new Status(Status.ERROR, Activator.PLUGIN_ID, CommonBuildMessages.FAIL_TO_GENERATE_BUILD_DATA);
-       
-               if (status.isOK()) {
-                       MessageDialog.openInformation(window.getShell(), CommonBuildMessages.GENERATE_BUILD_DATA_RESULT, status.getMessage());
-               } else {
-                       MessageDialog.openError(window.getShell(), CommonBuildMessages.GENERATE_BUILD_DATA_RESULT, status.getMessage());
-               }
-       
-               // refresh the project explorer
-               try {
-                       project.refreshLocal(IResource.DEPTH_INFINITE, null );
-               } catch (CoreException e) {
-                       e.printStackTrace();
-               }
-               
-               super.okPressed();
-       }
-}
index 0a2f00c..8e6adc1 100644 (file)
 */
 package org.tizen.nativecommon.build;
 
+import java.lang.reflect.Field;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativecommon.build.obs.UserInformation;
 
 
 public class CheckCancelJob implements Runnable {
        private IProgressMonitor monitor;
-    private final SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+       private String targetId;        
+    private SmartBuildInterface target_sbi;
+    private SmartBuildInterface command_sbi;
     private boolean terminateChecker;
     private boolean isFinished;
+    private boolean isPlatform;
+    private Process proc;
       
-     public CheckCancelJob(IProgressMonitor _monitor) {
-        this.monitor = _monitor;
-     }
+    public CheckCancelJob(IProgressMonitor _monitor, IProject proj, SmartBuildInterface target_sbi, boolean isPlatform) {
+               this.target_sbi = target_sbi;
+               this.command_sbi = SmartBuildInterface.getInstance(proj);
+               this.monitor = _monitor;
+               this.isPlatform = isPlatform;
+               this.proc = null;
+               IConfiguration cfg = ManagedBuildManager.getBuildInfo(proj).getDefaultConfiguration();           
+               try {
+                       this.targetId = CommonConfigurationManager.getDefaultBuildTargetName(cfg);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }
+       }
      
      @Override
      public void run() {
@@ -52,11 +72,37 @@ public class CheckCancelJob implements Runnable {
                                Thread.sleep(100);      
                         if (monitor.isCanceled()) {
                                 try {
-                                        this.terminateChecker=sbi.terminate();                                  
-                                        monitor.setCanceled(false);
+                                        proc = target_sbi.getProcess();
+                                        if (isPlatform) {
+                                               String passwd = UserInformation.getRootPassword();
+                                               if (passwd == null) {
+                                                       passwd = "";
+                                               }                                                                       
+                                               String pid = "";
+                                               try {
+                                                       Field f = proc.getClass().getDeclaredField("pid");
+                                                       f.setAccessible(true);
+                                                       pid = f.get(proc).toString();                                                           
+                                               } catch (IllegalArgumentException e) {                                  
+                                                       e.printStackTrace();
+                                               } catch (IllegalAccessException e) {                                    
+                                                       e.printStackTrace();
+                                               } catch (SecurityException e) {                                 
+                                                       e.printStackTrace();
+                                               } catch (NoSuchFieldException e) {                                      
+                                                       e.printStackTrace();
+                                               }                               
+                                                       
+                                               String option = String.format("-pid=%s -passwd=%s", pid, passwd);
+                                               command_sbi.actionReturnExitValue("kill", option, targetId, null);                                              
+                                       }
+                                       proc.destroy();                                                 
+                                        
                                 } catch (SBIException e) {
+                                        setFinishFlag(true);
                                         e.printStackTrace();
                                 }
+                                setFinishFlag(true);
                         }
                 }
         } catch (InterruptedException e1) {                    
@@ -64,10 +110,6 @@ public class CheckCancelJob implements Runnable {
                }
      }
 
-     public boolean getTerminateChecker() {
-        return this.terminateChecker;
-     }
-     
      public void setFinishFlag(boolean value) {
         this.isFinished = value;
      }
index 3167188..c221fa5 100644 (file)
@@ -30,6 +30,9 @@
 package org.tizen.nativecommon.build;
 
 import org.eclipse.cdt.core.CommandLauncher;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -49,12 +52,25 @@ public class CommonBuildCommandLauncher extends CommandLauncher {
 
                Process proc = null;
 
-               if ( commandPath.toString().contains( "sbi-make") ) {                   
-                       CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance( this.getProject() );
-                       SmartBuildInterface sbi = SmartBuildInterface.getInstance(); 
+               if ( commandPath.toString().contains( "sbi-make") ) {
+                       IProject proj = getProject();
+                       CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(proj);
+                       SmartBuildInterface sbi = SmartBuildInterface.getInstance(proj);                
                        
-                       // verify target, toolchain, rootstrap cfg
-                       String targetID = builder.getTargetID();
+                       // String targetID = builder.getTargetID();
+                       // Can not use "builder.getTargetID()" because "Build All, Clean All" command
+                       // So, use last segment of working directory. it is configuration name
+                       String cfgName = changeToDirectory.lastSegment();
+                       IConfiguration[] cfgs = ManagedBuildManager.getBuildInfo(getProject()).getManagedProject().getConfigurations();
+                       IConfiguration cfg = null;
+                       for (IConfiguration c : cfgs) {
+                               if (c.getName().equals(cfgName)) {
+                                       cfg = c;
+                                       break;
+                               }
+                       }
+                       
+                       String targetID = builder.getTargetID(cfg);
                        String toolchainID = sbi.getToolchainIDFromTargetID(targetID);
                        String rootstrapID = sbi.getRootstrapIDFromTargetID(targetID);                  
 
@@ -67,7 +83,6 @@ public class CommonBuildCommandLauncher extends CommandLauncher {
                                        
                                        throw new SBIException(message);
                                }
-                       
                                if (!sbi.checkTargetID(targetID)) {
                                        sbi.writeTargetCfgFile(targetID);
                                }                       
@@ -75,7 +90,7 @@ public class CommonBuildCommandLauncher extends CommandLauncher {
                                e.printStackTrace();
                                e.showErrorDialog();
                        }
-                       
+
                        String options = args[0];
                        for( int i = 1 ; i < args.length ; i++  ) {
                                options = options + " " + args[i];
@@ -88,7 +103,6 @@ public class CommonBuildCommandLauncher extends CommandLauncher {
                        for( int i = 0; i < cmds.length - 1; i ++ ) {
                                newArgs[i]= cmds[i+1];
                        }
-                       sbi.setProject(this.getProject());
                        proc = super.execute( new Path(cmds[0]), newArgs, sbi.getEnvironmentVariables(), changeToDirectory, monitor);
                } else {
                        proc =  super.execute(commandPath, args, env, changeToDirectory, monitor);
index 40a4454..ef4f29c 100644 (file)
@@ -1,53 +1,60 @@
 /*
-*  Build
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@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
-*
-*/
+ *  Build
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Kangho Kim <kh5325.kim@samsung.com>
+ * Yoonki Park <yoonki.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.nativecommon.build;
 
+/**
+ * A tizen build configuration constants
+ * 
+ * @author Kangho Kim{@literal <kh5325.kim@samsung.com>} (S-Core)
+ */
 public class CommonBuildConstants {
-       
-       public static final int FULL_BUILD = 6;
-       public static final int PACKAGE_BUILD = 7;
-       public static final int AUTO_BUILD = 9;
-       public static final int INCREMENTAL_BUILD = 10;
-       public static final int CLEAN_BUILD = 15;
-       
-       public static final String ARGS_AUTO = "build";
-       public static final String ARGS_INCREMENTAL = "build";
-       public static final String ARGS_FULL = "build";
-       public static final String ARGS_CLEAN = "clean";
-       public static final String ARGS_PACKAGE = "package";
-                       
-       public static final String UNIT_TEST_NATURE_ID = "org.tizen.tizentest.nature";  
-       public static final String BUILD_COMMAND = "sbi-ide";   
-       
-       public static final String WINDOW_SHELL = "cmd";
-       public static final String LINUX_SHELL = "/bin/bash";
-       public static final String SHELL_EOF = "!#@$%&^*";
-       public static final String UNIX_EOF = "!#@$%&^*";
-       public static final String SBOX_EOF = "] >";    
+    // TODO : won't be used
+    public static final int FULL_BUILD = 6;
+    public static final int PACKAGE_BUILD = 7;
+    public static final int AUTO_BUILD = 9;
+    public static final int INCREMENTAL_BUILD = 10;
+    public static final int CLEAN_BUILD = 15;
+
+    public static final String ARGS_AUTO = "build";
+    public static final String ARGS_INCREMENTAL = "build";
+    public static final String ARGS_FULL = "build";
+    public static final String ARGS_CLEAN = "clean";
+    public static final String ARGS_PACKAGE = "package";
+
+    public static final String UNIT_TEST_NATURE_ID = "org.tizen.tizentest.nature";
+    public static final String BUILD_COMMAND = "sbi-ide";
+
+    public static final String WINDOW_SHELL = "cmd";
+    public static final String LINUX_SHELL = "/bin/bash";
+    public static final String SHELL_EOF = "!#@$%&^*";
+    public static final String UNIX_EOF = "!#@$%&^*";
+    public static final String SBOX_EOF = "] >";
+
+    /**
+     * Default auto-build value
+     */
+    public static final boolean DEFAULT_AUTOBUILD = true;
 }
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonBuildPackageObjectAction.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/build/CommonBuildPackageObjectAction.java
deleted file mode 100644 (file)
index 40be872..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
-*  NativeApp
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-* DongHee Yang <donghee.yang@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.nativecommon.build;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-
-import org.tizen.nativecommon.Activator;
-import org.tizen.nativecommon.build.CheckCancelJob;
-import org.tizen.nativecommon.build.CommonBuildMessages;
-import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
-import org.tizen.nativecommon.build.ProjectTypeManager;
-import org.tizen.nativecommon.build.exception.SBIException;
-
-
-public class CommonBuildPackageObjectAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
-       protected IProject project;
-       protected IWorkbenchWindow window;
-       private IStatus status = null;
-       private String pkgType;
-
-       public CommonBuildPackageObjectAction() {
-       }
-
-       public CommonBuildPackageObjectAction(IProject project) {
-               this.project = project;
-       }
-
-       @Override
-       public void run(IAction action) {
-               pkgType = action.getText();
-               CommonBuildPackageFile.setPackageType(project, pkgType);
-               window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-               ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
-
-               try {
-                       dialog.run(true, true, new IRunnableWithProgress() {
-                               @Override
-                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                               InterruptedException {
-                                       status = null;
-                                       monitor.beginTask(CommonBuildMessages.PACKAGING_APPLICATION, -1);
-
-                                       CheckCancelJob cancelJob = new CheckCancelJob(monitor);
-                                       Thread checkCancelThread = new Thread(cancelJob);
-                                       checkCancelThread.start();
-
-                                       CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(project);
-
-                                       try {
-                                               if (packager.isDependencyCheckSuppoted()) {
-                                                       monitor.subTask("Checking package dependency...");
-                                                       packager.buildPackageDependencyCheck();
-                                                       // check terminated
-                                                       if(cancelJob.getTerminateChecker()){
-                                                               cancelJob.setFinishFlag(true);
-                                                               monitor.done();
-                                                               return ;
-                                                       }
-
-                                                       checkBuildPackageContinue checkContinueJob = new checkBuildPackageContinue();
-                                                       Display.getDefault().syncExec(checkContinueJob);
-                                                       while (checkContinueJob.getResult() == -1) {
-                                                       }
-                                                       if (checkContinueJob.getResult() == 0) {
-                                                               status = new Status(Status.OK, Activator.PLUGIN_ID, CommonBuildMessages.STOP_TO_BUILD_PACKAGE);
-                                                               monitor.done();
-                                                               return;
-                                                       } else {
-                                                               monitor.subTask("Building package...");
-                                                               project.build( IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor );
-                                                               packager.buildPackage(pkgType);
-                                                       }
-                                               } else {
-                                                       monitor.subTask("Building package...");
-                                                       project.build( IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor );
-                                                       packager.buildPackage(pkgType);
-                                               }
-                                       } catch (SBIException e) {
-                                               e.printStackTrace();
-                                               status = new Status(Status.ERROR, Activator.PLUGIN_ID, CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);
-                                               cancelJob.setFinishFlag(true);
-                                               monitor.done();
-                                               return;
-                                       } catch (CoreException e) {
-                                               //e.printStackTrace();
-                                               status = new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage());
-                                               cancelJob.setFinishFlag(true);
-                                               monitor.done();
-                                               return;
-                                       }
-
-                                       // check terminated
-                                       if(cancelJob.getTerminateChecker()){
-                                               cancelJob.setFinishFlag(true);
-                                               monitor.done();
-                                               return ;
-                                       }
-
-                                       //monitor.worked(1);
-
-                                       if (packager.isPackageCheckSuppoted()) {
-                                               if (packager.checkPackageFile(pkgType)) {
-                                                       status = new Status(Status.OK, Activator.PLUGIN_ID, CommonBuildMessages.SUCCESS_TO_BUILD_PACKAGE);
-                                               } else {
-                                                       status = new Status(Status.ERROR, Activator.PLUGIN_ID, CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);
-                                               }
-                                       }
-                                       //monitor.worked(2);
-
-                                       //checkCancelThread.interrupt();
-                                       monitor.done();
-                               }
-                       });
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-
-               if (status != null) {
-                       if (status.isOK()) {
-                               MessageDialog.openInformation(window.getShell(), CommonBuildMessages.BUILD_RESULT, status.getMessage());
-                       } else {
-                               MessageDialog.openError(window.getShell(), CommonBuildMessages.BUILD_RESULT, status.getMessage());
-                       }
-               }
-
-
-               // refresh the project explorer
-               try {
-                       project.refreshLocal(IResource.DEPTH_INFINITE, null );
-               } catch (CoreException e) {
-                       e.printStackTrace();
-               }
-       }
-
-       protected File findFirstFilebyExtension(File searchPath, String ext) {
-               File[] allFiles = searchPath.listFiles(new ExtFilter(ext));
-               if (allFiles == null || allFiles.length == 0)
-                       return null;
-               return allFiles[0];
-       }
-
-       protected class ExtFilter implements FilenameFilter {
-               protected String ext;
-
-               public ExtFilter(String ext) {
-                       this.ext = ext;
-               }
-
-               public boolean accept(File dir, String name) {
-                       return name.endsWith(ext);
-               }
-       }
-
-       @Override
-       public void selectionChanged(IAction action, ISelection selection) {
-               Object obj = null;
-
-               if (selection instanceof TreeSelection) {
-                       TreeSelection _selection = (TreeSelection)selection;
-
-                       if (_selection != null) {
-                               obj = _selection.getFirstElement();
-                       }
-               }
-
-               if (obj != null) {
-                       if (obj instanceof IProject) {
-                               project = (IProject) obj;
-                       }
-               }
-       }
-
-       @Override
-       public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-               // do nothing
-       }
-
-       @Override
-       public void dispose() {
-               // do nothing
-       }
-
-       @Override
-       public void init(IWorkbenchWindow window) {
-               // do nothing
-       }
-
-       private class checkBuildPackageContinue implements Runnable {
-               private int result = -1;
-
-               public checkBuildPackageContinue() {
-               }
-
-               @Override
-               public void run() {
-                       synchronized(this) {
-                               // TODO Auto-generated method stub
-                               Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-                               boolean bResult = MessageDialog.openQuestion(shell, "Question",
-                                               "Dependency checking has finished.\nDo you want to continue ?");
-                               if (bResult) {
-                                       result = 1;
-                               } else {
-                                       result = 0;
-                               }
-                       }
-               }
-
-               public int getResult() {
-                       return this.result;
-               }
-       };
-}
index 61bc5fe..54d6bf4 100644 (file)
@@ -29,6 +29,7 @@
 package org.tizen.nativecommon.build;
 
 import java.util.ArrayList;
+import java.util.Collections;
 
 import org.eclipse.cdt.core.CCProjectNature;
 import org.eclipse.cdt.core.model.CoreModel;
@@ -41,940 +42,965 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
 import org.eclipse.cdt.managedbuilder.core.IProjectType;
 import org.eclipse.cdt.managedbuilder.core.ITool;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.internal.core.Tool;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativecommon.build.model.SBIModel;
 
 
 
 
 public class CommonConfigurationManager
 {
-       // Project Info
-       static final String SLP_PROJECT_INFO_STORAGE_MODULE_ID = "com.samsung.tizen.nativeapp.projectInfo";
-
-       public static  final String SBI_BASE_C_COMPILER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.c.compiler.base";
-       public static  final String SBI_BASE_CPP_COMPILER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.base";
-       public static  final String SBI_ASSEMBLER_TOOL_ID = "org.tizen.nativeapp.tool.sbi.gnu.assembler.base";  
-       public static  final String SBI_C_TARGET_OPTION_ID = "sbi.gnu.c.compiler.option";
-       public static  final String SBI_CPP_TARGET_OPTION_ID = "sbi.gnu.cpp.compiler.option";
-       public static  final String GNU_C_INCLUDE_PATH_OPTION_ID = "gnu.c.compiler.option.include.paths";
-       public static  final String GNU_CPP_INCLUDE_PATH_OPTION_ID = "gnu.cpp.compiler.option.include.paths";   
-       public static  final String GNU_C_DEF_SYMBOLS_OPTION_ID = "gnu.c.compiler.option.preprocessor.def.symbols";
-       public static  final String GNU_CPP_DEF_SYMBOLS_OPTION_ID = "gnu.cpp.compiler.option.preprocessor.def";
-       public static  final String SBI_C_LINKER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.c.linker.base";
-       public static  final String SBI_CPP_LINKER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.cpp.linker.base";        
-       
-       public static  final String GNU_C_LIBRARIES_OPTION_ID = "gnu.c.link.option.libs";
-       public static  final String GNU_CPP_LIBRARIES_OPTION_ID = "gnu.cpp.link.option.libs";
-       public static  final String GNU_C_USEROBJS_OPTION_ID = "gnu.c.link.option.userobjs";
-       public static  final String GNU_CPP_USEROBJS_OPTION_ID = "gnu.cpp.link.option.userobjs";
-       public static  final String GNU_C_LINKPATH_OPTION_ID = "gnu.c.link.option.paths";
-       public static  final String GNU_CPP_LINKPATH_OPTION_ID = "gnu.cpp.link.option.paths";
-       public static  final String GNU_C_LINKOTHER_OPTION_ID = "gnu.c.link.option.other";
-       public static  final String GNU_CPP_LINKOTHER_OPTION_ID = "gnu.cpp.link.option.other";
-       public static  final String SBI_C_OTHER_FPIC_ID = "sbi.gnu.c.compiler.option.misc.pic";
-       public static  final String SBI_CPP_OTHER_FPIC_ID = "sbi.gnu.cpp.compiler.option.misc.pic";     
-       public static  final String SBI_CPP_LINKER_OTHER_SHARED_ID = "sbi.gnu.cpp.linker.option.shared_flag";
-       
-       public static  final String SBI_DEVICE_CONFIG_SUFFIX = "Tizen-Device";
-       public static  final String SBI_EMULATOR_CONFIG_SUFFIX = "Tizen-Emulator";
-       public static  final String SBI_RELEASE_CONFIG_SUFFIX = "Release";
-       
-       public static  final String SBI_OLD_DEVICE_CONFIG_SUFFIX = "SLP-Device";
-       public static  final String SBI_OLD_EMULATOR_CONFIG_SUFFIX = "SLP-Emulator";
-       
-       /** this is old version (for compatibility) **/
-       public static  final String SBI_BASE_C_COMPILER_TOOL_ID_OLD = "com.samsung.slp.nativeide.tool.sbi.gnu.c.compiler.base";
-       public static  final String SBI_BASE_CPP_COMPILER_TOOL_ID_OLD = "com.samsung.slp.nativeide.tool.sbi.gnu.cpp.compiler.base";
-       public static  final String SBI_ASSEMBLER_TOOL_ID_OLD = "com.samsung.tizen.nativeapp.tool.sbi.gnu.assembler.base";
-       public static  final String SBI_C_TARGET_OPTION_ID_OLD = "sbi.gnu.c.compiler.option.target";
-       public static  final String SBI_CPP_TARGET_OPTION_ID_OLD = "sbi.gnu.cpp.compiler.option.target";                
-       public static  final String SBI_C_LINKER_TOOL_ID_OLD = "com.samsung.slp.nativeide.tool.sbi.gnu.c.linker.base";
-       public static  final String SBI_CPP_LINKER_TOOL_ID_OLD = "com.samsung.slp.nativeide.tool.sbi.gnu.cpp.linker.base";
-       public static  final String SBI_C_OTHER_FPIC_ID_OLD = "sbi.gnu.c.compiler.slp.option.misc.pic";
-       public static  final String SBI_CPP_OTHER_FPIC_ID_OLD = "sbi.gnu.cpp.compiler.slp.option.misc.pic";
-       public static  final String SBI_CPP_LINKER_OTHER_SHARED_ID_OLD = "sbi.gnu.cpp.linker.slp.option.shared_flag";
-
-       
-       public static void initializeBuildTargetName( IProject project ) {
-               
-               
-               try {
-                       IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
-                       IConfiguration defaultConfig = info.getDefaultConfiguration();
-                       
-                       SmartBuildInterface sbi = SmartBuildInterface.getInstance();
-                       
-                       for( IConfiguration config: defaultConfig.getManagedProject().getConfigurations() ) {
-                               
-                               String targetID = getDefaultBuildTargetName(config);
-                                       
-                               if (!sbi.checkTargetID(targetID)) {                                     
-                                       sbi.writeTargetCfgFile(targetID);
-                               }               
-                               
-                               setBuildTargetName(config, targetID );
-                               setToolCommand( config, sbi.getRootstrapIDFromTargetID(targetID) );             
-                       }
-                       
-                       // Apply to project file
-                       ManagedBuildManager.saveBuildInfo( project, true);
-               } catch (SBIException e) {
-                       e.showErrorDialog();
-               }                       
-       }
-               
-       
-       public static void setBuildTargetName( IConfiguration config, String targetName ) {
-               
-               String c_compiler_tool_id = SBI_BASE_C_COMPILER_TOOL_ID;
-               String c_target_option_id = SBI_C_TARGET_OPTION_ID;
-               String cpp_compiler_tool_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
-               String cpp_target_option_id = SBI_CPP_TARGET_OPTION_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       //CommonConfigurationOld.setBuildTargetName(config, targetName);
-                       c_compiler_tool_id = SBI_BASE_C_COMPILER_TOOL_ID;
-                       c_target_option_id = SBI_C_TARGET_OPTION_ID;
-                       cpp_compiler_tool_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
-                       cpp_target_option_id = SBI_CPP_TARGET_OPTION_ID;
-
-                       return;
-               }
-
-               ArrayList<String> tmpList = new ArrayList<String>();
-               tmpList.add( targetName );
-
-               // c compiler
-               ITool compilerTool =config.getToolsBySuperClassId( c_compiler_tool_id )[0];
-               IOption targetOption = compilerTool.getOptionBySuperClassId( c_target_option_id );
-               ManagedBuildManager.setOption( config, compilerTool, targetOption, tmpList.toArray( new String[0] ));
-
-               // cpp compiler
-               compilerTool =config.getToolsBySuperClassId( cpp_compiler_tool_id )[0];
-               targetOption = compilerTool.getOptionBySuperClassId( cpp_target_option_id );
-               ManagedBuildManager.setOption( config, compilerTool, targetOption, tmpList.toArray( new String[0] ));
-       }
-       
-
-       // Get default target name for the configuration
-       public static String getDefaultBuildTargetName( IConfiguration config ) throws SBIException
-       {
-               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
-               String rootstrapName = "";
-               String toolchainName = "";
-               String toolchainNameInConfiguration = config.getToolChain().getName();                  
-               String arch;
-               ArrayList<String>  toolchainList = sbi.getToolchainList();
-               ArrayList<String> rootstrapList = sbi.getRootstrapList();
-               
-               // get architecture
-               if ( config.getName().contains(SBI_EMULATOR_CONFIG_SUFFIX)) {
-                       arch = "i386";
-               } 
-               else if ( config.getName().contains(SBI_DEVICE_CONFIG_SUFFIX) ) {
-                       arch = "armel";                         
-               }
-               else {
-                       arch = "armel";                         
-               }
-               
-               // get matching toolchain name
-               for (String toolchainID : toolchainList ) {
-                       // First , should be matched Tool-chain Name, Architecture
-                       if (sbi.getToolchianNameFromToolchainID(toolchainID).equals(toolchainNameInConfiguration) &&                                            
-                               sbi.getArchitectureFromToolchainID(toolchainID).equals(arch) ) {
-                               
-                               // Project type must be matched, if specified
-                               String projectType = sbi.getToolchainPropertyValue( toolchainID, "PROJECT_TYPE" );
-                               IProjectType configProjectType = config.getProjectType() != null ? config.getProjectType() : config.getParent().getProjectType();
-                               if ( projectType != null && !projectType.equals( configProjectType.getBuildArtefactType().getId() ) )
-                                       continue;
-
-                               toolchainName = toolchainID;
-                               break;
-                       }               
-               }
-               
-               // get matching rootstrap name
-               for (String rootstrapID : rootstrapList ) {
-
-                       // First , should be matched Tool-chain Type and Architecture
-                       String toolchainType = sbi.getToolchainTypeFromToolchainID( toolchainName );
-                       if ( sbi.doesRootstrapSupportToolchainType( rootstrapID, toolchainType ) && 
-                                       sbi.getArchitectureFromRootstrapID(rootstrapID).equals(arch)) {
-
-                               // Project type must be matched, if specified
-                               String projectType = sbi.getRootstrapPropertyValue( rootstrapID, "PROJECT_TYPE" );
-                               if ( projectType != null && !projectType.equals(  config.getProjectType().getBuildArtefactType().getId()  ) )
-                                       continue;
-
-                               rootstrapName = rootstrapID;
-                               break;
-                       }
-               }
-               
-               if (rootstrapName == "" ) {
-                       throw new SBIException( String.format( "There is no avaiable rootstrap for configuration \"%s\"", config.getName() ) );                         
-               } 
-               else if ( toolchainName == "" ) {
-                       throw new SBIException( String.format( "There is no avaiable toolchain for configuration \"%s\"", config.getName() ) );                         
-               }
-               else {
-                       return SmartBuildInterface.makeTargetID( rootstrapName, toolchainName );        
-               }
-       }
-
-       
-       public static String getBuildTargetName( IConfiguration config ) 
-       {
-               String compiler_tool_id = SBI_BASE_C_COMPILER_TOOL_ID;
-               String target_option_id = SBI_C_TARGET_OPTION_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       //return CommonConfigurationOld.getBuildTargetName(config);
-                       compiler_tool_id = SBI_BASE_C_COMPILER_TOOL_ID_OLD;
-                       target_option_id = SBI_C_TARGET_OPTION_ID_OLD;
-               }
-
-               ITool compilerTool =config.getToolsBySuperClassId( compiler_tool_id )[0];
-               IOption targetOption = compilerTool.getOptionBySuperClassId( target_option_id );
-               String[] targetList;
-               
-               try {
-                       targetList = targetOption.getUserObjects();
-
-               } catch (BuildException e) {
-                       e.printStackTrace();
-                       return null;
-               }
-
-               if ( targetList.length == 1 )
-                       return targetList[0];
-               else
-                       return  null;   
-       }
-
-       
-       public static void setToolCommand( IConfiguration config, String rootstrapCfgName ) 
-       {
-               String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;             
-               String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               String assembler_id = SBI_ASSEMBLER_TOOL_ID;
-               
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID_OLD;                
-                       cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       assembler_id = SBI_ASSEMBLER_TOOL_ID_OLD;
-                       //CommonConfigurationOld.setToolCommand(config, rootstrapCfgName);
-                       //return;
-               }
-
-               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
-               String arch;
-               try {
-                       arch = sbi.getArchitectureFromRootstrapID(rootstrapCfgName);
-                       String toolchainype = sbi.getSupportToolchainTypeFromRootstrapID(rootstrapCfgName);
-                       
-                       ITool compilerTool =config.getToolsBySuperClassId( c_compiler_id )[0];
-                       ITool cxxcompilerTool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
-                       ITool linkerTool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-                       ITool assemblerTool =config.getToolsBySuperClassId( assembler_id )[0];          
-                       
-                       ManagedBuildManager.setToolCommand(config, compilerTool, 
-                                       new Path(sbi.getCCompilerPath(getBuildTargetName(config))).lastSegment());
-                       ManagedBuildManager.setToolCommand(config, cxxcompilerTool, 
-                                       new Path(sbi.getCXXCompilerPath(getBuildTargetName(config))).lastSegment());
-                       ManagedBuildManager.setToolCommand(config, linkerTool, 
-                                       new Path(sbi.getCXXCompilerPath(getBuildTargetName(config))).lastSegment());            
-                       
-                       // this is should be changed after toolchain config file(.cfg) supports assembler path
-                       if (toolchainype.equals("slp.sbox2")) {                 
-                               ManagedBuildManager.setToolCommand(config, assemblerTool, "as");
-                       } else {                        
-                               if (arch.equals("i386")) {
-                                       ManagedBuildManager.setToolCommand(config, assemblerTool, "i386-linux-gnueabi-as");                             
-                               } else {                                                                
-                                       ManagedBuildManager.setToolCommand(config, assemblerTool, "arm-linux-gnueabi-as");                              
-                               }
-                       }
-               } catch (SBIException e) {
-                       e.printStackTrace();
-                       e.showErrorDialog();
-               }
-               
-       }
-
-       
-       protected static boolean isCPPProject( IConfiguration config )
-       {
-               try {
-                       IProject project = (IProject)config.getOwner();
-
-                       if ( project.hasNature(  CCProjectNature.CC_NATURE_ID ) ) 
-                               return true;
-               } catch (CoreException e1) {
-                       e1.printStackTrace();
-               }
-
-               return false;
-       }
-       
-       
-       public static String getArchitecture( IConfiguration config ) 
-       {
-               SmartBuildInterface sbi = SmartBuildInterface.getInstance();                            
-               String targetID = getBuildTargetName(config);
-
-               try {
-                       return sbi.getRootstrapArchitecture( targetID );
-               } catch (SBIException e) {
-                       e.printStackTrace();
-                       e.showErrorDialog();
-                       return "armel";
-               }
-       }
-       
-       
-       // append linker option to 
-       public static void appendLibraryToLinker(  IConfiguration config, String libraryName )
-       {
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       //CommonConfigurationOld.appendLibraryToLinker(config, libraryName);
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return;
-               }
-
-               String linkerId;
-               String linkerOption;
-               
-               if ( isCPPProject( config ) ) {
-                       linkerId = cpp_linker_id ;
-                       linkerOption = GNU_CPP_LIBRARIES_OPTION_ID;
-               }
-               else {
-                       linkerId = c_linker_id ;
-                       linkerOption = GNU_C_LIBRARIES_OPTION_ID;
-               }
-               
-               ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
-               IOption librariesOption = linkerTool.getOptionBySuperClassId(linkerOption);
-
-               ArrayList<String> tmpList =new ArrayList<String>();
-               String[] libraries;
-               try {
-                       libraries = librariesOption.getLibraries();
-                       for( String lib : libraries ) {
-                               tmpList.add( lib );
-                       }
-               } catch (BuildException e) {
-               }
-
-               tmpList.add( libraryName );
-               ManagedBuildManager.setOption( config, linkerTool, librariesOption, tmpList.toArray( new String[0] ));
-       }
-       
-       
-       // append link other object option to 
-       public static void appendOtherObjectToLinker(  IConfiguration config, String objPath )
-       {
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       //CommonConfigurationOld.appendOtherObjectToLinker(config, objPath);
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return;
-               }
-
-               String linkerId;
-               String objOption;
-               
-               if ( isCPPProject( config ) ) {
-                       linkerId = cpp_linker_id ;
-                       objOption = GNU_CPP_USEROBJS_OPTION_ID;
-               }
-               else {
-                       linkerId = c_linker_id ;
-                       objOption = GNU_C_USEROBJS_OPTION_ID;
-               }
-               
-               ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
-               IOption userObjOption = linkerTool.getOptionBySuperClassId(objOption);
-
-               ArrayList<String> tmpList =new ArrayList<String>();
-               String[] userObjFlags;
-               try {
-                       userObjFlags = userObjOption.getBasicStringListValue();
-                       for( String obj : userObjFlags ) {
-                               tmpList.add( obj );
-                       }
-               } catch (BuildException e) {
-               }
-
-               if( !tmpList.contains(objPath) ){
-                       tmpList.add( objPath );
-                       ManagedBuildManager.setOption( config, linkerTool, userObjOption, tmpList.toArray( new String[0] ));
-               }
-       }
-       
-       
-       // append link path option to 
-       public static void appendLinkPathsToLinker(  IConfiguration config, String path )
-       {
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       //CommonConfigurationOld.appendLinkPathsToLinker(config, path);
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return;
-               }
-
-               String linkerId;
-               String pathOption;
-               
-               if ( isCPPProject( config ) ) {
-                       linkerId = cpp_linker_id ;
-                       pathOption = GNU_CPP_LINKPATH_OPTION_ID;
-               }
-               else {
-                       linkerId = c_linker_id ;
-                       pathOption = GNU_C_LINKPATH_OPTION_ID;
-               }
-               
-               ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
-               IOption linkPathOption = linkerTool.getOptionBySuperClassId(pathOption);
-
-               ArrayList<String> tmpList =new ArrayList<String>();
-               String[] flags;
-               try {
-                       flags = linkPathOption.getBasicStringListValue();
-                       for( String obj : flags ) {
-                               tmpList.add( obj );
-                       }
-               } catch (BuildException e) {
-               }
-
-               tmpList.add( path );
-               ManagedBuildManager.setOption( config, linkerTool, linkPathOption, tmpList.toArray( new String[0] ));
-       }
-       
-       
-       // append link path option to 
-       public static void appendLinkOtherFlagsToLinker(  IConfiguration config, String flag )
-       {
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       //CommonConfigurationOld.appendLinkOtherFlagsToLinker(config, flag);
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return;
-               }
-
-               String linkerId;
-               String flagOption;              
-               
-               if ( isCPPProject( config ) ) {
-                       linkerId = cpp_linker_id ;
-                       flagOption = GNU_CPP_LINKOTHER_OPTION_ID;
-               }
-               else {
-                       linkerId = c_linker_id ;
-                       flagOption = GNU_C_LINKOTHER_OPTION_ID;
-               }
-               
-               ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
-               IOption otherFlagOption = linkerTool.getOptionBySuperClassId(flagOption);
-
-               ArrayList<String> tmpList =new ArrayList<String>();
-               String[] flags;
-               try {
-                       flags = otherFlagOption.getBasicStringListValue();
-                       for( String obj : flags ) {
-                               tmpList.add( obj );
-                       }
-               } catch (BuildException e) {
-               }
-
-               tmpList.add( flag );
-               ManagedBuildManager.setOption( config, linkerTool, otherFlagOption, tmpList.toArray( new String[0] ));
-       }
-       
-       // remove link other object option from linker 
-       public static void removeOtherObjectFromLinker(  IConfiguration config, String objPath )
-       {
-               String linkerId;
-               String objOption;
-               
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-
-               }
-               
-               if ( isCPPProject( config ) ) {
-                       linkerId = cpp_linker_id ;
-                       objOption = GNU_CPP_USEROBJS_OPTION_ID;
-               } else {
-                       linkerId = c_linker_id ;
-                       objOption = GNU_C_USEROBJS_OPTION_ID;
-               }
-               
-               ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
-               IOption userObjOption = linkerTool.getOptionBySuperClassId(objOption);
-
-               ArrayList<String> tmpList =new ArrayList<String>();
-               String[] userObjFlags;
-               try {
-                       userObjFlags = userObjOption.getBasicStringListValue();
-                       for( String obj : userObjFlags ) {
-                               tmpList.add( obj );
-                       }
-               } catch (BuildException e) {
-               }
-
-               if( tmpList.contains(objPath) ){
-                       tmpList.remove( objPath );
-                       ManagedBuildManager.setOption( config, linkerTool, userObjOption, tmpList.toArray( new String[0] ));
-               }
-       }
-
-       
-       // append linker option to 
-       public static void appendIncludePathToCompiler(  IConfiguration config, String path )
-       {
-               String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
-               String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID_OLD;
-                       cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID_OLD;
-               }
-               
-               ITool cCompilerTool = config.getToolsBySuperClassId( c_compiler_id )[0];
-               IOption cIncludePathOption = cCompilerTool.getOptionBySuperClassId(GNU_C_INCLUDE_PATH_OPTION_ID);
-
-               ITool cppCompilerTool = config.getToolsBySuperClassId( cpp_compiler_id )[0];
-               IOption cppIncludePathOption = cppCompilerTool.getOptionBySuperClassId(GNU_CPP_INCLUDE_PATH_OPTION_ID);
-
-               ArrayList<String> cIncludePathList =new ArrayList<String>();
-               ArrayList<String> cppIncludePathList =new ArrayList<String>();
-               try {
-                       // c
-                       String[] flags = cIncludePathOption.getBasicStringListValue();
-                       for( String obj : flags ) {
-                               cIncludePathList.add( obj );
-                       }
-                       
-                       // cpp
-                       flags = cppIncludePathOption.getBasicStringListValue();
-                       for( String obj : flags ) {
-                               cppIncludePathList.add( obj );
-                       }
-                       
-               } catch (BuildException e) {
-               }
-
-               if( !cIncludePathList.contains( path )){
-                       cIncludePathList.add( path );
-                       ManagedBuildManager.setOption( config, cCompilerTool, cIncludePathOption, cIncludePathList.toArray( new String[0] ));
-               }
-               if( !cppIncludePathList.contains( path)){
-                       cppIncludePathList.add( path );
-                       ManagedBuildManager.setOption( config, cppCompilerTool, cppIncludePathOption, cppIncludePathList.toArray( new String[0] ));
-               }
-       }
-       
-       
-       // Include Path -I
-       public static ArrayList<String>  getIncludePathOptions( IConfiguration config ) {
-               
-               String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
-               String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID_OLD;
-                       cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID_OLD;
-                       //return CommonConfigurationOld.getIncludePathOptions(config );
-               }
-
-               ArrayList<String> result = new ArrayList<String>();
-
-               try {
-                       // c compiler
-                       ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
-                       IOption option = tool.getOptionBySuperClassId( GNU_C_INCLUDE_PATH_OPTION_ID );
-                       
-                       for( String path : option.getIncludePaths() ) {
-                               result.add( path );
-                       }
-       
-                       // cpp
-                       tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
-                       option = tool.getOptionBySuperClassId( GNU_CPP_INCLUDE_PATH_OPTION_ID );
-       
-                       for( String path : option.getIncludePaths() ) {
-                               if ( !result.contains( path ) )
-                                       result.add( path );
-                       }
-               } catch (BuildException e) {
-               }
-
-               return result;
-       }
-       
-       
-       public static void setIncludePathOptions( IConfiguration config , ArrayList<String> srcList ) {
-               
-               String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
-               String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID_OLD;
-                       cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID_OLD;            
-               }
-               
-               // c 
-               ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
-               IOption option = tool.getOptionBySuperClassId( GNU_C_INCLUDE_PATH_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-
-               // cpp 
-               tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
-               option = tool.getOptionBySuperClassId( GNU_CPP_INCLUDE_PATH_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-       }
-       
-       
-       // Library search path option -L
-       public static ArrayList<String>  getLibrarySearchPathOptions( IConfiguration config ) {
-               
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return CommonConfigurationOld.getLibrarySearchPathOptions(config );
-               }
-
-               ArrayList<String> result = new ArrayList<String>();
-
-               try{
-                       // c 
-                       ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-                       IOption option = tool.getOptionBySuperClassId( GNU_C_LINKPATH_OPTION_ID );
-                       
-                       for( String path : option.getBasicStringListValue() ) {
-                               result.add( path );
-                       }
-       
-                       // cpp
-                       tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-                       option = tool.getOptionBySuperClassId( GNU_CPP_LINKPATH_OPTION_ID );
-       
-                       for( String path : option.getBasicStringListValue() ) {
-                               if ( !result.contains( path ) )
-                                       result.add( path );
-                       }
-               } catch (BuildException e) {
-               }
-
-
-               return result;
-       }
-       
-       
-       public static void  setLibrarySearchPathOptions( IConfiguration config , ArrayList<String> srcList ) {
-               
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-               }
-               
-               // c 
-               ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-               IOption option = tool.getOptionBySuperClassId( GNU_C_LINKPATH_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-
-               // cpp 
-               tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-               option = tool.getOptionBySuperClassId( GNU_CPP_LINKPATH_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-       }
-       
-       
-       // Library link option -l
-       public static ArrayList<String>  getLibraryLinkOptions( IConfiguration config ) {
-               // TODO: should be removed
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return CommonConfigurationOld.getLibraryLinkOptions(config );
-               }       
-
-               ArrayList<String> result = new ArrayList<String>();
-
-               try {
-                       // c 
-                       ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-                       IOption option = tool.getOptionBySuperClassId( GNU_C_LIBRARIES_OPTION_ID );
-                       
-                       for( String path : option.getLibraries() ) {
-                               result.add( path );
-                       }
-       
-                       // cpp
-                       tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-                       option = tool.getOptionBySuperClassId( GNU_CPP_LIBRARIES_OPTION_ID );
-       
-                       for( String path : option.getLibraries() ) {
-                               if ( !result.contains( path ) )
-                                       result.add( path );
-                       }
-               } catch (BuildException e) {
-               }
-
-               return result;
-       }
-       
-       
-       public static void  setLibraryLinkOptions( IConfiguration config , ArrayList<String> srcList ) {
-               // TODO: should be removed
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-               }               
-               
-               // c 
-               ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-               IOption option = tool.getOptionBySuperClassId( GNU_C_LIBRARIES_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-
-               // cpp 
-               tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-               option = tool.getOptionBySuperClassId( GNU_CPP_LIBRARIES_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-       }
-       
-       // Object link option 
-       public static ArrayList<String>  getObjectLinkOptions( IConfiguration config ) {
-               // TODO: should be removed
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-                       
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return CommonConfigurationOld.getObjectLinkOptions(config );
-               }                               
-
-               ArrayList<String> result = new ArrayList<String>();
-
-               try {
-                       // c 
-                       ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-                       IOption option = tool.getOptionBySuperClassId( GNU_C_USEROBJS_OPTION_ID );
-                       
-                       for( String path : option.getBasicStringListValue() ) {
-                               result.add( path );
-                       }
-       
-                       // cpp
-                       tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-                       option = tool.getOptionBySuperClassId( GNU_CPP_USEROBJS_OPTION_ID );
-       
-                       for( String path : option.getBasicStringListValue() ) {
-                               if ( !result.contains( path ) )
-                                       result.add( path );
-                       }
-               } catch (BuildException e) {
-               }
-
-               return result;
-       }
-       
-       
-       public static void  setObjectLinkOptions( IConfiguration config , ArrayList<String> srcList ) {
-               
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-                       
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;             
-               }                               
-               
-               // c 
-               ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-               IOption option = tool.getOptionBySuperClassId( GNU_C_USEROBJS_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-
-               // cpp 
-               tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-               option = tool.getOptionBySuperClassId( GNU_CPP_USEROBJS_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-       }
-       
-       
-       // Library link option -XLinker
-       public static ArrayList<String> getOtherLinkOptions( IConfiguration config ) {
-               
-               // TODO: should be removed
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-                               
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;
-                       //return CommonConfigurationOld.getOtherLinkOptions(config );
-               }                               
-
-               ArrayList<String> result = new ArrayList<String>();
-
-               try {
-                       // c 
-                       ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-                       IOption option = tool.getOptionBySuperClassId( GNU_C_LINKOTHER_OPTION_ID );
-                       
-                       for( String path : option.getBasicStringListValue() ) {
-                               result.add( path );
-                       }
-       
-                       // cpp
-                       tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-                       option = tool.getOptionBySuperClassId( GNU_CPP_LINKOTHER_OPTION_ID );
-       
-                       for( String path : option.getBasicStringListValue() ) {
-                               if ( !result.contains( path ) )
-                                       result.add( path );
-                       }
-               } catch (BuildException e) {
-               }
-
-               return result;
-       }
-               
-       
-       public static void setOtherLinkOptions( IConfiguration config , ArrayList<String> srcList ) {
-               
-               String c_linker_id = SBI_C_LINKER_TOOL_ID;
-               String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
-                       
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       c_linker_id = SBI_C_LINKER_TOOL_ID_OLD;
-                       cpp_linker_id = SBI_CPP_LINKER_TOOL_ID_OLD;             
-               }                               
-               
-               // c 
-               ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
-               IOption option = tool.getOptionBySuperClassId( GNU_C_LINKOTHER_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-
-               // cpp 
-               tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
-               option = tool.getOptionBySuperClassId( GNU_CPP_LINKOTHER_OPTION_ID );
-               ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
-       }
-
-       
-       public static boolean isOldConfiguration( IConfiguration config ) {
-               
-               if ( config.getBuildArtefactType() == null ) {
-                       return false;
-               }
-               
-               if ( config.getBuildArtefactType().getId().equals("com.samsung.slp.nativeide.buildArtefactType.app") ||
-                               config.getBuildArtefactType().getId().equals("com.samsung.slp.nativeide.buildArtefactType.sharedLib") ||
-                               config.getBuildArtefactType().getId().equals("com.samsung.slp.nativeide.buildArtefactType.staticLib") ||
-                               config.getBuildArtefactType().getId().equals("com.samsung.slp.nativeide.buildArtefactType.cdeb") ) {
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-       
-       
-       public static void setProjectVersion( IProject project, String version ) {
-               try {
-                       ICProjectDescription desc = CoreModel.getDefault().getProjectDescription(project);
-                       
-                       if ( desc == null ) {
-                               return;
-                       }
-
-                       // create & set
-                       ICStorageElement storageElm = desc.getStorage( SLP_PROJECT_INFO_STORAGE_MODULE_ID, true );
-                       storageElm.setAttribute("version", version );
-                       CoreModel.getDefault().setProjectDescription(project, desc, true, new NullProgressMonitor() );
-                       
-                       // save
-                       ManagedBuildManager.saveBuildInfo( project, true );
-               } catch (CoreException e) {
-               }
-       }
-
-       
-       public static String getProjectVersion( IProject project ) {
-               
-               try {
-                       ICProjectDescription desc = CoreModel.getDefault().getProjectDescription(project);
-
-                       // create & set
-                       ICStorageElement storageElm = desc.getStorage( SLP_PROJECT_INFO_STORAGE_MODULE_ID, true );
-                       String version = storageElm.getAttribute("version") ;
-                       return version;
-               } catch (CoreException e) {
-               }
-               
-               return null;
-       }
-}
+    // Project Info
+    static final String SLP_PROJECT_INFO_STORAGE_MODULE_ID = "com.samsung.tizen.nativeapp.projectInfo";
+
+    public static  final String SBI_BASE_C_COMPILER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.c.compiler.base";
+    public static  final String SBI_BASE_CPP_COMPILER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.base";
+    public static  final String SBI_ASSEMBLER_TOOL_ID = "org.tizen.nativeapp.tool.sbi.gnu.assembler.base";    
+    public static  final String SBI_C_TARGET_OPTION_ID = "sbi.gnu.c.compiler.option";
+    public static  final String SBI_CPP_TARGET_OPTION_ID = "sbi.gnu.cpp.compiler.option";
+    public static  final String GNU_C_INCLUDE_PATH_OPTION_ID = "gnu.c.compiler.option.include.paths";
+    public static  final String GNU_CPP_INCLUDE_PATH_OPTION_ID = "gnu.cpp.compiler.option.include.paths";    
+    public static  final String GNU_C_DEF_SYMBOLS_OPTION_ID = "gnu.c.compiler.option.preprocessor.def.symbols";
+    public static  final String GNU_CPP_DEF_SYMBOLS_OPTION_ID = "gnu.cpp.compiler.option.preprocessor.def";
+    public static  final String GNU_C_OTHER_ID = "gnu.c.compiler.option.misc.other";
+    public static  final String GNU_CPP_OTHER_ID = "gnu.cpp.compiler.option.other.other";
+    public static  final String SBI_C_LINKER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.c.linker.base";
+    public static  final String SBI_CPP_LINKER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.cpp.linker.base";    
+
+    public static  final String GNU_C_LIBRARIES_OPTION_ID = "gnu.c.link.option.libs";
+    public static  final String GNU_CPP_LIBRARIES_OPTION_ID = "gnu.cpp.link.option.libs";
+    public static  final String GNU_C_USEROBJS_OPTION_ID = "gnu.c.link.option.userobjs";
+    public static  final String GNU_CPP_USEROBJS_OPTION_ID = "gnu.cpp.link.option.userobjs";
+    public static  final String GNU_C_LINKPATH_OPTION_ID = "gnu.c.link.option.paths";
+    public static  final String GNU_CPP_LINKPATH_OPTION_ID = "gnu.cpp.link.option.paths";
+    public static  final String GNU_C_LINKOTHER_OPTION_ID = "gnu.c.link.option.other";
+    public static  final String GNU_CPP_LINKOTHER_OPTION_ID = "gnu.cpp.link.option.other";
+    public static  final String GNU_C_LINK_OPTION_ID = "gnu.c.link.option.flags";
+    public static  final String GNU_CPP_LINK_OPTION_ID = "gnu.cpp.link.option.flags";
+
+    public static  final String SBI_DEVICE_CONFIG_SUFFIX = "Tizen-Device";
+    public static  final String SBI_EMULATOR_CONFIG_SUFFIX = "Tizen-Emulator";
+    public static  final String SBI_RELEASE_CONFIG_SUFFIX = "Release";
+    
+    public static void initializeBuildTargetName( IProject project, boolean save ) {
+        try {
+            IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
+            IConfiguration defaultConfig = info.getDefaultConfiguration();
+            SmartBuildInterface sbi = SmartBuildInterface.getInstance(project);
+            for( IConfiguration config: defaultConfig.getManagedProject().getConfigurations() ) {
+                String targetID = getDefaultBuildTargetName(config);
+                if (!sbi.checkTargetID(targetID)) {
+                    sbi.writeTargetCfgFile(targetID);
+                }
+                setBuildTargetName(config, targetID );
+                setToolCommand(config);        
+            }
+            
+            if(save) {
+                // Apply to project file
+                ManagedBuildManager.saveBuildInfo( project, true);
+            }
+            
+        } catch (SBIException e) {
+            e.showErrorDialog();
+        }            
+    }
+        
+    
+    public static void setBuildTargetName( IConfiguration config, String targetName ) {
+        
+        String c_compiler_tool_id = SBI_BASE_C_COMPILER_TOOL_ID;
+        String c_target_option_id = SBI_C_TARGET_OPTION_ID;
+        String cpp_compiler_tool_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+        String cpp_target_option_id = SBI_CPP_TARGET_OPTION_ID;
+
+        ArrayList<String> tmpList = new ArrayList<String>();
+        tmpList.add( targetName );
+
+        // c compiler
+        ITool compilerTool =config.getToolsBySuperClassId( c_compiler_tool_id )[0];
+        IOption targetOption = compilerTool.getOptionBySuperClassId( c_target_option_id );
+        ManagedBuildManager.setOption( config, compilerTool, targetOption, tmpList.toArray( new String[0] ));
+
+        // cpp compiler
+        compilerTool =config.getToolsBySuperClassId( cpp_compiler_tool_id )[0];
+        targetOption = compilerTool.getOptionBySuperClassId( cpp_target_option_id );
+        ManagedBuildManager.setOption( config, compilerTool, targetOption, tmpList.toArray( new String[0] ));
+    }
+    
+
+    // Get default target name for the configuration
+    public static String getDefaultBuildTargetName( IConfiguration config ) throws SBIException
+    {
+        SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+        String rootstrapName = "";
+        String toolchainName = "";
+        String arch;
+        ArrayList<String> toolchainList = sbi.getToolchainList();
+        ArrayList<String> rootstrapList = sbi.getRootstrapList();
+        ArrayList<String> availableToolchain = new ArrayList<String>();
+        ArrayList<String> availableRootstrap = new ArrayList<String>();
+        
+        // get architecture
+        if ( config.getName().contains(SBI_EMULATOR_CONFIG_SUFFIX)) {
+            arch = "i386";
+        } 
+        else if ( config.getName().contains(SBI_DEVICE_CONFIG_SUFFIX) ) {
+            arch = "armel";                
+        }
+        else {
+            arch = "armel";                
+        }
+        
+        
+        // get matching toolchain name
+        for (String toolchainID : toolchainList ) {
+            /*
+            // First , should be matched Tool-chain Name, Architecture
+            if (sbi.getToolchianNameFromToolchainID(toolchainID).equals(toolchainNameInConfiguration) &&                         
+                sbi.getArchitectureFromToolchainID(toolchainID).equals(arch) )
+            */
+            
+            // First , should be matched Architecture
+            if (sbi.getArchitectureFromToolchainID(toolchainID).equals(arch))
+            {                
+                // Project type must be matched, if specified
+                String projectType = sbi.getToolchainPropertyValue( toolchainID, "PROJECT_TYPE" );
+                IProjectType configProjectType = config.getProjectType() != null ? config.getProjectType() : config.getParent().getProjectType();
+                String selectedProjType = configProjectType.getBuildArtefactType().getId();
+                if (projectType != null && !projectType.equals(selectedProjType))
+                    continue;
+                
+                availableToolchain.add(toolchainID);
+            }
+        }
+        
+        // find default toolchain
+        Collections.sort(availableToolchain);
+        for (String toolchainID : availableToolchain) {
+            String setDefault = sbi.getToolchainPropertyValue(toolchainID, "DEFAULT");
+            if (setDefault != null && setDefault.equals("true")) {
+                toolchainName = toolchainID;
+            }
+        }
+        
+        // if default toolchain does not exist, toolchain is set as first available
+        if (toolchainName == "") {
+            toolchainName = availableToolchain.get(0);
+        }
+        
+        // get matching rootstrap name
+        for (String rootstrapID : rootstrapList ) {
+
+            // First , should be matched Tool-chain Type and Architecture
+            String toolchainType = sbi.getToolchainTypeFromToolchainID( toolchainName );
+            if ( sbi.doesRootstrapSupportToolchainType( rootstrapID, toolchainType ) && 
+                    sbi.getArchitectureFromRootstrapID(rootstrapID).equals(arch)) {
+
+                // Project type must be matched, if specified
+                String projectType = sbi.getRootstrapPropertyValue( rootstrapID, "PROJECT_TYPE" );
+                IProjectType configProjectType = config.getProjectType() != null ? config.getProjectType() : config.getParent().getProjectType();
+                String selectedProjType = configProjectType.getBuildArtefactType().getId();
+                if (projectType != null && !projectType.equals(selectedProjType))
+                    continue;
+
+                availableRootstrap.add(rootstrapID);
+            }
+        }
+        
+        // find default rootstrap
+        Collections.sort(availableRootstrap);
+        for (String rootstrapID : availableRootstrap) {
+            String setDefault = sbi.getRootstrapPropertyValue(rootstrapID, "DEFAULT");
+            if (setDefault != null && setDefault.equals("true")) {
+                rootstrapName = rootstrapID;
+            }
+        }
+        
+        // if default rootstrap does not exist, rootstrap is set as first available
+        if (rootstrapName == "") {
+            rootstrapName = availableRootstrap.get(0);
+        }
+
+        if (rootstrapName == "" ) {
+            throw new SBIException( String.format( "There is no avaiable rootstrap for configuration \"%s\"", config.getName() ) );                
+        }
+        else if ( toolchainName == "" ) {
+            throw new SBIException( String.format( "There is no avaiable toolchain for configuration \"%s\"", config.getName() ) );                
+        }
+        else {
+            return SmartBuildInterface.makeTargetID( rootstrapName, toolchainName );    
+        }
+    }
+    
+    public static String getBuildTargetName( IConfiguration config ) 
+    {
+        String compiler_tool_id = SBI_BASE_C_COMPILER_TOOL_ID;
+        String target_option_id = SBI_C_TARGET_OPTION_ID;
+        
+        ITool[] tools = config.getToolsBySuperClassId( compiler_tool_id );
+        if (tools.length == 0) {
+               return null;
+        }                      
+
+        ITool compilerTool = tools[0];
+        IOption targetOption = compilerTool.getOptionBySuperClassId( target_option_id );
+        String[] targetList;
+        
+        try {
+            targetList = targetOption.getUserObjects();
+
+        } catch (BuildException e) {
+            e.printStackTrace();
+            return null;
+        }
+
+        if ( targetList.length == 1 )
+            return targetList[0];
+        else
+            return  null;    
+    }
+    
+    public static void verifyTarget( IConfiguration config ) {
+        String target = getBuildTargetName(config);
+        if (target == null) {
+            return;
+        }
+        
+        SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+        String tc = sbi.getToolchainIDFromTargetID(target);
+        String rs = sbi.getRootstrapIDFromTargetID(target);
+        
+        try {
+            if (SBIModel.checkToolchainById(tc) && SBIModel.checkRootstrapById(rs)) {
+                if (!sbi.checkTargetID(target)) {
+                    sbi.writeTargetCfgFile(target);
+                }
+                return; 
+            }        
+        
+            String defaultTarget = getDefaultBuildTargetName(config);
+            if (!sbi.checkTargetID(defaultTarget)) {
+                sbi.writeTargetCfgFile(defaultTarget);
+            }
+            setBuildTargetName(config, defaultTarget );
+        } catch (SBIException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }                
+    }
+        
+    public static void setToolCommand(IConfiguration config) 
+    {
+        String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;        
+        String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+        String assembler_id = SBI_ASSEMBLER_TOOL_ID;
+
+        SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+        String target = getBuildTargetName(config);
+        
+        if (target == null) {
+            return;
+        }        
+        
+        try {
+            ITool compilerTool =config.getToolsBySuperClassId( c_compiler_id )[0];
+            ITool cxxcompilerTool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
+            ITool linkerTool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+            ITool assemblerTool =config.getToolsBySuperClassId( assembler_id )[0];        
+            
+            ManagedBuildManager.setToolCommand(config, compilerTool, 
+                    new Path(sbi.getCCompilerPath(target)).lastSegment());
+            ManagedBuildManager.setToolCommand(config, cxxcompilerTool, 
+                    new Path(sbi.getCXXCompilerPath(target)).lastSegment());
+            ManagedBuildManager.setToolCommand(config, linkerTool, 
+                    new Path(sbi.getCXXCompilerPath(target)).lastSegment());
+            ManagedBuildManager.setToolCommand(config, assemblerTool,
+                    new Path(sbi.getAssemblerPath(target)).lastSegment());
+        } catch (SBIException e) {
+            e.printStackTrace();
+            e.showErrorDialog();
+        }        
+    }
+
+    protected static boolean isCPPProject( IConfiguration config )
+    {
+        try {
+            IProject project = (IProject)config.getOwner();
+
+            if ( project.hasNature(  CCProjectNature.CC_NATURE_ID ) ) 
+                return true;
+        } catch (CoreException e1) {
+            e1.printStackTrace();
+        }
+
+        return false;
+    }
+    
+    
+    public static String getArchitecture( IConfiguration config ) 
+    {
+        SmartBuildInterface sbi = SmartBuildInterface.getInstance();                
+        String targetID = getBuildTargetName(config);
+
+        try {
+            return sbi.getRootstrapArchitecture( targetID );
+        } catch (SBIException e) {
+            e.printStackTrace();
+            e.showErrorDialog();
+            return "armel";
+        }
+    }
+    
+    
+    // append linker option to 
+    public static void appendLibraryToLinker(  IConfiguration config, String libraryName )
+    {
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+
+        String linkerId;
+        String linkerOption;
+        
+        if ( isCPPProject( config ) ) {
+            linkerId = cpp_linker_id ;
+            linkerOption = GNU_CPP_LIBRARIES_OPTION_ID;
+        }
+        else {
+            linkerId = c_linker_id ;
+            linkerOption = GNU_C_LIBRARIES_OPTION_ID;
+        }
+        
+        ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
+        IOption librariesOption = linkerTool.getOptionBySuperClassId(linkerOption);
+
+        ArrayList<String> tmpList =new ArrayList<String>();
+        String[] libraries;
+        try {
+            libraries = librariesOption.getLibraries();
+            for( String lib : libraries ) {
+                tmpList.add( lib );
+            }
+        } catch (BuildException e) {
+        }
+        if (!tmpList.contains(libraryName)) {
+               tmpList.add( libraryName );
+               ManagedBuildManager.setOption( config, linkerTool, librariesOption, tmpList.toArray( new String[0] ));
+        }
+        
+    }
+        
+    // append link other object option to 
+    public static void appendOtherObjectToLinker(  IConfiguration config, String objPath )
+    {
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+        String linkerId;
+        String objOption;
+        
+        if ( isCPPProject( config ) ) {
+            linkerId = cpp_linker_id ;
+            objOption = GNU_CPP_USEROBJS_OPTION_ID;
+        }
+        else {
+            linkerId = c_linker_id ;
+            objOption = GNU_C_USEROBJS_OPTION_ID;
+        }
+        
+        ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
+        IOption userObjOption = linkerTool.getOptionBySuperClassId(objOption);
+
+        ArrayList<String> tmpList =new ArrayList<String>();
+        String[] userObjFlags;
+        try {
+            userObjFlags = userObjOption.getBasicStringListValue();
+            for( String obj : userObjFlags ) {
+                tmpList.add( obj );
+            }
+        } catch (BuildException e) {
+        }
+
+        if( !tmpList.contains(objPath) ){
+            tmpList.add( objPath );
+            ManagedBuildManager.setOption( config, linkerTool, userObjOption, tmpList.toArray( new String[0] ));
+        }     
+    }
+    
+    
+    // append link path option to 
+    public static void appendLinkPathsToLinker(  IConfiguration config, String path )
+    {
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+        String linkerId;
+        String pathOption;
+        
+        if ( isCPPProject( config ) ) {
+            linkerId = cpp_linker_id ;
+            pathOption = GNU_CPP_LINKPATH_OPTION_ID;
+        }
+        else {
+            linkerId = c_linker_id ;
+            pathOption = GNU_C_LINKPATH_OPTION_ID;
+        }
+        
+        ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
+        IOption linkPathOption = linkerTool.getOptionBySuperClassId(pathOption);
+
+        ArrayList<String> tmpList =new ArrayList<String>();
+        String[] flags;
+        try {
+            flags = linkPathOption.getBasicStringListValue();
+            for( String obj : flags ) {
+                tmpList.add( obj );
+            }
+        } catch (BuildException e) {
+        }
+
+        if( !tmpList.contains(path) ){
+            tmpList.add( path );
+            ManagedBuildManager.setOption( config, linkerTool, linkPathOption, tmpList.toArray( new String[0] ));
+        }
+        
+    }
+    
+    
+    // append link path option to 
+    public static void appendLinkOtherFlagsToLinker(  IConfiguration config, String flag )
+    {
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+        String linkerId;
+        String flagOption;        
+        
+        if ( isCPPProject( config ) ) {
+            linkerId = cpp_linker_id ;
+            flagOption = GNU_CPP_LINKOTHER_OPTION_ID;
+        }
+        else {
+            linkerId = c_linker_id ;
+            flagOption = GNU_C_LINKOTHER_OPTION_ID;
+        }
+        
+        ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
+        IOption otherFlagOption = linkerTool.getOptionBySuperClassId(flagOption);
+
+        ArrayList<String> tmpList =new ArrayList<String>();
+        String[] flags;
+        try {
+            flags = otherFlagOption.getBasicStringListValue();
+            for( String obj : flags ) {
+                tmpList.add( obj );
+            }
+        } catch (BuildException e) {
+        }
+        
+        if( !tmpList.contains(flag) ){
+               tmpList.add( flag );
+               ManagedBuildManager.setOption( config, linkerTool, otherFlagOption, tmpList.toArray( new String[0] ));
+        }        
+    }
+    
+    // remove link other object option from linker 
+    public static void removeOtherObjectFromLinker(  IConfiguration config, String objPath )
+    {
+        String linkerId;
+        String objOption;
+        
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+    
+        if ( isCPPProject( config ) ) {
+            linkerId = cpp_linker_id ;
+            objOption = GNU_CPP_USEROBJS_OPTION_ID;
+        } else {
+            linkerId = c_linker_id ;
+            objOption = GNU_C_USEROBJS_OPTION_ID;
+        }
+        
+        ITool linkerTool = config.getToolsBySuperClassId( linkerId )[0];
+        IOption userObjOption = linkerTool.getOptionBySuperClassId(objOption);
+
+        ArrayList<String> tmpList =new ArrayList<String>();
+        String[] userObjFlags;
+        try {
+            userObjFlags = userObjOption.getBasicStringListValue();
+            for( String obj : userObjFlags ) {
+                tmpList.add( obj );
+            }
+        } catch (BuildException e) {
+        }
+
+        if( tmpList.contains(objPath) ){
+            tmpList.remove( objPath );
+            ManagedBuildManager.setOption( config, linkerTool, userObjOption, tmpList.toArray( new String[0] ));
+        }
+    }
+
+    
+    // append linker option to 
+    public static void appendIncludePathToCompiler(  IConfiguration config, String path )
+    {
+        String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
+        String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+        
+        ITool cCompilerTool = config.getToolsBySuperClassId( c_compiler_id )[0];
+        IOption cIncludePathOption = cCompilerTool.getOptionBySuperClassId(GNU_C_INCLUDE_PATH_OPTION_ID);
+
+        ITool cppCompilerTool = config.getToolsBySuperClassId( cpp_compiler_id )[0];
+        IOption cppIncludePathOption = cppCompilerTool.getOptionBySuperClassId(GNU_CPP_INCLUDE_PATH_OPTION_ID);
+
+        ArrayList<String> cIncludePathList =new ArrayList<String>();
+        ArrayList<String> cppIncludePathList =new ArrayList<String>();
+        try {
+            // c
+            String[] flags = cIncludePathOption.getBasicStringListValue();
+            for( String obj : flags ) {
+                cIncludePathList.add( obj );
+            }
+            
+            // cpp
+            flags = cppIncludePathOption.getBasicStringListValue();
+            for( String obj : flags ) {
+                cppIncludePathList.add( obj );
+            }
+            
+        } catch (BuildException e) {
+        }
+
+        if( !cIncludePathList.contains( path )){
+            cIncludePathList.add( path );
+            ManagedBuildManager.setOption( config, cCompilerTool, cIncludePathOption, cIncludePathList.toArray( new String[0] ));
+        }
+        if( !cppIncludePathList.contains( path)){
+            cppIncludePathList.add( path );
+            ManagedBuildManager.setOption( config, cppCompilerTool, cppIncludePathOption, cppIncludePathList.toArray( new String[0] ));
+        }
+    }
+    
+    
+    // Include Path -I
+    public static ArrayList<String>  getIncludePathOptions( IConfiguration config ) {
+        
+        String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
+        String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+
+        ArrayList<String> result = new ArrayList<String>();
+
+        try {
+            // c compiler
+            ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
+            IOption option = tool.getOptionBySuperClassId( GNU_C_INCLUDE_PATH_OPTION_ID );
+            
+            for( String path : option.getIncludePaths() ) {
+                result.add( path );
+            }
+    
+            // cpp
+            tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
+            option = tool.getOptionBySuperClassId( GNU_CPP_INCLUDE_PATH_OPTION_ID );
+    
+            for( String path : option.getIncludePaths() ) {
+                if ( !result.contains( path ) )
+                    result.add( path );
+            }
+        } catch (BuildException e) {
+        }
+
+        return result;
+    }
+    
+    public static void appendPreprocessorSymbolToCompiler(  IConfiguration config, String symbol )
+    {
+        String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
+        String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+        
+        ITool cCompilerTool = config.getToolsBySuperClassId( c_compiler_id )[0];
+        IOption cSymbolOption = cCompilerTool.getOptionBySuperClassId(GNU_C_DEF_SYMBOLS_OPTION_ID);
+
+        ITool cppCompilerTool = config.getToolsBySuperClassId( cpp_compiler_id )[0];
+        IOption cppSymbolOption = cppCompilerTool.getOptionBySuperClassId(GNU_CPP_DEF_SYMBOLS_OPTION_ID);
+
+        ArrayList<String> cSymbolList =new ArrayList<String>();
+        ArrayList<String> cppSymbolList =new ArrayList<String>();
+        try {
+            // c
+            String[] flags = cSymbolOption.getBasicStringListValue();
+            for( String obj : flags ) {
+               cSymbolList.add( obj );
+            }
+            
+            // cpp
+            flags = cppSymbolOption.getBasicStringListValue();
+            for( String obj : flags ) {
+               cppSymbolList.add( obj );
+            }
+            
+        } catch (BuildException e) {
+        }
+
+        if( !cSymbolList.contains( symbol )){
+               cSymbolList.add( symbol );
+            ManagedBuildManager.setOption( config, cCompilerTool, cSymbolOption, cSymbolList.toArray( new String[0] ));
+        }
+        if( !cppSymbolList.contains( symbol)){
+               cppSymbolList.add( symbol );
+            ManagedBuildManager.setOption( config, cppCompilerTool, cppSymbolOption, cppSymbolList.toArray( new String[0] ));
+        }
+    }
+    
+    
+    
+    public static void setIncludePathOptions( IConfiguration config , ArrayList<String> srcList ) {
+        
+        String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
+        String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+        
+        // c 
+        ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_INCLUDE_PATH_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+
+        // cpp 
+        tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
+        option = tool.getOptionBySuperClassId( GNU_CPP_INCLUDE_PATH_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+    }
+    
+    
+    // Library search path option -L
+    public static ArrayList<String>  getLibrarySearchPathOptions( IConfiguration config ) {
+        
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+
+        ArrayList<String> result = new ArrayList<String>();
+
+        try{
+            // c 
+            ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+            IOption option = tool.getOptionBySuperClassId( GNU_C_LINKPATH_OPTION_ID );
+            
+            for( String path : option.getBasicStringListValue() ) {
+                result.add( path );
+            }
+    
+            // cpp
+            tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+            option = tool.getOptionBySuperClassId( GNU_CPP_LINKPATH_OPTION_ID );
+    
+            for( String path : option.getBasicStringListValue() ) {
+                if ( !result.contains( path ) )
+                    result.add( path );
+            }
+        } catch (BuildException e) {
+        }
+
+
+        return result;
+    }
+    
+    
+    public static void  setLibrarySearchPathOptions( IConfiguration config , ArrayList<String> srcList ) {
+        
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+
+        // c 
+        ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_LINKPATH_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+
+        // cpp 
+        tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+        option = tool.getOptionBySuperClassId( GNU_CPP_LINKPATH_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+    }
+    
+    
+    // Library link option -l
+    public static ArrayList<String>  getLibraryLinkOptions( IConfiguration config ) {
+        // TODO: should be removed
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+
+        ArrayList<String> result = new ArrayList<String>();
+
+        try {
+            // c 
+            ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+            IOption option = tool.getOptionBySuperClassId( GNU_C_LIBRARIES_OPTION_ID );
+            
+            for( String path : option.getLibraries() ) {
+                result.add( path );
+            }
+    
+            // cpp
+            tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+            option = tool.getOptionBySuperClassId( GNU_CPP_LIBRARIES_OPTION_ID );
+    
+            for( String path : option.getLibraries() ) {
+                if ( !result.contains( path ) )
+                    result.add( path );
+            }
+        } catch (BuildException e) {
+        }
+
+        return result;
+    }
+    
+    
+    public static void  setLibraryLinkOptions( IConfiguration config , ArrayList<String> srcList ) {
+        // TODO: should be removed
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+        
+        // c 
+        ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_LIBRARIES_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+
+        // cpp 
+        tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+        option = tool.getOptionBySuperClassId( GNU_CPP_LIBRARIES_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+    }
+    
+    // Object link option 
+    public static ArrayList<String>  getObjectLinkOptions( IConfiguration config ) {
+        // TODO: should be removed
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+
+        ArrayList<String> result = new ArrayList<String>();
+
+        try {
+            // c 
+            ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+            IOption option = tool.getOptionBySuperClassId( GNU_C_USEROBJS_OPTION_ID );
+            
+            for( String path : option.getBasicStringListValue() ) {
+                result.add( path );
+            }
+    
+            // cpp
+            tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+            option = tool.getOptionBySuperClassId( GNU_CPP_USEROBJS_OPTION_ID );
+    
+            for( String path : option.getBasicStringListValue() ) {
+                if ( !result.contains( path ) )
+                    result.add( path );
+            }
+        } catch (BuildException e) {
+        }
+
+        return result;
+    }
+    
+    
+    public static void  setObjectLinkOptions( IConfiguration config , ArrayList<String> srcList ) {
+        
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+        
+        // c 
+        ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_USEROBJS_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+
+        // cpp 
+        tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+        option = tool.getOptionBySuperClassId( GNU_CPP_USEROBJS_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+    }
+    
+    
+    // Library link option -XLinker
+    public static ArrayList<String> getOtherLinkOptions( IConfiguration config ) {
+        
+        // TODO: should be removed
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+
+        ArrayList<String> result = new ArrayList<String>();
+
+        try {
+            // c 
+            ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+            IOption option = tool.getOptionBySuperClassId( GNU_C_LINKOTHER_OPTION_ID );
+            
+            for( String path : option.getBasicStringListValue() ) {
+                result.add( path );
+            }
+    
+            // cpp
+            tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+            option = tool.getOptionBySuperClassId( GNU_CPP_LINKOTHER_OPTION_ID );
+    
+            for( String path : option.getBasicStringListValue() ) {
+                if ( !result.contains( path ) )
+                    result.add( path );
+            }
+        } catch (BuildException e) {
+        }
+
+        return result;
+    }
+        
+    
+    public static void setOtherLinkOptions( IConfiguration config , ArrayList<String> srcList ) {
+        
+        String c_linker_id = SBI_C_LINKER_TOOL_ID;
+        String cpp_linker_id = SBI_CPP_LINKER_TOOL_ID;
+        
+        // c 
+        ITool tool =config.getToolsBySuperClassId( c_linker_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_LINKOTHER_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+
+        // cpp 
+        tool =config.getToolsBySuperClassId( cpp_linker_id )[0];
+        option = tool.getOptionBySuperClassId( GNU_CPP_LINKOTHER_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, srcList.toArray( new String[0] ));
+    }
+    
+    
+    public static void setCLinkerMiscOptions( IConfiguration config , String op ) {
+        
+        String c_compiler_id = SBI_C_LINKER_TOOL_ID;        
+
+        ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_LINK_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, op );
+    }
+    
+    public static void setCXXLinkerMiscOptions( IConfiguration config , String op ) {        
+        
+        String cpp_compiler_id = SBI_CPP_LINKER_TOOL_ID;        
+         
+        ITool tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_CPP_LINK_OPTION_ID );
+        ManagedBuildManager.setOption( config, tool, option, op);
+    }
+    
+    public static void setCCompilerOtherOptions( IConfiguration config , String op ) {
+        
+        String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;        
+
+        ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_OTHER_ID );
+        ManagedBuildManager.setOption( config, tool, option, op );
+    }
+    
+    public static void setCXXCompilerOtherOptions( IConfiguration config , String op ) {        
+        
+        String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;        
+         
+        ITool tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_CPP_OTHER_ID );
+        ManagedBuildManager.setOption( config, tool, option, op);
+    }
+    
+    public static String getCLinkerOptions( IConfiguration config ) {
+        
+        String c_compiler_id = SBI_C_LINKER_TOOL_ID;        
+        
+        ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_LINK_OPTION_ID );
+        String result = "";
+        try {
+            result = option.getStringValue();
+        } catch (BuildException e) {        
+            e.printStackTrace();
+        }
+        return result;
+    }
+    
+    public static String getCXXLinkerOptions( IConfiguration config ) {
+        
+        String cpp_compiler_id = SBI_CPP_LINKER_TOOL_ID;        
+         
+        ITool tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_CPP_LINK_OPTION_ID );
+        String result = "";
+        try {
+            result = option.getStringValue();
+        } catch (BuildException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+    
+    public static String getCComplierOtherOptions( IConfiguration config ) {
+        
+        String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;        
+        
+        ITool tool =config.getToolsBySuperClassId( c_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_C_OTHER_ID );
+        String result = "";
+        try {
+            result = option.getStringValue();
+        } catch (BuildException e) {        
+            e.printStackTrace();
+        }
+        return result;
+    }
+    
+    public static String getCXXComplierOtherOptions( IConfiguration config ) {
+        
+        String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;        
+         
+        ITool tool =config.getToolsBySuperClassId( cpp_compiler_id )[0];
+        IOption option = tool.getOptionBySuperClassId( GNU_CPP_OTHER_ID );
+        String result = "";
+        try {
+            result = option.getStringValue();
+        } catch (BuildException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+    
+    public static void setProjectVersion( IProject project, String version, boolean save ) {
+        try {
+            ICProjectDescription desc = CoreModel.getDefault().getProjectDescription(project);
+            
+            if ( desc == null ) {
+                return;
+            }
+
+            // create & set
+            ICStorageElement storageElm = desc.getStorage( SLP_PROJECT_INFO_STORAGE_MODULE_ID, true );
+            storageElm.setAttribute("version", version );
+            CoreModel.getDefault().setProjectDescription(project, desc, true, new NullProgressMonitor() );
+            
+            if(save) {
+                ManagedBuildManager.saveBuildInfo( project, true );
+            }
+        } catch (CoreException e) {
+        }
+    }
+
+    
+    public static String getProjectVersion( IProject project ) {
+        
+        try {
+            ICProjectDescription desc = CoreModel.getDefault().getProjectDescription(project);
+
+            // create & set
+            ICStorageElement storageElm = desc.getStorage( SLP_PROJECT_INFO_STORAGE_MODULE_ID, true );
+            String version = storageElm.getAttribute("version") ;
+            return version;
+        } catch (CoreException e) {
+        }
+        
+        return null;
+    }
+}
\ No newline at end of file
index dff5237..bd88783 100644 (file)
@@ -1,8 +1,8 @@
 package org.tizen.nativecommon.build;
 
 import java.io.File;
+import java.io.IOException;
 
-import org.eclipse.cdt.core.settings.model.ICResourceDescription;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedProject;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
@@ -11,7 +11,8 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
-import org.tizen.common.log.Logger;
+import org.tizen.common.util.FileUtil;
+import org.tizen.common.util.log.Logger;
 import org.tizen.nativecommon.PathUtil;
 import org.tizen.nativecommon.build.exception.SBIException;
 import org.tizen.nativecommon.build.model.SBIModel;
@@ -23,12 +24,12 @@ public abstract class CommonProjectDependentBuilder {
        private SmartBuildInterface sbi= null;
        
        public CommonProjectDependentBuilder() {
-               sbi = SmartBuildInterface.getInstance();
+               setSbi();
        }       
 
-       public CommonProjectDependentBuilder(IProject project) {
-               sbi = SmartBuildInterface.getInstance();
+       public CommonProjectDependentBuilder(IProject project) {                
                setProject(project);
+               setSbi(project);
        }       
        
        protected abstract String getConfigureOption(); 
@@ -42,8 +43,8 @@ public abstract class CommonProjectDependentBuilder {
        
        public abstract void setBuildTargetID(IConfiguration c, String targetId);
        
-       public abstract void setToolCommand(IConfiguration config, String rootstrapCfgName);
-       public abstract void changeToolchain(IConfiguration config, ICResourceDescription cfgd, String toolchainNameInCfg);
+       public abstract void setToolCommand(IConfiguration config);
+       public abstract void changeToolchain(IConfiguration config, String targetId);
 
        public void configure() throws SBIException {           
                String targetID = getTargetID();
@@ -97,10 +98,26 @@ public abstract class CommonProjectDependentBuilder {
                        //sbi is compiled using MinGW, and it cannot receive interrupt signal in Windows.
                        //Therefore, gdb cannot suspend a debugging process.
                        if ( System.getProperty("os.name").startsWith("Windows")) {
-                               String gdbPath = SBIModel.getTargetById(targetID).getToolchain().getTool("gdb").getPath();
+                               String gdbPath = SBIModel.getTargetById(targetID).getToolchain().getTool("debugger").getPath();
+                               String gdbInitPath = workingDir + "\\.gdbinit";
                                gdbPath = PathUtil.convertMinGWPath(gdbPath);
-                               arrOption[arrOption.length-1] = "--eval-command=\"set sysroot " + this.getDebugSysRootPath() + "\"";
-                               return sbi.execute(new Path(gdbPath), arrOption, sbi.getEnvironmentVariables(), new Path(workingDir), new NullProgressMonitor());
+                               
+                               File f = new File(gdbInitPath);
+                               String sysrootOp = "set sysroot " + PathUtil.convertMinGWPath(this.getDebugSysRootPath());
+                               try {
+                                   FileUtil.writeTextFile(f, sysrootOp, null);
+                               } catch (IOException e) {
+                                   e.printStackTrace();
+                               }
+                               
+                               String[] options = new String[arrOption.length + 1];
+                               int i=0;
+                               for(String option:arrOption) {
+                                       options[i] = option;
+                                       i++;
+                               }
+                               options[options.length - 1] = "--command=" + gdbInitPath;
+                               return sbi.execute(new Path(gdbPath), options, sbi.getEnvironmentVariables(), new Path(workingDir), new NullProgressMonitor());
                        } else {
                                String options = getDebugOption(arrOption);
                                return sbi.actionNB("debug", options, targetID, workingDir ); 
@@ -167,4 +184,12 @@ public abstract class CommonProjectDependentBuilder {
                IPath makeFilePath = new Path(path);
                return makeFilePath.toFile().isFile();          
        }
+       
+    public void setSbi() {
+       sbi = SmartBuildInterface.getInstance();
+    }
+    
+    public void setSbi(IProject project) {
+       sbi = SmartBuildInterface.getInstance(project);
+    }
 }
\ No newline at end of file
index ed818c7..fd80a22 100644 (file)
@@ -5,74 +5,85 @@ import java.io.File;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.tizen.nativecommon.build.exception.SBIException;
 
 
 public abstract class CommonProjectDependentPackager {
-       public static final String RPM = "RPM";
-       public static final String DEB = "DEB";
-       protected IProject project = null;
-       protected SmartBuildInterface sbi= null;
-       protected boolean isDialogCancel = false;
-
-       public CommonProjectDependentPackager() {
-               sbi = SmartBuildInterface.getInstance();
-       }
-
-       public CommonProjectDependentPackager(IProject project) {
-               sbi = SmartBuildInterface.getInstance();
-               setProject(project);
-       }
-
-       public abstract boolean isDependencyCheckSuppoted();
-       public abstract boolean isPackageCheckSuppoted();
-       public abstract boolean checkPackageFile(String pkgType);
-       public abstract String getPackageOption(String pkgType);
-       public abstract String getPackageOption(IConfiguration c, String pkgType);
-       protected abstract String getPackageDependencyCheckOption();
-       public abstract String getTargetID();
-       public abstract String getTargetID(IConfiguration c);
-       public abstract void buildPackageDependencyCheck() throws SBIException;
-       public abstract void buildPackage(String pkgType) throws SBIException;
-       public abstract void buildPackage(String configName, String pkgType) throws SBIException;
-
-
-       public void setProject(IProject project) {
-               this.project = project;
-       }
-
-       public IProject getProject() {
-               return this.project;
-       }
-
-       public SmartBuildInterface getSbi() {
-               return this.sbi;
-       }
-
-       public String getWorkingDir() {
-               IConfiguration config = getConfiguration();
-               String workingDir = getProjectPath() + File.separatorChar + config.getName();
-               return workingDir;
-       }
-
-       public String getWorkingDir(IConfiguration config) {
-               String workingDir = getProjectPath() + File.separatorChar + config.getName();
-               return workingDir;
-       }
-
-       public String getProjectPath() {
-               IPath proLoc = project.getLocation();
-               return proLoc.toOSString();
-       }
-
-       public IConfiguration getConfiguration() {
-               return ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
-       }
-
-       public boolean checkMakeFile(String path) {
-               IPath makeFilePath = new Path(path);
-               return makeFilePath.toFile().isFile();
-       }
+    public static final String TPK = "TPK";
+    public static final String RPM = "RPM";
+    public static final String DEB = "DEB";
+    public static final String DEFAULT = TPK;
+    protected IProject project = null;
+    protected SmartBuildInterface sbi= null;
+    protected boolean isDialogCancel = false;
+
+    public CommonProjectDependentPackager() {
+       setSbi();
+    }
+
+    public CommonProjectDependentPackager(IProject project) {        
+        setProject(project);
+        setSbi(project);
+    }
+
+    public abstract boolean isDependencyCheckSuppoted();
+    public abstract boolean isPackageCheckSuppoted();
+    public abstract boolean checkPackageFile(String pkgType);
+    public abstract String getPackageOption(IConfiguration c, String pkgType);
+    protected abstract String getPackageDependencyCheckOption();
+    public abstract String getTargetID(IConfiguration c);
+    public abstract void buildPackageDependencyCheck() throws SBIException;
+    public abstract void buildPackage(String pkgType) throws SBIException, CoreException;
+    public abstract void buildPackage(String configName, String pkgType) throws SBIException, CoreException;
+    public abstract void buildPackage(String configName, String pkgType, boolean signApp) throws SBIException, CoreException;
+    public abstract void buildPackage(String pkgType, boolean signApp) throws SBIException, CoreException;
+
+
+    public void setProject(IProject project) {
+        this.project = project;       
+    }
+    
+    public void setSbi() {
+       sbi = SmartBuildInterface.getInstance();
+    }
+    
+    public void setSbi(IProject project) {
+       sbi = SmartBuildInterface.getInstance(project);
+    }
+
+    public IProject getProject() {
+        return this.project;
+    }
+
+    public SmartBuildInterface getSbi() {
+        return this.sbi;
+    }
+
+    public String getWorkingDir() {
+        IConfiguration config = getCurrentConfiguration();
+        String workingDir = getProjectPath() + File.separatorChar + config.getName();
+        return workingDir;
+    }
+
+    public String getWorkingDir(IConfiguration config) {
+        String workingDir = getProjectPath() + File.separatorChar + config.getName();
+        return workingDir;
+    }
+
+    public String getProjectPath() {
+        IPath proLoc = project.getLocation();
+        return proLoc.toOSString();
+    }
+
+    public IConfiguration getCurrentConfiguration() {
+        return ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+    }
+
+    public boolean checkMakeFile(String path) {
+        IPath makeFilePath = new Path(path);
+        return makeFilePath.toFile().isFile();
+    }
 }
index 8c17952..38552d4 100644 (file)
@@ -47,7 +47,7 @@ public class GCCSpecsRunSIProvider extends
                                                
                                                // if configuration is not initialized, use default name
                                                if ( targetID == null ) {
-                                                       targetID =CommonConfigurationManager.getDefaultBuildTargetName(config);
+                                                       targetID = CommonConfigurationManager.getDefaultBuildTargetName(config);
                                                }
                                                
                                                // check target exist?
index 1266d37..e65adef 100644 (file)
@@ -95,7 +95,8 @@ public class ProjectTypeManager {
                        return null;
                }
                
-               b.setProject( project );                
+               b.setProject( project );
+               b.setSbi(project);
                return b;
        }
        
index 10260a6..6cc04bc 100644 (file)
@@ -36,7 +36,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -65,14 +65,11 @@ import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.ui.console.MessageConsoleStream;
-
-import org.tizen.common.console.ConsoleManager;
-import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.ui.view.console.ConsoleManager;
+import org.tizen.common.core.application.InstallPathConfig;
 import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativecommon.build.model.Rootstrap;
 import org.tizen.nativecommon.build.model.SBIModel;
 import org.tizen.nativecommon.build.model.Target;
-import org.tizen.nativecommon.build.model.Tool;
 import org.tizen.nativecommon.build.obs.UserInformation;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -83,30 +80,34 @@ import org.xml.sax.SAXException;
 
 public class SmartBuildInterface extends CommandLauncher  {
 
-       private static final SmartBuildInterface instance;
        private static final String SBICommandPath;
        private static final String BaseToolchainPath;
        private static final String BaseRootstrapPath;
-       private static final String BasePluginPath;
-       private static final String TempPluginPath;
+       private static final String TempPluginPath;     
        private static final String[] envp;
-       private static String PluginDir = "plugins";
-       private static String ToolchainsDir = "toolchains";
-       private static String RootstrapDir = "rootstraps";
-       private static String binDir = "bin";
-       private static String BuildSystemPath = "SDK" +  File.separatorChar + "build-system";
-       private static String SBIPath = InstallPathConfig.getSDKPath() + File.separatorChar + BuildSystemPath;
-       private static Process shellProcess;
+       private static final String PluginDir = "plugins";
+       private static final String RootstrapDir = "rootstraps";
+       private static final String platformVer = "tizen2.0";
+       private static final String platformDir = InstallPathConfig.getSDKPath() + File.separatorChar + "platforms";
+       private static final String binDir = "bin";
+       private static final String dibsDir = "dibs";
+       private static final String toolsDir = InstallPathConfig.getSDKPath() + File.separatorChar + "tools";
+       private static final String BuildSystemPath = "SDK" +  File.separatorChar + "build-system";             
+       private static final String SBIPath = toolsDir + File.separatorChar + "smart-build-interface";
+       private static final String DevToolsPath;
+       private static String MsysBinPath = "";
+       private static String MingwBinPath = "";
+       private Process shellProcess;
        private static Document pluginXml;
        private static final String PKG_OPTION = "-PKG_TYPE=";
 
        static {
-               instance = new SmartBuildInterface();
                SBICommandPath = new Path( SBIPath ).toOSString() + File.separatorChar + binDir;
-               BaseToolchainPath = new Path( SBIPath ).toOSString() + File.separatorChar + ToolchainsDir;
-               BaseRootstrapPath = new Path( SBIPath ).toOSString() + File.separatorChar + RootstrapDir;
-               BasePluginPath = new Path( SBIPath ).toOSString() + File.separatorChar  + PluginDir;
+               BaseToolchainPath = new Path( toolsDir ).toOSString();
+               BaseRootstrapPath = new Path( platformDir ).toOSString() + File.separatorChar + platformVer + 
+                               File.separatorChar + RootstrapDir;
                TempPluginPath = new Path( SBIPath ).toOSString() + File.separatorChar + "temp" + PluginDir;
+               DevToolsPath = new Path( toolsDir ).toOSString() + File.separatorChar + dibsDir;
 
 
                // Change environment variable
@@ -114,15 +115,20 @@ public class SmartBuildInterface extends CommandLauncher  {
                        // Added MinGW Path and make path STring
                        String pathVar = System.getenv("PATH");
                        String InstallPath = InstallPathConfig.getSDKPath();
-                       String mingwBinPath = InstallPath + File.separatorChar +
-                                       "MinGW" + File.separatorChar +
+
+                       MingwBinPath = InstallPath + File.separatorChar +
+                                       "tools" + File.separatorChar +
+                                       "mingw" + File.separatorChar +
                                        "bin";
-                       String msysBinPath = InstallPath + File.separatorChar +
-                                       "MinGW" + File.separatorChar +
+
+                       MsysBinPath = InstallPath + File.separatorChar + 
+                                       "tools" + File.separatorChar +
+                                       "mingw" + File.separatorChar +
                                        "msys"  + File.separatorChar +
                                        "1.0" + File.separatorChar +
                                        "bin";
-                       pathVar = mingwBinPath + ";" + msysBinPath + ";" + pathVar;
+
+                       pathVar = MingwBinPath + ";" + MsysBinPath + ";" + pathVar;
 
                        // Make Env Variable Array to pass
                        Map<String, String> envMap = System.getenv();
@@ -141,7 +147,21 @@ public class SmartBuildInterface extends CommandLauncher  {
        }
 
        public static final SmartBuildInterface getInstance() {
-               return instance;
+               return new SmartBuildInterface();
+       }
+
+       public static String getMingwBinPath(){
+           return MingwBinPath;
+       }
+
+       public static SmartBuildInterface getInstance(IProject project) {
+               if (project != null) {
+                       SmartBuildInterface newsbi = new SmartBuildInterface();
+                       newsbi.setProject(project);
+                       return newsbi;
+               } else {
+                       return getInstance();
+               }
        }
 
        private SmartBuildInterface( ) {
@@ -222,9 +242,9 @@ public class SmartBuildInterface extends CommandLauncher  {
                        return super.execute(new Path(cmds[0]), args, envp, workingPath, new NullProgressMonitor() );
                } catch (CoreException e) {
                        e.printStackTrace();
-               }
+               }               
 
-               return null;
+               return null;            
        }
 
 
@@ -256,8 +276,8 @@ public class SmartBuildInterface extends CommandLauncher  {
 
                // create console
                ConsoleManager cm = new ConsoleManager( consoleName, true);
-               MessageConsoleStream stdoutStream = cm.getMessageConsoleStream(false);
-               MessageConsoleStream stderrStream = cm.getMessageConsoleStream(true);
+               MessageConsoleStream stdoutStream = cm.getMessageConsoleStream();
+               MessageConsoleStream stderrStream = cm.getMessageConsoleStream();
 
                // Init log of console
                cm.clear();
@@ -335,29 +355,21 @@ public class SmartBuildInterface extends CommandLauncher  {
                }
 
                try {
-                       //Process shellProcess;
-
                        IPath workingPath = null;
                        if ( workingDir != null )
                                workingPath = new Path(workingDir);
 
-                       shellProcess = super.execute(new Path(cmds[0]), args, this.getEnvironmentVariables(), workingPath, new NullProgressMonitor() );
+                       if (this.getProject() != null) {
+                               shellProcess = super.execute(new Path(cmds[0]), args, getEnvironmentVariables(), workingPath, new NullProgressMonitor() );
+                       } else {
+                               shellProcess = super.execute(new Path(cmds[0]), args, envp, workingPath, new NullProgressMonitor() );
+                       }
 
                        if ( shellProcess == null ) {
                                // fork failed
                                throw new SBIException( String.format("SBI process fork failed!\nCommand:%s\n", cmd));
                        }
 
-                       if( cmd.contains("buildpackage") && cmd.contains(PKG_OPTION + CommonProjectDependentPackager.RPM)){
-                               OutputStream os = shellProcess.getOutputStream();
-                               PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os)));
-                               String password = UserInformation.getRootPassword();
-                               if( password != null){
-                                       pw.println(password);
-                               }
-                               pw.close();
-                       }
-
                        if (consoleStdoutStream != null && consoleStderrStream != null   )  {
                                illegalCommand = this.waitAndRead(consoleStdoutStream, consoleStderrStream );
                                if (illegalCommand != 0) {
@@ -393,34 +405,11 @@ public class SmartBuildInterface extends CommandLauncher  {
                        throw new SBIException(String.format( "Java Exception: %s\nCommand:%s\nMethod:CommandLauncher.execute()", cmd) );
                }
        }
-
-       public boolean terminate() throws SBIException {
-               if(shellProcess != null){
-                       shellProcess.destroy();
-                       BufferedWriter bw;
-                       bw = new BufferedWriter(new OutputStreamWriter(shellProcess.getOutputStream()));
-                       char c = 0x03; //standard code representing "Ctrl-C" sequence
-                       try {
-                               bw.write(c);
-                               bw.newLine();
-                               bw.flush();
-                       } catch (IOException e) {
-                               System.out.println(e.toString());
-                       } finally {
-                               if(bw != null )
-                                       try {
-                                               bw.close();
-                                       } catch (IOException e) {
-                                               e.printStackTrace();
-                                       }
-                       }
-                       commandNB("pkill sb2-exitreport");
-                       return true;
-               }
-               return false;
+       
+       public Process getProcess() {
+               return shellProcess;
        }
 
-
        public void create( String targetID, String rootstrapID, String toolchainID ) throws SBIException       {
                command( String.format("%s create -root %s -tool %s %s",
                                getSBICommandPath("sbi"),
@@ -498,6 +487,14 @@ public class SmartBuildInterface extends CommandLauncher  {
 
                return exitValue;
        }
+       
+       public String queryStdOut( String actionName, String targetID, String workingDir) throws SBIException {
+               
+               SBIStatus status = command(
+                               String.format( "%s query %s %s", getSBICommandPath("sbi"), targetID, actionName ), workingDir );
+
+               return status.getStdout();
+       }
 
        // Action with non-blocking
        public Process actionNB( String actionName, String options, String targetID, String workingDir )  {
@@ -556,9 +553,13 @@ public class SmartBuildInterface extends CommandLauncher  {
        }
 
        public String getRootstrapPath( String targetID ) throws SBIException {
-
-               return SBIModel.getTargetById(targetID).getRootstrap().getPath();
-
+               
+               Target t = SBIModel.getTargetById(targetID);
+               if (t == null) {
+                       return null;
+               } else {
+                       return t.getRootstrap().getPath();
+               }
        }
 
        public String getRootstrapVersion( String targetID ) throws SBIException {
@@ -575,24 +576,22 @@ public class SmartBuildInterface extends CommandLauncher  {
 
        public String getRootstrapVersionFromRootstrapID( String rootstrapID ) throws SBIException {
 
-               Rootstrap rootstrap = SBIModel.getRootstrapById(rootstrapID);
-               if ( rootstrap == null ) throw new SBIException( String.format("Current build-system does not support the rootstrap \"%s\"", rootstrapID ) );
+               return SBIModel.getRootstrapById(rootstrapID).getVersion();
+       }
+
+       public String getRootstrapArchitectureFromRootstrapID( String rootstrapID ) throws SBIException {
 
-               return rootstrap.getVersion();
+               return SBIModel.getRootstrapById(rootstrapID).getArch();
        }
 
        public String getRootstrapNameFromRootstrapID(String rootstrapID) throws SBIException {
 
-               Rootstrap rootstrap = SBIModel.getRootstrapById(rootstrapID);
-               if ( rootstrap == null ) throw new SBIException( String.format("Current build-system does not support the rootstrap \"%s\"", rootstrapID ) );
-               return rootstrap.getName();
+               return SBIModel.getRootstrapById(rootstrapID).getName();
        }
 
        public String getRootstrapPathFromRootstrapID( String rootstrapID ) throws SBIException {
 
-               Rootstrap rootstrap = SBIModel.getRootstrapById(rootstrapID);
-               if ( rootstrap == null ) throw new SBIException( String.format("Current build-system does not support the rootstrap \"%s\"", rootstrapID ) );
-               return rootstrap.getPath();
+               return SBIModel.getRootstrapById(rootstrapID).getPath();
        }
 
        public String getToolchianNameFromToolchainID(String toolchainID) throws SBIException {
@@ -614,85 +613,33 @@ public class SmartBuildInterface extends CommandLauncher  {
                return status.getStdout();
        }
 
-       public ArrayList<String> getToolInfosByPatternUsingToolchain(String toolchainID, String regexp) throws SBIException {
-               if ( toolchainID == null )
+       public String getToolPath( String targetID, String toolName ) throws SBIException {
+               Target t = SBIModel.getTargetById(targetID);
+               if (t == null) {
                        return null;
-
-               Pattern p;
-               Matcher m;
-               ArrayList<String> toolInfos = new ArrayList<String>();
-
-               SBIStatus status = command( String.format("%s show tool %s",
-                               getSBICommandPath("sbi"), toolchainID ) );
-               String[] results = splitConfigLineByLine( status.getStdout() );
-
-               p = Pattern.compile(regexp);
-
-               for (String str: results) {
-                       m = p.matcher(str);
-                       if (m.matches()) {
-                               toolInfos.add(str);
-                       }
-               }
-               return toolInfos;
-       }
-
-       public String getAToolInfoByPatternUsingToolchain(String toolchainID, String regexp) throws SBIException {
-               if ( toolchainID == null )
-                       return "";
-
-               Pattern p;
-               Matcher m;
-
-               SBIStatus status = command( String.format("%s show tool %s",
-                               getSBICommandPath("sbi"), toolchainID ) );
-               String[] results = splitConfigLineByLine( status.getStdout());
-
-               p = Pattern.compile(regexp);
-
-               for (String str: results) {
-                       m = p.matcher(str);
-                       if (m.matches()) {
-                               return str;
-                       }
+               } else {
+                       return t.getToolchain().getTool(toolName).getPath();
                }
-               return "";
-       }
-
-       public String getToolPath( String targetID, String toolName ) throws SBIException {
-
-               
-               // check valid target name
-               Target target = SBIModel.getTargetById(targetID);
-               if ( target == null )   return toolName;
-               
-               // check valid tool name 
-               Tool tool =  target.getToolchain().getTool(toolName);
-               if ( tool == null ) return toolName;
-               
-               return tool.getPath();
        }
 
 
        public String getCCompilerPath( String targetID ) throws SBIException {
-               return getToolPath(targetID, "gcc");
+               return getToolPath(targetID, "c_compiler");
        }
 
 
        public String getCXXCompilerPath( String targetID ) throws SBIException {
-               return getToolPath(targetID, "g++");
+               return getToolPath(targetID, "c++_compiler");
+       }
+       
+       public String getAssemblerPath( String targetID ) throws SBIException {
+               return getToolPath(targetID, "assembler");
        }
 
        public String getSBICommandPath( String cmd ) {
                return SBICommandPath + File.separatorChar + cmd;
        }
 
-       /*
-       public String getBaseTargetPath() {
-               return BaseTargetPath;
-       }
-       */
-
        public String getBaseToolchainPath() {
                return BaseToolchainPath;
        }
@@ -700,6 +647,18 @@ public class SmartBuildInterface extends CommandLauncher  {
        public String getBaseRootstrapPath() {
                return BaseRootstrapPath;
        }
+       
+       public String getMsysBinPath() {
+               return MsysBinPath;
+       }
+       
+       public String getDevToolsPath() {
+               return DevToolsPath;
+       }
+       
+       public String getSdkToolsPath() {
+               return toolsDir;
+       }
 
        public String getConfigValue( String source, String key ) {
 
@@ -755,9 +714,7 @@ public class SmartBuildInterface extends CommandLauncher  {
 
        public String getArchitectureFromRootstrapID(String rootstrapID) throws SBIException {
 
-               Rootstrap rootstrap = SBIModel.getRootstrapById(rootstrapID);
-               if ( rootstrap == null ) throw new SBIException( String.format("Current build-system does not support the rootstrap \"%s\"", rootstrapID ) );
-               return rootstrap.getArch();
+               return SBIModel.getRootstrapById(rootstrapID).getArch();
        }
 
        public String getArchitectureFromToolchainID(String toolchainID) throws SBIException {
@@ -814,8 +771,16 @@ public class SmartBuildInterface extends CommandLauncher  {
                for ( String toolchainID : toolchainCfgList) {
 
                        String projectType = getToolchainPropertyValue( toolchainID, "PROJECT_TYPE" );
-                       if ( getToolchianNameFromToolchainID(toolchainID).equals(toolchainName) &&
-                                       ( projectType == null ||  artifactType == null  || projectType.equals(artifactType)  ) ) {
+                       /*
+                       if (getToolchianNameFromToolchainID(toolchainID).equals(toolchainName) &&
+                                       (projectType == null ||  artifactType == null  || projectType.equals(artifactType))) 
+                       {
+                               return true;
+                       }
+                       */
+                       
+                       if (projectType == null ||  artifactType == null  || projectType.equals(artifactType)) 
+                       {
                                return true;
                        }
                }
@@ -841,7 +806,6 @@ public class SmartBuildInterface extends CommandLauncher  {
                return false;
        }
 
-
        public static String makeTargetID (String rootstrapID, String toolchainID ) {
                return rootstrapID + "_" + toolchainID;
        }
@@ -864,7 +828,7 @@ public class SmartBuildInterface extends CommandLauncher  {
        }
 
 
-       public static String[] splitConfigLineByLine( String src ) {
+       public String[] splitConfigLineByLine( String src ) {
 
                // For windows
                String str1 = src.replace("\r\n","\n");
@@ -910,7 +874,11 @@ public class SmartBuildInterface extends CommandLauncher  {
        }
 
 
-       public static String getWindowsPathFromMinGWPath( String srcPath ) {
+       public String getWindowsPathFromMinGWPath( String srcPath ) {
+               
+               if (srcPath == "") {
+                       return srcPath;
+               }
 
                if (srcPath.charAt(0) == '/' && srcPath.charAt(2) == '/') {
                        char drive = srcPath.charAt(1);
@@ -1034,3 +1002,4 @@ public class SmartBuildInterface extends CommandLauncher  {
                return delDir.delete();
        }
 }
+
index ed9224c..edd3146 100644 (file)
@@ -31,6 +31,8 @@ package org.tizen.nativecommon.build.model;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.tizen.nativecommon.build.SBIStatus;
 import org.tizen.nativecommon.build.SmartBuildInterface;
@@ -67,26 +69,37 @@ public class SBIModel {
        
        public static ArrayList<Target> getTargetList() {
                return targetList;
-       }       
+       }
        
-       public static void addTarget(Target target) {           
+       private static void _addTarget(Target target) {         
                targetList.add(target);
        }
        
        public static void addTarget(String targetId, String targetName, 
                String rootstrapId, String toolchainId) throws SBIException {
                
-               Rootstrap rootstrap = getRootstrapById(rootstrapId);
-               Toolchain toolchain = getToolchainById(toolchainId);                    
+               if (!initialized) {
+                       initialize();
+               }       
+               
+               Rootstrap rootstrap = _getRootstrapById(rootstrapId);
+               Toolchain toolchain = _getToolchainById(toolchainId);                   
                Target target = createTargetModel(targetId, targetName, rootstrap, toolchain);
-               addTarget(target);
+               _addTarget(target);
        }       
        
-       public static void removeTarget(Target target) {                
+       private static void removeTarget(Target target) {               
                targetList.remove(target);
        }
        
        public static Target getTargetById(String id) {         
+               if (!initialized) {
+                       initialize();
+               }       
+               return _getTargetById(id);
+       }
+       
+       private static Target _getTargetById(String id) {               
                for (Target t : targetList) {
                        if (t.getId().equals(id)) {
                                return t;
@@ -95,8 +108,14 @@ public class SBIModel {
                return null;
        }
        
-       public static Target getTargetByName(String name) {
-               
+       public static Target getTargetByName(String name) {             
+               if (!initialized) {
+                       initialize();
+               }               
+               return _getTargetByName(name);
+       }
+       
+       public static Target _getTargetByName(String name) {            
                for (Target t : targetList) {
                        if (t.getName().equals(name)) {
                                return t;
@@ -106,6 +125,13 @@ public class SBIModel {
        }
        
        public static Rootstrap getRootstrapById(String id) {
+               if (!initialized) {
+                       initialize();
+               }       
+               return _getRootstrapById(id);
+       }
+       
+       public static Rootstrap _getRootstrapById(String id) {
                for (Rootstrap r : rootstrapList) {
                        if (r.getId().equals(id)) {
                                return r;
@@ -114,7 +140,23 @@ public class SBIModel {
                return null;
        }
        
+       public static boolean checkRootstrapById(String id) {
+               for (Rootstrap r : rootstrapList) {
+                       if (r.getId().equals(id)) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+       
        public static Toolchain getToolchainById(String id) {
+               if (!initialized) {
+                       initialize();
+               }
+               return _getToolchainById(id);
+       }
+       
+       private static Toolchain _getToolchainById(String id) {
                for (Toolchain t : toolchainList) {
                        if (t.getId().equals(id)) {
                                return t;
@@ -123,7 +165,30 @@ public class SBIModel {
                return null;
        }
        
+       public static boolean checkToolchainById(String id) {
+               if (!initialized) {
+                       initialize();
+               }
+               return _checkToolchainById(id);
+       }
+       
+       public static boolean _checkToolchainById(String id) {
+               for (Toolchain t : toolchainList) {
+                       if (t.getId().equals(id)) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+       
        public static ArrayList<String> getTargetIdList() throws SBIException {
+               if (!initialized) {
+                       initialize();
+               }
+               return _getTargetIdList();
+       }
+       
+       public static ArrayList<String> _getTargetIdList() throws SBIException {
                ArrayList<String> list = new ArrayList<String>();
                
                if (initialized) {
@@ -134,7 +199,7 @@ public class SBIModel {
                        SBIStatus status = sbi.command( String.format( "%s list target" , sbi.getSBICommandPath("sbi")));
                        
                        if (status.getStdout() != null && !status.getStdout().isEmpty()) {
-                               for( String line : SmartBuildInterface.splitConfigLineByLine( status.getStdout()) ){
+                               for( String line : sbi.splitConfigLineByLine( status.getStdout()) ){
                                        // TODO need to support default target  
                                        //if ( line.split(" ").length < 2 )
                                        //      break;
@@ -147,6 +212,13 @@ public class SBIModel {
        }
        
        public static ArrayList<String> getRootstrapIdList() throws SBIException {
+               if (!initialized) {
+                       initialize();
+               }
+               return _getRootstrapIdList();
+       }
+       
+       public static ArrayList<String> _getRootstrapIdList() throws SBIException {
                ArrayList<String> list = new ArrayList<String>();
                
                if (initialized) {
@@ -157,7 +229,7 @@ public class SBIModel {
                        SBIStatus status = sbi.command( String.format( "%s list root" , sbi.getSBICommandPath("sbi")));
                        
                        if (status.getStdout() != null && !status.getStdout().isEmpty()) {
-                               for( String line : SmartBuildInterface.splitConfigLineByLine( status.getStdout() ) ){
+                               for( String line : sbi.splitConfigLineByLine( status.getStdout() ) ){
                                        list.add( line.split(" ")[0] );
                                }
                        }
@@ -165,17 +237,24 @@ public class SBIModel {
                return list;
        }
        
-       public static ArrayList<String> getToolchainIdList() throws SBIException {
+       public static ArrayList<String> getToolchainIdList() throws SBIException {              
+               if (!initialized) {
+                       initialize();
+               }
+               return _getToolchainIdList();
+       }
+       
+       public static ArrayList<String> _getToolchainIdList() throws SBIException {             
                ArrayList<String> list = new ArrayList<String>();
                
                if (initialized) {
                        for (Toolchain t : toolchainList) {
                                list.add(t.getId());
-                       }
+                       }                       
                } else {                
                        SBIStatus status =sbi.command( String.format( "%s list tool" , sbi.getSBICommandPath("sbi")));                  
                        if (status.getStdout() != null && !status.getStdout().isEmpty()) {
-                               for( String line : SmartBuildInterface.splitConfigLineByLine( status.getStdout() ) ){
+                               for( String line : sbi.splitConfigLineByLine( status.getStdout() ) ){
                                        list.add( line.split(" ")[0] );
                                }
                        }
@@ -183,29 +262,33 @@ public class SBIModel {
                return list;
        }
        
-       public static void initialize() throws SBIException {
-               ArrayList<String> rootstrapIdList = getRootstrapIdList();
-               ArrayList<String> toolchainIdList = getToolchainIdList();
-               ArrayList<String> targetIdList = getTargetIdList();
-               
-               for (String rootstrapId : rootstrapIdList) {
-                       Rootstrap r = createRootstrapModel(rootstrapId);
-                       rootstrapList.add(r);
-               }
-               
-               for (String toolchainId : toolchainIdList) {
-                       Toolchain t = createToolchainModel(toolchainId);
-                       toolchainList.add(t);
-               }               
-               
-               for (String targetId : targetIdList) {                  
-                       String targetName = targetId; // name == id ?
-                       String rootstrapId = sbi.getRootstrapIDFromTargetID(targetId);
-                       String toolchainId = sbi.getToolchainIDFromTargetID(targetId);
-                       Rootstrap rootstrap = getRootstrapById(rootstrapId);
-                       Toolchain toolchain = getToolchainById(toolchainId);
-                       Target target = createTargetModel(targetId, targetName, rootstrap, toolchain);
-                       addTarget(target);
+       public static synchronized void initialize() {
+               try {
+                       ArrayList<String> rootstrapIdList = _getRootstrapIdList();              
+                       ArrayList<String> toolchainIdList = _getToolchainIdList();
+                       ArrayList<String> targetIdList = _getTargetIdList();
+                       
+                       for (String rootstrapId : rootstrapIdList) {
+                               Rootstrap r = createRootstrapModel(rootstrapId);
+                               rootstrapList.add(r);
+                       }
+                       
+                       for (String toolchainId : toolchainIdList) {
+                               Toolchain t = createToolchainModel(toolchainId);
+                               toolchainList.add(t);
+                       }               
+                       
+                       for (String targetId : targetIdList) {                  
+                               String targetName = targetId; // name == id ?
+                               String rootstrapId = sbi.getRootstrapIDFromTargetID(targetId);
+                               String toolchainId = sbi.getToolchainIDFromTargetID(targetId);
+                               Rootstrap rootstrap = _getRootstrapById(rootstrapId);
+                               Toolchain toolchain = _getToolchainById(toolchainId);
+                               Target target = createTargetModel(targetId, targetName, rootstrap, toolchain);
+                               _addTarget(target);
+                       }
+               } catch (SBIException e) {
+                       e.printStackTrace();
                }
                
                initialized = true;
@@ -284,9 +367,9 @@ public class SBIModel {
                                // Added Property
                                propertyMap.put( entry.getKey(), entry.getValue() );
                        }
-               }
-               
-               ArrayList<Tool> toolList = createToolList(id);
+               }               
+
+               ArrayList<Tool> toolList = createToolList(status.getStdout());
                Toolchain t = new Toolchain(id, name, toolchainType, version, arch, path, toolList);
                t.setProperyList( propertyMap );
 
@@ -297,14 +380,25 @@ public class SBIModel {
        private static Target createTargetModel(String id, String name, Rootstrap rootstrap, Toolchain toolchain) {             
                Target t = new Target(id, name, rootstrap, toolchain);
                return t;
-       }
+       }       
        
-       private static ArrayList<Tool> createToolList(String id) throws SBIException {
+       private static ArrayList<Tool> createToolList(String result) throws SBIException {
                ArrayList<Tool> list = new ArrayList<Tool>();
+               ArrayList<String> toolInfos = new ArrayList<String>();
+               Pattern p;
+               Matcher m;              
+               
+               String[] results = sbi.splitConfigLineByLine(result);
+               p = Pattern.compile("TOOL_.*_PATH=.*");
+
+               for (String str: results) {
+                       m = p.matcher(str);
+                       if (m.matches()) {
+                               toolInfos.add(str);
+                       }
+               }               
                
-               ArrayList<String> toolPath;
-               toolPath =      sbi.getToolInfosByPatternUsingToolchain(id, "TOOL_.*_PATH=.*"); 
-               for (String tool : toolPath) {
+               for (String tool : toolInfos) {
                        String name = "";                       
                        String version = "";
                        String _version = "";
@@ -316,27 +410,43 @@ public class SBIModel {
                        name = s[0];                    
                        if (s.length == 2) {
                                path = s[1].trim();
-                       }                       
-                       _version = sbi.getAToolInfoByPatternUsingToolchain(id, String.format("TOOL_%s_VERSION=.*", name));
+                       }
+                       p = Pattern.compile(String.format("TOOL_%s_VERSION=.*", name));
+                       for (String str: results) {
+                               m = p.matcher(str);
+                               if (m.matches()) {
+                                       _version = str;
+                               }
+                       }
+
                        s = _version.split("=");
                        if (s.length == 2) {
                                version = s[1].trim();
                        }
                        Tool t = new Tool(name, version, path);
                        list.add(t);
-               }
-               
+               }               
                return list;
-       }
-       
+       }       
        
        static public String getToolchainPropertyValue( String toolchainID, String key ) {
                return getToolchainById(toolchainID).getPropertyValue(key);
        }
-
        
        static public String getRootstrapPropertyValue( String rootstrapID, String key ) {
                return getRootstrapById(rootstrapID).getPropertyValue(key);
-       }
+       }       
 
+       static private void waitInit() {
+               int time = 0;
+               while(!initialized) {
+                       if (time > 20) break;
+               try {
+                               Thread.sleep(1000);
+                               time += 1;
+                       } catch (InterruptedException e) {                      
+                               e.printStackTrace();
+                       }
+               }
+       }
 }
index 107d50a..d0047cc 100644 (file)
@@ -50,6 +50,7 @@ public class SetSBITarget extends ProcessRunner {
                
                IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
 
-               CommonConfigurationManager.initializeBuildTargetName( projectHandle );
+               //Save build configuration at the end of the project creation
+               CommonConfigurationManager.initializeBuildTargetName( projectHandle, false );
        }
 }
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/build/ui/AbstractDynamicAnalysisPropertyTab.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/build/ui/AbstractDynamicAnalysisPropertyTab.java
new file mode 100644 (file)
index 0000000..9799a2d
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+*  Build
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Taejun Ha <taejun.ha@samsung.com>
+* Jiil Hyoun <jiil.hyoun@samsung.com>
+* Donghyuk Yang <donghyuk.yang@samsung.com>
+* Hoon Kang <h245.kang@samsung.com>  
+* DongHee Yang <donghee.yang@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.nativecommon.build.ui;
+
+import org.eclipse.cdt.core.settings.model.ICResourceDescription;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration;
+import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
+import org.eclipse.cdt.ui.newui.ICPropertyProvider;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+
+abstract public class AbstractDynamicAnalysisPropertyTab extends AbstractCBuildPropertyTab {
+public static final String DYNAMICANALYSIS_COMPILE_FLAG = "-fprofile-arcs -ftest-coverage";
+    
+    protected Button checkDynamicAnalysis;
+
+    protected abstract void createDynamicAnalysisComposite(Composite parent);
+
+    protected abstract boolean checkSetDynamicAnalysisOption();
+
+    @Override
+    public abstract boolean canBeVisible();
+
+    @Override
+    protected abstract void performOK();
+
+    protected void createDynamicAnalysisComposite(Composite parent, IProject project) {
+    }
+
+    @Override
+    public void createControls(Composite _parent, ICPropertyProvider _provider) {
+        page = _provider;
+        if (canBeVisible()) {
+            createControls(_parent);
+        }
+    }
+
+    @Override
+    protected void createControls(Composite parent) {
+        super.createControls(parent);
+        usercomp.setLayout(new GridLayout(1, false));
+        Composite composite = new Composite(usercomp, SWT.NONE);
+        createDynamicAnalysisComposite(composite);      
+    }
+    
+    @Override
+    protected void updateData(ICResourceDescription cfg) {
+        checkDynamicAnalysis.setSelection(checkSetDynamicAnalysisOption());
+    }
+    
+    @Override
+    protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
+    }
+
+    @Override
+    protected void performDefaults() {
+    }
+
+    @Override
+    public void updateButtons() {
+    }
+}
old mode 100644 (file)
new mode 100755 (executable)
index 73807bf..8719bf3
@@ -76,7 +76,6 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
        private Label mRootstrapPathL;  \r
        private Label mRootstrapVersionL;\r
        private Label mRootstrapArchL;\r
-       private Label spaceLabel;\r
        private SmartBuildInterface sbi;\r
        private TableViewer toolListTable;\r
        private int selectedColumn =0;          \r
@@ -97,7 +96,7 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                \r
                config = getCfg();\r
                project = page.getProject();\r
-               sbi = SmartBuildInterface.getInstance();\r
+               sbi = SmartBuildInterface.getInstance(project);\r
                \r
                if (toolchainInfos == null) {\r
                        setToolchainInfosArrs();\r
@@ -110,13 +109,13 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                Composite composite = new Composite(usercomp, SWT.NONE);\r
                createRootstrapSelectComposite(composite);\r
                \r
-               spaceLabel = new Label(composite, SWT.NONE);\r
-               spaceLabel = new Label(composite, SWT.NONE);\r
+               new Label(composite, SWT.NONE);   // Space Label\r
+               new Label(composite, SWT.NONE);   // Space Label\r
                \r
                createRootstrapInfoComposite(composite);\r
                \r
-               spaceLabel = new Label(composite, SWT.NONE);                    \r
-               spaceLabel = new Label(composite, SWT.NONE);                    \r
+               new Label(composite, SWT.NONE);   // Space Label\r
+               new Label(composite, SWT.NONE);   // Space Label\r
                \r
                createToolchainComposite(composite);\r
        }\r
@@ -188,7 +187,8 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
        \r
        private String getIdFromRootstrapName( String rootstrapName ) {          \r
                for (int i = 0 ; i < rootstrapInfos.length ; i++) {\r
-                       if (rootstrapInfos[i][0].equals(rootstrapName)) {\r
+                       if (!getSuitableToolchainList(rootstrapInfos[i][1]).isEmpty() &&\r
+                               rootstrapInfos[i][0].equals(rootstrapName)) {\r
                                return rootstrapInfos[i][1];\r
                        }\r
                }       \r
@@ -230,7 +230,7 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                                        mToolchainCombo.select(0);\r
                                        String selectedToolchainName = mToolchainCombo.getText();\r
                                        String rootstrapID = getIdFromRootstrapName(selectedRootstrapName);\r
-                                       String toolchainID = getIdFromToolchainName(    rootstrapID, selectedToolchainName );\r
+                                       String toolchainID = getIdFromToolchainName(rootstrapID, selectedToolchainName );\r
                                        \r
                                        // get target id\r
                                        String targetID = SmartBuildInterface.makeTargetID(rootstrapID, toolchainID);\r
@@ -247,8 +247,7 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                                        setToolList(getIdFromToolchainName(rootstrapID, selectedToolchainName));\r
                                        setRootstrapInfos(rootstrapID);\r
                                        \r
-                                       /* change toolchain */\r
-                                       changeToolchain(selectedToolchainName);                                 \r
+                                       /* change toolchain */                                                                          \r
                                        setChangedOption();\r
                                } else {\r
                                        setToolListEmpty();\r
@@ -311,8 +310,9 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
    {\r
           try {\r
                   ArrayList<String> compatibleRootstrapList = new ArrayList<String>();\r
-                  ArrayList<String> rootIdList = sbi.getRootstrapList();\r
+                  ArrayList<String> rootIdList = sbi.getRootstrapList();          \r
                   for (String rootstrapId : rootIdList) {\r
+                          \r
                           String name = sbi.getRootstrapNameFromRootstrapID(rootstrapId);\r
 \r
                           // check name and compatibility\r
@@ -463,7 +463,6 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                                }\r
                                \r
                                // change toolchain\r
-                               changeToolchain(mToolchainCombo.getText());\r
                                setToolList( toolchainID );\r
                                setChangedOption();\r
                        }                       \r
@@ -524,10 +523,9 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                setRootstrapPathText(rootstrapId);\r
        }       \r
        \r
-       protected void changeToolchain(String toolchainName) {\r
-               //SLPConfiguration.changeToolchain( getCfg(), cfgdescr, toolchainNameInCfg);\r
+       protected void changeToolchain(String targetId) {\r
                CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project);\r
-               builder.changeToolchain(getCfg(), cfgdescr, toolchainName);\r
+               builder.changeToolchain(getCfg(), targetId);\r
        }\r
        \r
        private void setToolList(String toolchainId) {\r
@@ -574,7 +572,7 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
        \r
        private void setRootstrapArchText(String rootstrapiD) {\r
                try {\r
-                       mRootstrapArchL.setText(sbi.getArchitectureFromRootstrapID(rootstrapiD));\r
+                       mRootstrapArchL.setText(sbi.getRootstrapArchitectureFromRootstrapID(rootstrapiD));\r
                } catch (SBIException e) {\r
                        e.printStackTrace();\r
                        //e.showErrorDialog();\r
@@ -593,8 +591,8 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                String toolchainName = mToolchainCombo.getText();               \r
                \r
                String rootstrapId = getIdFromRootstrapName(rootstrapName);\r
-               String toolchainId = getIdFromToolchainName(rootstrapId, toolchainName);                 \r
-               String targetId = sbi.makeTargetID(rootstrapId, toolchainId);\r
+               String toolchainId = getIdFromToolchainName(rootstrapId, toolchainName);\r
+               String targetId = SmartBuildInterface.makeTargetID(rootstrapId, toolchainId);\r
 \r
                try {\r
                        if (!sbi.checkTargetID(targetId)) {\r
@@ -607,21 +605,12 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                        }\r
                } catch (SBIException e) {\r
                        e.printStackTrace();\r
-                       //e.showErrorDialog();\r
                        return;\r
                }\r
-               \r
-               CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project);\r
-               builder.setBuildTargetID( getCfg(), targetId);\r
-               setChangedCompilerOnSettingPage(rootstrapId);\r
+\r
+               changeToolchain(targetId);\r
        }\r
-       \r
-       private void setChangedCompilerOnSettingPage( String rootstrapId) {\r
-               CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project);\r
-               builder.setToolCommand(getCfg(), rootstrapId);\r
-               //SLPConfiguration.setToolCommand( getCfg(), rootstrapCfgName );\r
-       }       \r
-       \r
+\r
        private int getRootstrapIndex(String rootstrapName) {\r
                String[] rootstrapList = mRootstrapCombo.getItems();\r
                for (int i = 0 ; i < rootstrapList.length ; i++) {\r
@@ -699,7 +688,7 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                        if (needSetDefaultBuildTarget) {\r
                                setChangedOption();             \r
                        } else {\r
-                               String targetId = sbi.makeTargetID(selectedRootstrapId,  selectedToolchainId);\r
+                               String targetId = SmartBuildInterface.makeTargetID(selectedRootstrapId,  selectedToolchainId);\r
                                \r
                                try {\r
                                        if (!sbi.checkTargetID(targetId)) {\r
@@ -783,6 +772,8 @@ public class PlatformSettingTab extends AbstractCBuildPropertyTab {
                                                        } else {\r
                                                                return (entry_2.getVersion()).compareTo(entry_1.getVersion());\r
                                                        }\r
+                                               default:\r
+                                                   break;\r
                                        }\r
                                        return entry_1.getName().compareTo(entry_2.getName());\r
                                }\r
index 52853ac..211b8f0 100644 (file)
@@ -1,7 +1,5 @@
 package org.tizen.nativecommon.build.ui;
 
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
@@ -32,10 +30,12 @@ public class projectBuildArtefactType extends PropertyTester {
                        if ( project == null ) {
                                return false;
                        }
-
+                       
                        // check CDT Managed Project Type 
                        IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project );
-                       if ( info == null ) return false;
+                       if ( info == null ) {
+                               return false;
+                       }
 
                        // get build-artefact type
                        IConfiguration cfg;
@@ -45,7 +45,7 @@ public class projectBuildArtefactType extends PropertyTester {
                                        info.getDefaultConfiguration().getParent().getProjectType() != null ) {
                                cfg = info.getDefaultConfiguration().getParent();
                        } else {
-                                return false;
+                               return false;
                        }
                        
                        String projectArtefactType =cfg.getProjectType().getBuildArtefactType().getId();
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/CProjectLaunchCommand.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/CProjectLaunchCommand.java
new file mode 100644 (file)
index 0000000..d46cd39
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+abstract public class CProjectLaunchCommand implements IProjectLaunchCommand {
+
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/CppProjectLaunchCommand.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/CppProjectLaunchCommand.java
new file mode 100644 (file)
index 0000000..afd3ba1
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+abstract public class CppProjectLaunchCommand implements IProjectLaunchCommand {
+
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/IProjectLaunchCommand.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/IProjectLaunchCommand.java
new file mode 100644 (file)
index 0000000..02bcdab
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+import java.io.File;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.tizen.common.TizenProjectType;
+import org.tizen.nativecommon.build.CommonProjectDependentPackager;
+
+public interface IProjectLaunchCommand {
+    public void loadManifestfile();
+
+    public File getProjectDefaultIcon();
+
+    public String getPackageName();
+
+    public IProject getProject();
+
+    public String getLaunchCommand();
+
+    public String getDebugLaunchCommand();
+
+    public String getInstallCommand(File packageFile, String packageType);
+
+    public String getRemoveCommand(String packageType);
+
+    public String getListCommand();
+
+    public String getListCommandResult();
+
+    public String getArchitecture(IConfiguration config);
+    public String getBuildTargetName(IConfiguration config);
+    public String getAllCFlags(IConfiguration config);
+    public void doMultiAppPreProcess(CommonProjectDependentPackager packager, IProgressMonitor monitor);
+    // will be deprecated
+    public void savePackageModel();
+    public TizenProjectType getNativeProjectType();
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenAttachDelegate.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenAttachDelegate.java
new file mode 100644 (file)
index 0000000..7e1350c
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.IProcessInfo;
+import org.eclipse.cdt.core.IProcessList;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.internal.ui.LaunchImages;
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.TwoPaneElementSelector;
+import org.tizen.common.TizenPlatformConstants;
+
+public class TizenAttachDelegate extends TizenLaunchDelegate {
+    protected Integer pid = Integer.valueOf(-1);
+
+    protected void launchApplicationForDebug(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
+            launchApplicationWithGDBServer(launch, config, new SubProgressMonitor(monitor, 1));
+            launchApplicationWithGDBClient(launch, config, exeFile, new SubProgressMonitor(monitor, 1));
+        } finally {
+            monitor.done();
+        }
+    }
+
+    @Override
+    protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {        
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
+
+            setPID();
+            if (pid.equals(Integer.valueOf(-1)) || pid.equals(Integer.valueOf(0)))
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER + ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID, null);
+
+            String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);            
+            String commandArguments =  ":" + gdbserverPort + TizenPlatformConstants.ATTACH_OPTION + pid;
+            String gdbserverCmd = TizenPlatformConstants.GDBSERVER_CMD + " " + commandArguments;
+            currentDevice.executeShellCommand(gdbserverCmd);
+        } catch (Exception e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } finally {
+            monitor.done();
+        }
+    }
+    
+    private void setPID() {
+        Display.getDefault().syncExec(new Runnable() {
+            public void run() {
+                pid = promptForProcessID();
+            }
+        }); 
+    }
+
+    private Integer promptForProcessID() {
+        try {
+            return selectProcess();
+        } catch (CoreException e) {
+            return Integer.valueOf(-1);
+        }
+    }
+    
+    private Integer selectProcess() throws CoreException {
+        Shell shell = LaunchUIPlugin.getShell();
+        if (shell == null)
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, null);
+
+        ILabelProvider topprovider = new LabelProvider() {
+            public String getText(Object element) {
+                IProcessInfo pinfo = (IProcessInfo)element;
+                IPath ppath = new Path(pinfo.getName());
+                return ppath.lastSegment() + " - " + pinfo.getPid(); //$NON-NLS-1$
+            }
+
+            public Image getImage(Object element) {
+                return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
+            }
+        };
+        
+        ILabelProvider downprovider = new LabelProvider() {
+            public String getText(Object element) {
+                IProcessInfo info = (IProcessInfo)element;
+                return info.getName();
+            }
+
+            public Image getImage(Object element) {
+                return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
+            }
+        };
+        
+        TwoPaneElementSelector dlg = new TwoPaneElementSelector(shell, topprovider, downprovider);
+        dlg.setTitle("Select Process"); //$NON-NLS-1$
+        dlg.setMessage("Select a Process to attach debugger to:"); //$NON-NLS-1$
+        
+        IProcessList processList = null;
+        processList = new TizenDeviceProcessList(currentDevice,TizenPlatformConstants.APP_INSTALL_PATH);
+
+        IProcessInfo pInfos[] = null;
+        pInfos = processList.getProcessList();
+
+        if(pInfos == null)
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, null);
+
+        dlg.setElements(pInfos);
+        
+        if (dlg.open() == Window.OK) {
+            IProcessInfo info = (IProcessInfo)dlg.getFirstResult();
+            if (info != null)
+                return Integer.valueOf(info.getPid());
+        }
+
+        return Integer.valueOf(-1);
+    }
+}
\ No newline at end of file
index 08f480f..ebf4ff4 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
 import java.io.IOException;
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenCoredumpDelegate.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenCoredumpDelegate.java
new file mode 100644 (file)
index 0000000..ae9804b
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.ICDIDebugger2;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.common.TizenPlatformConstants;
+import org.tizen.common.connection.ui.TizenRemoteFileDialog;
+import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
+import org.tizen.nativecommon.ProjectUtil;
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.MultiLineReceiver;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
+
+public class TizenCoredumpDelegate extends TizenLaunchDelegate {
+    protected final static String DEFAULT_CORE_DIR = TizenPlatformConstants.PUBICL_PLATFORM_CORE_PATH;
+    private FileEntry coreDir = null;
+
+    @Override
+    protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
+        ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
+        wc.doSave();
+    }
+    
+    @Override
+    protected void launchApplicationForDebug(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
+            launchApplicationWithGDBClient(launch, config, exeFile, new SubProgressMonitor(monitor, 10));
+        } finally {
+            monitor.done();
+        }
+    }
+
+    @Override
+    protected void launchApplicationWithGDBClient(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException {
+        ILaunchConfigurationWorkingCopy workingCopy = null;
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT, 2);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT);
+            
+            ICDebugConfiguration debugConfiguration = getDebugConfig(config);
+            String strPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, "");
+
+            if (strPath == null || strPath.length() == 0) {
+                IProject project = ProjectUtil.getProject(config);
+                FileEntry remotePath = promptForCoreFilePath(project, debugConfiguration);
+                if(remotePath == null)
+                    newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null);
+            
+                IPath programPath = CDebugUtils.verifyProgramPath(config);
+                programPath = programPath.removeLastSegments(1);
+                String projectPath = programPath.toPortableString();
+                String coreFilePath = projectPath + "/core." + project.getName();
+                boolean isSuccess = false;                 
+                try {
+                    isSuccess = downloadCoreFile(remotePath, coreFilePath, new SubProgressMonitor(monitor, 1));
+                } catch (IOException e) {
+                    newCoreException(TizenLaunchMessages.CANNOT_FIND_CORE_FILE, e);
+                }
+                
+                if(isSuccess == false)
+                    newCoreException(TizenLaunchMessages.CANNOT_FIND_CORE_FILE, null);
+
+                File coreFile = new File(coreFilePath.toString());
+                IPath corePath = new Path(coreFilePath.toString());
+                ICProject cproject = CDebugUtils.verifyCProject(config);
+                IBinaryObject core = verifyBinary(cproject, corePath);
+                if (!coreFile.canRead() || !(core.getType() == IBinaryObject.CORE))
+                    newCoreException(TizenLaunchMessages.INVALID_CORE_FILE, null);
+
+                // Call again the launch delegate with the core file which user has selected.
+                workingCopy = config.getWorkingCopy();
+                workingCopy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, coreFilePath);
+                workingCopy.launch(ILaunchManager.DEBUG_MODE, new SubProgressMonitor(monitor, 1));
+                workingCopy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, "");
+                workingCopy.doSave();
+                // Coredump debugging finishes here.
+                return;
+            }
+            IPath programPath = CDebugUtils.verifyProgramPath(config);
+            ICProject cproject = CDebugUtils.verifyCProject(config);
+            exeFile = null;
+            if (programPath != null)
+                exeFile = verifyBinary(cproject, programPath);
+            else
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null);
+    
+            GDBCDIDebugger2 debugger = new GDBCDIDebugger2();
+            ICDISession debugSession = ((ICDIDebugger2)debugger).createSession(launch, exeFile.getPath().toFile(), new SubProgressMonitor(monitor, 1));
+            if(debugSession == null)
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null);
+
+            ICDITarget[] targetArray = debugSession.getTargets();
+            Process proc = null;
+            IProcess iproc = null;
+            for (int i = 0; i < targetArray.length; i++) {
+                proc = targetArray[i].getProcess();
+
+                if (proc != null)
+                    iproc = DebugPlugin.newProcess(launch, proc, exeFile.getName(), null);
+
+                IProject project = ProjectUtil.getProject(config);
+                CDIDebugModel.newDebugTarget(launch, project, targetArray[i],
+                        "Tizen debugger",
+                        iproc, exeFile, true, false, "false", true);
+                monitor.worked(1);
+            }
+        } catch (Exception e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
+        } finally {
+            if (workingCopy != null) {
+                workingCopy.setAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, "");
+                workingCopy.doSave();
+            }
+            monitor.done();
+        }
+    }
+
+    private FileEntry promptForCoreFilePath(final IProject project, ICDebugConfiguration debugConfig) throws CoreException {
+        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+        if (window == null) {
+            IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
+            window = windows[0];
+        }
+        
+        final Shell shell = window.getShell();
+        if (shell != null) {
+            shell.getDisplay().syncExec(new Runnable() {
+                public void run() {
+                    TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, "Select a directory where exist coredump file", currentDevice, true, DEFAULT_CORE_DIR);
+                    if (dlg.open() == TizenRemoteFileDialogResult.OK)
+                        coreDir = dlg.getSelectedFileEntry();
+                    else
+                        coreDir = null;
+                }
+            });
+        }
+        return coreDir;
+    }
+
+    private boolean downloadCoreFile(FileEntry coreDir, String destFilePath, IProgressMonitor monitor) throws IOException {
+        if (coreDir == null)
+            return false;
+        String command = "ls -lt " + coreDir.getFullPath();
+        currentDevice.executeShellCommand(command, new MultiLineReceiver() {
+            @Override
+            public void processNewLines(String[] lines) {
+                for (String line : lines) {
+                    if (line.contains("core")) {
+                        executeResult = line.substring(line.indexOf("core"));
+                        break;
+                    }
+                }
+            }
+        }, defaultTimeOut);
+
+        if (!executeResult.startsWith("core"))
+            return false;
+
+        FileEntry[] coreFiles = coreDir.getFileListingService().getChildren(coreDir, true, null);
+        FileEntry found = null;
+        for (FileEntry file : coreFiles) {
+            if (file.getName().equals(executeResult)) {
+                found = file;
+                break;
+            }
+        }
+
+        if (found == null)
+            return false;
+        
+        SyncResult result = currentDevice.getSyncService().pullFile(found.getFullPath(), destFilePath, true, SyncService.getNullProgressMonitor());
+        
+        if (result.getCode() == SyncService.RESULT_OK)
+            return  true;
+        else
+            return false;
+    }
+}
\ No newline at end of file
index 6b86a76..cf53407 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
index 5d7e241..b499016 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
 import java.io.IOException;
@@ -33,24 +33,22 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.eclipse.cdt.core.IProcessList;
-import org.tizen.common.log.Logger;
+import org.tizen.common.util.log.Logger;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.MultiLineReceiver;
 
 public class TizenDeviceProcessList implements IProcessList {
-    public final static String APP_CMD_PREFIX = "/opt/apps/";
-    
     IDevice device = null;
     List<String> processList;
     List<TizenProcessInfo> processInfoList;
     TizenProcessInfo[] processInfo = null;
     String cmdFilterPrefix = null;
     Pattern numberPattern = Pattern.compile("[0-9]+");
-    
+
     public TizenDeviceProcessList(IDevice device) {
        this(device, null);
     }
-    
+
     /**
      * Creates a new process list instance by including the given process command. 
      *
@@ -66,14 +64,17 @@ public class TizenDeviceProcessList implements IProcessList {
 
     public TizenProcessInfo[] getProcessList() {
         try {
-            String procQuery = "cd;ls -1 /proc 2>/dev/null";
+            /* Changed the command to remove ansi color from the query result.
+             * Use tee command instead of sending "cd;ls -1 /proc 2>/dev/null".
+             */
+            String procQuery = "cd;ls -1 /proc 2>/dev/null | tee /dev/null";
             device.executeShellCommand(procQuery, new MultiLineReceiver() {
                 @Override
                 public void processNewLines(String[] lines) {
                     for (String line : lines) {
-                       Matcher m = numberPattern.matcher(line);
-                       if (m.matches())
-                               processList.add(line);
+                        Matcher m = numberPattern.matcher(line);
+                        if (m.matches())
+                            processList.add(line);
                     }
                 }
             });
@@ -86,19 +87,19 @@ public class TizenDeviceProcessList implements IProcessList {
             return null;
 
         String cmdQuery = null;
-        
+
         for (final String procId : processList) {
             cmdQuery = MessageFormat.format("cd;cat /proc/{0}/cmdline 2>/dev/null",procId);
-            
+
             try {
                 device.executeShellCommand(cmdQuery.toString(), new MultiLineReceiver() {
                     @Override
                     public void processNewLines(String[] lines) {
                         for (String line : lines) {
-                               if (cmdFilterPrefix == null) 
-                               processInfoList.add(new TizenProcessInfo(procId, line));
-                               else if (line.startsWith(cmdFilterPrefix))
-                                       processInfoList.add(new TizenProcessInfo(procId, line));                                        
+                            if (cmdFilterPrefix == null)
+                                processInfoList.add(new TizenProcessInfo(procId, line));
+                            else if (line.startsWith(cmdFilterPrefix))
+                                processInfoList.add(new TizenProcessInfo(procId, line));
                         }
                     }
                 });
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchCommand.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchCommand.java
new file mode 100644 (file)
index 0000000..0e4cc66
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.osgi.util.NLS;
+import org.tizen.common.TizenPlatformConstants;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.util.log.Logger;
+import org.tizen.nativecommon.TizenNativeException;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.MultiLineReceiver;
+
+/**
+ * objects able to receive the output of a remote shell command
+ */
+public class TizenLaunchCommand {
+    public static final int defaultTimeOut = 60000;
+    private IDevice currentDevice = null;
+    private String commandOutstream = null;
+    private String endLine = null;
+
+    public TizenLaunchCommand(IDevice device) {
+        if (device == null)
+            this.currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
+        else
+            this.currentDevice = device;
+    }
+
+    public void run(String command) throws CoreException, Exception {
+        CommandOuputReceiver receiver = new CommandOuputReceiver();
+
+        currentDevice.executeShellCommand( command, receiver, defaultTimeOut);
+        this.endLine = receiver.getEndLine();
+        this.commandOutstream = receiver.getCommandOutstream();
+
+        if (command.endsWith(TizenPlatformConstants.CMD_SUFFIX)) {
+            if(!TizenPlatformConstants.CMD_SUCCESS.equals(endLine)) {
+                throw new TizenNativeException(NLS.bind(TizenLaunchMessages.ERROR_COMMAND, command, this.commandOutstream));
+            }
+        }
+    }
+    
+    public void runForCodeCoverage(String command) throws CoreException, Exception {
+      //TODO : add error check code;
+        currentDevice.executeShellCommand( command );
+    }
+
+    public String getCommandOutstream() {
+        return commandOutstream;
+    }
+
+    public String getEndLine() {
+        return endLine;
+    }
+
+    private final class CommandOuputReceiver extends MultiLineReceiver {
+        private StringBuilder commandOutstream = null;
+        private String endLine = null;
+
+        public CommandOuputReceiver() {
+            super();
+            setTrimLine(false);
+        }
+
+        @Override
+        public void processNewLines(String[] lines) {
+            commandOutstream = new StringBuilder(256);
+
+            for( String line: lines ) {
+                commandOutstream.append(line);
+                commandOutstream.append(File.separatorChar);
+            }
+            endLine = lines[lines.length - 1];
+        }
+
+        public String getCommandOutstream() {
+            if (commandOutstream != null)
+                return commandOutstream.toString();
+
+            return TizenPlatformConstants.CMD_SUCCESS;
+        }
+
+        //TODO : lastline?
+        public String getEndLine() {
+            if (endLine == null)
+                return TizenPlatformConstants.CMD_SUCCESS;
+
+            return endLine;
+        }
+    }
+}
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchConfiguration.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchConfiguration.java
new file mode 100644 (file)
index 0000000..935b1fb
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.tizen.common.TizenPlatformConstants;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.util.LocalPortChecker;
+import org.tizen.common.util.log.Logger;
+import org.tizen.sdblib.IDevice;
+
+/**
+ * objects able to set tizen run/debug default configuration.
+ */
+public class TizenLaunchConfiguration {
+    public static final int defaultTimeOut = 60000;
+    private IDevice currentDevice = null;
+    private ILaunchConfigurationWorkingCopy configuration = null;
+    private int debugPort = -1;
+
+    public TizenLaunchConfiguration(ILaunchConfigurationWorkingCopy config, IDevice device) {
+        this.configuration = config;
+        if (device == null)
+            this.currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
+        else
+            this.currentDevice = device;
+    }
+    
+    public void setDefaults() {
+        configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, TizenLaunchConfigurationConstants.ATTR_REMOTE_TCP_DEFAULT);
+        configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, TizenPlatformConstants.LOCALHOST);
+        String gdbserverPort = null;
+        try {
+            gdbserverPort = configuration.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
+            configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+
+            currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
+            if (currentDevice == null)
+                return;
+            int localDebugPort = getDefaultDebugPort();
+            if (localDebugPort < 0)
+                return;
+            currentDevice.createForward(localDebugPort, Integer.parseInt(gdbserverPort));
+            String localPort = Integer.valueOf(localDebugPort).toString();
+            configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
+            configuration.doSave();
+        } catch (Exception e) {
+            Logger.error(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        }
+    }
+
+    private int getDefaultDebugPort() {
+        int debugPortBase = Integer.valueOf(TizenLaunchConfigurationConstants.ATTR_GDBLOCAL_BASEPORT_DEFAULT);
+        if (!currentDevice.isEmulator())
+            debugPortBase += 100;
+
+        debugPort = debugPortBase;
+        while ((debugPort < 65535) && !LocalPortChecker.isPortAvailable(debugPort)) {
+            debugPort += 10;
+        }
+
+        if (LocalPortChecker.isPortAvailable(debugPort))
+            return debugPort;
+        else
+            return -1;
+    }
+}
\ No newline at end of file
index 4dc62b4..f87dd4c 100644 (file)
@@ -1,12 +1,12 @@
 /*
-* NativeApp
+* NativeCommon
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
+import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
 import org.tizen.nativecommon.Activator;
 
 public class TizenLaunchConfigurationConstants {
-       public static final String ATTR_GDBSERVER_PORT = Activator.PLUGIN_ID + ".ATTR_GDBSERVER_PORT";
-       public static final String ATTR_GDBSERVER_PORT_DEFAULT = "26102";
-       public static final String DEBUGGER_ID = "org.tizen.nativecommon.launch.TizenDebugger";
-       public static final String CORE_DEBUGGER_ID = "org.tizen.nativecommon.launch.TizenDebuggerForCore";
-       public static final String COMMAND_FACTORY_ID = "org.tizen.nativecommon.launch.TizenCommandFactory";
-       public static final String ATTR_PROJECT_BUILD_CONFIG_NAME="org.tizen.nativeapp.launch.PROJECT_BUILD_CONFIG_NAME_ATTR";
+    public static final String ATTR_GDBSERVER_PORT = Activator.PLUGIN_ID + ".ATTR_GDBSERVER_PORT";
+    public static final String ATTR_GDBSERVER_PORT_DEFAULT = "26102";
+    public static final String ATTR_GDBLOCAL_BASEPORT_DEFAULT = "26102";
+    public static final String DEBUGGER_ID = "org.tizen.nativecommon.launch.TizenDebugger";
+    public static final String CORE_DEBUGGER_ID = "org.tizen.nativecommon.launch.TizenDebuggerForCore";
+    public static final String COMMAND_FACTORY_ID = "org.tizen.nativecommon.launch.TizenCommandFactory";
+    public static final String ATTR_PROJECT_BUILD_CONFIG_NAME = "org.tizen.nativeapp.launch.PROJECT_BUILD_CONFIG_NAME_ATTR";
+
+    /**
+     * Launch configuration attribute value. The default value is true. The key is ATTR_DEBUGGER_AUTO_SOLIB.
+     */
+    public static final boolean DEBUGGER_AUTO_SOLIB_DEFAULT = IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT;
+
+    /**
+     * Launch configuration attribute value. The key is
+     * ATTR_DEBUGGER_STOP_AT_MAIN. The default value is false.
+     */
+    public static boolean DEBUGGER_STOP_AT_MAIN_DEFAULT = false;//ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT;
+
+    /**
+     * Debug configuration attribute.
+     * True is tcp based debugging, and False is based serial communication.
+     */
+    public static boolean ATTR_REMOTE_TCP_DEFAULT = true;
 }
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchDelegate.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/TizenLaunchDelegate.java
new file mode 100644 (file)
index 0000000..de6eecc
--- /dev/null
@@ -0,0 +1,765 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.ICDIDebugger2;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.ui.newui.CDTPropertyManager;
+import org.eclipse.cdt.utils.PathUtil;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.TwoPaneElementSelector;
+import org.tizen.common.TizenPlatformConstants;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.core.command.CommandCancelException;
+import org.tizen.common.util.log.Logger;
+import org.tizen.nativecommon.Activator;
+import org.tizen.nativecommon.ProjectUtil;
+import org.tizen.nativecommon.TizenNativeException;
+import org.tizen.nativecommon.build.CommonBuildPackageFile;
+import org.tizen.nativecommon.build.CommonProjectDependentPackager;
+import org.tizen.nativecommon.build.ProjectTypeManager;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
+
+public class TizenLaunchDelegate extends AbstractCLaunchDelegate {
+    protected File packageFile = null;
+    protected IConfiguration selectedConfig = null;
+    protected IDevice currentDevice = null;
+    protected String executeResult = "";
+    protected int localDebugPort = -1;
+    protected ICDISession debugSession;
+    protected String packageType;
+    protected static final String ENVIRONMENT_SETTING_CMD = "export ";
+
+    protected static final int defaultTimeOut = 60000;
+
+    protected String getPluginID() {
+        return Activator.PLUGIN_ID;
+    }
+
+    public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+        if (monitor == null)
+            monitor = new NullProgressMonitor();
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 20);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
+
+            activateProgressView();
+
+            verifyCProjectConfigurationSettings(config);
+            verifyDeviceReachability(ProjectUtil.getProject(config), new SubProgressMonitor(monitor, 8));
+            verifyBuildConfiguration(config, mode, new SubProgressMonitor(monitor, 1));
+
+            if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+                setDebugConfigAttributes(config);
+                setDefaultSourceLocator(launch, config);
+                IBinaryObject exeFile = getBinaryObject(config);
+                launchApplicationForDebug(launch, config, exeFile, new SubProgressMonitor(monitor, 10));
+            } else {
+                launchApplicationForRun(config, launch, new SubProgressMonitor(monitor, 10));
+            }
+        } finally {
+            if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+                processPostDebug(config);
+            } else {
+                if (!launch.isTerminated())
+                    launch.terminate();
+                ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+                launchManager.removeLaunch(launch);
+            }
+            monitor.done();
+        }
+    }
+
+    protected void processPostDebug(ILaunchConfiguration config)
+            throws CoreException {
+        if (debugSession != null) {
+            try {
+                Process process = debugSession.getSessionProcess();
+                if (process != null)
+                    process.waitFor();
+            } catch (Exception e) {
+                // do nothing
+            }
+        }
+        ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+        String gdbserverPort = wc.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
+        if (localDebugPort != -1) {
+            try {
+                currentDevice.removeForward(localDebugPort, Integer.parseInt(gdbserverPort));
+            } catch (Exception e) {
+                // do nothing
+            }
+        }
+    }
+
+    protected void launchApplicationForDebug(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
+            deployApplication(config, new SubProgressMonitor(monitor, 8));
+            launchApplicationWithGDBServer(launch, config, new SubProgressMonitor(monitor, 1));
+            launchApplicationWithGDBClient(launch, config, exeFile, new SubProgressMonitor(monitor, 1));
+        }
+        catch (CommandCancelException e){
+            Logger.info("Command canceled");
+            return;
+        }
+        finally {
+            monitor.done();
+        }
+    }
+
+    protected String getCodeCoverageEnvironmentVariable(String packageName) {
+        String command = "export GCOV_PREFIX=" + TizenPlatformConstants.APP_INSTALL_PATH
+                + "/"
+                + packageName
+                + "/data "
+                + "&& export GCOV_PREFIX_STRIP=4096 && ";
+        return command;
+    }
+
+    protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
+            IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(ProjectUtil.getProject(config));
+            String execArguments = getArguments(config);
+            String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
+            String gdbserverCmd = TizenPlatformConstants.GDBSERVER_CMD
+                    + " :"
+                    + gdbserverPort
+                    + " "
+                    + getDebugLaunchCommand(config)
+                    + " "
+                    + execArguments;
+            String command = null;
+
+            if (hasCodeCoverageFlag(config)) {
+                // TODO: run through launch_app
+                command = getCodeCoverageEnvironmentVariable(manifest.getPackageName()) + gdbserverCmd;
+            } else {
+                command = gdbserverCmd;
+            }
+            //TODO : add error check code;
+            currentDevice.executeShellCommand(command);
+        } catch (Exception e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } finally {
+            monitor.done();
+        }
+    }
+
+    protected void launchApplicationWithGDBClient(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT, 1);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT);
+
+            TizenDebugger debugger = new TizenDebugger();
+            debugSession = ((ICDIDebugger2)debugger).createSession(launch, exeFile.getPath().toFile(), new SubProgressMonitor(monitor, 1));
+            if(debugSession == null)
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null);
+
+            boolean attrDebuggerStopAtMain = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
+            String attrDebuggerStopAtMainSymbol = null;
+            if (attrDebuggerStopAtMain)
+                attrDebuggerStopAtMainSymbol = launch.getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,    ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+
+            ICDITarget[] targetArray = debugSession.getTargets();
+            for (int i = 0; i < targetArray.length; i++) {
+                Process proc = targetArray[i].getProcess();
+                IProcess iproc = null;
+                if (proc != null)
+                    iproc = DebugPlugin.newProcess(launch, proc, exeFile.getName(), null);
+                IProject project = ProjectUtil.getProject(config);
+                CDIDebugModel.newDebugTarget(launch, project, targetArray[i],
+                        "Tizen debugger",
+                        iproc, exeFile, true, false, attrDebuggerStopAtMainSymbol, true);
+            }
+        } catch (Exception e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
+        } finally {
+            monitor.done();
+        }
+    }
+
+    protected void launchApplicationForRun(ILaunchConfiguration config, ILaunch launch,
+            IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
+            deployApplication(config, new SubProgressMonitor(monitor, 9));
+            launchApplication(config, launch, new SubProgressMonitor(monitor, 1));
+        }
+        catch (CommandCancelException e) {
+            Logger.info("Command canceled");
+            return;
+        }
+        finally {
+            monitor.done();
+        }
+    }
+
+    protected boolean hasCodeCoverageFlag(ILaunchConfiguration config) throws CoreException {
+        IProject project = ProjectUtil.getProject(config);
+        String buildConfigName = getBuildConfigName(config);
+        IConfiguration configuration = getBuildConfiguration(buildConfigName, project);
+        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+        String cflags = manifest.getAllCFlags(configuration);
+        if (cflags.contains(TizenPlatformConstants.CODE_COVERAGE_BUILD_OPTION)) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
+    protected String getDebugLaunchCommand(ILaunchConfiguration config) throws CoreException {
+        IProject project = ProjectUtil.getProject(config);
+        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+
+        String command = TizenPlatformConstants.APP_INSTALL_PATH
+                + "/"
+                + manifest.getPackageName()
+                + "/bin/"
+                + ProjectUtil.getExecutableName(config);
+
+        return command;
+    }
+
+    protected void activateProgressView() {
+        Display.getDefault().syncExec(new Runnable() {
+            public void run() {
+                IWorkbench workbench = PlatformUI.getWorkbench();
+                if (workbench == null)
+                    return;
+                IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+                if (workbenchWindow == null)
+                    return;
+                IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+                if (workbenchPage == null)
+                    return;
+                try {
+                    workbenchPage.showView("org.eclipse.ui.views.ProgressView");
+                } catch (PartInitException e) {
+                    //nothing to do
+                }
+            }
+        });
+    }
+
+    protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
+        ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+        TizenLaunchConfiguration tc = new TizenLaunchConfiguration(wc, null);
+        tc.setDefaults();
+        setSharedlibrarySearchPath(config);
+    }
+
+    /**
+     * Input debug symbol directories for the search path of shared libraries.
+     * Step 1. add project's lib directory.
+     * Step 2. add referenced project's configuration directory.
+     * Step 3. turn 'automatically load shared library symbols' on.
+     * Step 4. save launch configuration.
+     **/
+    private void setSharedlibrarySearchPath(ILaunchConfiguration config) throws CoreException {
+        // Step 1:
+        List<String> values = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, new ArrayList(1));
+        ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+        IPath libPath = new Path(ProjectUtil.getProject(config).getLocation().toOSString() + File.separatorChar + "lib");
+
+        if (canAddLibrarySearchPath(config, libPath))
+            values.add(libPath.toOSString());
+
+        // Step 2:
+        List<IProject>  refProjects = CDebugUtils.getReferencedProjects(ProjectUtil.getProject(config));
+
+        for (IProject proj : refProjects) {
+            if (proj.exists()) {
+                IConfiguration configuration = ManagedBuildManager.getBuildInfo(proj).getDefaultConfiguration();
+                if ("so".equals(configuration.getArtifactExtension())) {
+                    libPath = new Path(proj.getLocation().toOSString() + File.separatorChar + configuration.getName());
+                    if (canAddLibrarySearchPath(config, libPath))
+                        values.add(libPath.toOSString());
+                }
+            }
+        }
+        if (values.size() > 0)
+            wc.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, values);
+
+        // Step 3:
+        wc.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, TizenLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
+        wc.doSave();
+    }
+
+    private boolean canAddLibrarySearchPath(ILaunchConfiguration config, IPath searchPath) throws CoreException {
+        List values = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, Collections.EMPTY_LIST);
+        Iterator it = values.iterator();
+        boolean ret = true;
+
+        while( it.hasNext() ) {
+            IPath oldPath = new Path((String)it.next());
+            if (PathUtil.equalPath(oldPath, searchPath)) {
+                ret = false;
+                break;
+            }
+        }
+        return ret;
+    }
+
+    protected void deployApplication(ILaunchConfiguration config,
+            IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.START_DEPLOY_PROCESS, 11);
+            monitor.subTask(TizenLaunchMessages.START_DEPLOY_PROCESS);
+
+            IProject project = ProjectUtil.getProject(config);
+            createPackage(config, new SubProgressMonitor(monitor, 6));
+            ProjectUtil.refreshResources(project);
+            transferPackage(new SubProgressMonitor(monitor, 1));
+            installPackage(config, new SubProgressMonitor(monitor, 4));
+        } finally {
+            monitor.done();
+        }
+    }
+
+    protected void createPackage(ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.CREATE_PACKAGE, 1);
+            monitor.subTask(TizenLaunchMessages.CREATE_PACKAGE);
+
+            IProject project = ProjectUtil.getProject(config);
+            IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+            //manifest.savePackageModel();
+            //CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project);
+            CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(project);
+            String buildConfigName = getBuildConfigName(config);
+
+            packageType = CommonBuildPackageFile.getPackageType(project);
+            if( "".equals(packageType)){
+                packageType = CommonProjectDependentPackager.DEFAULT;
+            }
+
+            manifest.doMultiAppPreProcess(packager, monitor);
+            packager.buildPackage(buildConfigName, packageType, Activator.getDefault().getPreferenceStore().getBoolean(Activator.SIGN_RUN_CHECK_KEY));
+
+            packageType = packageType.toLowerCase();
+            String packageDirectory = File.separatorChar + buildConfigName + File.separatorChar;
+            IPath packagePath = new Path(project.getLocation().toString() + packageDirectory);
+            packageFile = findPackageFile(packagePath.toFile(), "." + packageType.toLowerCase(), project);
+            if(packageFile == null)
+                newCoreException(TizenLaunchMessages.CANNOT_CREATE_PACKAGE, null);
+        } catch (CoreException e) {
+            throw e;
+        } catch (Exception e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_PACKAGE, e);
+        } finally {
+            monitor.done();
+        }
+    }
+
+    protected String getBuildConfigName(ILaunchConfiguration config) throws CoreException {
+            IProject project = ProjectUtil.getProject(config);
+
+            String buildConfigName = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_NAME, "");
+
+            if (buildConfigName.isEmpty()) {
+                IConfiguration configuration = ManagedBuildManager.getBuildInfo(project).getDefaultConfiguration();
+                return configuration.getName();
+            } else
+                return buildConfigName;
+    }
+
+    protected void transferPackage(IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.TRANSFER_PACKAGE, 1);
+            monitor.subTask(TizenLaunchMessages.TRANSFER_PACKAGE);
+
+            if(packageFile == null)
+                newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
+
+            String destDirectoryPath = TizenPlatformConstants.TEMPORARY_PKG_PATH;
+
+            String srcFilePath = packageFile.getAbsoluteFile().getCanonicalPath();
+            String destFilePath = destDirectoryPath + packageFile.getAbsoluteFile().getName();
+
+            SyncResult syncSuccess = currentDevice.getSyncService().pushFile(srcFilePath, destFilePath, SyncService.getNullProgressMonitor());
+
+            if (syncSuccess.getCode() != SyncService.RESULT_OK)
+                newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
+        } catch (CoreException e) {
+            throw e;
+        } catch (Exception e) {
+            newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, e);
+        } finally {
+            monitor.done();
+        }
+    }
+
+    protected void installPackage(ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.INSTALL_PACKAGE, 2);
+            monitor.subTask(TizenLaunchMessages.INSTALL_PACKAGE);
+
+            IProject project = ProjectUtil.getProject(config);
+            IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+            // check old application
+            String packageName = manifest.getPackageName();
+            String exeName = ProjectUtil.getExecutableName(config);
+
+            String listCmd = manifest.getListCommand();
+            String listCmdRet = manifest.getListCommandResult();
+
+            TizenLaunchCommand launcher = new TizenLaunchCommand(currentDevice);
+            launcher.run(listCmd);
+
+            if(launcher.getEndLine().contains(listCmdRet)) {
+                // remove old application
+                String removeCmd = manifest.getRemoveCommand(packageType);
+                try {
+                    launcher.run(removeCmd);
+                } catch (TizenNativeException e) {
+                  //FIXME & TODO : what if package is not removed?
+                }
+            }
+            monitor.worked(1);
+
+            // install new application
+            String installCmd = manifest.getInstallCommand(packageFile, packageType);
+            launcher.run(installCmd);
+        } catch (CoreException e) {
+            throw e;
+        } catch (Exception e) {
+            newCoreException(TizenLaunchMessages.CANNOT_INSTALL, e);
+        } finally {
+            monitor.done();
+        }
+    }
+
+    /**
+     * Set the given environment before launching a application
+     *
+     * @param config ILaunchConfiguration.
+     * @param environment the new environment variable to add.
+     *
+     */
+    protected void setEnvironment(ILaunchConfiguration config, String environment) throws CoreException{
+        //TODO : do implement later
+        /*
+        ret = ENVIRONMENT_SETTING_CMD + "LD_LIBRARY_PATH=" + TizenPlatformConstants.TOOLS_TARGET_PATH + "/gtest/usr/lib:$LD_LIBRARY_PATH && ";
+        ret = ret + ENVIRONMENT_SETTING_CMD + TIZEN_LAUNCH_ENV + "=" + launchMode + " && ";
+        return ret;*/
+    }
+
+    protected String[] getEnvironment(ILaunchConfiguration config) throws CoreException {
+        Map map = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null);
+        ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+        if (map != null) {
+            wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
+            wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null);
+        }
+        boolean append = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, false);
+        wc.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, append);
+        config = wc.doSave();
+
+        String[] array = DebugPlugin.getDefault().getLaunchManager().getEnvironment(config);
+        if (array == null)
+            return new String[0];
+
+        return array;
+    }
+
+    protected String setArguments(ILaunchConfiguration config) throws CoreException {
+        IPath exeFile = CDebugUtils.verifyProgramPath(config);
+        String arguments = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
+        String executableWithArguments= "";
+        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(ProjectUtil.getProject(config));
+        String exeTargetPath = TizenPlatformConstants.APP_INSTALL_PATH + "/" + manifest.getPackageName() + "/bin/" + exeFile.toFile().getName();
+        if (!arguments.equals(""))
+            executableWithArguments =  exeTargetPath + " " + arguments;
+        else
+            executableWithArguments = exeTargetPath;
+        return executableWithArguments;
+    }
+
+    protected String getArguments(ILaunchConfiguration config) throws CoreException {
+        String arguments = null;
+        arguments = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
+
+        return arguments;
+    }
+
+    protected void newCoreException(String message, Throwable exception) throws CoreException {
+        Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception);
+        throw new CoreException(status);
+    }
+
+    protected IBinaryObject getBinaryObject(ILaunchConfiguration config) throws CoreException {
+        IPath exePath = CDebugUtils.verifyProgramPath(config);
+        ICProject cproject = CDebugUtils.verifyCProject(config);
+        IBinaryObject binaryObject = verifyBinary(cproject, exePath);
+        return binaryObject;
+    }
+
+    protected void verifyBuildConfiguration(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
+        // FIXME : Match by deviceType, not buildTargetArchitecture.
+        IProject project = ProjectUtil.getProject(config);
+        String buildTargetArchitecture = getArchitecture(project);
+        if (currentDevice.isEmulator()) {
+            if(!buildTargetArchitecture.contains("86"))
+                resolveProblematicConfiguration(config, "86");
+        } else {
+            if(!buildTargetArchitecture.contains("arm"))
+                resolveProblematicConfiguration(config, "arm");
+        }
+    }
+
+    protected IConfiguration getBuildConfiguration(String buildConfigName, IProject project) throws CoreException {
+        IConfiguration configuration = null;
+        IConfiguration[] configurations = ManagedBuildManager.getBuildInfo(project).getManagedProject().getConfigurations();
+        for (IConfiguration c : configurations) {
+            if (c.getName().equals(buildConfigName) ) {
+                configuration = c;
+                break;
+            }
+        }
+        if (configuration == null)
+            newCoreException(TizenLaunchMessages.BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE, null);
+
+        return configuration;
+    }
+
+    protected void verifyDeviceReachability(IProject project, IProgressMonitor monitor) throws CoreException {
+        try {
+            monitor.beginTask(TizenLaunchMessages.PREPARE_TO_LAUNCH, 1);
+            monitor.subTask(TizenLaunchMessages.PREPARE_TO_LAUNCH);
+
+            currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
+            if (currentDevice == null)
+                newCoreException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE, null);
+            if (currentDevice.isOffline())
+                newCoreException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE, null);
+        } finally {
+            monitor.done();
+        }
+    }
+
+    protected void resolveProblematicConfiguration(ILaunchConfiguration config, final String arch) throws CoreException {
+        final IProject project = ProjectUtil.getProject(config);
+        Display.getDefault().syncExec(new Runnable() {
+            public void run() {
+                selectedConfig = selectBuildConfiguration(project, arch);
+            }
+        });
+
+        if (selectedConfig == null)
+            newCoreException(TizenLaunchMessages.BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE, null);
+
+        ICProjectDescription projDes = CDTPropertyManager.getProjectDescription(project);
+        ICConfigurationDescription cDesc = projDes.getConfigurationByName(selectedConfig.getName());
+        ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, cDesc.getConfiguration().getId());
+        wc.setAttribute(TizenLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_NAME, cDesc.getConfiguration().getName());
+        wc.doSave();
+    }
+
+    protected IConfiguration selectBuildConfiguration(IProject project, String arch) {
+        Shell shell = LaunchUIPlugin.getShell();
+
+        ILabelProvider topprovider = new LabelProvider() {
+            public String getText(Object element) {
+                IConfiguration buildConfig = (IConfiguration)element;
+                return buildConfig.getName();
+            }
+        };
+
+        ILabelProvider downprovider = new LabelProvider() {
+            public String getText(Object element) {
+                IConfiguration buildConfig = (IConfiguration)element;
+                return buildConfig.getName();
+            }
+        };
+
+        TwoPaneElementSelector dlg = new TwoPaneElementSelector(shell, topprovider, downprovider);
+        dlg.setTitle("Select a new build configuration"); //$NON-NLS-1$
+        dlg.setMessage("Build configuration doesn't match with current active device.\nSelect a new build configuration to launch"); //$NON-NLS-1$
+
+        IConfiguration[] configurations = ManagedBuildManager.getBuildInfo(project).getManagedProject().getConfigurations();
+        List<IConfiguration> adaptableConfigs = new ArrayList<IConfiguration>(0);
+        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+        for(IConfiguration c : configurations) {
+            String buildTargetArchitecture = manifest.getArchitecture(c);
+            if (buildTargetArchitecture.contains(arch))
+                adaptableConfigs.add(c);
+        }
+
+        dlg.setElements(adaptableConfigs.toArray());
+
+        if (dlg.open() == Window.OK) {
+            IConfiguration selectedConfig = (IConfiguration)dlg.getFirstResult();
+            return selectedConfig;
+        }
+
+        return null;
+    }
+
+    protected void verifyCProjectConfigurationSettings(ILaunchConfiguration config) throws CoreException {
+        IPath exePath = CDebugUtils.verifyProgramPath(config);
+        ICProject cproject = CDebugUtils.verifyCProject(config);
+        if (exePath != null)
+            verifyBinary(cproject, exePath);
+        else
+            newCoreException(TizenLaunchMessages.CANNOT_FIND_EXECUTABLE, null);
+    }
+
+    protected File findPackageFile(File searchPath, String ext, IProject project) {
+        File[] packageFiles = searchPath.listFiles(new ExtFilter(ext));
+
+        if (packageFiles == null || packageFiles.length == 0)
+            return null;
+        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+        String packageName = manifest.getPackageName();
+        if (packageName == null)
+            return null;
+
+//        String arch = getArchitecture(project);
+
+        for (File file : packageFiles) {
+            String fileName = file.getName();
+            // Removed architecture check because rpm fileName contains "i586" in OBS environment but getArchitecture() returns "i386".
+//            if (fileName.contains(packageName) && fileName.contains(arch) ) {
+            if (fileName.contains(packageName)) {
+                return file;
+            }
+        }
+
+        return null;
+    }
+
+    protected class ExtFilter implements FilenameFilter {
+        protected String ext;
+
+        public ExtFilter(String ext) {
+            this.ext = ext;
+        }
+
+        public boolean accept(File dir, String name) {
+            return name.endsWith(ext);
+        }
+    }
+
+    protected String getArchitecture(IProject project){
+        String arch = null;
+        IConfiguration config = ManagedBuildManager.getBuildInfo(project).getDefaultConfiguration();
+        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+        String targetID = manifest.getBuildTargetName(config);
+        try {
+            arch = SmartBuildInterface.getInstance().getRootstrapArchitecture(targetID);
+        } catch (SBIException e) {
+            Logger.error("Error getArchitecture", e);
+        }
+
+        return arch;
+    }
+
+    public void launchApplication(ILaunchConfiguration config, ILaunch launch,
+            IProgressMonitor monitor) throws CoreException {
+        IProject project = ProjectUtil.getProject(config);
+        IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+
+//      String command = String.format(TizenOSPConstants.LAUNCH_CMD, packageName, exeName);
+        String command = null;
+        TizenLaunchCommand launcher = new TizenLaunchCommand(currentDevice);
+        if (hasCodeCoverageFlag(config)) {
+            command = getCodeCoverageEnvironmentVariable(manifest.getPackageName());
+            command += getDebugLaunchCommand(config);
+            try {
+                launcher.runForCodeCoverage(command);
+            } catch (TizenNativeException e) {
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
+            } catch (Exception e) {
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
+            }
+        } else {
+            command = manifest.getLaunchCommand();
+            try {
+                launcher.run(command);
+            } catch (TizenNativeException e) {
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
+            } catch (Exception e) {
+                newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
+            }
+        }
+    }
+}
index 0b35a2a..1f34b75 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
 import org.eclipse.osgi.util.NLS;
@@ -44,12 +44,12 @@ public class TizenLaunchMessages extends NLS {
        public static String CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER;
        public static String CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT;
        public static String CANNOT_FIND_CORE_FILE;
-       public static String CANNOT_CHANGE_OWNERSHIP;
        public static String CANNOT_FIND_BUILDCONFIG_NAME;
        public static String CANNOT_CREATE_FORWARD;
        public static String BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE;
        public static String INVALID_CORE_FILE;
        public static String CANNOT_GET_PROCESSLIST;
+       public static String ERROR_COMMAND;
        
        //error messages from cdt
        public static String Launch_common_Exception_occurred_reading_configuration_EXCEPTION;
index ea8ffde..b166821 100644 (file)
@@ -11,7 +11,6 @@ CANNOT_LAUNCH = Cannot launch application.
 CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER = Cannot launch application with GDBServer.
 CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT = Cannot launch application with GDBClient.
 CANNOT_FIND_CORE_FILE = Cannot find core file.
-CANNOT_CHANGE_OWNERSHIP = Cannot change ownership.
 CANNOT_FIND_BUILDCONFIG_NAME = Cannot find build configuration name.
 CANNOT_CREATE_FORWARD = Cannot create forward.
 BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE = Build configuration does not match with current device type. Select correct device or build configuration.   
@@ -23,13 +22,15 @@ PREPARE_TO_LAUNCH = Preparing to launch...
 START_DEPLOY_PROCESS = Start deploy process... 
 CREATE_PACKAGE = Creating package...
 TRANSFER_PACKAGE = Transferring package...
-INSTALL_PACKAGE = Installing package...
-Launch_common_Exception_occurred_reading_configuration_EXCEPTION = Exception occurred reading configuration {0}
+INSTALL_PACKAGE = Installing the package...
+Launch_common_Exception_occurred_reading_configuration_EXCEPTION = Exception occurred while reading the {0} configuration.
 TizenMainTab_Configuration_name = {0} {1}
-TizenMainTab_Project_not_specified=Project not specified
-Launch_common_Project_does_not_exist=Project does not exist
-TizenMainTab_Program_not_specified=Program not specified
-TizenMainTab_Project_must_be_opened=Project must be opened
-TizenMainTab_Program_does_not_exist=Program does not exist
-TizenMainTab_Use_Active=Use Active
-CANNOT_GET_PROCESSLIST=Cannot get process lists
+TizenMainTab_Project_not_specified=Project not specified.
+Launch_common_Project_does_not_exist=Project does not exist.
+TizenMainTab_Program_not_specified=Program not specified.
+TizenMainTab_Project_must_be_opened=Project must be opened.
+TizenMainTab_Program_does_not_exist=Program does not exist.
+TizenMainTab_Use_Active=Use the active build configuration
+CANNOT_GET_PROCESSLIST=Failed to retrieve process lists.
+ERROR_COMMAND=Executing command failed: {0}\n\
+ \  {1}
index be199c9..b2521f8 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
 import java.io.BufferedWriter;
@@ -111,7 +111,7 @@ public class TizenMIProcessAdapter extends MIProcessAdapter {
                IProject project = getProjectName(args);
                CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project);
                
-               String[] newArgs = new String[args.length];
+               String[] newArgs = new String[args.length-1];
                System.arraycopy(args, 1, newArgs, 0, args.length-1);
 
                gdbProcess = builder.debug(newArgs);
index 7cf16d6..d34d8bd 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
 import org.eclipse.cdt.core.IProcessInfo;
index 7d5abb5..570a6ee 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch;
 
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
index dd18d46..0288ac5 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch.ui;
 
 import java.util.ArrayList;
index af1b40c..f88fb52 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch.ui;
 
 import java.io.File;
index 6534a9f..e35cc2e 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch.ui;
 
 import java.io.File;
index 14d0757..d733160 100644 (file)
@@ -4,9 +4,9 @@
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
-* Joogwan Kim <joogwan.kim@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
-*  
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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
@@ -22,7 +22,7 @@
 * Contributors:
 * - S-Core Co., Ltd
 *
-*/ 
+*/
 package org.tizen.nativecommon.launch.ui;
 
 import java.util.ArrayList;
@@ -35,37 +35,51 @@ import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
 import org.eclipse.cdt.launch.ui.CDebuggerTab;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.tizen.nativecommon.launch.TizenLaunchConfiguration;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 
-
 public class TizenDebuggerTab extends CDebuggerTab {
 
-       public TizenDebuggerTab(boolean attachMode) {
-               super(attachMode);
-       }
+    public TizenDebuggerTab(boolean attachMode) {
+        super(attachMode);
+    }
 
-       @Override
-       public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
-               super.setDefaults(configuration);
-               configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
-               configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, TizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
-               configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
-       }
+    @Override
+    public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+        super.setDefaults(configuration);
+        configuration
+                .setAttribute(
+                        ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
+                        TizenLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
+        configuration.setAttribute(
+                IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY,
+                TizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
+        configuration.setAttribute(
+                IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
+                TizenLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
+        TizenLaunchConfiguration tc = new TizenLaunchConfiguration(configuration, null);
+        tc.setDefaults();
+    }
 
-       @Override
-       protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
-               ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
-               String defaultSelection = selection;
+    @Override
+    protected void loadDebuggerComboBox(ILaunchConfiguration config,
+            String selection) {
+        ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault()
+                .getDebugConfigurations();
+        String defaultSelection = selection;
 
-               List<ICDebugConfiguration> list = new ArrayList<ICDebugConfiguration>();
-               for(int i = 0; i < debugConfigs.length; i++) {
-                       ICDebugConfiguration configuration = debugConfigs[i];
-                       if(configuration.getID().equals(TizenLaunchConfigurationConstants.DEBUGGER_ID))  {
-                               list.add(configuration);
-                               defaultSelection = configuration.getID();
-                       }
-               }
-               setInitializeDefault(defaultSelection.equals("") ? true : false);
-               loadDebuggerCombo((ICDebugConfiguration[])list.toArray(new ICDebugConfiguration[list.size()]), defaultSelection);
-       }
+        List<ICDebugConfiguration> list = new ArrayList<ICDebugConfiguration>();
+        for (int i = 0; i < debugConfigs.length; i++) {
+            ICDebugConfiguration configuration = debugConfigs[i];
+            if (configuration.getID().equals(
+                    TizenLaunchConfigurationConstants.DEBUGGER_ID)) {
+                list.add(configuration);
+                defaultSelection = configuration.getID();
+            }
+        }
+        setInitializeDefault(defaultSelection.equals("") ? true : false);
+        loadDebuggerCombo(
+                (ICDebugConfiguration[]) list.toArray(new ICDebugConfiguration[list
+                        .size()]), defaultSelection);
+    }
 }
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationForAttachTabGroup.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationForAttachTabGroup.java
new file mode 100644 (file)
index 0000000..1fa397a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+
+public class TizenLaunchConfigurationForAttachTabGroup extends AbstractLaunchConfigurationTabGroup {
+       @Override
+    public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+       ILaunchConfigurationTab[] tabs = null;
+               tabs = new ILaunchConfigurationTab[] { new TizenDebuggerTab(true), new SourceLookupTab() };
+       setTabs(tabs);
+    }
+}
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationForCoreTabGroup.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationForCoreTabGroup.java
new file mode 100644 (file)
index 0000000..16b5b3e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+
+public class TizenLaunchConfigurationForCoreTabGroup extends AbstractLaunchConfigurationTabGroup {
+       @Override
+       public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+       ILaunchConfigurationTab[] tabs = null;
+               tabs = new ILaunchConfigurationTab[] { new TizenDebuggerForCoreTab(), new SourceLookupTab() };
+       setTabs(tabs);
+    }
+}
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationTabGroup.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenLaunchConfigurationTabGroup.java
new file mode 100644 (file)
index 0000000..8279f67
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+
+public class TizenLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
+       @Override
+       public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+       ILaunchConfigurationTab[] tabs = null;
+
+       if (mode.equals("debug"))
+                       tabs = new ILaunchConfigurationTab[] { new TizenDebuggerTab(false), new SourceLookupTab() };
+               else
+                       tabs = new ILaunchConfigurationTab[] { };
+
+       setTabs(tabs);
+    }
+}
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenMainTab.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/TizenMainTab.java
new file mode 100644 (file)
index 0000000..cc8c1f7
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.LaunchUtils;
+import org.eclipse.cdt.launch.ui.CMainTab;
+import org.eclipse.cdt.ui.newui.CDTPropertyManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
+import org.tizen.nativecommon.launch.TizenLaunchMessages;
+
+
+public class TizenMainTab extends CMainTab {
+       public void createControl(Composite parent) {
+               Composite comp = new Composite(parent, SWT.NONE);
+               setControl(comp);
+
+               GridLayout topLayout = new GridLayout();
+               comp.setLayout(topLayout);
+
+               createVerticalSpacer(comp, 1);
+               createExeFileGroup(comp, 1);
+               createProjectGroup(comp, 1);
+               createBuildOptionGroup(comp, 1);
+               createVerticalSpacer(comp, 1);
+       }
+
+       /**
+        * Override for find binary file that is matched to build configuration name.
+        */
+       @Override
+       protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
+               boolean renamed = false;
+               String buildConfigName = "";
+
+               if (!(cElement instanceof IBinary))
+                       cElement = cElement.getCProject();
+               if (cElement instanceof ICProject) {
+                       IProject project = cElement.getCProject().getProject();
+                       String name = project.getName();
+                       ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
+                       if (projDes != null) {
+                               buildConfigName = projDes.getActiveConfiguration().getName();
+                               name = NLS.bind(TizenLaunchMessages.TizenMainTab_Configuration_name, name, buildConfigName);
+                       }
+                       name = getLaunchConfigurationDialog().generateName(name);
+                       config.rename(name);
+                       renamed = true;
+               }
+
+               IBinary binary = null;
+               if (cElement instanceof ICProject) {
+                       IBinary[] bins = getBinaryFiles((ICProject)cElement);
+                       if (bins != null && bins.length == 1) {
+                               binary = bins[0];
+                       } else {
+                               for (int i = 0; i < bins.length; i++) {
+                                       IPath binaryPath = bins[i].getPath();
+                                       String parentDirName = binaryPath.removeLastSegments(1).lastSegment();
+                                       if (parentDirName.equals(buildConfigName) &&
+                                               binaryPath.lastSegment().equals(cElement.toString()))
+                                               binary = bins[i];
+                               }
+                       }
+               } else if (cElement instanceof IBinary) {
+                       binary = (IBinary)cElement;
+               }
+
+               if (binary != null) {
+                       String path;
+                       path = binary.getResource().getProjectRelativePath().toOSString();
+                       config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, path);
+                       if (!renamed) {
+                               String name = binary.getElementName();
+                               int index = name.lastIndexOf('.');
+
+                               if (index > 0)
+                                       name = name.substring(0, index);
+
+                               name = getLaunchConfigurationDialog().generateName(name);
+                               config.rename(name);
+                               renamed = true;
+                       }
+               }
+               
+               if (!renamed) {
+                       String name = getLaunchConfigurationDialog().generateName(cElement.getCProject().getElementName());
+                       config.rename(name);
+               }
+       }
+
+       @Override
+       public void performApply(ILaunchConfigurationWorkingCopy config) {
+               super.performApply(config);
+               if (fBuildConfigCombo != null) {
+                       config.setAttribute(TizenLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_NAME, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex()) + "name"));
+               }
+       }
+       
+       @Override
+       protected void updateBuildConfigCombo(String selectedConfigID) {
+               if (fBuildConfigCombo != null) {
+                       fBuildConfigCombo.setEnabled(!fBuildConfigAuto.getSelection());
+                       fBuildConfigCombo.removeAll();
+                       fBuildConfigCombo.add(TizenLaunchMessages.TizenMainTab_Use_Active); 
+                       fBuildConfigCombo.setData("0", EMPTY_STRING); //$NON-NLS-1$
+                       fBuildConfigCombo.select(0);
+                       ICProject cproject = getCProject();
+                       if (cproject != null) {
+                               ICProjectDescription projDes = CDTPropertyManager.getProjectDescription(cproject.getProject());
+                               if (projDes != null) {
+                                       // Find the config that should be automatically selected
+                                       String autoConfigId = null;
+                                       if (fBuildConfigAuto.getSelection()) {
+                                               ICConfigurationDescription autoConfig = LaunchUtils.getBuildConfigByProgramPath(cproject.getProject(), fProgText.getText());
+                                               if (autoConfig != null)
+                                                       autoConfigId = autoConfig.getId();
+                                       }
+
+                                       int selIndex = 0;
+                                       ICConfigurationDescription[] configurations = projDes.getConfigurations();
+                                       ICConfigurationDescription selectedConfig = projDes.getConfigurationById(selectedConfigID);
+                                       for (int i = 0; i < configurations.length; i++) {
+                                               String configName = configurations[i].getName();
+                                               fBuildConfigCombo.add(configName);
+                                               fBuildConfigCombo.setData(Integer.toString(i + 1), configurations[i].getId());
+                                               fBuildConfigCombo.setData(Integer.toString(i + 1) + "name", configurations[i].getName());
+                                               if (selectedConfig != null && selectedConfigID.equals(configurations[i].getId()) ||
+                                                       fBuildConfigAuto.getSelection() && configurations[i].getId().equals(autoConfigId)) {
+                                                       selIndex = i + 1;
+                                               }
+                                       }
+                                       fBuildConfigCombo.select(selIndex);
+                               }
+                       }
+               }       
+       }
+
+}
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationAttachLaunchShortcut.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationAttachLaunchShortcut.java
new file mode 100644 (file)
index 0000000..3d49dbb
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui.shortcut;
+
+import org.eclipse.debug.core.ILaunchConfigurationType;
+
+
+public class TizenApplicationAttachLaunchShortcut extends TizenLaunchShortcut {
+
+       @Override
+       protected ILaunchConfigurationType getCLaunchConfigType() {
+               return getLaunchManager().getLaunchConfigurationType("org.tizen.nativecommon.launch.TizenAttachConfigurationType");
+       }
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationCoredumpLaunchShortcut.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationCoredumpLaunchShortcut.java
new file mode 100644 (file)
index 0000000..41d8e65
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui.shortcut;
+
+import org.eclipse.debug.core.ILaunchConfigurationType;
+
+
+public class TizenApplicationCoredumpLaunchShortcut extends TizenLaunchShortcut {
+
+       @Override
+       protected ILaunchConfigurationType getCLaunchConfigType() {
+               return getLaunchManager().getLaunchConfigurationType("org.tizen.nativecommon.launch.TizenCoredumpConfigurationType");
+       }
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationLaunchShortcut.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenApplicationLaunchShortcut.java
new file mode 100644 (file)
index 0000000..3650eb8
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui.shortcut;
+
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.tizen.nativecommon.launch.ui.shortcut.TizenLaunchShortcut;
+
+
+public class TizenApplicationLaunchShortcut extends TizenLaunchShortcut {
+
+       @Override
+       protected ILaunchConfigurationType getCLaunchConfigType() {
+               return getLaunchManager().getLaunchConfigurationType("org.tizen.nativecommon.launch.TizenLaunchConfigurationType");
+       }
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenLaunchShortcut.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/launch/ui/shortcut/TizenLaunchShortcut.java
new file mode 100644 (file)
index 0000000..3fd8bb8
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+* NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+* Yoonki Park <yoonki.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.nativecommon.launch.ui.shortcut;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.internal.ui.launch.CApplicationLaunchShortcut;
+import org.eclipse.cdt.debug.internal.ui.launch.LaunchMessages;
+import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
+
+
+public class TizenLaunchShortcut extends CApplicationLaunchShortcut {
+
+    @Override
+    public void launch(IEditorPart editor, String mode) {
+        searchAndLaunch(new Object[] { editor.getEditorInput()}, mode);
+    }
+
+    @Override
+    public void launch(ISelection selection, String mode) {
+        if (selection instanceof IStructuredSelection) {
+            searchAndLaunch(((IStructuredSelection) selection).toArray(), mode);
+        }
+    }
+
+    private void searchAndLaunch(final Object[] elements, String mode) {
+        if (elements != null && elements.length > 0) {
+            IBinary bin = null;
+            if (elements.length == 1 && elements[0] instanceof IBinary) {
+                bin = (IBinary)elements[0];
+            } else {
+                final List results = new ArrayList();
+                ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
+                IRunnableWithProgress runnable = new IRunnableWithProgress() {
+                    public void run(IProgressMonitor pm) throws InterruptedException {
+                        int nElements = elements.length;
+                        pm.beginTask("Looking for executables", nElements); //$NON-NLS-1$
+                        try {
+                            IProgressMonitor sub = new SubProgressMonitor(pm, 1);
+                            for (int i = 0; i < nElements; i++) {
+                                if (elements[i] instanceof IAdaptable) {
+                                    IResource r = (IResource) ((IAdaptable) elements[i]).getAdapter(IResource.class);
+                                    if (r != null) {
+                                        ICProject cproject = CoreModel.getDefault().create(r.getProject());
+                                        if (cproject != null) {
+                                            try {
+                                                IBinary[] bins = cproject.getBinaryContainer().getBinaries();
+                                                IConfiguration config = ManagedBuildManager.getBuildInfo(r.getProject()).getDefaultConfiguration();
+                                                String activeBuildConfiguration = config.toString();
+
+                                                for (int j = 0; j < bins.length; j++) {
+                                                    if (bins[j].isExecutable() || bins[j].isSharedLib()) {
+                                                        String parentDirName = bins[j].getPath().removeLastSegments(1).lastSegment();
+                                                        if (parentDirName.equals(activeBuildConfiguration))
+                                                            results.add(bins[j]);
+                                                    }
+                                                }
+                                            } catch (CModelException e) {
+                                            }
+                                        }
+                                    }
+                                }
+                                if (pm.isCanceled()) {
+                                    throw new InterruptedException();
+                                }
+                                sub.done();
+                            }
+                        } finally {
+                            pm.done();
+                        }
+                    }
+                };
+                try {
+                    dialog.run(true, true, runnable);
+                } catch (InterruptedException e) {
+                    return;
+                } catch (InvocationTargetException e) {
+                    MessageDialog.openError(getShell(), LaunchMessages.getString("CApplicationLaunchShortcut.Application_Launcher"), e.getMessage()); //$NON-NLS-1$
+                    return;
+                }
+                int count = results.size();
+                if (count == 0) {
+                    MessageDialog.openError(getShell(), LaunchMessages.getString("CApplicationLaunchShortcut.Application_Launcher"), LaunchMessages.getString("CApplicationLaunchShortcut.Launch_failed_no_binaries")); //$NON-NLS-1$ //$NON-NLS-2$
+                } else if (count > 1) {
+                    bin = chooseBinary(results, mode);
+                } else {
+                    bin = (IBinary)results.get(0);
+                }
+            }
+            if (bin != null) {
+                launch(bin, mode);
+            }
+        } else {
+            MessageDialog.openError(getShell(), LaunchMessages.getString("CApplicationLaunchShortcut.Application_Launcher"), LaunchMessages.getString("CApplicationLaunchShortcut.Launch_failed_no_project_selected")); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+    }
+
+    @Override
+    protected ILaunchConfiguration findLaunchConfiguration(IBinary bin, String mode) {
+        ILaunchConfiguration configuration = null;
+        ILaunchConfigurationType configType = getCLaunchConfigType();
+        List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
+        try {
+            ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
+            candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
+            for (int i = 0; i < configs.length; i++) {
+                ILaunchConfiguration config = configs[i];
+                IPath programPath = CDebugUtils.getProgramPath(config);
+                String projectName = CDebugUtils.getProjectName(config);
+                IPath name = bin.getResource().getProjectRelativePath();
+                if (programPath != null && programPath.equals(name)) {
+                    if (projectName != null && projectName.equals(bin.getCProject().getProject().getName())) {
+                        candidateConfigs.add(config);
+                    }
+                }
+            }
+        } catch (CoreException e) {
+            CDebugUIPlugin.log(e);
+        }
+
+        int candidateCount = candidateConfigs.size();
+        if (candidateCount < 1) {
+            // No chooseDebugConfig()
+            configuration = createConfiguration(bin, mode);
+        } else if (candidateCount == 1) {
+            configuration = candidateConfigs.get(0);
+        } else {
+            // TODO: does it happen? If then,
+            configuration = createConfiguration(bin, mode);
+        }
+        return configuration;
+    }
+
+    private ILaunchConfiguration createConfiguration(IBinary bin, String mode) {
+        ILaunchConfiguration config = null;
+        try {
+            String projectName = bin.getResource().getProjectRelativePath().toString();
+            ILaunchConfigurationType configType = getCLaunchConfigType();
+            ILaunchConfigurationWorkingCopy wc =
+                configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(bin.getElementName()));
+            wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, projectName);
+            wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, bin.getCProject().getElementName());
+            wc.setMappedResources(new IResource[] {bin.getResource().getProject()});
+            wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "");
+            wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, TizenLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
+            wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+            wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, TizenLaunchConfigurationConstants.DEBUGGER_ID);
+            wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, TizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
+            wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, TizenLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
+
+
+            ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(bin.getCProject().getProject());
+            if (projDes != null) {
+                String buildConfigID = projDes.getActiveConfiguration().getId();
+                wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID);
+                String buildConfigName = projDes.getActiveConfiguration().getName();
+                wc.setAttribute(TizenLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_NAME, buildConfigName);
+            }
+
+            config = wc.doSave();
+        } catch (CoreException ce) {
+            CDebugUIPlugin.log(ce);
+        }
+        return config;
+    }
+
+    @Override
+    protected ILaunchConfigurationType getCLaunchConfigType() {
+        return getLaunchManager().getLaunchConfigurationType("org.tizen.nativecommon.launch.TizenLaunchConfigurationType");
+    }
+}
index 34d3e23..26a2d53 100644 (file)
@@ -61,141 +61,166 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.QualifiedName;
 
-public class TizenCreateSourceFolder extends ProcessRunner {   
-       Map<IProject, Long> map = new HashMap<IProject, Long>();
-       
-       public static QualifiedName SOURCEDIR_KEY = new QualifiedName("RegistSrcDir", "RegistSrcDir"); 
-       boolean alreadyRegist = false;
-       
-       @Override
-       public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
-                       throws ProcessFailureException {
-               
-               String projectName = args[0].getSimpleValue();
-               String targetPath = args[1].getSimpleValue();           
-               String value = "";
-               
-               try {
-                       if (processId.contains(" Process 1 ")) {                
-                               IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);                      
-                               value = projectHandle.getPersistentProperty(SOURCEDIR_KEY);             
-                       
-                               if (value == null) {
-                                       projectHandle.setPersistentProperty(SOURCEDIR_KEY, "true");                             
-                                       alreadyRegist = false;
-                               } else if (value.equals("true")) {
-                                       alreadyRegist = true;
-                               }
-                       }
-               
-                       if (!alreadyRegist) {
-                               createSourceFolder(projectName, targetPath, monitor);
-                       }               
-               } catch (CoreException e) {
-                       e.printStackTrace();
-               }
-       }
-       
-       protected void createSourceFolder(String projectName, String targetPath, IProgressMonitor monitor) throws ProcessFailureException {
-               //If the targetPath is an empty string, there will be no source folder to create.
-               // Also this is not an error. So just return gracefully.
-               if (targetPath == null || targetPath.length()==0) {
-                       return;
-               }
-               
-               IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-               
-               if (!projectHandle.exists()) {
-                       throw new ProcessFailureException(Messages.getString("CreateSourceFolder.0") + projectName); //$NON-NLS-1$
-               }
-
-               CreateFolder.createFolder(projectName, targetPath, monitor);
-
-               IPath projPath = projectHandle.getFullPath();
-               IFolder folder = projectHandle.getFolder(targetPath);
-
-               try {
-                       ICProject cProject = CoreModel.getDefault().create(projectHandle);
-                       if (cProject != null) {
-                               if(CCorePlugin.getDefault().isNewStyleProject(cProject.getProject())){
-                                       //create source folder for new style project
-                                       createNewStyleProjectFolder(monitor, projectHandle, folder);
-                               } else {
-                                       //create source folder for all other projects 
-                                       createFolder(targetPath, monitor, projPath, cProject);
-                               }
-                       }
-               } catch (WriteAccessException e) {
-                       throw new ProcessFailureException(Messages.getString("CreateSourceFolder.2") + e.getMessage(), e); //$NON-NLS-1$
-               } catch (CoreException e) {
-                       throw new ProcessFailureException(Messages.getString("CreateSourceFolder.2") + e.getMessage(), e); //$NON-NLS-1$
-               }
-       }
-
-       /**
-        * @param monitor
-        * @param projectHandle
-        * @param folder
-        * @throws CoreException
-        * @throws WriteAccessException
-        */
-       private void createNewStyleProjectFolder(IProgressMonitor monitor, IProject projectHandle, IFolder folder) throws CoreException, WriteAccessException {
-               ICSourceEntry newEntry = new CSourceEntry(folder, null, 0); 
-               ICProjectDescription description = CCorePlugin.getDefault().getProjectDescription(projectHandle);               
-
-               ICConfigurationDescription configs[] = description.getConfigurations();         
-               for(int i=0; i < configs.length; i++){
-                       ICConfigurationDescription config = configs[i];                 
-                       ICSourceEntry[] entries = config.getSourceEntries();
-                       Set<ICSourceEntry> set = new HashSet<ICSourceEntry>();
-                       for (int j=0; j < entries.length; j++) {
-                               if(new Path(entries[j].getValue()).segmentCount() == 1)
-                                       continue;
-                               set.add(entries[j]);
-                       }
-                       set.add(newEntry);                      
-
-                       config.setSourceEntries(set.toArray(new ICSourceEntry[set.size()]));                    
-               }
-               
-               CCorePlugin.getDefault().setProjectDescription(projectHandle, description, false, monitor);
-       }
-
-       /**
-        * @param targetPath
-        * @param monitor
-        * @param projPath
-        * @param cProject
-        * @throws CModelException
-        */
-       private void createFolder(String targetPath, IProgressMonitor monitor, IPath projPath, ICProject cProject) throws CModelException {
-               IPathEntry[] entries = cProject.getRawPathEntries();
-               List<IPathEntry> newEntries = new ArrayList<IPathEntry>(entries.length + 1);
-
-               int projectEntryIndex= -1;
-               IPath path = projPath.append(targetPath);
-
-               for (int i = 0; i < entries.length; i++) {
-                       IPathEntry curr = entries[i];
-                       if (path.equals(curr.getPath())) {
-                               // just return if this folder exists already
-                               return;
-                       }
-                       if (projPath.equals(curr.getPath())) {
-                               projectEntryIndex = i;
-                       }       
-                       newEntries.add(curr);
-               }
-
-               IPathEntry newEntry = CoreModel.newSourceEntry(path);
-
-               if (projectEntryIndex != -1) {
-                       newEntries.set(projectEntryIndex, newEntry);
-               } else {
-                       newEntries.add(CoreModel.newSourceEntry(path));
-               }
-
-               cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor);
-       }
+public class TizenCreateSourceFolder extends ProcessRunner {    
+    Map<IProject, Long> map = new HashMap<IProject, Long>();
+    
+    public static QualifiedName SOURCEDIR_KEY = new QualifiedName("RegistSrcDir", "RegistSrcDir"); 
+    boolean alreadyRegist = false;
+    
+    @Override
+    public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+            throws ProcessFailureException {
+
+        //args is the arguments of the process. Each element in array represent one argument.
+        //In this case, args[0] is projectName, and args[1] is pathList.
+        String projectName = args[0].getSimpleValue();
+        
+        ProcessArgument[][] targetPathListInfo = args[1].getComplexArrayValue();
+        List<String> targetPathList = new ArrayList<String>();
+        
+        for( ProcessArgument[] pathInfo : targetPathListInfo ) {
+            //Type of complex array is ProcessArgument[][]. Each array ProcessArgument[] in complex array represent one complex element.
+            //complex element consists simple, simple array, complex array.
+            //In this case, targetPathListInfo[n][0] means path of n-th element.
+            //path is simple value. Therefore, we should retrieve getSimpleValue method to retrieve it.
+            String targetPath = pathInfo[0].getSimpleValue();
+            
+            if (targetPath != null && targetPath.length() > 0) {
+                targetPathList.add(targetPath);
+            }
+        }
+        
+        String value = "";
+        
+        try {
+            if (processId.contains(" Process 1 ")) {        
+                IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);            
+                value = projectHandle.getPersistentProperty(SOURCEDIR_KEY);        
+            
+                if (value == null) {
+                    projectHandle.setPersistentProperty(SOURCEDIR_KEY, "true");                
+                    alreadyRegist = false;
+                } else if (value.equals("true")) {
+                    alreadyRegist = true;
+                }
+            }
+        
+            if (!alreadyRegist) {
+                createSourceFolders(projectName, targetPathList, monitor);
+            }
+        } catch (CoreException e) {
+            e.printStackTrace();
+        }
+    }
+    
+    public static void createSourceFolders(String projectName, List<String> targetPathList, IProgressMonitor monitor) throws ProcessFailureException {
+        
+        IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+        
+        if (!projectHandle.exists()) {
+            throw new ProcessFailureException(Messages.getString("CreateSourceFolder.0") + projectName); //$NON-NLS-1$
+        }
+        
+        IPath projPath = projectHandle.getFullPath();
+        
+        for(String targetPath: targetPathList) {
+            CreateFolder.createFolder(projectName, targetPath, monitor);
+        }
+        
+        try {
+            ICProject cProject = CoreModel.getDefault().create(projectHandle);
+            if (cProject != null) {
+                if(CCorePlugin.getDefault().isNewStyleProject(cProject.getProject())){
+                    //create source folder for new style project
+                    createNewStyleProjectFolders(monitor, projectHandle, targetPathList);
+                } else {
+                    //create source folder for all other projects 
+                    for(String targetPath: targetPathList) {
+                        createFolders(targetPath, monitor, projPath, cProject);
+                    }
+                }
+            }
+        } catch (WriteAccessException e) {
+            throw new ProcessFailureException(Messages.getString("CreateSourceFolder.2") + e.getMessage(), e); //$NON-NLS-1$
+        } catch (CoreException e) {
+            throw new ProcessFailureException(Messages.getString("CreateSourceFolder.2") + e.getMessage(), e); //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * @param monitor
+     * @param projectHandle
+     * @param folder
+     * @throws CoreException
+     * @throws WriteAccessException
+     */
+    private static void createNewStyleProjectFolders(IProgressMonitor monitor, IProject projectHandle, List<String> targetPathList) throws CoreException, WriteAccessException {
+        
+        ICProjectDescription description = CCorePlugin.getDefault().getProjectDescription(projectHandle);
+        ICConfigurationDescription configs[] = description.getConfigurations();
+        List<ICSourceEntry> newFolderList = new ArrayList<ICSourceEntry>();
+        
+        for(String targetPath: targetPathList) {
+            ICSourceEntry newEntry = new CSourceEntry(projectHandle.getFolder(targetPath), null, 0);
+            newFolderList.add(newEntry);
+        }
+        
+        for(int i=0; i < configs.length; i++){
+            Set<ICSourceEntry> newSet = new HashSet<ICSourceEntry>();
+            ICConfigurationDescription config = configs[i];            
+            ICSourceEntry[] entries = config.getSourceEntries();
+            
+            for (int j=0; j < entries.length; j++) {
+                if(new Path(entries[j].getValue()).segmentCount() == 1)
+                    continue;
+                newSet.add(entries[j]);
+            }
+            
+            for(ICSourceEntry newFolder: newFolderList) {
+                newSet.add(newFolder);
+            }
+            
+            config.setSourceEntries(newSet.toArray(new ICSourceEntry[newSet.size()]));
+        }
+        
+        CCorePlugin.getDefault().setProjectDescription(projectHandle, description, false, monitor);
+    }
+
+    /**
+     * @param targetPath
+     * @param monitor
+     * @param projPath
+     * @param cProject
+     * @throws CModelException
+     */
+    private static void createFolders(String targetPath, IProgressMonitor monitor, IPath projPath, ICProject cProject) throws CModelException {
+        IPathEntry[] entries = cProject.getRawPathEntries();
+        List<IPathEntry> newEntries = new ArrayList<IPathEntry>(entries.length + 1);
+
+        int projectEntryIndex= -1;
+        IPath path = projPath.append(targetPath);
+
+        for (int i = 0; i < entries.length; i++) {
+            IPathEntry curr = entries[i];
+            if (path.equals(curr.getPath())) {
+                // just return if this folder exists already
+                return;
+            }
+            if (projPath.equals(curr.getPath())) {
+                projectEntryIndex = i;
+            }    
+            newEntries.add(curr);
+        }
+
+        IPathEntry newEntry = CoreModel.newSourceEntry(path);
+
+        if (projectEntryIndex != -1) {
+            newEntries.set(projectEntryIndex, newEntry);
+        } else {
+            newEntries.add(CoreModel.newSourceEntry(path));
+        }
+
+        cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor);
+    }
 
 }
index 7f49ad2..b520dba 100644 (file)
@@ -1,31 +1,34 @@
 /*
  * NativeApp
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Hoon Kang <h245.kang@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
-*
-*/
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hoon Kang <h245.kang@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.nativecommon.ui;
 
 import java.util.ArrayList;
 
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
@@ -39,154 +42,194 @@ import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
 import org.tizen.common.util.OSChecker;
+import org.tizen.common.util.SWTUtil;
 import org.tizen.nativecommon.ProjectUtil;
 import org.tizen.nativecommon.build.CurrentEnabledProject;
 import org.tizen.nativecommon.ui.actions.ConfigurationActionManager;
 import org.tizen.nativecommon.ui.actions.IConfigurationListener;
 
-
-public class ConfigurationCombo extends WorkbenchWindowControlContribution {
-
-       private Combo configurationCombo = null;
-       private ArrayList<String> configurations = new ArrayList<String>();
-       private IProject project = null;
-       private static final String FRESHIDE_PERSPECTIVE_ID = "org.tizen.nativeapp.perspective";
-
-       /*
-       private IProjectListener listener = new IProjectListener() {
-               public void SelectedProjectChanged(IProject _project) {
-                       if (_project != null) {
-                               project = _project;
-                               setConfigurationList(project);
-                               setDefaultSelection(project);
-                       }
-               }
-       };*/
-
-       private ISelectionListener listener = new ISelectionListener() {
-
-               @Override
-               public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection) {
-                       String perspectiveID = sourcepart.getSite().getPage().getPerspective().getId();
-                       if (!perspectiveID.equals(FRESHIDE_PERSPECTIVE_ID)) {
-                               return;
-                       }
-
-                       if( !("Project Explorer".equals(sourcepart.getTitle()) || "Navigator".equals(sourcepart.getTitle()) || sourcepart instanceof IEditorPart) ){
-                               return;
-                       }
-                       project = ProjectUtil.getProject(sourcepart, selection);
-
-                       setConfigurationList(project);
-
-                       CurrentEnabledProject.setCurrentProject(project);
-               }
-       };
-
-       private IConfigurationListener cListener = new IConfigurationListener()
-       {
-               @Override
-               public void ConfigurationChanged() {
-               }
-
-               @Override
-               public void SelectionChanged(String configName) {
-                       int index = configurations.indexOf(configName);
-                       configurationCombo.select(index);
-               }
-       };
-
-
-       public ConfigurationCombo() {
-               // TODO Auto-generated constructor stub
-               ConfigurationActionManager.addDeviceListener(cListener);
-       }
-
-       public ConfigurationCombo(String id) {
-               super(id);
-               // TODO Auto-generated constructor stub
-       }
-
-       @Override
-       protected Control createControl(Composite parent) {
-
-               this.getWorkbenchWindow().getSelectionService().addSelectionListener(listener);
-               //CurrentEnabledProject.addProjectListener(listener);
-
-               configurationCombo = new Combo(parent, SWT.READ_ONLY);
-
-               if ( OSChecker.isWindows()) {
-                       FontData[] fontData = configurationCombo.getFont().getFontData();
-                       for( FontData font : fontData){
-                               font.setHeight(font.getHeight() - 1);
-                       }
-
-                       Font font = new Font(configurationCombo.getDisplay(), fontData);
-                       configurationCombo.setFont(font);
-               }
-
-               project = ProjectUtil.getProject();
-               setConfigurationList(project);
-
-               configurationCombo.setToolTipText("Configurations");
-               configurationCombo.addSelectionListener(new SelectionListener() {
-
-                       @Override
-                       public void widgetSelected(SelectionEvent e) {
-                               String configName = configurationCombo.getText();
-                               setActiveConfiguration(configName);
-                       }
-
-                       @Override
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-               });
-
-               return configurationCombo;
-       }
-
-       private void resetConfiguration() {
-               configurations.clear();
-               configurationCombo.removeAll();
-               configurationCombo.add("                              ");
-       }
-
-       private void setConfigurationList(IProject project) {
-               configurations.clear();
-
-               if (project != null) {
-                       IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project );
-                       String[] confs = info.getConfigurationNames();
-                       for (String config : confs) {
-                               configurations.add(config);
-                       }
-                       configurationCombo.setItems(configurations.toArray(new String[0]));
-                       setDefaultSelection(project);
-               } else {
-                       resetConfiguration();
-               }
-       }
-
-       private void setDefaultSelection(IProject project) {
-               if (project != null) {
-                       IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project );
-                       IConfiguration config = info.getDefaultConfiguration();
-                       String configName = config.getName();
-                       int index = configurations.indexOf(configName);
-                       configurationCombo.select(index);
-               }
-       }
-
-       private void setActiveConfiguration(String configName) {
-               if (project == null) {
-                       return;
-               }
-
-               ManagedBuildManager.getBuildInfo( project ).setDefaultConfiguration(configName);
-       }
+public class ConfigurationCombo extends WorkbenchWindowControlContribution
+{
+
+    private Combo configurationCombo = null;
+    private ArrayList<String> configurations = new ArrayList<String>();
+    private IProject project = null;
+    private static final String FRESHIDE_PERSPECTIVE_ID = "org.tizen.nativeapp.perspective";
+
+    /*
+     * private IProjectListener listener = new IProjectListener() { public void
+     * SelectedProjectChanged(IProject _project) { if (_project != null) {
+     * project = _project; setConfigurationList(project);
+     * setDefaultSelection(project); } } };
+     */
+
+    private ISelectionListener listener = new ISelectionListener()
+    {
+
+        @Override
+        public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection)
+        {
+            String perspectiveID = sourcepart.getSite().getPage().getPerspective().getId();
+            if (!perspectiveID.equals(FRESHIDE_PERSPECTIVE_ID))
+            {
+                return;
+            }
+
+            if (!("Project Explorer".equals(sourcepart.getTitle())
+                    || "Navigator".equals(sourcepart.getTitle()) || sourcepart instanceof IEditorPart))
+            {
+                return;
+            }
+
+            project = ProjectUtil.getProject(sourcepart, selection);
+
+            if (project != null)
+            {
+                setConfigurationList(project);
+            }
+
+            CurrentEnabledProject.setCurrentProject(project);
+        }
+    };
+
+    private IConfigurationListener cListener = new IConfigurationListener()
+    {
+        @Override
+        public void ConfigurationChanged()
+        {}
+
+        @Override
+        public void SelectionChanged(String configName)
+        {
+            int index = configurations.indexOf(configName);
+            configurationCombo.select(index);
+        }
+    };
+
+    private ICProjectDescriptionListener prjListner = new ICProjectDescriptionListener()
+    {
+
+        @Override
+        public void handleEvent(CProjectDescriptionEvent event)
+        {
+            final String appliedConfigName = event.getAppliedCProjectDescription()
+                    .getActiveConfiguration().getName();
+            SWTUtil.getDisplay().asyncExec( new Runnable() {
+                @Override
+                public void run() {
+                    configurationCombo.select(configurationCombo.indexOf(appliedConfigName));
+                }
+            });
+        }
+    };
+
+    public ConfigurationCombo()
+    {
+        ConfigurationActionManager.addDeviceListener(cListener);
+        CoreModel.getDefault().addCProjectDescriptionListener(prjListner,
+                CProjectDescriptionEvent.DATA_APPLIED);
+    }
+
+    public ConfigurationCombo(String id)
+    {
+        super(id);
+    }
+
+    @Override
+    protected Control createControl(Composite parent)
+    {
+
+        this.getWorkbenchWindow().getSelectionService().addSelectionListener(listener);
+        // CurrentEnabledProject.addProjectListener(listener);
+
+        configurationCombo = new Combo(parent, SWT.READ_ONLY);
+
+        if (OSChecker.isWindows())
+        {
+            FontData[] fontData = configurationCombo.getFont().getFontData();
+            for (FontData font : fontData)
+            {
+                font.setHeight(font.getHeight() - 1);
+            }
+
+            Font font = new Font(configurationCombo.getDisplay(), fontData);
+            configurationCombo.setFont(font);
+        }
+
+        project = ProjectUtil.getProject();
+        setConfigurationList(project);
+
+        configurationCombo.setToolTipText("Configurations");
+        configurationCombo.addSelectionListener(new SelectionListener()
+        {
+
+            @Override
+            public void widgetSelected(SelectionEvent e)
+            {
+                String configName = configurationCombo.getText();
+                setActiveConfiguration(configName);
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e)
+            {}
+        });
+
+        return configurationCombo;
+    }
+
+    private void resetConfiguration()
+    {
+        configurations.clear();
+        configurationCombo.removeAll();
+        configurationCombo.add("                              ");
+    }
+
+    private void setConfigurationList(IProject project)
+    {
+        configurations.clear();
+
+        if (project != null)
+        {
+            IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+            String[] confs = info.getConfigurationNames();
+            for (String config : confs)
+            {
+                configurations.add(config);
+            }
+            configurationCombo.setItems(configurations.toArray(new String[0]));
+            setDefaultSelection(project);
+        } else
+        {
+            resetConfiguration();
+        }
+    }
+
+    private void setDefaultSelection(IProject project)
+    {
+        if (project != null)
+        {
+            IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+            IConfiguration config = info.getDefaultConfiguration();
+            String configName = config.getName();
+            int index = configurations.indexOf(configName);
+            configurationCombo.select(index);
+        }
+    }
+
+    private void setActiveConfiguration(String configName)
+    {
+        if (project == null)
+        {
+            return;
+        }
+
+        ManagedBuildManager.getBuildInfo(project).setDefaultConfiguration(configName);
+    }
 }
index 6dbbbd6..25c6613 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * NativeApp
+ * NativeCommon
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
 * YoonKi Park <yoonki.park@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>
+* 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.
@@ -37,36 +37,39 @@ import org.eclipse.ui.navigator.resources.ProjectExplorer;
 import org.tizen.common.connection.ConnectionPlugin;
 
 
+/**
+ * This is class is initializer of Tizen Native perspective.
+ */
 public class PerspectiveFactory implements IPerspectiveFactory {
 
-       /**
-        * Constructs a new Default layout.
-        */
-       public PerspectiveFactory() {
-               super();
-       }
+    /**
+     * Constructs a new Default layout.
+     */
+    public PerspectiveFactory() {
+        super();
+    }
 
-       public void createInitialLayout(IPageLayout layout) {
-               String editorArea = layout.getEditorArea();
-               
-               IFolderLayout folder= layout.createFolder("topLeft", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
-               folder.addView(ProjectExplorer.VIEW_ID);
-               folder.addPlaceholder(CUIPlugin.CVIEW_ID);
-               folder.addPlaceholder(IPageLayout.ID_RES_NAV);
-               folder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
-               
-               folder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
-               folder.addView(IPageLayout.ID_PROBLEM_VIEW);
-               folder.addView(IPageLayout.ID_TASK_LIST);
-               folder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
-               layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
-               layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
-               layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
-               layout.addShowViewShortcut(ConnectionPlugin.ID_CONNECTION_VIEW);
-               
-               folder= layout.createFolder("topRight", IPageLayout.RIGHT,(float)0.7, editorArea); //$NON-NLS-1$
-               folder.addView(IPageLayout.ID_OUTLINE);
-               layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
-       }       
-       
-}
+    public void createInitialLayout(IPageLayout layout) {
+        String editorArea = layout.getEditorArea();
+
+        IFolderLayout folder= layout.createFolder("topLeft", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
+        folder.addView(ProjectExplorer.VIEW_ID);
+        folder.addPlaceholder(CUIPlugin.CVIEW_ID);
+        folder.addPlaceholder(IPageLayout.ID_RES_NAV);
+        folder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+
+        folder= layout.createFolder("topRight", IPageLayout.RIGHT,(float)0.75, editorArea); //$NON-NLS-1$
+        folder.addView(IPageLayout.ID_OUTLINE);
+        layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+
+        folder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
+        folder.addView(IPageLayout.ID_PROBLEM_VIEW);
+        folder.addView(IPageLayout.ID_TASK_LIST);
+        folder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
+        layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+        layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+        layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
+        layout.addShowViewShortcut(ConnectionPlugin.ID_CONNECTION_VIEW);
+    }
+
+}
\ No newline at end of file
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/IUnitTestHandler.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/IUnitTestHandler.java
new file mode 100644 (file)
index 0000000..8e28eee
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+*  NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Kangho Kim <kh5325.kim@samsung.com>
+* Gun Kim <gune.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.nativecommon.unittest;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard;
+import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
+import org.eclipse.cdt.ui.wizards.EntryDescriptor;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.nativecommon.launch.IProjectLaunchCommand;
+
+public interface IUnitTestHandler {
+    public void setExternToHeader(String filePath, String targetProjectIncludeStr, ArrayList<IFile> addStringList) throws CoreException, IOException;
+    public String getIncludeDirectory();
+    public String getProjectNamePattern();
+    public EntryDescriptor getEmptyProjectEntryDescriptor(Composite composite, CDTMainWizardPage wizardPage, CDTCommonProjectWizard wizard);
+    public void createLibProjectFile(IProject testProject, IProgressMonitor monitor) throws CoreException, IOException;
+    public String getProjectSuffix();
+    public Image getTargetProjectIcon(IProject proj);
+    public EntryDescriptor getUnitTestProjectEntryDescriptor( EntryDescriptor[] entryDesArray);
+    public String getProjectTypeId();
+    public String getProjectTypeName();
+    public String getDynamicAnalysisOption( IConfiguration config );
+    public void setDynamicAnalysisOption( IConfiguration config, String option );
+    public void appendIncludePathToCCompiler( IConfiguration config, String includePath );
+    public void appendIncludePathToCPPCompiler( IConfiguration config, String includePath );
+    public String getAppInstallPath(IProject testProject);
+    public void postProcess(IProject project);
+    public ArrayList<IPath> getBuildObjectFiles(IProject project);
+    public ArrayList<IResource> getBuildSources(IProject project);
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestProjectInfo.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestProjectInfo.java
new file mode 100644 (file)
index 0000000..272a25f
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+*  NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Kangho Kim <kh5325.kim@samsung.com>
+* Gun Kim <gune.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.nativecommon.unittest;
+
+import org.tizen.nativecommon.build.ui.AbstractDynamicAnalysisPropertyTab;
+
+
+public class UnitTestProjectInfo {
+    private IUnitTestHandler unitTestHandler;
+    private String templateId;
+    private String buildArtifactType;
+    private String targetProjectType;
+    
+    public static final String APPLICATION_TYPE = "app";
+    public static final String STATIC_TYPE = "static";
+    public static final String SHARED_TYPE = "share";
+    
+    public UnitTestProjectInfo(){
+        
+    }
+    public UnitTestProjectInfo(IUnitTestHandler unitTestHandler, String templateId, String buildArtifactType, String projectType) {
+        this.unitTestHandler = unitTestHandler;
+        this.templateId = templateId;
+        this.buildArtifactType = buildArtifactType;
+        this.targetProjectType = projectType;
+    }
+
+    public IUnitTestHandler getUnitTestHandler(){
+        return unitTestHandler;
+    }
+    public String getTemplateId() {
+        return templateId;
+    }
+    public String getBuildArtifactType() {
+        return buildArtifactType;
+    }
+    public String getTargetProjectType() {
+        return targetProjectType;
+    }
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestRegistry.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestRegistry.java
new file mode 100644 (file)
index 0000000..8555951
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+*  NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Kangho Kim <kh5325.kim@samsung.com>
+* Gun Kim <gune.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.nativecommon.unittest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.RegistryFactory;
+import org.tizen.nativecommon.build.ui.AbstractDynamicAnalysisPropertyTab;
+
+public class UnitTestRegistry {
+    private static List<UnitTestProjectInfo> unittestProjectDB = new ArrayList<UnitTestProjectInfo>();
+    private static final String UNITTEST_HANDLER_EXTENSION = "org.tizen.nativecommon.unittest.handler";
+    
+    public static void setTargetProjectType( IUnitTestHandler unitTestHandler, String templateId, String buildArtifactType, String projectType) {
+        unittestProjectDB.add(new UnitTestProjectInfo( unitTestHandler, templateId, buildArtifactType, projectType));
+    }
+    
+    public static List<UnitTestProjectInfo> getUnitTestProjectInfoList(){
+        return unittestProjectDB;
+    }
+    
+    public static void initializeUnitTestRegistry(){
+        IExtensionRegistry registry = RegistryFactory.getRegistry();
+        IConfigurationElement[] ces = registry.getConfigurationElementsFor(UNITTEST_HANDLER_EXTENSION);
+        IUnitTestHandler handler = null;
+        String targetArtefactType = null;
+        String templateName = null;
+        String targetType = null;
+        
+        for ( IConfigurationElement ce : ces ) {
+            try {
+                handler = (IUnitTestHandler)ce.createExecutableExtension("class");
+            } catch (Exception e) {
+                continue;
+            }
+            targetArtefactType = ce.getAttribute("targetArtefactType");
+            templateName = ce.getAttribute("templateName");
+            targetType = ce.getAttribute("targetType");
+            setTargetProjectType( handler, templateName, targetArtefactType, targetType);
+            
+        }
+    }
+
+    public static UnitTestProjectInfo getUnitTestProjectInfo( String buildArtefactType ) {
+        for ( UnitTestProjectInfo info : unittestProjectDB ) {
+            if ( info.getBuildArtifactType().equals(buildArtefactType)) {
+                return info;
+            }
+        }
+        return null;
+    }
+    
+    public static UnitTestProjectInfo getUnitTestProjectInfo( IProject project ) {
+        String targetProjectType = getBuildArtefactType(project);
+        if ( targetProjectType == null)
+            return null;
+        
+        return getUnitTestProjectInfo(targetProjectType);
+    }
+    
+    public static String getBuildArtefactType( IProject project ) {
+        IManagedBuildInfo info =  ManagedBuildManager.getBuildInfo( project);
+        if ( info == null)
+            return null;
+        IConfiguration cfg =info.getDefaultConfiguration();
+        if ( cfg == null)
+            return null;
+        IManagedProject managedProject = cfg.getManagedProject();
+        if ( managedProject == null)
+            return null;
+        IProjectType projectType = managedProject.getProjectType();
+        if ( projectType == null)
+            return null;
+        IBuildPropertyValue buildArtefactType =  projectType.getBuildArtefactType();
+        if ( buildArtefactType == null)
+            return null;
+        
+        return buildArtefactType.getId();
+    }
+    
+    public static IUnitTestHandler getUnitTestHandler ( IProject project) {
+        String buildArtefactType = getBuildArtefactType(project);
+        if( buildArtefactType == null)
+            return null;
+        
+        UnitTestProjectInfo unitTestInfo = getUnitTestProjectInfo(buildArtefactType);
+        if( unitTestInfo == null ) {
+            return null;
+        }
+        return unitTestInfo.getUnitTestHandler();
+    }
+}
diff --git a/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestSettingsPage.java b/org.tizen.nativecommon/src/org/tizen/nativecommon/unittest/UnitTestSettingsPage.java
new file mode 100644 (file)
index 0000000..e95af3e
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+*  NativeCommon
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Kangho Kim <kh5325.kim@samsung.com>
+* Gun Kim <gune.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.nativecommon.unittest;
+
+import org.tizen.nativecommon.build.ui.TizenSettingsPage;
+
+public class UnitTestSettingsPage extends TizenSettingsPage {
+
+}
\ No newline at end of file
index 1184d1c..a1912ac 100755 (executable)
-#!/bin/bash -x
-
-build_path=${SRCDIR}/build_result
-
-__set_parameter()
-{
-       build_id=${package_name}
-       build_type=N
-       build_result_directory=${build_type}.${build_id}
-       build_result_path="$build_path/$build_result_directory"
-       architecture=x86
-       ide_root_path_name=IDE
-
-       case ${platform} in
-               linux)
-                       archive_platform_name=linux
-                       windowing=gtk
-                       ;;
-               windows)
-                       archive_platform_name=win32
-                       windowing=win32
-                       ;;
-               *)
-                       echo "${platform} is not support yet."
-                       ;;
-       esac
-
-       result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip
-}
-
-__set_build_parameter()
-{
-       case ${platform} in
-               linux)
-                       reference_ide_path=${ROOTDIR}/indigo-pde/eclipse
-                       ;;
-               windows)
-                       reference_ide_path=${ROOTDIR}/indigo-winpde/eclipse
-                       ;;
-               *)
-                       echo "${platform} is not support yet."
-                       ;;
-       esac
-}
-
-__set_install_parameter()
-{
-       INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${platform}/data
-}
-
-__clean_build_environment()
-{
-       if [ -d $build_path ]
-       then
-               echo "Build result directory : [$build_path]"
-       else
-               echo "Make build result directory [$build_path]"
-               mkdir -p $build_path
-       fi
-
-       echo "Remove legacy build files..."
-       if [ -d ${build_result_path}/${archive_platform_name}.${windowing}.${architecture} ]
-       then
-               rm -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}
-       fi
-       if [ -e ${build_result_path}/${result_archive_file} ]
-       then
-               rm -rf ${build_result_path}/${result_archive_file}
-       fi
-       if [ -d ${build_path}/tmp ]
-       then
-               rm -rf ${build_path}/tmp
-       fi
-
-       if [ -d ${build_path}/buildRepo ]
-       then
-               rm -rf ${build_path}/buildRepo
-       fi
-
-       rm -r ${build_path}/*.xml
-       rm -r ${build_path}/*.properties
-       rm -r ${build_path}/*.clean
-
-
-       if [ -d $build_path/plugins ]
-       then
-               echo "plugins directory recreate..."
-               rm -rf $build_path/plugins
-               mkdir $build_path/plugins
-       else
-               echo "Make plugins directory..."
-               mkdir $build_path/plugins
-       fi
-       if [ -d $build_path/features/ ]
-       then
-               echo "features directory recreate..."
-               rm -rf $build_path/features
-               mkdir $build_path/features
-       else
-               echo "Make features directory..."
-               mkdir $build_path/features
-       fi
-
-}
-
-__copy_build_sources()
-{
-       echo "Copy features from $SRCDIR to $build_path/features"
-       cp -r $SRCDIR/* $build_path/features
-
-       echo "Copy plugins from $SRCDIR to $build_path/plugins"
-       cp -r $SRCDIR/* $build_path/plugins
-}
-
-__copy_dependency_plugins()
-{
-       dependency_plugin_path=${ROOTDIR}/${ide_root_path_name}
-       if [ -d ${dependency_plugin_path} ]
-       then
-               cp -rf ${dependency_plugin_path}/features/* ${build_path}/features/
-               cp -rf ${dependency_plugin_path}/plugins/* ${build_path}/plugins/
-       fi
-}
-
-__make_ant_build_properties_file()
-{
-       builder_path="${SRCDIR}/builder"
-       parent_path_of_based_eclipse=${reference_ide_path}/..
-
-       echo "Make build.properties file..."
-       if [ ! -e $builder_path/build.properties.clean ] ; then
-               echo "ERROR : \"build.properties.clean\" file does not exist..."
-               exit 1
-       fi
-       cp $builder_path/build.properties.clean $build_path
-       cp $builder_path/customTargets.xml $build_path
-
-       if [ -d $reference_ide_path ] 
-       then
-               sed -e "s;\(^buildDirectory=\).*;\1${build_path};g" \
-               -e "s;\(^base=\).*;\1${parent_path_of_based_eclipse};g" \
-               -e "s;\(^baseLocation=\).*;\1${reference_ide_path};g" \
-               -e "s;\(^configs=\).*;\1${archive_platform_name},${windowing},${architecture};g" \
-               -e "s;\(^buildType=\).*;\1${build_type};g" \
-               -e "s;\(^buildId=\).*;\1${build_id};g" \
-               -e "s;\(^archivePrefix=\).*;\1${build_id};g" \
-               < $build_path/build.properties.clean > $build_path/build.properties
-
-       else
-               echo "ERROR : target eclipse is not exist."
-               exit 1
-       fi
-}
-
-__execute_pde_build()
-{
-       echo "Execute Product Ant Builder..."
-       equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar`
-       pde_build=`echo org.eclipse.pde.build_*`
-
-       java -jar ${reference_ide_path}/plugins/$equinox_launcher -application org.eclipse.ant.core.antRunner -buildfile ${reference_ide_path}/plugins/$pde_build/scripts/productBuild/productBuild.xml -Dbuilder=$build_path -Dosgi.locking=none 2>&1
-
-       if [ $? != 0 ];
-       then
-               echo "Build failed..."
-               exit 1
-       fi
-}
-
-__unzip_plugin_pack()
-{
-       echo "unzip to $build_result_path"
-       unzip -a $build_result_path/${result_archive_file} -d $build_result_path/${archive_platform_name}.${windowing}.${architecture}
-}
-
-build_plugins()
-{
-       case ${platform} in
-               linux)
-                       echo "build plugin for ${platform}"
-                       ;;
-               windows)
-                       echo "build plugin for ${platform}"
-                       ;;
-               *)
-                       echo "${platform} is not support yet."
-                       exit 1
-                       ;;
-       esac
-
-       __set_parameter
-       __set_build_parameter
-       __clean_build_environment
-       __copy_build_sources
-       __copy_dependency_plugins
-       __make_ant_build_properties_file
-       __execute_pde_build
-       __unzip_plugin_pack
-
-       echo "Build SUCCESS. You will find SDK IDE in \"${build_result_path}\"."
-}
-
-__clean_packaging_environment()
-{
-
-       if [ -d ${INSTALL_DIR} ]
-       then
-               rm -rf ${INSTALL_DIR}
-       else
-               mkdir -p ${INSTALL_DIR}
-       fi
-}
+#!/bin/bash -xe
 
 __copy_necessary_binaries()
 {
-       echo "add necessary files."
-       ## ex) cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
-       cp -rf ${SRCDIR}/packager/common/data/* ${INSTALL_DIR}/
+    echo "add necessary files."
+    ## ex)
+    ##     ide_root_path_name=IDE
+    ##     cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
+    ##     cp -rf ${SRCDIR}/packager/common/data/* ${INSTALL_DIR}/
 }
 
-packaging_plugins()
+__set_parameter()
 {
-       __set_parameter
-       __set_install_parameter
-
-       __clean_packaging_environment
-       __copy_necessary_binaries
-
-       install_ide_path=${INSTALL_DIR}/${ide_root_path_name}
-       
-       if [ ! -d ${install_ide_path} ]
-       then
-               mkdir -p ${install_ide_path}
-       fi
-
-       cp -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}/${package_name}/* ${install_ide_path}/
+    case ${TARGET_OS} in
+        ubuntu-32|ubuntu-64)
+            pde_path=${ROOTDIR}/indigo-pde
+            ;;
+        windows-32|windows-64)
+            pde_path=${ROOTDIR}/indigo-winpde
+            ;;
+        macos-64)
+            pde_path=${ROOTDIR}/indigo-macpde
+            ;;
+        *)
+            echo "${TARGET_OS} is not support yet."
+            exit 1
+            ;;
+    esac
+    
+    build_script_path=${pde_path}/pde_build
 }
 
 # clean
 clean()
 {
-       echo "=========================================CLEAN============================================"
-       make clean
-       rm -rf ${SRCDIR}/*.zip
-       rm -rf ${SRCDIR}/*.tar.gz
-       rm -rf ${build_path}
+    echo "=========================================CLEAN============================================"
+    __set_parameter
+    ${build_script_path}/clean.sh ${package_name}
 }
 
 # build
 build() 
 {
-       echo "=========================================BUILD============================================"
-       pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
-       for pkgname_and_platform in ${pkgname_and_platform_list}
-       do
-               pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
-               package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
-               platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
-       
-               if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
-               then
-                       build_plugins
-               else
-                       echo ""
-               fi
-       done
+    echo "=========================================BUILD============================================"
+    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+    for pkgname_and_platform in ${pkgname_and_platform_list}
+    do
+        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+    
+        if [ "x${TARGET_OS}" = "x${platform}" ]
+        then
+            __set_parameter
+            ${build_script_path}/build.sh ${package_name}
+       else
+            echo ""
+        fi
+    done
 }
 
 # install
 install() 
 {
-       pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
-       for pkgname_and_platform in ${pkgname_and_platform_list}
-       do
-               echo "=========================================INSTALL============================================"
-               pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
-               package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
-               platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
-
-               if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
-               then
-                       packaging_plugins
-               else
-                       echo ""
-               fi
-       done    
+    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+    for pkgname_and_platform in ${pkgname_and_platform_list}
+    do
+        echo "=========================================INSTALL============================================"
+        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+
+        if [ "x${TARGET_OS}" = "x${platform}" ]
+        then
+            __set_parameter
+               INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${TARGET_OS}/data
+            mkdir -p ${INSTALL_DIR} 
+            __copy_necessary_binaries
+            ${build_script_path}/install.sh ${package_name}
+        else
+            echo ""
+        fi
+    done    
 }
 
 [ "$1" = "clean" ] && clean
 [ "$1" = "build" ] && build
 [ "$1" = "install" ] && install
-exit 0
index da9263a..e118e89 100644 (file)
@@ -1,19 +1,39 @@
-Package:nativecommon-eplugin
-Version:1.0.9
-OS:linux
-Build-host-os:linux
-Build-dependency:indigo-pde [linux], base-ide-product [linux], common-eplugin [linux]
-Install-dependency:base-ide-product [linux], common-eplugin [linux], sdk-gdb-server [linux]
+Version:1.0.36
 Source:nativecommon-eplugin
 Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park <yoonki.park@samsung.com>, Hyunsik Noh <hyunsik.noh@samsung.com>, Gun Kim <gune.kim@samsung.com>, Ho Namkoong <ho.namkoong@samsung.com>, Taeyoung Son <taeyoung2.son@samsung.com>
+
+Package:nativecommon-eplugin
+OS:ubuntu-32
+Build-host-os:ubuntu-32
+Build-dependency:indigo-pde [ubuntu-32], base-ide-product [ubuntu-32], common-eplugin [ubuntu-32]
+Install-dependency:base-ide-product [ubuntu-32], common-eplugin [ubuntu-32]
 Description:Nativecommon plugin
 
 Package:nativecommon-eplugin
-Version:1.0.9
-OS:windows
-Build-host-os:linux
-Build-dependency:indigo-winpde [windows], base-ide-product [windows], common-eplugin [windows]
-Install-dependency:base-ide-product [windows], common-eplugin [windows], sdk-gdb-server [windows]
-Source:nativecommon-eplugin
-Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park <yoonki.park@samsung.com>, Hyunsik Noh <hyunsik.noh@samsung.com>, Gun Kim <gune.kim@samsung.com>, Ho Namkoong <ho.namkoong@samsung.com>, Taeyoung Son <taeyoung2.son@samsung.com>
+OS:windows-32
+Build-host-os:ubuntu-32
+Build-dependency:indigo-winpde [windows-32], base-ide-product [windows-32], common-eplugin [windows-32]
+Install-dependency:base-ide-product [windows-32], common-eplugin [windows-32]
+Description:Nativecommon plugin
+
+Package:nativecommon-eplugin
+OS:ubuntu-64
+Build-host-os:ubuntu-64
+Build-dependency:indigo-pde [ubuntu-64], base-ide-product [ubuntu-64], common-eplugin [ubuntu-64]
+Install-dependency:base-ide-product [ubuntu-64], common-eplugin [ubuntu-64]
 Description:Nativecommon plugin
+
+Package:nativecommon-eplugin
+OS:windows-64
+Build-host-os:ubuntu-64
+Build-dependency:indigo-winpde [windows-64], base-ide-product [windows-64], common-eplugin [windows-64]
+Install-dependency:base-ide-product [windows-64], common-eplugin [windows-64]
+Description:Nativecommon plugin
+
+Package:nativecommon-eplugin
+OS:macos-64
+Build-host-os:ubuntu-64
+Build-dependency:indigo-macpde [macos-64], base-ide-product [macos-64], common-eplugin [macos-64]
+Install-dependency:base-ide-product [macos-64], common-eplugin [macos-64]
+Description:Nativecommon plugin
+
diff --git a/packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_armel.tar b/packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_armel.tar
deleted file mode 100644 (file)
index 08ee06c..0000000
Binary files a/packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_armel.tar and /dev/null differ
diff --git a/packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_i386.tar b/packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_i386.tar
deleted file mode 100644 (file)
index debdcd2..0000000
Binary files a/packager/common/data/SDK/develop-tool/elmscalegetter_0.0.1_i386.tar and /dev/null differ