<feature
id="org.tizen.nativeplatform.feature"
label="Tizen Native Platform"
- version="0.20.0.qualifier"
- provider-name="Samsung"
+ version="1.0.0.qualifier"
+ provider-name="Tizen"
plugin="org.tizen.base.platform"
license-feature="org.tizen.base.feature">
</description>
<copyright>
- Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ Copyright (c)
</copyright>
<license url="http://www.example.com/license">
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<snippet filetemplate="false" extension="cfm">
+<name>File Comment</name>
+<help>describe file information</help>
+<starttext><![CDATA[/**
+ * @file $${CURRENTFILE}
+ * @brief $${file information}
+ *
+ * @author $${name} ($${e-mail})
+ * @version $${Revision}
+ */]]></starttext>
+<endtext><![CDATA[]]></endtext>
+</snippet>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<snippet filetemplate="false" extension="cfm">
+<name>Project Comment</name>
+<help>describe project information</help>
+<starttext><![CDATA[/*
+ * $${project name}
+ *
+ * $${lisence information}
+ *
+ * $${supplementary information}
+ */]]></starttext>
+<endtext><![CDATA[]]></endtext>
+</snippet>
\ No newline at end of file
--- /dev/null
+#These key combos are used by the cfeclipse plugin.
+#Tue Jul 26 16:12:05 KST 2011
+fc=/Comments/File Comment.xml
+lim=/Log/Log INFO message.xml
+clm=/Localization/Create a localized message.xml
+lwm=/Log/Log WARNING message.xml
+lem=/Log/Log ERROR message.xml
+lvm=/Log/Log VERBOSE message.xml
+pc=/Comments/Project Comment.xml
+ldm=/Log/Log DEBUG message.xml
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Tizen Native Inhouse
+Bundle-Name: Tizen Native Platform
Bundle-SymbolicName: org.tizen.nativeplatform;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.tizen.nativeplatform.Activator
-Bundle-Vendor: Samsung
+Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.cdt.managedbuilder.core;bundle-version="7.0.2",
org.eclipse.core.resources;bundle-version="3.6.1",
org.eclipse.cdt.core;bundle-version="5.2.1",
org.eclipse.cdt.managedbuilder.ui;bundle-version="7.0.0",
- org.tizen.common;bundle-version="1.3.20",
+ org.tizen.common,
org.eclipse.ui.console;bundle-version="3.5.0",
org.eclipse.cdt.ui;bundle-version="5.2.2",
org.eclipse.debug.ui,
org.tizen.common.connection,
- org.tizen.nativecommon;bundle-version="1.0.0"
+ org.tizen.nativecommon
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.cdt.debug.core,
--- /dev/null
+Bundle-Vendor = Samsung Electronics
templates/,\
plugin.properties,\
about.html,\
- about_files/
+ about_files/,\
+ OSGI-INF/
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<!-- build start -->
- <extension
- point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
- <toolChain
- configurationEnvironmentSupplier="org.tizen.nativeplatform.build.PlatformConfigurationEnvVarSupplier"
- id="com.samsung.slp.toolchain.custom.debian.base"
- isAbstract="true"
- osList="linux,win32"
- superClass="com.samsung.slp.toolchain.gnu.base.common">
- <builder
- autoBuildTarget="build"
- buildfileGenerator="org.tizen.nativeplatform.build.PlatformMakeGenerator"
- cleanBuildTarget="clean"
- command="sbi-make"
- commandLauncher="org.tizen.nativecommon.build.CommonBuildCommandLauncher"
- id="com.samsung.slp.builder.custom.debian"
- incrementalBuildTarget="build"
- name="SLP Custom Debian builder">
- </builder>
- </toolChain>
- <toolChain
- id="com.samsung.slp.toolchain.custom.debian"
- isAbstract="false"
- name="GCC-4.5(SBOX2)"
- osList="linux,win32"
- superClass="com.samsung.slp.toolchain.custom.debian.base">
- <supportedProperties>
- <property
- id="org.eclipse.cdt.build.core.buildArtefactType">
- <value
- id="com.samsung.slp.buildArtefactType.custom.debian">
- </value>
- </property>
- </supportedProperties>
- </toolChain>
- <projectType
- buildArtefactType="com.samsung.slp.buildArtefactType.custom.debian"
- id="com.samsung.slp.project.custom.debian"
- isAbstract="true"
- isTest="false">
- <configuration
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.config.custom.debian.emulator"
- name="Tizen-Emulator">
- <toolChain
- id="com.samsung.slp.toolchain.custom.debian.emulator"
- superClass="com.samsung.slp.toolchain.custom.debian">
- </toolChain>
- </configuration>
- <configuration
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.config.custom.debian.device"
- name="Tizen-Device">
- <toolChain
- id="com.samsung.slp.toolchain.custom.debian.device"
- superClass="com.samsung.slp.toolchain.custom.debian">
- </toolChain>
- </configuration>
- </projectType>
- </extension>
- <extension
- id="com.samsung.slp.build.info.custom.debian"
- point="org.eclipse.cdt.managedbuilder.core.buildProperties">
- <propertyValue
- id="com.samsung.slp.buildArtefactType.custom.debian"
- name="SLP Custom Debian Package"
- property="org.eclipse.cdt.build.core.buildArtefactType">
- </propertyValue>
+ <extension
+ id="org.tizen.nativeplatform.gdbserver"
+ name="org.tizen.nativeplatform.gdbserver"
+ point="org.tizen.common.connection.tools">
+ <tools
+ packagename="gdbserver-platform"
+ sourcepath="/on-demand">
+ </tools>
</extension>
-
+
+ <extension point="org.eclipse.core.contenttype.contentTypes">
+ <file-association
+ content-type="org.eclipse.cdt.make.core.makefile"
+ file-extensions="spec"/>
+ </extension>
+
<extension
point="org.eclipse.cdt.core.templates">
<template
filterPattern=".*"
id="org.tizen.nativeapp.templates.custom.debian.EmptyProject"
location="templates/InhouseFrameworkPackages/EmptyProject/template.xml"
- projectType="com.samsung.slp.nativeide.buildArtefactType.cdeb">
+ projectType="org.tizen.nativeide.buildArtefactType.platform">
</template>
<template
filterPattern=".*"
id="org.tizen.nativeapp.templates.custom.debian.HelloWorldProject"
location="templates/InhouseFrameworkPackages/HelloWorldProject/template.xml"
- projectType="com.samsung.slp.nativeide.buildArtefactType.cdeb">
+ projectType="org.tizen.nativeide.buildArtefactType.platform">
+ </template>
+ <template
+ filterPattern=".*"
+ id="org.tizen.nativeapp.templates.custom.debian.AgentProject"
+ location="templates/InhouseFrameworkPackages/AgentProject/template.xml"
+ projectType="org.tizen.nativeide.buildArtefactType.platform">
</template>
<template
filterPattern=".*"
point="org.eclipse.ui.handlers">
<handler
commandId="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr"
- class="org.tizen.nativeplatform.pkgInstall.PackageManagerRootstrapHandler">
+ class="org.tizen.nativeplatform.pkgmgr.PackageManagerHandler">
</handler>
</extension>
-<!--
- <extension
- point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base"
- isAbstract="false"
- name="[SBOX2] GCC-4.5"
- osList="linux"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gnu.slp.base">
- </toolChain>
-
- <projectType
- buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.app"
- id="com.samsung.slp.nativeide.target.sbi.gcc45sbox2.app"
- isAbstract="true"
- isTest="false">
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
- cleanCommand="rm -rf"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.app.debug.emulator"
- name="Debug-Tizen-Emulator">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.app.debug.emulator"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
- cleanCommand="rm -rf"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.app.debug.device"
- name="Debug-Tizen-Device">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.app.debug.device"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release"
- cleanCommand="rm -rf"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.app.release"
- name="Release">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.app.release"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- </projectType>
-
- <projectType
- buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.sharedLib"
- id="com.samsung.slp.nativeide.target.sbi.gcc45sbox2.so"
- isAbstract="true"
- isTest="false">
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.so.debug.emulator"
- name="Debug-Tizen-Emulator">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.so.debug.emulator"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.so.debug.device"
- name="Debug-Tizen-Device">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.so.debug.device"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release"
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.so.release"
- name="Release">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.so.release"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- </projectType>
-
- <projectType
- buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.staticLib"
- id="com.samsung.slp.nativeide.target.sbi.gcc45sbox2.lib"
- isAbstract="true"
- isTest="false">
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.lib.debug.emulator"
- name="Debug-Tizen-Emulator">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.lib.debug.emulator"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.lib.debug.device"
- name="Debug-Tizen-Device">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.lib.debug.device"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- <configuration
- buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release"
- cleanCommand="rm -f"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.lib.release"
- name="Release">
- <toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.lib.release"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
- </toolChain>
- </configuration>
- </projectType>
- </extension>
--->
<extension
point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
<toolChain
configurationEnvironmentSupplier="org.tizen.nativeplatform.build.PlatformConfigurationEnvVarSupplier"
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.base"
+ id="org.tizen.nativeide.toolchain.sbi.gcc45.platform.base"
isAbstract="false"
- name="[SBOX2] GCC-4.5 Custom Debian"
+ name="Tizen Platform Toolchain"
osList="linux"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gnu.base">
+ superClass="org.tizen.nativeide.toolchain.sbi.gnu.base">
<builder
autoBuildTarget="build"
buildfileGenerator="org.tizen.nativeplatform.build.PlatformMakeGenerator"
cleanBuildTarget="clean"
command="sbi-make"
- commandLauncher="org.tizen.nativecommon.build.CommonBuildCommandLauncher"
- id="org.tizen.nativeapp.target.sbi.gcc45sbox2.builder.cdeb"
+ commandLauncher="org.tizen.nativeplatform.build.PlatformBuildCommandLauncher"
+ id="org.tizen.nativeide.target.sbi.gcc45.platform.builder"
incrementalBuildTarget="build"
- name="Tizen Custom Debian Builder">
+ name="Tizen Platform Builder">
</builder>
<tool
- id="com.samsung.slp.nativeide.tool.sbi.gnu.archiver.cdeb.base"
- superClass="com.samsung.slp.nativeide.tool.sbi.gnu.archiver.base">
+ id="org.tizen.nativeide.tool.sbi.gnu.archiver.platform.base"
+ superClass="org.tizen.nativeide.tool.sbi.gnu.archiver.base">
<enablement
type="ALL">
<false/>
</enablement>
</tool>
<tool
- id="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.compiler.cdeb.base"
- superClass="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.compiler.base">
+ id="org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.platform.base"
+ superClass="org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.base">
<enablement
type="ALL">
<false/>
</enablement>
</tool>
<tool
- id="com.samsung.slp.nativeide.tool.sbi.gnu.c.compiler.cdeb.base"
- superClass="com.samsung.slp.nativeide.tool.sbi.gnu.c.compiler.base">
+ id="org.tizen.nativeide.tool.sbi.gnu.c.compiler.platform.base"
+ superClass="org.tizen.nativeide.tool.sbi.gnu.c.compiler.base">
<enablement
type="ALL">
<false/>
</enablement>
</tool>
<tool
- id="com.samsung.slp.nativeide.tool.sbi.gnu.c.linker.cdeb.base"
- superClass="com.samsung.slp.nativeide.tool.sbi.gnu.c.linker.base">
+ id="org.tizen.nativeide.tool.sbi.gnu.c.linker.platform.base"
+ superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base">
<enablement
type="ALL">
<false/>
</enablement>
</tool>
<tool
- id="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.linker.cdeb.base"
- superClass="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.linker.base">
+ id="org.tizen.nativeide.tool.sbi.gnu.cpp.linker.platform.base"
+ superClass="org.tizen.nativeide.tool.sbi.gnu.cpp.linker.base">
<enablement
type="ALL">
<false/>
</enablement>
</tool>
<tool
- id="com.samsung.tizen.nativeapp.tool.sbi.gnu.assembler.cdeb.base"
- superClass="com.samsung.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+ id="org.tizen.nativeapp.tool.sbi.gnu.assembler.platform.base"
+ superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
<enablement
type="ALL">
<false/>
</toolChain>
<projectType
- buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.cdeb"
- id="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb"
+ buildArtefactType="org.tizen.nativeide.buildArtefactType.platform"
+ id="org.tizen.nativebuild.target.sbi.gcc45.platform"
isAbstract="false"
isTest="false">
<configuration
cleanCommand="rm -f"
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.emulator"
+ id="org.tizen.nativeide.config.sbi.gcc45.platform.emulator"
name="Tizen-Emulator">
<toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.emulator"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.base">
+ id="org.tizen.nativeide.toolchain.sbi.gcc45.platform.emulator"
+ superClass="org.tizen.nativeide.toolchain.sbi.gcc45.platform.base">
</toolChain>
</configuration>
<configuration
cleanCommand="rm -f"
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
- id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.device"
+ id="org.tizen.nativeide.config.sbi.gcc45.platform.device"
name="Tizen-Device">
<toolChain
- id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.device"
- superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.base">
+ id="org.tizen.nativeide.toolchain.sbi.gcc45.platform.device"
+ superClass="org.tizen.nativeide.toolchain.sbi.gcc45.platform.base">
</toolChain>
</configuration>
</projectType>
<extension
point="org.eclipse.cdt.managedbuilder.core.buildProperties">
<propertyValue
- id="com.samsung.slp.nativeide.buildArtefactType.cdeb"
- name="Tizen Custom Debian Project"
+ id="org.tizen.nativeide.buildArtefactType.platform"
+ name="Tizen Platform Project"
property="org.eclipse.cdt.build.core.buildArtefactType">
</propertyValue>
</extension>
point="org.eclipse.cdt.managedbuilder.core.projectConverter">
<converter
class="org.tizen.nativeplatform.build.PlatformProjectConverter"
- fromId="com.samsung.slp.project.custom.debian"
- id="com.samsung.tizen.nativeapp.converter.cdeb"
+ fromId="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb"
+ id="org.tizen.nativeapp.converter.platform"
mbsVersion="4.0.0"
- name="Upgrade Tizen Custom Debian Project, GCC-4.5(SBOX2)"
- toId="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb">
+ name="Upgrade Tizen Platform Project, GCC-4.5"
+ toId="org.tizen.nativebuild.target.sbi.gcc45.platform">
</converter>
</extension>
<!-- build end -->
finalPerspective="org.tizen.nativeapp.perspective"
icon="icons/newc_app.gif"
id="org.tizen.nativeapp.newCategory.customWizard"
- name="Tizen Custom Debian Project"
+ name="Tizen Platform Project"
preferredPerspectives="org.tizen.nativeapp.perspective"
project="true">
</wizard>
<!-- launching & debugging start -->
<extension
- id="org.tizen.nativeapp.elmscaletool"
- name="org.tizen.nativeapp.elmscaletool"
- point="org.tizen.common.connection.tools">
- <tools
- packagename="elmscalegetter"
- sourcepath="/SDK/develop-tool">
- </tools>
- </extension>
-
- <extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"
id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"
- name="Tizen Custom Debian Project"
+ name="Tizen Platform Project"
public="true"/>
<launchConfigurationType
delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"
id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach"
- name="Tizen Custom Debian Project - Attach"
+ name="Tizen Platform Project - Attach"
public="true"/>
<launchConfigurationType
delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"
id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore"
- name="Tizen Custom Debian Project - Coredump"
+ name="Tizen Platform Project - Coredump"
public="true"/>
</extension>
delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"
id="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"
modes="run,debug"
- name="Tizen Custom Debian Project"
- delegateDescription="The Tizen Custom Debian Project Launcher supports running Tizen application on device"
+ name="Tizen Platform Project"
+ delegateDescription="The Tizen Platform Project Launcher supports running Tizen application on device"
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"/>
delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"
id="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"
modes="debug"
- name="Tizen Custom Debian Project - Attach"
- delegateDescription="The Tizen Custom Debian Project Launcher supports attach debugging Tizen process on device"
+ name="Tizen Platform Project - Attach"
+ delegateDescription="The Tizen Platform Project Launcher supports attach debugging Tizen process on device"
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach"/>
delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"
id="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"
modes="debug"
- name="Tizen Custom Debian Project - Coredump"
- delegateDescription="The Tizen Custom Debian Project Launcher supports coredump debugging"
+ name="Tizen Platform Project - Coredump"
+ delegateDescription="The Tizen Platform Project Launcher supports coredump debugging"
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore"/>
<tab
id="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab"
group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationTabGroup"
- name="Tizen Custom Debian Project Main Tab"
+ name="Tizen Platform Project Main Tab"
class="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab">
<associatedDelegate delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"/>
</tab>
<tab
id="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab"
group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForAttachTabGroup"
- name="Tizen Custom Debian Project Main Tab"
+ name="Tizen Platform Project Main Tab"
class="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab">
<associatedDelegate delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"/>
</tab>
<tab
id="org.tizen.nativeplatform.launch.ui.TizenDebianMainCoreTab"
group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForCoreTabGroup"
- name="Tizen Custom Debian Project main tab for coredump"
+ name="Tizen Platform Project main tab for coredump"
class="org.tizen.nativeplatform.launch.ui.TizenDebianMainCoreTab">
<associatedDelegate delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"/>
</tab>
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
- label="Tizen Custom Debian Project"
+ label="Tizen Platform Project"
icon="icons/Tizen_Custom_Debian_ConfigurationType_Image.gif"
modes="run,debug"
class="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectLaunchShortcut"
</contextualLaunch>
<description
mode="run"
- description="Runs a Tizen Custom Debian Project"/>
+ description="Runs a Tizen Platform Project"/>
<description
mode="debug"
- description="Debugs a Tizen Custom Debian Project"/>
+ description="Debugs a Tizen Platform Project"/>
<configurationType
id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType">
</configurationType>
</shortcut>
<shortcut
- label="Tizen Custom Debian Project - Attach"
+ label="Tizen Platform Project - Attach"
icon="icons/Tizen_Custom_Debian_ConfigurationType_Image_Attach.gif"
modes="debug"
class="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectAttachLaunchShortcut"
</contextualLaunch>
<description
mode="debug"
- description="Attach Debugs a Tizen Custom Debian Project"/>
+ description="Attach Debugs a Tizen Platform Project"/>
<configurationType
id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach">
</configurationType>
</shortcut>
<shortcut
- label="Tizen Custom Debian Project - Coredump"
+ label="Tizen Platform Project - Coredump"
icon="icons/Tizen_Custom_Debian_ConfigurationType_Image_Core.gif"
modes="debug"
class="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectCoredumpLaunchShortcut"
</contextualLaunch>
<description
mode="debug"
- description="Coredump Debugs a Tizen Custom Debian Project"/>
+ description="Coredump Debugs a Tizen Platform Project"/>
<configurationType
id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore">
</configurationType>
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
- id="org.tizen.nativeplatform.pkgInstall.pkgtoolbar">
+ id="org.tizen.nativecommon.manager.mgrtoolbar">
<command
commandId="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr"
icon="icons/package_installer.gif"
</toolbar>
</menuContribution>
</extension>
-
+
<extension
point="org.eclipse.ui.actionSets">
<actionSet
- label="Package Manager ActionSet"
+ label="Manager ActionSet"
visible="true"
- id="org.tizen.nativeplatform.pkginstall.actionset">
+ id="org.tizen.nativecommon.actionset">
<menu
- label="Package Manager"
- path="additions"
- id="org.tizen.nativeplatform.pkginstall.menuid">
- </menu>
+ label="Tizen Native Manager"
+ path="window/additions"
+ id="org.tizen.nativecommon.manager">
+ <separator name="slot"/>
+ </menu>
<action
id="org.tizen.nativeplatform.pkginstall.action"
label="Package Manager"
- menubarPath="window/additions"
- class="org.tizen.nativeplatform.pkgInstall.DialogActionDelegate">
+ menubarPath="window/org.tizen.nativecommon.manager/slot"
+ class="org.tizen.nativeplatform.pkgmgr.DialogActionDelegate"
+ icon="icons/package_installer.gif">
</action>
+
</actionSet>
</extension>
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+
+ <objectContribution
+ adaptable="false"
+ id="org.tizen.nativeplatform.build.BuildPackageObjectContribution"
+ objectClass="org.eclipse.core.resources.IProject">
+ <action
+ class="org.tizen.nativeplatform.build.BuildPackageObjectAction"
+ enablesFor="+"
+ id="org.tizen.nativeplatform.buildPackage.deb"
+ label="Build Package"
+ menubarPath="buildGroup">
+ </action>
+ <enablement>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.tizen.nativecommon.projectBuildArtefactType"
+ value="org.tizen.nativeide.buildArtefactType.platform">
+ </test>
+ </adapt>
+ </enablement>
+ </objectContribution>
+ </extension>
<!-- package manager end -->
</plugin>
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.tizen.nativecommon.build.ProjectTypeManager;
-import org.tizen.nativeplatform.build.CustomDebianProjectDependentBuilderOld;
import org.tizen.nativeplatform.build.PlatformConfigurationManager;
import org.tizen.nativeplatform.build.PlatformProjectDependentBuilder;
import org.tizen.nativeplatform.build.PlatformProjectDependentPackager;
*/
public void start(BundleContext context) throws Exception {
super.start(context);
- plugin = this;
-
- ProjectTypeManager.registerProjectArtifactType(
- PlatformConfigurationManager.OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE,
- CustomDebianProjectDependentBuilderOld.getInstance(),
- PlatformProjectDependentPackager.getInstance(),
- false);
+ plugin = this;
ProjectTypeManager.registerProjectArtifactType(
PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE,
PlatformProjectDependentBuilder.getInstance(),
PlatformProjectDependentPackager.getInstance(),
true);
-
- //SLPProjectTypeManager.registerBuilder("SLP Custom Debian Package", CustomDebianProjectDependentBuilder.getInstance() );
- //SLPProjectTypeManager.registerBuilder("SLP Inhouse Framework Package", InhouseFrameworkProjectDependentBuilder.getInstance() );
}
/*
--- /dev/null
+package org.tizen.nativeplatform.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.IManagedBuildInfo;
+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.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+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.build.CheckCancelJob;
+import org.tizen.nativecommon.build.CommonBuildMessages;
+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.nativeplatform.Activator;
+
+public class BuildPackageObjectAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
+ protected IProject project;
+ protected IWorkbenchWindow window;
+ private IStatus status = null;
+ private final String PKGTYPE = "RPM";
+
+ public BuildPackageObjectAction() {
+ }
+
+ public BuildPackageObjectAction(IProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public void run(IAction action) {
+
+ 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);
+
+ CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(project);
+ CheckCancelJob cancelJob = new CheckCancelJob(monitor, project, packager.getSbi(), true);
+ Thread checkCancelThread = new Thread(cancelJob);
+ checkCancelThread.start();
+
+ try {
+ monitor.subTask("Building package...");
+ 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) {
+ status = new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage());
+ cancelJob.setFinishFlag(true);
+ monitor.done();
+ return;
+ }
+
+ cancelJob.setFinishFlag(true);
+ 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;
+ }
+ };
+}
+
--- /dev/null
+/*
+* 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.nativeplatform.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;
+import org.eclipse.core.runtime.Path;
+
+import org.tizen.common.util.ProcessMonitorThread;
+import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
+import org.tizen.nativecommon.build.ProjectTypeManager;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+
+
+public class PlatformBuildCommandLauncher extends CommandLauncher {
+ @Override
+ public Process execute(IPath commandPath, String[] args, String[] env,
+ IPath changeToDirectory, IProgressMonitor monitor) throws CoreException {
+
+ Process proc = null;
+
+ if ( commandPath.toString().contains( "sbi-make") ) {
+ IProject proj = getProject();
+ CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(proj);
+ SmartBuildInterface sbi = SmartBuildInterface.getInstance(proj);
+
+ String targetID = builder.getTargetID();
+ String toolchainID = sbi.getToolchainIDFromTargetID(targetID);
+ String rootstrapID = sbi.getRootstrapIDFromTargetID(targetID);
+
+ try {
+ if (!sbi.checkRootstrapID(rootstrapID) || !sbi.checkToolchainID(toolchainID)) {
+ String message = String.format(
+ "Current build system does not support '%s' toolchain or '%s' rootstrap\n" +
+ "Please select toolchain supported by current build system.",
+ toolchainID, rootstrapID);
+
+ throw new SBIException(message);
+ }
+ if (!sbi.checkTargetID(targetID)) {
+ sbi.writeTargetCfgFile(targetID);
+ }
+ } catch (SBIException e) {
+ e.printStackTrace();
+ e.showErrorDialog();
+ }
+
+ String options = args[0];
+ for( int i = 1 ; i < args.length ; i++ ) {
+ options = options + " " + args[i];
+ }
+ String cmd = String.format( "%s action %s -- make -options=\"%s\"", sbi.getSBICommandPath("sbi"), targetID, options );
+
+ // command parsing using SBI
+ String[] cmds = sbi.parseCommandString( cmd );
+ String[] newArgs = new String[ cmds.length - 1];
+ for( int i = 0; i < cmds.length - 1; i ++ ) {
+ newArgs[i]= cmds[i+1];
+ }
+ proc = super.execute( new Path(cmds[0]), newArgs, sbi.getEnvironmentVariables(), changeToDirectory, monitor);
+ } else {
+ proc = super.execute(commandPath, args, env, changeToDirectory, monitor);
+ }
+
+ ProcessMonitorThread pmt = new ProcessMonitorThread(proc, monitor);
+ pmt.start();
+
+ return proc;
+ }
+}
{
// ProjectInfo
public static final String CURRENT_SLP_PROJECT_VERSION = "1.0.0";
- public static final String TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE = "com.samsung.slp.nativeide.buildArtefactType.cdeb";
+ public static final String TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE = "org.tizen.nativeide.buildArtefactType.platform";
public static final String OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE = "com.samsung.slp.project.custom.debian";
- // SBI Compatibility
- public static final String SBI_PROJECT_TYPE_ID = "com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb";
- public static final String SBI_DEFAULT_I386_CONFIGRATION_ID = "com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.emulator";
- public static final String SBI_DEFAULT_ARM_CONFIGRATION_ID = "com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.device";
- public static final String SBI_DEFAULT_TARGET_NAME = "tizen-device-1.0.sb2_gcc45sbox2.armel.cdeb";
- public static final String SBI_ARM_TOOLCHAIN_NAME = "gcc45sbox2.armel.cdeb";
- public static final String SBI_ARM_SBOX2_TOOLCHAIN_NAME = "gcc45sbox2.armel.cdeb";
- public static final String SBI_ARM_ROOTSTRAP_NAME = "tizen-device-1.0.sb2";
- public static final String SBI_I386_TOOLCHAIN_NAME = "gcc45sbox2.i386.cdeb";
- public static final String SBI_I386_SBOX2_TOOLCHAIN_NAME = "gcc45sbox2.i386.cdeb";
- public static final String SBI_I386_ROOTSTRAP_NAME = "tizen-emulator-1.0.sb2";
-
+ // SBI Compatibility
+ public static final String SBI_PROJECT_TYPE_ID = "org.tizen.nativebuild.target.sbi.gcc45.platform";
+ public static final String SBI_DEFAULT_I386_CONFIGRATION_ID = "org.tizen.nativeide.config.sbi.gcc45.platform.emulator";
+ public static final String SBI_DEFAULT_ARM_CONFIGRATION_ID = "org.tizen.nativeide.config.sbi.gcc45.platform.device";
+
// get compiler flags
public static String getAllCFlags( IConfiguration config )
{
- // TODO: should be removed
- if ( isOldConfiguration(config) ) {
- return CustomDebianConfigurationOld.getAllCFlags(config);
- }
-
- return getAllCompilerFlags( config, SBI_BASE_C_COMPILER_TOOL_ID );
+ String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
+ return getAllCompilerFlags( config, c_compiler_id );
}
public static String getAllCPPFlags( IConfiguration config )
{
- // TODO: should be removed
- if ( isOldConfiguration(config) ) {
- return CustomDebianConfigurationOld.getAllCPPFlags(config);
- }
-
- return getAllCompilerFlags( config, SBI_BASE_CPP_COMPILER_TOOL_ID );
+ String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+ return getAllCompilerFlags( config, cpp_compiler_id );
}
compilerFlags = compilerFlags.trim();
return compilerFlags;
- }
-
-
-
+ }
protected static boolean isCPPProject( IConfiguration config )
{
return false;
}
-
-
- public static void changeToolchain( IConfiguration config, ICResourceDescription cfgd, String toolchainNameInCfg) {
- // TODO: should be removed
- if ( isOldConfiguration(config) ) {
- CustomDebianConfigurationOld.changeToolchain(config, cfgd, toolchainNameInCfg );
- return;
- }
-
- IToolChainModificationManager tcmmgr = ManagedBuildManager.getToolChainModificationManager();
- IToolChain[] r_tcs = ManagedBuildManager.getRealToolChains();
- IToolChain[] v_tcs;
-
- IResourceInfo ri = config.getResourceInfo(cfgd.getPath(), false);
- IToolListModification mod;
-
- if (ri instanceof IFolderInfo) {
- mod = tcmmgr.createModification((IFolderInfo)ri);
- } else {
- mod = tcmmgr.createModification((IFileInfo)ri);
- }
-
- IToolChain realToolChain = null;
- if (ri instanceof IFolderInfo) {
- IToolChain toolChainInstance = ((IFolderInfoModification)mod).getToolChain();
- realToolChain = ManagedBuildManager.getRealToolChain(toolChainInstance);
- if (realToolChain==null)
- realToolChain = toolChainInstance;
- }
-
- boolean isMng = config.getBuilder().isManagedBuildOn();
- ArrayList<IToolChain> list = new ArrayList<IToolChain>();
-
- IToolChain[] tcs = r_tcs;
- IFolderInfoModification fim = (IFolderInfoModification)mod;
- tcs = fim.getCompatibleToolChains();
- IToolChain[] tcs1 = new IToolChain[tcs.length + 1];
- System.arraycopy(tcs, 0, tcs1, 0, tcs.length);
- tcs1[tcs.length] = realToolChain; // add existing toolchain
- tcs = tcs1;
-
- for (IToolChain tc : tcs) {
- if ( tc.isSystemObject() && !(((ToolChain)tc).isPreferenceToolChain() && !isMng) ) {
- // NO TOOLCHAIN
- continue;
- }
- list.add(tc);
- }
-
- v_tcs = list.toArray(new IToolChain[list.size()]);
- int x = 0;
- IFolderInfoModification foim = (IFolderInfoModification)mod;
-
- for (int i = 0 ; i < v_tcs.length ; i++) {
- if (v_tcs[i].getName().equals(toolchainNameInCfg)) {
- x = i;
- break;
- }
- }
-
- IToolChain tc = v_tcs[x];
- if (tc == null) return;
-
-
- foim.setToolChain(tc);
-
- try {
- mod.apply();
- } catch (CoreException e) {
- ManagedBuilderUIPlugin.log(e);
- }
+ public static void changeToolchain(IConfiguration config, String targetId) {
+ SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+ setBuildTargetName(config, targetId);
+ setToolCommand(config);
}
-
-
+ /*
public static String updateBuildTargetConfiguration( IConfiguration config ) throws SBIException {
// get target name
// check toolchain name
if ( !sbi.checkToolchainID(toolchainID) ) {
- // change "gcc-4.5.3-i386.sb2" , "gcc-4.5-i386.cdeb.sb2"
- if ( ( toolchainID.equals("gcc-4.5.3-i386.sb2") || toolchainID.equals("gcc-4.5-i386.cdeb.sb2") ) &&
- sbi.checkToolchainID( SBI_I386_SBOX2_TOOLCHAIN_NAME ) ) {
- toolchainID = SBI_I386_SBOX2_TOOLCHAIN_NAME;
- }
- // change "gcc-4.5.3-armel.sb2" , "gcc-4.5-armel.cdeb.sb2"
- else if ( ( toolchainID.equals("gcc-4.5.3-armel.sb2") || toolchainID.equals("gcc-4.5-armel.cdeb.sb2") ) &&
- sbi.checkToolchainID( SBI_ARM_SBOX2_TOOLCHAIN_NAME ) ) {
- toolchainID = SBI_ARM_SBOX2_TOOLCHAIN_NAME;
- } else {
- // set default
- if ( config.getName().contains(SBI_DEVICE_CONFIG_SUFFIX) ) {
- toolchainID = SBI_ARM_TOOLCHAIN_NAME;
- } else {
- toolchainID = SBI_I386_TOOLCHAIN_NAME;
- }
- }
+ // set default
+ if ( config.getName().contains(SBI_DEVICE_CONFIG_SUFFIX) ) {
+ toolchainID = SBI_ARM_OBS_TOOLCHAIN_NAME;
+ } else {
+ toolchainID = SBI_I386_OBS_TOOLCHAIN_NAME;
+ }
}
// create target name && update configuration
return targetID;
}
-
+ */
public static String getRootstrapPath( IConfiguration config ) {
try {
-
- // if not exist, update target configuration
- String targetID = updateBuildTargetConfiguration( config );
-
- // return rootstrap
+ String targetID = getBuildTargetName(config);
+ if (targetID == null) {
+ targetID = getDefaultBuildTargetName(config);
+ }
SmartBuildInterface sbi = SmartBuildInterface.getInstance();
- return sbi.getRootstrapPath(targetID);
-
+ String path = sbi.getRootstrapPath(targetID);
+ if (path == null) {
+ return "";
+ } else {
+ return sbi.getRootstrapPath(targetID);
+ }
} catch (SBIException e) {
e.printStackTrace();
return "/";
}
- }
+ }
}
private IProject project;
private IPath topBuildDir;
private IConfiguration config;
-
- public final static String SBI_MESSAGE_NEED_PROJECT_CONVERSION =
- "Old project type detected!\nPlease upgrade your project.\n" +
- " 1. Open the popup-menu by clicking right mouse button on your project\n" +
- " 2. Select \"Convert To...\" menu item to open a project converter dialog.\n" +
- " 3. Select \"Upgrade Tizen .....\" item on the dialog.\n" +
- " 4. Check if all project options are set correctly.\n" +
- " (Some options may not be transferred automatically)";
-
@Override
public void generateDependencies() throws CoreException {
@Override
public MultiStatus generateMakefiles(IResourceDelta delta)
- throws CoreException {
-
- if ( PlatformConfigurationManager.isOldConfiguration( config ) ) {
-
- //SBIException ex = new SBIException(SLPApplicationProjectConverter.SBI_MESSAGE_NEED_PROJECT_CONVERSION);
- SBIException ex = new SBIException(SBI_MESSAGE_NEED_PROJECT_CONVERSION);
- ex.showErrorDialog();
-
- throw new CoreException( new MultiStatus(
- ManagedBuilderCorePlugin.getUniqueIdentifier(),
- IStatus.ERROR,
- new String(String.format("Build failed! Please upgrade project!" )),
- null) );
- }
-
+ throws CoreException {
+
// if Makefile does not exist, regenerate "Makefile"
IFolder configDir = project.getFolder( config.getName() );
if ( !configDir.exists() )
}
@Override
- public MultiStatus regenerateMakefiles() throws CoreException {
-
- if ( PlatformConfigurationManager.isOldConfiguration( config ) ) {
-
- //SBIException ex = new SBIException(SLPApplicationProjectConverter.SBI_MESSAGE_NEED_PROJECT_CONVERSION);
- SBIException ex = new SBIException(SBI_MESSAGE_NEED_PROJECT_CONVERSION);
- ex.showErrorDialog();
-
- throw new CoreException( new MultiStatus(
- ManagedBuilderCorePlugin.getUniqueIdentifier(),
- IStatus.ERROR,
- new String(String.format("Build failed! Please upgrade project!" )),
- null) );
- }
+ public MultiStatus regenerateMakefiles() throws CoreException {
// Check topdir folder exist
topBuildDir = createDirectory(config.getName());
}
Configuration newConfig = createNewConfiguration( config , toId );
- String newTargetName = getNewBuildTargetName( config , toId );
+ //String newTargetName = getNewBuildTargetName( config , toId );
+ String newTargetName = PlatformConfigurationManager.getBuildTargetName(config);
// target name
if (!sbi.checkTargetID(newTargetName)) {
Configuration parentConfig = null;
if ( toId.equals(PlatformConfigurationManager.SBI_PROJECT_TYPE_ID) ) {
- if ( config.getParent().getId().contains("custom.debian.emulator") ) {
+ if ( config.getParent().getId().contains("emulator") ) {
parentConfig = (Configuration)ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_I386_CONFIGRATION_ID );
- } else if ( config.getParent().getId().contains("custom.debian.device") ) {
+ } else if ( config.getParent().getId().contains("device") ) {
parentConfig = (Configuration) ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_ARM_CONFIGRATION_ID );
} else {
parentConfig = (Configuration)ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_ARM_CONFIGRATION_ID );
return newConfig;
}
-
+ /*
protected String getNewBuildTargetName( IConfiguration config , String toId ) {
String newTargetName = null;
return newTargetName;
}
+ */
}
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativecommon.build.obs.PasswordInputDialog;
+import org.tizen.nativecommon.build.obs.UserInformation;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
public class PlatformProjectDependentBuilder extends CommonProjectDependentBuilder {
@Override
protected String getDebugOption(String[] arrOption) {
- String gdbOptions = "-gdb-options=\'";
- for (int i = 0 ; i < arrOption.length ; i++) {
- gdbOptions = gdbOptions.concat(arrOption[i] + " ");
- }
- gdbOptions = gdbOptions.concat("\' ");
+ String options = "";
+ String rootstrapPath = "";
+ String targetId = getTargetID();
- String sysroot="";
- try {
- sysroot = String.format("-sysroot=%s", getSbi().getRootstrapPath(getTargetID()) );
- } catch (SBIException e) {
- e.printStackTrace();
+ if (targetId.contains("obs")) {
+ String passwd = getSudoPassword();
+ options = String.format("-passwd=%s -gdb-options=\'", passwd);
+ try {
+ rootstrapPath = new Path(getSbi().getRootstrapPath(getTargetID())).makeAbsolute().toOSString();
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ for (int i = 0 ; i < arrOption.length ; i++) {
+ if (arrOption[i] == null) {
+ break;
+ } else if (arrOption[i].startsWith("--cd")) {
+ continue;
+ } else if (arrOption[i].contains(rootstrapPath)) {
+ String op = arrOption[i].replaceAll(rootstrapPath, "");
+ options = options.concat(op + " ");
+ } else {
+ options = options.concat(arrOption[i] + " ");
+ }
+ }
+ options = options.concat("\' ");
+ return options;
+
+ } else {
+ options = "-gdb-options=\'";
+ for (int i = 0 ; i < arrOption.length ; i++) {
+ options = options.concat(arrOption[i] + " ");
+ }
+ options = options.concat("\' ");
+ String sysroot="";
+ try {
+ rootstrapPath = getSbi().getRootstrapPath(getTargetID());
+ sysroot = String.format("-sysroot=%s", rootstrapPath );
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+ return options.concat(sysroot);
}
-
- return gdbOptions + sysroot;
}
@Override
}
@Override
- public void setToolCommand(IConfiguration config, String rootstrapCfgName) {
- PlatformConfigurationManager.setToolCommand(config, rootstrapCfgName);
+ public void setToolCommand(IConfiguration config) {
+ PlatformConfigurationManager.setToolCommand(config);
}
@Override
- public void changeToolchain(IConfiguration config,
- ICResourceDescription cfgd, String toolchainNameInCfg) {
- PlatformConfigurationManager.changeToolchain(config, cfgd, toolchainNameInCfg);
+ public void changeToolchain(IConfiguration config, String targetId) {
+ PlatformConfigurationManager.changeToolchain(config, targetId);
+ }
+
+ private String getSudoPassword() {
+ if (UserInformation.getRootPassword() == null) {
+ openPasswordDialog();
+ }
+
+ return UserInformation.getRootPassword();
+ }
+
+ private void openPasswordDialog(){
+
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getShells()[0];
+ PasswordInputDialog passwordDialog = new PasswordInputDialog(shell, "Input password");
+ if( passwordDialog.open() == Window.OK){
+ UserInformation.setRootPassword(passwordDialog.getPassword());
+ UserInformation.setSavePassword(passwordDialog.isSavePassword());
+ }
+ }
+ });
}
}
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
-* Contact:
+* 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>
+* 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
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.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
import org.tizen.nativecommon.build.CommonProjectDependentPackager;
import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativecommon.build.obs.PasswordInputDialog;
+import org.tizen.nativecommon.build.obs.UserInformation;
public class PlatformProjectDependentPackager extends CommonProjectDependentPackager {
super(project);
}
- @Override
- public String getPackageOption() {
- String workingDir = getWorkingDir();
-
- String options = String.format(
- "-WORKING_DIR=%s",
- workingDir );
- return options;
- }
-
@Override
- public String getPackageOption(IConfiguration config) {
+ public String getPackageOption(IConfiguration config, String pkgType) {
String workingDir = getWorkingDir(config);
+ String options = "";
+ String passwd = getSudoPassword(pkgType);
+ if (passwd == null) {
+ return null;
+ }
- String options = String.format(
- "-WORKING_DIR=%s",
- workingDir );
+ if (RPM.equals(pkgType)) {
+ options = String.format(
+ "-PASSWD=%s " +
+ "-WORKING_DIR=%s " +
+ "-PKG_TYPE=%s" ,
+ passwd,
+ workingDir,
+ pkgType );
+ } else {
+ options = String.format(
+ "-WORKING_DIR=%s " +
+ "-PKG_TYPE=%s" ,
+ workingDir,
+ pkgType );
+ }
return options;
}
- public void buildPackage() throws SBIException {
-
- String targetID = getTargetID();
- String projectDir = getProjectPath();
- String options = getPackageOption();
+ private String getSudoPassword(String pkgType) {
+ if (UserInformation.getRootPassword() == null) {
+ if (!openPasswordDialog(pkgType)) {
+ return null;
+ }
+ }
- sbi.actionConsole("buildpackage", options, targetID, projectDir, "Packaging" );
+ return UserInformation.getRootPassword();
}
-
-
- public void buildPackage(String configName) throws SBIException {
+
+ public boolean openPasswordDialog(String pkgType){
+ if( UserInformation.isSavePassword() || !RPM.equals(pkgType)){
+ return true;
+ }
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getShells()[0];
+ PasswordInputDialog passwordDialog = new PasswordInputDialog(shell, "Input password");
+ if( passwordDialog.open() == Window.OK){
+ UserInformation.setRootPassword(passwordDialog.getPassword());
+ UserInformation.setSavePassword(passwordDialog.isSavePassword());
+ isDialogCancel = false;
+ }
+ else{
+ isDialogCancel = true;
+ }
+ }
+ });
+ return !isDialogCancel;
+ }
+
+ public void buildPackage(String pkgType) throws SBIException {
+ IConfiguration config = getCurrentConfiguration();
+
+ buildPackage(config, pkgType);
+ }
+
+
+ public void buildPackage(String configName, String pkgType) throws SBIException {
IConfiguration[] configurations = ManagedBuildManager.getBuildInfo(project).getManagedProject().getConfigurations();
IConfiguration config = null;
-
+
for (IConfiguration c : configurations) {
if (c.getName().equals(configName) ) {
config = c;
break;
}
}
-
- String targetID = getTargetID(config);
- String projectDir = getProjectPath();
- String options = getPackageOption(config);
- sbi.actionConsole("buildpackage", options, targetID, projectDir, "Packaging" );
+ buildPackage(config, pkgType);
}
+
- public void buildPackageDependencyCheck() throws SBIException {
-
- String targetID = getTargetID();
+ // command "build package" from specified configuration and pkgType
+ private void buildPackage(IConfiguration config, String pkgType) throws SBIException {
+ String targetID = getTargetID(config);
+ String projectDir = getProjectPath();
+ String options = getPackageOption(config, pkgType);
+
+ if (options == null) {
+ return;
+ }
+
+ sbi.actionConsole("buildpackage", options, targetID, projectDir, "Packaging" ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ public void buildPackageDependencyCheck() throws SBIException {
+
+ IConfiguration config = getCurrentConfiguration();
+ String targetID = getTargetID(config);
String projectDir = getProjectPath();
String options = getPackageDependencyCheckOption();
-
- sbi.actionConsole("checkbuilddeps", options, targetID, projectDir, "Packaging" );
- }
- @Override
- public String getTargetID() {
- IConfiguration config = getConfiguration();
- return PlatformConfigurationManager.getBuildTargetName(config);
+ sbi.actionConsole("checkbuilddeps", options, targetID, projectDir, "Packaging" );
}
-
+
+
@Override
- public String getTargetID(IConfiguration config) {
+ public String getTargetID(IConfiguration config) {
return PlatformConfigurationManager.getBuildTargetName(config);
}
-
+
@Override
public boolean isDependencyCheckSuppoted() {
return true;
@Override
protected String getPackageDependencyCheckOption() {
return "";
- }
+ }
@Override
public boolean isPackageCheckSuppoted() {
}
@Override
- public boolean checkPackageFile() {
+ public boolean checkPackageFile(String pkgType) {
return false;
}
+
+ @Override
+ public void buildPackage(String configName, String pkgType, boolean signApp)
+ throws SBIException, CoreException {
+ buildPackage(configName, pkgType);
+ }
+
+ @Override
+ public void buildPackage(String pkgType, boolean signApp)
+ throws SBIException, CoreException {
+ buildPackage(pkgType);
+ }
}
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.connection.debugtools.DebugTool;
import org.tizen.common.util.LocalPortChecker;
-
import org.tizen.nativecommon.build.CommonConfigurationManager;
import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
import org.tizen.nativecommon.build.ProjectTypeManager;
import org.tizen.sdblib.IDevice;
public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
- protected static final String PACKAGE_EXTENSION = ".deb";
- protected static final String CMD_RESULT_CHECK = "; echo $?;";
- protected static final String GDBSERVER_DIR = "gdbserver";
- protected static final String GDBSERVER_BIN = "gdbserver";
protected IConfiguration selectedConfig;
protected IDevice currentDevice;
protected String executeResult = "";
- protected static final String LOCALHOST = "127.0.0.1";
- protected static final String ENVIRONMENT_SETTING_CMD = "export ";
protected int localDebugPort = -1;
protected ICDISession debugSession;
- protected static final String ELM_SCALE_GETTER = "/home/developer/sdk_tools/elm_scale_getter/get_elm_scale ";
protected static final int defaultTimeOut = 60000;
protected String getPluginID() {
monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
- String gdbserverCmd = DebugTool.TOOLS_TARGET_PATH + "/" + GDBSERVER_DIR + "/" + GDBSERVER_BIN + " :" + gdbserverPort;
+ String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " :" + gdbserverPort;
String execArg = setArguments(config);
String envCmd = setEnvironments(config);
String command = envCmd + gdbserverCmd + " " + execArg;
protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
- wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, LOCALHOST);
+ wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, TizenPlatformConstants.LOCALHOST);
String gdbserverPort = wc.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
try {
String envs = "";
String[] envArray = getEnvironment(config);
for (String env : envArray)
- envs = ENVIRONMENT_SETTING_CMD + env + " && ";
+ envs = TizenPlatformConstants.ENVIRONMENT_SETTING_CMD + env + " && ";
return envs;
}
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
-
-import org.tizen.common.connection.debugtools.DebugTool;
+import org.tizen.common.TizenPlatformConstants;
import org.tizen.nativecommon.launch.TizenDeviceProcessList;
import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
import org.tizen.nativecommon.launch.TizenLaunchMessages;
public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegate {
protected Integer pid = Integer.valueOf(-1);
- protected final String ATTACH_OPTION = " --attach ";
@Override
protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
- wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, LOCALHOST);
+ wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, TizenPlatformConstants.LOCALHOST);
String gdbserverPort = wc.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
try {
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 + ATTACH_OPTION + pid;
- String gdbserverCmd = DebugTool.TOOLS_TARGET_PATH + "/" + GDBSERVER_DIR + "/" + GDBSERVER_BIN + " " + commandArguments;
+ String commandArguments = ":" + gdbserverPort + TizenPlatformConstants.ATTACH_OPTION + pid;
+ String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " " + commandArguments;
String envCmd = setEnvironments(config);
String command = envCmd + gdbserverCmd;
currentDevice.executeShellCommand(command);
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
-* Contact:
+* 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>
+* 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
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.launch.TizenLaunchMessages;
import org.tizen.sdblib.SyncService.SyncResult;
public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate {
- protected final static String DEFAULT_CORE_DIR = "/opt/bs/core";
private FileEntry coreDir = null;
@Override
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 {
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, "");
newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null);
String projectPath = project.getLocation().toOSString();
String coreFilePath = projectPath + "/core." + project.getName();
- boolean isSuccess = false;
+ 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);
}
String appPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
IPath hostPath = getHostPath(appPath, config);
-
+
GDBCDIDebugger2 debugger = new GDBCDIDebugger2();
ICDISession debugSession = ((ICDIDebugger2)debugger).createSession(launch, hostPath.toFile(), new SubProgressMonitor(monitor, 1));
if(debugSession == null)
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);
+ TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, "Select a directory where exist coredump file", currentDevice, true, TizenPlatformConstants.PUBICL_PLATFORM_CORE_PATH);
if (dlg.open() == TizenRemoteFileDialogResult.OK)
coreDir = dlg.getSelectedFileEntry();
else
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
-CANNOT_FIND_PROJECT_NAME = Cannot find a project name.
-CANNOT_CONNECT_TO_DEVICE = Cannot connect to a device.
-CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP = Cannot find binary file in a host rootstrap.
-CANNOT_CREATE_PACKAGE = Cannot create package.
-CANNOT_TRANSFER_FILE = Cannot transfer file.
-CANNOT_INSTALL = Cannot install application.
-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.
-BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE = Build configuration does not match with current device type. Select correct device or build configuration.
-CANNOT_FIND_HOST_ROOTSTRAP_PATH = Cannot find host rootstrap path.
-CANNOT_FIND_DEBIAN_CONTROL_FILE = Cannot find debian control file.
-CANNOT_FIND_PACKAGE_SECTION_IN_CONTROL_FILE = Cannot find package section in control file.
+CANNOT_FIND_PROJECT_NAME = Project name not found.
+CANNOT_CONNECT_TO_DEVICE = Device connection failed.
+CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP = Binary file not found in the host rootstrap.
+CANNOT_CREATE_PACKAGE = Package creation failed.
+CANNOT_TRANSFER_FILE = File transfer failed.
+CANNOT_INSTALL = Application installation failed.
+CANNOT_LAUNCH = Application launch failed.
+CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER = Application launch with GDBServer failed.
+CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT = Application launch with GDBClient failed.
+BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE = Build configuration does not match the current device type. Select the correct device or build configuration.
+CANNOT_FIND_HOST_ROOTSTRAP_PATH = Host rootstrap path not found.
+CANNOT_FIND_DEBIAN_CONTROL_FILE = Debian control file not found.
+CANNOT_FIND_PACKAGE_SECTION_IN_CONTROL_FILE = Package section not found in the control file.
OPERATION_CANCELED = Operation canceled.
-LAUNCH_APPLICATION = Launching Application...
-LAUNCH_APPLICATION_WITH_GDBSERVER = Launching application with GDBServer...
-LAUNCH_APPLICATION_WITH_GDBCLIENT = Launching application with GDBClient...
+LAUNCH_APPLICATION = Launching the application...
+LAUNCH_APPLICATION_WITH_GDBSERVER = Launching the application with GDBServer...
+LAUNCH_APPLICATION_WITH_GDBCLIENT = Launching the application with GDBClient...
PREPARE_TO_LAUNCH = Preparing to launch...
-START_DEPLOY_PROCESS = Start deploy process...
-CREATE_PACKAGE = Creating package...
-TRANSFER_PACKAGE = Transferring package...
-INSTALL_PACKAGE = Installing package...
+START_DEPLOY_PROCESS = Starting the deployment process...
+CREATE_PACKAGE = Creating the package...
+TRANSFER_PACKAGE = Transferring the package...
+INSTALL_PACKAGE = Installing the package...
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
+import org.tizen.sdblib.IDevice;
+
+public class DialogActionDelegate implements IWorkbenchWindowActionDelegate {
+
+ private IWorkbenchWindow window;
+
+ private SmartBuildInterface sbi = null;
+ private final String BUNDLE_NAME = DialogActionDelegate.class.getPackage().getName() + ".RPMPackageCommands";
+ private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ @Override
+ public void run(IAction action) {
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ String target = null;
+ boolean enableRootstrap = true;
+ boolean enableTarget = true;
+
+ IProject project = CurrentEnabledProject.getCurrentProject();
+ Shell shell = window.getShell();
+ if (project == null) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Project"));
+ return;
+ }
+ sbi = SmartBuildInterface.getInstance(project);
+
+ IConfiguration cfg = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+ String targetName = PlatformConfigurationManager.getBuildTargetName(cfg);
+
+ IManagedProject managedProject = cfg.getManagedProject();
+ String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
+ if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE)) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.Platformproject"));
+ return;
+ }
+
+ if (device == null) {
+ enableTarget = false;
+ } else {
+ target = device.getSerialNumber();
+ if (target == null) {
+ enableTarget = false;
+ }
+ }
+
+ String result = "";
+ try {
+ result = sbi.queryStdOut("command", targetName, null);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+ if (!result.contains("passwd")) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.SupportedRpm"));
+ return;
+ }
+ RPMPackageDialog pkgdlg = new RPMPackageDialog(window.getShell(), target, enableRootstrap, enableTarget);
+ pkgdlg.open();
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+}
--- /dev/null
+/*
+* Inhouse
+*
+* 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.nativeplatform.pkgmgr;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import org.tizen.common.connection.ConnectionPlugin;
+
+import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.sdblib.IDevice;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class PackageManagerHandler extends AbstractHandler {
+
+ private SmartBuildInterface sbi = null;
+
+ private final String BUNDLE_NAME = PackageManagerHandler.class.getPackage().getName() + ".RPMPackageCommands";
+ private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ /**
+ * The constructor.
+ */
+ public PackageManagerHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ String target = null;
+ boolean enableRootstrap = true;
+ boolean enableTarget = true;
+
+ IProject project = CurrentEnabledProject.getCurrentProject();
+ Shell shell = window.getShell();
+ if (project == null) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Project"));
+ return null;
+ }
+ sbi = SmartBuildInterface.getInstance(project);
+
+ IConfiguration cfg = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+ String targetName = PlatformConfigurationManager.getBuildTargetName(cfg);
+
+ IManagedProject managedProject = cfg.getManagedProject();
+ String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
+ if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE)) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.Platformproject"));
+ return null;
+ }
+
+ if (device == null) {
+ enableTarget = false;
+ } else {
+ target = device.getSerialNumber();
+ if (target == null) {
+ enableTarget = false;
+ }
+ }
+
+ String result = "";
+ try {
+ result = sbi.queryStdOut("command", targetName, null);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+ if (!result.contains("passwd")) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.SupportedRpm"));
+ return null;
+ }
+ RPMPackageDialog pkgdlg = new RPMPackageDialog(window.getShell(), target, enableRootstrap, enableTarget);
+ pkgdlg.open();
+
+ return null;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+* Inhouse
+*
+* 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.nativeplatform.pkgmgr;
+
+import org.eclipse.ui.console.MessageConsoleStream;
+
+import org.tizen.sdblib.MultiLineReceiver;
+
+public class PackageManagerOuputReceiver extends MultiLineReceiver {
+
+ public boolean isCancelled = false;
+ private boolean printConsole = true;
+ private String[] log = null;
+ private MessageConsoleStream mcs = null;
+
+ public PackageManagerOuputReceiver() {
+ super();
+
+ setTrimLine(false);
+ }
+
+ public void setMessageConsoleStream(MessageConsoleStream mcs) {
+ this.mcs = mcs;
+ }
+
+ public void setPrintConsole(boolean b) {
+ printConsole = b;
+ }
+
+ @Override
+ public void processNewLines(String[] lines) {
+ if (isCancelled == false) {
+ //processLogLines(lines);
+ log = lines;
+ if (printConsole) {
+ for (String line : lines) {
+ if (line.endsWith("\n")) {
+ mcs.print(line);
+ } else {
+ mcs.println(line);
+ }
+ }
+ }
+ }
+ }
+
+ public String[] getLog() {
+ return log;
+ }
+
+ public void cleanLog() {
+ log = null;
+ }
+
+ public boolean isCancelled() {
+ return isCancelled;
+ }
+
+}
--- /dev/null
+/*
+* Inhouse
+*
+* 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.nativeplatform.pkgmgr;
+
+import java.io.OutputStream;
+import java.util.ResourceBundle;
+
+import org.tizen.common.util.HostUtil;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
+import org.tizen.sdblib.IDevice;
+
+public class RPMPackageCommander {
+
+ private final static SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+ private final static int MAX_TIMEOUT = 10000;
+ private static String http_proxy = "";
+ private static String sudo_passwd = "";
+
+ private static final String BUNDLE_NAME = RPMPackageCommander.class.getPackage().getName() + ".RPMPackageCommands";
+ private static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ public RPMPackageCommander() {
+ }
+
+ public static void setHttpProxy(String proxy) {
+ http_proxy = proxy;
+ }
+
+ public static void setSudoPassword(String pwd) {
+ sudo_passwd = pwd;
+ }
+
+ public static void InstallPkgToRootstrap(String targetID, String fileList,
+ OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String cmd = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmd(fileList));
+ String options = getSbiCommand(cmd);
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void InstallPkgToRootstrap(SmartBuildInterface sbi, String targetID, String fileList,
+ OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String cmd = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmd(fileList));
+ String options = getSbiCommand(cmd);
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void InstallPkgToDevice(String fileList, IDevice device, PackageManagerOuputReceiver rec) {
+
+ if (device != null) {
+ try {
+ String command = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmd(fileList));
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ public static String getArchForFile(String filePath) {
+ return HostUtil.returnExecute(getQueryInfoCmd("ARCH", filePath));
+ }
+
+ public static String getPkgNameForFile(String filePath) {
+ return HostUtil.returnExecute(getQueryInfoCmd("NAME", filePath));
+ }
+
+ public static String getPkgVerForFile(String filePath) {
+ String version = HostUtil.returnExecute(getQueryInfoCmd("VERSION", filePath));
+ String release = HostUtil.returnExecute(getQueryInfoCmd("RELEASE", filePath));
+
+ return version + "-" + release;
+
+ }
+
+ public static String getPkgInstalledVerForRootstrap(String pkgName, String targetID) {
+ String retStr = "";
+ String version = "";
+ String release = "";
+
+ if (!pkgInstalledSuccessfullyForRootstrap(pkgName, targetID)) {
+ return retStr;
+ }
+
+ String result = null;
+ String cmd = String.format("%s;%s", getResetDbCmd(), getShowPkgInfoCmd(pkgName));
+ String options = getSbiCommand(cmd);
+
+ try {
+ result = sbi.actionStdOut("command", options, targetID, null);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ String[] splitResult = result.split("\n");
+ for (String r : splitResult) {
+ if (r.trim().startsWith("Version")) {
+ version = r.split(":")[1].trim();
+ } else if (r.trim().startsWith("Release")) {
+ release = r.split(":")[1].trim();
+ }
+ }
+
+ retStr = version + "-" + release;
+ return retStr;
+ }
+
+ public static String getPkgInstalledVerForDevice(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {
+ String retStr = "";
+ String version = "";
+ String release = "";
+
+ if (device != null) {
+ if (!pkgInstalledSuccessfullyForDevice(pkgName, device, rec)) {
+ return retStr;
+ }
+
+ try {
+ String command = String.format("%s;%s", getResetDbCmd(), getShowPkgInfoCmd(pkgName));
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ for (String l : rec.getLog()) {
+ if (l.trim().startsWith("Version")) {
+ version = l.split(":")[1].trim();
+ } else if (l.trim().startsWith("Release")) {
+ release = l.split(":")[1].trim();
+ }
+ }
+
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ retStr = version + "-" + release;
+ return retStr;
+ }
+
+ public static boolean pkgInstalledSuccessfullyForRootstrap(String pkgName, String targetID) {
+
+ boolean ret = false;
+ String result = "";
+
+ String cmd = String.format("%s;%s", getResetDbCmd(), getShowPkgCmd(pkgName));
+ String options = getSbiCommand(cmd);
+
+ try {
+ result = sbi.actionStdOut("command", options, targetID, null);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ if (!result.isEmpty() && result.contains(pkgName)) {
+ ret = true;
+ }
+
+ return ret;
+ }
+
+ public static boolean pkgInstalledSuccessfullyForDevice(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {
+
+ boolean ret = false;
+
+ if (device != null) {
+ try {
+ String command = String.format("%s;%s", getResetDbCmd(), getShowPkgCmd(pkgName));
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ if (rec.getLog() == null) {
+ return false;
+ }
+
+ for (String l : rec.getLog()) {
+ if (l.contains(pkgName)) {
+ ret = true;
+ }
+ }
+
+ return ret;
+ }
+
+ public static String getRemotePackageListForRootstrap(String targetID) {
+
+ String result = "";
+ String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRemotePkgListCmd());
+ String options = getSbiCommand(cmd);
+
+ try {
+ result = sbi.actionStdOut("command", options, targetID, null);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String getRemotePackageListForDevice(IDevice device, PackageManagerOuputReceiver rec) {
+
+ String result = "";
+
+ try {
+ String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRemotePkgListCmd());
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ for (String l : rec.getLog()) {
+ result = result.concat(l + "\n");
+ }
+
+ return result;
+ }
+
+ public static String getRepositoryListForRootstrap(String targetID) {
+
+ String result = "";
+ String cmd = String.format("%s;%s", getResetDbCmd(), getRepoListCmd());
+ String options = getSbiCommand(cmd);
+
+ try {
+ result = sbi.actionStdOut("command", options, targetID, null);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String getRepositoryListForDevice(IDevice device, PackageManagerOuputReceiver rec) {
+
+ String result = "";
+
+ try {
+ String command = String.format("%s;%s", getResetDbCmd(), getRepoListCmd());
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ for (String l : rec.getLog()) {
+ result = result.concat(l + "\n");
+ }
+
+ return result;
+ }
+
+ public static String refreshRepositoryForRootstrap(String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String result = "";
+ String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRefreshCmd());
+ String options = getSbiCommand(cmd);
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String refreshRepositoryForRootstrap(SmartBuildInterface sbi, String targetID,
+ OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String result = "";
+ String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRefreshCmd());
+ String options = getSbiCommand(cmd);
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String refreshRepositoryForDevice(IDevice device, PackageManagerOuputReceiver rec) {
+
+ String result = "";
+
+ try {
+ String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRefreshCmd());
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ for (String l : rec.getLog()) {
+ result = result.concat(l + "\n");
+ }
+
+ return result;
+ }
+
+ public static String addRepositoryForRootstrap(String name, String uri, String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String result = "";
+ String cmd = String.format("%s;%s", getResetDbCmd(), getAddRepoCmd(uri, name));
+ String options = getSbiCommand(cmd);
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String addRepositoryForDevice(String name, String uri, IDevice device, PackageManagerOuputReceiver rec) {
+
+ String result = "";
+
+ try {
+ String command = String.format("%s;%s", getResetDbCmd(), getAddRepoCmd(uri, name));
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ for (String l : rec.getLog()) {
+ result = result.concat(l + "\n");
+ }
+
+ return result;
+ }
+
+ public static String removeRepositoryForRootstrap(String name, String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String result = "";
+ String cmd = String.format("%s;%s", getResetDbCmd(), getRemoteRepoCmd(name));
+ String options = getSbiCommand(cmd);
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String removeRepositoryForDevice(String name, IDevice device, PackageManagerOuputReceiver rec) {
+
+ String result = "";
+
+ try {
+ String command = String.format("%s;%s", getResetDbCmd(), getRemoteRepoCmd(name));
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ for (String l : rec.getLog()) {
+ result = result.concat(l + "\n");
+ }
+
+ return result;
+ }
+
+ public static String installRemotePkgForRootstrap(String pkgList, String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String result = "";
+ String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(pkgList));
+ String options = getSbiCommand(cmd);
+
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String installRemotePkgForRootstrap(SmartBuildInterface sbi, String pkgList, String targetID,
+ OutputStream stdoutStream, OutputStream stderrStream) {
+
+ String result = "";
+ String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(pkgList));
+ String options = getSbiCommand(cmd);
+
+
+ try {
+ sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+ } catch (SBIException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public static String installRemotePkgForDevice(String pkgList, IDevice device, PackageManagerOuputReceiver rec) {
+
+ String result = "";
+
+ try {
+ String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(pkgList));
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ for (String l : rec.getLog()) {
+ result = result.concat(l + "\n");
+ }
+
+ return result;
+ }
+
+ public static void changeUpdateModeForDevice(IDevice device, PackageManagerOuputReceiver rec) {
+
+ try {
+ String command = resources.getString("Command.Change.Updatemode");
+ rec.cleanLog();
+ device.executeShellCommand(command, rec, MAX_TIMEOUT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static String getProxyCmd() {
+ return String.format(resources.getString("Command.Export.Proxy"), http_proxy);
+ }
+
+ private static String getResetDbCmd() {
+ return String.format(resources.getString("Command.Reset.Db"));
+ }
+
+ private static String getInstallPkgCmd(String pkgList) {
+ return String.format(resources.getString("Command.Install.Remote.Pkg"), pkgList);
+ }
+
+ private static String getInstallLocalPkgCmd(String pkgList) {
+ return String.format(resources.getString("Command.Install.Local.Pkg"), pkgList);
+ }
+
+ private static String getRemoteRepoCmd(String name) {
+ return String.format(resources.getString("Command.Remove.Repo"), name);
+ }
+
+ private static String getAddRepoCmd(String uri, String name) {
+ return String.format(resources.getString("Command.Add.Repo"), uri, name);
+ }
+
+ private static String getRefreshCmd() {
+ return resources.getString("Command.Refresh.Repo");
+ }
+
+ private static String getRepoListCmd() {
+ return resources.getString("Command.List.Repo");
+ }
+
+ private static String getRemotePkgListCmd() {
+ return resources.getString("Command.List.Remote.Pkg");
+ }
+
+ private static String getShowPkgCmd(String name) {
+ return String.format(resources.getString("Command.Show.Pkg"), name);
+ }
+
+ private static String getShowPkgInfoCmd(String name) {
+ return String.format(resources.getString("Command.Show.Info.Pkg"), name);
+ }
+
+ private static String getQueryInfoCmd(String tag, String name) {
+ return String.format(resources.getString("Command.Info.Pkg.File"), tag, name);
+ }
+
+ private static String getSbiCommand(String cmd) {
+ return String.format("-passwd=%s -path=. -cmd=\"%s\"", sudo_passwd, cmd);
+ }
+}
--- /dev/null
+Command.Export.Proxy = export http_proxy=%s
+Command.Reset.Db = rm -f /var/lib/rpm/__db*
+Command.Install.Remote.Pkg = zypper --non-interactive in %s
+Command.Install.Local.Pkg = rpm -ihv %s --ignoreos --force
+Command.Remove.Repo = zypper rr %s
+Command.Add.Repo = zypper ar %s %s
+Command.Refresh.Repo = zypper refresh
+Command.List.Repo = zypper lr -u
+Command.List.Remote.Pkg = zypper pa
+Command.Show.Pkg = rpm -qa %s
+Command.Show.Info.Pkg = rpm -qi %s
+Command.Info.Pkg.File = rpm -qp --qf "%%{%s}\n" %s
+Command.Change.Updatemode = /bin/change-booting-mode.sh --update
+
+PkgMgr.Error.Noselected.Project = No project selected. Select a Tizen platform project.
+PkgMgr.Error.Not.Platformproject = The selected project is not a Tizen platform project.
+PkgMgr.Error.Not.SupportedRpm = RPM package not supported by the build system.
+PkgMgr.Error.Not.RpmProject = The project is not RPM project.
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class LocalPackage extends Package {
+
+ private String path = "";
+
+ public LocalPackage() {
+ super();
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+public enum LocalPkgProvider {
+ INSTANCE;
+
+ private CopyOnWriteArrayList<LocalPackage> pkgs;
+
+ private LocalPkgProvider()
+ {
+ pkgs = new CopyOnWriteArrayList <LocalPackage>();
+ }
+
+ public void clear() {
+ pkgs.clear();
+ }
+
+ public CopyOnWriteArrayList<LocalPackage> getPkgs()
+ {
+ return pkgs;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class Package {
+ public static enum INSTALLINFO
+ {
+ INSTALLED, NOT_INSTALLED, DIFFERENT_VERSION
+ }
+
+ public static enum PKGTYPE
+ {
+ LOCAL, REMOTE
+ }
+
+ private String name = "";
+ private String arch = "";
+ private String newVersion = "";
+ private String installVersion = "";
+ private boolean checkColumn = true;
+ private INSTALLINFO installInfo = INSTALLINFO.NOT_INSTALLED;
+ private PKGTYPE pkgType = PKGTYPE.LOCAL;
+
+ public PKGTYPE getPkgType()
+ {
+ return pkgType;
+ }
+
+ public void setPkgType( PKGTYPE pkgType )
+ {
+ this.pkgType = pkgType;
+ }
+
+ public void setArch(String arch)
+ {
+ this.arch = arch;
+ }
+
+ public String getArch()
+ {
+ return arch;
+ }
+
+ public INSTALLINFO getInstallInfo()
+ {
+ return installInfo;
+ }
+
+ public void setInstallInfo( INSTALLINFO installInfo )
+ {
+ this.installInfo = installInfo;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setInstalledVersion(String ver) {
+ this.installVersion = ver;
+ }
+
+ public String getInstalledVersion() {
+ return installVersion;
+ }
+
+ public void setNewVersion(String ver) {
+ this.newVersion = ver;
+ }
+
+ public String getNewVersion() {
+ return newVersion;
+ }
+
+ public boolean getCheckColumn()
+ {
+ return checkColumn;
+ }
+
+ public void setCheckColumn( boolean check )
+ {
+ this.checkColumn = check;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public enum PackageProvider {
+ INSTANCE;
+
+ private CopyOnWriteArrayList<Package> buildsystem_pkgs;
+ private CopyOnWriteArrayList<Package> device_pkgs;
+
+ private PackageProvider()
+ {
+ buildsystem_pkgs = new CopyOnWriteArrayList <Package>();
+ device_pkgs = new CopyOnWriteArrayList <Package>();
+ }
+
+ public void clear() {
+ buildsystem_pkgs.clear();
+ device_pkgs.clear();
+ }
+
+ public CopyOnWriteArrayList<Package> getBuildsystemPkgs()
+ {
+ return buildsystem_pkgs;
+ }
+
+ public CopyOnWriteArrayList<Package> getDevicePkgs()
+ {
+ return device_pkgs;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class RemotePackage extends Package {
+
+ private String repository = "";
+ private boolean checkGrayed = false;
+
+ public RemotePackage() {
+ super();
+ }
+
+ public void setRepo(String repository)
+ {
+ this.repository = repository;
+ }
+
+ public String getRepo()
+ {
+ return repository;
+ }
+
+ public boolean getCheckGrayed()
+ {
+ return checkGrayed;
+ }
+
+ public void setCheckGrayed( boolean check )
+ {
+ this.checkGrayed = check;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+public enum RemotePkgProvider {
+ INSTANCE;
+
+ private CopyOnWriteArrayList<RemotePackage> pkgs;
+ private CopyOnWriteArrayList<RemotePackage> selected_pkgs;
+
+ private RemotePkgProvider()
+ {
+ pkgs = new CopyOnWriteArrayList <RemotePackage>();
+ selected_pkgs = new CopyOnWriteArrayList <RemotePackage>();
+ }
+
+ public void clear() {
+ pkgs.clear();
+ selected_pkgs.clear();
+ }
+
+ public CopyOnWriteArrayList<RemotePackage> getPkgs()
+ {
+ return pkgs;
+ }
+
+ public CopyOnWriteArrayList<RemotePackage> getSelectedPkgs()
+ {
+ return selected_pkgs;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class Repository {
+ private String name = "";
+ private String uri = "";
+ private boolean dirty = false;
+ private boolean checkColumn = false;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getUri()
+ {
+ return uri;
+ }
+
+ public void setUri(String uri)
+ {
+ this.uri = uri;
+ }
+
+ public boolean getCheckColumn()
+ {
+ return checkColumn;
+ }
+
+ public void setCheckColumn( boolean check )
+ {
+ this.checkColumn = check;
+ }
+
+ public boolean getCheckDirty()
+ {
+ return dirty;
+ }
+
+ public void setCheckDirty( boolean check )
+ {
+ this.dirty = check;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public enum RepositoryProvider {
+
+ INSTANCE;
+
+ private CopyOnWriteArrayList<Repository> buildsystem_repos;
+ private CopyOnWriteArrayList<Repository> device_repos;
+
+ private RepositoryProvider()
+ {
+ buildsystem_repos = new CopyOnWriteArrayList <Repository>();
+ device_repos = new CopyOnWriteArrayList <Repository>();
+ }
+
+ public void clear()
+ {
+ buildsystem_repos.clear();
+ device_repos.clear();
+ }
+
+ public CopyOnWriteArrayList<Repository> getBuildsystemRepos()
+ {
+ return buildsystem_repos;
+ }
+
+ public CopyOnWriteArrayList<Repository> getDeviceRepos()
+ {
+ return device_repos;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.swt.graphics.Color;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePackage;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+
+public class AddRemotePackageDialog extends Dialog {
+
+ private TableViewer packageViewer;
+ private int selectedColumn = 0;
+ private Display disp = null;
+
+ private int x = 0;
+ private int y = 0;
+ private final int width = 800;
+ private final int height = 800;
+
+ private final String BUNDLE_NAME = AddRemotePackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+ private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ protected AddRemotePackageDialog(Shell parentShell) {
+ super(parentShell);
+
+ Rectangle bounds = parentShell.getBounds();
+ x = bounds.x + (bounds.width - width)/2;
+ y = bounds.y + (bounds.height - height)/2;
+ this.disp = parentShell.getDisplay();
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+
+ newShell.setText(resources.getString("AddRemotePkg.Title"));
+ newShell.setLocation(x, y);
+ newShell.setSize(width, height);
+ }
+
+ @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));
+
+ createTable(composite);
+ return null;
+ }
+
+ private void createTable( Composite parent )
+ {
+
+ Composite bottom = new Composite( parent, SWT.NONE );
+ bottom.setLayoutData(new GridData(GridData.FILL_BOTH));
+ bottom.setLayout(new GridLayout(1, false));
+
+ Composite b2 = new Composite( bottom, SWT.NONE );
+ b2.setLayoutData(new GridData(GridData.FILL_BOTH));
+ b2.setLayout(new FillLayout());
+
+ packageViewer = new TableViewer( b2, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);
+ createColumns();
+ Table table = packageViewer.getTable();
+ table.addListener( SWT.Selection, new Listener(){
+
+ @Override
+ public void handleEvent(Event event) {
+ if( event.detail == SWT.CHECK ) {
+ RemotePackage pkg = (RemotePackage)event.item.getData();
+ pkg.setCheckColumn( !pkg.getCheckColumn() );
+ }
+ }
+ });
+
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ packageViewer.setContentProvider(new ArrayContentProvider());
+ packageViewer.setInput(RemotePkgProvider.INSTANCE.getPkgs());
+
+ updateCheck();
+ }
+
+ private void createColumns()
+ {
+ String[] titles = {"Package Name", "Repository", "Arch", "Version", "Status"};
+ int[] bounds = { 250, 120, 60, 150, 160};
+
+ TableViewerColumn colPackage = createTableViewerColumn( titles[0], bounds[0], SWT.NONE);
+
+ colPackage.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ return pkg.getName();
+ }
+ });
+
+ TableViewerColumn colInstallType = createTableViewerColumn( titles[1], bounds[1], SWT.NONE);
+
+ colInstallType.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ RemotePackage pkg = (RemotePackage)element;
+ return pkg.getRepo();
+ }
+ });
+
+ TableViewerColumn colArch = createTableViewerColumn( titles[2], bounds[2], SWT.NONE);
+
+ colArch.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ RemotePackage pkg = (RemotePackage)element;
+ String arch = "";
+ arch = pkg.getArch();
+ return arch;
+ }
+ });
+
+ TableViewerColumn colNewVer = createTableViewerColumn( titles[3], bounds[3], SWT.NONE);
+
+ colNewVer.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ RemotePackage pkg = (RemotePackage)element;
+ String newVer = "";
+ newVer = pkg.getNewVersion();
+ return newVer;
+ }
+ });
+
+ TableViewerColumn colStatus = createTableViewerColumn( titles[4], bounds[4], SWT.NONE);
+
+ colStatus.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ RemotePackage pkg = (RemotePackage)element;
+ String status = "";
+ status = pkg.getInstallInfo().toString();
+ return status;
+ }
+ });
+ }
+
+ private TableViewerColumn createTableViewerColumn( String title, int bound, int Style) {
+
+ final TableViewerColumn viewerColumn = new TableViewerColumn( packageViewer, Style);
+ final TableColumn column = viewerColumn.getColumn();
+ column.addSelectionListener(new TableSelectionAdapter());
+ column.setText(title);
+ column.setWidth(bound);
+ column.setResizable(true);
+ column.setMoveable(true);
+ return viewerColumn;
+ }
+
+ @Override
+ protected void okPressed() {
+
+ for(RemotePackage p : RemotePkgProvider.INSTANCE.getPkgs()) {
+ if (p.getCheckColumn() && !Package.INSTALLINFO.INSTALLED.equals(p.getInstallInfo())) {
+ RemotePkgProvider.INSTANCE.getSelectedPkgs().add(p);
+ }
+ }
+
+ super.okPressed();
+ }
+
+ private class TableSelectionAdapter extends SelectionAdapter
+ {
+ public void widgetSelected(SelectionEvent e) {
+ selectedColumn = packageViewer.getTable().indexOf((TableColumn) e.widget);
+ packageViewer.getTable().setSortColumn((TableColumn)e.widget);
+ if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+ packageViewer.getTable().setSortDirection(SWT.UP);
+ } else {
+ packageViewer.getTable().setSortDirection(SWT.DOWN);
+ }
+
+ packageViewer.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int result = 0;
+
+ RemotePackage entry_1 = (RemotePackage)e1;
+ RemotePackage entry_2 = (RemotePackage)e2;
+
+ switch (selectedColumn) {
+ case 0:
+ if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getName().compareTo(entry_2.getName());
+ } else {
+ result = entry_2.getName().compareTo(entry_1.getName());
+ }
+ break;
+ case 1:
+ if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getRepo().compareTo(entry_2.getRepo());
+ } else {
+ result = entry_2.getRepo().compareTo(entry_1.getRepo());
+ }
+ break;
+ case 2:
+ if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getArch().compareTo(entry_2.getArch());
+ } else {
+ result = entry_2.getArch().compareTo(entry_1.getArch());
+ }
+ break;
+ case 3:
+ if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getNewVersion().compareTo(entry_2.getNewVersion());
+ } else {
+ result = entry_2.getNewVersion().compareTo(entry_1.getNewVersion());
+ }
+ break;
+ case 4:
+ if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getInstallInfo().toString().compareTo(entry_2.getInstallInfo().toString());
+ } else {
+ result = entry_2.getInstallInfo().toString().compareTo(entry_1.getInstallInfo().toString());
+ }
+ break;
+ }
+
+ return result;
+ }
+ });
+ updateCheck();
+ }
+ }
+
+ private void updateCheck() {
+ int recentTableIndex = packageViewer.getTable().getItemCount();
+ Color installedColor = disp.getSystemColor(SWT.COLOR_LIST_SELECTION);
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = packageViewer.getTable().getItem(i);
+ RemotePackage pkg = (RemotePackage)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ if (Package.INSTALLINFO.INSTALLED.equals(pkg.getInstallInfo())) {
+ item.setBackground(installedColor);
+ }
+ }
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.util.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+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.swt.widgets.Text;
+
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativeplatform.pkgmgr.model.Repository;
+import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
+
+public class AddRepoDialog extends Dialog {
+
+ private Text nameText;
+ private Text uriText;
+ private String tab;
+
+ private int x = 0;
+ private int y = 0;
+ private final int width = 500;
+ private final int height = 200;
+
+ private final String BUNDLE_NAME = AddRepoDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+ private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ protected AddRepoDialog(Shell parentShell) {
+ super(parentShell);
+ }
+
+ public AddRepoDialog(Shell parentShell, String tab) {
+ super(parentShell);
+ this.tab = tab;
+ Rectangle bounds = parentShell.getBounds();
+ x = bounds.x + (bounds.width - width)/2;
+ y = bounds.y + (bounds.height - height)/2;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+
+ newShell.setText(resources.getString("AddRepo.Title"));
+ newShell.setLocation(x, y);
+ newShell.setSize(width, height);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ Composite composite = new Composite( parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ composite.setLayout(new GridLayout(2, false));
+
+ Label nameLabel = new Label(composite, SWT.NONE);
+ nameLabel.setText(resources.getString("AddRepo.Label.Name"));
+ nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+ GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+ gridData.widthHint = 500;
+ nameText.setLayoutData(gridData);
+
+ Label urlLabel = new Label(composite, SWT.NONE);
+ urlLabel.setText(resources.getString("AddRepo.Label.Uri"));
+ uriText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+ gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+ gridData.widthHint = 500;
+ uriText.setLayoutData(gridData);
+
+ return null;
+ }
+
+ @Override
+ protected void okPressed() {
+
+ CopyOnWriteArrayList<Repository> list = null;
+ Repository repo = new Repository();
+ repo.setName(nameText.getText());
+ repo.setUri(uriText.getText());
+
+ if (resources.getString("PkgMgr.Tab.Buildsystem").equals(tab)) {
+ list = RepositoryProvider.INSTANCE.getBuildsystemRepos();
+ // if repository name or url already exist, then return
+ if (checkRepoExists(list, repo)) {
+ return;
+ } else {
+ repo.setCheckDirty(true);
+ RepositoryProvider.INSTANCE.getBuildsystemRepos().add(repo);
+ }
+ } else if (resources.getString("PkgMgr.Tab.Device").equals(tab)) {
+ list = RepositoryProvider.INSTANCE.getDeviceRepos();
+ // if repository name or url already exist, then return
+ if (checkRepoExists(list, repo)) {
+ return;
+ } else {
+ repo.setCheckDirty(true);
+ RepositoryProvider.INSTANCE.getDeviceRepos().add(repo);
+ }
+ }
+
+ super.okPressed();
+ }
+
+ private boolean checkRepoExists(CopyOnWriteArrayList<Repository> list, Repository repo) {
+ for( Repository r : list) {
+ if (r.getName().equals(repo.getName()) || r.getUri().equals(repo.getUri())) {
+ DialogUtil.openMessageDialog(resources.getString("AddRepo.Message.AlreadyExist"));
+ return true;
+ }
+ }
+ return false;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.tizen.common.ui.view.console.ConsoleManager;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.FileUtil;
+import org.tizen.nativecommon.build.CheckCancelJob;
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePackage;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+import org.tizen.nativeplatform.pkgmgr.model.Repository;
+import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
+
+public class BuildSystemTab {
+
+ private IProject project;
+ private TabFolder folder = null;
+ private String conf = null;
+ private String targetId = null;
+ private TableViewer repoViewer = null;
+ private TableViewer pkgViewer = null;
+ private final Shell shell;
+ private FileDialog fd;
+ private String previousFilterPath = null;
+ private String selectedFileList;
+ private CopyOnWriteArrayList<Package> pkgs;
+ private SmartBuildInterface sbi = null;
+
+ private final String BUNDLE_NAME = BuildSystemTab.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+ private final ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ public BuildSystemTab(Shell shell, TabFolder folder, String conf, String targetId) {
+ this.shell = shell;
+ this.folder = folder;
+ this.conf = conf;
+ this.targetId = targetId;
+ this.project = CurrentEnabledProject.getCurrentProject();
+ this.sbi = SmartBuildInterface.getInstance(project);
+ }
+
+ public void createTab() {
+ initialize();
+ createBuildsystemTab(folder);
+ }
+
+ private void initialize() {
+ RepositoryProvider.INSTANCE.getBuildsystemRepos().clear();
+ PackageProvider.INSTANCE.getBuildsystemPkgs().clear();
+
+ String result = RPMPackageCommander.getRepositoryListForRootstrap(targetId);
+ String[] splitStr = result.split("\n");
+ // url list starts at 3 line
+ for (int i = 3 ; i < splitStr.length ; i++) {
+ String s = splitStr[i];
+ s = s.replaceAll(" ", "");
+ String[] part = s.split("\\|");
+ String name = part[1];
+ String uri = part[5];
+
+ Repository repo = new Repository();
+ repo.setName(name);
+ repo.setUri(uri);
+
+ RepositoryProvider.INSTANCE.getBuildsystemRepos().add(repo);
+ }
+ }
+
+ private void createBuildsystemTab( TabFolder parent )
+ {
+ TabItem buildsystemTab = new TabItem( parent, SWT.NULL );
+ buildsystemTab.setText(resources.getString("PkgMgr.Tab.Buildsystem"));
+
+ Composite composite = new Composite(folder, SWT.NONE);
+ buildsystemTab.setControl(composite);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createInfoComposite( composite );
+ createRepositoryGroup( composite );
+ createPackageGroup( composite );
+ }
+
+ private void createInfoComposite( Composite parent )
+ {
+ Composite info_comp = new Composite( parent, SWT.NONE );
+ info_comp.setLayoutData(new GridData(GridData.BEGINNING));
+ info_comp.setLayout(new GridLayout(1, false));
+
+ Label configurationLabel = new Label(info_comp, SWT.LEFT);
+ configurationLabel.setText(String.format("%s %s", resources.getString("PkgMgr.Label.Configuration"), conf));
+ }
+
+ private void createRepositoryGroup( Composite parent )
+ {
+ Group grpRepo = new Group(parent, SWT.NONE);
+ grpRepo.setText(resources.getString("PkgMgr.Frame.Respository"));
+ grpRepo.setLayout(new GridLayout(1, false));
+ GridData repo_gd = new GridData(GridData.FILL_BOTH);
+ grpRepo.setLayoutData(repo_gd);
+
+ Composite repo_comp = new Composite( grpRepo, SWT.NONE );
+ repo_comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ repo_comp.setLayout(new GridLayout(2, false));
+
+ Composite repo_comp_table = new Composite( repo_comp, SWT.NONE );
+ repo_comp_table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ repo_comp_table.setLayout(new FillLayout());
+
+ Composite repo_comp_buttons = new Composite( repo_comp, SWT.NONE );
+ repo_comp_buttons.setLayoutData(new GridData(GridData.FILL_BOTH));
+ repo_comp_buttons.setLayout(new GridLayout(1, false));
+
+ createRepositoryTable( repo_comp_table );
+ createRepositoryButtons( repo_comp_buttons );
+ }
+
+ private void createPackageGroup( Composite parent )
+ {
+ Group grpPkg = new Group(parent, SWT.NONE);
+ grpPkg.setText(resources.getString("PkgMgr.Frame.Package"));
+ grpPkg.setLayout(new GridLayout(1, false));
+ GridData pkgs_gd = new GridData(GridData.FILL_BOTH);
+ pkgs_gd.heightHint = shell.getBounds().height / 3;
+ grpPkg.setLayoutData(pkgs_gd);
+
+ Composite pkg_comp = new Composite( grpPkg, SWT.NONE );
+ pkg_comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ pkg_comp.setLayout(new GridLayout(2, false));
+
+ Composite pkg_comp_table = new Composite( pkg_comp, SWT.NONE );
+ pkg_comp_table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ pkg_comp_table.setLayout(new FillLayout());
+
+ Composite pkg_comp_buttons = new Composite( pkg_comp, SWT.NONE );
+ pkg_comp_buttons.setLayoutData(new GridData(GridData.FILL_BOTH));
+ pkg_comp_buttons.setLayout(new GridLayout(1, false));
+
+ createPackageTable( pkg_comp_table );
+ createPackageButtons( pkg_comp_buttons );
+ }
+
+ private void createRepositoryTable( Composite parent)
+ {
+ repoViewer = new TableViewer( parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
+ createColumnsForRepoTable( parent );
+ Table tableForRepository = repoViewer.getTable();
+ tableForRepository.addListener( SWT.Selection, new Listener(){
+
+ @Override
+ public void handleEvent(Event event) {
+ if( event.detail == SWT.CHECK )
+ {
+ Repository repo = (Repository)event.item.getData();
+ repo.setCheckColumn( !repo.getCheckColumn() );
+ }
+ }
+ });
+ tableForRepository.setHeaderVisible(true);
+ tableForRepository.setLinesVisible(true);
+ repoViewer.setContentProvider(new ArrayContentProvider());
+ repoViewer.setInput(RepositoryProvider.INSTANCE.getBuildsystemRepos());
+ }
+
+ private void createRepositoryButtons( Composite parent )
+ {
+ Button add_bt = new Button( parent, SWT.PUSH );
+ add_bt.setText(resources.getString("PkgMgr.Button.AddRepo"));
+ add_bt.setToolTipText(resources.getString("PkgMgr.Button.AddRepo.Tooltip"));
+ add_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ AddRepoDialog dialog = new AddRepoDialog(shell, resources.getString("PkgMgr.Tab.Buildsystem"));
+ dialog.open();
+ repoViewer.refresh();
+
+ int recentTableIndex = 0;
+ recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = null;
+ item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+
+ if (repo.getCheckDirty()) {
+ ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+ cm.clear();
+ MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs = cm.getMessageConsoleStream();
+ RPMPackageCommander.addRepositoryForRootstrap(repo.getName(), repo.getUri(), targetId, mcs, mcsError);
+ repo.setCheckDirty(false);
+ }
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+
+ Button modify_bt = new Button( parent, SWT.PUSH );
+ modify_bt.setText(resources.getString("PkgMgr.Button.ModifyRepo"));
+ modify_bt.setToolTipText(resources.getString("PkgMgr.Button.ModifyRepo.Tooltip"));
+ modify_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ CopyOnWriteArrayList<Repository> list = RepositoryProvider.INSTANCE.getBuildsystemRepos();
+
+ Repository selectedRepo = null;
+ int count = 0;
+
+ for( Repository repo : list) {
+ if (repo.getCheckColumn()) {
+ count++;
+ selectedRepo = repo;
+ }
+ }
+
+ if (count != 1 ) {
+ DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
+ return;
+ }
+
+ ModifyRepoDialog dialog = new ModifyRepoDialog(shell, resources.getString("PkgMgr.Tab.Buildsystem"),
+ selectedRepo.getName(), selectedRepo.getUri());
+ dialog.open();
+
+ repoViewer.refresh();
+
+ int recentTableIndex = 0;
+ recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = null;
+ item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+
+ if (repo.getCheckDirty()) {
+ list.remove(selectedRepo);
+ ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+ cm.clear();
+ MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs = cm.getMessageConsoleStream();
+ RPMPackageCommander.removeRepositoryForRootstrap(selectedRepo.getName(), targetId, mcs, mcsError);
+
+ cm.clear();
+ mcsError = cm.getMessageConsoleStream();
+ mcs = cm.getMessageConsoleStream();
+ RPMPackageCommander.addRepositoryForRootstrap(repo.getName(), repo.getUri(), targetId, mcs, mcsError);
+ repo.setCheckDirty(false);
+ }
+ }
+
+ repoViewer.refresh();
+ recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+ Button remove_bt = new Button( parent, SWT.PUSH );
+ remove_bt.setText(resources.getString("PkgMgr.Button.RemoveRepo"));
+ remove_bt.setToolTipText(resources.getString("PkgMgr.Button.RemoveRepo.Tooltip"));
+ remove_bt.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ CopyOnWriteArrayList<Repository> list = RepositoryProvider.INSTANCE.getBuildsystemRepos();
+
+ for( Repository repo : list)
+ {
+ boolean selected = false;
+ selected = repo.getCheckColumn();
+
+ if (selected) {
+ list.remove(repo);
+ ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+ cm.clear();
+ MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs = cm.getMessageConsoleStream();
+ RPMPackageCommander.removeRepositoryForRootstrap(repo.getName(), targetId, mcs, mcsError);
+ }
+ }
+
+ repoViewer.refresh();
+ int recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+ }
+
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+ Button refresh_bt = new Button( parent, SWT.PUSH );
+ refresh_bt.setText(resources.getString("PkgMgr.Button.RefreshRepo"));
+ refresh_bt.setToolTipText(resources.getString("PkgMgr.Button.RefreshRepo.Tooltip"));
+ refresh_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Refreshing"), -1);
+
+ CheckCancelJob cancelJob = new CheckCancelJob(monitor, project, sbi, true);
+
+ ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+ cm.clear();
+ MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs = cm.getMessageConsoleStream();
+ Thread checkCancelThread = new Thread(cancelJob);
+ checkCancelThread.start();
+
+ RPMPackageCommander.refreshRepositoryForRootstrap(sbi, targetId, mcs, mcsError);
+
+ cancelJob.setFinishFlag(true);
+ }
+ });
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+ }
+
+ private void createPackageTable( Composite parent )
+ {
+ pkgViewer = new TableViewer( parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
+ createColumns( parent );
+ Table packageTable = pkgViewer.getTable();
+ packageTable.addListener( SWT.Selection, new Listener(){
+
+ @Override
+ public void handleEvent(Event event) {
+ if( event.detail == SWT.CHECK )
+ {
+ Package pkg = (Package)event.item.getData();
+ pkg.setCheckColumn( !pkg.getCheckColumn() );
+ }
+ }
+ });
+
+ packageTable.setHeaderVisible(true);
+ packageTable.setLinesVisible(true);
+
+ pkgViewer.setContentProvider(new ArrayContentProvider());
+ pkgViewer.setInput(PackageProvider.INSTANCE.getBuildsystemPkgs());
+ }
+
+ private void createPackageButtons( Composite parent )
+ {
+ Button add_rtpkg_bt = new Button( parent, SWT.PUSH );
+ add_rtpkg_bt.setText(resources.getString("PkgMgr.Button.AddRPackage"));
+ add_rtpkg_bt.setToolTipText(resources.getString("PkgMgr.Button.AddRPackage.Tooltip"));
+ add_rtpkg_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ RemotePkgProvider.INSTANCE.getPkgs().clear();
+ RemotePkgProvider.INSTANCE.getSelectedPkgs().clear();
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Getting.RemotePackage"), -1);
+ genRemotePkgList();
+ }
+ });
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ AddRemotePackageDialog dlg = new AddRemotePackageDialog(shell);
+ dlg.open();
+
+ dialog = new ProgressMonitorDialog(shell);
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Adding.Package"), -1);
+ for (RemotePackage p : RemotePkgProvider.INSTANCE.getSelectedPkgs()) {
+ addRemotePackage(p);
+ }
+ }
+ });
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ pkgViewer.refresh();
+ int recentTableIndex = pkgViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = pkgViewer.getTable().getItem(i);
+ Package pkg = (Package)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ }
+
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+
+ Button add_lcpkg_bt = new Button( parent, SWT.PUSH );
+ add_lcpkg_bt.setText(resources.getString("PkgMgr.Button.AddLPackage"));
+ add_lcpkg_bt.setToolTipText(resources.getString("PkgMgr.Button.AddLPackage.Tooltip"));
+ add_lcpkg_bt.addMouseListener(new MouseListener()
+ {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ int oldTableIndex = pkgViewer.getTable().getItemCount();
+
+ fd = new FileDialog( shell, SWT.OPEN|SWT.MULTI);
+ fd.setText(resources.getString("FileDlg.Title"));
+ if (previousFilterPath == null)
+ fd.setFilterPath(null);
+ else
+ fd.setFilterPath(previousFilterPath);
+ String[] filterExt = { resources.getString("FileDlg.Filter.Ext") };
+ fd.setFilterExtensions(filterExt);
+
+ try {
+ String arch = sbi.getArchitectureFromToolchainID(sbi.getToolchainIDFromTargetID(targetId));
+ String _arch = "";
+ if ("armel".equals(arch)) {
+ _arch = "armv7l";
+ } else if ("i386".equals(arch)) {
+ _arch = "i586";
+ } else {
+ _arch = arch;
+ }
+ String rootstrapPath = sbi.getRootstrapPath(targetId);
+ String defaultPath = rootstrapPath + resources.getString("FileDlg.Default.Path") + _arch;
+ fd.setFilterPath(defaultPath);
+ } catch (SBIException e2) {
+ e2.printStackTrace();
+ }
+
+ selectedFileList = fd.open();
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, false, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Adding.Package"), -1);
+ if( selectedFileList != null )
+ {
+ String[] files = fd.getFileNames();
+ previousFilterPath = fd.getFilterPath();
+ for (int i=0, n = files.length; i<n; i++) {
+ monitor.subTask(String.format("Adding %s", files[i]));
+ StringBuffer buf = new StringBuffer();
+ buf.append(fd.getFilterPath());
+ if (buf.charAt(buf.length() -1) != File.separatorChar) {
+ buf.append(File.separatorChar);
+ }
+ buf.append(files[i]);
+ addLocalPackage( buf.toString());
+ }
+ }
+ }
+ });
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ pkgViewer.refresh();
+
+ int recentTableIndex = pkgViewer.getTable().getItemCount();
+
+ for (int i = oldTableIndex; i < recentTableIndex; i++) {
+ TableItem item = pkgViewer.getTable().getItem(i);
+ Package pkg = (Package)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+
+ Button remove_bt = new Button( parent, SWT.PUSH );
+ remove_bt.setText(resources.getString("PkgMgr.Button.RemoveList"));
+ remove_bt.setToolTipText(resources.getString("PkgMgr.Button.RemoveList.Tooltip"));
+ remove_bt.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ CopyOnWriteArrayList<Package> pkgList = PackageProvider.INSTANCE.getBuildsystemPkgs();
+ for( Package pkg: pkgList)
+ {
+ boolean selected = false;
+ selected = pkg.getCheckColumn();
+ if (selected) {
+ pkgList.remove(pkg);
+ }
+ }
+ pkgViewer.refresh();
+
+ int recentTableIndex = pkgViewer.getTable().getItemCount();
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = null;
+ item = pkgViewer.getTable().getItem(i);
+ Package pkg = (Package)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+
+ Button install_bt = new Button( parent, SWT.PUSH );
+ install_bt.setText(resources.getString("PkgMgr.Button.Install"));
+ install_bt.setToolTipText(resources.getString("PkgMgr.Button.Install.Tooltip"));
+ install_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ pkgs = getSelectedPkg(PackageProvider.INSTANCE.getBuildsystemPkgs());
+
+ if(pkgs.isEmpty()) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Package"));
+ return;
+ }
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
+
+ CheckCancelJob cancelJob = new CheckCancelJob(monitor, project, sbi, true);
+
+ try {
+ String rpmPathList = "";
+ String localPkgList = "";
+ String remotePkgList = "";
+ String rootstrapPath = sbi.getRootstrapPath(targetId);
+
+ ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+ cm.clear();
+ MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs1 = cm.getMessageConsoleStream();
+ MessageConsoleStream mcsError2 = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs2 = cm.getMessageConsoleStream();
+
+ for (Package pkg : pkgs) {
+ if (pkg instanceof LocalPackage) {
+ LocalPackage p = (LocalPackage)pkg;
+ String filePath = p.getPath();
+ String filename = new File(filePath).getName();
+ String pathOnRootstrap = "/tmp/" + filename;
+ String copyToPath = rootstrapPath + pathOnRootstrap;
+ FileUtil.copyTo(filePath, copyToPath);
+ rpmPathList = rpmPathList.concat(pathOnRootstrap + " ");
+ localPkgList = localPkgList.concat(pkg.getName() + " ");
+ } else if (pkg instanceof RemotePackage) {
+ remotePkgList = remotePkgList.concat(pkg.getName() + " ");
+ }
+ }
+
+ Thread checkCancelThread = new Thread(cancelJob);
+ checkCancelThread.start();
+
+ if(!"".equals(remotePkgList)) {
+ monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), remotePkgList));
+ mcs1.write(resources.getString("PkgMgr.Console.Remote.Install"));
+ RPMPackageCommander.installRemotePkgForRootstrap(sbi, remotePkgList, targetId, mcs, mcsError);
+ }
+
+ if(!"".equals(localPkgList)) {
+ monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), localPkgList));
+ mcs1.write(resources.getString("PkgMgr.Console.Local.Install"));
+ RPMPackageCommander.InstallPkgToRootstrap(sbi, targetId, rpmPathList, mcs2, mcsError2);
+ for (String p : rpmPathList.split(" ")) {
+ File f = new File(rootstrapPath + p);
+ if (f.exists()) {
+ f.delete();
+ }
+ }
+ }
+
+ for (Package pkg : pkgs) {
+ String installedVer = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), targetId);
+ pkg.setInstalledVersion(installedVer);
+ if ("".equals(installedVer)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+ } else if (installedVer.equals(pkg.getNewVersion())) {
+ if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), targetId)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+ } else {
+ pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+ }
+ } else {
+ pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+ }
+ }
+
+ } catch (IOException e) {
+ cancelJob.setFinishFlag(true);
+ e.printStackTrace();
+ } catch (SBIException e) {
+ cancelJob.setFinishFlag(true);
+ e.printStackTrace();
+ }
+
+ cancelJob.setFinishFlag(true);
+ monitor.done();
+ }
+ });
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ pkgViewer.refresh();
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+ }
+
+ private void createColumnsForRepoTable( Composite parent )
+ {
+ String[] titles = {"Name", "Reposity URL"};
+ int[] bounds = { 200, 600 };
+
+ TableViewerColumn colName = createTableViewerColumn( repoViewer, titles[0], bounds[0], SWT.NONE);
+ TableColumn column = colName.getColumn();
+ column.addSelectionListener(new RepoTableSelectionAdapter(repoViewer));
+
+ colName.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Repository repo = (Repository)element;
+ return repo.getName();
+ }
+ });
+
+ TableViewerColumn colUrl = createTableViewerColumn( repoViewer, titles[1], bounds[1], SWT.NONE);
+ column = colUrl.getColumn();
+ column.addSelectionListener(new RepoTableSelectionAdapter(repoViewer));
+
+ colUrl.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Repository repo = (Repository)element;
+ return repo.getUri();
+ }
+ });
+ }
+
+ private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
+
+ final TableViewerColumn viewerColumn = new TableViewerColumn( viewer, Style);
+ final TableColumn column = viewerColumn.getColumn();
+ column.addSelectionListener(new PackageTableSelectionAdapter(pkgViewer));
+ column.setText(title);
+ column.setWidth(bound);
+ column.setResizable(true);
+ column.setMoveable(true);
+ return viewerColumn;
+ }
+
+ private void createColumns( Composite parent )
+ {
+ String[] titles = {"Install Type", "Package Name", "Arch", "New Version", "Installed Version", "Status"};
+ int[] bounds = { 120, 250, 60, 150, 150, 150};
+
+ TableViewerColumn colInstallType = createTableViewerColumn( pkgViewer, titles[0], bounds[0], SWT.NONE);
+
+ colInstallType.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ return pkg.getPkgType().toString();
+ }
+ });
+
+ TableViewerColumn colPackage = createTableViewerColumn( pkgViewer, titles[1], bounds[1], SWT.NONE);
+
+ colPackage.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ return pkg.getName();
+ }
+ });
+
+ TableViewerColumn colArch = createTableViewerColumn( pkgViewer, titles[2], bounds[2], SWT.NONE);
+
+ colArch.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String arch = pkg.getArch();
+ return arch;
+ }
+ });
+
+ TableViewerColumn colNewVer = createTableViewerColumn( pkgViewer, titles[3], bounds[3], SWT.NONE);
+
+ colNewVer.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String newVer = pkg.getNewVersion();
+ return newVer;
+ }
+ });
+
+ TableViewerColumn colInsVer = createTableViewerColumn( pkgViewer, titles[4], bounds[4], SWT.NONE);
+ colInsVer.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String installedVer = pkg.getInstalledVersion();
+ return installedVer;
+ }
+ });
+
+ TableViewerColumn colStatus = createTableViewerColumn( pkgViewer, titles[5], bounds[5], SWT.NONE);
+
+ colStatus.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String status = pkg.getInstallInfo().toString();
+ return status;
+ }
+ });
+ }
+
+ private void genRemotePkgList() {
+
+ String list = RPMPackageCommander.getRemotePackageListForRootstrap(targetId);
+ String[] splitStr = list.split("\n");
+
+ // Package list starts at 5 line
+ for (int i = 5 ; i < splitStr.length ; i++) {
+ String s = splitStr[i];
+ s = s.replaceAll(" ", "");
+ String[] part = s.split("\\|");
+ String status = part[0];
+ String repo = part[1];
+ String name = part[2];
+ String version = part[3];
+ String arch = part[4];
+
+ RemotePackage pkg = new RemotePackage();
+ pkg.setName(name);
+ pkg.setArch(arch);
+ pkg.setNewVersion(version);
+ pkg.setRepo(repo);
+ pkg.setCheckColumn(false);
+ if ("i".equals(status)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+ } else if ("v".equals(status)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+ }
+
+ RemotePkgProvider.INSTANCE.getPkgs().add(pkg);
+ }
+ }
+
+ private void addRemotePackage( RemotePackage p ) {
+ CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getBuildsystemPkgs();
+ Iterator<Package> debIter = pkgs.iterator();
+
+ while( debIter.hasNext() ) {
+ Package pkg = debIter.next();
+ if( pkg.getName().equals(p.getName()) &&
+ pkg.getNewVersion().equals(p.getNewVersion()) ) {
+ return;
+ }
+ }
+
+ String installedVer = RPMPackageCommander.getPkgInstalledVerForRootstrap(p.getName(), targetId);
+ p.setInstalledVersion(installedVer);
+ p.setCheckColumn(true);
+ p.setPkgType(Package.PKGTYPE.REMOTE);
+ PackageProvider.INSTANCE.getBuildsystemPkgs().add(p);
+ }
+
+ private void addLocalPackage( String rpmPath )
+ {
+ CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getBuildsystemPkgs();
+ Iterator<Package> debIter = pkgs.iterator();
+
+ String pkgName = RPMPackageCommander.getPkgNameForFile(rpmPath);
+ String newVer = RPMPackageCommander.getPkgVerForFile(rpmPath);
+
+ while( debIter.hasNext() ) {
+ Package pkg = debIter.next();
+ if( pkg.getName().equals(pkgName) && pkg.getNewVersion().equals(newVer)) {
+ return;
+ }
+ }
+
+ LocalPackage pkg = new LocalPackage();
+ pkg.setName(pkgName);
+ pkg.setPath(rpmPath);
+ pkg.setPkgType(Package.PKGTYPE.LOCAL);
+ pkg.setArch(RPMPackageCommander.getArchForFile(rpmPath));
+ pkg.setNewVersion(newVer);
+
+ String installedVerForRootstrap = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), targetId);
+ pkg.setInstalledVersion(installedVerForRootstrap);
+
+ if ("".equals(newVer)) {
+ pkg.setCheckColumn(false);
+ } else if (!"".equals(installedVerForRootstrap)) {
+ if (!installedVerForRootstrap.equals(newVer)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+ } else {
+ if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkgName, targetId)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+ }
+ }
+ }
+
+ PackageProvider.INSTANCE.getBuildsystemPkgs().add(pkg);
+ }
+
+ private CopyOnWriteArrayList<Package> getSelectedPkg(CopyOnWriteArrayList<Package> pkgs) {
+ CopyOnWriteArrayList<Package> _pkgs = new CopyOnWriteArrayList<Package>();
+ for (Package pkg : pkgs) {
+ if(pkg.getCheckColumn()) {
+ _pkgs.add(pkg);
+ }
+ }
+
+ return _pkgs;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.tizen.common.ui.view.console.ConsoleManager;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePackage;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+import org.tizen.nativeplatform.pkgmgr.model.Repository;
+import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
+
+public class DeviceTab {
+
+ private TabFolder folder = null;
+ private String targetId = null;
+ private TableViewer repoViewer = null;
+ private TableViewer pkgViewer = null;
+ private final Shell shell;
+ private FileDialog fd;
+ private String previousFilterPath = null;
+ private String selectedFileList;
+ private final IDevice device;
+ private CopyOnWriteArrayList<Package> pkgs;
+ private final SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+
+ private final String TMP_PATH= "/tmp";
+ private final String BUNDLE_NAME = DeviceTab.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+ private final ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ public DeviceTab(Shell shell, TabFolder folder, String targetId, IDevice dev) {
+ this.shell = shell;
+ this.folder = folder;
+ this.targetId = targetId;
+ this.device = dev;
+ }
+
+ public void createTab() {
+ initialize();
+ createDeivceTab(folder);
+ }
+
+ private void initialize() {
+ RepositoryProvider.INSTANCE.getDeviceRepos().clear();
+ PackageProvider.INSTANCE.getDevicePkgs().clear();
+
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ String result = RPMPackageCommander.getRepositoryListForDevice(device, rec);
+ String[] splitStr = result.split("\n");
+ for (int i = 2 ; i < splitStr.length ; i++) {
+ String s = splitStr[i];
+ s = s.replaceAll(" ", "");
+ String[] part = s.split("\\|");
+ String name = part[1];
+ String uri = part[5];
+
+ Repository repo = new Repository();
+ repo.setName(name);
+ repo.setUri(uri);
+
+ RepositoryProvider.INSTANCE.getDeviceRepos().add(repo);
+ }
+ }
+
+ private void createDeivceTab( TabFolder parent )
+ {
+ TabItem deviceTab = new TabItem( parent, SWT.NULL );
+ deviceTab.setText(resources.getString("PkgMgr.Tab.Device"));
+
+ Composite composite = new Composite(folder, SWT.NONE);
+ deviceTab.setControl(composite);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createInfoComposite( composite );
+ createRepositoryGroup( composite );
+ createPackageGroup( composite );
+ }
+
+ private void createInfoComposite( Composite parent )
+ {
+ Composite info_comp = new Composite( parent, SWT.NONE );
+ info_comp.setLayoutData(new GridData(GridData.BEGINNING));
+ info_comp.setLayout(new GridLayout(1, false));
+
+ Label configurationLabel = new Label(info_comp, SWT.LEFT);
+ configurationLabel.setText(String.format("%s %s", resources.getString("PkgMgr.Label.Connection"), device.getSerialNumber()));
+ }
+
+ private void createRepositoryGroup( Composite parent )
+ {
+ Group grpRepo = new Group(parent, SWT.NONE);
+ grpRepo.setText(resources.getString("PkgMgr.Frame.Respository"));
+ grpRepo.setLayout(new GridLayout(1, false));
+ GridData repo_gd = new GridData(GridData.FILL_BOTH);
+ grpRepo.setLayoutData(repo_gd);
+
+ Composite repo_comp = new Composite( grpRepo, SWT.NONE );
+ repo_comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ repo_comp.setLayout(new GridLayout(2, false));
+
+ Composite repo_comp_table = new Composite( repo_comp, SWT.NONE );
+ repo_comp_table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ repo_comp_table.setLayout(new FillLayout());
+
+ Composite repo_comp_buttons = new Composite( repo_comp, SWT.NONE );
+ repo_comp_buttons.setLayoutData(new GridData(GridData.FILL_BOTH));
+ repo_comp_buttons.setLayout(new GridLayout(1, false));
+
+ createRepositoryTable( repo_comp_table );
+ createRepositoryButtons( repo_comp_buttons );
+ }
+
+ private void createPackageGroup( Composite parent )
+ {
+ Group grpPkg = new Group(parent, SWT.NONE);
+ grpPkg.setText(resources.getString("PkgMgr.Frame.Package"));
+ grpPkg.setLayout(new GridLayout(1, false));
+ GridData pkgs_gd = new GridData(GridData.FILL_BOTH);
+ pkgs_gd.heightHint = shell.getBounds().height / 3;
+ grpPkg.setLayoutData(pkgs_gd);
+
+ Composite pkg_comp = new Composite( grpPkg, SWT.NONE );
+ pkg_comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ pkg_comp.setLayout(new GridLayout(2, false));
+
+ Composite pkg_comp_table = new Composite( pkg_comp, SWT.NONE );
+ pkg_comp_table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ pkg_comp_table.setLayout(new FillLayout());
+
+ Composite pkg_comp_buttons = new Composite( pkg_comp, SWT.NONE );
+ pkg_comp_buttons.setLayoutData(new GridData(GridData.FILL_BOTH));
+ pkg_comp_buttons.setLayout(new GridLayout(1, false));
+
+ createPackageTable( pkg_comp_table );
+ createPackageButtons( pkg_comp_buttons );
+ }
+
+ private void createRepositoryTable( Composite parent)
+ {
+ // Build System Tab
+ repoViewer = new TableViewer( parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
+ createColumnsForRepoTable( parent );
+ Table tableForRepository = repoViewer.getTable();
+ tableForRepository.addListener( SWT.Selection, new Listener(){
+
+ @Override
+ public void handleEvent(Event event) {
+ if( event.detail == SWT.CHECK )
+ {
+ Repository repo = (Repository)event.item.getData();
+ repo.setCheckColumn( !repo.getCheckColumn() );
+ }
+ }
+ });
+ tableForRepository.setHeaderVisible(true);
+ tableForRepository.setLinesVisible(true);
+ repoViewer.setContentProvider(new ArrayContentProvider());
+ repoViewer.setInput(RepositoryProvider.INSTANCE.getDeviceRepos());
+ }
+
+ private void createRepositoryButtons( Composite parent )
+ {
+ Button add_bt = new Button( parent, SWT.PUSH );
+ add_bt.setText(resources.getString("PkgMgr.Button.AddRepo"));
+ add_bt.setToolTipText(resources.getString("PkgMgr.Button.AddRepo.Tooltip"));
+ add_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ AddRepoDialog dialog = new AddRepoDialog(shell, resources.getString("PkgMgr.Tab.Device"));
+ dialog.open();
+ repoViewer.refresh();
+
+ int recentTableIndex = 0;
+ recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = null;
+ item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+
+ if (repo.getCheckDirty()) {
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ RPMPackageCommander.addRepositoryForDevice(repo.getName(), repo.getUri(), device, rec);
+ repo.setCheckDirty(false);
+ }
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+
+ Button modify_bt = new Button( parent, SWT.PUSH );
+ modify_bt.setText(resources.getString("PkgMgr.Button.ModifyRepo"));
+ modify_bt.setToolTipText(resources.getString("PkgMgr.Button.ModifyRepo.Tooltip"));
+ modify_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ CopyOnWriteArrayList<Repository> list = RepositoryProvider.INSTANCE.getDeviceRepos();
+
+ Repository selectedRepo = null;
+ int count = 0;
+
+ for( Repository repo : list) {
+ if (repo.getCheckColumn()) {
+ count++;
+ selectedRepo = repo;
+ }
+ }
+
+ if (count != 1 ) {
+ DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
+ return;
+ }
+
+ ModifyRepoDialog dialog = new ModifyRepoDialog(shell, resources.getString("PkgMgr.Tab.Device"),
+ selectedRepo.getName(), selectedRepo.getUri());
+ dialog.open();
+
+ repoViewer.refresh();
+
+ int recentTableIndex = 0;
+ recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = null;
+ item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+
+ if (repo.getCheckDirty()) {
+ list.remove(selectedRepo);
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ RPMPackageCommander.removeRepositoryForDevice(selectedRepo.getName(), device, rec);
+
+ rec.cleanLog();
+ RPMPackageCommander.addRepositoryForDevice(repo.getName(), repo.getUri(), device, rec);
+ repo.setCheckDirty(false);
+ }
+ }
+
+ repoViewer.refresh();
+ recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+
+ Button remove_bt = new Button( parent, SWT.PUSH );
+ remove_bt.setText(resources.getString("PkgMgr.Button.RemoveRepo"));
+ remove_bt.setToolTipText(resources.getString("PkgMgr.Button.RemoveRepo.Tooltip"));
+ remove_bt.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ CopyOnWriteArrayList<Repository> list = RepositoryProvider.INSTANCE.getDeviceRepos();
+
+ for( Repository repo : list)
+ {
+ boolean selected = false;
+ selected = repo.getCheckColumn();
+
+ if (selected) {
+ list.remove(repo);
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ RPMPackageCommander.removeRepositoryForDevice(repo.getName(), device, rec);
+ }
+ }
+
+ repoViewer.refresh();
+ int recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = repoViewer.getTable().getItem(i);
+ Repository repo = (Repository)item.getData();
+ item.setChecked(repo.getCheckColumn());
+ }
+
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+ Button refresh_bt = new Button( parent, SWT.PUSH );
+ refresh_bt.setText(resources.getString("PkgMgr.Button.RefreshRepo"));
+ refresh_bt.setToolTipText(resources.getString("PkgMgr.Button.RefreshRepo.Tooltip"));
+ refresh_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Refreshing"), -1);
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ RPMPackageCommander.refreshRepositoryForDevice(device, rec);
+ }
+ });
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+ }
+
+ private void createPackageTable( Composite parent )
+ {
+ pkgViewer = new TableViewer( parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
+ createColumns( parent );
+ Table packageTable = pkgViewer.getTable();
+ packageTable.addListener( SWT.Selection, new Listener(){
+
+ @Override
+ public void handleEvent(Event event) {
+ if( event.detail == SWT.CHECK )
+ {
+ Package pkg = (Package)event.item.getData();
+ pkg.setCheckColumn( !pkg.getCheckColumn() );
+ }
+ }
+ });
+
+ packageTable.setHeaderVisible(true);
+ packageTable.setLinesVisible(true);
+
+ pkgViewer.setContentProvider(new ArrayContentProvider());
+ pkgViewer.setInput(PackageProvider.INSTANCE.getDevicePkgs());
+ }
+
+ private void createPackageButtons( Composite parent )
+ {
+ Button add_rtpkg_bt = new Button( parent, SWT.PUSH );
+ add_rtpkg_bt.setText(resources.getString("PkgMgr.Button.AddRPackage"));
+ add_rtpkg_bt.setToolTipText(resources.getString("PkgMgr.Button.AddRPackage.Tooltip"));
+ add_rtpkg_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ RemotePkgProvider.INSTANCE.getPkgs().clear();
+ RemotePkgProvider.INSTANCE.getSelectedPkgs().clear();
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Getting.RemotePackage"), -1);
+ genRemotePkgList();
+ }
+ });
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ AddRemotePackageDialog dlg = new AddRemotePackageDialog(shell);
+ dlg.open();
+
+ dialog = new ProgressMonitorDialog(shell);
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Adding.Package"), -1);
+ for (RemotePackage p : RemotePkgProvider.INSTANCE.getSelectedPkgs()) {
+ addRemotePackage(p);
+ }
+ }
+ });
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ pkgViewer.refresh();
+ int recentTableIndex = pkgViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = pkgViewer.getTable().getItem(i);
+ Package pkg = (Package)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+
+
+ Button add_lcpkg_bt = new Button( parent, SWT.PUSH );
+ add_lcpkg_bt.setText(resources.getString("PkgMgr.Button.AddLPackage"));
+ add_lcpkg_bt.setToolTipText(resources.getString("PkgMgr.Button.AddLPackage.Tooltip"));
+ add_lcpkg_bt.addMouseListener(new MouseListener()
+ {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ int oldTableIndex = pkgViewer.getTable().getItemCount();
+
+ fd = new FileDialog( shell, SWT.OPEN|SWT.MULTI);
+ fd.setText(resources.getString("FileDlg.Title"));
+ if (previousFilterPath == null)
+ fd.setFilterPath(null);
+ else
+ fd.setFilterPath(previousFilterPath);
+ String[] filterExt = { resources.getString("FileDlg.Filter.Ext") };
+ fd.setFilterExtensions(filterExt);
+
+ try {
+ String arch = sbi.getArchitectureFromToolchainID(sbi.getToolchainIDFromTargetID(targetId));
+ String _arch = "";
+ if ("armel".equals(arch)) {
+ _arch = "armv7l";
+ } else if ("i386".equals(arch)) {
+ _arch = "i586";
+ } else {
+ _arch = arch;
+ }
+ String rootstrapPath = sbi.getRootstrapPath(targetId);
+ String defaultPath = rootstrapPath + resources.getString("FileDlg.Default.Path") + _arch;
+ fd.setFilterPath(defaultPath);
+ } catch (SBIException e2) {
+ e2.printStackTrace();
+ }
+
+ selectedFileList = fd.open();
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, false, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Adding.Package"), -1);
+ if( selectedFileList != null )
+ {
+ String[] files = fd.getFileNames();
+ previousFilterPath = fd.getFilterPath();
+ for (int i=0, n = files.length; i<n; i++) {
+ monitor.subTask(String.format("Adding %s", files[i]));
+ StringBuffer buf = new StringBuffer();
+ buf.append(fd.getFilterPath());
+ if (buf.charAt(buf.length() -1) != File.separatorChar) {
+ buf.append(File.separatorChar);
+ }
+ buf.append(files[i]);
+ addLocalPackage( buf.toString());
+ }
+ }
+ }
+ });
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ pkgViewer.refresh();
+
+ int recentTableIndex = pkgViewer.getTable().getItemCount();
+
+ for (int i = oldTableIndex; i < recentTableIndex; i++) {
+ TableItem item = null;
+
+ item = pkgViewer.getTable().getItem(i);
+ Package pkg = (Package)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+
+ Button remove_bt = new Button( parent, SWT.PUSH );
+ remove_bt.setText(resources.getString("PkgMgr.Button.RemoveList"));
+ remove_bt.setToolTipText(resources.getString("PkgMgr.Button.RemoveList.Tooltip"));
+ remove_bt.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ CopyOnWriteArrayList<Package> pkgList = PackageProvider.INSTANCE.getDevicePkgs();
+ for( Package pkg: pkgList)
+ {
+ boolean selected = false;
+ selected = pkg.getCheckColumn();
+ if (selected) {
+ pkgList.remove(pkg);
+ }
+ }
+ pkgViewer.refresh();
+
+ int recentTableIndex = pkgViewer.getTable().getItemCount();
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = null;
+ item = pkgViewer.getTable().getItem(i);
+ Package pkg = (Package)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+ Button install_bt = new Button( parent, SWT.PUSH );
+ install_bt.setText(resources.getString("PkgMgr.Button.Install"));
+ install_bt.setToolTipText(resources.getString("PkgMgr.Button.Install.Tooltip"));
+ install_bt.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ pkgs = getSelectedPkg(PackageProvider.INSTANCE.getDevicePkgs());
+
+ if(pkgs.isEmpty()) {
+ MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Package"));
+ return;
+ }
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
+
+ try {
+ String newPath = null;
+ ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+ cm.clear();
+ MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs = cm.getMessageConsoleStream();
+ PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+ rec.setMessageConsoleStream(mcs);
+ String localPkgList = "";
+ String remotePkgList = "";
+
+ // Step 1: transfer pkg and make pkg list
+ for (Package pkg : pkgs)
+ {
+ if (pkg instanceof LocalPackage) {
+ LocalPackage p = (LocalPackage)pkg;
+ String file = new File(p.getPath()).getName();
+ newPath = TMP_PATH + "/" + file;
+ monitor.subTask(String.format(resources.getString("PkgMgr.Message.Transfer.File"), p.getPath(), newPath));
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ SyncService syncService = device.getSyncService();
+ SyncResult syncResult = syncService.pushFile(p.getPath(), newPath, SyncService.getNullProgressMonitor());
+ if (syncResult.getCode() != SyncService.RESULT_OK) {
+ mcsError.println(String.format(resources.getString("PkgMgr.Error.Failtransfer.File"), p.getPath(), newPath));
+ p.setInstallInfo( Package.INSTALLINFO.NOT_INSTALLED);
+ continue;
+ }
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ if (localPkgList == "") {
+ localPkgList = newPath;
+ } else {
+ localPkgList = localPkgList + " " + newPath;
+ }
+
+ } else if (pkg instanceof RemotePackage) {
+ if (remotePkgList == "") {
+ remotePkgList = pkg.getName();
+ } else {
+ remotePkgList = remotePkgList + " " + pkg.getName();
+ }
+ }
+ }
+
+
+ // Step 2: set update mode on device
+ if (!device.isEmulator()) {
+ RPMPackageCommander.changeUpdateModeForDevice(device, rec);
+ }
+
+ if (remotePkgList != "") {
+ monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), remotePkgList));
+ RPMPackageCommander.installRemotePkgForDevice(remotePkgList, device, rec);
+ }
+
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+ if (localPkgList != "") {
+ monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), localPkgList));
+ RPMPackageCommander.InstallPkgToDevice(localPkgList, device, rec);
+ }
+
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+
+ Thread.sleep(500);
+
+ for (Package pkg : pkgs) {
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ // update status
+ rec.setPrintConsole(false);
+ String installedVer = RPMPackageCommander.getPkgInstalledVerForDevice(pkg.getName(), device, rec);
+ pkg.setInstalledVersion(installedVer);
+
+ if ("".equals(installedVer)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+ } else if (installedVer.equals(pkg.getNewVersion())) {
+ if (RPMPackageCommander.pkgInstalledSuccessfullyForDevice(pkg.getName(), device, rec)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+ } else {
+ pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+ }
+ } else {
+ pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+ }
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ monitor.done();
+ }
+ });
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ pkgViewer.refresh();
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+ }
+
+ private void createColumnsForRepoTable( Composite parent )
+ {
+ String[] titles = {"Name", "Reposity URL"};
+ int[] bounds = { 200, 600 };
+
+ TableViewerColumn colName = createTableViewerColumn( repoViewer, titles[0], bounds[0], SWT.NONE);
+ TableColumn column = colName.getColumn();
+ column.addSelectionListener(new RepoTableSelectionAdapter(repoViewer));
+
+ colName.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Repository repo = (Repository)element;
+ return repo.getName();
+ }
+ });
+
+ TableViewerColumn colUrl = createTableViewerColumn( repoViewer, titles[1], bounds[1], SWT.NONE);
+ column = colUrl.getColumn();
+ column.addSelectionListener(new RepoTableSelectionAdapter(repoViewer));
+
+ colUrl.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Repository repo = (Repository)element;
+ return repo.getUri();
+ }
+ });
+ }
+
+ private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
+
+ final TableViewerColumn viewerColumn = new TableViewerColumn( viewer, Style);
+ final TableColumn column = viewerColumn.getColumn();
+ column.addSelectionListener(new PackageTableSelectionAdapter(pkgViewer));
+ column.setText(title);
+ column.setWidth(bound);
+ column.setResizable(true);
+ column.setMoveable(true);
+ return viewerColumn;
+ }
+
+ private void createColumns( Composite parent )
+ {
+ String[] titles = {"Install Type", "Package Name", "Arch", "New Version", "Installed Version", "Status"};
+ int[] bounds = { 120, 250, 60, 150, 150, 150};
+
+ TableViewerColumn colInstallType = createTableViewerColumn( pkgViewer, titles[0], bounds[0], SWT.NONE);
+
+ colInstallType.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ return pkg.getPkgType().toString();
+ }
+ });
+
+ TableViewerColumn colPackage = createTableViewerColumn( pkgViewer, titles[1], bounds[1], SWT.NONE);
+
+ colPackage.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ return pkg.getName();
+ }
+ });
+
+ TableViewerColumn colArch = createTableViewerColumn( pkgViewer, titles[2], bounds[2], SWT.NONE);
+
+ colArch.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String arch = pkg.getArch();
+ return arch;
+ }
+ });
+
+ TableViewerColumn colNewVer = createTableViewerColumn( pkgViewer, titles[3], bounds[3], SWT.NONE);
+
+ colNewVer.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String newVer = pkg.getNewVersion();
+ return newVer;
+ }
+ });
+
+ TableViewerColumn colInsVer = createTableViewerColumn( pkgViewer, titles[4], bounds[4], SWT.NONE);
+ colInsVer.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String installedVer = pkg.getInstalledVersion();
+ return installedVer;
+ }
+ });
+
+ TableViewerColumn colStatus = createTableViewerColumn( pkgViewer, titles[5], bounds[5], SWT.NONE);
+
+ colStatus.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Package pkg = (Package)element;
+ String status = pkg.getInstallInfo().toString();
+ return status;
+ }
+ });
+ }
+
+ private void genRemotePkgList() {
+
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ String list = RPMPackageCommander.getRemotePackageListForDevice(device, rec);
+
+ String[] splitStr = list.split("\n");
+
+ for (int i = 4 ; i < splitStr.length ; i++) {
+ String s = splitStr[i];
+ s = s.replaceAll(" ", "");
+ String[] part = s.split("\\|");
+ String status = part[0];
+ String repo = part[1];
+ String name = part[2];
+ String version = part[3];
+ String arch = part[4];
+
+ RemotePackage pkg = new RemotePackage();
+ pkg.setName(name);
+ pkg.setArch(arch);
+ pkg.setNewVersion(version);
+ pkg.setRepo(repo);
+ if ("i".equals(status)) {
+ pkg.setCheckColumn(true);
+ pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+ } else if ("v".equals(status)) {
+ pkg.setCheckColumn(false);
+ pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+ } else {
+ pkg.setCheckColumn(false);
+ }
+
+ RemotePkgProvider.INSTANCE.getPkgs().add(pkg);
+ }
+ }
+
+ private void addRemotePackage( RemotePackage p ) {
+ CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getDevicePkgs();
+ Iterator<Package> debIter = pkgs.iterator();
+
+ while( debIter.hasNext() ) {
+ Package pkg = debIter.next();
+ if( pkg.getName().equals(p.getName()) &&
+ pkg.getNewVersion().equals(p.getNewVersion()) ) {
+ return;
+ }
+ }
+
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ String installedVer = RPMPackageCommander.getPkgInstalledVerForDevice(p.getName(), device, rec);
+
+ p.setInstalledVersion(installedVer);
+ p.setCheckColumn(true);
+ p.setPkgType(Package.PKGTYPE.REMOTE);
+ PackageProvider.INSTANCE.getDevicePkgs().add(p);
+ }
+
+ private void addLocalPackage( String rpmPath )
+ {
+ CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getDevicePkgs();
+ Iterator<Package> debIter = pkgs.iterator();
+
+ String pkgName = RPMPackageCommander.getPkgNameForFile(rpmPath);
+ String newVer = RPMPackageCommander.getPkgVerForFile(rpmPath);
+
+ while( debIter.hasNext() ) {
+ Package pkg = debIter.next();
+ if( pkg.getName().equals(pkgName) && pkg.getNewVersion().equals(newVer)) {
+ return;
+ }
+ }
+
+ LocalPackage pkg = new LocalPackage();
+ pkg.setName(pkgName);
+ pkg.setPath(rpmPath);
+ pkg.setPkgType(Package.PKGTYPE.LOCAL);
+ pkg.setArch(RPMPackageCommander.getArchForFile(rpmPath));
+ pkg.setNewVersion(newVer);
+
+ PackageManagerOuputReceiver rec = getNewOuputReceiver();
+ String installedVerForRootstrap = RPMPackageCommander.getPkgInstalledVerForDevice(pkg.getName(), device, rec);
+ pkg.setInstalledVersion(installedVerForRootstrap);
+
+ if ("".equals(newVer)) {
+ pkg.setCheckColumn(false);
+ } else if (!"".equals(installedVerForRootstrap)) {
+ if (!installedVerForRootstrap.equals(newVer)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+ } else {
+ if (RPMPackageCommander.pkgInstalledSuccessfullyForDevice(pkgName, device, rec)) {
+ pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+ }
+ }
+ }
+
+ PackageProvider.INSTANCE.getDevicePkgs().add(pkg);
+ }
+
+ private CopyOnWriteArrayList<Package> getSelectedPkg(CopyOnWriteArrayList<Package> pkgs) {
+ CopyOnWriteArrayList<Package> _pkgs = new CopyOnWriteArrayList<Package>();
+ for (Package pkg : pkgs) {
+ if(pkg.getCheckColumn()) {
+ _pkgs.add(pkg);
+ }
+ }
+
+ return _pkgs;
+ }
+
+ private PackageManagerOuputReceiver getNewOuputReceiver() {
+ ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+ cm.clear();
+ MessageConsoleStream mcsError = cm.getMessageConsoleStream();
+ MessageConsoleStream mcs = cm.getMessageConsoleStream();
+ PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+ rec.setMessageConsoleStream(mcs);
+
+ return rec;
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+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.swt.widgets.Text;
+
+import org.tizen.nativeplatform.pkgmgr.model.Repository;
+import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
+
+public class ModifyRepoDialog extends Dialog {
+
+ private Text nameText;
+ private Text uriText;
+ private String tab;
+ private String name;
+ private String value;
+
+ private int x = 0;
+ private int y = 0;
+ private final int width = 500;
+ private final int height = 200;
+
+ private final String BUNDLE_NAME = ModifyRepoDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+ private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ protected ModifyRepoDialog(Shell parentShell) {
+ super(parentShell);
+ }
+
+ public ModifyRepoDialog(Shell parentShell, String tab, String name, String value) {
+ super(parentShell);
+ this.tab = tab;
+ this.name = name;
+ this.value = value;
+ Rectangle bounds = parentShell.getBounds();
+ x = bounds.x + (bounds.width - width)/2;
+ y = bounds.y + (bounds.height - height)/2;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+
+ newShell.setText(resources.getString("ModifyRepo.Title"));
+ newShell.setLocation(x, y);
+ newShell.setSize(width, height);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ Composite composite = new Composite( parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ composite.setLayout(new GridLayout(2, false));
+
+ Label nameLabel = new Label(composite, SWT.NONE);
+ nameLabel.setText(resources.getString("ModifyRepo.Label.Name"));
+ nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+ GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+ gridData.widthHint = 500;
+ nameText.setLayoutData(gridData);
+ nameText.setText(name);
+ nameText.setEnabled(false);
+
+ Label urlLabel = new Label(composite, SWT.NONE);
+ urlLabel.setText(resources.getString("ModifyRepo.Label.Uri"));
+ uriText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+ gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+ gridData.widthHint = 500;
+ uriText.setLayoutData(gridData);
+ uriText.setText(value);
+
+ return null;
+ }
+
+ @Override
+ protected void okPressed() {
+
+ Repository repo = new Repository();
+ if (!uriText.getText().equals(value)) {
+ repo.setName(nameText.getText());
+ repo.setUri(uriText.getText());
+ repo.setCheckDirty(true);
+
+ if (resources.getString("PkgMgr.Tab.Buildsystem").equals(tab)) {
+ RepositoryProvider.INSTANCE.getBuildsystemRepos().add(repo);
+ } else if (resources.getString("PkgMgr.Tab.Device").equals(tab)) {
+ RepositoryProvider.INSTANCE.getDeviceRepos().add(repo);
+ }
+ }
+
+ super.okPressed();
+ }
+}
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+
+public class PackageTableSelectionAdapter extends SelectionAdapter {
+ private TableViewer repoViewer;
+ private int selectedColumn = 0;
+ public PackageTableSelectionAdapter(TableViewer v) {
+ super();
+ this.repoViewer = v;
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ selectedColumn = repoViewer.getTable().indexOf((TableColumn) e.widget);
+ repoViewer.getTable().setSortColumn((TableColumn)e.widget);
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ repoViewer.getTable().setSortDirection(SWT.UP);
+ } else {
+ repoViewer.getTable().setSortDirection(SWT.DOWN);
+ }
+
+ repoViewer.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int result = 0;
+
+ Package entry_1 = (Package)e1;
+ Package entry_2 = (Package)e2;
+
+ switch (selectedColumn) {
+ case 0:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getPkgType().compareTo(entry_2.getPkgType());
+ } else {
+ result = entry_2.getPkgType().compareTo(entry_1.getPkgType());
+ }
+ break;
+ case 1:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getName().compareTo(entry_2.getName());
+ } else {
+ result = entry_2.getName().compareTo(entry_1.getName());
+ }
+ break;
+ case 2:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getArch().compareTo(entry_2.getArch());
+ } else {
+ result = entry_2.getArch().compareTo(entry_1.getArch());
+ }
+ break;
+ case 3:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getNewVersion().compareTo(entry_2.getNewVersion());
+ } else {
+ result = entry_2.getNewVersion().compareTo(entry_1.getNewVersion());
+ }
+ break;
+ case 4:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getInstalledVersion().compareTo(entry_2.getInstalledVersion());
+ } else {
+ result = entry_2.getInstalledVersion().compareTo(entry_1.getInstalledVersion());
+ }
+ break;
+ case 5:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getInstallInfo().toString().compareTo(entry_2.getInstallInfo().toString());
+ } else {
+ result = entry_2.getInstallInfo().toString().compareTo(entry_1.getInstallInfo().toString());
+ }
+ break;
+ }
+
+ return result;
+ }
+ });
+ updateCheck();
+ }
+
+ private void updateCheck() {
+ int recentTableIndex = repoViewer.getTable().getItemCount();
+
+ for (int i = 0; i < recentTableIndex; i++) {
+ TableItem item = repoViewer.getTable().getItem(i);
+ Package pkg = (Package)item.getData();
+ item.setChecked(pkg.getCheckColumn());
+ }
+ }
+}
--- /dev/null
+PkgMgr.Title = Package Manager
+PkgMgr.Frame.Description = Install packages to the build system or device.
+PkgMgr.Frame.Respository = Repositories
+PkgMgr.Frame.Package = Packages
+PkgMgr.Tab.Buildsystem = Build System
+PkgMgr.Tab.Device = Device
+PkgMgr.Console.Name = Package Manager
+PkgMgr.Error.Noselected = - No project is selected, no device is connected, or the selected project is not a Tizen project
+PkgMgr.Error.Noselected.Package = No package selected.
+PkgMgr.Error.Failtransfer.File = Moving the file from %s to %s failed.
+PkgMgr.Warn.Notset.Proxy = (Warning: HTTP Proxy environment variable (OBS_HTTP_PROXY) is not set)
+PkgMgr.Label.Configuration = Selected configuration:
+PkgMgr.Label.Connection = Selected connection:
+PkgMgr.Button.AddRepo = Add
+PkgMgr.Button.AddRepo.Tooltip = Add a repository
+PkgMgr.Button.ModifyRepo = Modify
+PkgMgr.Button.ModifyRepo.Tooltip = Modify a repository
+PkgMgr.Button.RemoveRepo = Remove
+PkgMgr.Button.RemoveRepo.Tooltip = Remove the selected repositories
+PkgMgr.Button.RefreshRepo = Refresh
+PkgMgr.Button.RefreshRepo.Tooltip = Refresh all repositories
+PkgMgr.Button.AddRPackage = Add Remote Package
+PkgMgr.Button.AddRPackage.Tooltip = Add remote packages from repositories
+PkgMgr.Button.AddLPackage = Add Local Package
+PkgMgr.Button.AddLPackage.Tooltip = Add local packages from file system
+PkgMgr.Button.RemoveList = Remove List
+PkgMgr.Button.RemoveList.Tooltip = Remove selected packages from list
+PkgMgr.Button.Install = Install Package
+PkgMgr.Button.Install.Tooltip = Install selected packages
+PkgMgr.Message.Refreshing = Refreshing the repository...
+PkgMgr.Message.Adding.Package = Adding selected packages to the table...
+PkgMgr.Message.Getting.RemotePackage = Getting the remote package list...
+PkgMgr.Message.Installing.Package = Installing packages...
+PkgMgr.Message.Select.OnePackage = Please select one repository
+PkgMgr.Message.Transfer.File = Transferring %s to target's %s...
+PkgMgr.Console.Remote.Install = ***** Installing a remote package *****\n
+PkgMgr.Console.Local.Install = \n***** Installing a local package *****\n
+
+AddRepo.Title = Add Package Repository
+AddRepo.Label.Name = Name:
+AddRepo.Label.Uri = URI:
+AddRepo.Message.AlreadyExist = The repository already exists
+
+ModifyRepo.Title = Modify Package Repository
+ModifyRepo.Label.Name = Name:
+ModifyRepo.Label.Uri = URI:
+
+AddRemotePkg.Title = Add Remote Packages
+
+FileDlg.Title = Select RPM files...
+FileDlg.Filter.Ext = *.rpm
+FileDlg.Default.Path = /home/abuild/rpmbuild/RPMS/
--- /dev/null
+/*
+* Inhouse
+*
+* 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.nativeplatform.pkgmgr.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.ui.PlatformUI;
+
+import org.osgi.framework.Bundle;
+import org.tizen.common.connection.ConnectionPlugin;
+
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativecommon.build.obs.PasswordInputDialog;
+import org.tizen.nativecommon.build.obs.UserInformation;
+import org.tizen.nativeplatform.Activator;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.sdblib.IDevice;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPkgProvider;
+import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+
+public class RPMPackageDialog extends Dialog {
+
+
+ private String configuration;
+ private IDevice device;
+ private TabFolder tabFolder;
+
+ private boolean enableRootstrapTab = true;
+ private boolean enableTargetTab = true;
+ private int tabIndex = 0;
+ private String http_proxy = "";
+ private String password = "";
+
+ private int x = 0;
+ private int y = 0;
+ private final int width = 1100;
+ private final int height = 800;
+
+ private final String BUNDLE_NAME = RPMPackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+ private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ public RPMPackageDialog(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) {
+ super(parentShell);
+ setBlockOnOpen(false);
+ this.enableRootstrapTab = enableRootstrap;
+ this.enableTargetTab = enableTarget;
+
+ Rectangle bounds = parentShell.getBounds();
+ x = bounds.x + (bounds.width - width)/2;
+ y = bounds.y + (bounds.height - height)/2;
+
+ if (enableRootstrap) {
+ IProject _project = CurrentEnabledProject.getCurrentProject();
+ IConfiguration config = ManagedBuildManager.getBuildInfo( _project ).getDefaultConfiguration();
+ configuration = config.getName();
+ http_proxy = getHttpProxy(_project);
+ RPMPackageCommander.setHttpProxy(this.http_proxy);
+ }
+ if (enableTarget) {
+ device = ConnectionPlugin.getDefault().getCurrentDevice();
+ }
+
+ password = getSudoPassword();
+ RPMPackageCommander.setSudoPassword(password);
+ }
+
+ private String getSudoPassword() {
+ if (UserInformation.getRootPassword() == null) {
+ openPasswordDialog();
+ }
+
+ return UserInformation.getRootPassword();
+ }
+
+
+ private String getHttpProxy(IProject project) {
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
+ IConfiguration cfg = info.getDefaultConfiguration();
+ ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(cfg);
+ IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
+
+ // append "OBS_HTTP_PROXY"
+ IEnvironmentVariable var = mngr.getVariable("OBS_HTTP_PROXY", cfgDes, true);
+ if ( var != null ) {
+ return var.getValue();
+ }
+ return "";
+ }
+
+ private void setImage(Shell parentShell) {
+ try {
+ Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
+ parentShell.setImage(new Image(Display.getCurrent(), FileLocator.toFileURL(bundle.getEntry("icons/package_installer.gif")).getPath()));
+ } catch (Exception e) {
+ }
+ }
+
+ protected void setShellStyle(int newShellStyle) {
+ int newStyle = newShellStyle & ~SWT.APPLICATION_MODAL;
+ newStyle |= SWT.MODELESS;
+ super.setShellStyle(newStyle);
+ }
+
+ @Override
+ public boolean close()
+ {
+ RemotePkgProvider.INSTANCE.clear();
+ LocalPkgProvider.INSTANCE.clear();
+ PackageProvider.INSTANCE.clear();
+ return super.close();
+ }
+
+ protected void createButtonsForButtonBar(Composite parent)
+ {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(resources.getString("PkgMgr.Title"));
+
+ if (!enableRootstrapTab && !enableTargetTab) {
+ newShell.setLocation(x, y);
+ newShell.setSize(width/2, height/4);
+ setImage(newShell);
+ } else {
+ newShell.setLocation(x, y);
+ newShell.setSize(width, height);
+ setImage(newShell);
+ }
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ Composite container = new Composite( parent, SWT.None );
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+ container.setLayout(new GridLayout(1, false));
+
+ if (!enableRootstrapTab && !enableTargetTab) {
+ createError( container, resources.getString("PkgMgr.Error.Noselected"));
+ } else {
+ createDialogDescription ( container );
+ createTabs ( container );
+ }
+ return null;
+ }
+
+
+ private void createError( Composite parent, String message )
+ {
+ Composite com = new Composite( parent, SWT.NONE );
+ com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ com.setLayout(new GridLayout(1, false));
+
+ Label errorLabel = new Label(com, SWT.NONE);
+ errorLabel.setText(message);
+ }
+
+ private void createDialogDescription(Composite composite)
+ {
+ Composite comp_descrip = new Composite(composite, SWT.NONE);
+ Color whiteColor = new Color(composite.getDisplay(), 255, 255, 255);
+ Color warningColor = composite.getDisplay().getSystemColor(SWT.COLOR_RED);
+
+ comp_descrip.setLayout(new GridLayout(1, false));
+ GridData comp_descrip_gd = new GridData(GridData.FILL_HORIZONTAL);
+ comp_descrip_gd.heightHint = height/12;
+ comp_descrip.setLayoutData(comp_descrip_gd);
+ comp_descrip.setBackground(whiteColor);
+
+ Label label = new Label(comp_descrip, SWT.NONE);
+ label.setText(resources.getString("PkgMgr.Frame.Description"));
+ label.setBackground(whiteColor);
+
+ if ("".equals(http_proxy)) {
+ Label warning_label = new Label(comp_descrip, SWT.NONE);
+ warning_label.setText(resources.getString("PkgMgr.Warn.Notset.Proxy"));
+ warning_label.setBackground(whiteColor);
+ warning_label.setForeground(warningColor);
+ }
+ }
+
+ private void createTabs( Composite parent )
+ {
+ tabFolder = new TabFolder( parent, SWT.BORDER );
+ tabFolder.setLayoutData(new GridData( GridData.FILL_BOTH));
+ tabFolder.setLayout(new GridLayout(1, false));
+
+ tabFolder.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ // TODO:
+ }
+ });
+
+
+ if (enableRootstrapTab) {
+ BuildSystemTab tab = new BuildSystemTab(getShell(), tabFolder, configuration, getTargetID());
+ tab.createTab();
+ }
+ if (enableTargetTab) {
+ DeviceTab tab = new DeviceTab(getShell(), tabFolder, getTargetID(), device);
+ tab.createTab();
+ }
+
+ tabFolder.setSelection(tabIndex);
+ }
+
+ private String getTargetID() {
+ IProject project = CurrentEnabledProject.getCurrentProject();
+ IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+ String targetID = PlatformConfigurationManager.getBuildTargetName(config);
+ return targetID;
+ }
+
+ private void openPasswordDialog(){
+
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getShells()[0];
+ PasswordInputDialog passwordDialog = new PasswordInputDialog(shell, "Input password");
+ if( passwordDialog.open() == Window.OK){
+ UserInformation.setRootPassword(passwordDialog.getPassword());
+ UserInformation.setSavePassword(passwordDialog.isSavePassword());
+ }
+ }
+ });
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.TableColumn;
+import org.tizen.nativeplatform.pkgmgr.model.Repository;
+
+public class RepoTableSelectionAdapter extends SelectionAdapter {
+ private TableViewer repoViewer;
+ private int selectedColumn = 0;
+ public RepoTableSelectionAdapter(TableViewer v) {
+ super();
+ this.repoViewer = v;
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ selectedColumn = repoViewer.getTable().indexOf((TableColumn) e.widget);
+ repoViewer.getTable().setSortColumn((TableColumn)e.widget);
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ repoViewer.getTable().setSortDirection(SWT.UP);
+ } else {
+ repoViewer.getTable().setSortDirection(SWT.DOWN);
+ }
+
+ repoViewer.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int result = 0;
+
+ Repository entry_1 = (Repository)e1;
+ Repository entry_2 = (Repository)e2;
+
+ switch (selectedColumn) {
+ case 0:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getName().compareTo(entry_2.getName());
+ } else {
+ result = entry_2.getName().compareTo(entry_1.getName());
+ }
+ break;
+ case 1:
+ if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+ result = entry_1.getUri().compareTo(entry_2.getUri());
+ } else {
+ result = entry_2.getUri().compareTo(entry_1.getUri());
+ }
+ break;
+ }
+
+ return result;
+ }
+ });
+ }
+}
if ( e.getName() != null && e.getName().equals("Empty Project") )
continue;
- if( e.getId().equals("com.samsung.slp.nativeide.buildArtefactType.cdeb") ||
- (e.getParentId() != null && e.getParentId().equals("com.samsung.slp.nativeide.buildArtefactType.cdeb")) ) {
+ if( e.getId().equals("org.tizen.nativeide.buildArtefactType.platform") ||
+ (e.getParentId() != null && e.getParentId().equals("org.tizen.nativeide.buildArtefactType.platform")) ) {
result.add(item);
}
public class TizenDebianProjectWizard extends CDTCommonProjectWizard{
public TizenDebianProjectWizard() {
- super("Tizen Custom Debian Project", //$NON-NLS-1$
- "Create a Tizen Custom Debian Project project of selected type"); //$NON-NLS-1$
+ super("Tizen Platform Project", //$NON-NLS-1$
+ "Create a Tizen Platform Project project of selected type"); //$NON-NLS-1$
// WizardConstants.isDebian = true;
}
@Override
public void addPages() {
fMainPage= new TizenDebianMainWizardPage(CUIPlugin.getResourceString("CProjectWizard"));
- fMainPage.setTitle("Tizen Custom Debian Project");
- fMainPage.setDescription("Create a Tizen Custom Debian Project project of selected type");
+ fMainPage.setTitle("Tizen Platform Project");
+ fMainPage.setDescription("Create a Tizen Platform Project project of selected type");
addPage(fMainPage);
}
IProject prj = super.getProject(defaults, onFinish);
// Marking project version
- PlatformConfigurationManager.setProjectVersion( prj, PlatformConfigurationManager.CURRENT_SLP_PROJECT_VERSION );
+ PlatformConfigurationManager.setProjectVersion( prj, PlatformConfigurationManager.CURRENT_SLP_PROJECT_VERSION, true);
return prj;
}
-EmptyProject.Ctemplate.label=Empty Debian Project
-EmptyProject.Ctemplate.description=Empty Debian Project
+EmptyProject.Ctemplate.label=Empty Platform Project
+EmptyProject.Ctemplate.description=Empty Platform Project
EmptyProject.basics.label=Advanced Settings
EmptyProject.basics.description=Advanced properties of a project
EmptyProject.author.label=Author
<?xml version="1.0" encoding="ISO-8859-1"?>
<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
- copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
- id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
- help="help.html">
- <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
- <property id="author"
- label="%HelloWorldProject.author.label"
- description="%HelloWorldProject.author.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.author.default"
- hidden="false"
- persist="false"/>
- <property id="copyright"
- label="%HelloWorldProject.copyright.label"
- description="%HelloWorldProject.copyright.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.copyright.default"
- hidden="false"
- persist="false"/>
- <property id="description"
- label="%HelloWorldProject.description.label"
- description="%HelloWorldProject.description.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.description.default"
- hidden="false"
- persist="false"/>
- <property id="vendor"
- label="%HelloWorldProject.vendor.label"
- description="%HelloWorldProject.vendor.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.vendor.default"
- hidden="false"
- persist="false"/>
- <property id="e-mail"
- label="%HelloWorldProject.e-mail.label"
- description="%HelloWorldProject.e-mail.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.e-mail.default"
- hidden="false"
- persist="false"/>
- </property-group>
-
- <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
- <simple name="projectName" value="$(projectName)"/>
- <simple name="path" value="src"/>
- </process>
-
- <process type="org.eclipse.cdt.core.AddFiles">
- <simple name="projectName" value="$(projectName)"/>
- <complex-array name="files">
- <element>
- <simple name="source" value="src/hello.c"/>
- <simple name="target" value="src/hello.c"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/rules"/>
- <simple name="target" value="debian/rules"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/compat"/>
- <simple name="target" value="debian/compat"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/control"/>
- <simple name="target" value="debian/control"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/changelog"/>
- <simple name="target" value="debian/changelog"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/com.samsung.hello.install"/>
- <simple name="target" value="debian/com.samsung.hello.install"/>
- <simple name="replaceable" value="true"/>
- </element>
- </complex-array>
- </process>
+ copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%HelloWorldProject.author.label"
+ description="%HelloWorldProject.author.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.author.default"
+ hidden="false"
+ persist="false"/>
+ <property id="copyright"
+ label="%HelloWorldProject.copyright.label"
+ description="%HelloWorldProject.copyright.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.copyright.default"
+ hidden="false"
+ persist="false"/>
+ <property id="description"
+ label="%HelloWorldProject.description.label"
+ description="%HelloWorldProject.description.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.description.default"
+ hidden="false"
+ persist="false"/>
+ <property id="vendor"
+ label="%HelloWorldProject.vendor.label"
+ description="%HelloWorldProject.vendor.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.vendor.default"
+ hidden="false"
+ persist="false"/>
+ <property id="e-mail"
+ label="%HelloWorldProject.e-mail.label"
+ description="%HelloWorldProject.e-mail.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.e-mail.default"
+ hidden="false"
+ persist="false"/>
+ </property-group>
+
+ <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="pathList">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="src/hello.c"/>
+ <simple name="target" value="src/hello.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/rules"/>
+ <simple name="target" value="debian/rules"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/compat"/>
+ <simple name="target" value="debian/compat"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/control"/>
+ <simple name="target" value="debian/control"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/changelog"/>
+ <simple name="target" value="debian/changelog"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/com.samsung.hello.install"/>
+ <simple name="target" value="debian/com.samsung.hello.install"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
- <process type="org.tizen.nativecommon.SetSBITarget">
- <simple name="projectName" value="$(projectName)"/>
- </process>
-
-
+ <process type="org.tizen.nativecommon.SetSBITarget">
+ <simple name="projectName" value="$(projectName)"/>
+ </process>
+
+
</template>
-EmptyProject.Ctemplate.label=Empty Debian Project
-EmptyProject.Ctemplate.description=Empty Debian Project
+EmptyProject.Ctemplate.label=Empty Platform Project
+EmptyProject.Ctemplate.description=Empty Platform Project
EmptyProject.basics.label=Advanced Settings
EmptyProject.basics.description=Advanced properties of a project
EmptyProject.author.label=Author
-com.samsung.hello (1.0.0) unstable; urgency=low
+$(projectName) (0.0.0-1) unstable; urgency=low
- * Initial Release
+ * initial release
- -- Author <E-mail> Fri, 22 Jul 2011 17:32:27 +0900
\ No newline at end of file
+ -- $(author) <$(e-mail)> Sat, 24 Mar 2012 17:32:27 +0900
\ No newline at end of file
# THIS FILE IS CREATED AUTOMATICALLY. DO NOT DELETE OR MODIFY THIS FILE.
#################################################################################
-Source: com.samsung.hello
-Maintainer: Author <E-mail>
-Standards-Version: 1.0.0
+Source: com.samsung.$(projectName)
+Maintainer: $(author) <$(e-mail)>
+Standards-Version: 0.0.1
-Package: com.samsung.hello
-description: none
-Architecture: any
-XB-Permission:
-XB-RequiredHardware:
+Package: com.samsung.$(projectName)
+description: $(description)
+Architecture: any
\ No newline at end of file
dh_testdir
# Add here commands to configure the package.
touch configure-stamp
-
+
build: build-stamp
build-stamp: configure-stamp
dh_testdir
# Add here commands to build the package.
mkdir -p bin
- $(CC) $(CFLAGS) $(LDFLAGS) src/hello.c -o bin/hello
+ $(CC) $(CFLAGS) $(LDFLAGS) src/$(projectName).c -o bin/$(projectName)
touch build-stamp
-
-clean:
+
+clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Add here commands to clean up before the build process.
dh_clean
-
+
install: build
dh_testdir
dh_testroot
- dh_clean -k
+ dh_clean -k
dh_installdirs
# Add here commands to install the package.
mkdir -p debian/tmp/usr/bin
- cp bin/hello debian/tmp/usr/bin/
+ cp bin/$(projectName) debian/tmp/usr/bin/
# Build architecture-independent files here.
binary-indep: build install
binary-arch: build install
dh_testdir
dh_testroot
- dh_installchangelogs
+ dh_installchangelogs
dh_installdocs
dh_installexamples
dh_install --sourcedir=debian/tmp
# dh_installmenu
-# dh_installdebconf
+# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installinfo
dh_installman
dh_link
- dh_strip
+# dh_strip
dh_compress
dh_fixperms
# dh_perl
dh_makeshlibs
- dh_installdeb
+ dh_installdeb
# dh_shlibdeps
dh_gencontrol
dh_md5sums
--- /dev/null
+Name: com.samsung.$(projectName)
+Version: 0.0.1
+Release: 1
+License: To be filled
+Summary: helloworld application (unstripped)
+Packager: $(author) <$(e-mail)>
+Group: Application
+Source: %{name}-%{version}.tar.gz
+%description
+$(description)
+
+%prep
+%setup -q
+
+%build
+mkdir -p bin
+gcc src/$(projectName).c -o bin/$(projectName)
+touch build-stamp
+
+%install
+echo "INSTALL"
+mkdir -p $RPM_BUILD_ROOT/usr/bin
+cp bin/$(projectName) $RPM_BUILD_ROOT/usr/bin
+
+%clean
+rm -f build-stamp configure-stamp
+
+%files
+%defattr(644, root, root)
+%attr(755, root, root) /usr/bin
+
+%changelog
+* Sat Mar 24 2012 Author <E-mail>
+ - initial release
\ No newline at end of file
<?xml version="1.0" encoding="ISO-8859-1"?>
<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
- copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
- id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
- help="help.html">
- <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
- <property id="author"
- label="%HelloWorldProject.author.label"
- description="%HelloWorldProject.author.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.author.default"
- hidden="false"
- persist="false"/>
- <property id="copyright"
- label="%HelloWorldProject.copyright.label"
- description="%HelloWorldProject.copyright.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.copyright.default"
- hidden="false"
- persist="false"/>
- <property id="description"
- label="%HelloWorldProject.description.label"
- description="%HelloWorldProject.description.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.description.default"
- hidden="false"
- persist="false"/>
- <property id="vendor"
- label="%HelloWorldProject.vendor.label"
- description="%HelloWorldProject.vendor.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.vendor.default"
- hidden="false"
- persist="false"/>
- <property id="e-mail"
- label="%HelloWorldProject.e-mail.label"
- description="%HelloWorldProject.e-mail.description"
- type="input"
- pattern=".*"
- default="%HelloWorldProject.e-mail.default"
- hidden="false"
- persist="false"/>
- </property-group>
-
- <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
- <simple name="projectName" value="$(projectName)"/>
- <simple name="path" value="src"/>
- </process>
-
- <process type="org.eclipse.cdt.core.AddFiles">
- <simple name="projectName" value="$(projectName)"/>
- <complex-array name="files">
- <element>
- <simple name="source" value="src/hello.c"/>
- <simple name="target" value="src/hello.c"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/rules"/>
- <simple name="target" value="debian/rules"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/compat"/>
- <simple name="target" value="debian/compat"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/control"/>
- <simple name="target" value="debian/control"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/changelog"/>
- <simple name="target" value="debian/changelog"/>
- <simple name="replaceable" value="true"/>
- </element>
- <element>
- <simple name="source" value="debian/com.samsung.hello.install"/>
- <simple name="target" value="debian/com.samsung.hello.install"/>
- <simple name="replaceable" value="true"/>
- </element>
- </complex-array>
- </process>
+ copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%HelloWorldProject.author.label"
+ description="%HelloWorldProject.author.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.author.default"
+ hidden="false"
+ persist="false"/>
+ <property id="copyright"
+ label="%HelloWorldProject.copyright.label"
+ description="%HelloWorldProject.copyright.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.copyright.default"
+ hidden="false"
+ persist="false"/>
+ <property id="description"
+ label="%HelloWorldProject.description.label"
+ description="%HelloWorldProject.description.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.description.default"
+ hidden="false"
+ persist="false"/>
+ <property id="vendor"
+ label="%HelloWorldProject.vendor.label"
+ description="%HelloWorldProject.vendor.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.vendor.default"
+ hidden="false"
+ persist="false"/>
+ <property id="e-mail"
+ label="%HelloWorldProject.e-mail.label"
+ description="%HelloWorldProject.e-mail.description"
+ type="input"
+ pattern=".*"
+ default="%HelloWorldProject.e-mail.default"
+ hidden="false"
+ persist="false"/>
+ </property-group>
+
+ <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="pathList">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="src/hello.c"/>
+ <simple name="target" value="src/$(projectName).c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/rules"/>
+ <simple name="target" value="debian/rules"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/compat"/>
+ <simple name="target" value="debian/compat"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/control"/>
+ <simple name="target" value="debian/control"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/changelog"/>
+ <simple name="target" value="debian/changelog"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/com.samsung.hello.install"/>
+ <simple name="target" value="debian/com.samsung.$(projectName).install"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="packaging/hello.spec"/>
+ <simple name="target" value="packaging/$(projectName).spec"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.tizen.nativecommon.SetSBITarget">
+ <simple name="projectName" value="$(projectName)"/>
+ </process>
+
- <process type="org.tizen.nativecommon.SetSBITarget">
- <simple name="projectName" value="$(projectName)"/>
- </process>
-
-
</template>
-#!/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/*.feature $build_path/features
-
- echo "Copy plugins from $SRCDIR to $build_path/plugins"
- cp -r $SRCDIR/* $build_path/plugins
- rm -rf $build_path/plugins/*.feature
-}
-
-__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}/
+ echo "add necessary files."
+ ## ex)
+ ## ide_root_path_name=IDE
+ ## cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
}
-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
-Package:nativeplatform-eplugin
-Version:0.20.14
-OS:linux
-Build-host-os:linux
-Build-dependency:indigo-pde [linux], base-ide-product [linux], common-eplugin [linux], nativecommon-eplugin [linux]
-Install-dependency:base-ide-product [linux], common-eplugin [linux], nativecommon-eplugin [linux]
+Version:1.0.21
Source:nativeplatform-eplugin
-Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park, Taeyoung Son
+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:nativeplatform-eplugin
+OS:ubuntu-32
+Build-host-os:ubuntu-32
+Build-dependency:indigo-pde [ubuntu-32], base-ide-product [ubuntu-32], common-eplugin [ubuntu-32], nativecommon-eplugin [ubuntu-32]
+Install-dependency:base-ide-product [ubuntu-32], common-eplugin [ubuntu-32], nativecommon-eplugin [ubuntu-32]
Description:Nativeplatform plugin
Package:nativeplatform-eplugin
-Version:0.20.14
-OS:windows
-Build-host-os:linux
-Build-dependency:indigo-winpde [windows], base-ide-product [windows], common-eplugin [windows], nativecommon-eplugin [windows]
-Install-dependency:base-ide-product [windows], common-eplugin [windows], nativecommon-eplugin [windows]
-Source:nativeplatform-eplugin
-Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park, Taeyoung Son
+OS:ubuntu-64
+Build-host-os:ubuntu-32
+Build-dependency:indigo-pde [ubuntu-64], base-ide-product [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64]
+Install-dependency:base-ide-product [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64]
+Description:Nativeplatform plugin
+
+Package:nativeplatform-eplugin
+OS:macos-64
+Build-host-os:ubuntu-32
+Build-dependency:indigo-macpde [macos-64], base-ide-product [macos-64], common-eplugin [macos-64], nativecommon-eplugin [macos-64]
+Install-dependency:base-ide-product [macos-64], common-eplugin [macos-64], nativecommon-eplugin [macos-64]
Description:Nativeplatform plugin