[Esbox-commits] r875 - in trunk/maemosdk: . org.maemo.esbox.maemosdk.sb2 org.maemo.esbox.maemosdk.sb2/META-INF org.maemo.esbox.maemosdk.sb2/conf org.maemo.esbox.maemosdk.sb2/icons org.maemo.esbox.maemosdk.sb2/icons/full org.maemo.esbox.maemosdk.sb2/icons/full/obj16 org.maemo.esbox.maemosdk.sb2/src org.maemo.esbox.maemosdk.sb2/src/org org.maemo.esbox.maemosdk.sb2/src/org/maemo org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2 org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/core org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2 org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2 org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/sdk
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Wed Oct 15 22:24:40 EEST 2008
Author: eswartz
Date: 2008-10-15 22:24:39 +0300 (Wed, 15 Oct 2008)
New Revision: 875
Added:
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.settings/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16/maemoprj_obj.png
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/core/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/core/SB2PreferenceConstants.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/Activator.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/AbstractSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetCurrentTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetVersionScratchboxCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCompilersSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCputranspSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListTargetsCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/MaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ShowPathMappingSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2FileSystemMapping.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDK.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDKTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/Scratchbox2SDKProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/sdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/sdk/IScratchbox2SDK.java
Removed:
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.settings/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16/maemoprj_obj.png
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/AbstractSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetCurrentTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetVersionScratchboxCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCompilersSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCputranspSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListTargetsCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/MaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ShowPathMappingSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/Scratchbox2SDKProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/
Log:
Merged Petr's sdkPlugins branch (rev 874) and adapted to package naming conventions.
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2 (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2)
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.classpath 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.project
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/.project 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.project 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.maemo.esbox.maemosdk.sb2</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.project (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/.project)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.project 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk.sb2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/.settings (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/.settings)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF)
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: scratchbox 2 and sdk+
-Bundle-SymbolicName: org.maemo.esbox.maemosdk.sb2;singleton:=true
-Bundle-Version: 1.5.0.qualifier
-Bundle-Activator: org.maemo.esbox.maemosdk.sb2.internal.Activator
-Require-Bundle: org.eclipse.core.runtime,
- org.maemo.esbox.maemosdk.core;bundle-version="1.5.0",
- org.eclipse.ui.ide;bundle-version="3.4.1",
- org.maemo.esbox.maemosdk.ui;bundle-version="1.5.0"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.maemo.esbox.maemosdk.sb2.command;x-friends:="org.maemo.esbox.maemosdk.tests",
- org.maemo.esbox.maemosdk.sb2.core;x-friends:="org.maemo.esbox.maemosdk.tests",
- org.maemo.esbox.maemosdk.sb2.launcher;x-friends:="org.maemo.esbox.maemosdk.tests",
- org.maemo.esbox.maemosdk.sb2.provider;x-friends:="org.maemo.esbox.maemosdk.tests",
- org.maemo.esbox.maemosdk.sb2.ui.preferences;x-friends:="org.maemo.esbox.maemosdk.tests",
- org.maemo.esbox.maemosdk.sb2.ui.wizard
-Bundle-Vendor: INdT / Nokia
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/META-INF/MANIFEST.MF 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Scratchbox 2 Support
+Bundle-SymbolicName: org.maemo.esbox.maemosdk.sb2;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.maemosdk.sb2.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0";visibility:=reexport,
+ org.eclipse.ui.ide,
+ org.maemo.esbox.maemosdk.ui;bundle-version="1.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.maemo.esbox.internal.api.maemosdk.sb2.core,
+ org.maemo.esbox.internal.maemosdk.sb2.command,
+ org.maemo.esbox.internal.maemosdk.sb2.core;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.maemosdk.sb2.launcher,
+ org.maemo.esbox.internal.maemosdk.sb2.provider,
+ org.maemo.esbox.internal.maemosdk.sb2.ui.preferences,
+ org.maemo.esbox.internal.maemosdk.sb2.ui.wizard,
+ org.maemo.esbox.maemosdk.sb2.sdk
+Bundle-Vendor: INdT / Nokia
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- conf/,\
- icons/
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/build.properties 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ conf/,\
+ icons/
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/conf)
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
-
-<properties>
- <comment>This file contains the default settings for Scratchbox 2 preferences;
- see the org.maemo.esbox.core.preference_set_provider extension</comment>
-
- <!-- WHEN ANY DEFAULTS CHANGED warranting rewriting prefs,
- bump pref version in esbox_common.xml and adjust ESboxPreferenceInitializer#RPEFS_VERSION_MAJOR ;
- WHEN ANYTHING ELSE CHANGED which can be merged into existing prefs,
- adjust ESboxPreferenceInitializer#RPEFS_VERSION_MINOR -->
-
- <entry key="SB2_MAPPING_MODE">maemo</entry>
- <entry key="SB2_INSTALL_MAPPING_MODE">emulate</entry>
- <entry key="SB2_LOG_LEVEL"></entry>
-
- <entry key="SB2_EXEC_COMMAND">sb2 -Qx -m ${MAPPING_MODE} ${LOG_OPTION} -t ${TARGET} "${{COMMAND}} ${{ARGS}}"</entry>
-
- <!-- this qemu-arm link is expected to be valid; we don't try to substitute unlike for sb1: see GetGdbQemuCommandPatternCommand -->
- <entry key="SB2_GDB_REMOTE_QEMU">sb2-qemu-arm -g ${PORT}</entry>
-
- <!-- The hash-bang in these scripts don't properly launch bash! -->
- <entry key="SB2_INIT_COMMAND">/bin/bash -c "sb2-init ${{OPTIONS}} ${{TARGET}} ${{COMPILER}}"</entry>
- <entry key="SB2_CONFIG_COMMAND">/bin/bash -c "sb2-config ${{ACTIONS}} ${{OPTIONS}}"</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_COMMAND">/bin/bash -c "maemo-rootstrap ${{OPTIONS}}"</entry>
- <entry key="SB2_SB2_SHOW_COMMAND">sb2-show</entry>
-
- <!-- actions of command sb2-config -->
-
- <entry key="SB2_VERSION_ACT">-v</entry>
- <entry key="SB2_LIST_ACT">-l</entry>
-
- <!-- actions of command maemo-rootstrap -->
- <entry key="SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT">--host-tools</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_FORCE_OPT">--force</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT">available</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_LIST_ACT">list</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_INSTALL_ACT">install</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_REMOVE_ACT">remove</entry>
- <entry key="SB2_MAEMO_ROOTSTRAP_PATH_ACT">path</entry>
-
- <!-- actions of command sb2-show -->
- <entry key="SB2_SB2_SHOW_PATH_ACTION">path</entry>
- <entry key="SB2_SB2_SHOW_PATH_OUTPUT_PATTERN">(.+)\s+=>\s+(\S+).*</entry>
-
-</properties>
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/conf/sb2_prefs.xml 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>This file contains the default settings for Scratchbox 2 preferences;
+ see the org.maemo.esbox.core.preference_set_provider extension</comment>
+
+ <!-- WHEN ANY DEFAULTS CHANGED warranting rewriting prefs,
+ bump pref version in esbox_common.xml and adjust ESboxPreferenceInitializer#RPEFS_VERSION_MAJOR ;
+ WHEN ANYTHING ELSE CHANGED which can be merged into existing prefs,
+ adjust ESboxPreferenceInitializer#RPEFS_VERSION_MINOR -->
+
+ <entry key="SB2_MAPPING_MODE">maemo</entry>
+ <entry key="SB2_INSTALL_MAPPING_MODE">emulate</entry>
+ <entry key="SB2_LOG_LEVEL"></entry>
+
+ <entry key="SB2_EXEC_COMMAND">sb2 -Qx -m ${MAPPING_MODE} ${LOG_OPTION} -t ${TARGET} "${{COMMAND}} ${{ARGS}}"</entry>
+
+ <!-- this qemu-arm link is expected to be valid; we don't try to substitute unlike for sb1: see GetGdbQemuCommandPatternCommand -->
+ <entry key="SB2_GDB_REMOTE_QEMU">sb2-qemu-arm -g ${PORT}</entry>
+
+ <!-- The hash-bang in these scripts don't properly launch bash! -->
+ <entry key="SB2_INIT_COMMAND">/bin/bash -c "sb2-init ${{OPTIONS}} ${{TARGET}} ${{COMPILER}}"</entry>
+ <entry key="SB2_CONFIG_COMMAND">/bin/bash -c "sb2-config ${{ACTIONS}} ${{OPTIONS}}"</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_COMMAND">/bin/bash -c "maemo-rootstrap ${{OPTIONS}}"</entry>
+ <entry key="SB2_SB2_SHOW_COMMAND">sb2-show</entry>
+
+ <!-- actions of command sb2-config -->
+
+ <entry key="SB2_VERSION_ACT">-v</entry>
+ <entry key="SB2_LIST_ACT">-l</entry>
+
+ <!-- actions of command maemo-rootstrap -->
+ <entry key="SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT">--host-tools</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_FORCE_OPT">--force</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT">available</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_LIST_ACT">list</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_INSTALL_ACT">install</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_REMOVE_ACT">remove</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_PATH_ACT">path</entry>
+
+ <!-- actions of command sb2-show -->
+ <entry key="SB2_SB2_SHOW_PATH_ACTION">path</entry>
+ <entry key="SB2_SB2_SHOW_PATH_OUTPUT_PATTERN">(.+)\s+=>\s+(\S+).*</entry>
+
+</properties>
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/icons)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16 (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16)
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16/maemoprj_obj.png
===================================================================
(Binary files differ)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16/maemoprj_obj.png (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/icons/full/obj16/maemoprj_obj.png)
===================================================================
(Binary files differ)
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension
- point="org.maemo.esbox.core.sdk_provider">
- <sdk_provider
- class="org.maemo.esbox.maemosdk.sb2.provider.Scratchbox2SDKProvider">
- </sdk_provider>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.maemo.esbox.ui.esboxPreferencePage"
- class="org.maemo.esbox.maemosdk.sb2.ui.preferences.Scratchbox2PreferencesPage"
- id="org.maemo.esbox.maemosdk.sdk2.esboxPreferencePage"
- name="Scratchbox 2">
- </page>
- </extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK"
- class="org.maemo.esbox.maemosdk.sb2.ui.adapters.MaemoSDKInstallTargetAdapterFactory">
- <adapter
- type="org.maemo.esbox.core.adapters.ISDKManageTargetAdapter">
- </adapter>
- </factory>
- </extension>
- <extension
- point="org.maemo.esbox.core.preference_set_provider">
- <preferenceSetProvider
- defaultsXMLFile="conf/sb2_prefs.xml"
- preferenceConstantsClass="org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants"
- preferenceMigratorClass="org.maemo.esbox.internal.api.core.OldESboxPreferenceMigrator"
- preferenceStoreBundle="org.maemo.esbox.maemosdk.sdk2"
- version="17">
- </preferenceSetProvider>
- </extension>
- <extension
- point="org.eclipse.ui.newWizards">
- <wizard
- class="org.maemo.esbox.maemosdk.sb2.ui.wizard.NewScratchbox2TargetWizard"
- icon="icons/full/obj16/maemoprj_obj.png"
- id="org.maemo.esbox.maemosdk.ui.scratchbox.targets.wizards.NewTargetWizard"
- name="Scratchbox Targets">
- </wizard>
- </extension>
-
-</plugin>
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/plugin.xml 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.maemo.esbox.core.sdk_provider">
+ <sdk_provider
+ class="org.maemo.esbox.internal.maemosdk.sb2.provider.Scratchbox2SDKProvider">
+ </sdk_provider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.internal.maemosdk.sb2.ui.preferences.Scratchbox2PreferencesPage"
+ id="org.maemo.esbox.maemosdk.sdk2.esboxPreferencePage"
+ name="Scratchbox 2">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.maemo.esbox.maemosdk.sb2.sdk.IScratchbox2SDK"
+ class="org.maemo.esbox.internal.maemosdk.sb2.ui.adapters.MaemoSDKInstallTargetAdapterFactory">
+ <adapter
+ type="org.maemo.esbox.core.adapters.ISDKManageTargetAdapter">
+ </adapter>
+ </factory>
+ </extension>
+ <extension
+ point="org.maemo.esbox.core.preference_set_provider">
+ <preferenceSetProvider
+ defaultsXMLFile="conf/sb2_prefs.xml"
+ preferenceConstantsClass="org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants"
+ preferenceMigratorClass="org.maemo.esbox.internal.api.core.OldESboxPreferenceMigrator"
+ preferenceStoreBundle="org.maemo.esbox.maemosdk.sdk2"
+ version="17">
+ </preferenceSetProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ class="org.maemo.esbox.internal.maemosdk.sb2.ui.wizard.NewScratchbox2TargetWizard"
+ icon="icons/full/obj16/maemoprj_obj.png"
+ id="org.maemo.esbox.maemosdk.ui.scratchbox.targets.wizards.NewTargetWizard"
+ name="Scratchbox Targets">
+ </wizard>
+ </extension>
+
+</plugin>
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/core/SB2PreferenceConstants.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/core/SB2PreferenceConstants.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/core/SB2PreferenceConstants.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/core/SB2PreferenceConstants.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.maemosdk.sb2.core;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+
+/**
+ * This class encapsulates the keys for preference constants defined by
+ * Scratchbox 2.
+ *
+ * @author eswartz
+ *
+ */
+public class SB2PreferenceConstants {
+ public static final int VERSION_MAJOR = 17;
+ public static final int VERSION_MINOR = 0;
+
+ /** Get the preference store that contains these preferences */
+ public static IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+
+ /* SB2 configuration options */
+ public static final String SB2_GDB_REMOTE_QEMU = "SB2_GDB_REMOTE_QEMU";
+ public static final String SB2_CONFIG_COMMAND = "SB2_CONFIG_COMMAND";
+ public static final String SB2_EXEC_COMMAND = "SB2_EXEC_COMMAND";
+ public static final String SB2_INIT_COMMAND = "SB2_INIT_COMMAND";
+ public static final String SB2_VERSION_ACT = "SB2_VERSION_ACT";
+ public static final String SB2_LIST_ACT = "SB2_LIST_ACT";
+ public static final String SB2_MAPPING_MODE = "SB2_MAPPING_MODE";
+ public static final String SB2_INSTALL_MAPPING_MODE = "SB2_INSTALL_MAPPING_MODE";
+ public static final String SB2_LOG_LEVEL = "SB2_LOG_LEVEL";
+ public static final String SB2_INIT_OPT_COMPILER = "SB2_INIT_OPT_COMPILER";
+ public static final String SB2_MAEMO_ROOTSTRAP_COMMAND = "SB2_MAEMO_ROOTSTRAP_COMMAND";
+ public static final String SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT = "SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT";
+ public static final String SB2_MAEMO_ROOTSTRAP_LIST_ACT = "SB2_MAEMO_ROOTSTRAP_LIST_ACT";
+ public static final String SB2_MAEMO_ROOTSTRAP_INSTALL_ACT = "SB2_MAEMO_ROOTSTRAP_INSTALL_ACT";
+ public static final String SB2_MAEMO_ROOTSTRAP_FORCE_OPT = "SB2_MAEMO_ROOTSTRAP_FORCE_OPT";
+ public static final String SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT = "SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT";
+ public static final String SB2_MAEMO_ROOTSTRAP_REMOVE_ACT = "SB2_MAEMO_ROOTSTRAP_REMOVE_ACT";
+ public static final String SB2_SB2_SHOW_COMMAND = "SB2_SB2_SHOW_COMMAND";
+ public static final String SB2_SB2_SHOW_PATH_ACTION = "SB2_SB2_SHOW_PATH_ACTION";
+ public static final String SB2_SB2_SHOW_PATH_OUTPUT_PATTERN = "SB2_SB2_SHOW_PATH_OUTPUT_PATTERN";
+ public static final String SB2_MAEMO_ROOTSTRAP_PATH_ACT = "SB2_MAEMO_ROOTSTRAP_PATH_ACT";
+
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/api/maemosdk/sb2/core/SB2PreferenceConstants.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/Activator.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/internal/Activator.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/Activator.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/Activator.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,157 @@
+package org.maemo.esbox.internal.maemosdk.sb2;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.maemosdk.sdk2";
+
+ // The shared instance
+ private static Activator plugin;
+
+ private IPreferenceStore preferenceStore;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path.
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running workspace or a
+ * standalone unit test (assumed to run relative to a plugin)
+ *
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path)
+ throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(
+ path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns the preference store for this UI plug-in. This preference store
+ * is used to hold persistent settings for this plug-in in the context of a
+ * workbench. Some of these settings will be user controlled, whereas others
+ * may be internal setting that are never exposed to the user.
+ * <p>
+ * If an error occurs reading the preference store, an empty preference
+ * store is quietly created, initialized with defaults, and returned.
+ * </p>
+ * <p>
+ * <strong>NOTE:</strong> As of Eclipse 3.1 this method is no longer
+ * referring to the core runtime compatibility layer and so plug-ins relying
+ * on Plugin#initializeDefaultPreferences will have to access the
+ * compatibility layer themselves.
+ * </p>
+ *
+ * @return the preference store
+ */
+ public IPreferenceStore getPreferenceStore() {
+ // Create the preference store lazily.
+ if (preferenceStore == null) {
+ preferenceStore = new ScopedPreferenceStore(new InstanceScope(),
+ getBundle().getSymbolicName());
+
+ }
+ return preferenceStore;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/Activator.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/AbstractSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/AbstractSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/AbstractSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Petr Baranov (Nokia) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.security.InvalidParameterException;
-
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.AbstractSDKCommand;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-public abstract class AbstractSb2Command extends AbstractSDKCommand {
-
- public AbstractSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.maemo.esbox.maemosdk.core.command.AbstractSDKCommand#
- * replaceScratchboxConfigCommand(java.lang.String, java.lang.String[])
- */
- public String replaceScratchboxConfigCommand(String action, String[] options)
- throws InvalidParameterException {
- String sboxCommand;
-
- sboxCommand = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_CONFIG_COMMAND);
-
- return replaceScratchboxCommand(sboxCommand, action, options);
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/AbstractSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/AbstractSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/AbstractSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/AbstractSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.security.InvalidParameterException;
+
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.AbstractSDKCommand;
+
+public abstract class AbstractSb2Command extends AbstractSDKCommand {
+
+ public AbstractSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.maemo.esbox.maemosdk.core.command.AbstractSDKCommand#
+ * replaceScratchboxConfigCommand(java.lang.String, java.lang.String[])
+ */
+ public String replaceScratchboxConfigCommand(String action, String[] options)
+ throws InvalidParameterException {
+ String sboxCommand;
+
+ sboxCommand = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_CONFIG_COMMAND);
+
+ return replaceScratchboxCommand(sboxCommand, action, options);
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.maemo.esbox.core.CorePlugin;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * Creates a new rootstrap for a target, if it does not exist. This command
- * wraps the callback to service:
- * <p>
- * maemo-rootstrap [--force] install <target>
- *
- */
-public class CreateMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
-
- private ISDK sdk;
- private IProgressMonitor monitor;
-
- public CreateMaemoRootstrapSb2Command(ISDK sdk,
- ICommandAbstractor commandAbstractor, IProgressMonitor monitor) {
- super(commandAbstractor);
- this.sdk = sdk;
- this.monitor = monitor;
- }
-
- protected boolean checkParameters(List<String> param) {
- return param.size() == 3;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public Boolean performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String targetName = param.get(0);
- String useHostToolsFlag = param.get(1);
- String forceFlag = param.get(2);
-
- List<String> params = new ArrayList<String>();
- if (useHostToolsFlag.equals(Boolean.TRUE.toString())) {
- params
- .add(commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT));
- }
- if (forceFlag.equals(Boolean.TRUE.toString())) {
- params
- .add(commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT));
- }
- params
- .add(commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_INSTALL_ACT));
- params.add(targetName);
-
- IEnvironmentModifierBlock envBlock = commandAbstractor
- .getProcessLauncherFactory().defaultEnvironmentModifierBlock();
- ProcessLauncherUtils.defineProxyVariables(envBlock);
-
- setMonitorAndConsole(monitor, CorePlugin.getDefault().getConsole(true,
- null, "Installing rootstrap " + targetName));
- doPerformCommand(params, envBlock, 0);
-
- sdk.refresh();
-
- return true;
- }
-
- public int getParametersSize() {
- return 1;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateMaemoRootstrapSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Creates a new rootstrap for a target, if it does not exist. This command
+ * wraps the callback to service:
+ * <p>
+ * maemo-rootstrap [--force] install <target>
+ *
+ */
+public class CreateMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
+
+ private ISDK sdk;
+ private IProgressMonitor monitor;
+
+ public CreateMaemoRootstrapSb2Command(ISDK sdk,
+ ICommandAbstractor commandAbstractor, IProgressMonitor monitor) {
+ super(commandAbstractor);
+ this.sdk = sdk;
+ this.monitor = monitor;
+ }
+
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 3;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public Boolean performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String useHostToolsFlag = param.get(1);
+ String forceFlag = param.get(2);
+
+ List<String> params = new ArrayList<String>();
+ if (useHostToolsFlag.equals(Boolean.TRUE.toString())) {
+ params
+ .add(commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT));
+ }
+ if (forceFlag.equals(Boolean.TRUE.toString())) {
+ params
+ .add(commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT));
+ }
+ params
+ .add(commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_INSTALL_ACT));
+ params.add(targetName);
+
+ IEnvironmentModifierBlock envBlock = commandAbstractor
+ .getProcessLauncherFactory().defaultEnvironmentModifierBlock();
+ ProcessLauncherUtils.defineProxyVariables(envBlock);
+
+ setMonitorAndConsole(monitor, CorePlugin.getDefault().getConsole(true,
+ null, "Installing rootstrap " + targetName));
+ doPerformCommand(params, envBlock, 0);
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/CreateTargetSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateTargetSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.List;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.process.CommandLineArguments;
-import org.maemo.esbox.core.process.IProcessLauncher;
-import org.maemo.esbox.core.process.ProcessLauncherCreator;
-import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.sb2.internal.Activator;
-
-/**
- * Creates a new target, if it does not exist. This command wraps the callback
- * to service:
- * <p>
- * sb2-init {flags} [targetname] [compiler]
- *
- */
-public class CreateTargetSb2Command extends AbstractSb2Command {
-
- private ISDK sdk;
-
- public CreateTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- this.sdk = sdk;
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return param.size() >= 3;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public Object performCommand(List<String> param) throws ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String targetName = param.get(0);
- String compilerName = param.get(1);
- String cpuTransp = param.get(2);
-
- // remaining arguments are flags
- String pattern = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_INIT_COMMAND);
-
- ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
- substitutor.define("TARGET", targetName);
- substitutor.define("COMPILER", compilerName);
-
- String options = "";
- if (cpuTransp != null && cpuTransp.length() > 0) {
- options += "-c " + cpuTransp;
- }
- substitutor.define("OPTIONS", options);
-
- pattern = substitutor.substitute(pattern);
-
- List<String> cmdLine = CommandLineArguments
- .createFromCommandLine(pattern);
-
- IProcessLauncher processLauncher = ProcessLauncherCreator
- .createProcessLauncher(commandAbstractor
- .getProcessLauncherFactory(), null, cmdLine);
-
- Process process = processLauncher.createProcess();
-
- processLauncher.redirectToConsole(true, null,
- "Installing scratchbox2 target " + targetName);
-
- try {
- process.waitFor();
- } catch (InterruptedException e) {
- Activator.getErrorLogger().logError("Target installation aborted",
- e);
- }
-
- sdk.refresh();
-
- return true;
- }
-
- @Override
- public int getParametersSize() {
- return 3;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateTargetSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/CreateTargetSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateTargetSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/CreateTargetSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+
+/**
+ * Creates a new target, if it does not exist. This command wraps the callback
+ * to service:
+ * <p>
+ * sb2-init {flags} [targetname] [compiler]
+ *
+ */
+public class CreateTargetSb2Command extends AbstractSb2Command {
+
+ private ISDK sdk;
+
+ public CreateTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ this.sdk = sdk;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() >= 3;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String compilerName = param.get(1);
+ String cpuTransp = param.get(2);
+
+ // remaining arguments are flags
+ String pattern = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_INIT_COMMAND);
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("TARGET", targetName);
+ substitutor.define("COMPILER", compilerName);
+
+ String options = "";
+ if (cpuTransp != null && cpuTransp.length() > 0) {
+ options += "-c " + cpuTransp;
+ }
+ substitutor.define("OPTIONS", options);
+
+ pattern = substitutor.substitute(pattern);
+
+ List<String> cmdLine = CommandLineArguments
+ .createFromCommandLine(pattern);
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator
+ .createProcessLauncher(commandAbstractor
+ .getProcessLauncherFactory(), null, cmdLine);
+
+ Process process = processLauncher.createProcess();
+
+ processLauncher.redirectToConsole(true, null,
+ "Installing scratchbox2 target " + targetName);
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ Activator.getErrorLogger().logError("Target installation aborted",
+ e);
+ }
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 3;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetCurrentTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetCurrentTargetSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetCurrentTargetSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (UFCG) - initial API and implementation
- * Ed Swartz (Nokia)
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.core.CorePreferenceConstants;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.Policy;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-/**
- * Get the current Scratchgox 2 target. There is no command to do this, so read
- * $HOME/.scratchbox2/config
- */
-public class GetCurrentTargetSb2Command extends AbstractSb2Command {
-
- public GetCurrentTargetSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public String performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- IFileStore config = commandAbstractor
- .getFileSystemAccess()
- .getFileStore(
- new Path("home")
- .append(
- commandAbstractor
- .getPreferenceValue(CorePreferenceConstants.USER))
- .append(".scratchbox2").append("config"));
-
- InputStream is = null;
- try {
- is = config.openInputStream(EFS.NONE, null);
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(is));
- Pattern varPattern = Pattern
- .compile("\\s*DEFAULT_TARGET\\s*=\\s*(\\S+)\\s*");
- String line;
- while ((line = reader.readLine()) != null) {
- Matcher matcher = varPattern.matcher(line.trim());
- if (matcher.matches()) {
- return matcher.group(1);
- }
- }
-
- return null;
- } catch (IOException e) {
- throw new ScratchboxException("Cannot read target from " + config
- + ": " + e.getMessage());
- } catch (CoreException e) {
- throw new ScratchboxException("Cannot read target from " + config
- + ": " + e.getMessage());
- } finally {
- Policy.close(is);
- }
-
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetCurrentTargetSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetCurrentTargetSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetCurrentTargetSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetCurrentTargetSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.CorePreferenceConstants;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Get the current Scratchgox 2 target. There is no command to do this, so read
+ * $HOME/.scratchbox2/config
+ */
+public class GetCurrentTargetSb2Command extends AbstractSb2Command {
+
+ public GetCurrentTargetSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public String performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ IFileStore config = commandAbstractor
+ .getFileSystemAccess()
+ .getFileStore(
+ new Path("home")
+ .append(
+ commandAbstractor
+ .getPreferenceValue(CorePreferenceConstants.USER))
+ .append(".scratchbox2").append("config"));
+
+ InputStream is = null;
+ try {
+ is = config.openInputStream(EFS.NONE, null);
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(is));
+ Pattern varPattern = Pattern
+ .compile("\\s*DEFAULT_TARGET\\s*=\\s*(\\S+)\\s*");
+ String line;
+ while ((line = reader.readLine()) != null) {
+ Matcher matcher = varPattern.matcher(line.trim());
+ if (matcher.matches()) {
+ return matcher.group(1);
+ }
+ }
+
+ return null;
+ } catch (IOException e) {
+ throw new ScratchboxException("Cannot read target from " + config
+ + ": " + e.getMessage());
+ } catch (CoreException e) {
+ throw new ScratchboxException("Cannot read target from " + config
+ + ": " + e.getMessage());
+ } finally {
+ Policy.close(is);
+ }
+
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.List;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * Get the command pattern for launching qemu with the debugger
- *
- * @author eswartz
- *
- */
-public class GetGdbQemuCommandPatternCommand extends AbstractSb2Command {
- private IScratchboxSDKTarget sdkTarget;
-
- public GetGdbQemuCommandPatternCommand(IScratchboxSDKTarget sdkTarget,
- ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- this.sdkTarget = sdkTarget;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public String performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String commandPattern = null;
-
- String architecture = param.get(0);
-
- if (architecture.equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)) {
- // we think this always uses a new enough version, so keep ${PORT}
- commandPattern = sdkTarget
- .getPreferenceValue(SB2PreferenceConstants.SB2_GDB_REMOTE_QEMU);
- } else {
- // The others, just standard "gdbserver" command.
- commandPattern = sdkTarget
- .getPreferenceValue(MaemoPreferenceConstants.SBOX_GDB_REMOTE);
- }
-
- return commandPattern;
- }
-
- /**
- * Find what qemu is configured for this target.
- *
- * @return qemu name, or <code>null</code> if not using qemu
- */
- protected String getConfiguredQemu() throws ESboxException {
- return null;
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetGdbQemuCommandPatternCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * Get the command pattern for launching qemu with the debugger
+ *
+ * @author eswartz
+ *
+ */
+public class GetGdbQemuCommandPatternCommand extends AbstractSb2Command {
+ private IScratchboxSDKTarget sdkTarget;
+
+ public GetGdbQemuCommandPatternCommand(IScratchboxSDKTarget sdkTarget,
+ ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ this.sdkTarget = sdkTarget;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public String performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String commandPattern = null;
+
+ String architecture = param.get(0);
+
+ if (architecture.equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)) {
+ // we think this always uses a new enough version, so keep ${PORT}
+ commandPattern = sdkTarget
+ .getPreferenceValue(SB2PreferenceConstants.SB2_GDB_REMOTE_QEMU);
+ } else {
+ // The others, just standard "gdbserver" command.
+ commandPattern = sdkTarget
+ .getPreferenceValue(MaemoPreferenceConstants.SBOX_GDB_REMOTE);
+ }
+
+ return commandPattern;
+ }
+
+ /**
+ * Find what qemu is configured for this target.
+ *
+ * @return qemu name, or <code>null</code> if not using qemu
+ */
+ protected String getConfiguredQemu() throws ESboxException {
+ return null;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * @author eswartz
- *
- */
-public class GetMaemoRootstrapLocationCommand extends MaemoRootstrapSb2Command {
-
- private IScratchboxSDKTarget sdkTarget;
-
- public GetMaemoRootstrapLocationCommand(
- ICommandAbstractor commandAbstractor, IScratchboxSDKTarget sdkTarget) {
- super(commandAbstractor);
- this.sdkTarget = sdkTarget;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return param.size() == 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.maemo.esbox.internal.core.command.ICommand#performCommand(java.util
- * .List)
- */
- public Object performCommand(List<String> params)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(params))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- List<String> rsCommands = new ArrayList<String>(2);
-
- String pathAction = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_PATH_ACT);
-
- rsCommands.add(pathAction);
- rsCommands.add(sdkTarget.getName());
-
- List<String> results = doPerformCommand(rsCommands, null, 0);
- if (results.size() == 0)
- throw new ScratchboxException(
- "Could not detect rootstrap location for " + sdkTarget
- + "\ngot:\n" + catenateLines(results));
-
- // ignore bogus report of deleted rootstrap
- IPath root = new Path(results.get(0).trim());
- IFileStore store = sdkTarget.getMachineFileSystemAccess().getFileStore(
- root);
- if (store.fetchInfo().exists())
- return root;
- else
- throw new ScratchboxException("Rootstrap location for " + sdkTarget
- + " does not exist: " + store);
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetMaemoRootstrapLocationCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * @author eswartz
+ *
+ */
+public class GetMaemoRootstrapLocationCommand extends MaemoRootstrapSb2Command {
+
+ private IScratchboxSDKTarget sdkTarget;
+
+ public GetMaemoRootstrapLocationCommand(
+ ICommandAbstractor commandAbstractor, IScratchboxSDKTarget sdkTarget) {
+ super(commandAbstractor);
+ this.sdkTarget = sdkTarget;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.internal.core.command.ICommand#performCommand(java.util
+ * .List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ List<String> rsCommands = new ArrayList<String>(2);
+
+ String pathAction = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_PATH_ACT);
+
+ rsCommands.add(pathAction);
+ rsCommands.add(sdkTarget.getName());
+
+ List<String> results = doPerformCommand(rsCommands, null, 0);
+ if (results.size() == 0)
+ throw new ScratchboxException(
+ "Could not detect rootstrap location for " + sdkTarget
+ + "\ngot:\n" + catenateLines(results));
+
+ // ignore bogus report of deleted rootstrap
+ IPath root = new Path(results.get(0).trim());
+ IFileStore store = sdkTarget.getMachineFileSystemAccess().getFileStore(
+ root);
+ if (store.fetchInfo().exists())
+ return root;
+ else
+ throw new ScratchboxException("Rootstrap location for " + sdkTarget
+ + " does not exist: " + store);
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetVersionScratchboxCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetVersionScratchboxCommand.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetVersionScratchboxCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (UFCG) - initial API and implementation
- * Ed Swartz (Nokia)
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.List;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * Get the version of Scratchbox installed. This command wraps the callback to
- * service sb-conf version.
- *
- */
-public class GetVersionScratchboxCommand extends AbstractSb2Command {
-
- public GetVersionScratchboxCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
- */
- public int getParametersSize() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .util.List)
- */
- public String performCommand(List<String> params)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(params))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String sboxVersionAction = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_VERSION_ACT);
-
- String currentSboxVersionCommand = this
- .replaceScratchboxConfigCommand(sboxVersionAction);
-
- Process process = createProcess(currentSboxVersionCommand, null);
-
- String currentVersion = getInputFromProcessAndWait(process, false, 0);
-
- return currentVersion;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetVersionScratchboxCommand.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/GetVersionScratchboxCommand.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetVersionScratchboxCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/GetVersionScratchboxCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Get the version of Scratchbox installed. This command wraps the callback to
+ * service sb-conf version.
+ *
+ */
+public class GetVersionScratchboxCommand extends AbstractSb2Command {
+
+ public GetVersionScratchboxCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .util.List)
+ */
+ public String performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String sboxVersionAction = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_VERSION_ACT);
+
+ String currentSboxVersionCommand = this
+ .replaceScratchboxConfigCommand(sboxVersionAction);
+
+ Process process = createProcess(currentSboxVersionCommand, null);
+
+ String currentVersion = getInputFromProcessAndWait(process, false, 0);
+
+ return currentVersion;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * List the maemo rootstraps available for installation.
- */
-public class ListAvailableMaemoRootstrapsSb2Command extends
- MaemoRootstrapSb2Command {
-
- private static final int LIST_TIMEOUT = 10000;
-
- public ListAvailableMaemoRootstrapsSb2Command(
- ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return param.size() == 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public List<MaemoRootstrap> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String availableAction = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT);
-
- // ensure the proxy is established
- IEnvironmentModifierBlock proxyEnvBlock = commandAbstractor
- .getProcessLauncherFactory().defaultEnvironmentModifierBlock();
- ProcessLauncherUtils.defineProxyVariables(proxyEnvBlock);
-
- List<String> available = doPerformCommand(Collections
- .singletonList(availableAction), proxyEnvBlock, LIST_TIMEOUT);
-
- // this output has a few header lines
- List<MaemoRootstrap> targetsAvailable = new ArrayList<MaemoRootstrap>();
-
- boolean gotHeader = false;
- for (String line : available) {
- if (line.contains("Nickname,")) {
- gotHeader = true;
- continue;
- }
- if (line.trim().length() == 0) {
- continue;
- }
- if (!gotHeader) {
- continue;
- }
-
- String[] tokens = line.split(",\\s*");
- if (tokens.length == 3) {
- targetsAvailable.add(new MaemoRootstrap(tokens[0], tokens[1],
- tokens[2]));
- }
-
- }
- return targetsAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListAvailableMaemoRootstrapsSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * List the maemo rootstraps available for installation.
+ */
+public class ListAvailableMaemoRootstrapsSb2Command extends
+ MaemoRootstrapSb2Command {
+
+ private static final int LIST_TIMEOUT = 10000;
+
+ public ListAvailableMaemoRootstrapsSb2Command(
+ ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public List<MaemoRootstrap> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String availableAction = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT);
+
+ // ensure the proxy is established
+ IEnvironmentModifierBlock proxyEnvBlock = commandAbstractor
+ .getProcessLauncherFactory().defaultEnvironmentModifierBlock();
+ ProcessLauncherUtils.defineProxyVariables(proxyEnvBlock);
+
+ List<String> available = doPerformCommand(Collections
+ .singletonList(availableAction), proxyEnvBlock, LIST_TIMEOUT);
+
+ // this output has a few header lines
+ List<MaemoRootstrap> targetsAvailable = new ArrayList<MaemoRootstrap>();
+
+ boolean gotHeader = false;
+ for (String line : available) {
+ if (line.contains("Nickname,")) {
+ gotHeader = true;
+ continue;
+ }
+ if (line.trim().length() == 0) {
+ continue;
+ }
+ if (!gotHeader) {
+ continue;
+ }
+
+ String[] tokens = line.split(",\\s*");
+ if (tokens.length == 3) {
+ targetsAvailable.add(new MaemoRootstrap(tokens[0], tokens[1],
+ tokens[2]));
+ }
+
+ }
+ return targetsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCompilersSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListCompilersSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCompilersSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.internal.Activator;
-
-/**
- * List the installed compilers. There's no known command for this, but we can
- * look in specific places.
- *
- */
-public class ListCompilersSb2Command extends AbstractSb2Command {
-
- public ListCompilersSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- List<String> compilersAvailable = new ArrayList<String>();
-
- try {
- IFileStore baseToolDir = commandAbstractor.getFileSystemAccess()
- .getFileStore(new Path("/opt/maemo/tools"));
- IFileStore[] kids = baseToolDir.childStores(EFS.NONE, null);
- for (IFileStore baseDir : kids) {
- IFileStore dir = baseDir.getChild("bin");
- if (dir.fetchInfo().isDirectory()) {
- IFileStore[] files = dir.childStores(EFS.NONE, null);
- for (IFileStore file : files) {
- if (file.getName().endsWith("-gcc")) {
- compilersAvailable.add(file.toURI().getPath());
- break;
- }
- }
- }
- }
- } catch (CoreException e) {
- Activator.getErrorLogger().logError("Error scanning compilers", e);
- }
- return compilersAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCompilersSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListCompilersSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCompilersSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCompilersSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * List the installed compilers. There's no known command for this, but we can
+ * look in specific places.
+ *
+ */
+public class ListCompilersSb2Command extends AbstractSb2Command {
+
+ public ListCompilersSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ List<String> compilersAvailable = new ArrayList<String>();
+
+ try {
+ IFileStore baseToolDir = commandAbstractor.getFileSystemAccess()
+ .getFileStore(new Path("/opt/maemo/tools"));
+ IFileStore[] kids = baseToolDir.childStores(EFS.NONE, null);
+ for (IFileStore baseDir : kids) {
+ IFileStore dir = baseDir.getChild("bin");
+ if (dir.fetchInfo().isDirectory()) {
+ IFileStore[] files = dir.childStores(EFS.NONE, null);
+ for (IFileStore file : files) {
+ if (file.getName().endsWith("-gcc")) {
+ compilersAvailable.add(file.toURI().getPath());
+ break;
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error scanning compilers", e);
+ }
+ return compilersAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCputranspSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListCputranspSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCputranspSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-
-/**
- * List the installed compilers. There's no known command for this, but we can
- * look in specific places.
- *
- */
-public class ListCputranspSb2Command extends AbstractSb2Command {
-
- public ListCputranspSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- List<String> cputranspAvailable = new ArrayList<String>();
-
- Set<String> expected = new HashSet<String>();
- expected.add("sb2-qemu-arm");
- expected.add("sbrsh");
-
- Properties env = ProcessLauncherUtils
- .getSynthesizedEnvironment(commandAbstractor
- .getProcessLauncherFactory());
- String pathenv = env.getProperty("PATH");
- if (pathenv == null) {
- pathenv = "/usr/bin:/bin"; // XXX
- }
- if (pathenv != null) {
- String[] paths = pathenv.split(":");
- for (String exp : expected) {
- for (String path : paths) {
- IFileStore bin = commandAbstractor.getFileSystemAccess()
- .getFileStore(new Path(path).append(exp));
- if (bin.fetchInfo().exists()) {
- cputranspAvailable.add(bin.toURI().getPath());
- break;
- }
- }
- }
- }
-
- return cputranspAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCputranspSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListCputranspSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCputranspSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListCputranspSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * List the installed compilers. There's no known command for this, but we can
+ * look in specific places.
+ *
+ */
+public class ListCputranspSb2Command extends AbstractSb2Command {
+
+ public ListCputranspSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ List<String> cputranspAvailable = new ArrayList<String>();
+
+ Set<String> expected = new HashSet<String>();
+ expected.add("sb2-qemu-arm");
+ expected.add("sbrsh");
+
+ Properties env = ProcessLauncherUtils
+ .getSynthesizedEnvironment(commandAbstractor
+ .getProcessLauncherFactory());
+ String pathenv = env.getProperty("PATH");
+ if (pathenv == null) {
+ pathenv = "/usr/bin:/bin"; // XXX
+ }
+ if (pathenv != null) {
+ String[] paths = pathenv.split(":");
+ for (String exp : expected) {
+ for (String path : paths) {
+ IFileStore bin = commandAbstractor.getFileSystemAccess()
+ .getFileStore(new Path(path).append(exp));
+ if (bin.fetchInfo().exists()) {
+ cputranspAvailable.add(bin.toURI().getPath());
+ break;
+ }
+ }
+ }
+ }
+
+ return cputranspAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * List the maemo rootstraps installed
- */
-public class ListInstalledMaemoRootstrapsSb2Command extends
- MaemoRootstrapSb2Command {
-
- public ListInstalledMaemoRootstrapsSb2Command(
- ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return param.size() == 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String availableAction = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_LIST_ACT);
-
- List<String> installed = doPerformCommand(Collections
- .singletonList(availableAction), null, 0);
-
- return installed;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListInstalledMaemoRootstrapsSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * List the maemo rootstraps installed
+ */
+public class ListInstalledMaemoRootstrapsSb2Command extends
+ MaemoRootstrapSb2Command {
+
+ public ListInstalledMaemoRootstrapsSb2Command(
+ ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String availableAction = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_LIST_ACT);
+
+ List<String> installed = doPerformCommand(Collections
+ .singletonList(availableAction), null, 0);
+
+ return installed;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListTargetsCommand.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListTargetsCommand.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListTargetsCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (UFCG) - initial API and implementation
- * Ed Swartz (Nokia)
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.List;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * List the installed targets. This command wraps the callback to service (sb1)
- * sb-conf list --targets or sb2-config -l (sb2)
- *
- */
-public class ListTargetsCommand extends AbstractSb2Command {
-
- public ListTargetsCommand(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public List<String> performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String listAction;
- String targetsOption;
- listAction = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_LIST_ACT);
- targetsOption = "";
-
- String listTargetsCommandString = this.replaceScratchboxConfigCommand(
- listAction, new String[] { targetsOption });
-
- Process process = createProcess(listTargetsCommandString, null);
-
- List<String> targetsAvailable = getLineInputFromProcessAndWait(process,
- true, 0);
-
- return targetsAvailable;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListTargetsCommand.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ListTargetsCommand.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListTargetsCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ListTargetsCommand.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * List the installed targets. This command wraps the callback to service (sb1)
+ * sb-conf list --targets or sb2-config -l (sb2)
+ *
+ */
+public class ListTargetsCommand extends AbstractSb2Command {
+
+ public ListTargetsCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction;
+ String targetsOption;
+ listAction = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_LIST_ACT);
+ targetsOption = "";
+
+ String listTargetsCommandString = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { targetsOption });
+
+ Process process = createProcess(listTargetsCommandString, null);
+
+ List<String> targetsAvailable = getLineInputFromProcessAndWait(process,
+ true, 0);
+
+ return targetsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/MaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/MaemoRootstrapSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/MaemoRootstrapSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.CommandLineArguments;
-import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * Base class for maemo rootstrap command.
- */
-public abstract class MaemoRootstrapSb2Command extends AbstractSb2Command {
-
- public MaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return true;
- }
-
- /**
- * Override if stderr output is allowed.
- *
- * @return false
- */
- protected boolean allowErrors() {
- return false;
-
- }
-
- /**
- * Perform the command with the given params as command line arguments, with
- * an optional timeout (triggering ScratchboxException if reached)
- *
- * @param params
- * command line parameters to maemo-rootstrap
- * @param envBlock
- * any environment needed or <code>null</code>
- * @param timeout
- * if not 0, timeout in milliseconds
- * @return lines from stdout
- * @throws ScratchboxException
- * if command execution fails or if timeout reached
- */
- @SuppressWarnings("unchecked")
- protected List<String> doPerformCommand(List<String> params,
- IEnvironmentModifierBlock envBlock, long timeout)
- throws ESboxException {
- String rootstrapCommand = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_COMMAND);
-
- String options = CommandLineArguments.toCommandLine(params);
-
- ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
- substitutor.define("OPTIONS", options);
-
- rootstrapCommand = substitutor.substitute(rootstrapCommand);
-
- if (console == null) {
- Process process = createProcess(rootstrapCommand, envBlock);
- List<String> results = getLineInputFromProcessAndWait(process,
- allowErrors(), timeout);
- return results;
- } else {
- runAndWaitForProcess("Running " + rootstrapCommand,
- rootstrapCommand, envBlock, timeout);
- return Collections.EMPTY_LIST;
- }
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/MaemoRootstrapSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/MaemoRootstrapSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/MaemoRootstrapSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/MaemoRootstrapSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Base class for maemo rootstrap command.
+ */
+public abstract class MaemoRootstrapSb2Command extends AbstractSb2Command {
+
+ public MaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return true;
+ }
+
+ /**
+ * Override if stderr output is allowed.
+ *
+ * @return false
+ */
+ protected boolean allowErrors() {
+ return false;
+
+ }
+
+ /**
+ * Perform the command with the given params as command line arguments, with
+ * an optional timeout (triggering ScratchboxException if reached)
+ *
+ * @param params
+ * command line parameters to maemo-rootstrap
+ * @param envBlock
+ * any environment needed or <code>null</code>
+ * @param timeout
+ * if not 0, timeout in milliseconds
+ * @return lines from stdout
+ * @throws ScratchboxException
+ * if command execution fails or if timeout reached
+ */
+ @SuppressWarnings("unchecked")
+ protected List<String> doPerformCommand(List<String> params,
+ IEnvironmentModifierBlock envBlock, long timeout)
+ throws ESboxException {
+ String rootstrapCommand = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_COMMAND);
+
+ String options = CommandLineArguments.toCommandLine(params);
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("OPTIONS", options);
+
+ rootstrapCommand = substitutor.substitute(rootstrapCommand);
+
+ if (console == null) {
+ Process process = createProcess(rootstrapCommand, envBlock);
+ List<String> results = getLineInputFromProcessAndWait(process,
+ allowErrors(), timeout);
+ return results;
+ } else {
+ runAndWaitForProcess("Running " + rootstrapCommand,
+ rootstrapCommand, envBlock, timeout);
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.maemo.esbox.core.CorePlugin;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * Remove a maemo rootstrap. Parameters are target name and force boolean flag.
- */
-public class RemoveMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
-
- private final IProgressMonitor monitor;
-
- public RemoveMaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor,
- IProgressMonitor monitor) {
- super(commandAbstractor);
- this.monitor = monitor;
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return param.size() == 2;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public Boolean performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String targetName = param.get(0);
- String forceFlag = param.get(1);
-
- String action = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_REMOVE_ACT);
-
- List<String> commands = new ArrayList<String>();
-
- if (forceFlag.equals(Boolean.TRUE.toString())) {
- String force = commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT);
- commands.add(force);
- }
- commands.add(action);
- commands.add(targetName);
-
- IEnvironmentModifierBlock envBlock = commandAbstractor
- .getProcessLauncherFactory().defaultEnvironmentModifierBlock();
- ProcessLauncherUtils.defineProxyVariables(envBlock);
-
- setMonitorAndConsole(monitor, CorePlugin.getDefault().getConsole(true,
- null, "Removing rootstrap " + targetName));
-
- doPerformCommand(commands, envBlock, 0);
-
- return Boolean.TRUE;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveMaemoRootstrapSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Remove a maemo rootstrap. Parameters are target name and force boolean flag.
+ */
+public class RemoveMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
+
+ private final IProgressMonitor monitor;
+
+ public RemoveMaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor,
+ IProgressMonitor monitor) {
+ super(commandAbstractor);
+ this.monitor = monitor;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 2;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public Boolean performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String forceFlag = param.get(1);
+
+ String action = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_REMOVE_ACT);
+
+ List<String> commands = new ArrayList<String>();
+
+ if (forceFlag.equals(Boolean.TRUE.toString())) {
+ String force = commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT);
+ commands.add(force);
+ }
+ commands.add(action);
+ commands.add(targetName);
+
+ IEnvironmentModifierBlock envBlock = commandAbstractor
+ .getProcessLauncherFactory().defaultEnvironmentModifierBlock();
+ ProcessLauncherUtils.defineProxyVariables(envBlock);
+
+ setMonitorAndConsole(monitor, CorePlugin.getDefault().getConsole(true,
+ null, "Removing rootstrap " + targetName));
+
+ doPerformCommand(commands, envBlock, 0);
+
+ return Boolean.TRUE;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveTargetSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/RemoveTargetSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveTargetSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.Scratchbox2SDK;
-
-/**
- * Remove a Scratchbox 2 target. There's no known command for this, but we can
- * manually fix up the system.
- *
- */
-public class RemoveTargetSb2Command extends AbstractSb2Command {
-
- private Scratchbox2SDK sdk;
-
- public RemoveTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- this.sdk = (Scratchbox2SDK) sdk;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
- * .lang.Object)
- */
- public Object performCommand(List<String> param)
- throws ScratchboxException, ESboxException {
- if (!this.checkParameters(param))
- throw new ScratchboxInvalidParameterException(
- "Invalid number of parameters");
-
- String targetToRemove = param.get(0);
- if (!targetExist(targetToRemove))
- throw new ScratchboxInvalidParameterException("Target "
- + targetToRemove + " does not exist.");
-
- IFileStore sb2Dir = commandAbstractor.getFileSystemAccess()
- .getFileStore(sdk.getScratchbox2ConfigDirectory());
- IFileStore targetDir = sb2Dir.getChild(targetToRemove);
-
- if (!targetDir.fetchInfo().exists()) {
- throw new ScratchboxInvalidParameterException("Target "
- + targetToRemove
- + " does not exist at the expected location: " + targetDir);
- }
-
- try {
- targetDir.delete(EFS.NONE, null);
- } catch (CoreException e) {
- throw new ScratchboxException("Failed to delete rootstrap", e);
- } finally {
- sdk.refresh();
- }
-
- return true;
- }
-
- /**
- * Verify if a target exists.
- *
- * @param targetToRemove
- * the target to verify.
- *
- * @return true, if the target exists in Scratchbox; false, otherwise.
- * @throws ScratchboxException
- * if some problem occurrs while requesting Scratchbox services.
- */
- private boolean targetExist(String targetToRemove) throws ESboxException {
- List<String> targetsAvailable = new ListTargetsCommand(
- commandAbstractor).performCommand(new ArrayList<String>());
- return targetsAvailable.contains(targetToRemove);
- }
-
- @Override
- public int getParametersSize() {
- return 1;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveTargetSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/RemoveTargetSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveTargetSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/RemoveTargetSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.sb2.core.Scratchbox2SDK;
+import org.maemo.esbox.maemosdk.core.command.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Remove a Scratchbox 2 target. There's no known command for this, but we can
+ * manually fix up the system.
+ *
+ */
+public class RemoveTargetSb2Command extends AbstractSb2Command {
+
+ private Scratchbox2SDK sdk;
+
+ public RemoveTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ this.sdk = (Scratchbox2SDK) sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java
+ * .lang.Object)
+ */
+ public Object performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetToRemove = param.get(0);
+ if (!targetExist(targetToRemove))
+ throw new ScratchboxInvalidParameterException("Target "
+ + targetToRemove + " does not exist.");
+
+ IFileStore sb2Dir = commandAbstractor.getFileSystemAccess()
+ .getFileStore(sdk.getScratchbox2ConfigDirectory());
+ IFileStore targetDir = sb2Dir.getChild(targetToRemove);
+
+ if (!targetDir.fetchInfo().exists()) {
+ throw new ScratchboxInvalidParameterException("Target "
+ + targetToRemove
+ + " does not exist at the expected location: " + targetDir);
+ }
+
+ try {
+ targetDir.delete(EFS.NONE, null);
+ } catch (CoreException e) {
+ throw new ScratchboxException("Failed to delete rootstrap", e);
+ } finally {
+ sdk.refresh();
+ }
+
+ return true;
+ }
+
+ /**
+ * Verify if a target exists.
+ *
+ * @param targetToRemove
+ * the target to verify.
+ *
+ * @return true, if the target exists in Scratchbox; false, otherwise.
+ * @throws ScratchboxException
+ * if some problem occurrs while requesting Scratchbox services.
+ */
+ private boolean targetExist(String targetToRemove) throws ESboxException {
+ List<String> targetsAvailable = new ListTargetsCommand(
+ commandAbstractor).performCommand(new ArrayList<String>());
+ return targetsAvailable.contains(targetToRemove);
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ShowPathMappingSb2Command.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ShowPathMappingSb2Command.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ShowPathMappingSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.command;
-
-import java.io.ByteArrayOutputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.process.CommandLineArguments;
-import org.maemo.esbox.core.process.IProcessLauncher;
-import org.maemo.esbox.core.process.ProcessLauncherCreator;
-import org.maemo.esbox.internal.api.commands.ICommandAbstractor;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * Invoke 'sb2-show path' on a list of paths and return the mappings, or
- * <code>null</code> for unmapped entries
- *
- * @author eswartz
- *
- */
-public class ShowPathMappingSb2Command extends AbstractSb2Command {
- public ShowPathMappingSb2Command(ICommandAbstractor commandAbstractor) {
- super(commandAbstractor);
- }
-
- @Override
- protected boolean checkParameters(List<String> param) {
- return true;
- }
-
- public Map<IPath, IPath> performCommand(List<String> params)
- throws ScratchboxException, ESboxException {
- List<String> cmdLine = CommandLineArguments
- .createFromVarArgs(
- commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_COMMAND),
- commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_ACTION));
- cmdLine.addAll(params);
-
- IProcessLauncher launcher = ProcessLauncherCreator
- .createProcessLauncher(commandAbstractor
- .getProcessLauncherFactory(), null, cmdLine);
-
- launcher.createProcess();
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ByteArrayOutputStream err = new ByteArrayOutputStream();
- launcher.waitAndRead(out, err);
-
- if (err.size() != 0)
- throw new ScratchboxException(
- "Cannot resolve scratchbox2 path mappings:\n" + err);
-
- String resolveInfo = out.toString().trim();
- String[] lines = resolveInfo.split("\r\n|\r|\n");
-
- Map<IPath, IPath> result = new HashMap<IPath, IPath>(lines.length);
-
- Pattern sb2ShowPattern = Pattern
- .compile(commandAbstractor
- .getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_OUTPUT_PATTERN));
-
- for (String line : lines) {
- Matcher matcher = sb2ShowPattern.matcher(line);
- if (matcher.matches()) {
- String toPath = matcher.group(2);
- // workaround buggy output
- if (toPath.startsWith("//"))
- toPath = toPath.substring(1);
- result.put(new Path(matcher.group(1)), new Path(toPath));
- }
- }
-
- return result;
- }
-
- @Override
- public int getParametersSize() {
- return 0;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ShowPathMappingSb2Command.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/command/ShowPathMappingSb2Command.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ShowPathMappingSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/command/ShowPathMappingSb2Command.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.command;
+
+import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * Invoke 'sb2-show path' on a list of paths and return the mappings, or
+ * <code>null</code> for unmapped entries
+ *
+ * @author eswartz
+ *
+ */
+public class ShowPathMappingSb2Command extends AbstractSb2Command {
+ public ShowPathMappingSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return true;
+ }
+
+ public Map<IPath, IPath> performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ List<String> cmdLine = CommandLineArguments
+ .createFromVarArgs(
+ commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_COMMAND),
+ commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_ACTION));
+ cmdLine.addAll(params);
+
+ IProcessLauncher launcher = ProcessLauncherCreator
+ .createProcessLauncher(commandAbstractor
+ .getProcessLauncherFactory(), null, cmdLine);
+
+ launcher.createProcess();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ launcher.waitAndRead(out, err);
+
+ if (err.size() != 0)
+ throw new ScratchboxException(
+ "Cannot resolve scratchbox2 path mappings:\n" + err);
+
+ String resolveInfo = out.toString().trim();
+ String[] lines = resolveInfo.split("\r\n|\r|\n");
+
+ Map<IPath, IPath> result = new HashMap<IPath, IPath>(lines.length);
+
+ Pattern sb2ShowPattern = Pattern
+ .compile(commandAbstractor
+ .getPreferenceValue(SB2PreferenceConstants.SB2_SB2_SHOW_PATH_OUTPUT_PATTERN));
+
+ for (String line : lines) {
+ Matcher matcher = sb2ShowPattern.matcher(line);
+ if (matcher.matches()) {
+ String toPath = matcher.group(2);
+ // workaround buggy output
+ if (toPath.startsWith("//"))
+ toPath = toPath.substring(1);
+ result.put(new Path(matcher.group(1)), new Path(toPath));
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2FileSystemMapping.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/core/Scratchbox2FileSystemMapping.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2FileSystemMapping.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2FileSystemMapping.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,86 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.internal.maemosdk.sb2.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.machine.FileSystemMapping;
+import org.maemo.esbox.internal.api.core.machine.IFileSystemMappingImpl;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+/**
+ * Represent the mappings from the machine to a Scratchbox 2 target running on
+ * the machine. This represents the direct mappings with all softlinks resolved.
+ *
+ * @author eswartz
+ *
+ */
+public class Scratchbox2FileSystemMapping extends FileSystemMapping implements
+ IFileSystemMappingImpl {
+ /**
+ * Construct with default path canonicalizers and add mappings for paths
+ * known to be mapped.
+ *
+ * @param targetRoot
+ * @param target
+ */
+ public Scratchbox2FileSystemMapping(IScratchboxSDKTarget sdkTarget,
+ IPath scratchboxBase, String target, String user) {
+
+ super(FileSystemMapping.getMachineCanonicalizer(true),
+ FileSystemMapping.getMachineCanonicalizer(true));
+
+ List<Pair<IPath, IPath>> mappings = getHostToTargetRootMappings();
+ mappings.clear();
+
+ // directories we're interested in
+ String[] topLevelDirs = { "/dev", "/home", "/proc", "/sys", "/targets",
+ "/bin", "/boot", "/cdrom", "/etc", "/floppy", "/initrd",
+ "/lib", "/media", "/mnt", "/opt", "/root", "/sbin", "/srv",
+ "/usr",
+ "/var",
+
+ // things get messier, so be more specific
+ "/var/cache/apt", "/usr/include", "/usr/lib",
+ "/usr/local/include", "/usr/local/lib", "/usr/X11R6",
+ "/usr/local", "/home/user", };
+
+ List<IPath> topLevelPaths = new ArrayList<IPath>();
+ topLevelPaths.add(new Path("/"));
+ for (String topLevelDir : topLevelDirs) {
+ topLevelPaths.add(new Path(topLevelDir));
+ }
+
+ Map<IPath, IPath> pathMapping = null;
+ try {
+ pathMapping = Scratchbox2SDK.getSb2PathMapping(sdkTarget,
+ topLevelPaths);
+ // pathMapping = ScratchboxFacade.getInstance().getSb2PathMapping(
+ // sdkTarget, topLevelPaths);
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError(
+ "Unable to map Scratchbox 2 paths", e);
+ return;
+ }
+
+ for (Map.Entry<IPath, IPath> entry : pathMapping.entrySet()) {
+ map(mappings, entry.getValue(), entry.getKey());
+ }
+
+ setHostToTargetRootMappings(mappings);
+ }
+
+ private void map(List<Pair<IPath, IPath>> mappings, IPath from, IPath to) {
+ mappings.add(new Pair<IPath, IPath>(from, to));
+ }
+
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2FileSystemMapping.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDK.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/core/Scratchbox2SDK.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDK.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,529 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Petr Baranov (Nokia) - initial API. Implementation from ScratchboxFacade
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.core;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.CorePreferenceConstants;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDKPlatform;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.core.commands.ICommandAbstractor;
+import org.maemo.esbox.internal.api.core.sdk.*;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+import org.maemo.esbox.internal.maemosdk.sb2.command.*;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.maemosdk.sb2.sdk.IScratchbox2SDK;
+
+/**
+ * @author baranov
+ *
+ */
+public class Scratchbox2SDK extends AbstractScratchboxSDK implements
+ IScratchbox2SDK {
+
+ private static final IPath ROOT_PATH = new Path("/");
+ private static Pattern TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN = Pattern
+ .compile("([a-zA-Z_]+)(\\d+)_([a-zA-Z]+)");
+
+ private static final String SB2_MACHINE = "sb2_machine";
+ private static final String SB2_VERSION = "sb2_version";
+
+ public Scratchbox2SDK(IMachine machine, String version,
+ IPreferenceProvider prefProvider) {
+ super(machine, version, "Scratchbox 2", SB2_MACHINE, SB2_VERSION,
+ "sb2_targets", 2);
+ this.prefProvider = prefProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK#refresh()
+ */
+ public void refresh() {
+ super.refresh();
+ List<String> targetNames;
+ try {
+ targetNames = getTargets();
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError("Could not refresh targets", e);
+ return;
+ }
+ List<ISDKTarget> newTargets = new ArrayList<ISDKTarget>();
+ for (String target : targetNames) {
+ // ignore this one, left behind by errant rootstrap installations
+ if (target.equals("libtool_build"))
+ continue;
+ IPath config = getScratchbox2ConfigDirectory();
+ IPath sb2BasePath = config.append(target);
+ Scratchbox2SDKTarget sdkTarget = new Scratchbox2SDKTarget(this,
+ getPlatform(target), getArchitecture(target), target,
+ sb2BasePath);
+ newTargets.add(sdkTarget);
+
+ try {
+ IPath sb2RootstrapPath = getMaemoRootstrapPath(sdkTarget);
+ sdkTarget.setRootstrapPath(sb2RootstrapPath);
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError(null, e);
+ }
+
+ }
+ this.targets = newTargets;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK#getTargets()
+ */
+ public List<String> getTargets() throws ESboxException {
+ MachineUtils.ensureCurrentMachine(SB_MACHINE, this.getMachine());
+
+ String[] targetsArray = (String[]) CacheUtils.getInstance()
+ .getCachedValue(SB_TARGETS);
+ if (targetsArray != null)
+ return Arrays.asList(targetsArray);
+
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
+ getCommandAbstractor());
+ List<String> targets = listTargetsCommand
+ .performCommand(new ArrayList<String>());
+
+ CacheUtils.getInstance().setCachedValue(SB_TARGETS,
+ (String[]) targets.toArray(new String[targets.size()]));
+
+ return targets;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.maemosdk.core.sdk.AbstractScratchboxSDK#getCommandAbstractor
+ * ()
+ */
+ public ICommandAbstractor getCommandAbstractor() throws ESboxException {
+ return getSb2WrappedAbstractor(super.getCommandAbstractor(), this
+ .getMachine());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK#
+ * getScratchbox2ConfigDirectory()
+ */
+ public IPath getScratchbox2ConfigDirectory() {
+ String userName = prefProvider
+ .getPreferenceValue(CorePreferenceConstants.USER);
+ if (userName.length() == 0)
+ userName = "ubuntu";
+ return new Path("home").append(userName).append(".scratchbox2")
+ .makeAbsolute();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK#createTarget(java.lang
+ * .String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public boolean createTarget(String targetName, String compiler,
+ String devkits, String cputransp) throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+ params.add(compiler);
+ params.add(cputransp);
+
+ CreateTargetSb2Command createTargetCommand = new CreateTargetSb2Command(
+ this, getCommandAbstractor());
+
+ CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
+
+ return (Boolean) createTargetCommand.performCommand(params);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK#getCompilers()
+ */
+ public List<String> getCompilers() throws ESboxException {
+ ListCompilersSb2Command listCompilersCommand = new ListCompilersSb2Command(
+ getCommandAbstractor());
+ return listCompilersCommand.performCommand(EMPTY_ARGS);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK#getCputransp()
+ */
+ public List<String> getCputransp() throws ESboxException {
+ ListCputranspSb2Command listCputranspCommand = new ListCputranspSb2Command(
+ getCommandAbstractor());
+ return listCputranspCommand.performCommand(EMPTY_ARGS);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK#getCurrentTarget()
+ */
+ public String getCurrentTarget() throws ESboxException {
+ GetCurrentTargetSb2Command getCurrentTargetCommand = new GetCurrentTargetSb2Command(
+ getCommandAbstractor());
+ return (String) getCurrentTargetCommand
+ .performCommand(new ArrayList<String>());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK#removeTarget(java.lang
+ * .String)
+ */
+ public boolean removeTarget(String targetName) throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+
+ RemoveTargetSb2Command removeTargetCommand;
+ removeTargetCommand = new RemoveTargetSb2Command(this,
+ getCommandAbstractor());
+ CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
+ CacheUtils.getInstance().setCachedValue(
+ SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
+ CacheUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP,
+ null);
+ return (Boolean) removeTargetCommand.performCommand(params);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.sdk.ISDK#getSDKRoot()
+ */
+ public IPath getSDKRoot() {
+ return ROOT_PATH;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.maemo.esbox.internal.maemosdk.core.sdk.
+ * IScratchboxSDKPlatformArchitectureProvider
+ * #getArchitecture(java.lang.String)
+ */
+ public String getArchitecture(String target) {
+ // convention says this is the part of the target after the underscore
+ Matcher matcher = TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN
+ .matcher(target);
+ if (matcher.matches()) {
+ return matcher.group(3).toUpperCase();
+ } else {
+ return IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN;
+ }
+ }
+
+ public ISDKPlatform getPlatform(String target) {
+ // convention says this is the part of the target before the underscore,
+ // minus a version.
+ Matcher matcher = TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN
+ .matcher(target);
+ if (matcher.matches()) {
+ String name = matcher.group(1);
+ String platformName = name.substring(0, 1).toUpperCase()
+ + name.substring(1).toLowerCase();
+ String versionInfo = matcher.group(2);
+ String version = ISDKPlatform.VERSION_UNKNOWN;
+ if (versionInfo.length() == 2)
+ version = versionInfo.substring(0, 1) + "."
+ + versionInfo.substring(1, 2);
+ return new BaseSDKPlatform(platformName, version);
+ } else {
+ return new BaseSDKPlatform(ISDKPlatform.NAME_UNKNOWN,
+ ISDKPlatform.VERSION_UNKNOWN);
+ }
+ }
+
+ /**
+ * Get the names of rootstraps already installed. This may inclue those that
+ * do not have targets associated.
+ *
+ * @param sdk
+ * the SDK to check
+ * @return List, never null
+ * @throws ESboxException
+ */
+ public synchronized List<String> getInstalledMaemoRootstraps()
+ throws ESboxException {
+ ListInstalledMaemoRootstrapsSb2Command command = new ListInstalledMaemoRootstrapsSb2Command(
+ MachineUtils.getHostCommandAbstractor(this.getMachine()));
+ return command.performCommand(EMPTY_ARGS);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK#getAvailableMaemoRootstraps
+ * (org.maemo.esbox.core.machine.IMachine)
+ */
+ public List<MaemoRootstrap> getAvailableMaemoRootstraps(IMachine machine)
+ throws ESboxException {
+ ListAvailableMaemoRootstrapsSb2Command command = new ListAvailableMaemoRootstrapsSb2Command(
+ MachineUtils.getHostCommandAbstractor(machine));
+ return command.performCommand(EMPTY_ARGS);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK#createRootstrapTarget
+ * (java.lang.String, boolean, boolean,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public boolean createRootstrapTarget(String targetName,
+ boolean useHostTools, boolean force, IProgressMonitor monitor)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+ params.add(Boolean.toString(useHostTools));
+ params.add(Boolean.toString(force));
+
+ CreateMaemoRootstrapSb2Command createTargetCommand = new CreateMaemoRootstrapSb2Command(
+ this, getCommandAbstractor(), monitor);
+
+ CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
+
+ return createTargetCommand.performCommand(params);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK#removeRootstrap(java
+ * .lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public boolean removeRootstrap(String targetName, boolean force,
+ IProgressMonitor monitor) throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+ params.add(Boolean.toString(force));
+
+ RemoveMaemoRootstrapSb2Command removeTargetCommand = new RemoveMaemoRootstrapSb2Command(
+ getCommandAbstractor(), monitor);
+
+ CacheUtils.getInstance().setCachedValue(SB_TARGETS, null);
+ CacheUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP,
+ null);
+ CacheUtils.getInstance().setCachedValue(
+ SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
+
+ return removeTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Invoke sb2-show path on the given path(s) to return the mappings.
+ *
+ * @param hostPaths
+ * array of paths to map
+ * @return map of resolved host paths to target paths
+ * @throws ESboxException
+ */
+ public static synchronized Map<IPath, IPath> getSb2PathMapping(
+ IScratchboxSDKTarget sdkTarget, List<IPath> hostPaths)
+ throws ESboxException {
+ // find cached value
+ MachineUtils.ensureCurrentMachine(SB2_MACHINE, sdkTarget.getSDK()
+ .getMachine());
+ Map<String, Map<String, String>> targetToPathMappingsMap = null;
+ Map<String, String> storedPathMappings = null;
+ targetToPathMappingsMap = (Map<String, Map<String, String>>) CacheUtils
+ .getInstance().getCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP);
+ if (targetToPathMappingsMap != null) {
+ storedPathMappings = targetToPathMappingsMap.get(sdkTarget
+ .getName());
+ }
+
+ Map<IPath, IPath> returnedPathMappings = new HashMap<IPath, IPath>();
+
+ // locate entries known to the cache
+ List<IPath> needToLookupHostPaths;
+ if (storedPathMappings != null) {
+ needToLookupHostPaths = new ArrayList<IPath>();
+ for (IPath hostPath : hostPaths) {
+ String targetPath = storedPathMappings.get(hostPath
+ .toPortableString());
+ if (targetPath != null) {
+ returnedPathMappings.put(hostPath, new Path(targetPath));
+ } else {
+ needToLookupHostPaths.add(hostPath);
+ }
+ }
+ } else {
+ needToLookupHostPaths = hostPaths;
+ }
+
+ if (needToLookupHostPaths.size() == 0) {
+ return returnedPathMappings;
+ }
+
+ // do the hard work for the paths not covered by the cache
+ ShowPathMappingSb2Command command = new ShowPathMappingSb2Command(
+ ((Scratchbox2SDKTarget)sdkTarget).getCommandAbstractor());
+ List<String> paths = new ArrayList<String>(needToLookupHostPaths.size());
+ for (IPath path : needToLookupHostPaths) {
+ paths.add(path.toPortableString());
+ }
+
+ Map<IPath, IPath> newPathMappings = (Map<IPath, IPath>) command
+ .performCommand(paths);
+ returnedPathMappings.putAll(newPathMappings);
+
+ // update cache
+ if (storedPathMappings == null) {
+ storedPathMappings = new HashMap<String, String>();
+ }
+ for (Map.Entry<IPath, IPath> entry : newPathMappings.entrySet()) {
+ storedPathMappings.put(entry.getKey().toPortableString(), entry
+ .getValue().toPortableString());
+ }
+ if (targetToPathMappingsMap == null) {
+ targetToPathMappingsMap = new HashMap<String, Map<String, String>>();
+ }
+ targetToPathMappingsMap.put(sdkTarget.getName(), storedPathMappings);
+
+ CacheUtils.getInstance().setCachedValue(
+ SB2_TARGET_TO_PATH_MAPPINGS_MAP, targetToPathMappingsMap);
+
+ return returnedPathMappings;
+ }
+
+ /**
+ * Return the current version of Scratchbox 2
+ *
+ * @return the current version of Scratchbox 2.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs,
+ * including no scratchbox 2 detected
+ */
+ public static synchronized String getCurrentSboxVersion(IMachine machine)
+ throws ESboxException {
+ // find cached value
+ MachineUtils.ensureCurrentMachine(SB2_MACHINE, machine);
+ String version = (String) CacheUtils.getInstance().getCachedValue(
+ SB2_VERSION);
+ if (version != null)
+ return version;
+
+ // do the hard work
+ MachineUtils.acquireMachine(machine);
+ ICommandAbstractor commandAbstractor = MachineUtils
+ .getHostCommandAbstractor(machine);
+ commandAbstractor = getSb2WrappedAbstractor(commandAbstractor, machine);
+ GetVersionScratchboxCommand getVersionCommand = new GetVersionScratchboxCommand(
+ commandAbstractor);
+
+ String currentVersion = getVersionCommand
+ .performCommand(new ArrayList<String>());
+ // remember cached value
+ CacheUtils.getInstance().setCachedValue(SB2_VERSION, currentVersion);
+
+ return currentVersion;
+ }
+
+ /**
+ * Get the path where a maemo rootstrap is installed
+ *
+ * @param scratchbox2SDKTarget
+ * @return path of rootstrap
+ * @throws ESboxException
+ * if not located
+ */
+ private synchronized IPath getMaemoRootstrapPath(
+ Scratchbox2SDKTarget sdkTarget) throws ESboxException {
+ // find cached value
+ MachineUtils.ensureCurrentMachine(SB_MACHINE, sdkTarget.getSDK()
+ .getMachine());
+ Map<String, String> targetToRootstrapMap = null;
+ targetToRootstrapMap = (Map<String, String>) CacheUtils.getInstance()
+ .getCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP);
+ if (targetToRootstrapMap != null) {
+ String rootstrap = targetToRootstrapMap.get(sdkTarget.getName());
+ if (rootstrap != null) {
+ return new Path(rootstrap);
+ }
+ }
+
+ // do the hard work
+ GetMaemoRootstrapLocationCommand command = new GetMaemoRootstrapLocationCommand(
+ getCommandAbstractor(), sdkTarget);
+ IPath rootstrapPath;
+
+ // be sure to record something in the cache for broken targets so
+ // we don't keep asking all the time
+ ESboxException caughtException = null;
+ try {
+ rootstrapPath = (IPath) command.performCommand(EMPTY_ARGS);
+ } catch (ESboxException e) {
+ rootstrapPath = Path.EMPTY;
+ caughtException = e;
+ }
+
+ // store cached value
+ if (targetToRootstrapMap == null)
+ targetToRootstrapMap = new HashMap<String, String>();
+ targetToRootstrapMap.put(sdkTarget.getName(), rootstrapPath
+ .toPortableString());
+ CacheUtils.getInstance().setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP,
+ targetToRootstrapMap);
+
+ if (caughtException != null)
+ throw caughtException;
+
+ return rootstrapPath;
+ }
+
+ /**
+ * Get a command abstractor that updates the PATH if sb2 tools are not on
+ * the path.
+ *
+ * @param commandAbstractor
+ * @param machine
+ * @return
+ */
+ private static ICommandAbstractor getSb2WrappedAbstractor(
+ ICommandAbstractor commandAbstractor, IMachine machine) {
+ // XXX: the default path should be provided some other way
+ return wrapCommandAbstractorForSDK(commandAbstractor, machine, "sb2",
+ "/usr/bin");
+ }
+
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDK.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDKTarget.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/core/Scratchbox2SDKTarget.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDKTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDKTarget.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Petr Baranov (Nokia) - initial API. Implementation from ScratchboxFacade
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.CorePreferenceConstants;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDKPlatform;
+import org.maemo.esbox.internal.api.core.sdk.AbstractScratchboxSDKTarget;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.sb2.command.GetGdbQemuCommandPatternCommand;
+import org.maemo.esbox.internal.maemosdk.sb2.launcher.Scratchbox2ProcessLauncherFactory;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * @author baranov
+ *
+ */
+public class Scratchbox2SDKTarget extends AbstractScratchboxSDKTarget {
+ private IPath targetRoot;
+ private IPath rootstrapRoot;
+
+ public Scratchbox2SDKTarget(Scratchbox2SDK sdk, ISDKPlatform platform,
+ String architecture, String target, IPath targetRoot) {
+ super(sdk, platform, architecture, target);
+ if (targetRoot == null)
+ throw new IllegalArgumentException();
+ this.targetRoot = targetRoot;
+ init(new Scratchbox2FileSystemMapping(this, targetRoot, target, sdk
+ .getPreferenceValue(CorePreferenceConstants.USER))
+ // ,new AptPackageManager(this)
+ );
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget#
+ * getProcessLauncherFactoryForInstall()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactoryForInstall() {
+ // install mode needs to be a different mapping and also run as root
+ return new Scratchbox2ProcessLauncherFactory(this,
+ SB2PreferenceConstants.SB2_INSTALL_MAPPING_MODE, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget#getRootstrapPath()
+ */
+ public IPath getRootstrapPath() {
+ return rootstrapRoot;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ // default is build mode
+ return new Scratchbox2ProcessLauncherFactory(this,
+ SB2PreferenceConstants.SB2_MAPPING_MODE, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getSDKTargetRoot()
+ */
+ public IPath getSDKTargetRoot() {
+ return targetRoot;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.internal.api.core.sdk.BaseSDKTarget#getArchitecture()
+ */
+ public String getArchitecture() {
+ // sb2 doesn't YET ship an x86 emulator
+ return IScratchboxSDKTarget.ARCHITECTURE_ARMEL;
+ }
+
+ /**
+ * Get the command template for launching qemu under gdb with this target
+ *
+ * @param sdkTarget
+ * @param architecture
+ * one of {@link IScratchboxSDKTarget#ARCHITECTURE_ARMEL} or
+ * {@link IScratchboxSDKTarget#ARCHITECTURE_X86}; usually from
+ * sdkTarget.getArchitecture()
+ * @return String or null if no cputransp used or not using qemu
+ */
+ public synchronized String getGdbQemuCommandPattern(String architecture)
+ throws ESboxException {
+ // ScratchboxSDK2 sdk = (ScratchboxSDK2)this.getSDK();
+ GetGdbQemuCommandPatternCommand command = new GetGdbQemuCommandPatternCommand(
+ this, this.getCommandAbstractor());
+ List<String> arguments = new ArrayList<String>(1);
+ arguments.add(architecture);
+ return command.performCommand(arguments);
+ }
+
+ /** Not API! The targets should be refreshed from ISDK#refresh() */
+ void setRootstrapPath(IPath rootstrapPath) {
+ this.rootstrapRoot = rootstrapPath;
+ }
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/core/Scratchbox2SDKTarget.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/launcher)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.launcher;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.process.CommandLineArguments;
-import org.maemo.esbox.core.process.EnvironmentProperties;
-import org.maemo.esbox.core.process.ProcessLauncherUtils;
-import org.maemo.esbox.core.process.ProcessLauncherUtils.Results;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.api.core.IStandardEnvironmentProvider;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-import org.maemo.esbox.maemosdk.sb2.internal.Activator;
-
-/**
- * @author eswartz
- *
- */
-public class Scratchbox2EnvironmentProvider implements
- IStandardEnvironmentProvider {
- public static Map<ISDKTarget, Properties> cachedStdEnvMap = new HashMap<ISDKTarget, Properties>();
- private final ISDKTarget sdkTarget;
-
- /**
- * @param sdkTarget
- */
- public Scratchbox2EnvironmentProvider(ISDKTarget sdkTarget) {
- this.sdkTarget = sdkTarget;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.maemo.esbox.internal.api.core.IStandardEnvironmentProvider#
- * flushRawEnvironment()
- */
- public void flushRawEnvironment() {
- cachedStdEnvMap.remove(sdkTarget);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.maemo.esbox.internal.api.core.IStandardEnvironmentProvider#
- * getRawEnvironment()
- */
- public Properties getRawEnvironment() {
- Properties standardEnv = cachedStdEnvMap.get(sdkTarget);
- if (standardEnv == null) {
- // gather arguments by querying a typical shell launched in POSIX
- // mode (sh instead of bash)
- Scratchbox2ProcessLauncher launcher = new Scratchbox2ProcessLauncher(
- sdkTarget, null, CommandLineArguments.createFromVarArgs(
- "sh", "-c", "set"), null,
- SB2PreferenceConstants.SB2_MAPPING_MODE, false);
-
- try {
- Results results = ProcessLauncherUtils
- .launchAndReadStandardStreams(launcher, null);
- standardEnv = EnvironmentProperties
- .createFromShellEnvDump(results.stdout);
- } catch (ESboxException e) {
- Activator
- .getErrorLogger()
- .logError(
- "Failed to read scratchbox environment; using system environment",
- e);
- standardEnv = sdkTarget.getSDK().getMachine()
- .getStandardEnvironment();
- }
-
- cachedStdEnvMap.put(sdkTarget, standardEnv);
- }
- return standardEnv;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2EnvironmentProvider.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.launcher;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.EnvironmentProperties;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.core.process.ProcessLauncherUtils.Results;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.core.IStandardEnvironmentProvider;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Scratchbox2EnvironmentProvider implements
+ IStandardEnvironmentProvider {
+ public static Map<ISDKTarget, Properties> cachedStdEnvMap = new HashMap<ISDKTarget, Properties>();
+ private final ISDKTarget sdkTarget;
+
+ /**
+ * @param sdkTarget
+ */
+ public Scratchbox2EnvironmentProvider(ISDKTarget sdkTarget) {
+ this.sdkTarget = sdkTarget;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.maemo.esbox.internal.api.core.IStandardEnvironmentProvider#
+ * flushRawEnvironment()
+ */
+ public void flushRawEnvironment() {
+ cachedStdEnvMap.remove(sdkTarget);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.maemo.esbox.internal.api.core.IStandardEnvironmentProvider#
+ * getRawEnvironment()
+ */
+ public Properties getRawEnvironment() {
+ Properties standardEnv = cachedStdEnvMap.get(sdkTarget);
+ if (standardEnv == null) {
+ // gather arguments by querying a typical shell launched in POSIX
+ // mode (sh instead of bash)
+ Scratchbox2ProcessLauncher launcher = new Scratchbox2ProcessLauncher(
+ sdkTarget, null, CommandLineArguments.createFromVarArgs(
+ "sh", "-c", "set"), null,
+ SB2PreferenceConstants.SB2_MAPPING_MODE, false);
+
+ try {
+ Results results = ProcessLauncherUtils
+ .launchAndReadStandardStreams(launcher, null);
+ standardEnv = EnvironmentProperties
+ .createFromShellEnvDump(results.stdout);
+ } catch (ESboxException e) {
+ Activator
+ .getErrorLogger()
+ .logError(
+ "Failed to read scratchbox environment; using system environment",
+ e);
+ standardEnv = sdkTarget.getSDK().getMachine()
+ .getStandardEnvironment();
+ }
+
+ cachedStdEnvMap.put(sdkTarget, standardEnv);
+ }
+ return standardEnv;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.launcher;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.BaseProcessLauncher;
-import org.maemo.esbox.core.process.CommandLineArguments;
-import org.maemo.esbox.core.process.IProcessLauncher;
-import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * For SB 2, launching is easy and follows the same pattern as a normal program
- * invocation.
- *
- * @author eswartz
- *
- */
-public class Scratchbox2ProcessLauncher extends BaseProcessLauncher implements
- IProcessLauncher {
-
- private ISDKTarget sdkTarget;
-
- public Scratchbox2ProcessLauncher(ISDKTarget sdkTarget,
- IPath workingDirectory, List<String> cmdLine,
- IEnvironmentModifierBlock environmentModifierBlock, String modeKey,
- boolean runAsRoot) {
- super(encodeArgumentArray(sdkTarget, cmdLine, modeKey),
- environmentModifierBlock, workingDirectory);
- if (runAsRoot) {
- getLaunchCommandArguments().add(0, "sudo");
- }
- if (sdkTarget == null)
- throw new IllegalArgumentException();
- this.sdkTarget = sdkTarget;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoPrefix()
- */
- @Override
- protected String getLaunchInfoPrefix() {
- return sdkTarget + " ";
- }
-
- private static List<String> encodeArgumentArray(ISDKTarget sdkTarget,
- List<String> cmdLine, String modeKey) {
-
- // Encode the launch command by replacing the arguments
- // representing template arguments with the actual values.
- //
- ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
-
- substitutor.define("TARGET", sdkTarget.getName());
- substitutor.define("COMMAND", cmdLine.get(0));
- substitutor.define("ARGS", CommandLineArguments.toCommandLine(cmdLine
- .subList(1, cmdLine.size())));
-
- String level = sdkTarget
- .getPreferenceValue(SB2PreferenceConstants.SB2_LOG_LEVEL);
- if (level.length() > 0) {
- substitutor.define("LOG_OPTION", "-L " + level);
- } else {
- substitutor.define("LOG_OPTION", "");
- }
-
- String mapMode = sdkTarget.getPreferenceValue(modeKey);
- substitutor.define("MAPPING_MODE", mapMode);
-
- // get the Scratchbox invocation pattern
- String commandPattern = sdkTarget
- .getPreferenceValue(SB2PreferenceConstants.SB2_EXEC_COMMAND);
-
- // replace variables
- commandPattern = substitutor.substitute(commandPattern);
-
- List<String> commandArgs = CommandLineArguments
- .createFromCommandLine(commandPattern);
- return commandArgs;
- }
-
- @Override
- protected void setupForLaunch() throws ScratchboxException {
- // nothing
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.maemo.esbox.internal.core.BaseProcessLauncher#doCreateProcess()
- */
- @Override
- protected Process doCreateProcess() throws Exception {
- return sdkTarget.getSDK().getMachine().createProcess(
- getLaunchCurrentWorkingDirectory(),
- getLaunchCommandArguments(),
- getLaunchEnvironmentModifierBlock(), isUsePTY());
- }
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncher.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.launcher;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.BaseProcessLauncher;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * For SB 2, launching is easy and follows the same pattern as a normal program
+ * invocation.
+ *
+ * @author eswartz
+ *
+ */
+public class Scratchbox2ProcessLauncher extends BaseProcessLauncher implements
+ IProcessLauncher {
+
+ private ISDKTarget sdkTarget;
+
+ public Scratchbox2ProcessLauncher(ISDKTarget sdkTarget,
+ IPath workingDirectory, List<String> cmdLine,
+ IEnvironmentModifierBlock environmentModifierBlock, String modeKey,
+ boolean runAsRoot) {
+ super(encodeArgumentArray(sdkTarget, cmdLine, modeKey),
+ environmentModifierBlock, workingDirectory);
+ if (runAsRoot) {
+ getLaunchCommandArguments().add(0, "sudo");
+ }
+ if (sdkTarget == null)
+ throw new IllegalArgumentException();
+ this.sdkTarget = sdkTarget;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoPrefix()
+ */
+ @Override
+ protected String getLaunchInfoPrefix() {
+ return sdkTarget + " ";
+ }
+
+ private static List<String> encodeArgumentArray(ISDKTarget sdkTarget,
+ List<String> cmdLine, String modeKey) {
+
+ // Encode the launch command by replacing the arguments
+ // representing template arguments with the actual values.
+ //
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+
+ substitutor.define("TARGET", sdkTarget.getName());
+ substitutor.define("COMMAND", cmdLine.get(0));
+ substitutor.define("ARGS", CommandLineArguments.toCommandLine(cmdLine
+ .subList(1, cmdLine.size())));
+
+ String level = sdkTarget
+ .getPreferenceValue(SB2PreferenceConstants.SB2_LOG_LEVEL);
+ if (level.length() > 0) {
+ substitutor.define("LOG_OPTION", "-L " + level);
+ } else {
+ substitutor.define("LOG_OPTION", "");
+ }
+
+ String mapMode = sdkTarget.getPreferenceValue(modeKey);
+ substitutor.define("MAPPING_MODE", mapMode);
+
+ // get the Scratchbox invocation pattern
+ String commandPattern = sdkTarget
+ .getPreferenceValue(SB2PreferenceConstants.SB2_EXEC_COMMAND);
+
+ // replace variables
+ commandPattern = substitutor.substitute(commandPattern);
+
+ List<String> commandArgs = CommandLineArguments
+ .createFromCommandLine(commandPattern);
+ return commandArgs;
+ }
+
+ @Override
+ protected void setupForLaunch() throws ScratchboxException {
+ // nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#doCreateProcess()
+ */
+ @Override
+ protected Process doCreateProcess() throws Exception {
+ return sdkTarget.getSDK().getMachine().createProcess(
+ getLaunchCurrentWorkingDirectory(),
+ getLaunchCommandArguments(),
+ getLaunchEnvironmentModifierBlock(), isUsePTY());
+ }
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.launcher;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
-import org.maemo.esbox.core.process.IProcessLauncher;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
-
-/**
- * @author eswartz
- *
- */
-public class Scratchbox2ProcessLauncherFactory extends
- BaseProcessLauncherFactory {
-
- protected ISDKTarget sdkTarget;
- private String mappingModeKey;
- private final boolean runAsRoot;
-
- /**
- * Create a factory and specify whether it is creating commands in build
- * mode (sb2 -m maemo) or installation mode (sb2 -e)
- *
- * @param sdkTarget
- * @param mappingModeKey
- * one of SB2PreferenceConstants.MAPPING_MODE or
- * SB2PreferenceConstants.INSTALL_MAPPING_MODE
- * @param isBuildMode
- * true: build mode, false: installation mode
- */
- public Scratchbox2ProcessLauncherFactory(ISDKTarget sdkTarget,
- String mappingModeKey, boolean runAsRoot) {
- super(new Scratchbox2EnvironmentProvider(sdkTarget), false);
- if (sdkTarget == null)
- throw new IllegalArgumentException();
- this.sdkTarget = sdkTarget;
- this.mappingModeKey = mappingModeKey;
- this.runAsRoot = runAsRoot;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.maemo.esbox.core.IProcessLauncherFactory#createProcessLauncher(org
- * .eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath,
- * org.maemo.esbox.core.List<String>, java.util.Properties)
- */
- protected IProcessLauncher doCreateProcessLauncher(IPath workingDirectory,
- List<String> cmdLine,
- IEnvironmentModifierBlock environmentModifierBlock) {
-
- return new Scratchbox2ProcessLauncher(sdkTarget, workingDirectory,
- cmdLine, environmentModifierBlock, mappingModeKey, runAsRoot);
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/launcher/Scratchbox2ProcessLauncherFactory.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.launcher;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.env.IEnvironmentModifierBlock;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Scratchbox2ProcessLauncherFactory extends
+ BaseProcessLauncherFactory {
+
+ protected ISDKTarget sdkTarget;
+ private String mappingModeKey;
+ private final boolean runAsRoot;
+
+ /**
+ * Create a factory and specify whether it is creating commands in build
+ * mode (sb2 -m maemo) or installation mode (sb2 -e)
+ *
+ * @param sdkTarget
+ * @param mappingModeKey
+ * one of SB2PreferenceConstants.MAPPING_MODE or
+ * SB2PreferenceConstants.INSTALL_MAPPING_MODE
+ * @param isBuildMode
+ * true: build mode, false: installation mode
+ */
+ public Scratchbox2ProcessLauncherFactory(ISDKTarget sdkTarget,
+ String mappingModeKey, boolean runAsRoot) {
+ super(new Scratchbox2EnvironmentProvider(sdkTarget), false);
+ if (sdkTarget == null)
+ throw new IllegalArgumentException();
+ this.sdkTarget = sdkTarget;
+ this.mappingModeKey = mappingModeKey;
+ this.runAsRoot = runAsRoot;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.core.IProcessLauncherFactory#createProcessLauncher(org
+ * .eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath,
+ * org.maemo.esbox.core.List<String>, java.util.Properties)
+ */
+ protected IProcessLauncher doCreateProcessLauncher(IPath workingDirectory,
+ List<String> cmdLine,
+ IEnvironmentModifierBlock environmentModifierBlock) {
+
+ return new Scratchbox2ProcessLauncher(sdkTarget, workingDirectory,
+ cmdLine, environmentModifierBlock, mappingModeKey, runAsRoot);
+ }
+
+}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/provider)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/Scratchbox2SDKProvider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/provider/Scratchbox2SDKProvider.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/Scratchbox2SDKProvider.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.provider;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.maemo.esbox.core.CorePreferenceManager;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.ErrorLogger;
-import org.maemo.esbox.core.machine.IMachine;
-import org.maemo.esbox.core.machine.MachineRegistry;
-import org.maemo.esbox.core.sdk.IPreferenceProvider;
-import org.maemo.esbox.core.sdk.ISDK;
-import org.maemo.esbox.core.sdk.ISDKProvider;
-import org.maemo.esbox.internal.api.core.sdk.UserAwarePreferenceProviderWrapper;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.core.sdk.CacheUtils;
-import org.maemo.esbox.maemosdk.sb2.core.Scratchbox2SDK;
-import org.maemo.esbox.maemosdk.sb2.internal.Activator;
-
-/**
- * This implementation of the SDK provider searches for SB2 targets using the
- * 'sb2-config -l' command. If any aspect of SB2 communication fails, we assume
- * SB2 is not installed.
- *
- * @author eswartz
- *
- */
-public class Scratchbox2SDKProvider implements ISDKProvider {
-
- // this may need to be bumped once an official release is made
- private static final String SCRATCHBOX_VERSION_PATTERN = "1\\.99\\..*"; //$NON-NLS-1$
-
- /**
- *
- */
- public Scratchbox2SDKProvider() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.maemo.esbox.core.sdk.ISDKProvider#createSDKs()
- */
- public List<ISDK> createSDKs() throws ESboxException {
- ErrorLogger logger = Activator.getErrorLogger();
-
- List<ISDK> sdks = new ArrayList<ISDK>();
- for (IMachine machine : MachineRegistry.getInstance()
- .getBuildMachines()) {
- // will never find sbox on host (right?!)
- if (machine.getOS().equals(Platform.OS_WIN32))
- continue;
-
- try {
- IPreferenceProvider prefProvider = new UserAwarePreferenceProviderWrapper(
- CorePreferenceManager.getInstance()
- .getPreferenceProvider(), machine);
- Scratchbox2SDK sdk = getMachineSDK(prefProvider, machine);
- if (sdk != null) {
- sdks.add(sdk);
- sdk.refresh();
- }
- } catch (ScratchboxException e) {
- logger.log(IStatus.INFO,
- "Problem scanning Scratchbox 2 installation", e);
- }
- }
-
- CacheUtils.getInstance().saveCachedData();
-
- return sdks;
- }
-
- /**
- * @param logger
- * @param prefProvider
- * @param sdks
- * @return
- * @throws ScratchboxException
- */
- private Scratchbox2SDK getMachineSDK(IPreferenceProvider prefProvider,
- IMachine machine) throws ESboxException {
- ErrorLogger logger = Activator.getErrorLogger();
-
- // only support one Scratchbox 2 installation
- String version = Scratchbox2SDK.getCurrentSbox2Version(machine);
- if (version == null) {
- // no scratchbox?
- return null;
- }
-
- if (!version.matches(SCRATCHBOX_VERSION_PATTERN)) {
- logger
- .logError(
- MessageFormat
- .format(
- "Only Scratchbox 2 version 1.99.x is supported (detected {0}); disabling Scratchbox 2 support",
- version), null);
- return null;
- }
-
- Scratchbox2SDK sdk = new Scratchbox2SDK(machine, version, prefProvider);
-
- return sdk;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/Scratchbox2SDKProvider.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/provider/Scratchbox2SDKProvider.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/Scratchbox2SDKProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/provider/Scratchbox2SDKProvider.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.provider;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.CorePreferenceManager;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineRegistry;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKProvider;
+import org.maemo.esbox.internal.api.core.sdk.CacheUtils;
+import org.maemo.esbox.internal.api.core.sdk.UserAwarePreferenceProviderWrapper;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+import org.maemo.esbox.internal.maemosdk.sb2.core.Scratchbox2SDK;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This implementation of the SDK provider searches for SB2 targets using the
+ * 'sb2-config -l' command. If any aspect of SB2 communication fails, we assume
+ * SB2 is not installed.
+ *
+ * @author eswartz
+ *
+ */
+public class Scratchbox2SDKProvider implements ISDKProvider {
+
+ // this may need to be bumped once an official release is made
+ private static final String SCRATCHBOX_VERSION_PATTERN = "1\\.99\\..*"; //$NON-NLS-1$
+
+ /**
+ *
+ */
+ public Scratchbox2SDKProvider() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.sdk.ISDKProvider#createSDKs()
+ */
+ public List<ISDK> createSDKs() throws ESboxException {
+ ErrorLogger logger = Activator.getErrorLogger();
+
+ List<ISDK> sdks = new ArrayList<ISDK>();
+ for (IMachine machine : MachineRegistry.getInstance()
+ .getBuildMachines()) {
+ // will never find sbox on host (right?!)
+ if (machine.getOS().equals(Platform.OS_WIN32))
+ continue;
+
+ try {
+ IPreferenceProvider prefProvider = new UserAwarePreferenceProviderWrapper(
+ CorePreferenceManager.getInstance()
+ .getPreferenceProvider(), machine);
+ Scratchbox2SDK sdk = getMachineSDK(prefProvider, machine);
+ if (sdk != null) {
+ sdks.add(sdk);
+ sdk.refresh();
+ }
+ } catch (ScratchboxException e) {
+ logger.log(IStatus.INFO,
+ "Problem scanning Scratchbox 2 installation", e);
+ }
+ }
+
+ CacheUtils.getInstance().saveCachedData();
+
+ return sdks;
+ }
+
+ /**
+ * @param logger
+ * @param prefProvider
+ * @param sdks
+ * @return
+ * @throws ScratchboxException
+ */
+ private Scratchbox2SDK getMachineSDK(IPreferenceProvider prefProvider,
+ IMachine machine) throws ESboxException {
+ ErrorLogger logger = Activator.getErrorLogger();
+
+ // only support one Scratchbox 2 installation
+ String version = Scratchbox2SDK.getCurrentSboxVersion(machine);
+ if (version == null) {
+ // no scratchbox?
+ return null;
+ }
+
+ if (!version.matches(SCRATCHBOX_VERSION_PATTERN)) {
+ logger
+ .logError(
+ MessageFormat
+ .format(
+ "Only Scratchbox 2 version 1.99.x is supported (detected {0}); disabling Scratchbox 2 support",
+ version), null);
+ return null;
+ }
+
+ Scratchbox2SDK sdk = new Scratchbox2SDK(machine, version, prefProvider);
+
+ return sdk;
+ }
+
+}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/adapters)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.ui.adapters;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
-import org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK;
-
-/**
- * @author eswartz
- *
- */
-public class MaemoSDKInstallTargetAdapterFactory implements IAdapterFactory {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object,
- * java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType.equals(ISDKManageTargetAdapter.class)) {
- if (adaptableObject instanceof IScratchbox2SDK) {
- return new MaemoScratchbox2SDKManageTargetAdapter(
- (IScratchbox2SDK) adaptableObject);
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.ui.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.maemosdk.sb2.sdk.IScratchbox2SDK;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MaemoSDKInstallTargetAdapterFactory implements IAdapterFactory {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object,
+ * java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType.equals(ISDKManageTargetAdapter.class)) {
+ if (adaptableObject instanceof IScratchbox2SDK) {
+ return new MaemoScratchbox2SDKManageTargetAdapter(
+ (IScratchbox2SDK) adaptableObject);
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.ui.adapters;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.Policy;
-import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
-import org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK;
-import org.maemo.esbox.maemosdk.sb2.internal.Activator;
-import org.maemo.esbox.maemosdk.sb2.ui.wizard.NewScratchbox2TargetWizard;
-import org.maemo.esbox.maemosdk.ui.adapters.ESboxTargetRemover;
-import org.maemo.esbox.maemosdk.ui.adapters.MaemoScratchboxSDKManageTargetAdapterBase;
-
-/**
- * @author eswartz
- *
- */
-public class MaemoScratchbox2SDKManageTargetAdapter extends
- MaemoScratchboxSDKManageTargetAdapterBase implements
- ISDKManageTargetAdapter {
-
- private final IScratchbox2SDK sdk;
-
- /**
- * @param sdk
- */
- public MaemoScratchbox2SDKManageTargetAdapter(IScratchbox2SDK sdk) {
- this.sdk = sdk;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.maemo.esbox.core.adapters.ISDKManageTargetAdapter#installSDKTargets
- * (org.eclipse.swt.widgets.Shell, java.util.List)
- */
- public IStatus installSDKTargets(Shell shell, List<ISDKTarget> installed) {
- NewScratchbox2TargetWizard targetWizard;
-
- targetWizard = new NewScratchbox2TargetWizard(sdk);
- WizardDialog dlg = new WizardDialog(shell, targetWizard);
- if (dlg.open() == Dialog.OK) {
- return Status.OK_STATUS;
- }
-
- return Policy.getCancelStatus(Activator.getDefault());
- }
-
- protected ESboxTargetRemover createTargetRemover(Shell shell,
- ISDKTarget target, boolean deleteRootstrap) {
- return new ESboxTargetRemover(shell, target, deleteRootstrap) {
-
- protected void doRemoveTarget(IProgressMonitor monitor,
- IScratchboxSDK sdk) {
- try {
- ((IScratchbox2SDK) sdk).removeRootstrap(
- sdkTarget.getName(), true, new SubProgressMonitor(
- monitor, 1));
- } catch (ESboxException e) {
- // don't worry -- it may be a bogus target or one without a
- // rootstrap
- Activator.getErrorLogger().logError(
- "Problem removing rootstrap", e);
- }
- };
- };
- }
-
- @Override
- protected boolean isRootStrapUsed(ISDKTarget selectedTarget) {
- {
- boolean rootstrapUsed_ = false;
- try {
- // see if a rootstrap -- possibly disconnected from the target --
- // exists
- List<MaemoRootstrap> rootstraps = sdk
- .getAvailableMaemoRootstraps(selectedTarget.getSDK()
- .getMachine());
- for (MaemoRootstrap rootstrap : rootstraps) {
- if (rootstrap.getName().equals(selectedTarget.getName())) {
- rootstrapUsed_ = true;
- break;
- }
- }
- } catch (ESboxException e1) {
- Activator.getErrorLogger().logError(
- "Failure scanning maemo rootstraps", e1);
- }
- return rootstrapUsed_;
- }
- }
-
-
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.ui.adapters;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+import org.maemo.esbox.internal.maemosdk.sb2.ui.wizard.NewScratchbox2TargetWizard;
+import org.maemo.esbox.internal.maemosdk.ui.adapters.ESboxTargetRemover;
+import org.maemo.esbox.internal.maemosdk.ui.adapters.MaemoScratchboxSDKManageTargetAdapterBase;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.sb2.sdk.IScratchbox2SDK;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MaemoScratchbox2SDKManageTargetAdapter extends
+ MaemoScratchboxSDKManageTargetAdapterBase implements
+ ISDKManageTargetAdapter {
+
+ private final IScratchbox2SDK sdk;
+
+ /**
+ * @param sdk
+ */
+ public MaemoScratchbox2SDKManageTargetAdapter(IScratchbox2SDK sdk) {
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.esbox.core.adapters.ISDKManageTargetAdapter#installSDKTargets
+ * (org.eclipse.swt.widgets.Shell, java.util.List)
+ */
+ public IStatus installSDKTargets(Shell shell, List<ISDKTarget> installed) {
+ NewScratchbox2TargetWizard targetWizard;
+
+ targetWizard = new NewScratchbox2TargetWizard(sdk);
+ WizardDialog dlg = new WizardDialog(shell, targetWizard);
+ if (dlg.open() == Dialog.OK) {
+ return Status.OK_STATUS;
+ }
+
+ return Policy.getCancelStatus(Activator.getDefault());
+ }
+
+ protected ESboxTargetRemover createTargetRemover(Shell shell,
+ ISDKTarget target, boolean deleteRootstrap) {
+ return new ESboxTargetRemover(shell, target, deleteRootstrap) {
+
+ protected void doRemoveTarget(IProgressMonitor monitor,
+ IScratchboxSDK sdk) {
+ try {
+ ((IScratchbox2SDK) sdk).removeRootstrap(
+ sdkTarget.getName(), true, new SubProgressMonitor(
+ monitor, 1));
+ } catch (ESboxException e) {
+ // don't worry -- it may be a bogus target or one without a
+ // rootstrap
+ Activator.getErrorLogger().logError(
+ "Problem removing rootstrap", e);
+ }
+ };
+ };
+ }
+
+ @Override
+ protected boolean isRootStrapUsed(ISDKTarget selectedTarget) {
+ {
+ boolean rootstrapUsed_ = false;
+ try {
+ // see if a rootstrap -- possibly disconnected from the target --
+ // exists
+ List<MaemoRootstrap> rootstraps = sdk
+ .getAvailableMaemoRootstraps(selectedTarget.getSDK()
+ .getMachine());
+ for (MaemoRootstrap rootstrap : rootstraps) {
+ if (rootstrap.getName().equals(selectedTarget.getName())) {
+ rootstrapUsed_ = true;
+ break;
+ }
+ }
+ } catch (ESboxException e1) {
+ Activator.getErrorLogger().logError(
+ "Failure scanning maemo rootstraps", e1);
+ }
+ return rootstrapUsed_;
+ }
+ }
+
+
+
+}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/preferences)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial implementation
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.ui.preferences;
-
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.maemo.esbox.maemosdk.sb2.core.SB2PreferenceConstants;
-
-/**
- * General preference page for scratchbox 2
- *
- * @author eswartz
- */
-public class Scratchbox2PreferencesPage extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
- /**
- * Field for build mapping mode
- */
- private StringFieldEditor feSbox2BuildMappingMode = null;
- /**
- * Field for install mapping mode
- */
- private StringFieldEditor feSbox2InstallMappingMode = null;
-
- /**
- * Field for log level
- */
- private RadioGroupFieldEditor feSbox2LogLevel = null;
-
- private StringFieldEditor feSbox2CommandLine;
-
- /**
- * The constructor
- */
- public Scratchbox2PreferencesPage() {
- super(GRID);
- setPreferenceStore(SB2PreferenceConstants.getPreferenceStore());
- setDescription("Options configuring scratchbox 2");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
- * ()
- */
- public void createFieldEditors() {
-
- feSbox2BuildMappingMode = new StringFieldEditor(
- SB2PreferenceConstants.SB2_MAPPING_MODE.toString(),
- "Build mapping mode:", getFieldEditorParent());
-
- feSbox2InstallMappingMode = new StringFieldEditor(
- SB2PreferenceConstants.SB2_INSTALL_MAPPING_MODE.toString(),
- "Install mapping mode:", getFieldEditorParent());
-
- feSbox2LogLevel = new RadioGroupFieldEditor(
- SB2PreferenceConstants.SB2_LOG_LEVEL.toString(),
- "Logging level:", 1, new String[][] { { "none", "" }, //$NON-NLS-1$
- { "error", "error" }, //$NON-NLS-1$
- { "warning", "warning" }, //$NON-NLS-1$
- { "notice", "notice" }, //$NON-NLS-1$
- { "info", "info" }, //$NON-NLS-1$
- { "debug", "debug" }, //$NON-NLS-1$
- { "noise", "noise" }, //$NON-NLS-1$
- }, getFieldEditorParent());
-
- feSbox2CommandLine = new StringFieldEditor(
- SB2PreferenceConstants.SB2_EXEC_COMMAND.toString(),
- "Command template:", getFieldEditorParent());
-
- // make this string manageable
- GC gc = new GC(getFieldEditorParent().getShell());
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- gridData.widthHint = gc.getAdvanceWidth('m') * 32;
- gc.dispose();
- feSbox2CommandLine.getTextControl(getFieldEditorParent())
- .setLayoutData(gridData);
-
- addField(feSbox2BuildMappingMode);
- addField(feSbox2InstallMappingMode);
- addField(feSbox2LogLevel);
- addField(feSbox2CommandLine);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- // Nothing to do
- }
-
-}
\ No newline at end of file
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/preferences/Scratchbox2PreferencesPage.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.ui.preferences;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.internal.api.maemosdk.sb2.core.SB2PreferenceConstants;
+
+/**
+ * General preference page for scratchbox 2
+ *
+ * @author eswartz
+ */
+public class Scratchbox2PreferencesPage extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ /**
+ * Field for build mapping mode
+ */
+ private StringFieldEditor feSbox2BuildMappingMode = null;
+ /**
+ * Field for install mapping mode
+ */
+ private StringFieldEditor feSbox2InstallMappingMode = null;
+
+ /**
+ * Field for log level
+ */
+ private RadioGroupFieldEditor feSbox2LogLevel = null;
+
+ private StringFieldEditor feSbox2CommandLine;
+
+ /**
+ * The constructor
+ */
+ public Scratchbox2PreferencesPage() {
+ super(GRID);
+ setPreferenceStore(SB2PreferenceConstants.getPreferenceStore());
+ setDescription("Options configuring scratchbox 2");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
+ * ()
+ */
+ public void createFieldEditors() {
+
+ feSbox2BuildMappingMode = new StringFieldEditor(
+ SB2PreferenceConstants.SB2_MAPPING_MODE.toString(),
+ "Build mapping mode:", getFieldEditorParent());
+
+ feSbox2InstallMappingMode = new StringFieldEditor(
+ SB2PreferenceConstants.SB2_INSTALL_MAPPING_MODE.toString(),
+ "Install mapping mode:", getFieldEditorParent());
+
+ feSbox2LogLevel = new RadioGroupFieldEditor(
+ SB2PreferenceConstants.SB2_LOG_LEVEL.toString(),
+ "Logging level:", 1, new String[][] { { "none", "" }, //$NON-NLS-1$
+ { "error", "error" }, //$NON-NLS-1$
+ { "warning", "warning" }, //$NON-NLS-1$
+ { "notice", "notice" }, //$NON-NLS-1$
+ { "info", "info" }, //$NON-NLS-1$
+ { "debug", "debug" }, //$NON-NLS-1$
+ { "noise", "noise" }, //$NON-NLS-1$
+ }, getFieldEditorParent());
+
+ feSbox2CommandLine = new StringFieldEditor(
+ SB2PreferenceConstants.SB2_EXEC_COMMAND.toString(),
+ "Command template:", getFieldEditorParent());
+
+ // make this string manageable
+ GC gc = new GC(getFieldEditorParent().getShell());
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = gc.getAdvanceWidth('m') * 32;
+ gc.dispose();
+ feSbox2CommandLine.getTextControl(getFieldEditorParent())
+ .setLayoutData(gridData);
+
+ addField(feSbox2BuildMappingMode);
+ addField(feSbox2InstallMappingMode);
+ addField(feSbox2LogLevel);
+ addField(feSbox2CommandLine);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+}
\ No newline at end of file
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/wizard)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.ui.wizard;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK;
-
-/**
- * This class provides installable rootstraps, descriptions, etc. from the
- * result of 'maemo-rootstrap'.
- *
- * @author eswartz
- *
- */
-public class MaemoRootstrapContentLabelProvider extends LabelProvider implements
- ITreeContentProvider, ITableLabelProvider, IColorProvider,
- IFontProvider {
- static final int COLUMN_NAME = 0;
- static final int COLUMN_ARCHITECTURE = 1;
- static final int COLUMN_DESCRIPTION = 2;
-
- public static Object NO_ROOTSTRAP = new Object();
- public static Object LOADING_LABEL = new Object();
-
- private boolean rootstrapsFetched;
- // either MaemoRootstrap or NO_ROOTSTRAP
- private List<Object> rootstraps;
- private Thread rootstrapThread;
- private final IScratchbox2SDK sdk;
-
- public MaemoRootstrapContentLabelProvider(IScratchbox2SDK sdk) {
- this.sdk = sdk;
- }
-
- public Object[] getElements(Object inputElement) {
- if (!rootstrapsFetched) {
- rootstraps = new ArrayList<Object>();
- rootstraps.add(NO_ROOTSTRAP);
- rootstraps.add(LOADING_LABEL);
-
- if (rootstrapThread == null) {
- rootstrapThread = new Thread(new Runnable() {
-
- public void run() {
- try {
- List<MaemoRootstrap> realRootstraps = sdk
- .getAvailableMaemoRootstraps(sdk
- .getMachine());
- synchronized (rootstraps) {
- rootstraps.remove(1);
- rootstraps.addAll(realRootstraps);
- }
- } catch (final ESboxException e) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- MessageDialog.openError(null,
- "Rootstrap lookup failed",
- "Error fetching rootstraps: check proxy settings?\n\n"
- + e.getMessage());
- }
-
- });
- }
- rootstrapsFetched = true;
- rootstrapThread = null;
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- fireLabelProviderChanged(new LabelProviderChangedEvent(
- MaemoRootstrapContentLabelProvider.this));
- }
-
- });
- }
-
- });
- rootstrapThread.start();
- }
- }
- synchronized (rootstraps) {
- return rootstraps.toArray();
- }
- }
-
- public Object[] getChildren(Object parentElement) {
- return new Object[0];
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public void dispose() {
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- viewer.refresh();
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- switch (columnIndex) {
- case COLUMN_NAME:
- if (element == NO_ROOTSTRAP) {
- return "Custom target";
- } else if (element == LOADING_LABEL) {
- return "Loading...";
- } else {
- return ((MaemoRootstrap) element).getName();
- }
-
- case COLUMN_ARCHITECTURE:
- if (element == NO_ROOTSTRAP || element == LOADING_LABEL) {
- return null;
- }
- return ((MaemoRootstrap) element).getArchitecture();
-
- case COLUMN_DESCRIPTION:
- if (element == NO_ROOTSTRAP) {
- return "User-defined name and compiler, manually installed rootstrap";
- } else if (element == LOADING_LABEL) {
- return null;
- } else {
- return ((MaemoRootstrap) element).getDescription();
- }
- }
- return null;
- }
-
- public Color getBackground(Object element) {
- return null;
- }
-
- public Color getForeground(Object element) {
- if (element == LOADING_LABEL)
- return Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
- else
- return null;
- }
-
- public Font getFont(Object element) {
- if (element == LOADING_LABEL)
- return JFaceResources.getFontRegistry().getItalic(
- JFaceResources.DIALOG_FONT);
- else
- return null;
- }
-
-}
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/MaemoRootstrapContentLabelProvider.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.ui.wizard;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.sb2.sdk.IScratchbox2SDK;
+
+/**
+ * This class provides installable rootstraps, descriptions, etc. from the
+ * result of 'maemo-rootstrap'.
+ *
+ * @author eswartz
+ *
+ */
+public class MaemoRootstrapContentLabelProvider extends LabelProvider implements
+ ITreeContentProvider, ITableLabelProvider, IColorProvider,
+ IFontProvider {
+ static final int COLUMN_NAME = 0;
+ static final int COLUMN_ARCHITECTURE = 1;
+ static final int COLUMN_DESCRIPTION = 2;
+
+ public static Object NO_ROOTSTRAP = new Object();
+ public static Object LOADING_LABEL = new Object();
+
+ private boolean rootstrapsFetched;
+ // either MaemoRootstrap or NO_ROOTSTRAP
+ private List<Object> rootstraps;
+ private Thread rootstrapThread;
+ private final IScratchbox2SDK sdk;
+
+ public MaemoRootstrapContentLabelProvider(IScratchbox2SDK sdk) {
+ this.sdk = sdk;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (!rootstrapsFetched) {
+ rootstraps = new ArrayList<Object>();
+ rootstraps.add(NO_ROOTSTRAP);
+ rootstraps.add(LOADING_LABEL);
+
+ if (rootstrapThread == null) {
+ rootstrapThread = new Thread(new Runnable() {
+
+ public void run() {
+ try {
+ List<MaemoRootstrap> realRootstraps = sdk
+ .getAvailableMaemoRootstraps(sdk
+ .getMachine());
+ synchronized (rootstraps) {
+ rootstraps.remove(1);
+ rootstraps.addAll(realRootstraps);
+ }
+ } catch (final ESboxException e) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openError(null,
+ "Rootstrap lookup failed",
+ "Error fetching rootstraps: check proxy settings?\n\n"
+ + e.getMessage());
+ }
+
+ });
+ }
+ rootstrapsFetched = true;
+ rootstrapThread = null;
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(
+ MaemoRootstrapContentLabelProvider.this));
+ }
+
+ });
+ }
+
+ });
+ rootstrapThread.start();
+ }
+ }
+ synchronized (rootstraps) {
+ return rootstraps.toArray();
+ }
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ viewer.refresh();
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ switch (columnIndex) {
+ case COLUMN_NAME:
+ if (element == NO_ROOTSTRAP) {
+ return "Custom target";
+ } else if (element == LOADING_LABEL) {
+ return "Loading...";
+ } else {
+ return ((MaemoRootstrap) element).getName();
+ }
+
+ case COLUMN_ARCHITECTURE:
+ if (element == NO_ROOTSTRAP || element == LOADING_LABEL) {
+ return null;
+ }
+ return ((MaemoRootstrap) element).getArchitecture();
+
+ case COLUMN_DESCRIPTION:
+ if (element == NO_ROOTSTRAP) {
+ return "User-defined name and compiler, manually installed rootstrap";
+ } else if (element == LOADING_LABEL) {
+ return null;
+ } else {
+ return ((MaemoRootstrap) element).getDescription();
+ }
+ }
+ return null;
+ }
+
+ public Color getBackground(Object element) {
+ return null;
+ }
+
+ public Color getForeground(Object element) {
+ if (element == LOADING_LABEL)
+ return Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
+ else
+ return null;
+ }
+
+ public Font getFont(Object element) {
+ if (element == LOADING_LABEL)
+ return JFaceResources.getFontRegistry().getItalic(
+ JFaceResources.DIALOG_FONT);
+ else
+ return null;
+ }
+
+}
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,409 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (UFCG) - initial API and implementation
- * Carolina Nogueira de Souza (UFCG) - initial API and implementation
- * Ed Swartz (Nokia)
- * Petr Baranov (Nokia)
- *******************************************************************************/
-package org.maemo.esbox.maemosdk.sb2.ui.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWizard;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.ErrorLogger;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
-import org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK;
-import org.maemo.esbox.maemosdk.sb2.internal.Activator;
-import org.maemo.esbox.maemosdk.ui.targets.wizards.TargetWizardCPUMethod;
-import org.maemo.esbox.maemosdk.ui.targets.wizards.TargetWizardCompilerPage;
-import org.maemo.esbox.maemosdk.ui.targets.wizards.TargetWizardNamePage;
-import org.maemo.esbox.maemosdk.ui.targets.wizards.TargetWizardPageFactory;
-import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationNFSServer;
-import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationTargetDevice;
-
-/**
- * The target wizard provides a easy way to create a target for Scratchbox. As
- * Scratchbox target configuration, the user can configure your target.
- *
- */
-public class NewScratchbox2TargetWizard extends Wizard implements INewWizard {
-
- protected WizardPage targetNamePage;
- protected WizardPage compilerNamePage;
- protected WizardPage cpuMethodName;
- protected WizardPage sbrshConfigTargetDevice;
- protected WizardPage sbrshConfigNFSServer;
- protected IProject generatedProject;
-
- private IScratchbox2SDK sdk;
-
- private WizardPage maemoRootstrapPage;
-
- protected ISDKTarget createdTarget;
-
- private void initialize() {
- setNeedsProgressMonitor(true);
- setWindowTitle("New Scratchbox 2 Target");
- ImageDescriptor image = Activator
- .getImageDescriptor("./icons/full/wizban/newtarget_wiz.gif");
- setDefaultPageImageDescriptor(image);
- initPages();
- }
-
- /**
- * Constructs a new target wizard for the given SDK (from the target
- * configuration page)
- *
- * @param sdk
- */
- public NewScratchbox2TargetWizard(IScratchbox2SDK sdk) {
- super();
- this.sdk = sdk;
- initialize();
- }
-
- /**
- * Inicializes the content of the pages.
- */
- private void initPages() {
- if (sdk != null) {
- maemoRootstrapPage = new TargetWizardRootstrapSb2Page(sdk);
- addPage(maemoRootstrapPage);
- targetNamePage = TargetWizardPageFactory.getInstance()
- .createNamePage(sdk);
- addPage(targetNamePage);
- compilerNamePage = TargetWizardPageFactory.getInstance()
- .createCompilerPage(sdk);
- addPage(compilerNamePage);
- cpuMethodName = TargetWizardPageFactory.getInstance()
- .createCPUMethod(sdk);
- addPage(cpuMethodName);
- sbrshConfigTargetDevice = TargetWizardPageFactory.getInstance()
- .createSbrshConfigDeviceTargetPage();
- addPage(sbrshConfigTargetDevice);
- sbrshConfigNFSServer = TargetWizardPageFactory.getInstance()
- .createSbrshConfigNFSSServer();
- addPage(sbrshConfigNFSServer);
- } else {
- addPage(TargetWizardPageFactory.getInstance()
- .createBadInstallationPage());
- }
- }
-
- public boolean canFinish() {
- if (sdk == null)
- return false;
-
- boolean nonCustomRootstrap = true;
- if (maemoRootstrapPage != null)
- nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
- .canFinish();
- boolean cpuPage = ((TargetWizardCPUMethod) cpuMethodName).canFinish();
- boolean configDevice = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
- .canFinish();
- boolean NFSServer = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer)
- .canFinish();
- boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName)
- .getSbrshConfigure();
-
- if (!sbrshConfigAccepted && (nonCustomRootstrap || cpuPage))
- return true;
- if (sbrshConfigAccepted && NFSServer && configDevice)
- return true;
-
- return false;
- }
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- if (page == maemoRootstrapPage) {
- boolean nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
- .canFinish();
- if (nonCustomRootstrap)
- return null;
- else
- return super.getNextPage(page);
- }
- if (page == cpuMethodName) {
- boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName)
- .getSbrshConfigure();
- if (!sbrshConfigAccepted) // user does not want to configure sbrsh
- return null;
- else
- // user wants to configure sbrsh
- return super.getNextPage(page);
- }
- return super.getNextPage(page);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- if (getRootstrap() != null) {
- if (!setupTargetFromRootstrap())
- return false;
- } else {
- if (!setupTargetFromScratch())
- return false;
- }
-
- boolean sbrshConfigSelected = ((TargetWizardCPUMethod) cpuMethodName)
- .getSbrshConfigure();
- if (sbrshConfigSelected) {
- configureSbrshService();
- showsDialog();
- }
-
- return true;
- }
-
- private boolean setupTargetFromScratch() {
- String targetName;
- // in this mode, construct a target from the user's settings
- targetName = getTargetNameSelected();
- String compilerName = getCompilerNameSelected();
- String cpuMethod = getCputranspSelected();
- try {
- sdk.createTarget(targetName, compilerName, null, cpuMethod);
- createdTarget = sdk.findSDKTarget(targetName);
- return true;
- } catch (ESboxException e) {
- ErrorLogger errorLogger = Activator.getErrorLogger();
- errorLogger.logAndShowError("Cannot get create target "
- + targetName, e);
- return false;
- }
- }
-
- private boolean setupTargetFromRootstrap() {
- String targetName;
- // in this mode, make a predefined target from a maemo rootstrap
- targetName = getRootstrap().getName();
- boolean create = true;
-
- if (true) {
- // see if the rootstrap (not necessarily the target) already exists,
- // and ask user, in case this will overwrite their customizations
- try {
- List<String> installedRootstraps = sdk
- .getInstalledMaemoRootstraps();
- if (installedRootstraps.contains(targetName)) {
- create = MessageDialog
- .openConfirm(
- getShell(),
- "Reinstall rootstrap?",
- MessageFormat
- .format(
- "The rootstrap ''{0}'' appears to be already installed, though it may be disconnected from scratchbox.\n\n"
- + "At this time, we can't recreate a target for this rootstrap, but "
- + "you could do it manually with 'sb2-init'.\n\n"
- + "Do you want to overwrite the rootstrap?",
- targetName));
- }
- } catch (ESboxException e) {
- ErrorLogger errorLogger = Activator.getErrorLogger();
- errorLogger.logError("Cannot detect installed rootstraps", e);
- }
- }
-
- if (create) {
- try {
- createRootstrap(targetName, useHostTools());
- } catch (ESboxException e) {
- ErrorLogger errorLogger = Activator.getErrorLogger();
- errorLogger.logAndShowError(
- "Cannot get create rootstrap target " + targetName, e);
- return false;
- }
- }
- return true;
- }
-
- private void createRootstrap(final String targetName,
- final boolean useHostTools) throws ScratchboxException {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
-
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- monitor.beginTask("Creating rootstrap",
- IProgressMonitor.UNKNOWN);
- try {
- sdk.createRootstrapTarget(targetName, useHostTools,
- true, new SubProgressMonitor(monitor, 1));
- createdTarget = sdk.findSDKTarget(targetName);
- } catch (ESboxException e) {
- throw new InvocationTargetException(e);
- }
- monitor.done();
- }
-
- });
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof ScratchboxException)
- throw (ScratchboxException) e.getCause();
- else
- throw new ScratchboxException(e);
- } catch (InterruptedException e) {
- throw new ScratchboxException(e);
- }
- }
-
- private MaemoRootstrap getRootstrap() {
- return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
- .getRootstrap();
- }
-
- private boolean useHostTools() {
- return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
- .useHostTools();
- }
-
- /**
- * Return the name of the target to be created.
- *
- * @return the name of the target to be created.
- */
- private String getTargetNameSelected() {
- return ((TargetWizardNamePage) targetNamePage).getTextControl()
- .getText();
- }
-
- /**
- * Return the compiler name of the target to be created.
- *
- * @return the compiler name of the target to be created.
- */
- private String getCompilerNameSelected() {
- TableItem item = ((TargetWizardCompilerPage) compilerNamePage)
- .getTableControl().getSelection()[0];
- return item.getText();
- }
-
- /**
- * Return the cputransp name of the target to be created.
- *
- * @return the cputransp name of the target to be created.
- */
- private String getCputranspSelected() {
- TableItem item = ((TargetWizardCPUMethod) cpuMethodName).getTable()
- .getSelection()[0];
- return item.getText();
- }
-
- /**
- * Configure sbrsh service.
- */
- private void configureSbrshService() {
- String targetName = getTargetNameSelected();
- String deviceTargetAddr = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
- .getTargetDeviceAddr();
- String nfsHostname = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer)
- .getNFSHostname();
-
- try {
- sdk.configureSbrsh(targetName, deviceTargetAddr, nfsHostname);
- } catch (ESboxException e) {
- ErrorLogger errorLogger = Activator.getErrorLogger();
- errorLogger.logAndShowError("Cannot configure sbrsh", e);
- }
- }
-
- /**
- * Add user at access list of the sbrshd running at the target device.
- */
- private void addUser() {
- String deviceTargetIP = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
- .getTargetDeviceIP();
- String username = System.getProperty("user.name");
- ErrorLogger errorLogger = Activator.getErrorLogger();
-
- try {
- String localAddr = getLocalIP();
- sdk.addSbrshAccessList(deviceTargetIP, username, localAddr);
- } catch (ESboxException e) {
- errorLogger
- .logAndShowError(
- "Cannot add user to the access list of sbrshd at the target device",
- e);
- } catch (UnknownHostException e) {
- errorLogger.logAndShowError("Cannot get local IP address", e);
- }
- }
-
- /**
- * Shows the dialog to ask the user if s/he wants to add his/herself to the
- * acess list of the sbrshd.
- */
- private void showsDialog() {
- String deviceTargetAddr = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
- .getTargetDeviceIP();
- String text = "Do you want to add yourself to the access list of the sbrshd running on target device? \n";
- text += "(This requires that "
- + deviceTargetAddr
- + " has ssh daemon running and sbrshd already installed, and that you have root access).";
- boolean userAddedAtAccessList = MessageDialog.openQuestion(getShell(),
- "Scratchbox Configuration", text);
- if (userAddedAtAccessList) {
- addUser();
- }
- }
-
- /**
- * Get the local IP address.
- *
- * @return the local IP address.
- * @throws UnknownHostException
- */
- private String getLocalIP() throws UnknownHostException {
- return InetAddress.getLocalHost().getHostAddress();
- }
-
- /**
- * We will accept the selection in the workbench to see if we can initialize
- * from it.
- *
- * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-
- /**
- * Get the target created. Only valid after wizard dialog completes.
- *
- * @return newly created ISDKTarget or <code>null</code>
- */
- public ISDKTarget getCreatedTarget() {
- return createdTarget;
- }
-
-}
\ No newline at end of file
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/NewScratchbox2TargetWizard.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,406 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.sb2.ui.wizard;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.sb2.Activator;
+import org.maemo.esbox.internal.maemosdk.ui.targets.wizards.*;
+import org.maemo.esbox.internal.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationNFSServer;
+import org.maemo.esbox.internal.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationTargetDevice;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.sb2.sdk.IScratchbox2SDK;
+
+/**
+ * The target wizard provides a easy way to create a target for Scratchbox. As
+ * Scratchbox target configuration, the user can configure your target.
+ *
+ */
+public class NewScratchbox2TargetWizard extends Wizard implements INewWizard {
+
+ protected WizardPage targetNamePage;
+ protected WizardPage compilerNamePage;
+ protected WizardPage cpuMethodName;
+ protected WizardPage sbrshConfigTargetDevice;
+ protected WizardPage sbrshConfigNFSServer;
+ protected IProject generatedProject;
+
+ private IScratchbox2SDK sdk;
+
+ private WizardPage maemoRootstrapPage;
+
+ protected ISDKTarget createdTarget;
+
+ private void initialize() {
+ setNeedsProgressMonitor(true);
+ setWindowTitle("New Scratchbox 2 Target");
+ ImageDescriptor image = Activator
+ .getImageDescriptor("./icons/full/wizban/newtarget_wiz.gif");
+ setDefaultPageImageDescriptor(image);
+ initPages();
+ }
+
+ /**
+ * Constructs a new target wizard for the given SDK (from the target
+ * configuration page)
+ *
+ * @param sdk
+ */
+ public NewScratchbox2TargetWizard(IScratchbox2SDK sdk) {
+ super();
+ this.sdk = sdk;
+ initialize();
+ }
+
+ /**
+ * Inicializes the content of the pages.
+ */
+ private void initPages() {
+ if (sdk != null) {
+ maemoRootstrapPage = new TargetWizardRootstrapSb2Page(sdk);
+ addPage(maemoRootstrapPage);
+ targetNamePage = TargetWizardPageFactory.getInstance()
+ .createNamePage(sdk);
+ addPage(targetNamePage);
+ compilerNamePage = TargetWizardPageFactory.getInstance()
+ .createCompilerPage(sdk);
+ addPage(compilerNamePage);
+ cpuMethodName = TargetWizardPageFactory.getInstance()
+ .createCPUMethod(sdk);
+ addPage(cpuMethodName);
+ sbrshConfigTargetDevice = TargetWizardPageFactory.getInstance()
+ .createSbrshConfigDeviceTargetPage();
+ addPage(sbrshConfigTargetDevice);
+ sbrshConfigNFSServer = TargetWizardPageFactory.getInstance()
+ .createSbrshConfigNFSSServer();
+ addPage(sbrshConfigNFSServer);
+ } else {
+ addPage(TargetWizardPageFactory.getInstance()
+ .createBadInstallationPage());
+ }
+ }
+
+ public boolean canFinish() {
+ if (sdk == null)
+ return false;
+
+ boolean nonCustomRootstrap = true;
+ if (maemoRootstrapPage != null)
+ nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
+ .canFinish();
+ boolean cpuPage = ((TargetWizardCPUMethod) cpuMethodName).canFinish();
+ boolean configDevice = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
+ .canFinish();
+ boolean NFSServer = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer)
+ .canFinish();
+ boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName)
+ .getSbrshConfigure();
+
+ if (!sbrshConfigAccepted && (nonCustomRootstrap || cpuPage))
+ return true;
+ if (sbrshConfigAccepted && NFSServer && configDevice)
+ return true;
+
+ return false;
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ if (page == maemoRootstrapPage) {
+ boolean nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
+ .canFinish();
+ if (nonCustomRootstrap)
+ return null;
+ else
+ return super.getNextPage(page);
+ }
+ if (page == cpuMethodName) {
+ boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName)
+ .getSbrshConfigure();
+ if (!sbrshConfigAccepted) // user does not want to configure sbrsh
+ return null;
+ else
+ // user wants to configure sbrsh
+ return super.getNextPage(page);
+ }
+ return super.getNextPage(page);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.IWizard#performFinish()
+ */
+ public boolean performFinish() {
+ if (getRootstrap() != null) {
+ if (!setupTargetFromRootstrap())
+ return false;
+ } else {
+ if (!setupTargetFromScratch())
+ return false;
+ }
+
+ boolean sbrshConfigSelected = ((TargetWizardCPUMethod) cpuMethodName)
+ .getSbrshConfigure();
+ if (sbrshConfigSelected) {
+ configureSbrshService();
+ showsDialog();
+ }
+
+ return true;
+ }
+
+ private boolean setupTargetFromScratch() {
+ String targetName;
+ // in this mode, construct a target from the user's settings
+ targetName = getTargetNameSelected();
+ String compilerName = getCompilerNameSelected();
+ String cpuMethod = getCputranspSelected();
+ try {
+ sdk.createTarget(targetName, compilerName, null, cpuMethod);
+ createdTarget = sdk.findSDKTarget(targetName);
+ return true;
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot get create target "
+ + targetName, e);
+ return false;
+ }
+ }
+
+ private boolean setupTargetFromRootstrap() {
+ String targetName;
+ // in this mode, make a predefined target from a maemo rootstrap
+ targetName = getRootstrap().getName();
+ boolean create = true;
+
+ if (true) {
+ // see if the rootstrap (not necessarily the target) already exists,
+ // and ask user, in case this will overwrite their customizations
+ try {
+ List<String> installedRootstraps = sdk
+ .getInstalledMaemoRootstraps();
+ if (installedRootstraps.contains(targetName)) {
+ create = MessageDialog
+ .openConfirm(
+ getShell(),
+ "Reinstall rootstrap?",
+ MessageFormat
+ .format(
+ "The rootstrap ''{0}'' appears to be already installed, though it may be disconnected from scratchbox.\n\n"
+ + "At this time, we can't recreate a target for this rootstrap, but "
+ + "you could do it manually with 'sb2-init'.\n\n"
+ + "Do you want to overwrite the rootstrap?",
+ targetName));
+ }
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logError("Cannot detect installed rootstraps", e);
+ }
+ }
+
+ if (create) {
+ try {
+ createRootstrap(targetName, useHostTools());
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError(
+ "Cannot get create rootstrap target " + targetName, e);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private void createRootstrap(final String targetName,
+ final boolean useHostTools) throws ScratchboxException {
+ try {
+ getContainer().run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Creating rootstrap",
+ IProgressMonitor.UNKNOWN);
+ try {
+ sdk.createRootstrapTarget(targetName, useHostTools,
+ true, new SubProgressMonitor(monitor, 1));
+ createdTarget = sdk.findSDKTarget(targetName);
+ } catch (ESboxException e) {
+ throw new InvocationTargetException(e);
+ }
+ monitor.done();
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ if (e.getCause() instanceof ScratchboxException)
+ throw (ScratchboxException) e.getCause();
+ else
+ throw new ScratchboxException(e);
+ } catch (InterruptedException e) {
+ throw new ScratchboxException(e);
+ }
+ }
+
+ private MaemoRootstrap getRootstrap() {
+ return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
+ .getRootstrap();
+ }
+
+ private boolean useHostTools() {
+ return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage)
+ .useHostTools();
+ }
+
+ /**
+ * Return the name of the target to be created.
+ *
+ * @return the name of the target to be created.
+ */
+ private String getTargetNameSelected() {
+ return ((TargetWizardNamePage) targetNamePage).getTextControl()
+ .getText();
+ }
+
+ /**
+ * Return the compiler name of the target to be created.
+ *
+ * @return the compiler name of the target to be created.
+ */
+ private String getCompilerNameSelected() {
+ TableItem item = ((TargetWizardCompilerPage) compilerNamePage)
+ .getTableControl().getSelection()[0];
+ return item.getText();
+ }
+
+ /**
+ * Return the cputransp name of the target to be created.
+ *
+ * @return the cputransp name of the target to be created.
+ */
+ private String getCputranspSelected() {
+ TableItem item = ((TargetWizardCPUMethod) cpuMethodName).getTable()
+ .getSelection()[0];
+ return item.getText();
+ }
+
+ /**
+ * Configure sbrsh service.
+ */
+ private void configureSbrshService() {
+ String targetName = getTargetNameSelected();
+ String deviceTargetAddr = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
+ .getTargetDeviceAddr();
+ String nfsHostname = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer)
+ .getNFSHostname();
+
+ try {
+ sdk.configureSbrsh(targetName, deviceTargetAddr, nfsHostname);
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot configure sbrsh", e);
+ }
+ }
+
+ /**
+ * Add user at access list of the sbrshd running at the target device.
+ */
+ private void addUser() {
+ String deviceTargetIP = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
+ .getTargetDeviceIP();
+ String username = System.getProperty("user.name");
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+
+ try {
+ String localAddr = getLocalIP();
+ sdk.addSbrshAccessList(deviceTargetIP, username, localAddr);
+ } catch (ESboxException e) {
+ errorLogger
+ .logAndShowError(
+ "Cannot add user to the access list of sbrshd at the target device",
+ e);
+ } catch (UnknownHostException e) {
+ errorLogger.logAndShowError("Cannot get local IP address", e);
+ }
+ }
+
+ /**
+ * Shows the dialog to ask the user if s/he wants to add his/herself to the
+ * acess list of the sbrshd.
+ */
+ private void showsDialog() {
+ String deviceTargetAddr = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice)
+ .getTargetDeviceIP();
+ String text = "Do you want to add yourself to the access list of the sbrshd running on target device? \n";
+ text += "(This requires that "
+ + deviceTargetAddr
+ + " has ssh daemon running and sbrshd already installed, and that you have root access).";
+ boolean userAddedAtAccessList = MessageDialog.openQuestion(getShell(),
+ "Scratchbox Configuration", text);
+ if (userAddedAtAccessList) {
+ addUser();
+ }
+ }
+
+ /**
+ * Get the local IP address.
+ *
+ * @return the local IP address.
+ * @throws UnknownHostException
+ */
+ private String getLocalIP() throws UnknownHostException {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if we can initialize
+ * from it.
+ *
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ /**
+ * Get the target created. Only valid after wizard dialog completes.
+ *
+ * @return newly created ISDKTarget or <code>null</code>
+ */
+ public ISDKTarget getCreatedTarget() {
+ return createdTarget;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java
===================================================================
--- branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java 2008-10-15 06:30:08 UTC (rev 873)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- * Petr Baranov (Nokia)
- *******************************************************************************/
-
-package org.maemo.esbox.maemosdk.sb2.ui.wizard;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
-import org.maemo.esbox.maemosdk.sb2.core.IScratchbox2SDK;
-import org.maemo.esbox.maemosdk.sb2.core.Scratchbox2SDK;
-import org.maemo.esbox.maemosdk.ui.targets.wizards.IValidatePage;
-
-/**
- * This page allows the user to select a rootstrap (which defines the target
- * name, compiler, devkits, and cpu method all at once) for use with sb2, or to
- * explicitly select to configure all the aspects himself.
- *
- * @author eswartz
- *
- */
-public class TargetWizardRootstrapSb2Page extends WizardPage implements
- IValidatePage {
-
- protected TreeViewer rootstrapTargetViewer;
- protected Text text;
- /* private */IScratchbox2SDK sdk; // in case we use it later
- protected Object selection;
- private MaemoRootstrapContentLabelProvider provider;
- private Button showExistingTargets;
- private Button useHostTools;
-
- /**
- * Constructs a NewTargetWizardNamePage.
- */
- protected TargetWizardRootstrapSb2Page(IScratchbox2SDK sdk) {
- super("Target Name");
- this.sdk = sdk;
- if (!(sdk instanceof Scratchbox2SDK)) {
- throw new IllegalArgumentException(
- "This page only expects a scratchbox 2 SDK");
- }
- setTitle("Select maemo SDK+ Rootstrap");
- setDescription("Select the maemo rootstrap to install, or manually configure a target.");
- setPageComplete(false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
- * .Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
-
- Label label = new Label(composite, SWT.LEFT);
- label.setText("Select a rootstrap:");
-
- rootstrapTargetViewer = new TreeViewer(composite, SWT.SINGLE
- | SWT.BORDER);
- rootstrapTargetViewer.getTree().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
-
- showExistingTargets = new Button(composite, SWT.CHECK);
- showExistingTargets.setText("Show existing targets");
- showExistingTargets.setSelection(false);
- showExistingTargets
- .setToolTipText("If checked, rootstraps with names matching existing targets will be shown. This is the only way to reinstall a target.");
-
- useHostTools = new Button(composite, SWT.CHECK);
- useHostTools.setText("Use host's build tools");
- useHostTools.setSelection(false);
- useHostTools
- .setToolTipText("If checked, configure the rootstrap to use the host versions of autotools, bison, flex, docbook, etc. instead of standard versions (c.f. devkits in scratchbox 1). We recommend leaving this unchecked and invoking maemo-tools to install official build tools.");
-
- // / setup rootstrap target tree
-
- provider = new MaemoRootstrapContentLabelProvider(sdk);
- rootstrapTargetViewer.setContentProvider(provider);
- rootstrapTargetViewer.setLabelProvider(provider);
-
- rootstrapTargetViewer
- .addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- selection = ((IStructuredSelection) event
- .getSelection()).getFirstElement();
- validatePage();
- }
-
- });
-
- provider.addListener(new ILabelProviderListener() {
-
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- rootstrapTargetViewer.refresh();
- }
-
- });
-
- rootstrapTargetViewer.getTree().setLinesVisible(true);
- rootstrapTargetViewer.getTree().setHeaderVisible(true);
-
- TreeColumn nameColumn = new TreeColumn(rootstrapTargetViewer.getTree(),
- SWT.LEFT);
- nameColumn.setText("Target Name");
- nameColumn.setWidth(200);
- nameColumn.setResizable(true);
-
- TreeColumn archColumn = new TreeColumn(rootstrapTargetViewer.getTree(),
- SWT.LEFT);
- archColumn.setText("Architecture");
- archColumn.setWidth(100);
- archColumn.setResizable(true);
-
- TreeColumn descColumn = new TreeColumn(rootstrapTargetViewer.getTree(),
- SWT.LEFT);
- descColumn.setText("Description");
- descColumn.setWidth(200);
- descColumn.setResizable(true);
-
- rootstrapTargetViewer.setInput(new Object());
-
- rootstrapTargetViewer.setSelection(StructuredSelection.EMPTY);
-
- showExistingTargets.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateViewerFilters();
- }
- });
-
- updateViewerFilters();
- setControl(composite);
- }
-
- protected void updateViewerFilters() {
- if (!showExistingTargets.getSelection()) {
- rootstrapTargetViewer
- .setFilters(new ViewerFilter[] { new ViewerFilter() {
-
- @Override
- public boolean select(Viewer viewer,
- Object parentElement, Object element) {
- if (element instanceof MaemoRootstrap) {
- MaemoRootstrap rootstrap = (MaemoRootstrap) element;
- if (sdk.findSDKTarget(rootstrap.getName()) != null)
- return false;
- }
- return true;
- }
-
- } });
- } else {
- rootstrapTargetViewer.setFilters(new ViewerFilter[0]);
- }
-
- rootstrapTargetViewer.refresh();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage
- * #perfomeAction()
- */
- public boolean validatePage() {
- setPageComplete(selection instanceof MaemoRootstrap
- || selection == MaemoRootstrapContentLabelProvider.NO_ROOTSTRAP);
- return true;
- }
-
- public boolean canFinish() {
- return selection instanceof MaemoRootstrap;
- }
-
- public MaemoRootstrap getRootstrap() {
- if (!(selection instanceof MaemoRootstrap))
- return null;
- return (MaemoRootstrap) selection;
- }
-
- public boolean isShowingExisting() {
- return showExistingTargets.getSelection();
- }
-
- public boolean useHostTools() {
- return useHostTools.getSelection();
- }
-
-}
\ No newline at end of file
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java)
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/internal/maemosdk/sb2/ui/wizard/TargetWizardRootstrapSb2Page.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ * Petr Baranov (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.sb2.ui.wizard;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.maemo.esbox.internal.maemosdk.sb2.core.Scratchbox2SDK;
+import org.maemo.esbox.internal.maemosdk.ui.targets.wizards.IValidatePage;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.sb2.sdk.IScratchbox2SDK;
+
+/**
+ * This page allows the user to select a rootstrap (which defines the target
+ * name, compiler, devkits, and cpu method all at once) for use with sb2, or to
+ * explicitly select to configure all the aspects himself.
+ *
+ * @author eswartz
+ *
+ */
+public class TargetWizardRootstrapSb2Page extends WizardPage implements
+ IValidatePage {
+
+ protected TreeViewer rootstrapTargetViewer;
+ protected Text text;
+ /* private */IScratchbox2SDK sdk; // in case we use it later
+ protected Object selection;
+ private MaemoRootstrapContentLabelProvider provider;
+ private Button showExistingTargets;
+ private Button useHostTools;
+
+ /**
+ * Constructs a NewTargetWizardNamePage.
+ */
+ protected TargetWizardRootstrapSb2Page(IScratchbox2SDK sdk) {
+ super("Target Name");
+ this.sdk = sdk;
+ if (!(sdk instanceof Scratchbox2SDK)) {
+ throw new IllegalArgumentException(
+ "This page only expects a scratchbox 2 SDK");
+ }
+ setTitle("Select maemo SDK+ Rootstrap");
+ setDescription("Select the maemo rootstrap to install, or manually configure a target.");
+ setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+ * .Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label label = new Label(composite, SWT.LEFT);
+ label.setText("Select a rootstrap:");
+
+ rootstrapTargetViewer = new TreeViewer(composite, SWT.SINGLE
+ | SWT.BORDER);
+ rootstrapTargetViewer.getTree().setLayoutData(
+ new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ showExistingTargets = new Button(composite, SWT.CHECK);
+ showExistingTargets.setText("Show existing targets");
+ showExistingTargets.setSelection(false);
+ showExistingTargets
+ .setToolTipText("If checked, rootstraps with names matching existing targets will be shown. This is the only way to reinstall a target.");
+
+ useHostTools = new Button(composite, SWT.CHECK);
+ useHostTools.setText("Use host's build tools");
+ useHostTools.setSelection(false);
+ useHostTools
+ .setToolTipText("If checked, configure the rootstrap to use the host versions of autotools, bison, flex, docbook, etc. instead of standard versions (c.f. devkits in scratchbox 1). We recommend leaving this unchecked and invoking maemo-tools to install official build tools.");
+
+ // / setup rootstrap target tree
+
+ provider = new MaemoRootstrapContentLabelProvider(sdk);
+ rootstrapTargetViewer.setContentProvider(provider);
+ rootstrapTargetViewer.setLabelProvider(provider);
+
+ rootstrapTargetViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ selection = ((IStructuredSelection) event
+ .getSelection()).getFirstElement();
+ validatePage();
+ }
+
+ });
+
+ provider.addListener(new ILabelProviderListener() {
+
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ rootstrapTargetViewer.refresh();
+ }
+
+ });
+
+ rootstrapTargetViewer.getTree().setLinesVisible(true);
+ rootstrapTargetViewer.getTree().setHeaderVisible(true);
+
+ TreeColumn nameColumn = new TreeColumn(rootstrapTargetViewer.getTree(),
+ SWT.LEFT);
+ nameColumn.setText("Target Name");
+ nameColumn.setWidth(200);
+ nameColumn.setResizable(true);
+
+ TreeColumn archColumn = new TreeColumn(rootstrapTargetViewer.getTree(),
+ SWT.LEFT);
+ archColumn.setText("Architecture");
+ archColumn.setWidth(100);
+ archColumn.setResizable(true);
+
+ TreeColumn descColumn = new TreeColumn(rootstrapTargetViewer.getTree(),
+ SWT.LEFT);
+ descColumn.setText("Description");
+ descColumn.setWidth(200);
+ descColumn.setResizable(true);
+
+ rootstrapTargetViewer.setInput(new Object());
+
+ rootstrapTargetViewer.setSelection(StructuredSelection.EMPTY);
+
+ showExistingTargets.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateViewerFilters();
+ }
+ });
+
+ updateViewerFilters();
+ setControl(composite);
+ }
+
+ protected void updateViewerFilters() {
+ if (!showExistingTargets.getSelection()) {
+ rootstrapTargetViewer
+ .setFilters(new ViewerFilter[] { new ViewerFilter() {
+
+ @Override
+ public boolean select(Viewer viewer,
+ Object parentElement, Object element) {
+ if (element instanceof MaemoRootstrap) {
+ MaemoRootstrap rootstrap = (MaemoRootstrap) element;
+ if (sdk.findSDKTarget(rootstrap.getName()) != null)
+ return false;
+ }
+ return true;
+ }
+
+ } });
+ } else {
+ rootstrapTargetViewer.setFilters(new ViewerFilter[0]);
+ }
+
+ rootstrapTargetViewer.refresh();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage
+ * #perfomeAction()
+ */
+ public boolean validatePage() {
+ setPageComplete(selection instanceof MaemoRootstrap
+ || selection == MaemoRootstrapContentLabelProvider.NO_ROOTSTRAP);
+ return true;
+ }
+
+ public boolean canFinish() {
+ return selection instanceof MaemoRootstrap;
+ }
+
+ public MaemoRootstrap getRootstrap() {
+ if (!(selection instanceof MaemoRootstrap))
+ return null;
+ return (MaemoRootstrap) selection;
+ }
+
+ public boolean isShowingExisting() {
+ return showExistingTargets.getSelection();
+ }
+
+ public boolean useHostTools() {
+ return useHostTools.getSelection();
+ }
+
+}
\ No newline at end of file
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk)
Copied: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2 (from rev 873, branches/sdkPlugins/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/sdk
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/sdk/IScratchbox2SDK.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/sdk/IScratchbox2SDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.sb2/src/org/maemo/esbox/maemosdk/sb2/sdk/IScratchbox2SDK.java 2008-10-15 19:24:39 UTC (rev 875)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Petr Baranov (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.sb2.sdk;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+public interface IScratchbox2SDK extends IScratchboxSDK {
+
+ /**
+ * Map<String,Map<String, String>> of sb2 target names to a map of the
+ * target directory to host directory path mappings
+ */
+ static final String SB2_TARGET_TO_PATH_MAPPINGS_MAP = "sb2_target_to_path_mappings_map";
+ /** Map<String,String> of sb2 target names to rootstrap paths */
+ static final String SB2_TARGET_TO_ROOTSTRAP_MAP = "sb2_target_to_rootstrap_map";
+
+ /**
+ * @return
+ */
+ public IPath getScratchbox2ConfigDirectory();
+
+ /**
+ * Create a new rootstrap target for Scratchbox 2. The target is named after
+ * a maemo-rootstrap available target.
+ *
+ * @param targetName
+ * the name of the new target.
+ * @param useHostTools
+ * if true, use the host toolchain rather than installing devkits
+ * in the rootstrap
+ * @param force
+ * if true, then overwrite any existing rootstrap; if false, then
+ * let the user choose (in the console :/) whether to overwrite
+ * or keep an existing one
+ * @return true if succeeded, false if failed
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public boolean createRootstrapTarget(String targetName,
+ boolean useHostTools, boolean force, IProgressMonitor monitor)
+ throws ESboxException;
+
+ /**
+ * Create a new rootstrap target for Scratchbox 2. The target is named after
+ * a maemo-rootstrap available target.
+ *
+ * @param targetName
+ * the name of the new target.
+ * @param force
+ * if true, then overwrite any existing rootstrap; if false, then
+ * let the user choose (in the console :/) whether to overwrite
+ * or keep an existing one
+ * @return true if succeeded, false if failed
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public boolean removeRootstrap(String targetName, boolean force,
+ IProgressMonitor monitor) throws ESboxException;
+
+ /**
+ * Get the names of rootstraps already installed. This may inclue those that
+ * do not have targets associated.
+ *
+ * @param sdk
+ * the SDK to check
+ * @return List, never null
+ * @throws ESboxException
+ */
+ public List<String> getInstalledMaemoRootstraps() throws ESboxException;
+
+ /**
+ * Get the MaemoRootstrap items available for installation. This includes
+ * any that might already be defined.
+ *
+ * @return List, never null
+ * @throws ESboxException
+ */
+ public List<MaemoRootstrap> getAvailableMaemoRootstraps(IMachine machine)
+ throws ESboxException;
+
+}
More information about the Esbox-commits
mailing list