From 41ac47d732eed8392d60d0f6773e5a279d49b999 Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 12 Dec 2013 13:36:50 +0100 Subject: initial commit of Enea Linux 3.1 Migrated from the internal git server on the dora-enea branch Signed-off-by: Adrian Dudau --- .gitignore | 1 + features/org.yocto.bc.headless.build/.project | 11 + .../org.yocto.bc.headless.build/build.properties | 262 +++ .../org.yocto.bc.headless.build/customTargets.xml | 212 ++ features/org.yocto.bc/.project | 17 + features/org.yocto.bc/build.properties | 3 + features/org.yocto.bc/feature.properties | 163 ++ features/org.yocto.bc/feature.xml | 42 + features/org.yocto.bc/license.html | 107 + features/org.yocto.doc.headless.build/.project | 11 + .../org.yocto.doc.headless.build/build.properties | 262 +++ .../org.yocto.doc.headless.build/customTargets.xml | 212 ++ features/org.yocto.doc/.project | 17 + features/org.yocto.doc/build.properties | 3 + features/org.yocto.doc/feature.properties | 163 ++ features/org.yocto.doc/feature.xml | 35 + features/org.yocto.doc/license.html | 107 + features/org.yocto.sdk.headless.build/.project | 11 + .../org.yocto.sdk.headless.build/build.properties | 262 +++ .../org.yocto.sdk.headless.build/customTargets.xml | 212 ++ features/org.yocto.sdk.site/.project | 17 + features/org.yocto.sdk.site/category.xml | 18 + features/org.yocto.sdk.site/index.html | 60 + features/org.yocto.sdk.site/site.xml | 18 + features/org.yocto.sdk.site/web/site.css | 12 + features/org.yocto.sdk.site/web/site.xsl | 214 ++ features/org.yocto.sdk/.project | 17 + features/org.yocto.sdk/build.properties | 6 + features/org.yocto.sdk/feature.properties | 163 ++ features/org.yocto.sdk/feature.xml | 109 + features/org.yocto.sdk/license.html | 107 + .../sourceTemplateFeature/feature.properties | 163 ++ .../sourceTemplateFeature/license.html | 107 + .../sourceTemplatePlugin/license.html | 107 + .../sourceTemplatePlugin/plugin.properties | 163 ++ plugins/org.yocto.bc.ui/.classpath | 7 + plugins/org.yocto.bc.ui/.project | 28 + plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF | 19 + .../OSGI-INF/l10n/bundle.properties | 6 + plugins/org.yocto.bc.ui/build.properties | 7 + plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg | Bin 0 -> 10247 bytes plugins/org.yocto.bc.ui/icons/BUG_logo_128.png | Bin 0 -> 8804 bytes plugins/org.yocto.bc.ui/icons/OE_logo_128.png | Bin 0 -> 8248 bytes plugins/org.yocto.bc.ui/icons/OE_logo_64.png | Bin 0 -> 5250 bytes plugins/org.yocto.bc.ui/icons/OE_logo_96.png | Bin 0 -> 6712 bytes plugins/org.yocto.bc.ui/icons/OE_logo_full.png | Bin 0 -> 12480 bytes plugins/org.yocto.bc.ui/icons/beagle_128.png | Bin 0 -> 15639 bytes plugins/org.yocto.bc.ui/icons/binary.gif | Bin 0 -> 366 bytes plugins/org.yocto.bc.ui/icons/cf_obj.gif | Bin 0 -> 230 bytes plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif | Bin 0 -> 361 bytes plugins/org.yocto.bc.ui/icons/clean.gif | Bin 0 -> 183 bytes plugins/org.yocto.bc.ui/icons/details_view.gif | Bin 0 -> 368 bytes plugins/org.yocto.bc.ui/icons/function.gif | Bin 0 -> 204 bytes plugins/org.yocto.bc.ui/icons/icon16_OE.gif | Bin 0 -> 383 bytes plugins/org.yocto.bc.ui/icons/import_wiz.gif | Bin 0 -> 327 bytes plugins/org.yocto.bc.ui/icons/importdir_wiz.png | Bin 0 -> 6184 bytes .../org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif | Bin 0 -> 587 bytes plugins/org.yocto.bc.ui/icons/oe_decorator.gif | Bin 0 -> 267 bytes plugins/org.yocto.bc.ui/icons/poky_128.png | Bin 0 -> 3555 bytes plugins/org.yocto.bc.ui/icons/read_only.gif | Bin 0 -> 851 bytes plugins/org.yocto.bc.ui/icons/refresh.gif | Bin 0 -> 330 bytes plugins/org.yocto.bc.ui/icons/releng_gears.gif | Bin 0 -> 159 bytes plugins/org.yocto.bc.ui/icons/sample.gif | Bin 0 -> 983 bytes plugins/org.yocto.bc.ui/icons/sample_decorator.gif | Bin 0 -> 854 bytes plugins/org.yocto.bc.ui/icons/topic.gif | Bin 0 -> 354 bytes plugins/org.yocto.bc.ui/icons/trash.gif | Bin 0 -> 590 bytes plugins/org.yocto.bc.ui/icons/variable.gif | Bin 0 -> 126 bytes plugins/org.yocto.bc.ui/icons/watchlist_view.gif | Bin 0 -> 158 bytes plugins/org.yocto.bc.ui/local.conf | 125 ++ plugins/org.yocto.bc.ui/plugin.xml | 344 ++++ .../src/org/yocto/bc/bitbake/BBCommonVars.java | 24 + .../src/org/yocto/bc/bitbake/BBLanguageHelper.java | 62 + .../src/org/yocto/bc/bitbake/BBRecipe.java | 50 + .../src/org/yocto/bc/bitbake/BBSession.java | 739 +++++++ .../org/yocto/bc/bitbake/IBBSessionListener.java | 18 + .../yocto/bc/bitbake/ICommandResponseHandler.java | 15 + .../org/yocto/bc/bitbake/ProjectInfoHelper.java | 105 + .../src/org/yocto/bc/bitbake/ShellSession.java | 248 +++ .../src/org/yocto/bc/ui/Activator.java | 266 +++ .../org/yocto/bc/ui/BCResourceChangeListener.java | 64 + .../ui/actions/AbstractBitbakeCommandAction.java | 199 ++ .../bc/ui/actions/BitbakeBuildRecipeAction.java | 24 + .../bc/ui/actions/BitbakeCleanRecipeAction.java | 26 + .../yocto/bc/ui/actions/BitbakeImportAction.java | 106 + .../bc/ui/actions/BitbakeRebuildRecipeAction.java | 29 + .../org/yocto/bc/ui/actions/LaunchHobAction.java | 84 + .../org/yocto/bc/ui/actions/LaunchHobDialog.java | 328 +++ .../org/yocto/bc/ui/actions/LaunchHobHandler.java | 50 + .../LaunchNewBitBakeProjectWizardAction.java | 48 + .../bc/ui/actions/LaunchNewRecipeWizardAction.java | 48 + .../bc/ui/actions/LaunchVariableWizardAction.java | 78 + .../org/yocto/bc/ui/builder/BitbakeBuilder.java | 177 ++ .../bc/ui/builder/BitbakeCommanderNature.java | 118 ++ .../yocto/bc/ui/builder/ToggleNatureAction.java | 106 + .../yocto/bc/ui/decorators/ProjectDecorator.java | 48 + .../src/org/yocto/bc/ui/decorators/ReadOnly.java | 107 + .../bc/ui/editors/bitbake/BBVariableTextHover.java | 118 ++ .../editors/bitbake/BitBakeDocumentProvider.java | 62 + .../bc/ui/editors/bitbake/BitBakeFileEditor.java | 75 + .../bitbake/BitBakeSourceViewerConfiguration.java | 195 ++ .../bc/ui/editors/bitbake/CustomFunctionRule.java | 94 + .../editors/bitbake/RecipeCompletionProcessor.java | 127 ++ .../bitbake/RecipeEditorActionContributor.java | 47 + .../ui/editors/bitbake/RecipeEditorMessages.java | 21 + .../bitbake/RecipeEditorMessages.properties | 14 + .../yocto/bc/ui/editors/bitbake/VariableRule.java | 69 + .../src/org/yocto/bc/ui/filesystem/Messages.java | 48 + .../src/org/yocto/bc/ui/filesystem/OEFile.java | 515 +++++ .../org/yocto/bc/ui/filesystem/OEFileSystem.java | 78 + .../bc/ui/filesystem/OEFileSystemContributor.java | 30 + .../org/yocto/bc/ui/filesystem/OEIgnoreFile.java | 133 ++ .../src/org/yocto/bc/ui/filesystem/Policy.java | 108 + .../src/org/yocto/bc/ui/model/IModelElement.java | 15 + .../src/org/yocto/bc/ui/model/ProjectInfo.java | 48 + .../perspectives/BitbakeCommanderPerspective.java | 89 + .../org/yocto/bc/ui/popup/actions/NewAction.java | 43 + .../yocto/bc/ui/views/RecipeContentProvider.java | 60 + .../src/org/yocto/bc/ui/views/RecipeView.java | 165 ++ .../bc/ui/wizards/BitbakeRecipeUIElement.java | 145 ++ .../org/yocto/bc/ui/wizards/FiniteStateWizard.java | 56 + .../yocto/bc/ui/wizards/FiniteStateWizardPage.java | 149 ++ .../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 215 ++ .../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 543 +++++ .../ui/wizards/importProject/BBCProjectPage.java | 236 +++ .../importProject/ImportYoctoProjectWizard.java | 166 ++ .../yocto/bc/ui/wizards/install/InstallWizard.java | 404 ++++ .../yocto/bc/ui/wizards/install/OptionsPage.java | 247 +++ .../BBConfigurationInitializeOperation.java | 50 + .../newproject/CreateBBCProjectOperation.java | 102 + .../yocto/bc/ui/wizards/variable/VariablePage.java | 262 +++ .../bc/ui/wizards/variable/VariableWizard.java | 43 + plugins/org.yocto.cmake.managedbuilder/.classpath | 7 + plugins/org.yocto.cmake.managedbuilder/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 16 + .../OSGI-INF/l10n/bundle.properties | 40 + .../build.properties | 7 + plugins/org.yocto.cmake.managedbuilder/plugin.xml | 283 +++ .../org/yocto/cmake/managedbuilder/Activator.java | 50 + .../YoctoCMakeMakefileGenerator.java | 281 +++ .../cmake/managedbuilder/YoctoCMakeMessages.java | 57 + .../managedbuilder/YoctoCMakeMessages.properties | 29 + .../managedbuilder/job/ExecuteConfigureJob.java | 186 ++ .../cmake/managedbuilder/util/ConsoleUtility.java | 49 + .../cmake/managedbuilder/util/SystemProcess.java | 118 ++ .../HelloWorldCCMakeProject/src/CMakeLists.txt | 34 + .../HelloWorldCCMakeProject/src/main.c | 21 + .../HelloWorldCCMakeProject/template.properties | 31 + .../HelloWorldCCMakeProject/template.xml | 61 + .../HelloWorldCPPCMakeProject/src/CMakeLists.txt | 34 + .../HelloWorldCPPCMakeProject/src/main.cpp | 21 + .../HelloWorldCPPCMakeProject/template.properties | 31 + .../HelloWorldCPPCMakeProject/template.xml | 61 + plugins/org.yocto.doc.user/.classpath | 6 + plugins/org.yocto.doc.user/.project | 28 + plugins/org.yocto.doc.user/META-INF/MANIFEST.MF | 8 + .../OSGI-INF/l10n/bundle.properties | 3 + plugins/org.yocto.doc.user/about.html.in | 189 ++ plugins/org.yocto.doc.user/build.properties | 9 + plugins/org.yocto.doc.user/html/book.css | 1 + plugins/org.yocto.doc.user/plugin.xml | 39 + plugins/org.yocto.doc.user/toc.xml | 24 + plugins/org.yocto.remote.utils/.classpath | 7 + plugins/org.yocto.remote.utils/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../org.yocto.remote.utils/META-INF/MANIFEST.MF | 27 + plugins/org.yocto.remote.utils/build.properties | 5 + .../org.yocto.remote.utils/resources/ust_tar.sh | 19 + .../org.yocto.remote.utils/resources/yocto_tool.sh | 125 ++ .../org.yocto.remote.utils/resources/yocto_ust.sh | 35 + .../src/org/yocto/remote/utils/Activator.java | 62 + .../src/org/yocto/remote/utils/CommonHelper.java | 46 + .../src/org/yocto/remote/utils/DialogRunnable.java | 26 + .../src/org/yocto/remote/utils/Messages.java | 35 + .../src/org/yocto/remote/utils/RSEHelper.java | 344 ++++ .../org/yocto/remote/utils/RemoteShellExec.java | 140 ++ .../src/org/yocto/remote/utils/ShellSession.java | 332 ++++ .../org/yocto/remote/utils/TerminalHandler.java | 132 ++ plugins/org.yocto.sdk.ide.doc.user/.classpath | 6 + plugins/org.yocto.sdk.ide.doc.user/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 8 + .../OSGI-INF/l10n/bundle.properties | 7 + .../org.yocto.sdk.ide.doc.user/build.properties | 6 + .../cheatsheets/createNewHelloWorldProject.xml | 222 +++ plugins/org.yocto.sdk.ide.doc.user/plugin.xml | 13 + plugins/org.yocto.sdk.ide/.classpath | 7 + plugins/org.yocto.sdk.ide/.project | 32 + .../.settings/org.eclipse.jdt.core.prefs | 8 + plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF | 37 + .../OSGI-INF/l10n/bundle.properties | 16 + plugins/org.yocto.sdk.ide/build.properties | 9 + plugins/org.yocto.sdk.ide/plugin.xml | 327 +++ .../sdk/ide/ProjectSpecificContributionItem.java | 69 + .../sdk/ide/TargetProfileContributionItem.java | 126 ++ .../org/yocto/sdk/ide/YoctoGeneralException.java | 32 + .../src/org/yocto/sdk/ide/YoctoProfileElement.java | 104 + .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 245 +++ .../yocto/sdk/ide/YoctoProjectSpecificSetting.java | 88 + .../src/org/yocto/sdk/ide/YoctoSDKChecker.java | 291 +++ .../src/org/yocto/sdk/ide/YoctoSDKMessages.java | 56 + .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 107 + .../src/org/yocto/sdk/ide/YoctoSDKPlugin.java | 116 ++ .../src/org/yocto/sdk/ide/YoctoUIElement.java | 161 ++ .../src/org/yocto/sdk/ide/YoctoUISetting.java | 555 ++++++ .../yocto/sdk/ide/actions/InvokeSyncAction.java | 110 + .../sdk/ide/actions/ProfileSwitchHandler.java | 134 ++ .../yocto/sdk/ide/actions/ReconfigYoctoAction.java | 44 + .../sdk/ide/actions/ReconfigYoctoHandler.java | 78 + .../org/yocto/sdk/ide/actions/YoctoConsole.java | 24 + .../natures/YoctoSDKAutotoolsProjectNature.java | 79 + .../ide/natures/YoctoSDKCMakeProjectNature.java | 92 + .../ide/natures/YoctoSDKEmptyProjectNature.java | 8 + .../yocto/sdk/ide/natures/YoctoSDKNatureUtils.java | 39 + .../sdk/ide/natures/YoctoSDKProjectNature.java | 36 + .../sdk/ide/preferences/PreferenceConstants.java | 43 + .../sdk/ide/preferences/PreferenceInitializer.java | 44 + .../ide/preferences/ProfileNameInputValidator.java | 63 + .../ide/preferences/YoctoSDKPreferencePage.java | 307 +++ .../preferences/YoctoSDKProjectPropertyPage.java | 202 ++ .../sdk/ide/utils/ProjectPreferenceUtils.java | 240 +++ .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 461 +++++ .../sdk/ide/utils/YoctoSDKUtilsConstants.java | 18 + .../NewYoctoAutotoolsProjectPostProcess.java | 81 + .../ide/wizard/NewYoctoProjectTemplateProcess.java | 270 +++ .../EmptyCAutotoolsProject/template.properties | 14 + .../EmptyCAutotoolsProject/template.xml | 17 + .../EmptyCPPAutotoolsProject/template.properties | 14 + .../EmptyCPPAutotoolsProject/template.xml | 16 + .../HelloWorldCAutotoolsProject/src/Basename.c | 9 + .../src/Basename.desktop.in.src | 9 + .../HelloWorldCAutotoolsProject/src/ChangeLog | 0 .../HelloWorldCAutotoolsProject/src/INSTALL | 9 + .../src/Makefile.am.src | 8 + .../src/Makefile.am.top | 7 + .../HelloWorldCAutotoolsProject/src/NEWS | 0 .../HelloWorldCAutotoolsProject/src/README | 25 + .../HelloWorldCAutotoolsProject/src/autogen.sh | 10 + .../src/configure.ac.top | 37 + .../template.properties | 28 + .../HelloWorldCAutotoolsProject/template.xml | 143 ++ .../HelloWorldCGTKAutotoolsProject/src/Basename.c | 50 + .../src/Basename.desktop.in.src | 9 + .../HelloWorldCGTKAutotoolsProject/src/ChangeLog | 0 .../HelloWorldCGTKAutotoolsProject/src/INSTALL | 9 + .../src/Makefile.am.src | 8 + .../src/Makefile.am.top | 7 + .../HelloWorldCGTKAutotoolsProject/src/NEWS | 0 .../HelloWorldCGTKAutotoolsProject/src/README | 25 + .../HelloWorldCGTKAutotoolsProject/src/autogen.sh | 10 + .../src/configure.ac.top | 49 + .../src/configure.ac.top.old | 37 + .../template.properties | 28 + .../HelloWorldCGTKAutotoolsProject/template.xml | 142 ++ .../HelloWorldCPPAutotoolsProject/src/Basename.cpp | 11 + .../HelloWorldCPPAutotoolsProject/src/ChangeLog | 0 .../HelloWorldCPPAutotoolsProject/src/INSTALL | 9 + .../src/Makefile.am.src | 8 + .../src/Makefile.am.top | 6 + .../HelloWorldCPPAutotoolsProject/src/NEWS | 0 .../HelloWorldCPPAutotoolsProject/src/README | 25 + .../HelloWorldCPPAutotoolsProject/src/autogen.sh | 10 + .../src/configure.ac.top | 47 + .../template.properties | 28 + .../HelloWorldCPPAutotoolsProject/template.xml | 142 ++ .../templates/projecttemplates/Licenses/AUTHORS | 1 + .../projecttemplates/Licenses/COPYING_BSD | 24 + .../projecttemplates/Licenses/COPYING_GPLv2 | 339 ++++ .../Licenses/COPYING_GPLv2_or_later | 340 ++++ .../projecttemplates/Licenses/COPYING_GPLv3 | 674 +++++++ .../projecttemplates/Licenses/COPYING_LGPLv2.1 | 502 +++++ .../projecttemplates/Licenses/COPYING_LGPLv3 | 165 ++ .../projecttemplates/Licenses/COPYING_MIT | 19 + .../projecttemplates/Licenses/COPYING_Other | 1 + .../templates/projecttemplates/Licenses/Header_BSD | 29 + .../projecttemplates/Licenses/Header_GPLv2 | 19 + .../Licenses/Header_GPLv2_or_later | 21 + .../projecttemplates/Licenses/Header_GPLv3 | 19 + .../projecttemplates/Licenses/Header_LGPLv2.1 | 20 + .../projecttemplates/Licenses/Header_LGPLv3 | 20 + .../templates/projecttemplates/Licenses/Header_MIT | 24 + .../projecttemplates/Licenses/Header_Other | 9 + plugins/org.yocto.sdk.remotetools/.classpath | 8 + plugins/org.yocto.sdk.remotetools/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../org.yocto.sdk.remotetools/META-INF/MANIFEST.MF | 29 + .../json-simple/pom.properties | 5 + .../com.googlecode.json-simple/json-simple/pom.xml | 65 + .../OSGI-INF/l10n/bundle.properties | 12 + plugins/org.yocto.sdk.remotetools/build.properties | 10 + plugins/org.yocto.sdk.remotetools/icons/sample.gif | Bin 0 -> 983 bytes .../lib/json-simple-1.1.1.jar | Bin 0 -> 23737 bytes plugins/org.yocto.sdk.remotetools/plugin.xml | 142 ++ .../src/org/yocto/sdk/remotetools/Activator.java | 79 + .../src/org/yocto/sdk/remotetools/LocalJob.java | 101 + .../src/org/yocto/sdk/remotetools/Messages.java | 62 + .../src/org/yocto/sdk/remotetools/SWTFactory.java | 642 ++++++ .../org/yocto/sdk/remotetools/YoctoBspElement.java | 88 + .../sdk/remotetools/YoctoBspPropertyElement.java | 65 + .../org/yocto/sdk/remotetools/YoctoJSONHelper.java | 89 + .../yocto/sdk/remotetools/actions/BaseModel.java | 123 ++ .../sdk/remotetools/actions/BaseSettingDialog.java | 216 ++ .../sdk/remotetools/actions/DialogHandler.java | 42 + .../sdk/remotetools/actions/IBaseConstants.java | 27 + .../sdk/remotetools/actions/LatencytopHandler.java | 35 + .../sdk/remotetools/actions/OprofileHandler.java | 55 + .../sdk/remotetools/actions/OprofileModel.java | 171 ++ .../yocto/sdk/remotetools/actions/PerfHandler.java | 30 + .../sdk/remotetools/actions/PowertopHandler.java | 48 + .../sdk/remotetools/actions/PowertopModel.java | 109 + .../remotetools/actions/PowertopSettingDialog.java | 131 ++ .../remotetools/actions/SimpleSettingDialog.java | 54 + .../sdk/remotetools/actions/SystemtapHandler.java | 70 + .../sdk/remotetools/actions/SystemtapModel.java | 88 + .../actions/SystemtapSettingDialog.java | 280 +++ .../yocto/sdk/remotetools/actions/Ust2Handler.java | 59 + .../yocto/sdk/remotetools/actions/Ust2Model.java | 166 ++ .../sdk/remotetools/actions/Ust2SettingDialog.java | 104 + .../remotetools/actions/UstSettingDialogBase.java | 170 ++ .../sdk/remotetools/actions/YoctoBspHandler.java | 38 + .../org/yocto/sdk/remotetools/messages.properties | 49 + .../yocto/sdk/remotetools/views/BaseFileView.java | 140 ++ .../sdk/remotetools/views/TerminalViewTab.java | 457 +++++ .../sdk/remotetools/views/TerminalViewer.java | 139 ++ .../sdk/remotetools/wizards/bsp/BSPAction.java | 32 + .../remotetools/wizards/bsp/BSPProgressDialog.java | 47 + .../sdk/remotetools/wizards/bsp/BSPThread.java | 92 + .../wizards/bsp/ErrorCollectorThread.java | 19 + .../remotetools/wizards/bsp/KernelArchGetter.java | 23 + .../wizards/bsp/KernelBranchesGetter.java | 28 + .../sdk/remotetools/wizards/bsp/MainPage.java | 498 +++++ .../wizards/bsp/OutputCollectorThread.java | 19 + .../remotetools/wizards/bsp/PropertiesPage.java | 498 +++++ .../remotetools/wizards/bsp/QemuArchGetter.java | 27 + .../remotetools/wizards/bsp/YoctoBSPWizard.java | 99 + scripts/build.sh | 173 ++ scripts/find-version | 62 + scripts/generate-doc.sh | 88 + scripts/readme.txt | 71 + scripts/setup.sh | 226 +++ tcf/lke_rse_tcf.patch | 2097 ++++++++++++++++++++ tcf/readme | 175 ++ tcf/terminals_agent.patch | 1042 ++++++++++ tcf/terminals_plugin.patch | 618 ++++++ 344 files changed, 33456 insertions(+) create mode 100644 .gitignore create mode 100644 features/org.yocto.bc.headless.build/.project create mode 100644 features/org.yocto.bc.headless.build/build.properties create mode 100644 features/org.yocto.bc.headless.build/customTargets.xml create mode 100644 features/org.yocto.bc/.project create mode 100644 features/org.yocto.bc/build.properties create mode 100644 features/org.yocto.bc/feature.properties create mode 100644 features/org.yocto.bc/feature.xml create mode 100644 features/org.yocto.bc/license.html create mode 100644 features/org.yocto.doc.headless.build/.project create mode 100644 features/org.yocto.doc.headless.build/build.properties create mode 100644 features/org.yocto.doc.headless.build/customTargets.xml create mode 100644 features/org.yocto.doc/.project create mode 100644 features/org.yocto.doc/build.properties create mode 100644 features/org.yocto.doc/feature.properties create mode 100644 features/org.yocto.doc/feature.xml create mode 100644 features/org.yocto.doc/license.html create mode 100644 features/org.yocto.sdk.headless.build/.project create mode 100644 features/org.yocto.sdk.headless.build/build.properties create mode 100644 features/org.yocto.sdk.headless.build/customTargets.xml create mode 100644 features/org.yocto.sdk.site/.project create mode 100644 features/org.yocto.sdk.site/category.xml create mode 100644 features/org.yocto.sdk.site/index.html create mode 100644 features/org.yocto.sdk.site/site.xml create mode 100644 features/org.yocto.sdk.site/web/site.css create mode 100644 features/org.yocto.sdk.site/web/site.xsl create mode 100644 features/org.yocto.sdk/.project create mode 100644 features/org.yocto.sdk/build.properties create mode 100644 features/org.yocto.sdk/feature.properties create mode 100644 features/org.yocto.sdk/feature.xml create mode 100644 features/org.yocto.sdk/license.html create mode 100644 features/org.yocto.sdk/sourceTemplateFeature/feature.properties create mode 100644 features/org.yocto.sdk/sourceTemplateFeature/license.html create mode 100644 features/org.yocto.sdk/sourceTemplatePlugin/license.html create mode 100644 features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties create mode 100644 plugins/org.yocto.bc.ui/.classpath create mode 100644 plugins/org.yocto.bc.ui/.project create mode 100644 plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF create mode 100644 plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties create mode 100644 plugins/org.yocto.bc.ui/build.properties create mode 100644 plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg create mode 100644 plugins/org.yocto.bc.ui/icons/BUG_logo_128.png create mode 100644 plugins/org.yocto.bc.ui/icons/OE_logo_128.png create mode 100644 plugins/org.yocto.bc.ui/icons/OE_logo_64.png create mode 100644 plugins/org.yocto.bc.ui/icons/OE_logo_96.png create mode 100644 plugins/org.yocto.bc.ui/icons/OE_logo_full.png create mode 100644 plugins/org.yocto.bc.ui/icons/beagle_128.png create mode 100644 plugins/org.yocto.bc.ui/icons/binary.gif create mode 100644 plugins/org.yocto.bc.ui/icons/cf_obj.gif create mode 100644 plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif create mode 100644 plugins/org.yocto.bc.ui/icons/clean.gif create mode 100644 plugins/org.yocto.bc.ui/icons/details_view.gif create mode 100644 plugins/org.yocto.bc.ui/icons/function.gif create mode 100644 plugins/org.yocto.bc.ui/icons/icon16_OE.gif create mode 100644 plugins/org.yocto.bc.ui/icons/import_wiz.gif create mode 100644 plugins/org.yocto.bc.ui/icons/importdir_wiz.png create mode 100644 plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif create mode 100644 plugins/org.yocto.bc.ui/icons/oe_decorator.gif create mode 100644 plugins/org.yocto.bc.ui/icons/poky_128.png create mode 100644 plugins/org.yocto.bc.ui/icons/read_only.gif create mode 100644 plugins/org.yocto.bc.ui/icons/refresh.gif create mode 100644 plugins/org.yocto.bc.ui/icons/releng_gears.gif create mode 100644 plugins/org.yocto.bc.ui/icons/sample.gif create mode 100644 plugins/org.yocto.bc.ui/icons/sample_decorator.gif create mode 100644 plugins/org.yocto.bc.ui/icons/topic.gif create mode 100644 plugins/org.yocto.bc.ui/icons/trash.gif create mode 100644 plugins/org.yocto.bc.ui/icons/variable.gif create mode 100644 plugins/org.yocto.bc.ui/icons/watchlist_view.gif create mode 100644 plugins/org.yocto.bc.ui/local.conf create mode 100644 plugins/org.yocto.bc.ui/plugin.xml create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ICommandResponseHandler.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/AbstractBitbakeCommandAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeBuildRecipeAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeCleanRecipeAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeImportAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeRebuildRecipeAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java create mode 100644 plugins/org.yocto.cmake.managedbuilder/.classpath create mode 100644 plugins/org.yocto.cmake.managedbuilder/.project create mode 100644 plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF create mode 100644 plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties create mode 100644 plugins/org.yocto.cmake.managedbuilder/build.properties create mode 100644 plugins/org.yocto.cmake.managedbuilder/plugin.xml create mode 100644 plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java create mode 100644 plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java create mode 100644 plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java create mode 100644 plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties create mode 100644 plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java create mode 100644 plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java create mode 100644 plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml create mode 100644 plugins/org.yocto.doc.user/.classpath create mode 100644 plugins/org.yocto.doc.user/.project create mode 100644 plugins/org.yocto.doc.user/META-INF/MANIFEST.MF create mode 100644 plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties create mode 100644 plugins/org.yocto.doc.user/about.html.in create mode 100644 plugins/org.yocto.doc.user/build.properties create mode 100644 plugins/org.yocto.doc.user/html/book.css create mode 100644 plugins/org.yocto.doc.user/plugin.xml create mode 100644 plugins/org.yocto.doc.user/toc.xml create mode 100644 plugins/org.yocto.remote.utils/.classpath create mode 100644 plugins/org.yocto.remote.utils/.project create mode 100644 plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF create mode 100644 plugins/org.yocto.remote.utils/build.properties create mode 100755 plugins/org.yocto.remote.utils/resources/ust_tar.sh create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_tool.sh create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_ust.sh create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java create mode 100644 plugins/org.yocto.sdk.ide.doc.user/.classpath create mode 100644 plugins/org.yocto.sdk.ide.doc.user/.project create mode 100644 plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF create mode 100644 plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties create mode 100644 plugins/org.yocto.sdk.ide.doc.user/build.properties create mode 100644 plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml create mode 100644 plugins/org.yocto.sdk.ide.doc.user/plugin.xml create mode 100644 plugins/org.yocto.sdk.ide/.classpath create mode 100644 plugins/org.yocto.sdk.ide/.project create mode 100644 plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF create mode 100644 plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties create mode 100644 plugins/org.yocto.sdk.ide/build.properties create mode 100644 plugins/org.yocto.sdk.ide/plugin.xml create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README create mode 100755 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README create mode 100755 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README create mode 100755 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv3 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.1 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv3 create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT create mode 100644 plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other create mode 100644 plugins/org.yocto.sdk.remotetools/.classpath create mode 100644 plugins/org.yocto.sdk.remotetools/.project create mode 100644 plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs create mode 100644 plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF create mode 100644 plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties create mode 100644 plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml create mode 100644 plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties create mode 100644 plugins/org.yocto.sdk.remotetools/build.properties create mode 100644 plugins/org.yocto.sdk.remotetools/icons/sample.gif create mode 100644 plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar create mode 100644 plugins/org.yocto.sdk.remotetools/plugin.xml create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java create mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java create mode 100755 scripts/build.sh create mode 100755 scripts/find-version create mode 100755 scripts/generate-doc.sh create mode 100644 scripts/readme.txt create mode 100755 scripts/setup.sh create mode 100644 tcf/lke_rse_tcf.patch create mode 100644 tcf/readme create mode 100644 tcf/terminals_agent.patch create mode 100644 tcf/terminals_plugin.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba077a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bin diff --git a/features/org.yocto.bc.headless.build/.project b/features/org.yocto.bc.headless.build/.project new file mode 100644 index 0000000..672fcda --- /dev/null +++ b/features/org.yocto.bc.headless.build/.project @@ -0,0 +1,11 @@ + + + org.yocto.bc.headless.build + + + + + + + + diff --git a/features/org.yocto.bc.headless.build/build.properties b/features/org.yocto.bc.headless.build/build.properties new file mode 100644 index 0000000..9d9a9cc --- /dev/null +++ b/features/org.yocto.bc.headless.build/build.properties @@ -0,0 +1,262 @@ +############################################################################### +# Copyright (c) 2003, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +##################### +# Parameters describing how and where to execute the build. +# Typical users need only update the following properties: +# baseLocation - where things you are building against are installed +# bootclasspath - The base jars to compile against (typicaly rt.jar) +# configs - the list of {os, ws, arch} configurations to build. +# +# Of course any of the settings here can be overridden by spec'ing +# them on the command line (e.g., -DbaseLocation=d:/eclipse + +#The type of the top level element we are building, generally "feature" +topLevelElementType = feature +#The id of the top level element we are building +topLevelElementId = org.yocto.bc + +############# PRODUCT/PACKAGING CONTROL ############# +product=/plugin or feature id/path/to/.product +runPackager=true + +#Set the name of the archive that will result from the product build. +#archiveNamePrefix= + +# The prefix that will be used in the generated archive. +archivePrefix=eclipse + +# The location underwhich all of the build output will be collected. +collectingFolder=${archivePrefix} + +# The list of {os, ws, arch} configurations to build. This +# value is a '&' separated list of ',' separate triples. For example, +# configs=win32,win32,x86 & linux,motif,x86 +# By default the value is *,*,* +configs = *, *, * +#configs=win32, win32, x86 & \ +# win32,win32,x86_64 & \ +# win32,win32,wpf & \ +# linux, gtk, ppc & \ +# linux, gtk, x86 & \ +# linux, gtk, x86_64 & \ +# linux, motif, x86 & \ +# solaris, motif, sparc & \ +# solaris, gtk, sparc & \ +# aix, motif, ppc & \ +# hpux, motif, ia64_32 & \ +# macosx, carbon, ppc & \ +# macosx, carbon, x86 & \ +# macosx, cocoa, ppc & \ +# macosx, cocoa, x86 & \ +# macosx, cocoa, x86_64 + +# By default PDE creates one archive (result) per entry listed in the configs property. +# Setting this value to true will cause PDE to only create one output containing all +# artifacts for all the platforms listed in the configs property. +# To control the output format for the group, add a "group, group, group - " entry to the +# archivesFormat. +#groupConfigurations=true + +#The format of the archive. By default a zip is created using antZip. +#The list can only contain the configuration for which the desired format is different than zip. +#archivesFormat=win32, win32, x86 - antZip& \ +# linux, gtk, ppc - antZip &\ +# linux, gtk, x86 - antZip& \ +# linux, gtk, x86_64 - antZip& \ +# linux, motif, x86 - antZip& \ +# solaris, motif, sparc - antZip& \ +# solaris, gtk, sparc - antZip& \ +# aix, motif, ppc - antZip& \ +# hpux, motif, PA_RISC - antZip& \ +# macosx, carbon, ppc - antZip + +#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. +allowBinaryCycles = true + +#Sort bundles depenedencies across all features instead of just within a given feature. +#flattenDependencies = true + +#Parallel compilation, requires flattenedDependencies=true +#parallelCompilation=true +#parallelThreadCount= +#parallelThreadsPerProcessor= + +#Set to true if you want the output to be ready for an update jar (no site.xml generated) +outputUpdateJars = true + +#Set to true for Jnlp generation +#codebase should be a URL that will be used as the root of all relative URLs in the output. +#generateJnlp=false +#jnlp.codebase= +#jnlp.j2se= +#jnlp.locale= +#jnlp.generateOfflineAllowed=true or false generate attribute in the generated features +#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built + +#Set to true if you want to sign jars +#signJars=false +#sign.alias= +#sign.keystore= +#sign.storepass= +#sign.keypass= + +#Arguments to send to the zip executable +zipargs= + +#Arguments to send to the tar executable +tarargs= + +#Control the creation of a file containing the version included in each configuration - on by default +#generateVersionsLists=false + +############## BUILD NAMING CONTROL ################ +# The directory into which the build elements are fetched and where +# the build takes place. +#buildDirectory= + +# Type of build. Used in naming the build output. Typically this value is +# one of I, N, M, S, ... +buildType=I + +# ID of the build. Used in naming the build output. +buildId=TestBuild + +# Label for the build. Used in naming the build output +buildLabel=${buildType}.${buildId} + +# Timestamp for the build. Used in naming the build output +timestamp=007 + +#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. +#The value will only be applied to plugin or features indicating build.properties, qualifier = context +#forceContextQualifier= + +#Enable / disable the generation of a suffix for the features that use .qualifier. +#The generated suffix is computed according to the content of the feature +#generateFeatureVersionSuffix=true + +############# BASE CONTROL ############# +# Settings for the base Eclipse components and Java class libraries +# against which you are building. +# Base location for anything the build needs to compile against. For example, +# in most RCP app or a plug-in, the baseLocation should be the location of a previously +# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. + +#base= +#baseLocation=${base}/eclipse + +#Folder containing repositories whose content is needed to compile against +#repoBaseLocation=${base}/repos +#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against +#transformedRepoLocation=${base}/transformedRepos + +#Os/Ws/Arch/nl of the eclipse specified by baseLocation +#baseos=win32 +#basews=win32 +#basearch=x86 + +#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built +filteredDependencyCheck=false + +#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) +resolution.devMode=false + +#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) +#a location is one of: +#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo +#- a directory that contains a /plugins or /features subdirectory +#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml +#pluginPath= + +skipBase=true +eclipseURL= +eclipseBuildId= +eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip + + +############# MAP FILE CONTROL ################ +# This section defines CVS tags to use when fetching the map files from the repository. +# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml + +skipMaps=true +mapsRepo=:pserver:anonymous@example.com/path/to/repo +mapsRoot=path/to/maps +mapsCheckoutTag=HEAD + +#tagMaps=true +mapsTagTag=v${buildId} + + +############ REPOSITORY CONTROL ############### +# This section defines properties parameterizing the repositories where plugins, fragments +# bundles and features are being obtained from. + +# The tags to use when fetching elements to build. +# By default thebuilder will use whatever is in the maps. +# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the +# overriding value +# For example fetchTag=CVS=HEAD, SVN=v20050101 +# fetchTag=HEAD +skipFetch=true + + +############# JAVA COMPILER OPTIONS ############## +# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE +#bootclasspath=${java.home}/lib/rt.jar + +# specific JRE locations to compile against. These values are used to compile bundles specifying a +# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support +#CDC-1.0/Foundation-1.0= /path/to/rt.jar +#CDC-1.1/Foundation-1.1= +#OSGi/Minimum-1.0= +#OSGi/Minimum-1.1= +#JRE-1.1= +#J2SE-1.2= +#J2SE-1.3= +#J2SE-1.4= +#J2SE-1.5= +#JavaSE-1.6= +#PersonalJava-1.1= +#PersonalJava-1.2= +#CDC-1.0/PersonalBasis-1.0= +#CDC-1.0/PersonalJava-1.0= +#CDC-1.1/PersonalBasis-1.1= +#CDC-1.1/PersonalJava-1.1= + +# Specify the output format of the compiler log when eclipse jdt is used +logExtension=.log + +# Whether or not to include debug info in the output jars +javacDebugInfo=false + +# Whether or not to fail the build if there are compiler errors +javacFailOnError=true + +# Enable or disable verbose mode of the compiler +javacVerbose=true + +# Extra arguments for the compiler. These are specific to the java compiler being used. +#compilerArg= + +# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties +javacSource=1.6 + +# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. +javacTarget=1.6 + +#individualSourceBundles=true + +#p2.gathering=true +p2.compress=true +#p2.category.site=file:${buildDirectory}/site.xml +p2.category.definition=file:${buildDirectory}/category.xml +p2.metadata.repo.name=Yocto Project Update Site +p2.artifact.repo.name=Yocto Project Update Site diff --git a/features/org.yocto.bc.headless.build/customTargets.xml b/features/org.yocto.bc.headless.build/customTargets.xml new file mode 100644 index 0000000..b6d7ed7 --- /dev/null +++ b/features/org.yocto.bc.headless.build/customTargets.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.yocto.bc/.project b/features/org.yocto.bc/.project new file mode 100644 index 0000000..553c486 --- /dev/null +++ b/features/org.yocto.bc/.project @@ -0,0 +1,17 @@ + + + org.yocto.bc + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/features/org.yocto.bc/build.properties b/features/org.yocto.bc/build.properties new file mode 100644 index 0000000..52c3cfc --- /dev/null +++ b/features/org.yocto.bc/build.properties @@ -0,0 +1,3 @@ +bin.includes = feature.xml,\ + license.html,\ + feature.properties diff --git a/features/org.yocto.bc/feature.properties b/features/org.yocto.bc/feature.properties new file mode 100644 index 0000000..71cd52d --- /dev/null +++ b/features/org.yocto.bc/feature.properties @@ -0,0 +1,163 @@ +############################################################################### +# Copyright (c) 2010 Intel, Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Intel - initial implementation +############################################################################### + +# "featureName" property - name of the feature +featureName=Yocto Project Bitbake Commander Plug-in + +# "providerName" property - name of the company that provides the feature +providerName=yoctoproject.org + +# "updateSiteName" property - label for the update site +updateSiteName=Yocto Project Update Site + +# "description" property - description of the feature +description=\ +Eclipse plug-in for developing bitbake commander project using Yocto Project + +# copyright +copyright=\ +Copyright (c) 2012 Intel, Inc. and others. \ +All rights reserved. This program and the accompanying materials \ +are made available under the terms of the Eclipse Public License v1.0 \ +which accompanies this distribution, and is available at \ +http://www.eclipse.org/legal/epl-v10.html +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +April 14, 2010\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/features/org.yocto.bc/feature.xml b/features/org.yocto.bc/feature.xml new file mode 100644 index 0000000..9ce7353 --- /dev/null +++ b/features/org.yocto.bc/feature.xml @@ -0,0 +1,42 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.yocto.bc/license.html b/features/org.yocto.bc/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.bc/license.html @@ -0,0 +1,107 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

Eclipse Foundation Software User Agreement

+

April 14, 2010

+ +

Usage Of Content

+ +

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

+ +

Applicable Licenses

+ +

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

+ +

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

+ +
    +
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • +
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • +
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
  • +
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • +
+ +

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

+ +
    +
  • The top-level (root) directory
  • +
  • Plug-in and Fragment directories
  • +
  • Inside Plug-ins and Fragments packaged as JARs
  • +
  • Sub-directories of the directory named "src" of certain Plug-ins
  • +
  • Feature directories
  • +
+ +

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

+ +

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

+ + + +

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

+ + +

Use of Provisioning Technology

+ +

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

+ +

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

+ +
    +
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
  2. +
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
  4. +
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. +
+ +

Cryptography

+ +

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

+ +

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

+ + diff --git a/features/org.yocto.doc.headless.build/.project b/features/org.yocto.doc.headless.build/.project new file mode 100644 index 0000000..106c772 --- /dev/null +++ b/features/org.yocto.doc.headless.build/.project @@ -0,0 +1,11 @@ + + + org.yocto.doc.headless.build + + + + + + + + diff --git a/features/org.yocto.doc.headless.build/build.properties b/features/org.yocto.doc.headless.build/build.properties new file mode 100644 index 0000000..6a857f8 --- /dev/null +++ b/features/org.yocto.doc.headless.build/build.properties @@ -0,0 +1,262 @@ +############################################################################### +# Copyright (c) 2003, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +##################### +# Parameters describing how and where to execute the build. +# Typical users need only update the following properties: +# baseLocation - where things you are building against are installed +# bootclasspath - The base jars to compile against (typicaly rt.jar) +# configs - the list of {os, ws, arch} configurations to build. +# +# Of course any of the settings here can be overridden by spec'ing +# them on the command line (e.g., -DbaseLocation=d:/eclipse + +#The type of the top level element we are building, generally "feature" +topLevelElementType = feature +#The id of the top level element we are building +topLevelElementId = org.yocto.doc + +############# PRODUCT/PACKAGING CONTROL ############# +product=/plugin or feature id/path/to/.product +runPackager=true + +#Set the name of the archive that will result from the product build. +#archiveNamePrefix= + +# The prefix that will be used in the generated archive. +archivePrefix=eclipse + +# The location underwhich all of the build output will be collected. +collectingFolder=${archivePrefix} + +# The list of {os, ws, arch} configurations to build. This +# value is a '&' separated list of ',' separate triples. For example, +# configs=win32,win32,x86 & linux,motif,x86 +# By default the value is *,*,* +configs = *, *, * +#configs=win32, win32, x86 & \ +# win32,win32,x86_64 & \ +# win32,win32,wpf & \ +# linux, gtk, ppc & \ +# linux, gtk, x86 & \ +# linux, gtk, x86_64 & \ +# linux, motif, x86 & \ +# solaris, motif, sparc & \ +# solaris, gtk, sparc & \ +# aix, motif, ppc & \ +# hpux, motif, ia64_32 & \ +# macosx, carbon, ppc & \ +# macosx, carbon, x86 & \ +# macosx, cocoa, ppc & \ +# macosx, cocoa, x86 & \ +# macosx, cocoa, x86_64 + +# By default PDE creates one archive (result) per entry listed in the configs property. +# Setting this value to true will cause PDE to only create one output containing all +# artifacts for all the platforms listed in the configs property. +# To control the output format for the group, add a "group, group, group - " entry to the +# archivesFormat. +#groupConfigurations=true + +#The format of the archive. By default a zip is created using antZip. +#The list can only contain the configuration for which the desired format is different than zip. +#archivesFormat=win32, win32, x86 - antZip& \ +# linux, gtk, ppc - antZip &\ +# linux, gtk, x86 - antZip& \ +# linux, gtk, x86_64 - antZip& \ +# linux, motif, x86 - antZip& \ +# solaris, motif, sparc - antZip& \ +# solaris, gtk, sparc - antZip& \ +# aix, motif, ppc - antZip& \ +# hpux, motif, PA_RISC - antZip& \ +# macosx, carbon, ppc - antZip + +#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. +allowBinaryCycles = true + +#Sort bundles depenedencies across all features instead of just within a given feature. +#flattenDependencies = true + +#Parallel compilation, requires flattenedDependencies=true +#parallelCompilation=true +#parallelThreadCount= +#parallelThreadsPerProcessor= + +#Set to true if you want the output to be ready for an update jar (no site.xml generated) +outputUpdateJars = true + +#Set to true for Jnlp generation +#codebase should be a URL that will be used as the root of all relative URLs in the output. +#generateJnlp=false +#jnlp.codebase= +#jnlp.j2se= +#jnlp.locale= +#jnlp.generateOfflineAllowed=true or false generate attribute in the generated features +#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built + +#Set to true if you want to sign jars +#signJars=false +#sign.alias= +#sign.keystore= +#sign.storepass= +#sign.keypass= + +#Arguments to send to the zip executable +zipargs= + +#Arguments to send to the tar executable +tarargs= + +#Control the creation of a file containing the version included in each configuration - on by default +#generateVersionsLists=false + +############## BUILD NAMING CONTROL ################ +# The directory into which the build elements are fetched and where +# the build takes place. +#buildDirectory= + +# Type of build. Used in naming the build output. Typically this value is +# one of I, N, M, S, ... +buildType=I + +# ID of the build. Used in naming the build output. +buildId=TestBuild + +# Label for the build. Used in naming the build output +buildLabel=${buildType}.${buildId} + +# Timestamp for the build. Used in naming the build output +timestamp=007 + +#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. +#The value will only be applied to plugin or features indicating build.properties, qualifier = context +#forceContextQualifier= + +#Enable / disable the generation of a suffix for the features that use .qualifier. +#The generated suffix is computed according to the content of the feature +#generateFeatureVersionSuffix=true + +############# BASE CONTROL ############# +# Settings for the base Eclipse components and Java class libraries +# against which you are building. +# Base location for anything the build needs to compile against. For example, +# in most RCP app or a plug-in, the baseLocation should be the location of a previously +# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. + +#base= +#baseLocation=${base}/eclipse + +#Folder containing repositories whose content is needed to compile against +#repoBaseLocation=${base}/repos +#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against +#transformedRepoLocation=${base}/transformedRepos + +#Os/Ws/Arch/nl of the eclipse specified by baseLocation +#baseos=win32 +#basews=win32 +#basearch=x86 + +#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built +filteredDependencyCheck=false + +#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) +resolution.devMode=false + +#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) +#a location is one of: +#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo +#- a directory that contains a /plugins or /features subdirectory +#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml +#pluginPath= + +skipBase=true +eclipseURL= +eclipseBuildId= +eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip + + +############# MAP FILE CONTROL ################ +# This section defines CVS tags to use when fetching the map files from the repository. +# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml + +skipMaps=true +mapsRepo=:pserver:anonymous@example.com/path/to/repo +mapsRoot=path/to/maps +mapsCheckoutTag=HEAD + +#tagMaps=true +mapsTagTag=v${buildId} + + +############ REPOSITORY CONTROL ############### +# This section defines properties parameterizing the repositories where plugins, fragments +# bundles and features are being obtained from. + +# The tags to use when fetching elements to build. +# By default thebuilder will use whatever is in the maps. +# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the +# overriding value +# For example fetchTag=CVS=HEAD, SVN=v20050101 +# fetchTag=HEAD +skipFetch=true + + +############# JAVA COMPILER OPTIONS ############## +# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE +#bootclasspath=${java.home}/lib/rt.jar + +# specific JRE locations to compile against. These values are used to compile bundles specifying a +# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support +#CDC-1.0/Foundation-1.0= /path/to/rt.jar +#CDC-1.1/Foundation-1.1= +#OSGi/Minimum-1.0= +#OSGi/Minimum-1.1= +#JRE-1.1= +#J2SE-1.2= +#J2SE-1.3= +#J2SE-1.4= +#J2SE-1.5= +#JavaSE-1.6= +#PersonalJava-1.1= +#PersonalJava-1.2= +#CDC-1.0/PersonalBasis-1.0= +#CDC-1.0/PersonalJava-1.0= +#CDC-1.1/PersonalBasis-1.1= +#CDC-1.1/PersonalJava-1.1= + +# Specify the output format of the compiler log when eclipse jdt is used +logExtension=.log + +# Whether or not to include debug info in the output jars +javacDebugInfo=false + +# Whether or not to fail the build if there are compiler errors +javacFailOnError=true + +# Enable or disable verbose mode of the compiler +javacVerbose=true + +# Extra arguments for the compiler. These are specific to the java compiler being used. +#compilerArg= + +# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties +javacSource=1.6 + +# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. +javacTarget=1.6 + +#individualSourceBundles=true + +#p2.gathering=true +p2.compress=true +#p2.category.site=file:${buildDirectory}/site.xml +p2.category.definition=file:${buildDirectory}/category.xml +p2.metadata.repo.name=Yocto Project Update Site +p2.artifact.repo.name=Yocto Project Update Site diff --git a/features/org.yocto.doc.headless.build/customTargets.xml b/features/org.yocto.doc.headless.build/customTargets.xml new file mode 100644 index 0000000..8cb505e --- /dev/null +++ b/features/org.yocto.doc.headless.build/customTargets.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.yocto.doc/.project b/features/org.yocto.doc/.project new file mode 100644 index 0000000..2ad46a8 --- /dev/null +++ b/features/org.yocto.doc/.project @@ -0,0 +1,17 @@ + + + org.yocto.doc + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/features/org.yocto.doc/build.properties b/features/org.yocto.doc/build.properties new file mode 100644 index 0000000..52c3cfc --- /dev/null +++ b/features/org.yocto.doc/build.properties @@ -0,0 +1,3 @@ +bin.includes = feature.xml,\ + license.html,\ + feature.properties diff --git a/features/org.yocto.doc/feature.properties b/features/org.yocto.doc/feature.properties new file mode 100644 index 0000000..46883e8 --- /dev/null +++ b/features/org.yocto.doc/feature.properties @@ -0,0 +1,163 @@ +############################################################################### +# Copyright (c) 2010 Intel, Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Intel - initial implementation +############################################################################### + +# "featureName" property - name of the feature +featureName=Yocto Project Documentation Plug-in + +# "providerName" property - name of the company that provides the feature +providerName=yoctoproject.org + +# "updateSiteName" property - label for the update site +updateSiteName=Yocto Project Update Site + +# "description" property - description of the feature +description=\ +Eclipse plug-in containing the documentation of the Yocto Project + +# copyright +copyright=\ +Copyright (c) 2013 Intel, Inc. and others. \ +All rights reserved. This program and the accompanying materials \ +are made available under the terms of the Eclipse Public License v1.0 \ +which accompanies this distribution, and is available at \ +http://www.eclipse.org/legal/epl-v10.html +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +April 14, 2010\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/features/org.yocto.doc/feature.xml b/features/org.yocto.doc/feature.xml new file mode 100644 index 0000000..ed8687e --- /dev/null +++ b/features/org.yocto.doc/feature.xml @@ -0,0 +1,35 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + diff --git a/features/org.yocto.doc/license.html b/features/org.yocto.doc/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.doc/license.html @@ -0,0 +1,107 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

Eclipse Foundation Software User Agreement

+

April 14, 2010

+ +

Usage Of Content

+ +

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

+ +

Applicable Licenses

+ +

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

+ +

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

+ +
    +
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • +
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • +
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
  • +
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • +
+ +

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

+ +
    +
  • The top-level (root) directory
  • +
  • Plug-in and Fragment directories
  • +
  • Inside Plug-ins and Fragments packaged as JARs
  • +
  • Sub-directories of the directory named "src" of certain Plug-ins
  • +
  • Feature directories
  • +
+ +

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

+ +

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

+ + + +

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

+ + +

Use of Provisioning Technology

+ +

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

+ +

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

+ +
    +
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
  2. +
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
  4. +
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. +
+ +

Cryptography

+ +

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

+ +

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

+ + diff --git a/features/org.yocto.sdk.headless.build/.project b/features/org.yocto.sdk.headless.build/.project new file mode 100644 index 0000000..f796e80 --- /dev/null +++ b/features/org.yocto.sdk.headless.build/.project @@ -0,0 +1,11 @@ + + + org.yocto.sdk.headless.build + + + + + + + + diff --git a/features/org.yocto.sdk.headless.build/build.properties b/features/org.yocto.sdk.headless.build/build.properties new file mode 100644 index 0000000..5a9b637 --- /dev/null +++ b/features/org.yocto.sdk.headless.build/build.properties @@ -0,0 +1,262 @@ +############################################################################### +# Copyright (c) 2003, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +##################### +# Parameters describing how and where to execute the build. +# Typical users need only update the following properties: +# baseLocation - where things you are building against are installed +# bootclasspath - The base jars to compile against (typicaly rt.jar) +# configs - the list of {os, ws, arch} configurations to build. +# +# Of course any of the settings here can be overridden by spec'ing +# them on the command line (e.g., -DbaseLocation=d:/eclipse + +#The type of the top level element we are building, generally "feature" +topLevelElementType = feature +#The id of the top level element we are building +topLevelElementId = org.yocto.sdk + +############# PRODUCT/PACKAGING CONTROL ############# +product=/plugin or feature id/path/to/.product +runPackager=true + +#Set the name of the archive that will result from the product build. +#archiveNamePrefix= + +# The prefix that will be used in the generated archive. +archivePrefix=eclipse + +# The location underwhich all of the build output will be collected. +collectingFolder=${archivePrefix} + +# The list of {os, ws, arch} configurations to build. This +# value is a '&' separated list of ',' separate triples. For example, +# configs=win32,win32,x86 & linux,motif,x86 +# By default the value is *,*,* +configs = *, *, * +#configs=win32, win32, x86 & \ +# win32,win32,x86_64 & \ +# win32,win32,wpf & \ +# linux, gtk, ppc & \ +# linux, gtk, x86 & \ +# linux, gtk, x86_64 & \ +# linux, motif, x86 & \ +# solaris, motif, sparc & \ +# solaris, gtk, sparc & \ +# aix, motif, ppc & \ +# hpux, motif, ia64_32 & \ +# macosx, carbon, ppc & \ +# macosx, carbon, x86 & \ +# macosx, cocoa, ppc & \ +# macosx, cocoa, x86 & \ +# macosx, cocoa, x86_64 + +# By default PDE creates one archive (result) per entry listed in the configs property. +# Setting this value to true will cause PDE to only create one output containing all +# artifacts for all the platforms listed in the configs property. +# To control the output format for the group, add a "group, group, group - " entry to the +# archivesFormat. +#groupConfigurations=true + +#The format of the archive. By default a zip is created using antZip. +#The list can only contain the configuration for which the desired format is different than zip. +#archivesFormat=win32, win32, x86 - antZip& \ +# linux, gtk, ppc - antZip &\ +# linux, gtk, x86 - antZip& \ +# linux, gtk, x86_64 - antZip& \ +# linux, motif, x86 - antZip& \ +# solaris, motif, sparc - antZip& \ +# solaris, gtk, sparc - antZip& \ +# aix, motif, ppc - antZip& \ +# hpux, motif, PA_RISC - antZip& \ +# macosx, carbon, ppc - antZip + +#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. +allowBinaryCycles = true + +#Sort bundles depenedencies across all features instead of just within a given feature. +#flattenDependencies = true + +#Parallel compilation, requires flattenedDependencies=true +#parallelCompilation=true +#parallelThreadCount= +#parallelThreadsPerProcessor= + +#Set to true if you want the output to be ready for an update jar (no site.xml generated) +outputUpdateJars = true + +#Set to true for Jnlp generation +#codebase should be a URL that will be used as the root of all relative URLs in the output. +#generateJnlp=false +#jnlp.codebase= +#jnlp.j2se= +#jnlp.locale= +#jnlp.generateOfflineAllowed=true or false generate attribute in the generated features +#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built + +#Set to true if you want to sign jars +#signJars=false +#sign.alias= +#sign.keystore= +#sign.storepass= +#sign.keypass= + +#Arguments to send to the zip executable +zipargs= + +#Arguments to send to the tar executable +tarargs= + +#Control the creation of a file containing the version included in each configuration - on by default +#generateVersionsLists=false + +############## BUILD NAMING CONTROL ################ +# The directory into which the build elements are fetched and where +# the build takes place. +#buildDirectory= + +# Type of build. Used in naming the build output. Typically this value is +# one of I, N, M, S, ... +buildType=I + +# ID of the build. Used in naming the build output. +buildId=TestBuild + +# Label for the build. Used in naming the build output +buildLabel=${buildType}.${buildId} + +# Timestamp for the build. Used in naming the build output +timestamp=007 + +#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. +#The value will only be applied to plugin or features indicating build.properties, qualifier = context +#forceContextQualifier= + +#Enable / disable the generation of a suffix for the features that use .qualifier. +#The generated suffix is computed according to the content of the feature +#generateFeatureVersionSuffix=true + +############# BASE CONTROL ############# +# Settings for the base Eclipse components and Java class libraries +# against which you are building. +# Base location for anything the build needs to compile against. For example, +# in most RCP app or a plug-in, the baseLocation should be the location of a previously +# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. + +#base= +#baseLocation=${base}/eclipse + +#Folder containing repositories whose content is needed to compile against +#repoBaseLocation=${base}/repos +#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against +#transformedRepoLocation=${base}/transformedRepos + +#Os/Ws/Arch/nl of the eclipse specified by baseLocation +#baseos=win32 +#basews=win32 +#basearch=x86 + +#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built +filteredDependencyCheck=false + +#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) +resolution.devMode=false + +#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) +#a location is one of: +#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo +#- a directory that contains a /plugins or /features subdirectory +#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml +#pluginPath= + +skipBase=true +eclipseURL= +eclipseBuildId= +eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip + + +############# MAP FILE CONTROL ################ +# This section defines CVS tags to use when fetching the map files from the repository. +# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml + +skipMaps=true +mapsRepo=:pserver:anonymous@example.com/path/to/repo +mapsRoot=path/to/maps +mapsCheckoutTag=HEAD + +#tagMaps=true +mapsTagTag=v${buildId} + + +############ REPOSITORY CONTROL ############### +# This section defines properties parameterizing the repositories where plugins, fragments +# bundles and features are being obtained from. + +# The tags to use when fetching elements to build. +# By default thebuilder will use whatever is in the maps. +# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the +# overriding value +# For example fetchTag=CVS=HEAD, SVN=v20050101 +# fetchTag=HEAD +skipFetch=true + + +############# JAVA COMPILER OPTIONS ############## +# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE +#bootclasspath=${java.home}/lib/rt.jar + +# specific JRE locations to compile against. These values are used to compile bundles specifying a +# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support +#CDC-1.0/Foundation-1.0= /path/to/rt.jar +#CDC-1.1/Foundation-1.1= +#OSGi/Minimum-1.0= +#OSGi/Minimum-1.1= +#JRE-1.1= +#J2SE-1.2= +#J2SE-1.3= +#J2SE-1.4= +#J2SE-1.5= +#JavaSE-1.6= +#PersonalJava-1.1= +#PersonalJava-1.2= +#CDC-1.0/PersonalBasis-1.0= +#CDC-1.0/PersonalJava-1.0= +#CDC-1.1/PersonalBasis-1.1= +#CDC-1.1/PersonalJava-1.1= + +# Specify the output format of the compiler log when eclipse jdt is used +logExtension=.log + +# Whether or not to include debug info in the output jars +javacDebugInfo=false + +# Whether or not to fail the build if there are compiler errors +javacFailOnError=true + +# Enable or disable verbose mode of the compiler +javacVerbose=true + +# Extra arguments for the compiler. These are specific to the java compiler being used. +#compilerArg= + +# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties +javacSource=1.6 + +# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. +javacTarget=1.6 + +#individualSourceBundles=true + +#p2.gathering=true +p2.compress=true +#p2.category.site=file:${buildDirectory}/site.xml +p2.category.definition=file:${buildDirectory}/category.xml +p2.metadata.repo.name=Yocto Project Update Site +p2.artifact.repo.name=Yocto Project Update Site diff --git a/features/org.yocto.sdk.headless.build/customTargets.xml b/features/org.yocto.sdk.headless.build/customTargets.xml new file mode 100644 index 0000000..cb08f91 --- /dev/null +++ b/features/org.yocto.sdk.headless.build/customTargets.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.yocto.sdk.site/.project b/features/org.yocto.sdk.site/.project new file mode 100644 index 0000000..9f1d10f --- /dev/null +++ b/features/org.yocto.sdk.site/.project @@ -0,0 +1,17 @@ + + + org.yocto.sdk.site + + + + + + org.eclipse.pde.UpdateSiteBuilder + + + + + + org.eclipse.pde.UpdateSiteNature + + diff --git a/features/org.yocto.sdk.site/category.xml b/features/org.yocto.sdk.site/category.xml new file mode 100644 index 0000000..4dd0178 --- /dev/null +++ b/features/org.yocto.sdk.site/category.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/features/org.yocto.sdk.site/index.html b/features/org.yocto.sdk.site/index.html new file mode 100644 index 0000000..ce46f0e --- /dev/null +++ b/features/org.yocto.sdk.site/index.html @@ -0,0 +1,60 @@ + + +org.yocto.sdk.site + + + + + + +
+ + diff --git a/features/org.yocto.sdk.site/site.xml b/features/org.yocto.sdk.site/site.xml new file mode 100644 index 0000000..33f36cd --- /dev/null +++ b/features/org.yocto.sdk.site/site.xml @@ -0,0 +1,18 @@ + + + + Yocto Project update site + + + + + + + + + + + + + + diff --git a/features/org.yocto.sdk.site/web/site.css b/features/org.yocto.sdk.site/web/site.css new file mode 100644 index 0000000..62c6f9f --- /dev/null +++ b/features/org.yocto.sdk.site/web/site.css @@ -0,0 +1,12 @@ + diff --git a/features/org.yocto.sdk.site/web/site.xsl b/features/org.yocto.sdk.site/web/site.xsl new file mode 100644 index 0000000..478de48 --- /dev/null +++ b/features/org.yocto.sdk.site/web/site.xsl @@ -0,0 +1,214 @@ + + + + + + + + org.yocto.sdk.site + + + +

org.yocto.sdk.site

+

+ + + + + + + + + + + + + + + + dark-row + + + light-row + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dark-row + + + light-row + + + + + + + + + + + + + + + dark-row + + + light-row + + + + + + + + +
+ + + +
+ + + +
+
+ ( - ) +
+
+ + - + +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Operating Systems:
Windows Systems:
Languages:
Architecture:
+


+ Uncategorized +
+ + + +
+
+ ( - ) +
+
+ + - + +
+

+
+ + + + + + + + + + + + + + + + + + + + + +
Operating Systems:
Windows Systems:
Languages:
Architecture:
+
+ + + +
+
+ ( - ) +
+
+ + - + +
+

+
+ + + + + + + + + + + + + + + + + + + + + +
Operating Systems:
Windows Systems:
Languages:
Architecture:
+
+ + +
+
+
diff --git a/features/org.yocto.sdk/.project b/features/org.yocto.sdk/.project new file mode 100644 index 0000000..d4d7e2f --- /dev/null +++ b/features/org.yocto.sdk/.project @@ -0,0 +1,17 @@ + + + org.yocto.sdk + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/features/org.yocto.sdk/build.properties b/features/org.yocto.sdk/build.properties new file mode 100644 index 0000000..efef74e --- /dev/null +++ b/features/org.yocto.sdk/build.properties @@ -0,0 +1,6 @@ +bin.includes = feature.xml,\ + license.html,\ + feature.properties + +generate.feature@org.yocto.sdk.source=org.yocto.sdk + diff --git a/features/org.yocto.sdk/feature.properties b/features/org.yocto.sdk/feature.properties new file mode 100644 index 0000000..1a2175d --- /dev/null +++ b/features/org.yocto.sdk/feature.properties @@ -0,0 +1,163 @@ +############################################################################### +# Copyright (c) 2010 Intel, Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Intel - initial implementation +############################################################################### + +# "featureName" property - name of the feature +featureName=Yocto Project ADT Plug-in + +# "providerName" property - name of the company that provides the feature +providerName=yoctoproject.org + +# "updateSiteName" property - label for the update site +updateSiteName=Yocto Project Update Site + +# "description" property - description of the feature +description=\ +Eclipse plug-ins for developing embedded applications using Yocto Project + +# copyright +copyright=\ +Copyright (c) 2010 Intel, Inc. and others. \ +All rights reserved. This program and the accompanying materials \ +are made available under the terms of the Eclipse Public License v1.0 \ +which accompanies this distribution, and is available at \ +http://www.eclipse.org/legal/epl-v10.html +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +April 14, 2010\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/features/org.yocto.sdk/feature.xml b/features/org.yocto.sdk/feature.xml new file mode 100644 index 0000000..fe61c42 --- /dev/null +++ b/features/org.yocto.sdk/feature.xml @@ -0,0 +1,109 @@ + + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/org.yocto.sdk/license.html b/features/org.yocto.sdk/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.sdk/license.html @@ -0,0 +1,107 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

Eclipse Foundation Software User Agreement

+

April 14, 2010

+ +

Usage Of Content

+ +

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

+ +

Applicable Licenses

+ +

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

+ +

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

+ +
    +
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • +
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • +
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
  • +
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • +
+ +

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

+ +
    +
  • The top-level (root) directory
  • +
  • Plug-in and Fragment directories
  • +
  • Inside Plug-ins and Fragments packaged as JARs
  • +
  • Sub-directories of the directory named "src" of certain Plug-ins
  • +
  • Feature directories
  • +
+ +

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

+ +

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

+ + + +

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

+ + +

Use of Provisioning Technology

+ +

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

+ +

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

+ +
    +
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
  2. +
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
  4. +
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. +
+ +

Cryptography

+ +

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

+ +

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

+ + diff --git a/features/org.yocto.sdk/sourceTemplateFeature/feature.properties b/features/org.yocto.sdk/sourceTemplateFeature/feature.properties new file mode 100644 index 0000000..f0519b3 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplateFeature/feature.properties @@ -0,0 +1,163 @@ +############################################################################### +# Copyright (c) 2011 Intel, Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Intel - initial implementation +############################################################################### + +# "featureName" property - name of the feature +featureName=Yocto Project ADT Plug-in - Source + +# "providerName" property - name of the company that provides the feature +providerName=yoctoproject.org + +# "updateSiteName" property - label for the update site +updateSiteName=Yocto Project Update Site + +# "description" property - description of the feature +description=\ +Eclipse plug-ins for developing embedded applications using Yocto Project + +# copyright +copyright=\ +Copyright (c) 2011 Intel, Inc. and others. \ +All rights reserved. This program and the accompanying materials \ +are made available under the terms of the Eclipse Public License v1.0 \ +which accompanies this distribution, and is available at \ +http://www.eclipse.org/legal/epl-v10.html +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +April 14, 2010\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/features/org.yocto.sdk/sourceTemplateFeature/license.html b/features/org.yocto.sdk/sourceTemplateFeature/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplateFeature/license.html @@ -0,0 +1,107 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

Eclipse Foundation Software User Agreement

+

April 14, 2010

+ +

Usage Of Content

+ +

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

+ +

Applicable Licenses

+ +

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

+ +

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

+ +
    +
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • +
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • +
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
  • +
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • +
+ +

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

+ +
    +
  • The top-level (root) directory
  • +
  • Plug-in and Fragment directories
  • +
  • Inside Plug-ins and Fragments packaged as JARs
  • +
  • Sub-directories of the directory named "src" of certain Plug-ins
  • +
  • Feature directories
  • +
+ +

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

+ +

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

+ + + +

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

+ + +

Use of Provisioning Technology

+ +

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

+ +

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

+ +
    +
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
  2. +
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
  4. +
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. +
+ +

Cryptography

+ +

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

+ +

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

+ + diff --git a/features/org.yocto.sdk/sourceTemplatePlugin/license.html b/features/org.yocto.sdk/sourceTemplatePlugin/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplatePlugin/license.html @@ -0,0 +1,107 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

Eclipse Foundation Software User Agreement

+

April 14, 2010

+ +

Usage Of Content

+ +

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

+ +

Applicable Licenses

+ +

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

+ +

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

+ +
    +
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • +
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • +
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
  • +
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • +
+ +

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

+ +
    +
  • The top-level (root) directory
  • +
  • Plug-in and Fragment directories
  • +
  • Inside Plug-ins and Fragments packaged as JARs
  • +
  • Sub-directories of the directory named "src" of certain Plug-ins
  • +
  • Feature directories
  • +
+ +

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

+ +

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

+ + + +

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

+ + +

Use of Provisioning Technology

+ +

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

+ +

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

+ +
    +
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
  2. +
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
  4. +
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. +
+ +

Cryptography

+ +

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

+ +

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

+ + diff --git a/features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties b/features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties new file mode 100644 index 0000000..91baf99 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties @@ -0,0 +1,163 @@ +############################################################################### +# Copyright (c) 2011 Intel, Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Intel - initial implementation +############################################################################### + +# "featureName" property - name of the feature +pluginName=Yocto Project ADT Plug-in - Source + +# "providerName" property - name of the company that provides the feature +providerName=yoctoproject.org + +# "updateSiteName" property - label for the update site +updateSiteName=Yocto Project Update Site + +# "description" property - description of the feature +description=\ +Eclipse plug-ins for developing embedded applications using Yocto Project + +# copyright +copyright=\ +Copyright (c) 2011 Intel, Inc. and others. \ +All rights reserved. This program and the accompanying materials \ +are made available under the terms of the Eclipse Public License v1.0 \ +which accompanies this distribution, and is available at \ +http://www.eclipse.org/legal/epl-v10.html +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +April 14, 2010\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/plugins/org.yocto.bc.ui/.classpath b/plugins/org.yocto.bc.ui/.classpath new file mode 100644 index 0000000..121e527 --- /dev/null +++ b/plugins/org.yocto.bc.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.yocto.bc.ui/.project b/plugins/org.yocto.bc.ui/.project new file mode 100644 index 0000000..6113d0b --- /dev/null +++ b/plugins/org.yocto.bc.ui/.project @@ -0,0 +1,28 @@ + + + org.yocto.bc.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6366424 --- /dev/null +++ b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.yocto.bc.ui;singleton:=true +Bundle-Version: 1.4.0.qualifier +Bundle-Activator: org.yocto.bc.ui.Activator +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.cdt.core;bundle-version="5.2.0", + org.eclipse.core.resources, + org.eclipse.debug.core;bundle-version="3.6.0", + org.eclipse.jface.text, + org.eclipse.ui.editors, + org.eclipse.ui.ide, + org.eclipse.ui.console, + org.eclipse.core.filesystem +Eclipse-LazyStart: true +Bundle-ClassPath: . diff --git a/plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..c6efee2 --- /dev/null +++ b/plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,6 @@ +#Properties file for org.yocto.bc.ui +command.name = LaunchHOB +command.label.0 = Launch HOB +command.mnemonic = L +Bundle-Vendor = yoctoproject.org +Bundle-Name = Yocto Bitbake Commander \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/build.properties b/plugins/org.yocto.bc.ui/build.properties new file mode 100644 index 0000000..dab151d --- /dev/null +++ b/plugins/org.yocto.bc.ui/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + OSGI-INF/ diff --git a/plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg new file mode 100644 index 0000000..7ea7219 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg differ diff --git a/plugins/org.yocto.bc.ui/icons/BUG_logo_128.png b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.png new file mode 100644 index 0000000..e67ccc6 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.png differ diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_128.png b/plugins/org.yocto.bc.ui/icons/OE_logo_128.png new file mode 100644 index 0000000..1af3293 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/OE_logo_128.png differ diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_64.png b/plugins/org.yocto.bc.ui/icons/OE_logo_64.png new file mode 100644 index 0000000..b31d055 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/OE_logo_64.png differ diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_96.png b/plugins/org.yocto.bc.ui/icons/OE_logo_96.png new file mode 100644 index 0000000..543a5bc Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/OE_logo_96.png differ diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_full.png b/plugins/org.yocto.bc.ui/icons/OE_logo_full.png new file mode 100644 index 0000000..efefeca Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/OE_logo_full.png differ diff --git a/plugins/org.yocto.bc.ui/icons/beagle_128.png b/plugins/org.yocto.bc.ui/icons/beagle_128.png new file mode 100644 index 0000000..75b6b4a Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/beagle_128.png differ diff --git a/plugins/org.yocto.bc.ui/icons/binary.gif b/plugins/org.yocto.bc.ui/icons/binary.gif new file mode 100644 index 0000000..e3eeb74 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/binary.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/cf_obj.gif b/plugins/org.yocto.bc.ui/icons/cf_obj.gif new file mode 100644 index 0000000..562d6d4 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/cf_obj.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif b/plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif new file mode 100644 index 0000000..03ff4bc Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/clean.gif b/plugins/org.yocto.bc.ui/icons/clean.gif new file mode 100644 index 0000000..679ffa5 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/clean.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/details_view.gif b/plugins/org.yocto.bc.ui/icons/details_view.gif new file mode 100644 index 0000000..c81630a Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/details_view.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/function.gif b/plugins/org.yocto.bc.ui/icons/function.gif new file mode 100644 index 0000000..f8277cf Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/function.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/icon16_OE.gif b/plugins/org.yocto.bc.ui/icons/icon16_OE.gif new file mode 100644 index 0000000..f0a6cbc Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/icon16_OE.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/import_wiz.gif b/plugins/org.yocto.bc.ui/icons/import_wiz.gif new file mode 100644 index 0000000..d38085a Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/import_wiz.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/importdir_wiz.png b/plugins/org.yocto.bc.ui/icons/importdir_wiz.png new file mode 100644 index 0000000..dce21ed Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/importdir_wiz.png differ diff --git a/plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif b/plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif new file mode 100644 index 0000000..d910b2b Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/oe_decorator.gif b/plugins/org.yocto.bc.ui/icons/oe_decorator.gif new file mode 100644 index 0000000..a368de8 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/oe_decorator.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/poky_128.png b/plugins/org.yocto.bc.ui/icons/poky_128.png new file mode 100644 index 0000000..d7cdde6 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/poky_128.png differ diff --git a/plugins/org.yocto.bc.ui/icons/read_only.gif b/plugins/org.yocto.bc.ui/icons/read_only.gif new file mode 100644 index 0000000..dde3cbd Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/read_only.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/refresh.gif b/plugins/org.yocto.bc.ui/icons/refresh.gif new file mode 100644 index 0000000..e383147 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/refresh.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/releng_gears.gif b/plugins/org.yocto.bc.ui/icons/releng_gears.gif new file mode 100644 index 0000000..81fb7b4 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/releng_gears.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/sample.gif b/plugins/org.yocto.bc.ui/icons/sample.gif new file mode 100644 index 0000000..34fb3c9 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/sample.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/sample_decorator.gif b/plugins/org.yocto.bc.ui/icons/sample_decorator.gif new file mode 100644 index 0000000..b51281b Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/sample_decorator.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/topic.gif b/plugins/org.yocto.bc.ui/icons/topic.gif new file mode 100644 index 0000000..b226e41 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/topic.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/trash.gif b/plugins/org.yocto.bc.ui/icons/trash.gif new file mode 100644 index 0000000..bf961b3 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/trash.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/variable.gif b/plugins/org.yocto.bc.ui/icons/variable.gif new file mode 100644 index 0000000..66fd649 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/variable.gif differ diff --git a/plugins/org.yocto.bc.ui/icons/watchlist_view.gif b/plugins/org.yocto.bc.ui/icons/watchlist_view.gif new file mode 100644 index 0000000..c55cb58 Binary files /dev/null and b/plugins/org.yocto.bc.ui/icons/watchlist_view.gif differ diff --git a/plugins/org.yocto.bc.ui/local.conf b/plugins/org.yocto.bc.ui/local.conf new file mode 100644 index 0000000..de47a9e --- /dev/null +++ b/plugins/org.yocto.bc.ui/local.conf @@ -0,0 +1,125 @@ +# Where to cache the files Poky downloads +DL_DIR ?= "${OEROOT}/sources" + +BBPATH += "${OEROOT}/meta-bug/*/*.bb \ + ${OEROOT}/meta-oe/*/*.bb \ + " + +# Poky has various extra metadata collections (openmoko, extras). +# To enable these, uncomment all (or some of) the following lines: +BBFILES = "\ + ${OEROOT}/meta/packages/*/*.bb \ + ${OEROOT}/meta-bug/packages/*/*.bb \ + ${OEROOT}/meta-oe/packages/*/*.bb \ + ${OEROOT}/meta-jalimo/packages/*/*.bb \ + ${OEROOT}/meta-extras/packages/*/*.bb \ + " +BBFILE_COLLECTIONS = "normal bug" +BBFILE_PATTERN_normal = "^${OEROOT}/meta/" +BBFILE_PATTERN_bug = "^${OEROOT}/meta-bug/" +BBFILE_PRIORITY_normal = "5" +BBFILE_PRIORITY_bug = "5" + + +BBMASK = "" + +# The machine to target +MACHINE ?= "bug" +# Other supported machines +#MACHINE ?= "qemux86" + +DISTRO ?= "poky" +# For bleeding edge / experimental / unstable package versions +# DISTRO ?= "poky-bleeding" + +# EXTRA_IMAGE_FEATURES allows extra packages to be added to the generated images +# (Some of these are automatically added to certain image types) +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "tools-profile" - add profiling tools (oprofile, exmap, lttng valgrind (x86 only)) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image for suitable of development +# e.g. ssh root access has a blank password +# There are other application targets too, see meta/classes/poky-image.bbclass +# and meta/packages/tasks/task-poky.bb for more details. + +EXTRA_IMAGE_FEATURES = "tools-debug tools-profile tools-testapps debug-tweaks" + +EXTRA_IMAGE_FEATURES_mx31ads = "tools-testapps debug-tweaks" + +# A list of packaging systems used in generated images +# The first package type listed will be used for rootfs generation +# include 'package_deb' for debs +# include 'package_ipk' for ipks +#PACKAGE_CLASSES ?= "package_deb package_ipk" +PACKAGE_CLASSES ?= "package_ipk" + +# POKYMODE controls the characteristics of the generated packages/images by +# telling poky which type of toolchain to use. +# +# Options include several different EABI combinations and a compatibility +# mode for the OABI mode poky previously used. +# +# The default is "eabi" +# Use "oabi" for machines with kernels < 2.6.18 on ARM for example. +# Use "external-MODE" to use the precompiled external toolchains where MODE +# is the type of external toolchain to use e.g. eabi. +# POKYMODE = "external-eabi" + +# Uncomment this to specify where BitBake should create its temporary files. +# Note that a full build of everything in OpenEmbedded will take GigaBytes of hard +# disk space, so make sure to free enough space. The default TMPDIR is +# /tmp +TMPDIR = "${OEROOT}/build/tmp" + +# Uncomment and set to allow bitbake to execute multiple tasks at once. +# Note, This option is currently experimental - YMMV. +# BB_NUMBER_THREADS = "1" +# Also, make can be passed flags so it run parallel threads e.g.: +PARALLEL_MAKE = "-j 2" + +# Uncomment this if you are using the Openedhand provided qemu deb - see README +# ASSUME_PROVIDED += "qemu-native" + +IMAGE_LINGUAS = "en-us" +LIMIT_BUILT_LOCALES = "en_US" +ENABLE_BINARY_LOCALE_GENERATION = "0" + +# Comment this out if you don't have a 3.x gcc version available and wish +# poky to build one for you. The 3.x gcc is required to build qemu-native. +# ASSUME_PROVIDED += "gcc3-native" + +# Uncomment these two if you want BitBake to build images useful for debugging. +# DEBUG_BUILD = "1" +# INHIBIT_PACKAGE_STRIP = "1" + +# Uncomment these to build a package such that you can use gprof to profile it. +# NOTE: This will only work with 'linux' targets, not +# 'linux-uclibc', as uClibc doesn't provide the necessary +# object files. Also, don't build glibc itself with these +# flags, or it'll fail to build. +# +# PROFILE_OPTIMIZATION = "-pg" +# SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}" +# LDFLAGS =+ "-pg" + +# Uncomment this if you want BitBake to emit debugging output +# BBDEBUG = "yes" +# Uncomment this if you want BitBake to emit the log if a build fails. +BBINCLUDELOGS = "yes" + +# Specifies a location to search for pre-generated tarballs when fetching +# a cvs:// URI. Uncomment this, if you not want to pull directly from CVS. +# CVS_TARBALL_STASH = "http://folks.o-hand.com/~richard/poky/sources/" + +# Set this if you wish to make pkgconfig libraries from your system available +# for native builds. Combined with extra ASSUME_PROVIDEDs this can allow +# native builds of applications like oprofileui-native (unsupported feature). +#EXTRA_NATIVE_PKGCONFIG_PATH = ":/usr/lib/pkgconfig" +#ASSUME_PROVIDED += "gtk+-native libglade-native" + +# ENABLE_BINARY_LOCALE_GENERATION = "1" diff --git a/plugins/org.yocto.bc.ui/plugin.xml b/plugins/org.yocto.bc.ui/plugin.xml new file mode 100644 index 0000000..cb0561c --- /dev/null +++ b/plugins/org.yocto.bc.ui/plugin.xml @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java new file mode 100644 index 0000000..d905e50 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java @@ -0,0 +1,24 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.bitbake; + +/** + * Constants for commonly used bitbake variables. + * @author kgilmer + * + */ +public class BBCommonVars { + public final static String WORKDIR = "WORKDIR"; + public static final String PN = "PN"; + public static final String S = "S"; + public static final String PV = "PV"; + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java new file mode 100644 index 0000000..8ebe134 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + * Lianhao Lu (Intel) - add more bitbake keywords and functions + *******************************************************************************/ +package org.yocto.bc.bitbake; + +import java.util.Comparator; +import java.util.Map; +import java.util.TreeMap; + +/** + * Here is where all BitBake-related information is centralized. + * @author kgilmer + * + */ +public class BBLanguageHelper { + + public static final String[] BITBAKE_KEYWORDS = new String[] { "inherit", "require", "export", "addtask", "python", "include", "fakeroot", "addhandler", "def"}; + public static final String[] SHELL_KEYWORDS = new String[] { "while", "do", "if", "fi", "ln", "export", "install", "oe_libinstall", "for", "in", "done", "echo", "then", "cat", "rm", "rmdir", "mkdir", "printf", "exit", "test", "cd", "cp"}; + public static final String[] BITBAKE_STANDARD_FUNCTIONS = new String[] { "fetch", "unpack", "patch", "configure", "compile", "install", "populate_sysroot", "package"}; + public static final String BITBAKE_RECIPE_FILE_EXTENSION = "bb"; + + /** + * @return A map of names and descriptions of commonly used BitBake variables. + */ + public static Map getCommonBitbakeVariables() { + Map m = new TreeMap(new Comparator() { + + public int compare(Object o1, Object o2) { + + return ((String) o1).compareTo(((String) o2)); + } + + }); + + m.put("SECTION", "Category of package"); + m.put("PR", "Package Release Number"); + m.put("SRC_URI", "Location of package sources"); + m.put("DESCRIPTION", "Description of package"); + m.put("EXTRA_OEMAKE", "Extra flags to pass to the package makefile"); + m.put("EXTRA_OECONF", "Extra configuration flags for the package makefile"); + m.put("DEPENDS", "The set of build-time dependent packages"); + m.put("RDEPENDS", "The set of run-time dependent packages"); + m.put("HOMEPAGE", "Homepage of the package"); + m.put("LICENSE", "License of the package"); + m.put("FILES_${PN}", "Full file path of files on target."); + m.put("S", "Package source directory"); + m.put("PV", "Package version"); + m.put("AUTHOR", "Author or maintainer of package"); + m.put("PRIORITY", "Priority of package"); + + return m; + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java new file mode 100644 index 0000000..2b355ba --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java @@ -0,0 +1,50 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.bitbake; + +import java.io.IOException; + +import org.eclipse.jface.preference.JFacePreferences; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.MessageConsole; +import org.eclipse.ui.console.MessageConsoleStream; + +/** + * Represents the bitbake environment of a recipe package. + * @author kgilmer + * + */ +public class BBRecipe extends BBSession { + private final BBSession session; + private final String filePath; + + public BBRecipe(BBSession session, String filePath) throws IOException { + super(session.shell, session.pinfo.getRootPath()); + this.session = session; + this.filePath = filePath; + this.parsingCmd = "DISABLE_SANITY_CHECKS=1 bitbake -e -b " + filePath; + } + + @Override + public void initialize() throws Exception { + if (this.size() == 0) { + //System.out.println("Failed to parse " + filePath); + //throw new IOException("Failed to parse " + filePath); + } + } + + protected String getDefaultDepends() { + return this.filePath; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java new file mode 100644 index 0000000..e998bcd --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java @@ -0,0 +1,739 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.bitbake; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Stack; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.Lock; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.preference.JFacePreferences; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IConsoleManager; +import org.eclipse.ui.console.MessageConsole; +import org.eclipse.ui.console.MessageConsoleStream; +import org.eclipse.ui.progress.WorkbenchJob; + +import org.yocto.bc.ui.model.IModelElement; +import org.yocto.bc.ui.model.ProjectInfo; + +/** + * BBSession encapsulates a global bitbake configuration and is the primary interface + * for actions against a BitBake installation. + * + * @author kgilmer + * + */ +public class BBSession implements IBBSessionListener, IModelElement, Map { + public static final int TYPE_VARIABLE_ASSIGNMENT = 1; + public static final int TYPE_UNKNOWN = 2; + public static final int TYPE_STATEMENT = 3; + public static final int TYPE_FLAG = 4; + + public static final String BUILDDIR_INDICATORS [] = { + File.separatorChar + "conf" + File.separatorChar + "local.conf", + File.separatorChar + "conf" + File.separatorChar + "bblayers.conf", + }; + + protected final ProjectInfo pinfo; + protected final ShellSession shell; + protected Map properties = null; + protected List depends = null; + protected boolean initialized = false; + protected MessageConsole sessionConsole; + private final ReentrantReadWriteLock rwlock = new ReentrantReadWriteLock(); + private final Lock rlock = rwlock.readLock(); + private final Lock wlock = rwlock.writeLock(); + protected String parsingCmd; + private boolean silent = false; + + public BBSession(ShellSession ssession, String projectRoot) throws IOException { + shell = ssession; + this.pinfo = new ProjectInfo(); + pinfo.setLocation(projectRoot); + pinfo.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(projectRoot)); + this.parsingCmd = "DISABLE_SANITY_CHECKS=1 bitbake -e"; + } + + public BBSession(ShellSession ssession, String projectRoot, boolean silent) throws IOException { + this(ssession, projectRoot); + this.silent = silent; + } + + private Collection adapttoIPath(List asList, IProject project) { + + List pathList = new ArrayList(); + + for (Iterator i = asList.iterator(); i.hasNext();) { + File f = (File) i.next(); + IFile ff = project.getFile(stripLeading(f.toString(), project.getLocationURI().getPath())); + if (ff.exists()) { + pathList.add(ff); + } + } + + return pathList; + } + + private String appendAll(String[] elems, int st) { + StringBuffer sb = new StringBuffer(); + + for (int i = st; i < elems.length; ++i) { + sb.append(elems[i]); + } + + return sb.toString(); + } + + private int charCount(String trimmed, char c) { + int i = 0; + int p = 0; + + while ((p = trimmed.indexOf(c, p)) > -1) { + i++; + p++; + } + + return i; + } + + public void clear() { + throw new RuntimeException("BB configuration is read-only."); + } + + public boolean containsKey(Object arg0) { + try { + checkValidAndLock(true); + return properties.containsKey(arg0); + } catch (Exception e) { + e.printStackTrace(); + return false; + }finally { + rlock.unlock(); + } + } + + public boolean containsValue(Object arg0) { + try { + checkValidAndLock(true); + return properties.containsValue(arg0); + } catch (Exception e) { + e.printStackTrace(); + return false; + }finally { + rlock.unlock(); + } + } + + public Set entrySet() { + try { + checkValidAndLock(true); + return properties.entrySet(); + } catch (Exception e) { + e.printStackTrace(); + return null; + }finally { + rlock.unlock(); + } + } + + @Override + public boolean equals(Object arg0) { + try { + checkValidAndLock(true); + return properties.equals(arg0); + } catch (Exception e) { + e.printStackTrace(); + return false; + }finally { + rlock.unlock(); + } + } + + public ShellSession getShell() { + return shell; + } + + public String getProjInfoRoot() { + return pinfo.getRootPath(); + } + + /** + * Recursively generate list of Recipe files from a root directory. + * + * @param rootDir + * @param recipes + * @param fileExtension + * @param project + */ + private void findRecipes(File rootDir, List recipes, final String fileExtension, IProject project) { + File[] children = rootDir.listFiles(new FileFilter() { + + public boolean accept(File pathname) { + return pathname.isFile() && pathname.getName().endsWith(fileExtension); + } + + }); + + if (children != null && children.length > 0) { + recipes.addAll(adapttoIPath(Arrays.asList(children), project)); + } + + File[] childDirs = rootDir.listFiles(new FileFilter() { + + public boolean accept(File pathname) { + return pathname.isDirectory(); + } + + }); + + if (childDirs != null && childDirs.length > 0) { + for (int i = 0; i < childDirs.length; ++i) { + findRecipes(childDirs[i], recipes, fileExtension, project); + } + } + } + + private Collection findRecipes(List paths, IProject project) { + List recipes = new ArrayList(); + + for (Iterator i = paths.iterator(); i.hasNext();) { + String rawPath = (String) i.next(); + String[] elems = rawPath.split("\\*/\\*"); + + if (elems.length == 2) { + + File rootDir = new File(elems[0]); + + findRecipes(rootDir, recipes, elems[1], project); + } + } + + return recipes; + } + + public Object get(Object arg0) { + try { + checkValidAndLock(true); + return properties.get(arg0); + } catch (Exception e) { + e.printStackTrace(); + return null; + }finally { + rlock.unlock(); + } + } + + private List getBitBakeKeywords() { + return Arrays.asList(BBLanguageHelper.BITBAKE_KEYWORDS); + } + + /** + * @return A MessageConsole for this BB session. + */ + public MessageConsole getConsole() { + if (sessionConsole == null) { + String cName = ProjectInfoHelper.getProjectName(pinfo.getRootPath()) + " Console"; + IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager(); + IConsole[] existing = conMan.getConsoles(); + for (int i = 0; i < existing.length; i++) + if (cName.equals(existing[i].getName())) { + sessionConsole = (MessageConsole) existing[i]; + break; + } + if (sessionConsole == null) { + sessionConsole = new MessageConsole(cName, null); + conMan.addConsoles(new IConsole[] { sessionConsole }); + } + } + + ConsolePlugin.getDefault().getConsoleManager().showConsoleView(sessionConsole); + + return sessionConsole; + } + + private int getLineType(String line) { + + if (line.contains("=")) { + return TYPE_VARIABLE_ASSIGNMENT; + } + + for (Iterator i = getBitBakeKeywords().iterator(); i.hasNext();) { + if (line.startsWith((String) i.next())) { + return TYPE_STATEMENT; + } + } + + if (line.contains(":")) { + return TYPE_FLAG; + } + + return TYPE_UNKNOWN; + } + + public Collection getRecipeFiles(IProject project) { + try { + checkValidAndLock(true); + if (!initialized) { + throw new RuntimeException(this.getClass().getName() + " is not initialized."); + } + String bbfiles = (String) this.properties.get("BBFILES"); + List paths = parseBBFiles(bbfiles); + return findRecipes(paths, project); + } catch (Exception e) { + return null; + } + finally { + rlock.unlock(); + } + } + + @Override + public int hashCode() { + try { + checkValidAndLock(true); + return properties.hashCode(); + } catch (Exception e) { + e.printStackTrace(); + return 0; + }finally { + rlock.unlock(); + } + } + + protected int checkExecuteError(String result, int code) { + String recipe = getDefaultDepends(); + String text = "Parsing " + ((recipe != null) ? ("recipe " + recipe) : "base configurations"); + if (code != 0) { + text = text + " ERROR!\n" + result; + }else { + text = text + " SUCCESS.\n"; + } + if(!silent) { + displayInConsole(text, code, false); + } + return code; + } + + protected void displayInConsole(final String result, final int code, boolean clear) { + MessageConsole console = getConsole(); + final MessageConsoleStream info = console.newMessageStream(); + if(clear) + console.clearConsole(); + new WorkbenchJob("Display parsing result") { + public IStatus runInUIThread(IProgressMonitor monitor) { + if(code != 0) { + info.setColor(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR)); + } + try { + info.println(result); + info.close(); + }catch (Exception e) { + e.printStackTrace(); + } + return Status.OK_STATUS; + } + }.schedule(); + } + + private void checkValidAndLock(boolean rdlck) throws Exception { + if(rdlck) + rlock.lock(); + else + wlock.lock(); + if(!initialized) { + //upgrade lock manually + if(rdlck) { + rlock.unlock(); + wlock.lock(); + } + try { + if(!initialized) { //recheck + int [] codes = {-1}; + String result = shell.execute(parsingCmd, codes); + if(checkExecuteError(result, codes[0]) == 0) { + properties = parseBBEnvironment(result); + } else { + properties = parseBBEnvironment(""); + } + initialized = true; + } + } finally { + //downgrade lock + if(rdlck) { + rlock.lock(); + wlock.unlock(); + } + } + } + //not release lock + } + + public void initialize() throws Exception { + try { + checkValidAndLock(false); + }finally { + wlock.unlock(); + } + } + + private boolean isBlockEnd(String trimmed) { + return charCount(trimmed, '}') > charCount(trimmed, '{'); + // return trimmed.indexOf('}') > -1 && trimmed.indexOf('{') == -1; + } + + private boolean isBlockStart(String trimmed) { + return charCount(trimmed, '{') > charCount(trimmed, '}'); + // return trimmed.indexOf('{') > -1 && trimmed.indexOf('}') == -1; + } + + public boolean isEmpty() { + try { + checkValidAndLock(true); + return properties.isEmpty(); + } catch (Exception e) { + e.printStackTrace(); + return true; + }finally { + rlock.unlock(); + } + } + + public Set keySet() { + try { + checkValidAndLock(true); + return properties.keySet(); + } catch (Exception e) { + e.printStackTrace(); + return null; + }finally { + rlock.unlock(); + } + } + + protected void parse(String content, Map outMap) throws Exception { + BufferedReader reader = new BufferedReader(new StringReader(content)); + String line; + boolean inLine = false; + StringBuffer sb = null; + Stack blockStack = new Stack(); + + while ((line = reader.readLine()) != null) { + String trimmed = line.trim(); + if (trimmed.length() == 0 || line.startsWith("#")) { + // weed out the blank and comment lines + continue; + } + // Now we look for block start ends, and ignore all code within + // blocks. + if (isBlockStart(trimmed)) { + blockStack.push(trimmed); + } else if (isBlockEnd(trimmed)) { + blockStack.pop(); + + } + + if (!blockStack.isEmpty()) { + // we are in a code block, continue until we break into global + // scope. + continue; + } + if (trimmed.endsWith("\\")) { + if (!inLine) { + inLine = true; + sb = new StringBuffer(trimmed.substring(0, trimmed.length() - 1)); + } else { + sb.append(trimmed.substring(0, trimmed.length() - 1)); + } + // Only parse the line when we have the complete contents. + continue; + } else if (inLine) { + inLine = false; + line = sb.toString(); + } + + parseLine(line, outMap); + } + } + + private void parseAdditiveAssignment(String line, String operator, Map mo) throws Exception { + String[] elems = splitAssignment(line, "\\+="); + + if (elems.length != 2) { + throw new Exception("Unable to parse additive variable assignment in line: " + line); + } + + if (!mo.containsKey(elems[0])) { + mo.put(elems[0].trim(), elems[1]); + } else { + String existing = (String) mo.get(elems[0]); + if (operator.equals("+=")) { + mo.put(elems[0], existing + elems[1]); + } else { + mo.put(elems[0], elems[1] + existing); + } + } + } + + protected String getDefaultDepends() { + return null; + } + + protected Map parseBBEnvironment(String bbOut) throws Exception { + Map env = new Hashtable(); + this.depends = new ArrayList(); + + parse(bbOut, env); + + String included = (String) env.get("BBINCLUDED"); + if(getDefaultDepends() != null) { + this.depends.add(getDefaultDepends()); + } + if(included != null) { + this.depends.addAll(Arrays.asList(included.split(" "))); + } + + return env; + } + + + private List parseBBFiles(String bbfiles) { + return Arrays.asList(bbfiles.split(" ")); + } + + //Map delegate methods + + private void parseConditionalAssignment(String line, Map mo) throws Exception { + String[] elems = splitAssignment(line, "\\?="); + + if (elems.length != 2) { + throw new Exception("Unable to parse conditional variable assignment in line: " + line); + } + + if (!mo.containsKey(elems[0].trim())) { + mo.put(elems[0].trim(), elems[1].trim()); + } + } + + private void parseImmediateAssignment(String line, String delimiter, Map mo) throws Exception { + String[] elems = splitAssignment(line, delimiter); + + mo.put(elems[0], substitute(elems[1], mo)); + } + + private void parseKeyValue(String line, String delimiter, Map mo) throws Exception { + String[] elems = splitAssignment(line, delimiter); + + mo.put(elems[0], elems[1]); + } + + private void parseLine(String line, Map mo) throws Exception { + + switch (getLineType(line)) { + case TYPE_VARIABLE_ASSIGNMENT: + parseVariableAssignment(line, mo); + break; + case TYPE_STATEMENT: + case TYPE_FLAG: + // for now ignore statements + break; + case TYPE_UNKNOWN: + // we'll gloss over unknown lines as well; + break; + default: + throw new Exception("Unable to parse line: " + line); + } + } + + private void parseVariableAssignment(String line, Map mo) throws Exception { + if (line.contains("?=")) { + parseConditionalAssignment(line, mo); + } else if (line.contains("+=")) { + parseAdditiveAssignment(line, "+=", mo); + } else if (line.contains("=+")) { + parseAdditiveAssignment(line, "=+", mo); + } else if (line.contains(":=")) { + parseImmediateAssignment(line, ":=", mo); + } else { + parseKeyValue(line, "=", mo); + } + + } + + private List parseVars(String line) { + List l = new ArrayList(); + + int i = 0; + + while ((i = line.indexOf("${", i)) > -1) { + int i2 = line.indexOf("}", i); + + l.add(line.subSequence(i + 2, i2)); + i++; + } + + return l; + } + + public Object put(Object arg0, Object arg1) { + throw new RuntimeException("BB configuration is read-only."); + } + + public void putAll(Map arg0) { + throw new RuntimeException("BB configuration is read-only."); + } + + public Object remove(Object arg0) { + throw new RuntimeException("BB configuration is read-only."); + } + + private String removeQuotes(String line) { + line = line.trim(); + + if (line.startsWith("\"")) { + line = line.substring(1); + } + + if (line.endsWith("\"")) { + line = line.substring(0, line.length() - 1); + } + + return line; + } + + public int size() { + try { + checkValidAndLock(true); + return properties.size(); + }catch (Exception e) { + e.printStackTrace(); + return 0; + }finally { + rlock.unlock(); + } + } + + private String[] splitAssignment(String line, String seperator) throws Exception { + String[] elems = line.split(seperator); + + if (elems.length < 2) { + throw new Exception("Unable to parse assignment in line: " + line); + } else if (elems.length == 2) { + + elems[0] = elems[0].trim(); // Clean up trailing or leading spaces. + if (elems[0].startsWith("export ")) { + elems[0] = elems[0].substring("export ".length()).trim(); + } + elems[1] = removeQuotes(elems[1]); // Evaluate variables + + return elems; + } else { + String[] retVal = new String[2]; + + retVal[0] = elems[0]; + if (retVal[0].startsWith("export ")) { + retVal[0] = retVal[0].substring("export ".length()).trim(); + } + retVal[1] = appendAll(elems, 1); + + return retVal; + } + } + + private String stripLeading(String target, String leading) { + if (target.startsWith(leading)) { + target = target.substring(leading.length()); + } + + return target; + } + + /** + * Return a string with variable substitutions in place. + * + * @param expression + * @return Input string with any substitutions from this file. + */ + public String substitute(String expression, Map mo) { + + List vars = parseVars(expression); + + for (Iterator i = vars.iterator(); i.hasNext();) { + String varName = (String) i.next(); + String varToken = "${" + varName + "}"; + + if (mo.containsKey(varName)) { + expression = expression.replace(varToken, (String) mo.get(varName)); + } else if (System.getProperty(varName) != null) { + expression = expression.replace(varToken, System.getProperty(varName)); + } else if (varName.toUpperCase().equals("HOME")) { + expression = expression.replace(varToken, System.getProperty("user.home")); + } + } + + return expression; + } + + public Collection values() { + try { + checkValidAndLock(true); + return properties.values(); + } catch (Exception e) { + e.printStackTrace(); + return null; + }finally { + rlock.unlock(); + } + } + + public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed) { + wlock.lock(); + try { + if (initialized && (removed != null || changed != null)) { + for(int i=0;removed != null && i 0) { + byte[] msg = new byte[process.getErrorStream().available()]; + + process.getErrorStream().read(msg, 0, msg.length); + out.write(new String(msg)); + out.write(LT); + errorMessage = "Error while executing: " + command + LT + new String(msg); + } + + BufferedReader br = new BufferedReader(new InputStreamReader(process + .getInputStream())); + + StringBuffer sb = new StringBuffer(); + String line = null; + + while (((line = br.readLine()) != null) && !line.endsWith(TERMINATOR) && !interrupt) { + sb.append(line); + sb.append(LT); + out.write(line); + out.write(LT); + } + + if (interrupt) { + process.destroy(); + initializeShell(); + interrupt = false; + }else if (line != null && retCode != null) { + try { + retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR))); + }catch (NumberFormatException e) { + throw new IOException("Can NOT get return code" + command + LT + line); + } + } + + if (errorMessage != null) { + throw new IOException(errorMessage); + } + + return sb.toString(); + } + +synchronized + public void execute(String command, ICommandResponseHandler handler) throws IOException { + System.out.println(command); + execute(command, TERMINATOR, handler); + } + + synchronized + public void execute(String command, String terminator, ICommandResponseHandler handler) throws IOException { + interrupt = false; + InputStream errIs = process.getErrorStream(); + if (errIs.available() > 0) { + clearErrorStream(errIs); + } + sendToProcessAndTerminate(command); + + BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); + String std = null; + + do { + if (errIs.available() > 0) { + byte[] msg = new byte[errIs.available()]; + + errIs.read(msg, 0, msg.length); + out.write(new String(msg)); + handler.response(new String(msg), true); + } + + std = br.readLine(); + + if (std != null && !std.endsWith(terminator)) { + out.write(std); + handler.response(std, false); + } + + } while (std != null && !std.endsWith(terminator) && !interrupt); + + if (interrupt) { + process.destroy(); + initializeShell(); + interrupt = false; + } + } + + private void clearErrorStream(InputStream is) { + + try { + byte b[] = new byte[is.available()]; + is.read(b); + System.out.println("clearing: " + new String(b)); + } catch (IOException e) { + e.printStackTrace(); + //Ignore any error + } + } + + /** + * Send command string to shell process and add special terminator string so + * reader knows when output is complete. + * + * @param command + * @throws IOException + */ + private void sendToProcessAndTerminate(String command) throws IOException { + pos.write(command.getBytes()); + pos.write(LT.getBytes()); + pos.flush(); + pos.write("echo $?".getBytes()); + pos.write(TERMINATOR.getBytes()); + pos.write(LT.getBytes()); + pos.flush(); + } + + /** + * Interrupt any running processes. + */ + public void interrupt() { + interrupt = true; + } + + private class NullWriter extends Writer { + + @Override + public void close() throws IOException { + } + + @Override + public void flush() throws IOException { + } + + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + } + + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java new file mode 100644 index 0000000..505a254 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java @@ -0,0 +1,266 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui; + +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.lang.reflect.InvocationTargetException; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +import org.yocto.bc.bitbake.BBRecipe; +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.bitbake.ProjectInfoHelper; +import org.yocto.bc.bitbake.ShellSession; +import org.yocto.bc.ui.model.ProjectInfo; +import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation; + +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.yocto.bc.ui"; + public static final String IMAGE_VARIABLE = "IMAGE_VARIABLE"; + public static final String IMAGE_FUNCTION = "IMAGE_FUNCTION"; + + // The shared instance + private static Activator plugin; + private static Map shellMap; + private static Map projInfoMap; + private static Hashtable bbSessionMap; + private static Hashtable bbRecipeMap; + + private IResourceChangeListener listener = new BCResourceChangeListener(); + + public static BBRecipe getBBRecipe(BBSession session, String filePath) throws IOException { + if (bbRecipeMap == null) { + bbRecipeMap = new Hashtable(); + } + + String key = session.getProjInfoRoot() + filePath; + BBRecipe recipe = (BBRecipe) bbRecipeMap.get(key); + if (recipe == null) { + recipe = new BBRecipe(session,filePath); + bbRecipeMap.put(key, recipe); + } + + return recipe; + } + + /** + * Get or create a BitBake session passing in ProjectInfo + * @param pinfo + * @return + * @throws IOException + */ + public static BBSession getBBSession(String projectRoot, Writer out) throws IOException { + if (bbSessionMap == null) { + bbSessionMap = new Hashtable(); + } + + BBSession bbs = (BBSession) bbSessionMap.get(projectRoot); + + if (bbs == null) { + bbs = new BBSession(getShellSession(projectRoot, out), projectRoot); + bbSessionMap.put(projectRoot, bbs); + } + + return bbs; + } + + /** + * Get or create a BitBake session passing in ProjectInfo + * @param pinfo + * @return + * @throws IOException + */ + public static BBSession getBBSession(String projectRoot) throws IOException { + if (bbSessionMap == null) { + bbSessionMap = new Hashtable(); + } + + BBSession bbs = (BBSession) bbSessionMap.get(projectRoot); + + if (bbs == null) { + bbs = new BBSession(getShellSession(projectRoot, null), projectRoot); + bbSessionMap.put(projectRoot, bbs); + } + + return bbs; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + public static ProjectInfo getProjInfo(String location) throws CoreException, InvocationTargetException, InterruptedException { + if (projInfoMap == null) { + projInfoMap = new Hashtable(); + } + + ProjectInfo pi = (ProjectInfo) projInfoMap.get(location); + + if (pi == null) { + pi = new ProjectInfo(); + pi.setLocation(location); + try { + pi.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(location)); + } catch (IOException e) { + throw new InvocationTargetException(e); + } + } + + return pi; + } + + public static void notifyAllBBSession(IResource[] added, IResource[] removed, IResource[] changed) { + Iterator iter; + if(bbRecipeMap != null) { + iter = bbRecipeMap.values().iterator(); + while(iter.hasNext()) { + BBRecipe p = (BBRecipe)iter.next(); + p.changeNotified(added, removed, changed); + } + } + + if(bbSessionMap != null) { + iter= bbSessionMap.values().iterator(); + while(iter.hasNext()) { + BBSession p = (BBSession)iter.next(); + p.changeNotified(added, removed, changed); + } + } + } + + /** + * @param absolutePath + * @return a cached shell session for a given project root. + * @throws IOException + */ + private static ShellSession getShellSession(String absolutePath, Writer out) throws IOException { + if (shellMap == null) { + shellMap = new Hashtable(); + } + + ShellSession ss = (ShellSession) shellMap.get(absolutePath); + + if (ss == null) { + ss = new ShellSession(ShellSession.SHELL_TYPE_BASH, new File(absolutePath), ProjectInfoHelper.getInitScriptPath(absolutePath), out); + } + + return ss; + } + + private static String loadInit(String absolutePath) throws CoreException { + IProject [] prjs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + IProject foundPrj = null; + + for (int i = 0; i < prjs.length; ++i) { + IProject p = prjs[i]; + + System.out + .println(p.getDescription().getLocationURI().getPath()); + + if (p.getDescription().getLocationURI().getPath().equals(absolutePath)) { + foundPrj = p; + break; + } + } + + if (foundPrj == null) { + throw new RuntimeException("Unable to find project associated with path! " + absolutePath); + } + + return foundPrj.getPersistentProperty(CreateBBCProjectOperation.BBC_PROJECT_INIT); + } + + public static void putProjInfo(String location, ProjectInfo pinfo) { + if (projInfoMap == null) { + projInfoMap = new Hashtable(); + } + + + + projInfoMap.put(location, pinfo); + } + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + ResourcesPlugin.getWorkspace().addResourceChangeListener( + listener, IResourceChangeEvent.POST_CHANGE); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + ResourcesPlugin.getWorkspace().removeResourceChangeListener( + listener); + plugin = null; + super.stop(context); + } + + /** + * Reset a configuration + * @param path + */ + public static void resetBBSession(String path) { + shellMap.remove(path); + bbSessionMap.remove(path); + } + + protected void initializeImageRegistry(ImageRegistry reg) { + reg.put(IMAGE_VARIABLE, Activator.getImageDescriptor("icons/variable.gif")); + reg.put(IMAGE_FUNCTION, Activator.getImageDescriptor("icons/function.gif")); + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java new file mode 100644 index 0000000..8a2bfdd --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java @@ -0,0 +1,64 @@ +package org.yocto.bc.ui; + +import java.util.HashSet; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.runtime.*; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; + +public class BCResourceChangeListener implements IResourceChangeListener { + + public void resourceChanged(IResourceChangeEvent event) { + final HashSet removed = new HashSet(); + final HashSet changed = new HashSet(); + switch (event.getType()) { + case IResourceChangeEvent.POST_CHANGE: + try { + event.getDelta().accept(new IResourceDeltaVisitor() { + public boolean visit(IResourceDelta delta) throws CoreException { + IResource res = delta.getResource(); + Boolean visit= true; + if (res instanceof IProject) { + visit = false; + try { + if(((IProject) res).isOpen() && + ((IProject) res).hasNature(BitbakeCommanderNature.NATURE_ID)){ + visit = true; + } + }catch (CoreException e) { + } + } + if (visit && (res instanceof IFile)) + { + switch (delta.getKind()) { + case IResourceDelta.REMOVED: + removed.add(res); + break; + case IResourceDelta.CHANGED: + changed.add(res); + break; + } + } + return visit; // visit the children + } + }); + //notify all the sessions + Activator.notifyAllBBSession(null, + removed.toArray(new IResource[removed.size()]), + changed.toArray(new IResource[changed.size()])); + + }catch (CoreException e) { + e.printStackTrace(); + } + break; + default: + break; + } + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/AbstractBitbakeCommandAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/AbstractBitbakeCommandAction.java new file mode 100644 index 0000000..41d5c73 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/AbstractBitbakeCommandAction.java @@ -0,0 +1,199 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import java.io.IOException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.JFacePreferences; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.graphics.Color; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.console.MessageConsole; +import org.eclipse.ui.console.MessageConsoleStream; + +import org.yocto.bc.bitbake.BBLanguageHelper; +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.bitbake.ICommandResponseHandler; +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; + +public abstract class AbstractBitbakeCommandAction implements IWorkbenchWindowActionDelegate { + + private class CommandJob extends Job { + + public CommandJob() { + super(getJobTitle()); + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + String cmds[] = getCommands(); + return execCommands(cmds, monitor); + } + + } + protected IAction action; + protected IFile recipe; + protected BBSession bbs; + + private Color commandColor, responseColor, errorColor; + private boolean errorOccurred = false; + + public AbstractBitbakeCommandAction() { + commandColor = JFaceResources.getColorRegistry().get(JFacePreferences.ACTIVE_HYPERLINK_COLOR); + responseColor = JFaceResources.getColorRegistry().get(JFacePreferences.HYPERLINK_COLOR); + errorColor = JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR); + } + + private void checkEnabled(IFile file) { + try { + if (file.getFileExtension() == null || !file.getFileExtension().equals(BBLanguageHelper.BITBAKE_RECIPE_FILE_EXTENSION)) { + action.setEnabled(false); + return; + } + + IProject project = file.getProject(); + if (!(project.hasNature(BitbakeCommanderNature.NATURE_ID))) { + action.setEnabled(false); + return; + } + + bbs = Activator.getBBSession(project.getLocationURI().getPath()); + + if (bbs != null) { + recipe = file; + action.setEnabled(true); + } + + } catch (CoreException e) { + action.setEnabled(false); + e.printStackTrace(); + } catch (Exception e) { + action.setEnabled(false); + e.printStackTrace(); + } + } + + public void dispose() { + } + + /** + * Execute array of commands with bitbake and put output in console. + * + * @param cmds + * @param monitor + * @return + */ + protected IStatus execCommands(String[] cmds, final IProgressMonitor monitor) { + MessageConsole mc = bbs.getConsole(); + final MessageConsoleStream cmd = mc.newMessageStream(); + cmd.setColor(commandColor); + final MessageConsoleStream out = mc.newMessageStream(); + final MessageConsoleStream err = mc.newMessageStream(); + err.setColor(errorColor); + + try { + for (int i = 0; i < cmds.length; ++i) { + cmd.println(cmds[i]); + monitor.subTask(cmds[i]); + bbs.getShell().execute(cmds[i], new ICommandResponseHandler() { + + public void response(String line, boolean isError) { + if (monitor.isCanceled()) { + cmd.println("Interrupting process by user request."); + bbs.getShell().interrupt(); + } + + if (isError) { + err.println(line); + errorOccurred(); + } else if (line.startsWith("ERROR:")) { + err.println(line); + } else { + out.println(line); + } + } + }); + } + } catch (IOException e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + } finally { + try { + if (errorOccurred) { + cmd.println("At least one error occured while executing this command. Check output for more details."); + } + cmd.close(); + out.close(); + err.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + return Status.OK_STATUS; + } + + protected void errorOccurred() { + errorOccurred = true; + } + + /** + * Return the command to be executed. + * + * @return + */ + public abstract String[] getCommands(); + + public Job getJob() { + return new CommandJob(); + } + + /** + * Return the title of the job. + * + * @return + */ + public abstract String getJobTitle(); + + public void init(IWorkbenchWindow window) { + } + + public void run(IAction action) { + Job job = getJob(); + job.schedule(); + } + + public void selectionChanged(IAction action, ISelection selection) { + this.action = action; + if (selection instanceof IStructuredSelection) { + Object sel = ((IStructuredSelection) selection).getFirstElement(); + + if (sel instanceof IFile) { + checkEnabled((IFile) sel); + return; + } + } + + action.setEnabled(false); + } + +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeBuildRecipeAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeBuildRecipeAction.java new file mode 100644 index 0000000..22ac94c --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeBuildRecipeAction.java @@ -0,0 +1,24 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +public class BitbakeBuildRecipeAction extends AbstractBitbakeCommandAction { + + @Override + public String [] getCommands() { + return new String[] {"bitbake -b " + recipe.getLocationURI().getPath()}; + } + + @Override + public String getJobTitle() { + return "Building " + recipe.getName(); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeCleanRecipeAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeCleanRecipeAction.java new file mode 100644 index 0000000..f95117e --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeCleanRecipeAction.java @@ -0,0 +1,26 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +public class BitbakeCleanRecipeAction extends AbstractBitbakeCommandAction { + + @Override + public String [] getCommands() { + return new String[] {"bitbake -c clean -b " + recipe.getLocationURI().getPath()}; + } + + @Override + public String getJobTitle() { + return "Cleaning " + recipe.getName(); + } + + +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeImportAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeImportAction.java new file mode 100644 index 0000000..ecceecf --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeImportAction.java @@ -0,0 +1,106 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import java.io.File; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; + +import org.yocto.bc.bitbake.BBCommonVars; +import org.yocto.bc.bitbake.BBRecipe; +import org.yocto.bc.ui.Activator; + +public class BitbakeImportAction extends AbstractBitbakeCommandAction { + + private class ImportJob extends Job { + + public ImportJob() { + super(getJobTitle()); + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + + try { + BBRecipe br = new BBRecipe(bbs, recipe.getLocationURI().getPath()); + br.initialize(); + String filePath = (String) br.get(BBCommonVars.S); + + //"${WORKDIR}/${PN}-${PV}" + if (filePath == null) { + filePath = ((String) br.get(BBCommonVars.WORKDIR)) + File.separator + ((String) br.get(BBCommonVars.PN)) + "-" + ((String) br.get(BBCommonVars.PV)); + } + + String projectName = (String) br.get(BBCommonVars.PN); + + if (filePath == null || projectName == null) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to parse recipe file."); + } + + File workdir = new File(filePath); + + if (workdir.exists() && workdir.isFile()) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, workdir.getPath() + " is an invalid workdir."); + } + + if (!workdir.exists()) { + execCommands(new String[] {"bitbake -c patch -b " + recipe.getLocationURI().getPath()}, monitor); + } + + if (!workdir.exists()) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to retrieve sources from BitBake. Consult console."); + } + + IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); + IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); + IProject proj = wsroot.getProject(projectName); + proj.create(desc, monitor); + proj.open(monitor); + + String copyCmd = "cp -r " + workdir.getAbsolutePath() + File.separator + "* \"" + proj.getLocationURI().getPath() + "\""; + execCommands(new String[] {copyCmd} , monitor); + + proj.refreshLocal(IResource.DEPTH_INFINITE, monitor); + + } catch (Exception e) { + e.printStackTrace(); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to create project.", e); + } + + return Status.OK_STATUS; + } + + } + + @Override + public String [] getCommands() { + return null; + } + + + @Override + public Job getJob() { + return new ImportJob(); + } + + @Override + public String getJobTitle() { + return "Importing " + recipe.getName(); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeRebuildRecipeAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeRebuildRecipeAction.java new file mode 100644 index 0000000..c5dedea --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeRebuildRecipeAction.java @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +/** + * Rebuild a recipe. + * @author kgilmer + * + */ +public class BitbakeRebuildRecipeAction extends AbstractBitbakeCommandAction { + + @Override + public String [] getCommands() { + return new String[] {"bitbake -c rebuild -b " + recipe.getLocationURI().getPath()}; + } + + @Override + public String getJobTitle() { + return "Rebuilding " + recipe.getName(); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java new file mode 100644 index 0000000..e92fac0 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2011 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; + +import org.eclipse.swt.widgets.Shell; + +import org.yocto.bc.ui.builder.BitbakeCommanderNature; + + +public class LaunchHobAction { + private static final String DIALOG_TITLE = "Launch HOB"; + + public void run(IAction action) { + IResource resource = getSelectedResource(); + if (resource == null) + return; + + IProject project = resource.getProject(); + LaunchHobDialog hobDialog = new LaunchHobDialog(new Shell(), DIALOG_TITLE, project); + hobDialog.open(); + String buildDir = hobDialog.getBuildDir(); + + if (buildDir != null) { + try { + BitbakeCommanderNature.launchHob(project,buildDir); + } catch (Exception e){ + System.out.println(e.getMessage()); + } + } + + } + + public void dispose() { + + } + + private IResource getSelectedResource() { + IWorkbench iworkbench = PlatformUI.getWorkbench(); + if (iworkbench == null){ + return null; + } + IWorkbenchWindow iworkbenchwindow = iworkbench.getActiveWorkbenchWindow(); + if (iworkbenchwindow == null) { + return null; + } + IWorkbenchPage iworkbenchpage = iworkbenchwindow.getActivePage(); + if (iworkbenchpage == null) { + return null; + } + ISelection sel = iworkbenchpage.getSelection(); + + if (!(sel instanceof IStructuredSelection)) + return null; + IStructuredSelection ss = (IStructuredSelection) sel; + Object element = ss.getFirstElement(); + if (element instanceof IResource) + return (IResource) element; + if (!(element instanceof IAdaptable)) + return null; + IAdaptable adaptable = (IAdaptable)element; + Object adapter = adaptable.getAdapter(IResource.class); + return (IResource) adapter; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java new file mode 100644 index 0000000..861360d --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java @@ -0,0 +1,328 @@ +/******************************************************************************* + * Copyright (c) 2011 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import java.util.Map; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.io.File; +import java.io.IOException; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Widget; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.ICommand; + +import org.yocto.bc.ui.builder.BitbakeBuilder; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; + +public class LaunchHobDialog extends Dialog { + private String title; + private Button buildButton; + private SelectionListener fSelectionListener; + private ModifyListener fModifyListener; + private Combo build_dir_combo; + + private IProject project; + private Shell shell; + private String build_dir; + + public LaunchHobDialog(Shell parentShell, String dialogTitle, IProject project) { + super(parentShell); + this.shell = parentShell; + this.project = project; + this.title = dialogTitle; + setShellStyle(getShellStyle() | SWT.RESIZE); + + fSelectionListener= new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) {} + + public void widgetSelected(SelectionEvent e) { + controlChanged(e.widget); + } + }; + + fModifyListener= new ModifyListener() { + public void modifyText(ModifyEvent e) { + controlModified(e.widget); + } + }; + + } + + public String getBuildDir() { + return build_dir; + } + @Override + protected Control createDialogArea(Composite parent) { + final Composite result = (Composite) super.createDialogArea(parent); + + try { + createComposite(result); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println("Have you ever set the project specific Yocto Settings?"); + System.out.println(e.getMessage()); + } + + return result; + } + + private void createComposite(Composite composite) throws Exception{ + Label root_label, sysroot_label; + + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + GridLayout layout = new GridLayout(2, false); + composite.setLayout(layout); + + gd= new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.horizontalSpan= 2; + composite.setLayoutData(gd); + + Label build_dir_label = new Label(composite, SWT.NONE); + build_dir_label.setText("Bitbake build directory: "); + Composite textContainer = new Composite(composite, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + build_dir_combo = new Combo(textContainer, SWT.DROP_DOWN); + build_dir_combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + initializeBuildCombo(); + + Button buildButton = addDirSelectButton(textContainer, build_dir_combo); + + //we add the listener at the end for avoiding the useless event trigger when control + //changed or modified. + buildButton.addSelectionListener(fSelectionListener); + build_dir_combo.addModifyListener(fModifyListener); + } + + private Button addDirSelectButton(final Composite parent, final Combo combo) { + Button button = new Button(parent, SWT.PUSH | SWT.LEAD); + button.setText("Browse"); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + String dirName = new DirectoryDialog(parent.getShell()).open(); + + if (dirName != null) { + combo.add(dirName); + combo.setText(dirName); + } + } + }); + return button; + } + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(title); + } + + protected void buttonPressed(int buttonId) { + if (buttonId == IDialogConstants.OK_ID) { + try { + build_dir = build_dir_combo.getText().toString(); + updateBuildSpec(build_dir); + super.buttonPressed(buttonId); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println(e.getMessage()); + } + } + else if (buttonId == IDialogConstants.CANCEL_ID) + { + super.buttonPressed(buttonId); + } + } + + private boolean validateInput() { + boolean valid = false; + String build_dir = build_dir_combo.getText().toString(); + if ((build_dir == null) || build_dir.isEmpty()) { + Display display = Display.getCurrent(); + Shell shell = new Shell(display); + MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); + msgBox.setText("Yocto Configuration Error"); + msgBox.setMessage("The specified build directory is empty!"); + msgBox.open(); + if (shell != null) + shell.dispose(); + return valid; + } + String project_path = project.getLocation().toString(); + File project_dir_file = new File(project_path); + File build_dir_file = new File(build_dir); + try { + if (isSubDirectory(project_dir_file, build_dir_file)) { + Display display = Display.getCurrent(); + Shell shell = new Shell(display); + MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); + msgBox.setText("Yocto Configuration Error"); + msgBox.setMessage("The specified build directory is a sub-dir of project path: " + project_path); + msgBox.open(); + if (shell != null) + shell.dispose(); + } else + valid = true; + } catch (IOException e) { + System.out.println(e.getMessage()); + } + return valid; + } + + private boolean isSubDirectory(File baseDir, File subDir) throws IOException { + baseDir = baseDir.getCanonicalFile(); + subDir = subDir.getCanonicalFile(); + + File parentFile = subDir; + while (parentFile != null) { + if (baseDir.equals(parentFile)) { + return true; + } + parentFile = parentFile.getParentFile(); + } + return false; + } + + private void controlChanged(Widget widget) { + + if (widget == buildButton) + { + } + } + + private void controlModified(Widget widget) { + if (widget == build_dir_combo) + { + + } + } + + private void initializeBuildCombo() + { + ArrayList items = new ArrayList (); + + try { + IProjectDescription desc = project.getDescription(); + + ICommand[] buildSpec = desc.getBuildSpec(); + if ((buildSpec != null) && (buildSpec.length != 0)) + { + for (int i = 0; i < buildSpec.length; i++) { + ICommand cmd = buildSpec[i]; + if (cmd.getBuilderName().equalsIgnoreCase(BitbakeBuilder.HOB_BUILD_ID)) + { + Map args = cmd.getArguments(); + if ((args != null) && !args.isEmpty()) + { + Iterator entries = args.entrySet().iterator(); + while (entries.hasNext()) { + Entry thisEntry = (Entry) entries.next(); + String key = (String)thisEntry.getKey(); + if (key.equalsIgnoreCase(BitbakeCommanderNature.BUILD_DIR_KEY)) { + build_dir_combo.removeAll(); + build_dir_combo.setItems(getValues((String)thisEntry.getValue())); + } + } + } + } + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + + private String[] getValues(String value) { + + if ((value != null) && !value.isEmpty()) + { + String[] pieces = value.split(","); + for (int i = 0; i < pieces.length; i++) + { + int start = pieces[i].indexOf("["); + if (start >= 0) + pieces[i] = pieces[i].substring(start+1); + int end = pieces[i].indexOf("]"); + if (end >= 0) + pieces[i] = pieces[i].substring(0, end); + pieces[i] = pieces[i].trim(); + } + return pieces; + } + return null; + } + + private void updateBuildSpec(String build_dir) + { + try { + String[] items = build_dir_combo.getItems(); + HashSet values = new HashSet(); + Map args = new HashMap(); + values.add(build_dir); + for (int i = 0; i < items.length; i++) { + values.add(items[i]); + } + args.put(BitbakeCommanderNature.BUILD_DIR_KEY, values.toString()); + IProjectDescription desc = project.getDescription(); + ICommand[] buildSpec = desc.getBuildSpec(); + boolean found = false; + if ((buildSpec != null) || (buildSpec.length != 0)) { + for (int i = 0; i < buildSpec.length; i++) { + ICommand cmd = buildSpec[i]; + if (cmd.getBuilderName().equalsIgnoreCase(BitbakeBuilder.HOB_BUILD_ID)) { + cmd.setArguments(args); + desc.setBuildSpec(buildSpec); + found = true; + break; + } + } + } + if (!found) { + ICommand[] newBuildSpec = new ICommand[buildSpec.length + 1]; + System.arraycopy(buildSpec, 0, newBuildSpec, 0, buildSpec.length); + ICommand cmd = desc.newCommand(); + cmd.setBuilderName(BitbakeBuilder.HOB_BUILD_ID); + cmd.setArguments(args); + newBuildSpec[newBuildSpec.length - 1] = cmd; + desc.setBuildSpec(newBuildSpec); + } + project.setDescription(desc, null); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java new file mode 100644 index 0000000..002075a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2011 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.commands.IHandler; + +public class LaunchHobHandler implements IHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + LaunchHobAction a = new LaunchHobAction(); + a.run(null); + return null; + } + + public void addHandlerListener(IHandlerListener handlerListener) { + // TODO Auto-generated method stub + + } + + public void dispose() { + // TODO Auto-generated method stub + + } + + public boolean isEnabled() { + // TODO Auto-generated method stub + return true; + } + + public boolean isHandled() { + // TODO Auto-generated method stub + return true; + } + + public void removeHandlerListener(IHandlerListener handlerListener) { + // TODO Auto-generated method stub + + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java new file mode 100644 index 0000000..b8b3144 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +import org.yocto.bc.ui.wizards.importProject.ImportYoctoProjectWizard; + +public class LaunchNewBitBakeProjectWizardAction implements IWorkbenchWindowActionDelegate { + + private IWorkbenchWindow window; + private IStructuredSelection selection; + + public void dispose() { + } + + public void init(IWorkbenchWindow window) { + this.window = window; + } + + public void run(IAction action) { + ImportYoctoProjectWizard wizard = new ImportYoctoProjectWizard(); + + wizard.init(window.getWorkbench(), selection); + WizardDialog wd = new WizardDialog(window.getShell(), wizard); + wd.create(); + wd.open(); + } + + public void selectionChanged(IAction action, ISelection selection) { + if (selection instanceof IStructuredSelection) { + this.selection = (IStructuredSelection) selection; + } + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java new file mode 100644 index 0000000..d30d37b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +import org.yocto.bc.ui.wizards.NewBitBakeFileRecipeWizard; + +public class LaunchNewRecipeWizardAction implements IWorkbenchWindowActionDelegate { + + private IWorkbenchWindow window; + private IStructuredSelection selection; + + public void dispose() { + } + + public void init(IWorkbenchWindow window) { + this.window = window; + } + + public void run(IAction action) { + NewBitBakeFileRecipeWizard wizard = new NewBitBakeFileRecipeWizard(); + + wizard.init(window.getWorkbench(), selection); + WizardDialog wd = new WizardDialog(window.getShell(), wizard); + wd.create(); + wd.open(); + } + + public void selectionChanged(IAction action, ISelection selection) { + if (selection instanceof IStructuredSelection) { + this.selection = (IStructuredSelection) selection; + } + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java new file mode 100644 index 0000000..eaf716e --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java @@ -0,0 +1,78 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.actions; + +import java.io.IOException; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; +import org.yocto.bc.ui.wizards.variable.VariableWizard; + +/** + * Action to launch the Variable Wizard. + * @author kgilmer + * + */ +public class LaunchVariableWizardAction implements IWorkbenchWindowActionDelegate { + + private IWorkbenchWindow window; + private Map session; + + public void dispose() { + } + + public void init(IWorkbenchWindow window) { + this.window = window; + } + + public void run(IAction action) { + VariableWizard wizard = new VariableWizard(session); + + WizardDialog wd = new WizardDialog(window.getShell(), wizard); + wd.create(); + wd.open(); + } + + public void selectionChanged(IAction action, ISelection selection) { + session = null; + + if (selection instanceof IStructuredSelection) { + Object element = ((IStructuredSelection)selection).getFirstElement(); + + if (element instanceof IResource) { + IProject p = ((IResource)element).getProject(); + + try { + if (p.isOpen() && p.hasNature(BitbakeCommanderNature.NATURE_ID)) { + session = Activator.getBBSession(((IResource)element).getProject().getLocationURI().getPath()); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } + } + } + + action.setEnabled(session != null); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java new file mode 100644 index 0000000..3705d9b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java @@ -0,0 +1,177 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.builder; + +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.xml.sax.SAXException; + +public class BitbakeBuilder extends IncrementalProjectBuilder { + + class SampleDeltaVisitor implements IResourceDeltaVisitor { + /* + * (non-Javadoc) + * + * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta) + */ + public boolean visit(IResourceDelta delta) throws CoreException { + IResource resource = delta.getResource(); + switch (delta.getKind()) { + case IResourceDelta.ADDED: + // handle added resource + //checkXML(resource); + break; + case IResourceDelta.REMOVED: + // handle removed resource + break; + case IResourceDelta.CHANGED: + // handle changed resource + //checkXML(resource); + break; + } + //return true to continue visiting children. + return true; + } + } +/* + class SampleResourceVisitor implements IResourceVisitor { + public boolean visit(IResource resource) { + + return true; + } + } +*/ +/* class XMLErrorHandler extends DefaultHandler { + + private IFile file; + + public XMLErrorHandler(IFile file) { + this.file = file; + } + + private void addMarker(SAXParseException e, int severity) { + BitbakeBuilder.this.addMarker(file, e.getMessage(), e + .getLineNumber(), severity); + } + + @Override + public void error(SAXParseException exception) throws SAXException { + addMarker(exception, IMarker.SEVERITY_ERROR); + } + + @Override + public void fatalError(SAXParseException exception) throws SAXException { + addMarker(exception, IMarker.SEVERITY_ERROR); + } + + @Override + public void warning(SAXParseException exception) throws SAXException { + addMarker(exception, IMarker.SEVERITY_WARNING); + } + } +*/ + public static final String BUILDER_ID = "org.yocto.bc.ui.builder.BitbakeBuilder"; + public static final String HOB_BUILD_ID = "org.yocto.bc.ui.builder.HOB"; + + private static final String MARKER_TYPE = "org.yocto.bc.ui.xmlProblem"; + + private SAXParserFactory parserFactory; + + private void addMarker(IFile file, String message, int lineNumber, + int severity) { + try { + IMarker marker = file.createMarker(MARKER_TYPE); + marker.setAttribute(IMarker.MESSAGE, message); + marker.setAttribute(IMarker.SEVERITY, severity); + if (lineNumber == -1) { + lineNumber = 1; + } + marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); + } catch (CoreException e) { + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.internal.events.InternalBuilder#build(int, + * java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + protected IProject[] build(int kind, Map args, IProgressMonitor monitor) + throws CoreException { + if (kind == FULL_BUILD) { + fullBuild(monitor); + } else { + IResourceDelta delta = getDelta(getProject()); + if (delta == null) { + fullBuild(monitor); + } else { + incrementalBuild(delta, monitor); + } + } + return null; + } + + /*void checkXML(IResource resource) { + if (resource instanceof IFile && resource.getName().endsWith(".xml")) { + IFile file = (IFile) resource; + deleteMarkers(file); + XMLErrorHandler reporter = new XMLErrorHandler(file); + try { + getParser().parse(file.getContents(), reporter); + } catch (Exception e1) { + } + } + }*/ + + private void deleteMarkers(IFile file) { + try { + file.deleteMarkers(MARKER_TYPE, false, IResource.DEPTH_ZERO); + } catch (CoreException ce) { + } + } + + protected void fullBuild(final IProgressMonitor monitor) + throws CoreException { + /*try { + getProject().accept(new SampleResourceVisitor()); + } catch (CoreException e) { + }*/ + } + + private SAXParser getParser() throws ParserConfigurationException, + SAXException { + if (parserFactory == null) { + parserFactory = SAXParserFactory.newInstance(); + } + return parserFactory.newSAXParser(); + } + + protected void incrementalBuild(IResourceDelta delta, + IProgressMonitor monitor) throws CoreException { + // the visitor does the work. + delta.accept(new SampleDeltaVisitor()); + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java new file mode 100644 index 0000000..fe2a997 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java @@ -0,0 +1,118 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + * Jessica Zhang - extend to support HOB build + *******************************************************************************/ +package org.yocto.bc.ui.builder; + +import java.util.ArrayList; + +import org.eclipse.core.resources.ICommand; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; + + +public class BitbakeCommanderNature implements IProjectNature { + + /** + * ID of this project nature + */ + public static final String NATURE_ID = "org.yocto.bc.ui.builder.BitbakeCommanderNature"; + public static final String BUILD_DIR_KEY = "org.yocto.bc.ui.builder.BitbakeCommander.BuildDir"; + private IProject project; + + public static void launchHob(IProject project, String buildDir) { + try { + ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager(); + ILaunchConfigurationType configType = + lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"); + ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "hob"); + ArrayList listValue = new ArrayList(); + listValue.add(new String("org.eclipse.ui.externaltools.launchGroup")); + w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue); + w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm"); + + String init_script = project.getLocation().toString() + "/oe-init-build-env "; + String argument = "-e \"source " + init_script + buildDir + ";hob";// + ";bash\""; + + w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument); + w_copy.launch(ILaunchManager.RUN_MODE, null); + + } catch (CoreException e) { + System.out.println(e.getMessage()); + } + } + /* + * (non-Javadoc) + * + * @see org.eclipse.core.resources.IProjectNature#configure() + */ + public void configure() throws CoreException { + IProjectDescription desc = project.getDescription(); + ICommand[] commands = desc.getBuildSpec(); + + for (int i = 0; i < commands.length; ++i) { + if (commands[i].getBuilderName().equals(BitbakeBuilder.BUILDER_ID)) { + return; + } + } + + ICommand[] newCommands = new ICommand[commands.length + 1]; + System.arraycopy(commands, 0, newCommands, 0, commands.length); + ICommand command = desc.newCommand(); + command.setBuilderName(BitbakeBuilder.BUILDER_ID); + newCommands[newCommands.length - 1] = command; + desc.setBuildSpec(newCommands); + project.setDescription(desc, null); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.resources.IProjectNature#deconfigure() + */ + public void deconfigure() throws CoreException { + IProjectDescription description = getProject().getDescription(); + ICommand[] commands = description.getBuildSpec(); + for (int i = 0; i < commands.length; ++i) { + if (commands[i].getBuilderName().equals(BitbakeBuilder.BUILDER_ID)) { + ICommand[] newCommands = new ICommand[commands.length - 1]; + System.arraycopy(commands, 0, newCommands, 0, i); + System.arraycopy(commands, i + 1, newCommands, i, + commands.length - i - 1); + description.setBuildSpec(newCommands); + return; + } + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.resources.IProjectNature#getProject() + */ + public IProject getProject() { + return project; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject) + */ + public void setProject(IProject project) { + this.project = project; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java new file mode 100644 index 0000000..f25148d --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java @@ -0,0 +1,106 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.builder; + +import java.util.Iterator; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; + +public class ToggleNatureAction implements IObjectActionDelegate { + + private ISelection selection; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + public void run(IAction action) { + if (selection instanceof IStructuredSelection) { + for (Iterator it = ((IStructuredSelection) selection).iterator(); it + .hasNext();) { + Object element = it.next(); + IProject project = null; + if (element instanceof IProject) { + project = (IProject) element; + } else if (element instanceof IAdaptable) { + project = (IProject) ((IAdaptable) element) + .getAdapter(IProject.class); + } + if (project != null) { + toggleNature(project); + } + } + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, + * org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + this.selection = selection; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, + * org.eclipse.ui.IWorkbenchPart) + */ + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + } + + /** + * Toggles sample nature on a project + * + * @param project + * to have sample nature added or removed + */ + private void toggleNature(IProject project) { + try { + IProjectDescription description = project.getDescription(); + String[] natures = description.getNatureIds(); + + for (int i = 0; i < natures.length; ++i) { + if (BitbakeCommanderNature.NATURE_ID.equals(natures[i])) { + // Remove the nature + String[] newNatures = new String[natures.length - 1]; + System.arraycopy(natures, 0, newNatures, 0, i); + System.arraycopy(natures, i + 1, newNatures, i, + natures.length - i - 1); + description.setNatureIds(newNatures); + project.setDescription(description, null); + return; + } + } + + // Add the nature + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = BitbakeCommanderNature.NATURE_ID; + description.setNatureIds(newNatures); + project.setDescription(description, null); + } catch (CoreException e) { + } + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java new file mode 100644 index 0000000..5901ee1 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java @@ -0,0 +1,48 @@ +package org.yocto.bc.ui.decorators; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IDecoration; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ILightweightLabelDecorator; + +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; + +public class ProjectDecorator implements ILightweightLabelDecorator { + + private ImageDescriptor image; + + public ProjectDecorator() { + image = Activator.getImageDescriptor("icons/oe_decorator.gif"); + } + + + public void decorate(Object element, IDecoration decoration) { + IProject p = (IProject) element; + + try { + if (p.isOpen() && p.hasNature(BitbakeCommanderNature.NATURE_ID)) { + decoration.addOverlay(image, IDecoration.TOP_RIGHT); + } + } catch (CoreException e) { + e.printStackTrace(); + } + } + + public void addListener(ILabelProviderListener arg0) { + } + + public void dispose() { + } + + public boolean isLabelProperty(Object arg0, String arg1) { + return false; + } + + + public void removeListener(ILabelProviderListener arg0) { + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java new file mode 100644 index 0000000..0bb3c20 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.decorators; + +import java.net.URL; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourceAttributes; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IDecoration; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ILightweightLabelDecorator; + +/** + * An example showing how to control when an element is decorated. This example + * decorates only elements that are instances of IResource and whose attribute + * is 'Read-only'. + * + * @see ILightweightLabelDecorator + */ +public class ReadOnly implements ILightweightLabelDecorator { + /** + * String constants for the various icon placement options from the template + * wizard. + */ + public static final String TOP_RIGHT = "TOP_RIGHT"; + + public static final String TOP_LEFT = "TOP_LEFT"; + + public static final String BOTTOM_RIGHT = "BOTTOM_RIGHT"; + + public static final String BOTTOM_LEFT = "BOTTOM_LEFT"; + + public static final String UNDERLAY = "UNDERLAY"; + + /** The integer value representing the placement options */ + private int quadrant; + + /** The icon image location in the project folder */ + private String iconPath = "icons/read_only.gif"; //NON-NLS-1 + + /** + * The image description used in + * addOverlay(ImageDescriptor, int) + */ + private ImageDescriptor descriptor; + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) + */ + public void decorate(Object element, IDecoration decoration) { + /** + * Checks that the element is an IResource with the 'Read-only' attribute + * and adds the decorator based on the specified image description and the + * integer representation of the placement option. + */ + IResource resource = (IResource) element; + ResourceAttributes attrs = resource.getResourceAttributes(); + if(attrs!=null) { + if (attrs.isReadOnly()){ + URL url = Platform.find( + Platform.getBundle("org.yocto.bc.ui"), new Path(iconPath)); //NON-NLS-1 + + if (url == null) + return; + descriptor = ImageDescriptor.createFromURL(url); + quadrant = IDecoration.TOP_RIGHT; + decoration.addOverlay(descriptor,quadrant); + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) + */ + public void addListener(ILabelProviderListener listener) { + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() + */ + public void dispose() { + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) + */ + public boolean isLabelProperty(Object element, String property) { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) + */ + public void removeListener(ILabelProviderListener listener) { + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java new file mode 100644 index 0000000..9478423 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java @@ -0,0 +1,118 @@ +/** + * + */ +package org.yocto.bc.ui.editors.bitbake; + +import java.io.File; +import java.util.Map; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.ITextHover; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.text.Region; + +import org.yocto.bc.bitbake.BBRecipe; +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.ui.Activator; + +/** + * Maps BB Variables in the editor to BBSession + * @author kgilmer + * + */ +class BBVariableTextHover implements ITextHover { + private final BBSession session; + private volatile Map envMap; + + public BBVariableTextHover(BBSession session, String file) { + this.session = session; + envMap = session; + LoadRecipeJob loadRecipeJob = new LoadRecipeJob(getFilename(file), file); + loadRecipeJob.schedule(); + } + + private String getFilename(String file) { + + String [] elems = file.split(File.separator); + + return elems[elems.length - 1]; + } + + public IRegion getHoverRegion(ITextViewer tv, int off) { + return new Region(off, 0); + } + + public String getHoverInfo(ITextViewer tv, IRegion r) { + try { + IRegion lineRegion = tv.getDocument().getLineInformationOfOffset(r.getOffset()); + + return getBBVariable(tv.getDocument().get(lineRegion.getOffset(), lineRegion.getLength()).toCharArray(), r.getOffset() - lineRegion.getOffset()); + } catch (Exception e) { + return ""; + } + } + + private String getBBVariable(char[] line, int offset) { + // Find start of word. + int i = offset; + + while (line[i] != ' ' && line[i] != '$' && i > 0) { + i--; + } + + if (i < 0 || line[i] != '$') { + return ""; //this is not a BB variable. + } + + // find end of word + int start = i; + i = offset; + + while (line[i] != ' ' && line[i] != '}' && i <= line.length) { + i++; + } + + if (line[i] != '}') { + return ""; //this bb variable didn't terminate as expected + } + + String key = new String(line, start + 2, i - start - 2); + String val = (String) envMap.get(key); + + if (val == null) { + val = ""; + } + + if (val.length() > 64) { + val = val.substring(0, 64) + '\n' + val.substring(65); + } + + return val; + } + + private class LoadRecipeJob extends Job { + private final String filePath; + + public LoadRecipeJob(String name, String filePath) { + super("Extracting BitBake environment for " + name); + this.filePath = filePath; + } + + @Override + protected IStatus run(IProgressMonitor mon) { + try { + BBRecipe recipe = Activator.getBBRecipe(session, filePath); + recipe.initialize(); + envMap = recipe; + } catch (Exception e) { + return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unable to load session for " + filePath, e); + } + + return Status.OK_STATUS; + } + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java new file mode 100644 index 0000000..4713bc3 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java @@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentExtension3; +import org.eclipse.jface.text.IDocumentPartitioner; +import org.eclipse.jface.text.rules.FastPartitioner; +import org.eclipse.jface.text.rules.IPredicateRule; +import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; +import org.eclipse.jface.text.rules.SingleLineRule; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.ui.editors.text.FileDocumentProvider; + +/** + * Document provider for BB recipe. + * @author kgilmer + * + */ +public class BitBakeDocumentProvider extends FileDocumentProvider { + /** + * The recipe partitioning. It contains two partition types: {@link #RECIPE_CODE} and + * {@link #RECIPE_COMMENT}. + */ + public static final String RECIPE_PARTITIONING= "org.recipeeditor.recipepartitioning"; //$NON-NLS-1$ + + public static final String RECIPE_CODE= IDocument.DEFAULT_CONTENT_TYPE; + public static final String RECIPE_COMMENT= "RECIPE_COMMENT"; //$NON-NLS-1$ + + private static final String[] CONTENT_TYPES= { + RECIPE_CODE, + RECIPE_COMMENT + }; + + private IDocumentPartitioner createRecipePartitioner() { + IPredicateRule[] rules= { new SingleLineRule("#", null, new Token(RECIPE_COMMENT), (char) 0, true, false) }; //$NON-NLS-1$ + + RuleBasedPartitionScanner scanner= new RuleBasedPartitionScanner(); + scanner.setPredicateRules(rules); + + return new FastPartitioner(scanner, CONTENT_TYPES); + } + + @Override + protected void setupDocument(Object element,IDocument document) { + if (document instanceof IDocumentExtension3) { + IDocumentExtension3 ext= (IDocumentExtension3) document; + IDocumentPartitioner partitioner= createRecipePartitioner(); + ext.setDocumentPartitioner(RECIPE_PARTITIONING, partitioner); + partitioner.connect(document); + } + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java new file mode 100644 index 0000000..b33f030 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java @@ -0,0 +1,75 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import java.io.IOException; +import java.util.ResourceBundle; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.Status; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor; +import org.eclipse.ui.texteditor.ContentAssistAction; +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; + +import org.yocto.bc.ui.Activator; + +/** + * Editor for BB Recipe + * @author kgilmer + * + */ +public class BitBakeFileEditor extends AbstractDecoratedTextEditor { + + public static final String EDITOR_ID = "org.yocto.bc.ui.editors.BitBakeFileEditor"; + static final String CONTENT_ASSIST= "ContentAssist"; + private BitBakeSourceViewerConfiguration viewerConfiguration; + private IFile targetFile; + + public BitBakeFileEditor() { + super(); + viewerConfiguration = new BitBakeSourceViewerConfiguration(getSharedColors(), getPreferenceStore()); + setSourceViewerConfiguration(viewerConfiguration); + setDocumentProvider(new BitBakeDocumentProvider()); + } + + @Override + protected void createActions() { + super.createActions(); + + ResourceBundle bundle= RecipeEditorMessages.getBundle(); + ContentAssistAction action= new ContentAssistAction(bundle, "contentAssist.", this); //$NON-NLS-1$ + action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); + setAction(CONTENT_ASSIST, action); + } + + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + + if (input instanceof FileEditorInput) { + IProject p = ((FileEditorInput)input).getFile().getProject(); + targetFile = ((FileEditorInput)input).getFile(); + viewerConfiguration.setTargetFile(targetFile); + + try { + viewerConfiguration.setBBSession(Activator.getBBSession(p.getLocationURI().getPath())); + } catch (IOException e) { + e.printStackTrace(); + throw new PartInitException(Status.CANCEL_STATUS); + } + } + super.init(site, input); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java new file mode 100644 index 0000000..56cd014 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java @@ -0,0 +1,195 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.text.ITextHover; +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.contentassist.ContentAssistant; +import org.eclipse.jface.text.contentassist.IContentAssistant; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.reconciler.IReconciler; +import org.eclipse.jface.text.rules.DefaultDamagerRepairer; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.SingleLineRule; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WordRule; +import org.eclipse.jface.text.source.ISharedTextColors; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; + +import org.yocto.bc.bitbake.BBLanguageHelper; +import org.yocto.bc.bitbake.BBSession; + +public class BitBakeSourceViewerConfiguration extends TextSourceViewerConfiguration { + + private static final class WordDetector implements IWordDetector { + public boolean isWordPart(char c) { + return !Character.isWhitespace(c); + } + + public boolean isWordStart(char c) { + return !Character.isWhitespace(c); + } + } + + private final ISharedTextColors fSharedColors; + private BBSession session; + private IFile targetFile; + private BBVariableTextHover textHover = null; + + public BitBakeSourceViewerConfiguration(ISharedTextColors sharedColors, IPreferenceStore store) { + super(store); + fSharedColors = sharedColors; + } + + protected void setTargetFile(IFile targetFile) { + this.targetFile = targetFile; + } + + public ITextHover getTextHover(ISourceViewer sv, String contentType) { + //only .bb file support Text Hover. + if (textHover == null && targetFile.getFileExtension().equals(BBLanguageHelper.BITBAKE_RECIPE_FILE_EXTENSION)) { + textHover = new BBVariableTextHover(session, targetFile.getLocationURI().getPath()); + } + + return textHover; + } + + private void addDamagerRepairer(PresentationReconciler reconciler, RuleBasedScanner commentScanner, String contentType) { + DefaultDamagerRepairer commentDamagerRepairer = new DefaultDamagerRepairer(commentScanner); + reconciler.setDamager(commentDamagerRepairer, contentType); + reconciler.setRepairer(commentDamagerRepairer, contentType); + } + + private RuleBasedScanner createCommentScanner() { + Color green = fSharedColors.getColor(new RGB(16, 96, 16)); + RuleBasedScanner commentScanner = new RuleBasedScanner(); + commentScanner.setDefaultReturnToken(new Token(new TextAttribute(green, null, SWT.ITALIC))); + return commentScanner; + } + + private IRule createCustomFunctionRule() { + Color blue = fSharedColors.getColor(new RGB(130, 0, 0)); + IRule rule = new CustomFunctionRule(new Token(new TextAttribute(blue, null, SWT.BOLD))); + + return rule; + } + + private SingleLineRule createFunctionNameRule() { + Color red = fSharedColors.getColor(new RGB(150, 0, 96)); + SingleLineRule stepRule = new SingleLineRule("do_", ")", new Token(new TextAttribute(red, null, SWT.BOLD))); //$NON-NLS-1$ //$NON-NLS-2$ + stepRule.setColumnConstraint(0); + return stepRule; + } + + private SingleLineRule createInlineVariableRule() { + Color blue = fSharedColors.getColor(new RGB(50, 50, 100)); + SingleLineRule stepRule = new SingleLineRule("${", "}", new Token(new TextAttribute(blue, null, SWT.BOLD))); //$NON-NLS-1$ //$NON-NLS-2$ + return stepRule; + } + + private WordRule createKeywordRule() { + WordRule keywordRule = new WordRule(new WordDetector()); + IToken token = new Token(new TextAttribute(fSharedColors.getColor(new RGB(96, 96, 0)), null, SWT.NONE)); + + for (int i = 0; i < BBLanguageHelper.BITBAKE_KEYWORDS.length; ++i) { + + keywordRule.addWord(BBLanguageHelper.BITBAKE_KEYWORDS[i], token); + keywordRule.setColumnConstraint(0); + } + + return keywordRule; + } + + private RuleBasedScanner createRecipeScanner() { + RuleBasedScanner recipeScanner = new RuleBasedScanner(); + + IRule[] rules = { createKeywordRule(), createShellKeywordRule(), createStringLiteralRule(), createVariableRule(), createFunctionNameRule(), createCustomFunctionRule(), + createInlineVariableRule() }; + recipeScanner.setRules(rules); + return recipeScanner; + } + + private WordRule createShellKeywordRule() { + WordRule keywordRule = new WordRule(new WordDetector()); + IToken token = new Token(new TextAttribute(fSharedColors.getColor(new RGB(0, 64, 92)), null, SWT.NONE)); + + for (int i = 0; i < BBLanguageHelper.SHELL_KEYWORDS.length; ++i) { + keywordRule.addWord(BBLanguageHelper.SHELL_KEYWORDS[i], token); + } + + return keywordRule; + } + + private SingleLineRule createStringLiteralRule() { + Color red = fSharedColors.getColor(new RGB(50, 50, 100)); + SingleLineRule rule = new SingleLineRule("\"", "\"", new Token(new TextAttribute(red, null, SWT.NONE)), '\\'); + + return rule; + } + + private IRule createVariableRule() { + Color blue = fSharedColors.getColor(new RGB(0, 0, 200)); + IRule rule = new VariableRule(new Token(new TextAttribute(blue, null, SWT.NONE))); + + return rule; + } + + @Override + public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { + return new String[] { BitBakeDocumentProvider.RECIPE_CODE, BitBakeDocumentProvider.RECIPE_COMMENT }; + } + + @Override + public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) { + return BitBakeDocumentProvider.RECIPE_PARTITIONING; + } + + @Override + public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) { + ContentAssistant assistant = new ContentAssistant(); + assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); + + // assistant.setContentAssistProcessor(new HippieProposalProcessor(), + // BitBakeDocumentProvider.RECIPE_COMMENT); + assistant.setContentAssistProcessor(new RecipeCompletionProcessor(), BitBakeDocumentProvider.RECIPE_CODE); + + return assistant; + } + + public IReconciler getReconciler(ISourceViewer sourceViewer) { + return null; + } + + @Override + public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { + PresentationReconciler reconciler = new PresentationReconciler(); + reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); + + addDamagerRepairer(reconciler, createCommentScanner(), BitBakeDocumentProvider.RECIPE_COMMENT); + addDamagerRepairer(reconciler, createRecipeScanner(), BitBakeDocumentProvider.RECIPE_CODE); + + return reconciler; + } + + public void setBBSession(BBSession session) { + this.session = session; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java new file mode 100644 index 0000000..223a25d --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java @@ -0,0 +1,94 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import org.eclipse.jface.text.rules.ICharacterScanner; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.Token; + +/** + * Rule for def_ BB Recipe functions + * @author kgilmer + * + */ +final class CustomFunctionRule implements IRule { + + /** Token to return for this rule */ + private final IToken fToken; + + /** + * Creates a new operator rule. + * + * @param token + * Token to use for this rule + */ + public CustomFunctionRule(IToken token) { + fToken = token; + } + + public IToken evaluate(ICharacterScanner scanner) { + if (scanner.getColumn() > 0) { + return Token.UNDEFINED; + } + + int i = scanner.read(); + int c = 1; + + if (!Character.isLetter(i) && i != 10) { + scanner.unread(); + return Token.UNDEFINED; + } + + if (i == 'd' && scanAhead(scanner, "o_".toCharArray())) { + scanner.unread(); + return Token.UNDEFINED; + } + + while (i != ICharacterScanner.EOF && i != 10) { + i = scanner.read(); + c++; + + if (i == '(') { + readUntil(scanner, ')'); + + return fToken; + } + } + + for (int t = 0; t < c; t++) { + scanner.unread(); + } + + return Token.UNDEFINED; + } + + private void readUntil(ICharacterScanner scanner, int c) { + int i; + do { + i = scanner.read(); + } while (! (i == ICharacterScanner.EOF) && ! (i == c)); + } + + private boolean scanAhead(ICharacterScanner scanner, char [] chars) { + boolean v = true; + for (int i = 0; i < chars.length; ++i) { + if (! (scanner.read() == chars[i])) { + v = false; + for (int j = 0; j < i; ++j) { + scanner.unread(); + } + break; + } + } + return v; + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java new file mode 100644 index 0000000..034187a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java @@ -0,0 +1,127 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + * Lianhao Lu (Intel) - remove compile warnings + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.text.Region; +import org.eclipse.jface.text.contentassist.ICompletionProposal; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.text.contentassist.IContextInformation; +import org.eclipse.jface.text.contentassist.IContextInformationValidator; +import org.eclipse.jface.text.templates.DocumentTemplateContext; +import org.eclipse.jface.text.templates.Template; +import org.eclipse.jface.text.templates.TemplateContext; +import org.eclipse.jface.text.templates.TemplateContextType; +import org.eclipse.jface.text.templates.TemplateProposal; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.ide.IDE.SharedImages; +import org.eclipse.ui.PlatformUI; + +import org.yocto.bc.bitbake.BBLanguageHelper; +import org.yocto.bc.ui.Activator; + +class RecipeCompletionProcessor implements IContentAssistProcessor { + + private static final String CONTEXT_ID= "bitbake_variables"; //$NON-NLS-1$ + private final TemplateContextType fContextType= new TemplateContextType(CONTEXT_ID, "Common BitBake Variables"); //$NON-NLS-1$ + //private final TemplateContextType fKeywordContextType= new TemplateContextType("bitbake_keywords", "BitBake Keywords"); //$NON-NLS-1$ + private final TemplateContextType fFunctionContextType = new TemplateContextType("bitbake_functions", "BitBake Functions"); + + RecipeCompletionProcessor() { + } + + public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { + IDocument document= viewer.getDocument(); + Region region= new Region(offset, 0); + + TemplateContext templateContext= new DocumentTemplateContext(fContextType, document, offset, 0); + //TemplateContext keywordContext = new DocumentTemplateContext(fKeywordContextType, document, offset, 0); + TemplateContext functionContext = new DocumentTemplateContext(fFunctionContextType, document, offset, 0); + + List proposals = new ArrayList(); + + getVariableTemplateProposals(templateContext, region, proposals); + // getKeywordTemplateProposals(keywordContext, region, proposals); + getAddTaskTemplateProposals(templateContext, region, proposals); + getFunctionTemplateProposals(functionContext, region, proposals); + + return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]); + } + + public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { + return null; + } + + private Template generateVariableTemplate(String name, String description) { + + return new Template(name, description, CONTEXT_ID, name + " = \"${" + name.toLowerCase() + "}\"", false); + } + + private void getAddTaskTemplateProposals(TemplateContext templateContext, Region region, List p) { + p.add(new TemplateProposal(new Template("addtask", "addtask statement", CONTEXT_ID, "addtask ${task_name} after ${do_previous_task} before ${do_next_task}", false),templateContext, region, PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJS_BKMRK_TSK))); + } + + + public char[] getCompletionProposalAutoActivationCharacters() { + return null; + } + + public char[] getContextInformationAutoActivationCharacters() { + return null; + } + + public IContextInformationValidator getContextInformationValidator() { + return null; + } + + public String getErrorMessage() { + return null; + } + + private void getFunctionTemplateProposals(TemplateContext templateContext, Region region, List p) { + String [] keywords = BBLanguageHelper.BITBAKE_STANDARD_FUNCTIONS; + Image img = Activator.getDefault().getImageRegistry().get(Activator.IMAGE_FUNCTION); + Arrays.sort(keywords); + + for (int i = 0; i < keywords.length; ++i) { + p.add(new TemplateProposal(new Template(keywords[i], keywords[i] + " function", CONTEXT_ID, "do_" + keywords[i] + "() {\n\n}", false), templateContext, region, img)); + } + } + /* + private void getKeywordTemplateProposals(TemplateContext templateContext, Region region, List p) { + String [] keywords = BBLanguageHelper.BITBAKE_KEYWORDS; + + Arrays.sort(keywords); + + for (int i = 0; i < keywords.length; ++i) { + p.add(new TemplateProposal(new Template(keywords[i], keywords[i] + " keyword", CONTEXT_ID, keywords[i] + " ", false),templateContext, region, null)); + } + } + */ + + private void getVariableTemplateProposals(TemplateContext templateContext, Region region, List p) { + Map n = BBLanguageHelper.getCommonBitbakeVariables(); + Image img = Activator.getDefault().getImageRegistry().get(Activator.IMAGE_VARIABLE); + for (Iterator i = n.keySet().iterator(); i.hasNext();) { + String name = (String) i.next(); + String description = (String) n.get(name); + p.add(new TemplateProposal(generateVariableTemplate(name, description), templateContext, region, img)); + } + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java new file mode 100644 index 0000000..f27951b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.editors.text.TextEditorActionContributor; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; +import org.eclipse.ui.texteditor.RetargetTextEditorAction; + +public class RecipeEditorActionContributor extends TextEditorActionContributor { + + private RetargetTextEditorAction fContentAssist; + + public RecipeEditorActionContributor() { + fContentAssist= new RetargetTextEditorAction(RecipeEditorMessages.getBundle(), "contentAssist."); //$NON-NLS-1$ + fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); + } + + @Override + public void contributeToMenu(IMenuManager menu) { + super.contributeToMenu(menu); + + IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); + if (editMenu != null) { + editMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fContentAssist); + } + } + + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + if (part instanceof ITextEditor) { + fContentAssist.setAction(getAction((ITextEditor) part, BitBakeFileEditor.CONTENT_ASSIST)); + } + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java new file mode 100644 index 0000000..020a25a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java @@ -0,0 +1,21 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import java.util.ResourceBundle; + +public class RecipeEditorMessages { + + public static ResourceBundle getBundle() { + return ResourceBundle.getBundle(RecipeEditorMessages.class.getName()); + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties new file mode 100644 index 0000000..76c670b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties @@ -0,0 +1,14 @@ +######################################################### +# Copyright (c) 2006 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Common Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/cpl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +########################################################## +contentAssist.label=Content Assist +contentAssist.tooltip=Content Assist +contentAssist.image= +contentAssist.description= Invokes content assist \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java new file mode 100644 index 0000000..750705a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java @@ -0,0 +1,69 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.editors.bitbake; + +import org.eclipse.jface.text.rules.ICharacterScanner; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.Token; + +final class VariableRule implements IRule { + + /** Token to return for this rule */ + private final IToken fToken; + + /** + * Creates a new operator rule. + * + * @param token + * Token to use for this rule + */ + public VariableRule(IToken token) { + fToken = token; + } + + public IToken evaluate(ICharacterScanner scanner) { + if (scanner.getColumn() > 0) { + return Token.UNDEFINED; + } + + int i = scanner.read(); + int c = 1; + + if (!Character.isLetter(i) && i != 10) { + scanner.unread(); + return Token.UNDEFINED; + } + + int p = i; + + while (i != ICharacterScanner.EOF && i != 10) { + p = i; + i = scanner.read(); + c++; + + if (i == '=') { + scanner.unread(); + + if (p == '?' || p == '+') { + scanner.unread(); + } + return fToken; + } + } + + for (int t = 0; t < c; t++) { + scanner.unread(); + } + + return Token.UNDEFINED; + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java new file mode 100644 index 0000000..0a82fdd --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.filesystem; + +import org.eclipse.osgi.util.NLS; + +/** + * Provides translatable messages for the file system bundle + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.core.internal.filesystem.messages"; //$NON-NLS-1$ + + public static String copying; + public static String couldnotDelete; + public static String couldnotDeleteReadOnly; + public static String couldNotLoadLibrary; + public static String couldNotMove; + public static String couldNotRead; + public static String couldNotWrite; + public static String deleteProblem; + public static String deleting; + public static String failedCreateWrongType; + public static String failedMove; + public static String failedReadDuringWrite; + public static String fileExists; + public static String fileNotFound; + public static String moving; + public static String noFileSystem; + public static String noImplDelete; + public static String noImplWrite; + public static String noScheme; + public static String notAFile; + public static String readOnlyParent; + + static { + // initialize resource bundles + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java new file mode 100644 index 0000000..85794f1 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java @@ -0,0 +1,515 @@ +/******************************************************************************* + * Copyright (c) 2005, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Ken Gilmer - adaptation from internal class. + *******************************************************************************/ +package org.yocto.bc.ui.filesystem; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.util.List; + +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileInfo; +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.filesystem.IFileSystem; +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.filesystem.provider.FileInfo; +import org.eclipse.core.filesystem.provider.FileStore; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.bitbake.ProjectInfoHelper; +import org.yocto.bc.bitbake.ShellSession; + +/** + * File system implementation based on storage of files in the local + * operating system's file system. + */ +public class OEFile extends FileStore { + private static int attributes(File aFile) { + if (!aFile.exists() || aFile.canWrite()) + return EFS.NONE; + return EFS.ATTRIBUTE_READ_ONLY; + } + + /** + * The java.io.File that this store represents. + */ + protected final File file; + private List ignorePaths; + + /** + * The absolute file system path of the file represented by this store. + */ + protected final String filePath; + + private final String root; + + /** + * Creates a new local file. + * + * @param file The file this local file represents + * @param root + */ + public OEFile(File file, List ignorePaths, String root) { + this.file = file; + this.ignorePaths = ignorePaths; + this.root = root; + this.filePath = file.getAbsolutePath(); + } + + /** + * This method is called after a failure to modify a file or directory. + * Check to see if the parent is read-only and if so then + * throw an exception with a more specific message and error code. + * + * @param target The file that we failed to modify + * @param exception The low level exception that occurred, or null + * @throws CoreException A more specific exception if the parent is read-only + */ + private void checkReadOnlyParent(File target, Throwable exception) throws CoreException { + File parent = target.getParentFile(); + if (parent != null && (attributes(parent) & EFS.ATTRIBUTE_READ_ONLY) != 0) { + String message = NLS.bind(Messages.readOnlyParent, target.getAbsolutePath()); + Policy.error(EFS.ERROR_PARENT_READ_ONLY, message, exception); + } + } + + @Override + public String[] childNames(int options, IProgressMonitor monitor) { + String[] names = file.list(); + return (names == null ? EMPTY_STRING_ARRAY : names); + } + + /* + * detect if the path is potential builddir + */ + private boolean isPotentialBuildDir(String path) { + boolean ret = true; + for (int i=0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) { + if((new File(path + BBSession.BUILDDIR_INDICATORS[i])).exists() == false) { + ret=false; + break; + } + } + return ret; + } + + /* + * try to find items for ignoreList + */ + private void updateIgnorePaths(String path, List list) { + if(isPotentialBuildDir(path)) { + BBSession config = null; + try { + ShellSession shell = new ShellSession(ShellSession.SHELL_TYPE_BASH, new File(root), + ProjectInfoHelper.getInitScriptPath(root) + " " + path, null); + config = new BBSession(shell, root, true); + config.initialize(); + } catch(Exception e) { + e.printStackTrace(); + return; + } + if (config.get("TMPDIR") == null || config.get("DL_DIR") == null || config.get("SSTATE_DIR") == null) { + //wrong guess about the buildDir + return; + }else { + if(!list.contains(config.get("TMPDIR"))) { + list.add(config.get("TMPDIR")); + } + if(!list.contains(config.get("DL_DIR"))) { + list.add(config.get("DL_DIR")); + } + if(!list.contains(config.get("SSTATE_DIR"))) { + list.add(config.get("SSTATE_DIR")); + } + } + } + } + + @Override + public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException { + String[] children = childNames(options, monitor); + IFileStore[] wrapped = new IFileStore[children.length]; + + for (int i = 0; i < wrapped.length; i++) { + String fullPath = file.toString() +File.separatorChar + children[i]; + + updateIgnorePaths(fullPath, ignorePaths); + if (ignorePaths.contains(fullPath)) { + wrapped[i] = getDeadChild(children[i]); + } else { + wrapped[i] = getChild(children[i]); + } + } + + return wrapped; + } + + @Override + public void copy(IFileStore destFile, int options, IProgressMonitor monitor) throws CoreException { + if (destFile instanceof OEFile) { + File source = file; + File destination = ((OEFile) destFile).file; + //handle case variants on a case-insensitive OS, or copying between + //two equivalent files in an environment that supports symbolic links. + //in these nothing needs to be copied (and doing so would likely lose data) + try { + if (source.getCanonicalFile().equals(destination.getCanonicalFile())) { + //nothing to do + return; + } + } catch (IOException e) { + String message = NLS.bind(Messages.couldNotRead, source.getAbsolutePath()); + Policy.error(EFS.ERROR_READ, message, e); + } + } + //fall through to super implementation + super.copy(destFile, options, monitor); + } + + @Override + public void delete(int options, IProgressMonitor monitor) throws CoreException { + if (monitor == null) + monitor = new NullProgressMonitor(); + else + monitor = new NullProgressMonitor(); + try { + monitor.beginTask(NLS.bind(Messages.deleting, this), 200); + String message = Messages.deleteProblem; + MultiStatus result = new MultiStatus(Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null); + + //don't allow Eclipse to delete entire OE directory + + if (!isProject()) { + internalDelete(file, filePath, result, monitor); + } + + if (!result.isOK()) + throw new CoreException(result); + } finally { + monitor.done(); + } + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof OEFile)) + return false; + + OEFile otherFile = (OEFile) obj; + + return file.equals(otherFile.file); + } + + @Override + public IFileInfo fetchInfo(int options, IProgressMonitor monitor) { + //in-lined non-native implementation + FileInfo info = new FileInfo(file.getName()); + final long lastModified = file.lastModified(); + if (lastModified <= 0) { + //if the file doesn't exist, all other attributes should be default values + info.setExists(false); + return info; + } + info.setLastModified(lastModified); + info.setExists(true); + info.setLength(file.length()); + info.setDirectory(file.isDirectory()); + info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, file.exists() && !file.canWrite()); + info.setAttribute(EFS.ATTRIBUTE_HIDDEN, file.isHidden()); + return info; + } + + @Override + public IFileStore getChild(IPath path) { + return new OEFile(new File(file, path.toOSString()), ignorePaths, root); + } + + @Override + public IFileStore getChild(String name) { + return new OEFile(new File(file, name), ignorePaths, root); + } + + private IFileStore getDeadChild(String name) { + return new OEIgnoreFile(new File(file, name)); + } + + /* + * (non-Javadoc) + * @see org.eclipse.core.filesystem.IFileStore#getFileSystem() + */ + @Override + public IFileSystem getFileSystem() { + return OEFileSystem.getInstance(); + } + + @Override + public String getName() { + return file.getName(); + } + + @Override + public IFileStore getParent() { + File parent = file.getParentFile(); + return parent == null ? null : new OEFile(parent, ignorePaths, root); + } + + @Override + public int hashCode() { + return file.hashCode(); + } + + /** + * Deletes the given file recursively, adding failure info to + * the provided status object. The filePath is passed as a parameter + * to optimize java.io.File object creation. + */ + private boolean internalDelete(File target, String pathToDelete, MultiStatus status, IProgressMonitor monitor) { + //first try to delete - this should succeed for files and symbolic links to directories + if (target.delete() || !target.exists()) + return true; + if (target.isDirectory()) { + monitor.subTask(NLS.bind(Messages.deleting, target)); + String[] list = target.list(); + if (list == null) + list = EMPTY_STRING_ARRAY; + int parentLength = pathToDelete.length(); + boolean failedRecursive = false; + for (int i = 0, imax = list.length; i < imax; i++) { + //optimized creation of child path object + StringBuffer childBuffer = new StringBuffer(parentLength + list[i].length() + 1); + childBuffer.append(pathToDelete); + childBuffer.append(File.separatorChar); + childBuffer.append(list[i]); + String childName = childBuffer.toString(); + // try best effort on all children so put logical OR at end + failedRecursive = !internalDelete(new java.io.File(childName), childName, status, monitor) || failedRecursive; + monitor.worked(1); + } + try { + // don't try to delete the root if one of the children failed + if (!failedRecursive && target.delete()) + return true; + } catch (Exception e) { + // we caught a runtime exception so log it + String message = NLS.bind(Messages.couldnotDelete, target.getAbsolutePath()); + status.add(new Status(IStatus.ERROR, Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, e)); + return false; + } + } + //if we got this far, we failed + String message = null; + if (fetchInfo().getAttribute(EFS.ATTRIBUTE_READ_ONLY)) + message = NLS.bind(Messages.couldnotDeleteReadOnly, target.getAbsolutePath()); + else + message = NLS.bind(Messages.couldnotDelete, target.getAbsolutePath()); + status.add(new Status(IStatus.ERROR, Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null)); + return false; + } + + @Override + public boolean isParentOf(IFileStore other) { + if (!(other instanceof OEFile)) + return false; + String thisPath = filePath; + String thatPath = ((OEFile) other).filePath; + int thisLength = thisPath.length(); + int thatLength = thatPath.length(); + //if equal then not a parent + if (thisLength >= thatLength) + return false; + if (getFileSystem().isCaseSensitive()) { + if (thatPath.indexOf(thisPath) != 0) + return false; + } else { + if (thatPath.toLowerCase().indexOf(thisPath.toLowerCase()) != 0) + return false; + } + //The common portion must end with a separator character for this to be a parent of that + return thisPath.charAt(thisLength - 1) == File.separatorChar || thatPath.charAt(thisLength) == File.separatorChar; + } + + /** + * @return + */ + private boolean isProject() { + return this.file.toString().equals(root); + } + + @Override + public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException { + boolean shallow = (options & EFS.SHALLOW) != 0; + //must be a directory + if (shallow) + file.mkdir(); + else + file.mkdirs(); + if (!file.isDirectory()) { + checkReadOnlyParent(file, null); + String message = NLS.bind(Messages.failedCreateWrongType, filePath); + Policy.error(EFS.ERROR_WRONG_TYPE, message); + } + return this; + } + + @Override + public void move(IFileStore destFile, int options, IProgressMonitor monitor) throws CoreException { + if (!(destFile instanceof OEFile)) { + super.move(destFile, options, monitor); + return; + } + File source = file; + File destination = ((OEFile) destFile).file; + boolean overwrite = (options & EFS.OVERWRITE) != 0; + monitor = Policy.monitorFor(monitor); + try { + monitor.beginTask(NLS.bind(Messages.moving, source.getAbsolutePath()), 10); + //this flag captures case renaming on a case-insensitive OS, or moving + //two equivalent files in an environment that supports symbolic links. + //in these cases we NEVER want to delete anything + boolean sourceEqualsDest = false; + try { + sourceEqualsDest = source.getCanonicalFile().equals(destination.getCanonicalFile()); + } catch (IOException e) { + String message = NLS.bind(Messages.couldNotMove, source.getAbsolutePath()); + Policy.error(EFS.ERROR_WRITE, message, e); + } + if (!sourceEqualsDest && !overwrite && destination.exists()) { + String message = NLS.bind(Messages.fileExists, destination.getAbsolutePath()); + Policy.error(EFS.ERROR_EXISTS, message); + } + if (source.renameTo(destination)) { + // double-check to ensure we really did move + // since java.io.File#renameTo sometimes lies + if (!sourceEqualsDest && source.exists()) { + // XXX: document when this occurs + if (destination.exists()) { + // couldn't delete the source so remove the destination and throw an error + // XXX: if we fail deleting the destination, the destination (root) may still exist + new OEFile(destination, ignorePaths, root).delete(EFS.NONE, null); + String message = NLS.bind(Messages.couldnotDelete, source.getAbsolutePath()); + Policy.error(EFS.ERROR_DELETE, message); + } + // source exists but destination doesn't so try to copy below + } else { + if (!destination.exists()) { + // neither the source nor the destination exist. this is REALLY bad + String message = NLS.bind(Messages.failedMove, source.getAbsolutePath(), destination.getAbsolutePath()); + Policy.error(EFS.ERROR_WRITE, message); + } + //the move was successful + monitor.worked(10); + return; + } + } + // for some reason renameTo didn't work + if (sourceEqualsDest) { + String message = NLS.bind(Messages.couldNotMove, source.getAbsolutePath()); + Policy.error(EFS.ERROR_WRITE, message, null); + } + // fall back to default implementation + super.move(destFile, options, Policy.subMonitorFor(monitor, 10)); + } finally { + monitor.done(); + } + } + + @Override + public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException { + monitor = Policy.monitorFor(monitor); + try { + monitor.beginTask("", 1); //$NON-NLS-1$ + return new FileInputStream(file); + } catch (FileNotFoundException e) { + String message; + if (!file.exists()) + message = NLS.bind(Messages.fileNotFound, filePath); + else if (file.isDirectory()) + message = NLS.bind(Messages.notAFile, filePath); + else + message = NLS.bind(Messages.couldNotRead, filePath); + Policy.error(EFS.ERROR_READ, message, e); + return null; + } finally { + monitor.done(); + } + } + + @Override + public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException { + monitor = Policy.monitorFor(monitor); + try { + monitor.beginTask("", 1); //$NON-NLS-1$ + return new FileOutputStream(file, (options & EFS.APPEND) != 0); + } catch (FileNotFoundException e) { + checkReadOnlyParent(file, e); + String message; + String path = filePath; + if (file.isDirectory()) + message = NLS.bind(Messages.notAFile, path); + else + message = NLS.bind(Messages.couldNotWrite, path); + Policy.error(EFS.ERROR_WRITE, message, e); + return null; + } finally { + monitor.done(); + } + } + + @Override + public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException { + boolean success = true; + + //native does not currently set last modified + if ((options & EFS.SET_LAST_MODIFIED) != 0) + success &= file.setLastModified(info.getLastModified()); + if (!success && !file.exists()) + Policy.error(EFS.ERROR_NOT_EXISTS, NLS.bind(Messages.fileNotFound, filePath)); + } + + /* (non-Javadoc) + * @see org.eclipse.core.filesystem.provider.FileStore#toLocalFile(int, org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException { + if (options == EFS.CACHE) + return super.toLocalFile(options, monitor); + return file; + } + + /* (non-Javadoc) + * @see org.eclipse.core.filesystem.IFileStore#toString() + */ + @Override + public String toString() { + return file.toString(); + } + + /* (non-Javadoc) + * @see org.eclipse.core.filesystem.IFileStore#toURI() + */ + @Override + public URI toURI() { + return URIUtil.toURI(filePath); + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java new file mode 100644 index 0000000..f0bf449 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java @@ -0,0 +1,78 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.filesystem; + +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.filesystem.IFileSystem; +import org.eclipse.core.filesystem.provider.FileSystem; + +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.ui.Activator; + +/** + * A filesystem that ignores specific OE directories that contain derived information. + * @author kgilmer + * + */ +public class OEFileSystem extends FileSystem { + + private static IFileSystem ref; + public static IFileSystem getInstance() { + return ref; + } + + private Map fileStoreCache; + + public OEFileSystem() { + ref = this; + fileStoreCache = new Hashtable(); + } + + @Override + public IFileStore getStore(URI uri) { + + OEFile uf = (OEFile) fileStoreCache.get(uri); + + if (uf == null) { + BBSession config = null; + try { + config = Activator.getBBSession(uri.getPath()); + config.initialize(); + } catch (Exception e) { + e.printStackTrace(); + return new OEIgnoreFile(new File(uri.getPath())); + } + + if (config.get("TMPDIR") == null || config.get("DL_DIR") == null || config.get("SSTATE_DIR")== null) { + throw new RuntimeException("Invalid local.conf: TMPDIR or DL_DIR or SSTATE_DIR undefined."); + } + + List ignoreList = new ArrayList(); + + //These directories are ignored because they contain too many files for Eclipse to handle efficiently. + ignoreList.add(config.get("TMPDIR")); + ignoreList.add(config.get("DL_DIR")); + ignoreList.add(config.get("SSTATE_DIR")); + + uf = new OEFile(new File(uri.getPath()), ignoreList, uri.getPath()); + fileStoreCache.put(uri, uf); + } + + return uf; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java new file mode 100644 index 0000000..4ac2998 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java @@ -0,0 +1,30 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.filesystem; + +import java.net.URI; + +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.ide.fileSystem.FileSystemContributor; + +public class OEFileSystemContributor extends FileSystemContributor { + + @Override + public URI browseFileSystem(String initialPath, Shell shell) { + return null; + } + + @Override + public URI getURI(String string) { + return super.getURI(string); + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java new file mode 100644 index 0000000..8643309 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java @@ -0,0 +1,133 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.filesystem; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; + +import org.eclipse.core.filesystem.IFileInfo; +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.filesystem.IFileSystem; +import org.eclipse.core.filesystem.provider.FileInfo; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; + +public class OEIgnoreFile implements IFileStore { + + private final File file; + + public OEIgnoreFile(File file) { + this.file = file; + } + + public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException { + + return new IFileInfo[0]; + } + + public String[] childNames(int options, IProgressMonitor monitor) throws CoreException { + return new String[0]; + } + + public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException { + + return new IFileStore[0]; + } + + public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { + // TODO Auto-generated method stub + + } + + public void delete(int options, IProgressMonitor monitor) throws CoreException { + // TODO Auto-generated method stub + + } + + public IFileInfo fetchInfo() { + // TODO Auto-generated method stub + return new FileInfo(file.getName()); + } + + public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException { + return new FileInfo(file.getName()); + } + + public Object getAdapter(Class adapter) { + // TODO Auto-generated method stub + return null; + } + + public IFileStore getChild(IPath path) { + // TODO Auto-generated method stub + return null; + } + + + + public IFileStore getChild(String name) { + return null; + } + + public IFileSystem getFileSystem() { + // TODO Auto-generated method stub + return OEFileSystem.getInstance(); + } + + public String getName() { + return file.getName(); + } + + public IFileStore getParent() { + // TODO Auto-generated method stub + return null; + } + + public boolean isParentOf(IFileStore other) { + // TODO Auto-generated method stub + return false; + } + + public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException { + return null; + } + + public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { + } + + public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException { + return null; + } + + public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException { + return null; + } + + public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException { + } + + public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException { + return file; + } + + public URI toURI() { + return file.toURI(); + } + + public IFileStore getFileStore(IPath path) { + return null; + } + + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java new file mode 100644 index 0000000..84c0f32 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.filesystem; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Date; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; + +import org.yocto.bc.ui.Activator; + +/** + * Grab bag of utility methods for the file system plugin + */ +public class Policy { + + /** + * General debug flag for the plugin + */ + public static boolean DEBUG = false; + + public static final String PI_FILE_SYSTEM = "org.eclipse.core.filesystem"; //$NON-NLS-1$ + + public static void checkCanceled(IProgressMonitor monitor) { + if (monitor.isCanceled()) + throw new OperationCanceledException(); + } + + /** + * Print a debug message to the console. + * Pre-pend the message with the current date and the name of the current thread. + */ + public static void debug(String message) { + StringBuffer buffer = new StringBuffer(); + buffer.append(new Date(System.currentTimeMillis())); + buffer.append(" - ["); //$NON-NLS-1$ + buffer.append(Thread.currentThread().getName()); + buffer.append("] "); //$NON-NLS-1$ + buffer.append(message); + System.out.println(buffer.toString()); + } + + public static void error(int code, String message) throws CoreException { + error(code, message, null); + } + + public static void error(int code, String message, Throwable exception) throws CoreException { + int severity = code == 0 ? 0 : 1 << (code % 100 / 33); + throw new CoreException(new Status(severity, PI_FILE_SYSTEM, code, message, exception)); + } + + public static void log(int severity, String message, Throwable t) { + if (message == null) + message = ""; //$NON-NLS-1$ + Activator.getDefault().getLog().log(new Status(severity, PI_FILE_SYSTEM, 1, message, t)); + } + + public static IProgressMonitor monitorFor(IProgressMonitor monitor) { + return monitor == null ? new NullProgressMonitor() : monitor; + } + + /** + * Closes a stream and ignores any resulting exception. + */ + public static void safeClose(InputStream in) { + try { + if (in != null) + in.close(); + } catch (IOException e) { + //ignore + } + } + + /** + * Closes a stream and ignores any resulting exception. + */ + public static void safeClose(OutputStream out) { + try { + if (out != null) + out.close(); + } catch (IOException e) { + //ignore + } + } + + public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) { + if (monitor == null) + return new NullProgressMonitor(); + if (monitor instanceof NullProgressMonitor) + return monitor; + return new SubProgressMonitor(monitor, ticks); + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java new file mode 100644 index 0000000..2892df5 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java @@ -0,0 +1,15 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.model; + +public interface IModelElement { + public void initialize() throws Exception; +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java new file mode 100644 index 0000000..3af1e2a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java @@ -0,0 +1,48 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.model; + + +public class ProjectInfo implements IModelElement { + private String name; + private String location; + private String init; + + public ProjectInfo() { + } + + public String getInitScriptPath() { + return init; + } + public String getProjectName() { + return name; + } + public String getRootPath() { + return location; + } + public void initialize() throws Exception { + name = new String(); + location = new String(); + init = new String(); + } + + public void setInitScriptPath(String init) { + this.init = init; + } + + public void setLocation(String location) { + this.location = location; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java new file mode 100644 index 0000000..b9ddcb6 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java @@ -0,0 +1,89 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.perspectives; + +import org.eclipse.ui.IFolderLayout; +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; +import org.eclipse.ui.console.IConsoleConstants; + +import org.yocto.bc.ui.views.RecipeView; + +public class BitbakeCommanderPerspective implements IPerspectiveFactory { + + private IPageLayout factory; + + public BitbakeCommanderPerspective() { + super(); + } + + private void addActionSets() { + factory.addActionSet("org.yocto.bc.ui.actionSet"); + factory.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); // NON-NLS-1 + } + + private void addNewWizardShortcuts() { + factory.addNewWizardShortcut("org.yocto.bc.ui.wizards.NewRecipeWizard");// NON-NLS-1 + //factory.addNewWizardShortcut("org.yocto.bc.ui.wizards.newproject.NewBBCProjectWizard");// NON-NLS-1 + factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");// NON-NLS-1 + } + + private void addPerspectiveShortcuts() { + // factory.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); + // //NON-NLS-1 + // factory.addPerspectiveShortcut("org.eclipse.team.cvs.ui.cvsPerspective"); + // //NON-NLS-1 + factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); // NON-NLS-1 + } + + private void addViews() { + IFolderLayout bottom = factory.createFolder("bottomRight", // NON-NLS-1 + IPageLayout.BOTTOM, 0.75f, factory.getEditorArea()); + + bottom.addView(IPageLayout.ID_PROBLEM_VIEW); + bottom.addView("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1 + bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW); + + IFolderLayout topLeft = factory.createFolder("topLeft", // NON-NLS-1 + IPageLayout.LEFT, 0.25f, factory.getEditorArea()); + topLeft.addView(IPageLayout.ID_RES_NAV); + //llu detach RecipeView + //topLeft.addView(RecipeView.ID_VIEW); // NON-NLS-1 + + } + + private void addViewShortcuts() { + // factory.addShowViewShortcut("org.eclipse.ant.ui.views.AntView"); + // //NON-NLS-1 + // factory.addShowViewShortcut("org.eclipse.team.ccvs.ui.AnnotateView"); + // //NON-NLS-1 + // factory.addShowViewShortcut("org.eclipse.pde.ui.DependenciesView"); + // //NON-NLS-1 + // factory.addShowViewShortcut("org.eclipse.jdt.junit.ResultView"); + // //NON-NLS-1 + factory.addShowViewShortcut("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1 + factory.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW); + // factory.addShowViewShortcut(JavaUI.ID_PACKAGES); + factory.addShowViewShortcut(IPageLayout.ID_RES_NAV); + // factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); + // factory.addShowViewShortcut(IPageLayout.ID_OUTLINE); + } + + public void createInitialLayout(IPageLayout factory) { + this.factory = factory; + addViews(); + addActionSets(); + addNewWizardShortcuts(); + addPerspectiveShortcuts(); + addViewShortcuts(); + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java new file mode 100644 index 0000000..3bdf5d3 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java @@ -0,0 +1,43 @@ +package org.yocto.bc.ui.popup.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IActionDelegate; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; + +public class NewAction implements IObjectActionDelegate { + + /** + * Constructor for Action1. + */ + public NewAction() { + super(); + } + + /** + * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) + */ + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + } + + /** + * @see IActionDelegate#run(IAction) + */ + public void run(IAction action) { + Shell shell = new Shell(); + MessageDialog.openInformation( + shell, + "Yocto Project BitBake Commander UI Plug-in", + "New Action was executed."); + } + + /** + * @see IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java new file mode 100644 index 0000000..7e29e7a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java @@ -0,0 +1,60 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.views; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.Viewer; + +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; + +class RecipeContentProvider implements IStructuredContentProvider { + public void dispose() { + } + + public Object[] getElements(Object parent) { + List recipes = new ArrayList(); + IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + IProjectNature nature = null; + for (int i = 0; i < projects.length; ++i) { + try { + if (projects[i].isOpen() && projects[i].hasNature(BitbakeCommanderNature.NATURE_ID)) { + recipes.addAll(getRecipesFromProject(projects[i])); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return recipes.toArray(); + } + + private Collection getRecipesFromProject(IProject project) throws Exception { + BBSession session = Activator.getBBSession(project.getLocationURI().getPath(), null); + return session.getRecipeFiles(project); + } + + public void inputChanged(Viewer v, Object oldInput, Object newInput) { + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java new file mode 100644 index 0000000..fdbd8e0 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java @@ -0,0 +1,165 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.views; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ViewPart; + +import org.yocto.bc.ui.editors.bitbake.BitBakeFileEditor; + +public class RecipeView extends ViewPart { + class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object obj, int index) { + return getImage(obj); + } + + public String getColumnText(Object obj, int index) { + + if (obj instanceof IFile) { + return ((IFile) obj).getName(); + } + + return getText(obj); + } + + @Override + public Image getImage(Object obj) { + return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE); + } + } + public static final String ID_VIEW = "org.yocto.bc.ui.views.RecipeView"; +private TableViewer viewer; + + /* private Action action1; + private Action action2; + */ private Action doubleClickAction; + + private void contributeToActionBars() { + IActionBars bars = getViewSite().getActionBars(); + fillLocalPullDown(bars.getMenuManager()); + fillLocalToolBar(bars.getToolBarManager()); + } + + @Override + public void createPartControl(Composite parent) { + viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + viewer.setContentProvider(new RecipeContentProvider()); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setSorter(new ViewerSorter()); + viewer.setInput(getViewSite()); + makeActions(); + hookContextMenu(); + hookDoubleClickAction(); + contributeToActionBars(); + } + + private void fillContextMenu(IMenuManager manager) { +/* manager.add(action1); + manager.add(action2); +*/ // Other plug-ins can contribute there actions here + manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + } + + private void fillLocalPullDown(IMenuManager manager) { +/* manager.add(action1); + manager.add(new Separator()); + manager.add(action2); +*/ } + + private void fillLocalToolBar(IToolBarManager manager) { +/* manager.add(action1); + manager.add(action2); +*/ } + + private void hookContextMenu() { + MenuManager menuMgr = new MenuManager("#PopupMenu"); + menuMgr.setRemoveAllWhenShown(true); + menuMgr.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + RecipeView.this.fillContextMenu(manager); + } + }); + Menu menu = menuMgr.createContextMenu(viewer.getControl()); + viewer.getControl().setMenu(menu); + getSite().registerContextMenu(menuMgr, viewer); + } + + private void hookDoubleClickAction() { + viewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + doubleClickAction.run(); + } + }); + } + + private void makeActions() { +/* action1 = new Action() { + public void run() { + } + }; + action1.setText("Action 1"); + action1.setToolTipText("Action 1 tooltip"); + action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); + + action2 = new Action() { + public void run() { + } + }; + action2.setText("Action 2"); + action2.setToolTipText("Action 2 tooltip"); + action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); +*/ doubleClickAction = new Action() { + @Override + public void run() { + ISelection selection = viewer.getSelection(); + Object obj = ((IStructuredSelection) selection).getFirstElement(); + + if (obj instanceof IFile) { + try { + RecipeView.this.getViewSite().getPage().openEditor(new FileEditorInput((IFile) obj), BitBakeFileEditor.EDITOR_ID); + } catch (PartInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + } + + @Override + public void setFocus() { + viewer.getControl().setFocus(); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java new file mode 100644 index 0000000..9699117 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java @@ -0,0 +1,145 @@ +/******************************************************************************* + * Copyright (c) 2011 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.wizards; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Text; +import java.util.ArrayList; + +public class BitbakeRecipeUIElement { + + private String container; + private String file; + private String description; + private String license; + private String checksum; + private String homepage; + private String author; + private String section; + private String srcuri; + private String md5sum; + private String sha256sum; + private String metaDir; + private ArrayList inheritance; + + public BitbakeRecipeUIElement() + { + this.container = ""; + this.file = ""; + this.description = ""; + this.license = ""; + this.checksum = ""; + this.homepage = ""; + this.author = ""; + this.section = ""; + this.srcuri = ""; + this.md5sum = ""; + this.sha256sum = ""; + this.inheritance = new ArrayList(); + this.metaDir = ""; + } + + public String getContainer() { + return container; + } + public void setContainer(String value) { + this.container = value; + } + public String getFile() { + return file; + } + public void setFile(String value) { + this.file = value; + } + public String getDescription() { + return description; + } + + public void setDescription(String value) { + this.description = value; + } + + public String getLicense() { + return license; + } + + public void setLicense(String value) { + this.license = value; + } + + public String getChecksum() { + return checksum; + } + public void setChecksum(String value) { + this.checksum = value; + } + + public String getHomePage() { + return homepage; + } + + public void setHomePage(String value) { + this.homepage = value; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String value) { + this.author = value; + } + + public String getSection() { + return section; + } + public void setSection(String value) { + this.section = value; + } + public String getSrcuri() { + return srcuri; + } + public void setSrcuri(String value) { + this.srcuri = value; + } + + public String getMd5sum() { + return md5sum; + } + + public void setMd5sum(String value) { + this.md5sum = value; + } + + public String getsha256sum() { + return sha256sum; + } + + public void setSha256sum(String value) { + this.sha256sum = value; + } + + public ArrayList getInheritance() { + return inheritance; + } + + public void setInheritance(ArrayList value) { + this.inheritance = value; + } + + public String getMetaDir() { + return metaDir; + } + + public void setMetaDir(String value) { + metaDir = value; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java new file mode 100644 index 0000000..8b47498 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java @@ -0,0 +1,56 @@ +package org.yocto.bc.ui.wizards; +import java.util.Map; + +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.swt.widgets.Composite; + + + +public abstract class FiniteStateWizard extends Wizard { + private boolean finishable = false; + private boolean canFinish = false; + + public FiniteStateWizard() { + } + + public abstract boolean performFinish(); + + /** + * @return Returns if the wizard is finishable in its current state. + */ + public boolean isFinishable() { + return finishable; + } + /** + * @param finishable Change the finish state of the wizard. + */ + public void setFinishable(boolean finishable) { + this.finishable = finishable; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.wizard.IWizard#createPageControls(org.eclipse.swt.widgets.Composite) + */ + public void createPageControls(Composite pageContainer) { + super.createPageControls(pageContainer); + } + + /* + * (non-Javadoc) Method declared on IWizard. + */ + public boolean canFinish() { + if (canFinish) + return true; + return super.canFinish(); + } + + public void setCanFinish(boolean canFinish) { + this.canFinish = canFinish; + } + + /** + * Retrive the model object from the wizard. + * @return + */ + public abstract Map getModel(); +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java new file mode 100644 index 0000000..a83a389 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java @@ -0,0 +1,149 @@ +package org.yocto.bc.ui.wizards; +import java.util.Map; + +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public abstract class FiniteStateWizardPage extends WizardPage { + protected Map model = null; + protected FiniteStateWizard wizard = null; + private static boolean previousState = false; + /** + * @param pageName + */ + protected FiniteStateWizardPage(String name, Map model) { + super(name); + this.model = model; + this.setPageComplete(false); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) + */ + public abstract void createControl(Composite parent); + + protected void setModelWizard() { + if (wizard == null) { + wizard = (FiniteStateWizard)FiniteStateWizardPage.this.getWizard(); + } + } + + /** + * Add page validation logic here. Returning true means that + * the page is complete and the user can go to the next page. + * + * @return + */ + protected abstract boolean validatePage(); + + /** + * This method should be implemented by ModelWizardPage classes. This method + * is called after the validatePage() returns successfully. + * Update the model with the contents of the controls on the page. + */ + protected abstract void updateModel(); + + /** + * Helper method to see if a field has some sort of text in it. + * @param value + * @return + */ + protected boolean hasContents(String value) { + if (value == null || value.length() == 0) { + return false; + } + + return true; + } + + /** + * This method is called right before a page is displayed. + * This occurs on user action (Next/Back buttons). + */ + public abstract void pageDisplay(); + + /** + * This method is called on the concrete WizardPage after the user has + * gone to the page after. + */ + public abstract void pageCleanup(); + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) + */ + public void setVisible(boolean arg0) { + + if (!arg0 && previousState) { + pageCleanup(); + } else if (arg0 && !previousState) { + pageDisplay(); + } else if (arg0 && previousState) { + pageDisplay(); + } + + previousState = arg0; + + super.setVisible(arg0); + } + + public class ValidationListener implements SelectionListener, ModifyListener, Listener, ISelectionChangedListener { + + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent e) { + validate(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) + */ + public void widgetDefaultSelected(SelectionEvent e) { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) + */ + public void modifyText(ModifyEvent e) { + validate(); + } + + public void validate() { + if (validatePage()) { + updateModel(); + setPageComplete(true); + return; + } + + setPageComplete(false); + } + + /* (non-Javadoc) + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + public void handleEvent(Event event) { + + validate(); + } + + public void selectionChanged(SelectionChangedEvent event) { + validate(); + } + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java new file mode 100644 index 0000000..14b268b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java @@ -0,0 +1,215 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + * Jessica Zhang (Intel) - Extend to support auto-fill base on src_uri value + *******************************************************************************/ +package org.yocto.bc.ui.wizards; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWizard; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +import org.yocto.bc.bitbake.BBLanguageHelper; + +public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard { + private NewBitBakeFileRecipeWizardPage page; + private ISelection selection; + + public NewBitBakeFileRecipeWizard() { + super(); + setNeedsProgressMonitor(true); + } + + @Override + public void addPages() { + page = new NewBitBakeFileRecipeWizardPage(selection); + addPage(page); + } + + private void doFinish(BitbakeRecipeUIElement element, IProgressMonitor monitor) throws CoreException { + String fileName = element.getFile(); + monitor.beginTask("Creating " + fileName, 2); + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IResource resource = root.findMember(new Path(element.getContainer())); + if (!resource.exists() || !(resource instanceof IContainer)) { + throwCoreException("Container \"" + element.getContainer() + "\" does not exist."); + } + IContainer container = (IContainer) resource; + + // If the extension wasn't specified, assume .bb + if (!fileName.endsWith(".bb") && !fileName.endsWith(".inc") && !fileName.endsWith(".conf")) { + fileName = fileName + ".bb"; + } + + final IFile file = container.getFile(new Path(fileName)); + try { + InputStream stream = openContentStream(element); + if (file.exists()) { + file.setContents(stream, true, true, monitor); + } else { + file.create(stream, true, monitor); + } + stream.close(); + } catch (IOException e) { + } + monitor.worked(1); + monitor.setTaskName("Opening file for editing..."); + getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + IDE.openEditor(page, file, true); + } catch (PartInitException e) { + } + } + }); + monitor.worked(1); + } + + /** + * We will accept the selection in the workbench to see if we can initialize + * from it. + * + * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.selection = selection; + } + + /** + * We will initialize file contents with a sample text. + * @param srcuri + * @param author + * @param homepage + * @param license + * @param description + * @param fileName + * @param newPage + */ + + private InputStream openContentStream(BitbakeRecipeUIElement element) { + + StringBuffer sb = new StringBuffer(); + + sb.append("DESCRIPTION = \"" + element.getDescription() + "\"\n"); + + if (element.getAuthor().length() > 0) { + sb.append("AUTHOR = \"" + element.getAuthor() + "\"\n"); + } + + if (element.getHomePage().length() > 0) { + sb.append("HOMEPAGE = \"" + element.getHomePage() + "\"\n"); + } + + if (element.getSection().length() > 0) { + sb.append("SECTION = \"" + element.getSection() + "\"\n"); + } + + if (element.getLicense().length() > 0) { + sb.append("LICENSE = \"" + element.getLicense() + "\"\n"); + } + + if (element.getChecksum().length() > 0) { + sb.append("LIC_FILES_CHKSUM = \"" + element.getChecksum() + "\"\n"); + } + + if (element.getSrcuri().length() > 0) { + sb.append("SRC_URI = \"" + element.getSrcuri() + "\"\n"); + } + + if (element.getMd5sum().length() > 0) { + sb.append("SRC_URI[md5sum] = \"" + element.getMd5sum() + "\"\n"); + } + + if (element.getsha256sum().length() > 0) { + sb.append("SRC_URI[sha256sum] = \"" + element.getsha256sum() + "\"\n"); + } + + ArrayList inheritance = element.getInheritance(); + if (!inheritance.isEmpty()) { + Object ia[] = inheritance.toArray(); + String inheritance_str = "inherit "; + for(int i=0; i 0) { + updateStatus("File name must be valid"); + return; + } + + if (descriptionText.getText().length() == 0) { + updateStatus("Recipe must have a description"); + return; + } + + if (licenseText.getText().length() == 0) { + updateStatus("Recipe must have a license"); + return; + } + + if (srcuriText.getText().length() == 0) { + updateStatus("SRC_URI can't be empty"); + } + + updateStatus(null); + } + + public BitbakeRecipeUIElement getUIElement() { + element.setAuthor(authorText.getText()); + element.setChecksum(checksumText.getText()); + element.setContainer(containerText.getText()); + element.setDescription(descriptionText.getText()); + element.setFile(fileText.getText()); + element.setHomePage(homepageText.getText()); + element.setLicense(licenseText.getText()); + element.setMd5sum(md5sumText.getText()); + element.setSection(sectionText.getText()); + element.setSha256sum(sha256sumText.getText()); + element.setSrcuri(srcuriText.getText()); + element.setInheritance(inheritance); + element.setMetaDir(metaDirLoc); + + return element; + } + + private void handleBrowse(final Composite parent, final Text text) { + ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select project directory"); + if (dialog.open() == Window.OK) { + Object[] result = dialog.getResult(); + if (result.length == 1) { + text.setText(((Path) result[0]).toString()); + } + } + } + + private void handlePopulate() { + String src_uri = srcuriText.getText(); + if ((src_uri.startsWith("http://") || src_uri.startsWith("ftp://")) + && (src_uri.endsWith("tar.gz") || src_uri.endsWith("tar.bz2"))) { + + HashMap mirror_map = createMirrorLookupTable(); + + populateRecipeName(src_uri); + populateSrcuriChecksum(src_uri); + String extractDir = extractPackage(src_uri); + populateLicensefileChecksum(extractDir); + updateSrcuri(mirror_map, src_uri); + populateInheritance(extractDir); + } else if (src_uri.startsWith("file://")) { + String path_str = src_uri.substring(7); + File package_dir = new File(path_str); + if (package_dir.isDirectory()) { + String package_name = path_str.substring(path_str.lastIndexOf("/")+1); + fileText.setText(package_name+".bb"); + populateLicensefileChecksum(path_str); + populateInheritance(path_str); + } + } + + } + + private String extractPackage(String src_uri) { + try { + File working_dir = new File(metaDirLoc+"/temp"); + int idx = src_uri.lastIndexOf("/"); + String tar_file = src_uri.substring(idx+1); + int tar_file_surfix_idx = tar_file.lastIndexOf(".tar"); + String tar_file_surfix = tar_file.substring(tar_file_surfix_idx); + String tar_file_path = metaDirLoc+"/temp/"+tar_file; + + String tar_cmd = ""; + int tar_idx = 0; + if (tar_file_surfix.matches(".tar.gz")) { + tar_cmd = "tar -zxvf "+ tar_file_path; + tar_idx = tar_file_path.lastIndexOf(".tar.gz"); + } else if (tar_file_surfix.matches(".tar.bz2")) { + tar_idx = tar_file_path.lastIndexOf(".tar.bz2"); + tar_cmd = "tar -xvf " + tar_file_path; + } + final Process process = Runtime.getRuntime().exec(tar_cmd, null, working_dir); + int returnCode = process.waitFor(); + if (returnCode == 0) { + return tar_file_path.substring(0, tar_idx); + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + private void populateInheritance(String extractDir) { + File extract_dir = new File(extractDir); + + File[] files = extract_dir.listFiles(); + for (File file : files) { + if (file.isDirectory()) + continue; + else { + if (file.getName().equalsIgnoreCase("cmakelists.txt")) + inheritance.add("cmake"); + else if (file.getName().equalsIgnoreCase("setup.py")) + inheritance.add("disutils"); + else { + String pattern = "configure.[ac|.in]"; + if (file.getName().equalsIgnoreCase("configure.ac") || file.getName().equalsIgnoreCase("configure.in")) + inheritance.add("autotools"); + else + continue; + } + } + } + } + + private void populateLicensefileChecksum(String extractDir) { + String licenseFileChecksum_str = null; + String licenseFilePath = null; + + try { + File extract_dir = new File(extractDir); + + FilenameFilter copyFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + if (name.startsWith("COPYING")) { + return true; + } else { + return false; + } + } + }; + + File copyFile = null; + File[] files = extract_dir.listFiles(copyFilter); + for (File file : files) { + if (file.isDirectory()) + continue; + else { + copyFile = file; + licenseFilePath = file.getCanonicalPath(); + break; + } + } + + MessageDigest digest_md5 = MessageDigest.getInstance("MD5"); + InputStream is = new FileInputStream(copyFile); + byte[] buffer = new byte[8192]; + int read = 0; + + while( (read = is.read(buffer)) > 0) { + digest_md5.update(buffer, 0, read); + } + byte[] md5sum = digest_md5.digest(); + BigInteger bigInt_md5 = new BigInteger(1, md5sum); + licenseFileChecksum_str = bigInt_md5.toString(16); + is.close(); + } catch (Exception e) { + throw new RuntimeException("Unable to process file for MD5 calculation", e); + } + + if (licenseFileChecksum_str != null) { + int idx = licenseFilePath.lastIndexOf("/"); + String license_file_name = licenseFilePath.substring(idx+1); + checksumText.setText("file://"+license_file_name+";md5="+licenseFileChecksum_str); + } + } + + private void populateSrcuriChecksum(String src_uri) { + String md5sum_str = null; + String sha256sum_str = null; + + try { + File working_dir = new File(metaDirLoc+"/temp"); + working_dir.mkdir(); + String download_cmd = "wget " + src_uri; + final Process process = Runtime.getRuntime().exec(download_cmd, null, working_dir); + int returnCode = process.waitFor(); + if (returnCode == 0) { + int idx = src_uri.lastIndexOf("/"); + String tar_file = src_uri.substring(idx+1); + String tar_file_path = metaDirLoc+"/temp/"+tar_file; + MessageDigest digest_md5 = MessageDigest.getInstance("MD5"); + MessageDigest digest_sha256 = MessageDigest.getInstance("SHA-256"); + File f = new File(tar_file_path); + InputStream is = new FileInputStream(f); + byte[] buffer = new byte[8192]; + int read = 0; + try { + while( (read = is.read(buffer)) > 0) { + digest_md5.update(buffer, 0, read); + digest_sha256.update(buffer, 0, read); + } + byte[] md5sum = digest_md5.digest(); + byte[] sha256sum = digest_sha256.digest(); + BigInteger bigInt_md5 = new BigInteger(1, md5sum); + BigInteger bigInt_sha256 = new BigInteger(1, sha256sum); + md5sum_str = bigInt_md5.toString(16); + sha256sum_str = bigInt_sha256.toString(16); + } + catch(IOException e) { + throw new RuntimeException("Unable to process file for MD5", e); + } + finally { + try { + is.close(); + } + catch(IOException e) { + throw new RuntimeException("Unable to close input stream for MD5 calculation", e); + } + } + if (md5sum_str != null) + md5sumText.setText(md5sum_str); + if (sha256sum_str != null) + sha256sumText.setText(sha256sum_str); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private HashMap createMirrorLookupTable() { + HashMap mirror_map = new HashMap(); + File mirror_file = new File(metaDirLoc+"/classes/mirrors.bbclass"); + + try { + if (mirror_file.exists()) { + BufferedReader input = new BufferedReader(new FileReader(mirror_file)); + + try + { + String line = null; + String delims = "[\\t]+"; + + while ((line = input.readLine()) != null) + { + String[] tokens = line.split(delims); + if (tokens.length < 2) + continue; + String ending_str = " \\n \\"; + int idx = tokens[1].lastIndexOf(ending_str); + String key = tokens[1].substring(0, idx); + mirror_map.put(key, tokens[0]); + } + } + finally { + input.close(); + } + } + } + catch (IOException e) + { + e.printStackTrace(); + + } + return mirror_map; + } + + private void populateRecipeName(String src_uri) { + String file_name = fileText.getText(); + if (!file_name.isEmpty()) + return; + String delims = "[/]+"; + String recipe_file = null; + + String[] tokens = src_uri.split(delims); + if (tokens.length > 0) { + String tar_file = tokens[tokens.length - 1]; + int surfix_idx = 0; + if (tar_file.endsWith(".tar.gz")) + surfix_idx = tar_file.lastIndexOf(".tar.gz"); + else + surfix_idx = tar_file.lastIndexOf(".tar.bz2"); + int sept_idx = tar_file.lastIndexOf("-"); + recipe_file = tar_file.substring(0, sept_idx)+"_"+tar_file.substring(sept_idx+1, surfix_idx)+".bb"; + } + if (recipe_file != null) + fileText.setText(recipe_file); + } + + private void updateSrcuri(HashMap mirrorsMap, String src_uri) { + Set mirrors = mirrorsMap.keySet(); + Iterator iter = mirrors.iterator(); + String mirror_key = null; + + while (iter.hasNext()) { + String value = (String)iter.next(); + if (src_uri.startsWith(value)) { + mirror_key = value; + break; + } + } + + if (mirror_key != null) { + String replace_string = (String)mirrorsMap.get(mirror_key); + if (replace_string != null) + src_uri = replace_string+src_uri.substring(mirror_key.length()); + } + int idx = src_uri.lastIndexOf("-"); + String new_src_uri = src_uri.substring(0, idx)+"-${PV}.tar.gz"; + srcuriText.setText(new_src_uri); + } + + private void initialize() { + if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { + IStructuredSelection ssel = (IStructuredSelection) selection; + if (ssel.size() > 1) + return; + Object obj = ssel.getFirstElement(); + if (obj instanceof IResource) { + IContainer container; + if (obj instanceof IContainer) + container = (IContainer) obj; + else + container = ((IResource) obj).getParent(); + containerText.setText(container.getFullPath().toString()); + } + } + } + + private void updateStatus(String message) { + setErrorMessage(message); + setPageComplete(message == null); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java new file mode 100644 index 0000000..71ea70c --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java @@ -0,0 +1,236 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.wizards.importProject; + +import java.io.File; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IStatus; +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.DirectoryDialog; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; + +import org.yocto.bc.ui.wizards.FiniteStateWizardPage; + +/** + * Main property page for new project wizard. + * @author kgilmer + * + */ +public class BBCProjectPage extends FiniteStateWizardPage { + + private class FileOpenSelectionAdapter extends SelectionAdapter { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog fd = new FileDialog(PlatformUI.getWorkbench() + .getDisplay().getActiveShell(), SWT.OPEN); + + fd.setText("Open Configuration Script"); + fd.setFilterPath(txtProjectLocation.getText()); + + String selected = fd.open(); + + if (selected != null) { + txtInit.setText(selected); + updateModel(); + } + } + } + public static final String PAGE_TITLE = "Yocto Project BitBake Commander Project"; + private Text txtProjectLocation; + + private Text txtInit; + private ValidationListener validationListener; + private Text txtProjectName; + + public BBCProjectPage(Map model) { + super(PAGE_TITLE, model); + setTitle("Create new Yocto Project BitBake Commander project"); + setMessage("Enter information to create a BitBake Commander project."); + } + + public void createControl(Composite parent) { + GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL); + GridData gdVU = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); + + Composite top = new Composite(parent, SWT.NONE); + top.setLayoutData(new GridData(GridData.FILL_BOTH)); + top.setLayout(new GridLayout()); + + Composite projectNameComp = new Composite(top, SWT.NONE); + GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL); + projectNameComp.setLayoutData(gdProjName); + projectNameComp.setLayout(new GridLayout(2, false)); + Label lblProjectName = new Label(projectNameComp, SWT.NONE); + lblProjectName.setText("N&ame:"); + + txtProjectName = new Text(projectNameComp, SWT.BORDER); + txtProjectName.setLayoutData(gdFillH); + txtProjectName.setFocus(); + validationListener = new ValidationListener(); + + txtProjectName.addModifyListener(validationListener); + + Label lblProjectLocation = new Label(projectNameComp, SWT.None); + lblProjectLocation.setText("&Location:"); + + Composite locComposite = new Composite(projectNameComp, SWT.NONE); + GridData gd = new GridData(GridData.VERTICAL_ALIGN_END + | GridData.FILL_HORIZONTAL); + gd.horizontalIndent = 0; + locComposite.setLayoutData(gd); + GridLayout gl = new GridLayout(2, false); + gl.marginWidth = 0; + locComposite.setLayout(gl); + + txtProjectLocation = new Text(locComposite, SWT.BORDER); + txtProjectLocation.setLayoutData(gdFillH); + txtProjectLocation.addModifyListener(validationListener); + + Button button = new Button(locComposite, SWT.PUSH); + button.setText("Browse..."); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleBrowse(); + } + }); + + Label lblInit = new Label(projectNameComp, SWT.NONE); + lblInit.setText("Init Script:"); + + Composite initComposite = new Composite(projectNameComp, SWT.NONE); + gd = new GridData(GridData.VERTICAL_ALIGN_END + | GridData.FILL_HORIZONTAL); + gd.horizontalIndent = 0; + initComposite.setLayoutData(gd); + gl = new GridLayout(2, false); + gl.marginWidth = 0; + initComposite.setLayout(gl); + + txtInit = new Text(initComposite, SWT.BORDER); + GridData gdi = new GridData(GridData.FILL_HORIZONTAL); + txtInit.setLayoutData(gdi); + txtInit.addModifyListener(validationListener); + + Button btnLoadInit = new Button(initComposite, SWT.PUSH); + btnLoadInit.setLayoutData(gdVU); + btnLoadInit.setText("Choose..."); + btnLoadInit.addSelectionListener(new FileOpenSelectionAdapter()); + + if (System.getenv("OEROOT") != null) { + txtProjectLocation.setText(System.getenv("OEROOT")); + } + + setControl(top); + } + + private void handleBrowse() { + DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.None); + String dir = dialog.open(); + if (dir != null) { + txtProjectLocation.setText(dir); + } + } + + private String getFileSegment(String initScriptPath) { + //return the first segment of " " seperated array, or full string if no " " exists + return initScriptPath.split(" ")[0]; + } + + private boolean isValidProjectName(String projectName) { + if (projectName.indexOf('$') > -1) { + return false; + } + + return true; + } + + + @Override + public void pageCleanup() { + // TODO Auto-generated method stub + + } + + @Override + public void pageDisplay() { + // TODO Auto-generated method stub + + } + + @Override + protected void updateModel() { + model.put(ImportYoctoProjectWizard.KEY_NAME, txtProjectName.getText()); + model.put(ImportYoctoProjectWizard.KEY_LOCATION, txtProjectLocation.getText()); + model.put(ImportYoctoProjectWizard.KEY_INITPATH, txtInit.getText()); + } + + + @Override + protected boolean validatePage() { + IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); + + IStatus validate = ResourcesPlugin.getWorkspace().validateName(txtProjectName.getText(), IResource.PROJECT); + + if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) { + setErrorMessage("Invalid project name: " + txtProjectName.getText()); + return false; + } + + IProject proj = wsroot.getProject(txtProjectName.getText()); + if (proj.exists()) { + setErrorMessage("A project with the name " + txtProjectName.getText() + + " already exists"); + return false; + } + + if (txtProjectLocation.getText().trim().length() == 0) { + setErrorMessage("Set directory that contains Poky tree"); + return false; + } + + File f = new File(txtProjectLocation.getText()); + if (!f.exists() || !f.isDirectory()) { + setErrorMessage("Invalid Directory"); + return false; + } + + if (txtInit.getText().length() == 0) { + setErrorMessage("Set configuration file before BitBake is launched."); + return false; + } + + File f2 = new File(getFileSegment(txtInit.getText())); + if (!f2.exists() || f2.isDirectory()) { + setErrorMessage("The configuration file is invalid."); + return false; + } + + setErrorMessage(null); + setMessage("All the entries are valid, press \"Finish\" to create the new yocto bitbake project,"+ + "this will take a while. Please don't interrupt till there's output in the Yocto Console window..."); + return true; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java new file mode 100644 index 0000000..b1fc841 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2011 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.wizards.importProject; + +import java.io.IOException; +import java.io.Writer; +import java.util.Hashtable; +import java.util.Map; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IImportWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IConsoleConstants; +import org.eclipse.ui.console.IConsoleManager; +import org.eclipse.ui.console.IConsoleView; +import org.eclipse.ui.console.MessageConsole; + +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.model.ProjectInfo; +import org.yocto.bc.ui.wizards.FiniteStateWizard; + +import org.yocto.bc.ui.wizards.newproject.BBConfigurationInitializeOperation; +import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation; + +public class ImportYoctoProjectWizard extends FiniteStateWizard implements IImportWizard { + protected final static String KEY_OEROOT = "OEROOT"; + public static final String KEY_NAME = "NAME"; + public static final String KEY_LOCATION = "LOCATION"; + public static final String KEY_INITPATH = "INITPATH"; + protected static final String KEY_PINFO = "PINFO"; + + private Map projectModel; + private IWorkbench workbench; + private IStructuredSelection selection; + + private MessageConsole myConsole; + + public ImportYoctoProjectWizard() { + projectModel = new Hashtable(); + } + + public Map getModel() { + return projectModel; + } + + @Override + public void addPages() { + addPage(new BBCProjectPage(projectModel)); + //addPage(new ConsolePage(projectModel)); + } + + + public boolean performFinish() { + ProjectInfo pinfo = new ProjectInfo(); + pinfo.setInitScriptPath((String) projectModel.get(ImportYoctoProjectWizard.KEY_INITPATH)); + pinfo.setLocation((String) projectModel.get(ImportYoctoProjectWizard.KEY_LOCATION)); + pinfo.setName((String) projectModel.get(ImportYoctoProjectWizard.KEY_NAME)); + + try { + ConsoleWriter cw = new ConsoleWriter(); + this.getContainer().run(false, false, new BBConfigurationInitializeOperation(pinfo, cw)); + myConsole.newMessageStream().println(cw.getContents()); + } catch (Exception e) { + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); + this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage()); + //valid = false; + //setPageComplete(valid); + return false; + } + + //valid = true; + projectModel.put(ImportYoctoProjectWizard.KEY_PINFO, pinfo); + //setPageComplete(valid); + //ProjectInfo pinfo = (ProjectInfo) projectModel.get(KEY_PINFO); + Activator.putProjInfo(pinfo.getRootPath(), pinfo); + try { + getContainer().run(false, false, new CreateBBCProjectOperation(pinfo)); + } catch (Exception e) { + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); + this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage()); + return false; + } + + return true; + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + this.setNeedsProgressMonitor(true); + setWindowTitle("BitBake Commander Project"); + + myConsole = findConsole("Yocto Console"); + IWorkbench wb = PlatformUI.getWorkbench(); + IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); + IWorkbenchPage page = win.getActivePage(); + String id = IConsoleConstants.ID_CONSOLE_VIEW; + try { + IConsoleView view = (IConsoleView) page.showView(id); + view.display(myConsole); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private MessageConsole findConsole(String name) { + ConsolePlugin plugin = ConsolePlugin.getDefault(); + IConsoleManager conMan = plugin.getConsoleManager(); + IConsole[] existing = conMan.getConsoles(); + for (int i = 0; i < existing.length; i++) + if (name.equals(existing[i].getName())) + return (MessageConsole) existing[i]; + // no console found, so create a new one + MessageConsole myConsole = new MessageConsole(name, null); + conMan.addConsoles(new IConsole[] { myConsole }); + return myConsole; + } + + private class ConsoleWriter extends Writer { + + private StringBuffer sb; + + public ConsoleWriter() { + sb = new StringBuffer(); + } + @Override + public void close() throws IOException { + } + + public String getContents() { + return sb.toString(); + } + + @Override + public void flush() throws IOException { + } + + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + //txtConsole.getText().concat(new String(cbuf)); + sb.append(cbuf); + } + + @Override + public void write(String str) throws IOException { + sb.append(str); + } + + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java new file mode 100644 index 0000000..f2cb1da --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java @@ -0,0 +1,404 @@ +package org.yocto.bc.ui.wizards.install; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileDescriptor; +import java.io.InputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.lang.reflect.InvocationTargetException; +import java.net.URL; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWizard; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.console.IConsoleConstants; +import org.eclipse.ui.console.MessageConsole; +import org.eclipse.ui.console.MessageConsoleStream; +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsoleManager; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IConsoleView; +import org.eclipse.ui.progress.IProgressService; + +import org.yocto.bc.bitbake.ICommandResponseHandler; +import org.yocto.bc.bitbake.ShellSession; +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.model.ProjectInfo; +import org.yocto.bc.ui.wizards.FiniteStateWizard; + +import org.yocto.bc.ui.wizards.newproject.BBConfigurationInitializeOperation; +import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation; + +/** + * A wizard for installing a fresh copy of an OE system. + * + * @author kgilmer + * + * A Wizard for creating a fresh Yocto bitbake project and new poky build tree from git + * + * @modified jzhang + * + */ +public class InstallWizard extends FiniteStateWizard implements + IWorkbenchWizard { + + static final String KEY_PINFO = "KEY_PINFO"; + protected static final String OPTION_MAP = "OPTION_MAP"; + protected static final String INSTALL_SCRIPT = "INSTALL_SCRIPT"; + protected static final String INSTALL_DIRECTORY = "Install Directory"; + protected static final String INIT_SCRIPT = "Init Script"; + + protected static final String PROJECT_NAME = "Project Name"; + protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env"; + protected static final String DEFAULT_INSTALL_DIR = "~/yocto"; + + protected static final String GIT_CLONE = "Git Clone"; + public static final String VALIDATION_FILE = DEFAULT_INIT_SCRIPT; + + private Map model; + private MessageConsole myConsole; + + public InstallWizard() { + this.model = new Hashtable(); + model.put(INSTALL_DIRECTORY, DEFAULT_INSTALL_DIR); + model.put(INIT_SCRIPT, DEFAULT_INIT_SCRIPT); + + setWindowTitle("Yocto Project BitBake Commander"); + setNeedsProgressMonitor(true); + + myConsole = findConsole("Yocto Project Console"); + IWorkbench wb = PlatformUI.getWorkbench(); + IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); + IWorkbenchPage page = win.getActivePage(); + String id = IConsoleConstants.ID_CONSOLE_VIEW; + try { + IConsoleView view = (IConsoleView) page.showView(id); + view.display(myConsole); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private MessageConsole findConsole(String name) { + ConsolePlugin plugin = ConsolePlugin.getDefault(); + IConsoleManager conMan = plugin.getConsoleManager(); + IConsole[] existing = conMan.getConsoles(); + for (int i = 0; i < existing.length; i++) + if (name.equals(existing[i].getName())) + return (MessageConsole) existing[i]; + // no console found, so create a new one + MessageConsole myConsole = new MessageConsole(name, null); + conMan.addConsoles(new IConsole[] { myConsole }); + return myConsole; + } + + public InstallWizard(IStructuredSelection selection) { + model = new Hashtable(); + } + + /* + * @Override public IWizardPage getNextPage(IWizardPage page) { if (page + * instanceof WelcomePage) { if (model.containsKey(WelcomePage.ACTION_USE)) + * { return bbcProjectPage; } } else if (page instanceof ProgressPage) { + * return bitbakePage; } + * + * if (super.getNextPage(page) != null) { System.out.println("next page: " + + * super.getNextPage(page).getClass().getName()); } else { + * System.out.println("end page"); } + * + * return super.getNextPage(page); } + * + * @Override public boolean canFinish() { System.out.println("can finish: " + * + super.canFinish()); return super.canFinish(); } + */ + @Override + public void addPages() { + addPage(new OptionsPage(model)); + } + + @Override + public Map getModel() { + return model; + } + + @Override + public boolean performFinish() { + BCCommandResponseHandler cmdOut = new BCCommandResponseHandler( + myConsole); + + WizardPage page = (WizardPage) getPage("Options"); + page.setPageComplete(true); + Map options = (Map) model; + String install_dir = ""; + if (options.containsKey(INSTALL_DIRECTORY)) { + install_dir = (String) options.get(INSTALL_DIRECTORY); + } + + try { + if (((Boolean)options.get(GIT_CLONE)).booleanValue()) { + String []git_clone_cmd = {"git", "clone", "--progress", "git://git.pokylinux.org/poky.git", install_dir}; + final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*"); + + this.getContainer().run(true,true, + new LongtimeRunningTask("Checking out Yocto git repository", + git_clone_cmd, null, null, + cmdOut, + new ICalculatePercentage() { + public float calWorkloadDone(String info) throws IllegalArgumentException { + Matcher m=pattern.matcher(info.trim()); + if(m.matches()) { + return new Float(m.group(1)) / 100; + }else { + throw new IllegalArgumentException(); + } + } + } + ) + ); + } + + if (!cmdOut.hasError()) { + + String initPath = install_dir + "/" + + (String) options.get(INIT_SCRIPT); + String prjName = (String) options.get(PROJECT_NAME); + ProjectInfo pinfo = new ProjectInfo(); + pinfo.setInitScriptPath(initPath); + pinfo.setLocation(install_dir); + pinfo.setName(prjName); + + ConsoleWriter cw = new ConsoleWriter(); + this.getContainer().run(false, false, + new BBConfigurationInitializeOperation(pinfo, cw)); + + myConsole.newMessageStream().println(cw.getContents()); + + model.put(InstallWizard.KEY_PINFO, pinfo); + Activator.putProjInfo(pinfo.getRootPath(), pinfo); + + this.getContainer().run(false, false, + new CreateBBCProjectOperation(pinfo)); + return true; + } + } catch (Exception e) { + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + IStatus.ERROR, e.getMessage(), e)); + this.getContainer().getCurrentPage().setDescription( + "Failed to create project: " + e.getMessage()); + } + return false; + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + } + + private interface ICalculatePercentage { + public float calWorkloadDone(String info) throws IllegalArgumentException; + } + + private class LongtimeRunningTask implements IRunnableWithProgress { + private String []cmdArray; + private String []envp; + private File dir; + private ICommandResponseHandler handler; + private Process p; + private String taskName; + static public final int TOTALWORKLOAD=100; + private int reported_workload; + ICalculatePercentage cal; + + public LongtimeRunningTask(String taskName, + String []cmdArray, String []envp, File dir, + ICommandResponseHandler handler, + ICalculatePercentage calculator) { + this.taskName=taskName; + this.cmdArray=cmdArray; + this.envp=envp; + this.dir=dir; + this.handler=handler; + this.p=null; + this.cal=calculator; + } + + private void reportProgress(IProgressMonitor monitor,String info) { + if(cal == null) { + monitor.worked(1); + }else { + float percentage; + try { + percentage=cal.calWorkloadDone(info); + } catch (IllegalArgumentException e) { + //can't get percentage + return; + } + int delta=(int) (TOTALWORKLOAD * percentage - reported_workload); + if( delta > 0 ) { + monitor.worked(delta); + reported_workload += delta; + } + } + } + + synchronized public void run(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + + boolean cancel=false; + reported_workload=0; + + try { + monitor.beginTask(taskName, TOTALWORKLOAD); + + p=Runtime.getRuntime().exec(cmdArray,envp,dir); + BufferedReader inbr = new BufferedReader(new InputStreamReader(p.getInputStream())); + BufferedReader errbr = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String info; + while (!cancel) { + if(monitor.isCanceled()) + { + cancel=true; + throw new InterruptedException("User Cancelled"); + } + + info=null; + //reading stderr + while (errbr.ready()) { + info=errbr.readLine(); + //some application using stderr to print out information + handler.response(info, false); + } + //reading stdout + while (inbr.ready()) { + info=inbr.readLine(); + handler.response(info, false); + } + + //report progress + if(info!=null) + reportProgress(monitor,info); + + //check if exit + try { + int exitValue=p.exitValue(); + if (exitValue != 0) { + handler.response( + taskName + " failed with the return value " + new Integer(exitValue).toString(), + true); + } + break; + }catch (IllegalThreadStateException e) { + } + + Thread.sleep(500); + } + } catch (IOException e) { + throw new InvocationTargetException(e); + } finally { + monitor.done(); + if (p != null ) { + p.destroy(); + } + } + } + } + + private class BCCommandResponseHandler implements ICommandResponseHandler { + private MessageConsoleStream myConsoleStream; + private Boolean errorOccured = false; + + public BCCommandResponseHandler(MessageConsole console) { + try { + this.myConsoleStream = console.newMessageStream(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void printDialog(String msg) { + try { + myConsoleStream.println(msg); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public Boolean hasError() { + return errorOccured; + } + + public void response(String line, boolean isError) { + try { + if (isError) { + myConsoleStream.println(line); + errorOccured = true; + } else { + myConsoleStream.println(line); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void printCmd(String cmd) { + try { + myConsoleStream.println(cmd); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + private class ConsoleWriter extends Writer { + + private StringBuffer sb; + + public ConsoleWriter() { + sb = new StringBuffer(); + } + + @Override + public void close() throws IOException { + } + + public String getContents() { + return sb.toString(); + } + + @Override + public void flush() throws IOException { + } + + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + // txtConsole.getText().concat(new String(cbuf)); + sb.append(cbuf); + } + + @Override + public void write(String str) throws IOException { + sb.append(str); + } + + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java new file mode 100644 index 0000000..2844fda --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java @@ -0,0 +1,247 @@ +package org.yocto.bc.ui.wizards.install; + +import java.io.IOException; +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +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.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; + +import org.yocto.bc.ui.wizards.FiniteStateWizard; +import org.yocto.bc.ui.wizards.FiniteStateWizardPage; +import org.yocto.bc.ui.wizards.FiniteStateWizardPage.ValidationListener; + +/** + * Select which flavor of OE is to be installed. + * + * @author kgilmer + * + * Setting up the parameters for creating the new Yocto Bitbake project + * + * @modified jzhang + */ +public class OptionsPage extends FiniteStateWizardPage { + + private Map vars; + private Composite c1; + private Composite top; + + private List controlList; + private boolean controlsCreated = false; + + private Text txtProjectLocation; + + private Text txtInit; + private ValidationListener validationListener; + private Text txtProjectName; + private Button gitButton; + + protected OptionsPage(Map model) { + super("Options", model); + //setTitle("Create new yocto bitbake project"); + setMessage("Enter these parameters to create new Yocto Project BitBake commander project"); + } + + @Override + public void createControl(Composite parent) { + top = new Composite(parent, SWT.None); + top.setLayout(new GridLayout()); + top.setLayoutData(new GridData(GridData.FILL_BOTH)); + + GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL); + GridData gdVU = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); + + Composite projectNameComp = new Composite(top, SWT.NONE); + GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL); + projectNameComp.setLayoutData(gdProjName); + projectNameComp.setLayout(new GridLayout(2, false)); + Label lblProjectName = new Label(projectNameComp, SWT.NONE); + lblProjectName.setText("Project N&ame:"); + + txtProjectName = new Text(projectNameComp, SWT.BORDER); + txtProjectName.setLayoutData(gdFillH); + txtProjectName.setFocus(); + validationListener = new ValidationListener(); + + txtProjectName.addModifyListener(validationListener); + + Label lblProjectLocation = new Label(projectNameComp, SWT.None); + lblProjectLocation.setText("&Project Location:"); + + Composite locComposite = new Composite(projectNameComp, SWT.NONE); + GridData gd = new GridData(GridData.VERTICAL_ALIGN_END + | GridData.FILL_HORIZONTAL); + gd.horizontalIndent = 0; + locComposite.setLayoutData(gd); + GridLayout gl = new GridLayout(2, false); + gl.marginWidth = 0; + locComposite.setLayout(gl); + + txtProjectLocation = new Text(locComposite, SWT.BORDER); + txtProjectLocation.setLayoutData(gdFillH); + txtProjectLocation.addModifyListener(validationListener); + + Button button = new Button(locComposite, SWT.PUSH); + button.setText("Browse..."); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleBrowse(); + } + }); + + //Label lblGit = new Label(projectNameComp, SWT.None); + //lblGit.setText("Clone from &Git Repository?"); + + Composite gitComposite = new Composite(projectNameComp, SWT.NONE); + gd = new GridData(GridData.VERTICAL_ALIGN_END + | GridData.FILL_HORIZONTAL); + gd.horizontalIndent = 0; + gitComposite.setLayoutData(gd); + gl = new GridLayout(1, false); + gl.marginWidth = 0; + gitComposite.setLayout(gl); + + gitButton = new Button(gitComposite, SWT.CHECK); + gitButton.setText("Clone from Yocto Project &Git Repository"); + gitButton.setEnabled(true); + gitButton.addSelectionListener(validationListener); + + setControl(top); + } + + private void handleBrowse() { + DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.None); + String dir = dialog.open(); + if (dir != null) { + txtProjectLocation.setText(dir); + } + } + + @Override + public void pageCleanup() { + + } + + @Override + public void pageDisplay() { + } + + @Override + + protected void updateModel() { + model.put(InstallWizard.INSTALL_DIRECTORY, txtProjectLocation.getText()+File.separator+txtProjectName.getText()); + model.put(InstallWizard.PROJECT_NAME, txtProjectName.getText()); + model.put(InstallWizard.GIT_CLONE, new Boolean(gitButton.getSelection())); + } + + private boolean isValidProjectName(String projectName) { + if (projectName.indexOf('$') > -1) { + return false; + } + + return true; + } + @Override + protected boolean validatePage() { + IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); + + IStatus validate = ResourcesPlugin.getWorkspace().validateName(txtProjectName.getText(), IResource.PROJECT); + + if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) { + setErrorMessage("Invalid project name: " + txtProjectName.getText()); + return false; + } + + IProject proj = wsroot.getProject(txtProjectName.getText()); + if (proj.exists()) { + setErrorMessage("A project with the name " + txtProjectName.getText() + + " already exists"); + return false; + } + + String projectLoc = txtProjectLocation.getText(); + File checkProject_dir = new File(projectLoc); + if (!checkProject_dir.isDirectory()) { + setErrorMessage("The project location directory " + txtProjectLocation.getText() + " is not valid"); + return false; + } + + String projectPath = projectLoc + File.separator+txtProjectName.getText(); + File git_dir=new File(projectPath); + if(!gitButton.getSelection()) { + if(!git_dir.isDirectory() || !git_dir.exists()) { + setErrorMessage("Directory " + txtProjectLocation.getText()+File.separator+txtProjectName.getText() + " does not exist, please select git clone."); + return false; + }else if(!new File(projectPath + File.separator + InstallWizard.VALIDATION_FILE).exists()) { + setErrorMessage("Directory " + txtProjectLocation.getText()+File.separator+txtProjectName.getText() + " seems invalid, please use other directory or project name."); + return false; + } + }else { + // git check + if(git_dir.exists()) { + setErrorMessage("Directory " + txtProjectLocation.getText()+File.separator+txtProjectName.getText() + " exists, please unselect git clone."); + return false; + } + } + + try { + URI location = new URI("file://" + txtProjectLocation.getText()+File.separator+txtProjectName.getText()); + + IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location); + if (!status.isOK()) { + setErrorMessage(status.getMessage()); + return false; + } + } catch (Exception e) { + setErrorMessage("Run into error while trying to validate entries!"); + return false; + } + setErrorMessage(null); + setMessage("All the entries are valid, press \"Finish\" to start the process, "+ + "this will take a while. Please don't interrupt till there's output in the Yocto Console window..."); + return true; + } + + private class FileOpenSelectionAdapter extends SelectionAdapter { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog fd = new FileDialog(PlatformUI.getWorkbench() + .getDisplay().getActiveShell(), SWT.OPEN); + + fd.setText("Open Configuration Script"); + fd.setFilterPath(txtProjectLocation.getText()); + + String selected = fd.open(); + + if (selected != null) { + txtInit.setText(selected); + updateModel(); + } + } + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java new file mode 100644 index 0000000..4f15107 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java @@ -0,0 +1,50 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.wizards.newproject; + +import java.io.Writer; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; + +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.bitbake.ProjectInfoHelper; +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.model.ProjectInfo; + +public class BBConfigurationInitializeOperation implements IRunnableWithProgress { + + private final ProjectInfo pinfo; + private final Writer writer; + + public BBConfigurationInitializeOperation(ProjectInfo pinfo) { + this.pinfo = pinfo; + writer = null; + } + + public BBConfigurationInitializeOperation(ProjectInfo pinfo, Writer writer) { + this.pinfo = pinfo; + this.writer = writer; + } + + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + BBSession session; + try { + ProjectInfoHelper.store(pinfo.getRootPath(), pinfo); + session = Activator.getBBSession(pinfo.getRootPath(), writer); + session.initialize(); + + } catch (Exception e) { + throw new InvocationTargetException(e); + } + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java new file mode 100644 index 0000000..dc0153b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java @@ -0,0 +1,102 @@ +/***************************************************************************** + * Copyright (c) 2009 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + *******************************************************************************/ +package org.yocto.bc.ui.wizards.newproject; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.Vector; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.QualifiedName; +import org.eclipse.core.runtime.Status; +import org.eclipse.ui.actions.WorkspaceModifyOperation; + +import org.yocto.bc.bitbake.ProjectInfoHelper; +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; +import org.yocto.bc.ui.model.ProjectInfo; + + +/** + * Creates a bbc project + * @author kgilmer + * + */ +public class CreateBBCProjectOperation extends WorkspaceModifyOperation { + + public static final String OEFS_SCHEME = "OEFS://"; + public static final QualifiedName BBC_PROJECT_INIT = new QualifiedName(null, "BBC_PROJECT_INIT"); + public static void addNatureToProject(IProject proj, String nature_id, IProgressMonitor monitor) throws CoreException { + IProjectDescription desc = proj.getDescription(); + Vector natureIds = new Vector(); + + natureIds.add(nature_id); + natureIds.addAll(Arrays.asList(desc.getNatureIds())); + desc.setNatureIds((String[]) natureIds.toArray(new String[natureIds.size()])); + + proj.setDescription(desc, monitor); + } + + private ProjectInfo projInfo; + + public CreateBBCProjectOperation(ProjectInfo projInfo) { + this.projInfo = projInfo; + } + + protected void addNatures(IProject proj, IProgressMonitor monitor) throws CoreException { + addNatureToProject(proj, BitbakeCommanderNature.NATURE_ID, monitor); + } + + private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInfo2) throws CoreException { + IProjectDescription desc = workspace.newProjectDescription(projInfo2.getProjectName()); + + try { + desc.setLocationURI(new URI(OEFS_SCHEME + projInfo2.getRootPath())); + } catch (URISyntaxException e) { + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to load filesystem.", e)); + } + + return desc; + } + + @Override + protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { + IProjectDescription desc = createProjectDescription(ResourcesPlugin.getWorkspace(), projInfo); + + IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); + + IProject proj = wsroot.getProject(projInfo.getProjectName()); + proj.create(desc, monitor); + try { + ProjectInfoHelper.store(proj.getLocationURI().getPath(), projInfo); + } catch (IOException e) { + throw new InvocationTargetException(e); + } + + proj.open(monitor); + + addNatures(proj, monitor); + } + + public ProjectInfo getProjectInfo() { + return projInfo; + } +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java new file mode 100644 index 0000000..810a014 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java @@ -0,0 +1,262 @@ +package org.yocto.bc.ui.wizards.variable; + +import java.util.Comparator; +import java.util.Map; + +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; + +import org.yocto.bc.ui.wizards.FiniteStateWizardPage; + +/** + * The wizard page for the Variable Wizard. + * @author kgilmer + * + */ +public class VariablePage extends FiniteStateWizardPage { + + private Text txtName; + private Text txtValue; + private TableViewer viewer; + private TableColumn c1; + private TableColumn c2; + + protected VariablePage(Map model) { + super("Yocto Project BitBake Commander", model); + setTitle("Yocto Project BitBake Variable Viewer"); + setDescription("Sort and fitler global BitBake variables by name or value."); + } + + @Override + public void createControl(Composite parent) { + Composite top = new Composite(parent, SWT.None); + top.setLayout(new GridLayout(2, true)); + top.setLayoutData(new GridData(GridData.FILL_BOTH)); + + ValidationListener listener = new ValidationListener(); + + txtName = new Text(top, SWT.BORDER); + txtName.addModifyListener(listener); + txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + txtValue = new Text(top, SWT.BORDER); + txtValue.addModifyListener(listener); + txtValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + viewer = new TableViewer(top); + + Table table = viewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + data.heightHint = 200; + data.horizontalSpan = 2; + table.setLayoutData(data); + c1 = new TableColumn(table, SWT.NONE); + c1.setText("Name"); + c1.setWidth(200); + c1.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + ((VariableViewerSorter) viewer.getSorter()).doSort(0); + viewer.refresh(); + } + }); + + c2 = new TableColumn(table, SWT.NONE); + c2.setText("Value"); + c2.setWidth(200); + c2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + ((VariableViewerSorter) viewer.getSorter()).doSort(1); + viewer.refresh(); + } + }); + + viewer.setContentProvider(new VariableContentProvider()); + viewer.setLabelProvider(new VariableLabelProvider()); + viewer.setSorter(new VariableViewerSorter()); + + viewer.setFilters(new ViewerFilter[] {new MapViewerFilter()}); + setControl(top); + } + + @Override + public void pageCleanup() { + + } + + @Override + public void pageDisplay() { + viewer.setInput(model); + } + + @Override + protected void updateModel() { + viewer.refresh(); + } + + @Override + protected boolean validatePage() { + return true; + } + + /** + * A content provider for the variable wizard dialog. + * @author kgilmer + * + */ + private class VariableContentProvider implements IStructuredContentProvider { + + public Object[] getElements(Object inputElement) { + return model.keySet().toArray(); + } + + public void dispose() { + + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + } + } + + /** + * A label provider for variable wizard dialog. + * @author kgilmer + * + */ + private class VariableLabelProvider implements ITableLabelProvider { + + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + String val; + + switch (columnIndex) { + case 0: + val = element.toString(); + break; + case 1: + val = (String) model.get(element); + break; + default: + val = ""; + break; + } + + return val; + } + + public void addListener(ILabelProviderListener listener) { + + } + + public void dispose() { + + } + + public boolean isLabelProperty(Object element, String property) { + return false; + } + + public void removeListener(ILabelProviderListener listener) { + + } + + } + + /** + * + * A tableviewer sorter found on the internet. + * + */ + class VariableViewerSorter extends ViewerSorter { + private static final int ASCENDING = 0; + + private static final int DESCENDING = 1; + + private int column; + + private int direction; + + public void doSort(int column) { + if (column == this.column) { + // Same column as last sort; toggle the direction + direction = 1 - direction; + } else { + // New column; do an ascending sort + this.column = column; + direction = ASCENDING; + } + } + + public int compare(Viewer viewer, Object e1, Object e2) { + int rc = 0; + Comparator c = this.getComparator(); + // Determine which column and do the appropriate sort + switch (column) { + case 0: + rc = c.compare(e1, e2); + break; + case 1: + rc = c.compare(model.get(e1), model.get(e2)); + break; + } + + // If descending order, flip the direction + if (direction == DESCENDING) + rc = -rc; + + return rc; + } + } + + /** + * A filter for the name/value model. + * @author kgilmer + * + */ + private class MapViewerFilter extends ViewerFilter { + + public MapViewerFilter() { + } + + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + String keyFilter = txtName.getText(); + String valFilter = txtValue.getText(); + + String elem = (String) element; + String val = (String) model.get(element); + + if (keyFilter.length() > 0 && elem.indexOf(keyFilter) == -1 ) { + return false; + } + + if (valFilter.length() > 0 && val.indexOf(valFilter) == -1 ) { + return false; + } + + return true; + } + + } + +} diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java new file mode 100644 index 0000000..d1bee1a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java @@ -0,0 +1,43 @@ +package org.yocto.bc.ui.wizards.variable; + +import java.util.Hashtable; +import java.util.Map; + +import org.eclipse.jface.viewers.IStructuredSelection; + +import org.yocto.bc.ui.wizards.FiniteStateWizard; + +/** + * This wizard is used to view, filter, and search for BitBake variables and variable contents. + * @author kgilmer + * + */ +public class VariableWizard extends FiniteStateWizard { + + private Map model; + + public VariableWizard(Map model) { + this.model = model; + setWindowTitle("Yocto Project BitBake Commander"); + } + + public VariableWizard(IStructuredSelection selection) { + model = new Hashtable(); + } + + @Override + public void addPages() { + addPage(new VariablePage(model)); + } + + @Override + public Map getModel() { + return model; + } + + @Override + public boolean performFinish() { + return true; + } + +} diff --git a/plugins/org.yocto.cmake.managedbuilder/.classpath b/plugins/org.yocto.cmake.managedbuilder/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.yocto.cmake.managedbuilder/.project b/plugins/org.yocto.cmake.managedbuilder/.project new file mode 100644 index 0000000..67c7f68 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.project @@ -0,0 +1,28 @@ + + + org.yocto.cmake.managedbuilder + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c1a4ce9 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Jul 14 11:43:59 CEST 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF b/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2ed5451 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.yocto.cmake.managedbuilder;singleton:=true +Bundle-Version: 1.4.0.qualifier +Bundle-Activator: org.yocto.cmake.managedbuilder.Activator +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.cdt.managedbuilder.core, + org.eclipse.cdt.core;bundle-version="5.2.1", + org.eclipse.core.resources;bundle-version="3.6.0", + org.eclipse.core.runtime;bundle-version="3.6.0", + org.eclipse.ui.console;bundle-version="3.5.0", + org.eclipse.ui;bundle-version="3.6.2", + org.yocto.sdk.ide +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy diff --git a/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..b2c067f --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,40 @@ +#/******************************************************************************* +# * Copyright (c) 2013 BMW Car IT GmbH. +# * 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: +# * BMW Car IT - initial implementation +# *******************************************************************************/ + +Bundle-Vendor = yoctoproject.org +Bundle-Name = Yocto CMake Plugin + +# Artefact type +yocto.cmake.artefactType=Yocto Project ADT CMake Project + +# Extension name +extension.name=Yocto CMake Managed Builder + +# Builder +builder.name=Yocto CMake Environment Builder + +# Toolchain +toolchain=Yocto CMake Build (Toolchain) + +# Configuration names +config.debug.name=Debug +config.debug.description=Builds a version of the project which is ready for debugging + +# CMake configure +cmakeconfigure.name=CMake configure +cmakeconfigure.options=CMake Options +cmakeconfigure.sourcepath=Relative source path +cmakeconfigure.toolchaincmakefilepath=Relative toolchain.cmake path +cmakeconfigure.debugsymbols=Compile with debug symbols +cmakeconfigure.verbosemakefile=Generate verbose Makefiles +cmakeconfigure.wdev=Enable developer warnings (-Wdev) +cmakeconfigure.wnodev=Suppress developer warnings (-Wno-dev) +cmakeconfigure.otherflags=Other flags diff --git a/plugins/org.yocto.cmake.managedbuilder/build.properties b/plugins/org.yocto.cmake.managedbuilder/build.properties new file mode 100644 index 0000000..3945652 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + templates/,\ + OSGI-INF/ diff --git a/plugins/org.yocto.cmake.managedbuilder/plugin.xml b/plugins/org.yocto.cmake.managedbuilder/plugin.xml new file mode 100644 index 0000000..7aa6671 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/plugin.xml @@ -0,0 +1,283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java new file mode 100644 index 0000000..6d4e28f --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.cmake.managedbuilder; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +public class Activator extends Plugin { + + /** The plug-in ID. */ + public static final String PLUGIN_ID = "org.yocto.cmake.managedbuilder"; //$NON-NLS-1$ + + /** The shared activator instance. */ + private static Activator plugin; + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * @return the shared instance of the Activator + */ + public static Activator getDefault() { + return plugin; + } +} diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java new file mode 100644 index 0000000..b77ae9e --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java @@ -0,0 +1,281 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.cmake.managedbuilder; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import org.eclipse.cdt.managedbuilder.core.IBuilder; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; +import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.jobs.Job; +import org.yocto.cmake.managedbuilder.job.ExecuteConfigureJob; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; + +public class YoctoCMakeMakefileGenerator implements IManagedBuilderMakefileGenerator2 { + + private static final String TOOLCHAINCMAKE_FILE_NAME = "toolchain.cmake"; //$NON-NLS-1$ + private static final String MAKEFILE_NAME = "Makefile"; //$NON-NLS-1$ + private static final String CMAKE_FILE_NAME = "CMakeLists.txt"; //$NON-NLS-1$ + private static final String CMAKECACHE_FILE_NAME = "CMakeCache.txt"; //$NON-NLS-1$ + + private IProject project; + private int lastBuildInfoChecksum = 0; + private IConfiguration configuration; + private IProgressMonitor monitor; + private IPath buildDir = null; + + @Override + public String getMakefileName() { + return MAKEFILE_NAME; + } + + @Override + public IPath getBuildWorkingDir() { + IPath buildWorkingDir = null; + + if (buildDir != null) { + buildWorkingDir = buildDir.removeFirstSegments(1); + } + + return buildWorkingDir; + } + + @Override + public boolean isGeneratedResource(IResource resource) { + return false; + } + + @Override + public void initialize(IProject project, IManagedBuildInfo info, + IProgressMonitor monitor) { + this.project = project; + this.configuration = info.getDefaultConfiguration(); + this.monitor = monitor; + + if (info.getDefaultConfiguration() != null) { + buildDir = project.getFolder(info.getConfigurationName()).getFullPath(); + } + } + + @Override + public void initialize(int buildKind, IConfiguration configuration, IBuilder builder, + IProgressMonitor monitor) { + this.project = configuration.getOwner().getProject(); + this.configuration = configuration; + this.monitor = monitor; + this.buildDir = project.getFolder(configuration.getName()).getFullPath(); + } + + @Override + public void generateDependencies() throws CoreException { + // nothing to do here + } + + @Override + public void regenerateDependencies(boolean force) throws CoreException { + generateDependencies(); + } + + @Override + public MultiStatus generateMakefiles(IResourceDelta delta) + throws CoreException { + int currentBuildInfoChecksum = ManagedBuildManager.getBuildInfo(project).hashCode(); + + IFile cmakeFile = project.getFile(CMAKE_FILE_NAME); + IResourceDelta cmakeDelta = delta.findMember(cmakeFile.getProjectRelativePath()); + IResourceDelta[] deltas = delta + .getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED); + + if (deltas.length > 0 || cmakeDelta != null || currentBuildInfoChecksum != lastBuildInfoChecksum) { + lastBuildInfoChecksum = currentBuildInfoChecksum; + return regenerateMakefiles(); + } else { + // CMake is not needed to run prior to building + // just return that makefile generation is completed + return new MultiStatus( + ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.OK, + new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.ok.makefilesStillValid")), null); //$NON-NLS-1$ + } + } + + @Override + public MultiStatus regenerateMakefiles() throws CoreException { + String taskName = + YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configure.creatingMakefiles"); //$NON-NLS-1$ + monitor.beginTask(taskName, 20); + + IFile cmakeFile = project.getFile(CMAKE_FILE_NAME); + if (!cmakeFile.exists()) { + return new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.CANCEL, + new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.cancel.missingCMakeList")), null); //$NON-NLS-1$ + } + + // Retrieve Build directory + IPath workingDir = getBuildWorkingDir(); + IPath location = project.getLocation().append(workingDir); + monitor.worked(1); + + // Create build directory if it doesn't exist + if (!location.toFile().exists()) { + monitor.subTask( + YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.creatingBuildDirectory")); //$NON-NLS-1$ + location.toFile().mkdirs(); + } else { + monitor.subTask( + YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.removingCacheFiles")); //$NON-NLS-1$ + IFile cmakeCache = project.getFile(workingDir.append(CMAKECACHE_FILE_NAME)); + cmakeCache.delete(true, monitor); + } + monitor.setTaskName(taskName); + + createToolchainCMakeFile(workingDir); + + // Create the Makefiles by executing cmake + ExecuteConfigureJob job = + new ExecuteConfigureJob( + YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configureJob.name"), //$NON-NLS-1$ + project, configuration, location); + job.setPriority(Job.BUILD); + job.setUser(false); + + job.schedule(); + try { + job.join(); + monitor.done(); + return new MultiStatus( + Activator.PLUGIN_ID, job.getResult().getSeverity(), + job.getResult().getMessage(), null); + } catch (InterruptedException e) { + return new MultiStatus( + Activator.PLUGIN_ID, + IStatus.ERROR, new String( + YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed")), null); //$NON-NLS-1$ + } + } + + private String createCMakeSetStatement(String variable, String value, String cacheOption) { + String setStatement = "set("; //$NON-NLS-1$ + setStatement += variable + " " + value; //$NON-NLS-1$ + if(cacheOption != null && !cacheOption.equals("")) { //$NON-NLS-1$ + setStatement += " " + cacheOption; //$NON-NLS-1$ + } + setStatement += ")\n"; //$NON-NLS-1$ + return setStatement; + } + + // Considered poky's cmake.bbclass for this method + private void createToolchainCMakeFile(IPath workingDir) { + String toolchainCMakeFileContentAsString = "# CMake system name must be something like \"Linux\".\n" + //$NON-NLS-1$ + "# This is important for cross-compiling.\n"; //$NON-NLS-1$ + + String targetArchValue = YoctoSDKUtils.getEnvValue(project, "TARGET_ARCH"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_SYSTEM_PROCESSOR", targetArchValue, null); //$NON-NLS-1$ + + String oeCMakeCCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_COMPILER"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_COMPILER", oeCMakeCCompilerValue, null); //$NON-NLS-1$ + + String oeCMakeCXXCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_COMPILER"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_COMPILER", oeCMakeCXXCompilerValue, null); //$NON-NLS-1$ + + String oeCMakeCFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS", //$NON-NLS-1$ + "\"" + oeCMakeCFlagsValue + "\"", "CACHE STRING \"CFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + String oeCMakeCXXFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS", //$NON-NLS-1$ + "\"" + oeCMakeCXXFlagsValue + "\"", "CACHE STRING \"CXXFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + String oeCMakeCFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS_RELEASE"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS_RELEASE", //$NON-NLS-1$ + "\"" + oeCMakeCFlagsReleaseValue + "\"", "CACHE STRING \"CFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + String oeCMakeCXXFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS_RELEASE"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS_RELEASE", //$NON-NLS-1$ + "\"" + oeCMakeCXXFlagsReleaseValue + "\"", "CACHE STRING \"CXXFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + String oeCMakeCLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_LINK_FLAGS"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_LINK_FLAGS", //$NON-NLS-1$ + "\"" + oeCMakeCLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + String oeCMakeCXXLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_LINK_FLAGS"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_LINK_FLAGS", //$NON-NLS-1$ + "\"" + oeCMakeCXXLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ + toolchainCMakeFileContentAsString += "# only search in the paths provided so cmake doesnt pick\n"; //$NON-NLS-1$ + toolchainCMakeFileContentAsString += "# up libraries and tools from the native build machine\n"; //$NON-NLS-1$ + + String findRootPathValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_HOST"); //$NON-NLS-1$ + findRootPathValue += " "; //$NON-NLS-1$ + findRootPathValue += YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_NATIVE"); //$NON-NLS-1$ + findRootPathValue += " "; //$NON-NLS-1$ + findRootPathValue += YoctoSDKUtils.getEnvValue(project, "CROSS_DIR"); //$NON-NLS-1$ + findRootPathValue += " "; //$NON-NLS-1$ + findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_PERLNATIVE_DIR"); //$NON-NLS-1$ + findRootPathValue += " "; //$NON-NLS-1$ + findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_EXTRA_ROOT_PATH"); //$NON-NLS-1$ + findRootPathValue += " "; //$NON-NLS-1$ + findRootPathValue += YoctoSDKUtils.getEnvValue(project, "EXTERNAL_TOOLCHAIN"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH", findRootPathValue, null); //$NON-NLS-1$ + + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ + toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ + + toolchainCMakeFileContentAsString += "# Use qt.conf settings\n"; //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("ENV{QT_CONF_PATH}", "qt.conf", null); //$NON-NLS-1$ //$NON-NLS-2$ + toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ + + toolchainCMakeFileContentAsString += "# We need to set the rpath to the correct directory as cmake does not provide any\n"; //$NON-NLS-1$ + toolchainCMakeFileContentAsString += "# directory as rpath by default\n"; //$NON-NLS-1$ + + String oeCMakeRPathValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_RPATH"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_INSTALL_RPATH", oeCMakeRPathValue, null); //$NON-NLS-1$ + + toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ + toolchainCMakeFileContentAsString += "# Use native cmake modules\n"; //$NON-NLS-1$ + + String stagingDatadirValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DATADIR"); //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_MODULE_PATH", //$NON-NLS-1$ + stagingDatadirValue + "/cmake/Modules/", null); //$NON-NLS-1$ + + toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ + toolchainCMakeFileContentAsString += "# add for non /usr/lib libdir, e.g. /usr/lib64\n"; //$NON-NLS-1$ + toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_LIBRARY_PATH", //$NON-NLS-1$ + "${libdir} ${base_libdir}", null); //$NON-NLS-1$ + + InputStream toolchainCMakeFileContent = new ByteArrayInputStream(toolchainCMakeFileContentAsString.getBytes()); + + IFile toolchainCMakeFile = project.getFile(TOOLCHAINCMAKE_FILE_NAME); + try { + if (toolchainCMakeFile.exists()) { + toolchainCMakeFile.delete(true, monitor); + } + toolchainCMakeFile.create(toolchainCMakeFileContent, true, monitor); + } catch (CoreException e) { + e.printStackTrace(); + } + } +} diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java new file mode 100644 index 0000000..1bd8b46 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.cmake.managedbuilder; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class YoctoCMakeMessages { + + private static final String RESOURCE_BUNDLE= YoctoCMakeMessages.class.getName(); + private static ResourceBundle fgResourceBundle; + static { + try { + fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE); + } catch (MissingResourceException x) { + fgResourceBundle = null; + } + } + + private YoctoCMakeMessages() { + } + + public static String getString(String key) { + try { + return fgResourceBundle.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } catch (NullPointerException e) { + return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * Gets a string from the resource bundle and formats it with the argument + * + * @param key the string used to get the bundle value, must not be null + */ + public static String getFormattedString(String key, Object arg) { + return MessageFormat.format(getString(key), new Object[] { arg }); + } + + /** + * Gets a string from the resource bundle and formats it with arguments + */ + public static String getFormattedString(String key, Object[] args) { + return MessageFormat.format(getString(key), args); + } +} diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties new file mode 100644 index 0000000..55773ac --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties @@ -0,0 +1,29 @@ +#/******************************************************************************* +# * Copyright (c) 2013 BMW Car IT GmbH. +# * 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: +# * BMW Car IT - initial implementation +# *******************************************************************************/ + +# Job +ExecuteConfigureJob.runConfigure=Running configure +ExecuteConfigureJob.consoleName=Configure using CMake [{0}] +ExecuteConfigureJob.buildingMakefile=Building Makefile +ExecuteConfigureJob.warning.aborted=Build of project has been aborted +ExecuteConfigureJob.error.couldNotStart=Build of project could not be started +ExecuteConfigureJob.error.buildFailed=Build of project failed +ExecuteConfigureJob.cmakeWarning.dialogTitle=Unable to run command "cmake" +ExecuteConfigureJob.cmakeWarning.dialogMessage=Please make sure that cmake is installed properly on this machine. + +# File generator +YoctoCMakeMakefileGenerator.configureJob.name=Configuring project +YoctoCMakeMakefileGenerator.configure.creatingMakefiles=Generating Makefiles using CMake +YoctoCMakeMakefileGenerator.cancel.missingCMakeList=CMakeLists.txt file is missing +YoctoCMakeMakefileGenerator.creatingBuildDirectory=Creating build directory +YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed=Makefile generation failed during configuration process +YoctoCMakeMakefileGenerator.ok.makefilesStillValid=Makefiles are still valid. +YoctoCMakeMakefileGenerator.removingCacheFiles=Removing cache files diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java new file mode 100644 index 0000000..354d930 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java @@ -0,0 +1,186 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.cmake.managedbuilder.job; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IContributedEnvironment; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.managedbuilder.core.BuildException; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.ITool; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.console.IOConsoleOutputStream; +import org.yocto.cmake.managedbuilder.Activator; +import org.yocto.cmake.managedbuilder.YoctoCMakeMessages; +import org.yocto.cmake.managedbuilder.util.ConsoleUtility; +import org.yocto.cmake.managedbuilder.util.SystemProcess; + + +public class ExecuteConfigureJob extends Job { + private SystemProcess configureProcess; + private LinkedList configureCommand; + private IProject project; + private IConfiguration configuration; + private IPath location; + + + public ExecuteConfigureJob(String name, + IProject project, IConfiguration configuration, IPath location) { + super(name); + this.project = project; + this.configuration = configuration; + this.location = location; + createCommands(); + createProcesses(); + } + + protected void createCommands() { + configureCommand = new LinkedList(); + + ITool[] configure = configuration + .getToolsBySuperClassId("org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe"); //$NON-NLS-1$ + + addCommand(configure[0]); + + try { + addFlags(configure[0]); + } catch (BuildException e) { + // ignore this exception + } + } + + private void addCommand(ITool configure) { + String command = configuration.getToolCommand(configure); + configureCommand.add(command); + } + + private void addFlags(ITool configure) throws BuildException { + String[] flags = configure.getToolCommandFlags( + project.getLocation(), location); + for (String flag : flags) { + if (flag.contains(" ")) { //$NON-NLS-1$ + String[] separatedFlags = flag.trim().split(" "); //$NON-NLS-1$ + configureCommand.addAll(Arrays.asList(separatedFlags)); + } else { + configureCommand.add(flag); + } + } + } + + protected void createProcesses() { + configureProcess = + new SystemProcess(configureCommand, location.toFile(), getEnvVariablesAsMap(project)); + } + + private Map getEnvVariablesAsMap (IProject project) { + Map result = new HashMap(); + + ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); + ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); + IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); + IContributedEnvironment env = manager.getContributedEnvironment(); + + for(IEnvironmentVariable var : env.getVariables(ccdesc)) { + result.put(var.getName(), var.getValue()); + } + + return result; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + protected IStatus run(IProgressMonitor monitor) { + monitor.beginTask( + YoctoCMakeMessages.getString("ExecuteConfigureJob.runConfigure"), 20); //$NON-NLS-1$ + + IOConsoleOutputStream cos = + ConsoleUtility.getConsoleOutput(YoctoCMakeMessages.getFormattedString("ExecuteConfigureJob.consoleName", //$NON-NLS-1$ + project.getName())); + monitor.worked(1); + + try { + return buildProject(monitor, cos); + } catch (IOException e) { + if(e.getMessage().startsWith("Cannot run program \"cmake\"")) { //$NON-NLS-1$ + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + MessageDialog.openWarning(null, + YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogTitle"), //$NON-NLS-1$ + YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogMessage")); //$NON-NLS-1$ + } + }); + return Status.OK_STATUS; + } else { + return new Status(Status.ERROR, + Activator.PLUGIN_ID, Status.OK, + YoctoCMakeMessages.getString("ExecuteConfigureJob.error.couldNotStart"), e); //$NON-NLS-1$ + } + } catch (InterruptedException e) { + return new Status(Status.WARNING, + Activator.PLUGIN_ID, + YoctoCMakeMessages.getString("ExecuteConfigureJob.warning.aborted")); //$NON-NLS-1$ + } finally { + try { + cos.close(); + } catch (IOException e) { + cos = null; + } + } + } + + private IStatus buildProject(IProgressMonitor monitor, + IOConsoleOutputStream cos) throws IOException, InterruptedException { + monitor.subTask( + YoctoCMakeMessages.getString("ExecuteConfigureJob.buildingMakefile")); //$NON-NLS-1$ + configureProcess.start(cos); + int exitValue = configureProcess.waitForResultAndStop(); + monitor.worked(15); + + if (exitValue != 0) { + return new Status(Status.ERROR, Activator.PLUGIN_ID, + YoctoCMakeMessages.getString("ExecuteConfigureJob.error.buildFailed") + " " + exitValue); //$NON-NLS-1$ //$NON-NLS-2$ + } + + return Status.OK_STATUS; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#canceling() + */ + /** + * Cancels the job and interrupts the system process. + * {@inheritDoc} + */ + @Override + protected void canceling() { + configureProcess.interrupt(); + } +} diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java new file mode 100644 index 0000000..9fb31e5 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.cmake.managedbuilder.util; + +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IOConsoleOutputStream; +import org.eclipse.ui.console.MessageConsole; + + +public class ConsoleUtility { + + public static IOConsoleOutputStream getConsoleOutput(String consoleName) { + return getConsole(consoleName).newOutputStream(); + } + + public static MessageConsole getConsole(String consoleName) { + MessageConsole foundConsole = findConsole(consoleName); + if (foundConsole != null) { + foundConsole.clearConsole(); + } else { + foundConsole = new MessageConsole(consoleName, null); + ConsolePlugin.getDefault(). + getConsoleManager().addConsoles(new IConsole[] { foundConsole }); + } + + return foundConsole; + } + + public static MessageConsole findConsole(String consoleName) { + IConsole[] consoles = + ConsolePlugin.getDefault().getConsoleManager().getConsoles(); + for (IConsole console : consoles) { + if (console.getName().equals(consoleName)) { + return (MessageConsole) console; + } + } + + return null; + } +} diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java new file mode 100644 index 0000000..9ca6e60 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.cmake.managedbuilder.util; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.LinkedList; +import java.util.Map; + +public class SystemProcess { + + private LinkedList command = new LinkedList(); + private File workingDirectory; + private ProcessBuilder builder; + private Process process; + private StreamPipe outputRedirector; + + public SystemProcess(LinkedList command) { + this(command, null); + } + + public SystemProcess(LinkedList command, File directory) { + this(command, directory, null); + } + + public SystemProcess(LinkedList command, File directory, Map additionalEnvironmentVariables) { + super(); + this.command = command; + if (directory != null) { + this.workingDirectory = directory; + } + setUpProcessBuilder(additionalEnvironmentVariables); + } + + private void setUpProcessBuilder(Map additionalEnvironmentVariables) { + builder = new ProcessBuilder(command); + if (workingDirectory != null) { + builder.directory(workingDirectory); + } + builder.redirectErrorStream(true); + + if(additionalEnvironmentVariables != null && !additionalEnvironmentVariables.isEmpty()) { + builder.environment().putAll(additionalEnvironmentVariables); + } + } + + public void start(OutputStream out) throws IOException { + if (builder != null) { + process = builder.start(); + outputRedirector = redirectOutput(process, out); + } + } + + public int waitForResultAndStop() throws InterruptedException { + if (process == null) { + return -1; + } + + process.waitFor(); + outputRedirector.interrupt(); + + return process.exitValue(); + } + + public void interrupt() { + process.destroy(); + } + + private StreamPipe redirectOutput(Process process, OutputStream out) { + InputStream in = process.getInputStream(); + StreamPipe stdoutPipe = new StreamPipe(in, out); + stdoutPipe.start(); + + return stdoutPipe; + } + + + private class StreamPipe extends Thread { + private InputStream in; + private OutputStream out; + boolean shutdown = false; + + public StreamPipe(InputStream in, OutputStream out) { + this.in = in; + this.out = out; + } + + @Override + public void run() { + byte[] buffer = new byte[1024]; + int length = 0; + + try { + while(!shutdown && ((length = in.read(buffer)) > -1)) { + out.write(buffer, 0, length); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void interrupt() { + shutdown = true; + super.interrupt(); + } + } +} diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt new file mode 100644 index 0000000..e6482a7 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required (VERSION 2.8.1) + +######## Project settings ######## +PROJECT($(projectName)) +SET(LICENSE "TBD") + +######## Build and include settings ######## +include_directories( + inc +) + +link_directories( + ${LINK_DIRECTORIES} +) + + +file(GLOB SOURCES + "src/*.c" +) + +add_executable( + $(projectName) + + ${SOURCES} +) + +TARGET_LINK_LIBRARIES( + $(projectName) +) + +######## Install targets ######## +INSTALL(TARGETS $(projectName) + RUNTIME DESTINATION usr/bin +) diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c new file mode 100644 index 0000000..78b4e23 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c @@ -0,0 +1,21 @@ +/** @mainpage $(projectName) - $(vendor) + * + * @author $(author) <$(email)> + * @version $(projectVersion) +**/ + + +#include +/** + * Main class of project $(projectName) + * + * @param argc the number of arguments + * @param argv the arguments from the commandline + * @returns exit code of the application + */ +int main(int argc, char **argv) { + // print a greeting to the console + printf("Hello World!\n"); + + return 0; +} diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties new file mode 100644 index 0000000..bc37c1c --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties @@ -0,0 +1,31 @@ +#/******************************************************************************* +# * Copyright (c) 2013 BMW Car IT GmbH. +# * 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: +# * BMW Car IT - initial implementation +# *******************************************************************************/ + +# Template +template.vendor=Yocto Project +template.name=Hello World C CMake Project +template.description=A simple C hello world project based on CMake + +# General Settings +general.name=General settings +general.description=Author properties of the project +general.author.name=Author +general.author.description=The author of the project +general.author.default=anonymous +general.email.name=Email address +general.email.description=The email address of the project's author +general.email.default=anony@mo.us +general.vendor.name=Vendor +general.vendor.description=The vendor of the project +general.vendor.default=None +general.projectVersion.name=Version +general.projectVersion.description=The version of the project +general.projectVersion.default=1.0.0 diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml new file mode 100644 index 0000000..7c3774e --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml @@ -0,0 +1,61 @@ + + diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt new file mode 100644 index 0000000..0436959 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required (VERSION 2.8.1) + +######## Project settings ######## +PROJECT($(projectName)) +SET(LICENSE "TBD") + +######## Build and include settings ######## +include_directories( + inc +) + +link_directories( + ${LINK_DIRECTORIES} +) + + +file(GLOB SOURCES + "src/*.cpp" +) + +add_executable( + $(projectName) + + ${SOURCES} +) + +TARGET_LINK_LIBRARIES( + $(projectName) +) + +######## Install targets ######## +INSTALL(TARGETS $(projectName) + RUNTIME DESTINATION usr/bin +) diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp new file mode 100644 index 0000000..78b4e23 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp @@ -0,0 +1,21 @@ +/** @mainpage $(projectName) - $(vendor) + * + * @author $(author) <$(email)> + * @version $(projectVersion) +**/ + + +#include +/** + * Main class of project $(projectName) + * + * @param argc the number of arguments + * @param argv the arguments from the commandline + * @returns exit code of the application + */ +int main(int argc, char **argv) { + // print a greeting to the console + printf("Hello World!\n"); + + return 0; +} diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties new file mode 100644 index 0000000..99e7047 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties @@ -0,0 +1,31 @@ +#/******************************************************************************* +# * Copyright (c) 2013 BMW Car IT GmbH. +# * 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: +# * BMW Car IT - initial implementation +# *******************************************************************************/ + +# Template +template.vendor=Yocto Project +template.name=Hello World C++ CMake Project +template.description=A simple C++ hello world project based on CMake + +# General Settings +general.name=General settings +general.description=Author properties of the project +general.author.name=Author +general.author.description=The author of the project +general.author.default=anonymous +general.email.name=Email address +general.email.description=The email address of the project's author +general.email.default=anony@mo.us +general.vendor.name=Vendor +general.vendor.description=The vendor of the project +general.vendor.default=None +general.projectVersion.name=Version +general.projectVersion.description=The version of the project +general.projectVersion.default=1.0.0 diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml new file mode 100644 index 0000000..a664d8a --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml @@ -0,0 +1,61 @@ + + diff --git a/plugins/org.yocto.doc.user/.classpath b/plugins/org.yocto.doc.user/.classpath new file mode 100644 index 0000000..bc74aab --- /dev/null +++ b/plugins/org.yocto.doc.user/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/plugins/org.yocto.doc.user/.project b/plugins/org.yocto.doc.user/.project new file mode 100644 index 0000000..d46bf21 --- /dev/null +++ b/plugins/org.yocto.doc.user/.project @@ -0,0 +1,28 @@ + + + org.yocto.doc.user + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.yocto.doc.user/META-INF/MANIFEST.MF b/plugins/org.yocto.doc.user/META-INF/MANIFEST.MF new file mode 100644 index 0000000..83c597c --- /dev/null +++ b/plugins/org.yocto.doc.user/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.yocto.doc.user;singleton:=true +Bundle-Version: 1.4.0.qualifier +Bundle-Vendor: %Bundle-Vendor +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: org.eclipse.help diff --git a/plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..b602cbd --- /dev/null +++ b/plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,3 @@ +#Properties file for org.yocto.doc.user +Bundle-Vendor = yoctoproject.org +Bundle-Name = Yocto Project Documentation diff --git a/plugins/org.yocto.doc.user/about.html.in b/plugins/org.yocto.doc.user/about.html.in new file mode 100644 index 0000000..3040859 --- /dev/null +++ b/plugins/org.yocto.doc.user/about.html.in @@ -0,0 +1,189 @@ + + + + +About + + +

About This Content

+ +

+ December, 2012 +

+

License

+ +

+ Copyright (c) 2010 Intel, Inc. and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at
+ + http://www.eclipse.org/legal/epl-v10.html + +

+ +

Third Party Content

+

The Content includes items that have been sourced from the Yocto project + as set out below. If you did not receive this Content directly + from the Linux Foundation, the following is provided for + informational purposes only, and you should look to the + Redistributor's license for terms and conditions of use.

+

+ + Yocto Project Quick Start + +
+
+ This short document lets you get started with the Yocto Project + quickly and start building an image. +
+
+ License: + + http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode + +
+ Source Code Repository: + + git://git.yoctoproject.org/yocto-docs + +
+ Commit: @COMMIT_ID-yocto-project-qs@ +
+
+ + Yocto Project Application Developer's Guide: + +
+
+ This manual shows you how to setup and use the Application Development + Toolkit (ADT) and stand-alone cross-development toolchains so you can + develop user-space applications. +
+
+ License: + + http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode + +
+ Source Code Repository: + + git://git.yoctoproject.org/yocto-docs + +
+ Commit: @COMMIT_ID-adt-manual@ +
+
+ + Yocto Project Development Manual: + +
+
+ This manual describes how to use the Yocto Project to develop + embedded Linux images and user-space applications to run on + targeted devices. +
+
+ License: + + http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode + +
+ Source Code Repository: + + git://git.yoctoproject.org/yocto-docs + +
+ Commit: @COMMIT_ID-dev-manual@ +
+
+ + Yocto Project Reference Manual: + +
+
+ This manual is the complete reference guide to the Poky component. + It also contains a chapter on Board Support Package (BSP) development. +
+
+ License: + + http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode + +
+ Source Code Repository: + + git://git.yoctoproject.org/yocto-docs + +
+ Commit: @COMMIT_ID-ref-manual@ +
+
+ + Yocto Project Board Support Package (BSP) Developer's Guide: + +
+
+ This brief document defines a structure for BSP components. + Having a commonly understood layout encourages standardization. +
+
+ License: + + http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode + +
+ Source Code Repository: + + git://git.yoctoproject.org/yocto-docs + +
+ Commit: @COMMIT_ID-bsp-guide@ +
+
+ + Yocto Project Linux Kernel Development Manual: + +
+
+ This document describes the architecture of the Yocto Project + kernel and provides some work flow examples. +
+
+ License: + + http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode + +
+ Source Code Repository: + + git://git.yoctoproject.org/yocto-docs + +
+ Commit: @COMMIT_ID-kernel-dev@ +
+
+ + Yocto Project Profiling and Tracing Manual: + +
+
+ This manual presents a set of common and generally useful + tracing and profiling schemes along with their application + (as appropriate) to each tool. +
+
+ License: + + http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode + +
+ Source Code Repository: + + git://git.yoctoproject.org/yocto-docs + +
+ Commit: @COMMIT_ID-profile-manual@ +

+ diff --git a/plugins/org.yocto.doc.user/build.properties b/plugins/org.yocto.doc.user/build.properties new file mode 100644 index 0000000..cbceb14 --- /dev/null +++ b/plugins/org.yocto.doc.user/build.properties @@ -0,0 +1,9 @@ +bin.includes = plugin.xml,\ + .,\ + META-INF/,\ + OSGI-INF/,\ + html/,\ + toc.xml,\ + about.html +src.includes = html/,\ + about.html diff --git a/plugins/org.yocto.doc.user/html/book.css b/plugins/org.yocto.doc.user/html/book.css new file mode 100644 index 0000000..e248f5a --- /dev/null +++ b/plugins/org.yocto.doc.user/html/book.css @@ -0,0 +1 @@ +@import "PLUGINS_ROOT/PRODUCT_PLUGIN/book.css"; diff --git a/plugins/org.yocto.doc.user/plugin.xml b/plugins/org.yocto.doc.user/plugin.xml new file mode 100644 index 0000000..8e87ce7 --- /dev/null +++ b/plugins/org.yocto.doc.user/plugin.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.yocto.doc.user/toc.xml b/plugins/org.yocto.doc.user/toc.xml new file mode 100644 index 0000000..86fbe29 --- /dev/null +++ b/plugins/org.yocto.doc.user/toc.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.yocto.remote.utils/.classpath b/plugins/org.yocto.remote.utils/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/plugins/org.yocto.remote.utils/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.yocto.remote.utils/.project b/plugins/org.yocto.remote.utils/.project new file mode 100644 index 0000000..29a2a5a --- /dev/null +++ b/plugins/org.yocto.remote.utils/.project @@ -0,0 +1,28 @@ + + + org.yocto.remote.utils + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF b/plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c7b57fe --- /dev/null +++ b/plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Utils +Bundle-SymbolicName: org.yocto.remote.utils +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.yocto.remote.utils.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Import-Package: org.eclipse.rse.core, + org.eclipse.rse.core.model, + org.eclipse.rse.core.subsystems, + org.eclipse.rse.internal.terminals.ui, + org.eclipse.rse.internal.terminals.ui.views, + org.eclipse.rse.services, + org.eclipse.rse.services.files, + org.eclipse.rse.services.shells, + org.eclipse.rse.services.terminals, + org.eclipse.rse.subsystems.files.core.servicesubsystem, + org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem, + org.eclipse.rse.subsystems.terminals.core, + org.eclipse.rse.subsystems.terminals.core.elements, + org.eclipse.rse.ui, + org.eclipse.tm.internal.terminal.control, + org.eclipse.tm.internal.terminal.provisional.api +Export-Package: org.yocto.remote.utils diff --git a/plugins/org.yocto.remote.utils/build.properties b/plugins/org.yocto.remote.utils/build.properties new file mode 100644 index 0000000..c3d44a1 --- /dev/null +++ b/plugins/org.yocto.remote.utils/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + resources/,\ + . diff --git a/plugins/org.yocto.remote.utils/resources/ust_tar.sh b/plugins/org.yocto.remote.utils/resources/ust_tar.sh new file mode 100755 index 0000000..20a8039 --- /dev/null +++ b/plugins/org.yocto.remote.utils/resources/ust_tar.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +#set PATH to include sbin dirs +export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" + +if [ ! -d "$@" ] || [ -z "$@" ]; then + exit 1 +fi + +DATESTRING="$(date +%Y%m%d%H%M%S%N)" +BASENAME=`basename $@` +DATAFILE=/tmp/${BASENAME}-${DATESTRING}.tar +cd $@ +cd .. + +tar -cf ${DATAFILE} ${BASENAME} &> /dev/null || exit $? + +echo -e "ustfile:$DATAFILE\n" + diff --git a/plugins/org.yocto.remote.utils/resources/yocto_tool.sh b/plugins/org.yocto.remote.utils/resources/yocto_tool.sh new file mode 100755 index 0000000..099e481 --- /dev/null +++ b/plugins/org.yocto.remote.utils/resources/yocto_tool.sh @@ -0,0 +1,125 @@ +#!/bin/sh + +help () +{ + echo "Usage $0 command [options] application [application argument]" + echo "command:" + echo " start - start an application" + echo " stop - stop an application" + echo " restart - restart an application" + echo "" + echo "options: -d | -l " + echo " -d - start an application as a singleton daemon" + echo " -l - redirect the standard output/error in the the file" + echo " note: Option -d and -l are exclusive to each other" + exit 1 +} + +killproc() { # kill the named process(es) + pid=`/bin/pidof $1` + [ "x$pid" != "x" ] && kill $pid +} + +start () +{ + pid=`/bin/pidof $APP` + [ "x$pid" != "x" ] && return 0 + + if [ "x$DAEMON" != "x" ]; then + if [ "x$APPARG" != "x" ]; then + start-stop-daemon -S -b --oknodo -x $APP -- $APPARG + else + start-stop-daemon -S -b --oknodo -x $APP + fi + + #wait for sometime for the backend app to bring up & daemonzie + ret=$? + if [ $ret -eq 0 ]; then + sleep 1 + fi + return $ret + elif [ "x$LOGFILE" != "x" ]; then + $APP $APPARG $>${LOGFILE} + else + $APP $APPARG + fi +} + +stop () +{ + if [ "x$DAEMON" != "x" ]; then + start-stop-daemon -K -x $APP + else + count=0 + while [ -n "`/bin/pidof $APP`" -a $count -lt 10 ] ; do + killproc $APP >& /dev/null + sleep 1 + RETVAL=$? + if [ $RETVAL != 0 -o -n "`/bin/pidof $APP`" ] ; then + sleep 3 + fi + count=`expr $count + 1` + done + fi +} + +restart () +{ + stop + sleep 1 + start +} + +#set PATH to include sbin dirs +export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" + +#get command +case $1 in +start) CMD=$1; shift 1 + ;; +stop) CMD=$1; shift 1 + ;; +*) help + ;; +esac + +#get options +while [ $# -gt 0 ]; do + case $1 in + -d) DAEMON=true; shift 1 + ;; + -l) LOGFILE=$2; shift 2 + ;; + *) break + ;; + esac +done + +#get application +APP=$1 +shift 1 + +#get app argument +APPARG="$@" + +#validate options +if [ "x$DAEMON" != "x" -a "x$LOGFILE" != "x" ]; then + help +fi +if [ "x$DAEMON" != "x" ]; then + APP=`which $APP` +fi +if [ "x$APP" == "x" ]; then + help +fi + +#run script +case $CMD in +start) start + ;; +stop) stop + ;; +restart) + restart + ;; +esac diff --git a/plugins/org.yocto.remote.utils/resources/yocto_ust.sh b/plugins/org.yocto.remote.utils/resources/yocto_ust.sh new file mode 100755 index 0000000..a1637db --- /dev/null +++ b/plugins/org.yocto.remote.utils/resources/yocto_ust.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +#set PATH to include sbin dirs +export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" + +DATESTRING="$(date +%Y%m%d%H%M%S%N)" +TEMPFILE="/tmp/yocto-ust-tmp-$DATESTRING" + +rm -f ${TEMPFILE} +usttrace $@ &> ${TEMPFILE} +ret=$? + +if [ $ret -ne 0 ]; then + cat $TEMPFILE + rm -f $TEMPFILE + exit $ret +fi + +#search for output dir +USTDIR=`cat ${TEMPFILE} | awk '/^Trace was output in:/ { print $5}'` +rm -f ${TEMPFILE} + +if [ -z "$USTDIR" ]; then + exit 1 +fi + +BASENAME=`basename $USTDIR` +DATAFILE=/tmp/${BASENAME}.tar +cd $USTDIR +cd .. + +tar -cf ${DATAFILE} ${BASENAME} &> /dev/null || exit $? + +echo -e "ustfile:$DATAFILE\n" + diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java new file mode 100644 index 0000000..da66a3e --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2013 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.remote.utils; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.yocto.remote.utils"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + 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; + } + +} diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java new file mode 100644 index 0000000..23afd38 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.remote.utils; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.swt.widgets.Display; + +public class CommonHelper { + + static public boolean isExecAvail(String exec) { + boolean ret = false; + try { + Process p = Runtime.getRuntime().exec(new String[] {"which", exec}); + p.waitFor(); + if(p.exitValue() == 0) { + ret = true; + } + } catch (Exception e) { + e.printStackTrace(); + } + return ret; + } + + public static void showErrorDialog(final String dialogTitle, final String errorMessage, final String reason) { + //needs to be run in the ui thread otherwise swt throws invalid thread access + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + ErrorDialog.openError(null, dialogTitle, errorMessage, + new Status(IStatus.ERROR,Activator.PLUGIN_ID,reason)); + } + }); + + } + +} diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java new file mode 100644 index 0000000..5fbab76 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java @@ -0,0 +1,26 @@ +package org.yocto.remote.utils; + +import org.eclipse.jface.dialogs.MessageDialog; + +public class DialogRunnable implements Runnable{ + int type = 0; + boolean result; + public static final int QUESTION = 1; + public static final int ERROR = 2; + String title; + String message; + + DialogRunnable(String title, String message, int type){ + this.title = title; + this.message = message; + this.type = type; + } + @Override + public void run() { + if (type == QUESTION) { + result = MessageDialog.openQuestion(null, title, message); + } else if (type == ERROR) { + MessageDialog.openError(null, title, message); + } + } +} \ No newline at end of file diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java new file mode 100644 index 0000000..fc696d6 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2013 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.remote.utils; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.yocto.remote.utils.messages"; //$NON-NLS-1$ + + public static String ErrorNoSubsystem; + public static String ErrorConnectSubsystem; + + public static String InfoDownload; + public static String InfoUpload; + + public static String RemoteShellExec_1; + public static String RemoteShellExec_2; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java new file mode 100644 index 0000000..201c944 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java @@ -0,0 +1,344 @@ +/******************************************************************************** + * Copyright (c) 2013 MontaVista Software, Inc and Others. + * 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: + * Anna Dushistova (MontaVista) - initial API and implementation + * Lianhao Lu (Intel) - Modified to add other file operations. + * Ioana Grigoropol (Intel) - Separated remote functionality + ********************************************************************************/ +package org.yocto.remote.utils; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.osgi.util.NLS; +import org.eclipse.rse.core.IRSECoreStatusCodes; +import org.eclipse.rse.core.IRSESystemType; +import org.eclipse.rse.core.RSECorePlugin; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.model.ISubSystemConfigurationCategories; +import org.eclipse.rse.core.model.ISystemRegistry; +import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.services.IService; +import org.eclipse.rse.services.files.IFileService; +import org.eclipse.rse.services.shells.HostShellProcessAdapter; +import org.eclipse.rse.services.shells.IHostShell; +import org.eclipse.rse.services.shells.IShellService; +import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; +import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; +import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; + +public class RSEHelper { + private final static String EXIT_CMD = "exit"; //$NON-NLS-1$ + private final static String CMD_DELIMITER = ";"; //$NON-NLS-1$ + + public static IHost getRemoteConnectionByName(String remoteConnection) { + if (remoteConnection == null) + return null; + IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHosts(); + for (int i = 0; i < connections.length; i++) + if (connections[i].getAliasName().equals(remoteConnection)) + return connections[i]; + return null; // TODO Connection is not found in the list--need to react + // somehow, throw the exception? + + } + + public static IService getConnectedRemoteFileService( + IHost currentConnection, IProgressMonitor monitor) throws Exception { + final ISubSystem subsystem = getFileSubsystem(currentConnection); + + if (subsystem == null) + throw new Exception(Messages.ErrorNoSubsystem); + + try { + subsystem.connect(monitor, false); + } catch (CoreException e) { + throw e; + } catch (OperationCanceledException e) { + throw new CoreException(Status.CANCEL_STATUS); + } + + if (!subsystem.isConnected()) + throw new Exception(Messages.ErrorConnectSubsystem); + + return ((IFileServiceSubSystem) subsystem).getFileService(); + } + + public static ISubSystem getFileSubsystem(IHost host) { + if (host == null) + return null; + ISubSystem[] subSystems = host.getSubSystems(); + for (int i = 0; i < subSystems.length; i++) { + if (subSystems[i] instanceof IFileServiceSubSystem) + return subSystems[i]; + } + return null; + } + + public static IService getConnectedShellService( + IHost currentConnection, IProgressMonitor monitor) throws Exception { + final ISubSystem subsystem = getShellSubsystem(currentConnection); + + if (subsystem == null) + throw new Exception(Messages.ErrorNoSubsystem); + + try { + subsystem.connect(monitor, false); + } catch (CoreException e) { + throw e; + } catch (OperationCanceledException e) { + throw new CoreException(Status.CANCEL_STATUS); + } + + if (!subsystem.isConnected()) + throw new Exception(Messages.ErrorConnectSubsystem); + + return ((IShellServiceSubSystem) subsystem).getShellService(); + } + + public static ISubSystem getShellSubsystem(IHost host) { + if (host == null) + return null; + ISubSystem[] subSystems = host.getSubSystems(); + for (int i = 0; i < subSystems.length; i++) { + if (subSystems[i] instanceof IShellServiceSubSystem) + return subSystems[i]; + } + return null; + } + + public static IHost[] getSuitableConnections() { + + //we only get RSE connections with files&cmds subsystem + ArrayList filConnections = new ArrayList (Arrays.asList(RSECorePlugin.getTheSystemRegistry() + .getHostsBySubSystemConfigurationCategory(ISubSystemConfigurationCategories.SUBSYSTEM_CATEGORY_FILES))); //$NON-NLS-1$ + + ArrayList terminalConnections = new ArrayList (Arrays.asList(RSECorePlugin.getTheSystemRegistry() + .getHostsBySubSystemConfigurationCategory("terminal")));//$NON-NLS-1$ + + ArrayList shellConnections = new ArrayList (Arrays.asList(RSECorePlugin.getTheSystemRegistry() + .getHostsBySubSystemConfigurationCategory("shells"))); //$NON-NLS-1$ + + Iterator iter = filConnections.iterator(); + while(iter.hasNext()){ + IHost fileConnection = iter.next(); + if(!terminalConnections.contains(fileConnection) && !shellConnections.contains(fileConnection)){ + iter.remove(); + } + IRSESystemType sysType = fileConnection.getSystemType(); + if (sysType == null || !sysType.isEnabled()) { + iter.remove(); + } + } + + return filConnections.toArray(new IHost[filConnections.size()]); + } + + public static void putRemoteFileInPlugin(IHost connection, String locaPathInPlugin, String remoteExePath, + IProgressMonitor monitor) throws Exception { + + assert(connection != null); + monitor.beginTask(Messages.InfoUpload, 100); + + IFileService fileService; + try { + fileService = (IFileService) getConnectedRemoteFileService( + connection, + new SubProgressMonitor(monitor, 5)); + InputStream inputStream = FileLocator.openStream( + Activator.getDefault().getBundle(), new Path(locaPathInPlugin), false); + Path remotePath = new Path(remoteExePath); + + //TODO workaround for now + //in case the underlying scp file service doesn't support inputStream upload + BufferedInputStream bis = new BufferedInputStream(inputStream); + File tempFile = File.createTempFile("scp", "temp"); //$NON-NLS-1$ //$NON-NLS-2$ + FileOutputStream os = new FileOutputStream(tempFile); + BufferedOutputStream bos = new BufferedOutputStream(os); + byte[] buffer = new byte[1024]; + int readCount; + while( (readCount = bis.read(buffer)) > 0) + { + bos.write(buffer, 0, readCount); + } + bos.close(); + fileService.upload(tempFile, remotePath.removeLastSegments(1) + .toString(), remotePath.lastSegment(), true, null, null, + new SubProgressMonitor(monitor, 80)); + // Need to change the permissions to match the original file + // permissions because of a bug in upload + remoteShellExec( + connection, + "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + } finally { + monitor.done(); + } + return; + } + + public static void getRemoteFile(IHost connection, String localExePath, String remoteExePath, + IProgressMonitor monitor) throws Exception { + + assert(connection!=null); + monitor.beginTask(Messages.InfoDownload, 100); + + IFileService fileService; + try { + fileService = (IFileService) getConnectedRemoteFileService( + connection, + new SubProgressMonitor(monitor, 10)); + File file = new File(localExePath); + file.deleteOnExit(); + monitor.worked(5); + Path remotePath = new Path(remoteExePath); + fileService.download(remotePath.removeLastSegments(1).toString(), + remotePath.lastSegment(),file,true, null, + new SubProgressMonitor(monitor, 85)); + // Need to change the permissions to match the original file + // permissions because of a bug in upload + //RemoteApplication p = remoteShellExec( + // config, + // "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + //Thread.sleep(500); + //p.destroy(); + + } finally { + monitor.done(); + } + return; + } + + public static ITerminalServiceSubSystem getTerminalSubSystem( + IHost connection) { + ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry(); + ISubSystem[] subsystems = systemRegistry.getSubSystems(connection); + for (int i = 0; i < subsystems.length; i++) { + if (subsystems[i] instanceof ITerminalServiceSubSystem) { + ITerminalServiceSubSystem subSystem = (ITerminalServiceSubSystem) subsystems[i]; + return subSystem; + } + } + return null; + } + + public static String spaceEscapify(String inputString) { + if (inputString == null) + return null; + + return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$ + } + + public static Process remoteShellExec(IHost connection, + String prelaunchCmd, String remoteCommandPath, String arguments, + IProgressMonitor monitor) throws CoreException { + + monitor.beginTask(NLS.bind(Messages.RemoteShellExec_1, + remoteCommandPath, arguments), 10); + String realRemoteCommand = arguments == null ? spaceEscapify(remoteCommandPath) + : spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$ + + String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD; + + if(prelaunchCmd != null) { + if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$ + remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand; + } + + IShellService shellService; + Process p = null; + try { + shellService = (IShellService) getConnectedShellService( + connection, + new SubProgressMonitor(monitor, 7)); + + // This is necessary because runCommand does not actually run the + // command right now. + String env[] = new String[0]; + try { + IHostShell hostShell = shellService.launchShell( + "", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$ + hostShell.writeToShell(remoteCommand); + p = new HostShellProcessAdapter(hostShell); + } catch (Exception e) { + if (p != null) { + p.destroy(); + } + abort(Messages.RemoteShellExec_2, e, + IRSECoreStatusCodes.EXCEPTION_OCCURRED); + } + } catch (Exception e1) { + abort(e1.getMessage(), e1, + IRSECoreStatusCodes.EXCEPTION_OCCURRED); + } + + monitor.done(); + return p; + } + + /** + * Throws a core exception with an error status object built from the given + * message, lower level exception, and error code. + * + * @param message + * the status message + * @param exception + * lower level exception associated with the error, or + * null if none + * @param code + * error code + */ + public static void abort(String message, Throwable exception, int code) throws CoreException { + IStatus status; + if (exception != null) { + MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, code, message, exception); + multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, exception.getLocalizedMessage(), exception)); + status = multiStatus; + } else { + status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, message, null); + } + throw new CoreException(status); + } + /** + * Checks whether a IHost associated system's is enabled and not a local one + * @param host + * @return + */ + public static boolean isHostViable(IHost host) { + IRSESystemType sysType = host.getSystemType(); + if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) + return true; + return false; + } + + /** + * Ensures that RSECorePlugin is initialized before performing any actions + */ + public static void waitForRSEInitCompletition() { + if (!RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL)) + try { + RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL); + } catch (InterruptedException e) { + return; + } + } +} diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java new file mode 100644 index 0000000..a7fe221 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2013 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.remote.utils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.rse.core.model.IHost; + +public class RemoteShellExec { + + public static final int + STATE_NULL = 0, + STATE_RUNNING = 1, + STATE_EXITED = 2; + + private final String command; + private final IHost host; + + private InputStream fInStream; + private OutputStream fOutStream; + private InputStream fErrStream; + private Process remoteShellProcess; + + private int exitCode = 0; + private int status = STATE_NULL; + + private final String RETURN_VALUE_TAG = "org.yocto.sdk.remotetools.RVTAG"; + private final String RETURN_VALUE_CMD = ";echo \"" + RETURN_VALUE_TAG + "$?\""; + + public RemoteShellExec(IHost host, String command) { + assert(host != null); + this.host = host; + this.command = command; + } + + public int getStatus() { + return status; + } + + public int getExitCode() { + return exitCode; + } + + private void reset() { + fInStream = null; + fOutStream = null; + fErrStream = null; + + remoteShellProcess = null; + exitCode = 0; + status = STATE_NULL; + } + + public InputStream getInputStream() { + return fInStream; + } + + public OutputStream getOutputStream() { + return fOutStream; + } + + public InputStream getErrStream() { + return fErrStream; + } + + public synchronized void start(String prelaunchCmd, String argument, IProgressMonitor monitor) throws Exception { + if(status == STATE_RUNNING) + return; + + reset(); + argument = (argument == null ? RETURN_VALUE_CMD : argument + RETURN_VALUE_CMD); + remoteShellProcess = RSEHelper.remoteShellExec(this.host, prelaunchCmd, this.command, argument, monitor); + fInStream = remoteShellProcess.getInputStream(); + fOutStream = remoteShellProcess.getOutputStream(); + fErrStream = remoteShellProcess.getErrorStream(); + status = STATE_RUNNING; + } + + public synchronized void terminate() throws Exception { + if(status != STATE_RUNNING || remoteShellProcess != null) + return; + + remoteShellProcess.destroy(); + reset(); + } + + public int waitFor(IProgressMonitor monitor) throws InterruptedException { + while(status == STATE_RUNNING) { + if(monitor != null) { + if(monitor.isCanceled()) { + throw new InterruptedException("User Cancelled"); + } + } + + try { + remoteShellProcess.waitFor(); + }catch(InterruptedException e){ + //get the return value + try { + if(fInStream.available() != 0) { + BufferedReader in = new BufferedReader(new InputStreamReader(fInStream)); + String thisline; + int idx; + while((thisline = in.readLine()) != null) { + if(thisline.indexOf(RETURN_VALUE_CMD) == -1) { + idx = thisline.indexOf(RETURN_VALUE_TAG); + if(idx != -1) { + try { + exitCode=(new Integer(thisline.substring(idx+RETURN_VALUE_TAG.length()))).intValue(); + }catch(NumberFormatException e2) { + } + break; + } + } + } + } + }catch(IOException e1) { + //do nothing + } + }finally { + status=STATE_EXITED; + } + } + return exitCode; + } +} + diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java new file mode 100644 index 0000000..0922824 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java @@ -0,0 +1,332 @@ +/***************************************************************************** + * Copyright (c) 2013 Ken Gilmer + * 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: + * Ken Gilmer - initial API and implementation + * Jessica Zhang - Adopt for Yocto Tools plugin + *******************************************************************************/ +package org.yocto.remote.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.lang.reflect.InvocationTargetException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.swt.widgets.Display; + +public class ShellSession { + /** + * Bash shell + */ + public static final int SHELL_TYPE_BASH = 1; + /** + * sh shell + */ + public static final int SHELL_TYPE_SH = 2; + private volatile boolean interrupt = false; + /** + * String used to isolate command execution + */ + public static final String TERMINATOR = "build$"; + public static final String LT = System.getProperty("line.separator"); + private Process process; + + private OutputStream pos = null; + + private String shellPath = null; + private final String initCmd; + private final File root; + private final File builddir; + + private OutputStreamWriter out; + + public static String getFilePath(String file) throws IOException { + File f = new File(file); + + if (!f.exists() || f.isDirectory()) { + throw new IOException("Path passed is not a file: " + file); + } + + StringBuffer sb = new StringBuffer(); + + String elems[] = file.split(File.separator); + + for (int i = 0; i < elems.length - 1; ++i) { + sb.append(elems[i]); + sb.append(File.separator); + } + + return sb.toString(); + } + + public ShellSession(int shellType, File root, File builddir, String initCmd, OutputStream out) throws IOException { + this.root = root; + this.builddir = builddir; + this.initCmd = initCmd; + if (out == null) { + this.out = new OutputStreamWriter(null); + } else { + this.out = new OutputStreamWriter(out); + } + if (shellType == SHELL_TYPE_SH) { + shellPath = "/bin/sh"; + } + shellPath = "/bin/bash"; + + initializeShell(); + } + + private void initializeShell() throws IOException { + process = Runtime.getRuntime().exec(shellPath); + pos = process.getOutputStream(); + + if (root != null) { + execute("cd " + root.getAbsolutePath()); + } + + if (initCmd != null) { + execute("source " + initCmd + " " + builddir.getAbsolutePath()); + } + } + + synchronized + public String execute(String command, int[] retCode) throws IOException { + String errorMessage = null; + + interrupt = false; + out.write(command); + out.write(LT); + + sendToProcessAndTerminate(command); + + if (process.getErrorStream().available() > 0) { + byte[] msg = new byte[process.getErrorStream().available()]; + + process.getErrorStream().read(msg, 0, msg.length); + String msg_str = new String(msg); + out.write(msg_str); + out.write(LT); + if (!msg_str.contains("WARNING")) + errorMessage = "Error while executing: " + command + LT + new String(msg); + } + + BufferedReader br = new BufferedReader(new InputStreamReader(process + .getInputStream())); + + StringBuffer sb = new StringBuffer(); + String line = null; + + while (true) { + line = br.readLine(); + if (line != null) { + sb.append(line); + sb.append(LT); + out.write(line); + out.write(LT); + } + if (line.endsWith(TERMINATOR)) + break; + } + if (interrupt) { + process.destroy(); + initializeShell(); + interrupt = false; + }else if (line != null && retCode != null) { + try { + retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR))); + }catch (NumberFormatException e) { + throw new IOException("Can NOT get return code" + command + LT + line); + } + } + out.flush(); + if (errorMessage != null) { + throw new IOException(errorMessage); + } + return sb.toString(); + } + + synchronized + public void execute(String command) throws IOException { + interrupt = false; + String errorMessage = null; + + sendToProcessAndTerminate(command); + boolean cancel = false; + try { + InputStream is = process.getInputStream(); + InputStream es = process.getErrorStream(); + String info; + while (!cancel) { + info = null; + StringBuffer buffer = new StringBuffer(); + int c; + while (is.available() > 0) { + c = is.read(); + char ch = (char) c; + buffer.append(ch); + if (ch == '\n') { + info = buffer.toString(); + if (!info.trim().endsWith(TERMINATOR)) { + out.write(info); + out.write(LT); + buffer.delete(0, buffer.length()); + } else { + cancel = true; + break; + } + } + } + while (es.available() > 0) { + c = es.read(); + char ch = (char) c; + buffer.append(ch); + if (ch == '\n') { + info = buffer.toString(); + if (!info.contains("WARNING")) + errorMessage += info; + out.write(info); + out.write(LT); + buffer.delete(0, buffer.length()); + } + } + } + } catch (IOException e) { + try { + throw new InvocationTargetException(e); + } catch (InvocationTargetException e1) { + e1.printStackTrace(); + } + } + out.flush(); + if (errorMessage != null) { + throw new IOException(errorMessage); + } + if (interrupt) { + process.destroy(); + initializeShell(); + interrupt = false; + } + } + synchronized + public boolean ensureKnownHostKey(String user, String host) throws IOException { + + boolean loadKeysMatch = false; + boolean accepted = false; + Process proc = Runtime.getRuntime().exec("ssh -o LogLevel=DEBUG3 " + user + "@" + host); + Pattern patternLoad = Pattern.compile("^debug3: load_hostkeys: loaded (\\d+) keys"); + Pattern patternAuthSucceeded = Pattern.compile("^debug1: Authentication succeeded.*"); + + try { + InputStream es = proc.getErrorStream(); + String info; + while (!loadKeysMatch) { + info = null; + StringBuffer buffer = new StringBuffer(); + int c; + while (es.available() > 0) { + c = es.read(); + char ch = (char) c; + buffer.append(ch); + if (ch == '\r') { + info = buffer.toString().trim(); + Matcher m = patternLoad.matcher(info); + if(m.matches()) { + int keys = new Integer(m.group(1)); + if (keys == 0) { + proc.destroy(); + DialogRunnable runnable = new DialogRunnable("Host authenticity", "The authenticity of host '" + host + "(" + host + ")' can't be established.\nAre you sure you want to continue connecting ?", DialogRunnable.QUESTION); + Display.getDefault().syncExec(runnable); + accepted = runnable.result; + if (accepted){ + proc = Runtime.getRuntime().exec("ssh -o StrictHostKeyChecking=no " + user + "@" + host);//add host key to known_hosts + try { + Thread.sleep(2000); //wait for process to finish + } catch (InterruptedException e) { + e.printStackTrace(); + } + proc.destroy(); + } else { + Display.getDefault().syncExec( new DialogRunnable("Host authenticity", "Host key verification failed.", DialogRunnable.ERROR)); + } + } else { + String errorMsg = ""; + // wait to check if key is the same and authentication succeeds + while (es.available() > 0) { + c = es.read(); + ch = (char) c; + buffer.append(ch); + if (ch == '\r') { + info = buffer.toString().trim(); + Matcher mAuthS = patternAuthSucceeded.matcher(info); + if(mAuthS.matches()) { + accepted = true; + break; + } else { + if (!info.startsWith("debug")) + errorMsg += info + "\n"; + } + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + buffer.delete(0, buffer.length()); + } + } + if (!accepted && !errorMsg.isEmpty()) { + Display.getDefault().syncExec( new DialogRunnable("Host authenticity", errorMsg, DialogRunnable.ERROR)); + } + } + loadKeysMatch = true; + break; + } + buffer.delete(0, buffer.length()); + } + } + } + es.close(); + } catch (IOException e) { + try { + throw new InvocationTargetException(e); + } catch (InvocationTargetException e1) { + e1.printStackTrace(); + } + } + return accepted; + } + + /** + * Send command string to shell process and add special terminator string so + * reader knows when output is complete. + * + * @param command + * @throws IOException + */ + private void sendToProcessAndTerminate(String command) throws IOException { + pos.write(command.getBytes()); + pos.write(LT.getBytes()); + pos.flush(); + pos.write("echo $?".getBytes()); + pos.write(TERMINATOR.getBytes()); + pos.write(LT.getBytes()); + pos.flush(); + } + + /** + * Interrupt any running processes. + */ + public void interrupt() { + interrupt = true; + } +} diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java new file mode 100644 index 0000000..d4798c2 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2013 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.remote.utils; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper; +import org.eclipse.rse.internal.terminals.ui.views.RSETerminalConnector; +import org.eclipse.rse.internal.terminals.ui.views.TerminalViewTab; +import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer; +import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI; +import org.eclipse.rse.services.terminals.ITerminalShell; +import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; +import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; +import org.eclipse.rse.ui.SystemBasePlugin; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; + +abstract public class TerminalHandler extends AbstractHandler { + + + protected Shell shell; + + protected String changeTerm = "export TERM=vt100;"; + + abstract protected String getInitCmd(); + abstract protected String getConnnectionName(); + abstract protected String getDialogTitle(); + + protected String changeTerm() { + return changeTerm; + } + + protected ITerminalShell getTerminalShellFromTab(CTabItem item) { + ITerminalShell terminalShell = null; + ITerminalViewControl terminalViewControl = (ITerminalViewControl) item + .getData(TerminalViewTab.DATA_KEY_CONTROL); + ITerminalConnector terminalConnector = terminalViewControl + .getTerminalConnector(); + if (terminalConnector instanceof RSETerminalConnector) { + RSETerminalConnector rseTerminalConnector = (RSETerminalConnector) terminalConnector; + terminalShell = rseTerminalConnector.getTerminalHostShell(); + } + return terminalShell; + } + + protected boolean preProcess(final ITerminalServiceSubSystem terminalSubSystem) { + if (!terminalSubSystem.isConnected()) { + try { + ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); + dialog.run(true, true, new IRunnableWithProgress(){ + @Override + public void run(IProgressMonitor monitor) { + monitor.beginTask("Connecting to remote target ...", 100); + try { + terminalSubSystem.connect(new NullProgressMonitor(), false); + monitor.done(); + } catch (Exception e) { + CommonHelper.showErrorDialog("Connection failure", null, e.getMessage()); + monitor.done(); + + } + } + }); + } catch (OperationCanceledException e) { + // user canceled, return silently + return false; + } catch (Exception e) { + SystemBasePlugin.logError(e.getLocalizedMessage(), e); + return false; + } + } else + return true; + return false; + } + + public void execute(IHost host) throws ExecutionException { + + final ITerminalServiceSubSystem terminalSubSystem = RSEHelper.getTerminalSubSystem(host); + + if (terminalSubSystem != null) { + TerminalsUI terminalsUI = TerminalsUI.getInstance(); + TerminalViewer viewer = terminalsUI.activateTerminalsView(); + if (preProcess(terminalSubSystem)) { + CTabItem tab = viewer.getTabFolder().createTabItem( + terminalSubSystem.getHost(), changeTerm() + getInitCmd()); + //since RSETerminalConnector not exit the shell during the diconnection, + //we have manually exit it here + try { + tab.addDisposeListener(new DisposeListener() { + @Override + public void widgetDisposed(DisposeEvent e) { + Object source = e.getSource(); + if (source instanceof CTabItem) { + CTabItem currentItem = (CTabItem) source; + ITerminalShell shell=getTerminalShellFromTab(currentItem); + if(shell!=null) { + shell.exit(); + } + } + } + }); + }catch(Exception e) { + e.printStackTrace(); + } + TerminalElement element = TerminalServiceHelper + .createTerminalElement(tab, terminalSubSystem); + terminalSubSystem.addChild(element); + + } + } + } + +} diff --git a/plugins/org.yocto.sdk.ide.doc.user/.classpath b/plugins/org.yocto.sdk.ide.doc.user/.classpath new file mode 100644 index 0000000..bc74aab --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/plugins/org.yocto.sdk.ide.doc.user/.project b/plugins/org.yocto.sdk.ide.doc.user/.project new file mode 100644 index 0000000..ccc3e39 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/.project @@ -0,0 +1,28 @@ + + + org.yocto.sdk.ide.doc.user + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f90fa9c --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Mar 04 13:59:33 CET 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF b/plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF new file mode 100644 index 0000000..efb0865 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.yocto.sdk.ide.doc.user;singleton:=true +Bundle-Version: 1.4.0.qualifier +Bundle-Vendor: %Bundle-Vendor +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: org.eclipse.ui.cheatsheets diff --git a/plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..2cf9956 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,7 @@ +#Properties file for org.yocto.sdk.ide.doc.user +Bundle-Vendor = yoctoproject.org +Bundle-Name = Yocto User Help + +category.name = Yocto Project + +cheatsheet.name = Creating a Hello World ANSI C or C++ Autotools Project diff --git a/plugins/org.yocto.sdk.ide.doc.user/build.properties b/plugins/org.yocto.sdk.ide.doc.user/build.properties new file mode 100644 index 0000000..caf850b --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/build.properties @@ -0,0 +1,6 @@ +bin.includes = plugin.xml,\ + .,\ + META-INF/,\ + OSGI-INF/,\ + cheatsheets/ +src.includes = cheatsheets/ diff --git a/plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml b/plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml new file mode 100644 index 0000000..310dce6 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml @@ -0,0 +1,222 @@ + + + + + + This cheat sheet will guide you through the process of creating and + building a "Hello World ANSI C Autotools Project" or + a "Hello World C++ Autotools Project" + application that uses a Yocto Project template. + + + + + Select Window > Open Perspective > + Other... from the menu bar.
+ Choose C/C++ from the Open Perspective dialog. + Click OK. +
+ + +
+ + + You need to specify a toolchain and sysroot location before + building any project in the workspace. + + + + The global settings can be modified in the Yocto Project ADT + section of the eclipse preferences. Select Window > + Preferences from the menu bar and then select the section + Yocto Project ADT. These settings are the default ones for + every project you create in the workspace. + + + + + + + Choose in the Cross Compiler Options the + Standalone pre-built toolchain. + + + + + Provide a Toolchain Root Location (e.g. + /opt/poky/1.3 or some other location on the filesystem). + + + + + Provide a Sysroot Location. This is the filesystem + containing libraries, headers etc. used while cross-building + binaries for the target. + + + + + If more than one toolchain is found in the Toolchain + Root Location, use the drop-down box to select the Target + Architecture. Make sure that the selected sysroot matches + the toolchain. + + + + + Choose in the Target Options whether the target is a QEMU + emulation (kernel location required) or an external hardware. + The target is used for running or remote debugging the binaries + created for it. + + + + + Save the settings with Apply and OK. You can later + change these settings for any project from the menu + Project > Change Yocto Project Settings. + + + + + + Choose between the available "Hello World ANSI C Autotools + Project" or the "Hello World C++ Autotools Project" + template projects. + + + You selected ${progLanguage}. + + + + Create a Yocto Project ADT Project "Hello World ANSI C Autotools + Project" or "Hello World C++ Autotools Project" + by using the appropriate Project wizard. + + + + + Click File > New > C++ Project to + launch the C++ Project wizard. + + + + + + + Click File > New > C Project to + launch the C Project wizard. + + + + + + + + + Enter HelloWorld as the project name, then select + Yocto Project ADT Project > + Hello World C++ Autotools Project from the Project type + list and click Next. + + + + + Enter HelloWorld as the project name, then select + Yocto Project ADT Project > + Hello World ANSI C Autotools Project from the Project type + list and click Next. + + + + + + Fill in the name of the Author. Make some changes in the + other fields if needed. Possibly change the License from + the drop-down box and click Next. + + + + + If needed make some Advanced settings. Confirm them with + Apply and OK. + + + + + Click Finish to create the project in your workspace. You + will find the created project in the Project Explorer view. + + + + + + Create the project's binary using a specified toolchain and + sysroot. + + + + Make sure that the project is on focus in the + Project Explorer view. + + + + + If you want to change the default settings for toolchain and + sysroot location go to Project > + Change Yocto Project Settings in the menu bar. Finish the + editing by pressing OK. + + + + + If you have changed the settings in the previous step, call + Project > Reconfigure Project to reconfigure the + project with these new settings (e.g. create the correct Makefiles + that make use of the selected toolchain and sysroot). + + + + + Build the project with a click on the hammer symbol in the + Toolbar. Alternatively, go to Project > + Build Project. If you didn't change the default + toolchain and sysroot, now the configuring step will be executed + at first, followed by the build step itself. + + + + + Observe the output in the different consoles (e.g. + Configure [HelloWorld] and + CDT Build Console [HelloWorld]) to check if everything + was successful. + + + + Congratulations, you have completed this cheat sheet! You may + continue with editing, rebuilding or debugging the + Hello World Autotools Project. + + +
diff --git a/plugins/org.yocto.sdk.ide.doc.user/plugin.xml b/plugins/org.yocto.sdk.ide.doc.user/plugin.xml new file mode 100644 index 0000000..24c539d --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/plugin.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/plugins/org.yocto.sdk.ide/.classpath b/plugins/org.yocto.sdk.ide/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/org.yocto.sdk.ide/.project b/plugins/org.yocto.sdk.ide/.project new file mode 100644 index 0000000..643f947 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/.project @@ -0,0 +1,32 @@ + + + org.yocto.sdk.ide + + + org.eclipse.tm.tcf + org.eclipse.tm.tcf.core + org.eclipse.tm.tcf.rse + org.eclipse.tm.tcf.terminals + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..6745823 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon May 03 15:24:21 PDT 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF b/plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d8ae504 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF @@ -0,0 +1,37 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.yocto.sdk.ide;singleton:=true +Bundle-Version: 1.4.0.qualifier +Bundle-Activator: org.yocto.sdk.ide.YoctoSDKPlugin +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.ui, + org.eclipse.cdt.ui;bundle-version="5.1.2", + org.eclipse.core.runtime, + org.eclipse.cdt.core;bundle-version="5.1.2", + org.eclipse.core.resources;bundle-version="3.5.1", + org.eclipse.debug.core;bundle-version="3.5.1", + org.eclipse.cdt.managedbuilder.core, + org.eclipse.cdt.autotools.core;bundle-version="1.1.0", + org.eclipse.cdt.autotools.ui;bundle-version="1.0.1", + org.eclipse.cdt.managedbuilder.ui;bundle-version="8.0.0", + org.eclipse.core.expressions;bundle-version="3.4.100", + org.eclipse.rse.files.ui;bundle-version="3.1.1", + org.eclipse.rse.services;bundle-version="3.2.200", + org.eclipse.rse.core;bundle-version="3.1.1", + org.eclipse.rse.ui;bundle-version="3.1.1", + org.eclipse.rse.subsystems.files.core;bundle-version="3.1.1", + org.eclipse.rse.subsystems.shells.core;bundle-version="3.1.0", + org.eclipse.cdt.launch.remote;bundle-version="2.4.0", + org.eclipse.cdt.debug.mi.core;bundle-version="7.1.0", + org.eclipse.cdt.debug.core;bundle-version="7.1.0", + org.eclipse.debug.ui;bundle-version="3.5.1", + org.eclipse.ui.ide;bundle-version="3.8.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Export-Package: org.yocto.sdk.ide, + org.yocto.sdk.ide.natures, + org.yocto.sdk.ide.utils, + org.yocto.sdk.ide.actions, + org.yocto.sdk.ide.preferences, + org.yocto.sdk.ide.wizard diff --git a/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..2031154 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,16 @@ +#Properties file for org.Yocto.sdk.ide +page.name.0 = Yocto Project ADT +extension.name.0 = YoctoSDKNature +extension.name.1 = YoctoSDKAutotoolsNature +extension.name.2 = YoctoSDKCMakeNature +command.name = ReconfigureYoctoProject +command.label.0 = Change Yocto Project Settings +command.mnemonic = C +command.targetProfileSwitch.name = Change Target Profile +command.targetProfileSwitch.label = Target Profiles +command.targetProfileSwitch.description = Changes the target profile of a selected project +command.targetProfileSwitch.parameter.name = Selected Target Profile +projectType.name.0 = Yocto Project ADT Autotools Project +projectProperties.label.0 = Yocto Project Settings +Bundle-Vendor = yoctoproject.org +Bundle-Name = Yocto Plugin IDE diff --git a/plugins/org.yocto.sdk.ide/build.properties b/plugins/org.yocto.sdk.ide/build.properties new file mode 100644 index 0000000..e763a45 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + templates/,\ + OSGI-INF/ +src.includes = templates/,\ + OSGI-INF/ diff --git a/plugins/org.yocto.sdk.ide/plugin.xml b/plugins/org.yocto.sdk.ide/plugin.xml new file mode 100644 index 0000000..c082c3a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/plugin.xml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java new file mode 100644 index 0000000..c29d278 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial implementation + *******************************************************************************/ + +package org.yocto.sdk.ide; + +import java.util.ArrayList; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.ui.menus.CommandContributionItem; +import org.eclipse.ui.menus.CommandContributionItemParameter; +import org.eclipse.ui.services.IServiceLocator; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; +import org.yocto.sdk.ide.actions.ProfileSwitchHandler; +import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; + +public class ProjectSpecificContributionItem extends TargetProfileContributionItem { + private static final String PROJECT_SPECIFIC_PROFILE = + "Preferences.Profile.ProjectSpecific.Profile.Label"; //$NON-NLS-N$ + private static final String DISABLED_COMMAND_ID = "org.yocto.sdk.ide.command.disabled"; //$NON-NLS-N$ + + private IServiceLocator serviceLocator; + + public ProjectSpecificContributionItem() {} + + public ProjectSpecificContributionItem(String id) { + super(id); + } + + @Override + protected IContributionItem[] getContributionItems() { + ArrayList items = new ArrayList(); + + IProject project = getSelectedProject(serviceLocator); + YoctoUIElement yoctoUIElement = ProjectPreferenceUtils.getElem(project); + SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(yoctoUIElement); + + if ((result != SDKCheckResults.SDK_PASS)) { + CommandContributionItemParameter parameter = new CommandContributionItemParameter(serviceLocator, + null, + DISABLED_COMMAND_ID, + CommandContributionItem.STYLE_PUSH); + + parameter.label = YoctoSDKMessages.getString(PROJECT_SPECIFIC_PROFILE); + + items.add(new CommandContributionItem(parameter)); + } else { + items.add(super.createProfileItem(serviceLocator, ProfileSwitchHandler.PROJECT_SPECIFIC_PARAMETER, + YoctoSDKMessages.getString(PROJECT_SPECIFIC_PROFILE))); + } + + updateSelection(serviceLocator); + + return items.toArray(new IContributionItem[items.size()]); + } + + @Override + public void initialize(IServiceLocator serviceLocator) { + this.serviceLocator = serviceLocator; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java new file mode 100644 index 0000000..95d8229 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.TreeSet; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ITreeSelection; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.actions.CompoundContributionItem; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.handlers.RadioState; +import org.eclipse.ui.menus.CommandContributionItem; +import org.eclipse.ui.menus.CommandContributionItemParameter; +import org.eclipse.ui.menus.IWorkbenchContribution; +import org.eclipse.ui.services.IServiceLocator; +import org.yocto.sdk.ide.actions.ProfileSwitchHandler; +import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; + +public class TargetProfileContributionItem extends CompoundContributionItem implements IWorkbenchContribution { + private IServiceLocator serviceLocator; + + public TargetProfileContributionItem() {} + + public TargetProfileContributionItem(String id) { + super(id); + } + + protected CommandContributionItem createProfileItem(IServiceLocator serviceLocator, + String parameter, String label) { + CommandContributionItemParameter itemParameter; + itemParameter = new CommandContributionItemParameter(serviceLocator, + null, + ProfileSwitchHandler.PROFILE_SWITCH_COMMAND, + CommandContributionItem.STYLE_RADIO); + + HashMap params = new HashMap(); + params.put(RadioState.PARAMETER_ID, parameter); + + itemParameter.label = label; + itemParameter.parameters = params; + + return new CommandContributionItem(itemParameter); + } + + @Override + protected IContributionItem[] getContributionItems() { + TreeSet profiles = YoctoSDKUtils.getProfilesFromDefaultStore().getProfiles(); + ArrayList items = new ArrayList(); + + for (String profile : profiles) { + items.add(createProfileItem(serviceLocator, profile, profile)); + } + + updateSelection(serviceLocator); + + return items.toArray(new IContributionItem[profiles.size()]); + } + + public IProject getSelectedProject(IServiceLocator serviceLocator) { + ISelectionService selectionService = (ISelectionService) serviceLocator.getService(ISelectionService.class); + ISelection selection = selectionService.getSelection(); + + if (selection instanceof ITreeSelection) { + Object selectedItem = ((ITreeSelection) selection).getFirstElement(); + if (selectedItem instanceof IResource) { + return ((IResource) selectedItem).getProject(); + } else if (selectedItem instanceof ICElement) { + ICProject cProject = ((ICElement) selectedItem).getCProject(); + if (cProject != null) { + return cProject.getProject(); + } + } else if (selectedItem instanceof IAdaptable) { + Object projectObject = ((IAdaptable) selectedItem).getAdapter(IProject.class); + if (projectObject != null && projectObject instanceof IProject) { + return ((IProject) projectObject); + } + } + } + + return null; + } + + @Override + public void initialize(IServiceLocator serviceLocator) { + this.serviceLocator = serviceLocator; + } + + protected void updateSelection(IServiceLocator serviceLocator) { + ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class); + Command command = commandService.getCommand(ProfileSwitchHandler.PROFILE_SWITCH_COMMAND); + IProject project = getSelectedProject(serviceLocator); + + try { + if (ProjectPreferenceUtils.getUseProjectSpecificOption(project)) { + HandlerUtil.updateRadioState(command, ProfileSwitchHandler.PROJECT_SPECIFIC_PARAMETER); + return; + } + + String selectedProfile = ProjectPreferenceUtils.getProfiles(project).getSelectedProfile(); + HandlerUtil.updateRadioState(command, selectedProfile); + } catch (ExecutionException e) { + // ignore + } + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java new file mode 100644 index 0000000..971425c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +/* All specific exceptions raised from yocto project should use + * this specific exception class. + * Currently we only use it for message printing + */ + +public class YoctoGeneralException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 6600798490815526253L; + /** + * + */ + + public YoctoGeneralException(String message) + { + super(message); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java new file mode 100644 index 0000000..02626ad --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2012 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import java.util.Comparator; +import java.util.StringTokenizer; +import java.util.TreeSet; + +import org.yocto.sdk.ide.preferences.PreferenceConstants; + +public class YoctoProfileElement { + private TreeSet profiles = new TreeSet(new Comparator() { + + @Override + public int compare(String o1, String o2) { + int strcompare = o1.compareTo(o2); + + if (strcompare == 0) { + return strcompare; + } + + // Standard profile always less than anything else + if (o1.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + return -1; + } + + if (o2.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + return 1; + } + + return strcompare; + } + }); + + private String selectedProfile; + + public YoctoProfileElement(String profilesString, String selectedProfile) { + setProfilesFromString(profilesString); + this.selectedProfile = selectedProfile; + } + + public void addProfile(String profile) { + this.profiles.add(profile); + } + + public boolean contains(String newText) { + return profiles.contains(newText); + } + + public TreeSet getProfiles() { + return profiles; + } + + public String getProfilesAsString() { + String profileString = ""; + + for (String profile : profiles) { + profileString += "\"" + profile + "\","; + } + return profileString.substring(0, profileString.length() - 1); + } + + public String getSelectedProfile() { + return selectedProfile; + } + + public void remove(String profile) { + this.profiles.remove(profile); + } + + public void rename(String oldProfileName, String newProfileName) { + this.remove(oldProfileName); + this.addProfile(newProfileName); + + if (selectedProfile.equals(oldProfileName)) { + selectedProfile = newProfileName; + } + } + + public void setProfiles(TreeSet profiles) { + this.profiles = profiles; + } + + public void setProfilesFromString(String profilesString) { + StringTokenizer tokenizer = new StringTokenizer(profilesString, ","); + + while (tokenizer.hasMoreElements()) { + String config = (String) tokenizer.nextElement(); + profiles.add(config.replace("\"", "")); + } + } + + public void setSelectedProfile(String selectedProfile) { + this.selectedProfile = selectedProfile; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java new file mode 100644 index 0000000..f56fea4 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java @@ -0,0 +1,245 @@ +/******************************************************************************* + * Copyright (c) 2012 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Listener; +import org.yocto.sdk.ide.preferences.PreferenceConstants; +import org.yocto.sdk.ide.preferences.ProfileNameInputValidator; +import org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage; +import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage; + +public class YoctoProfileSetting { + private static final String PROFILES_TITLE = "Preferences.Profiles.Title"; + private static final String NEW_PROFILE_TITLE = "Preferences.Profile.New.Title"; + private static final String RENAME_PROFILE_TITLE = "Preferences.Profile.Rename.Title"; + private static final String RENAME_DIALOG_TITLE = "Preferences.Profile.Rename.Dialog.Title"; + private static final String RENAME_DIALOG_MESSAGE = "Preferences.Profile.Rename.Dialog.Message"; + private static final String REMOVE_PROFILE_TITLE = "Preferences.Profile.Remove.Title"; + private static final String REMOVE_DIALOG_TITLE = "Preferences.Profile.Remove.Dialog.Title"; + private static final String REMOVE_DIALOG_MESSAGE = "Preferences.Profile.Remove.Dialog.Message"; + private static final String MODIFY_STANDARD_TITLE = "Preferences.Profile.Standard.Modification.Title"; + private static final String MODIFY_STANDARD_MESSAGE = "Preferences.Profile.Standard.Modification.Message"; + + private Combo sdkConfigsCombo; + private Button btnConfigRename; + private Button btnConfigRemove; + private Button btnConfigSaveAs; + + private YoctoProfileElement profileElement; + private PreferencePage preferencePage; + private final boolean editable; + + public YoctoProfileSetting(YoctoProfileElement profileElement, PreferencePage preferencePage, final boolean editable) { + this.profileElement = profileElement; + this.preferencePage = preferencePage; + this.editable = editable; + } + + public void createComposite(Composite composite) { + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + GridLayout layout = new GridLayout(2, false); + + Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE); + layout = new GridLayout(1, false); + if (isEditable()) { + layout.numColumns = 3; + } + + storeYoctoConfigurationsGroup.setLayout(layout); + gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.horizontalSpan = 2; + storeYoctoConfigurationsGroup.setLayoutData(gd); + storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROFILES_TITLE)); + + sdkConfigsCombo = new Combo(storeYoctoConfigurationsGroup, SWT.READ_ONLY); + addConfigs(sdkConfigsCombo); + sdkConfigsCombo.select(sdkConfigsCombo.indexOf(profileElement.getSelectedProfile())); + sdkConfigsCombo.setLayout(new GridLayout(2, false)); + sdkConfigsCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); + + Listener selectionListener = new Listener() { + @Override + public void handleEvent(Event event) { + Object source = event.widget; + if (!(source instanceof Combo)) { + return; + } + + Combo sdkCombo = (Combo) source; + if (sdkCombo.getSelectionIndex() < 0) { + return; + } + + String selectedItem = sdkCombo.getItem(sdkCombo.getSelectionIndex()); + profileElement.setSelectedProfile(selectedItem); + + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).switchProfile(selectedItem); + } else if (preferencePage instanceof YoctoSDKProjectPropertyPage) { + ((YoctoSDKProjectPropertyPage) preferencePage).switchProfile(selectedItem); + } + } + }; + + sdkConfigsCombo.addListener(SWT.Selection, selectionListener); + sdkConfigsCombo.addListener(SWT.Modify, selectionListener); + + if (isEditable()) { + createSaveAsProfileButton(storeYoctoConfigurationsGroup); + createRenameButton(storeYoctoConfigurationsGroup); + createRemoveButton(storeYoctoConfigurationsGroup); + } + } + + private void createSaveAsProfileButton(Group storeYoctoConfigurationsGroup) { + btnConfigSaveAs = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); + btnConfigSaveAs.setText(YoctoSDKMessages.getString(NEW_PROFILE_TITLE)); + btnConfigSaveAs.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).performSaveAs(); + } + } + }); + } + + private void createRemoveButton(Group storeYoctoConfigurationsGroup) { + btnConfigRemove = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); + btnConfigRemove.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false, 3, 1)); + btnConfigRemove.setText(YoctoSDKMessages.getString(REMOVE_PROFILE_TITLE)); + btnConfigRemove.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + saveChangesOnCurrentProfile(); + int selectionIndex = sdkConfigsCombo.getSelectionIndex(); + String selectedItem = sdkConfigsCombo.getItem(selectionIndex); + + if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + MessageDialog.openInformation(null, + YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE), + YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE)); + return; + } + + boolean deleteConfirmed = + MessageDialog.openConfirm(null, + YoctoSDKMessages.getString(REMOVE_DIALOG_TITLE), + YoctoSDKMessages.getFormattedString(REMOVE_DIALOG_MESSAGE, selectedItem)); + + if (!deleteConfirmed) { + return; + } + + sdkConfigsCombo.select(0); + sdkConfigsCombo.remove(selectionIndex); + profileElement.remove(selectedItem); + + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).deleteProfile(selectedItem); + } + } + }); + } + + private void createRenameButton(Group storeYoctoConfigurationsGroup) { + btnConfigRename = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); + btnConfigRename.setText(YoctoSDKMessages.getString(RENAME_PROFILE_TITLE)); + btnConfigRename.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + saveChangesOnCurrentProfile(); + int selectedIndex = sdkConfigsCombo.getSelectionIndex(); + final String selectedItem = sdkConfigsCombo.getItem(selectedIndex); + + if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + MessageDialog.openInformation(null, + YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE), + YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE)); + return; + } + + InputDialog profileNameDialog = + new InputDialog(null, + YoctoSDKMessages.getString(RENAME_DIALOG_TITLE), + YoctoSDKMessages.getString(RENAME_DIALOG_MESSAGE), + null, + new ProfileNameInputValidator(profileElement, selectedItem)); + + int returnCode = profileNameDialog.open(); + if (returnCode == IDialogConstants.CANCEL_ID) { + return; + } + + String newProfileName = profileNameDialog.getValue(); + profileElement.rename(selectedItem, profileNameDialog.getValue()); + + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).renameProfile(selectedItem, newProfileName); + } + + sdkConfigsCombo.setItem(selectedIndex, newProfileName); + sdkConfigsCombo.select(selectedIndex); + } + }); + } + + private void saveChangesOnCurrentProfile() { + preferencePage.performOk(); + } + + private void addConfigs(Combo combo) { + for (String profile : profileElement.getProfiles()) { + combo.add(profile); + } + } + + public void addProfile(String profileName) { + int index = sdkConfigsCombo.getItemCount(); + sdkConfigsCombo.add(profileName, index); + sdkConfigsCombo.select(index); + } + + public void setUIFormEnabledState(boolean isEnabled) { + setButtonsEnabledState(isEnabled); + sdkConfigsCombo.setEnabled(isEnabled); + } + + public YoctoProfileElement getCurrentInput() { + return profileElement; + } + + public void setButtonsEnabledState(boolean isEnabled) { + if (isEditable()) { + btnConfigRename.setEnabled(isEnabled); + btnConfigRemove.setEnabled(isEnabled); + btnConfigSaveAs.setEnabled(isEnabled); + } + } + + private boolean isEditable() { + return editable; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java new file mode 100644 index 0000000..2a55a64 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2012 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +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.Group; +import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage; + +public class YoctoProjectSpecificSetting { + private static final String PROJECT_SPECIFIC_TITLE = "Preferences.Profile.ProjectSpecific.Title"; + private static final String PROJECT_SPECIFIC_GROUP_TITLE = "Preferences.Profile.ProjectSpecific.Group.Title"; + + private YoctoProfileSetting yoctoConfigurationsSetting; + private YoctoUISetting yoctoUISetting; + + private Button btnUseProjectSpecificSettingsCheckbox; + private PreferencePage preferencePage; + + public YoctoProjectSpecificSetting(YoctoProfileSetting yoctoConfigurationsSetting, + YoctoUISetting yoctoUISetting, PreferencePage preferencePage) { + this.yoctoConfigurationsSetting = yoctoConfigurationsSetting; + this.yoctoUISetting = yoctoUISetting; + this.preferencePage = preferencePage; + } + + public void createComposite(Composite composite) { + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + GridLayout layout = new GridLayout(2, false); + + Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE); + layout = new GridLayout(2, false); + storeYoctoConfigurationsGroup.setLayout(layout); + gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.horizontalSpan = 2; + storeYoctoConfigurationsGroup.setLayoutData(gd); + storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_GROUP_TITLE)); + + btnUseProjectSpecificSettingsCheckbox = new Button(storeYoctoConfigurationsGroup, SWT.CHECK); + btnUseProjectSpecificSettingsCheckbox.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_TITLE)); + btnUseProjectSpecificSettingsCheckbox.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btnUseProjectSpecificSettingsCheckbox.getSelection()){ + yoctoConfigurationsSetting.setUIFormEnabledState(false); + yoctoUISetting.setUIFormEnabledState(true); + + if (preferencePage instanceof YoctoSDKProjectPropertyPage) { + ((YoctoSDKProjectPropertyPage) preferencePage).switchToProjectSpecificProfile(); + } + } else { + yoctoConfigurationsSetting.setUIFormEnabledState(true); + yoctoConfigurationsSetting.setButtonsEnabledState(false); + yoctoUISetting.setUIFormEnabledState(false); + + if (preferencePage instanceof YoctoSDKProjectPropertyPage) { + ((YoctoSDKProjectPropertyPage) preferencePage).switchToSelectedProfile(); + } + } + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) {} + }); + } + + public void setUseProjectSpecificSettings(boolean isUsingProjectSpecificSettings) { + btnUseProjectSpecificSettingsCheckbox.setSelection(isUsingProjectSpecificSettings); + } + + public boolean isUsingProjectSpecificSettings() { + return btnUseProjectSpecificSettingsCheckbox.getSelection(); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java new file mode 100644 index 0000000..714470b --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java @@ -0,0 +1,291 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel Corporation. + * Copyright (c) 2013 BMW Car IT GmbH. + * + * 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: + * Intel - initial API and implementation + * BMW Car IT - include error and advice messages with check results + *******************************************************************************/ +package org.yocto.sdk.ide; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants; + +public class YoctoSDKChecker { + private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"}; + private static final String SYSROOTS_DIR = "sysroots"; + private static final String SDK_VERSION = "OECORE_SDK_VERSION"; + + public static enum SDKCheckResults { + SDK_PASS("", false), + TOOLCHAIN_LOCATION_EMPTY( + "Poky.SDK.Location.Empty", true), + TOOLCHAIN_LOCATION_NONEXIST( + "Poky.SDK.Location.Nonexist", true), + SDK_TARGET_EMPTY( + "Poky.SDK.Target.Empty", true), + SDK_NO_TARGET_SELECTED( + "Poky.SDK.No.Target.Selected", false), + SYSROOT_EMPTY( + "Poky.Sysroot.Empty", true), + SYSROOT_NONEXIST( + "Poky.Sysroot.Nonexist", true), + QEMU_KERNEL_EMPTY( + "Poky.Qemu.Kernel.Empty", true), + QEMU_KERNEL_NONEXIST( + "Poky.Qemu.Kernel.Nonexist", true), + WRONG_ADT_VERSION( + "Poky.ADT.Sysroot.Wrongversion", false), + ENV_SETUP_SCRIPT_NONEXIST( + "Poky.Env.Script.Nonexist", false), + TOOLCHAIN_NO_SYSROOT( + "Poky.Toolchain.No.Sysroot", false), + TOOLCHAIN_HOST_MISMATCH( + "Poky.Toolchain.Host.Mismatch", false); + + private static final String DEFAULT_ADVICE = "Default.Advice"; + private static final String ADVICE_SUFFIX = ".Advice"; + + private final String messageID; + private final boolean addDefaultAdvice; + + private SDKCheckResults(final String messageID, final boolean addDefaultAdvice) { + this.messageID = messageID; + this.addDefaultAdvice = addDefaultAdvice; + } + + public String getMessage() { + return YoctoSDKMessages.getString(messageID); + } + + public String getAdvice() { + String advice = YoctoSDKMessages.getString(messageID + ADVICE_SUFFIX); + + if (addDefaultAdvice) { + advice += YoctoSDKMessages.getString(DEFAULT_ADVICE); + } + + return advice; + } + }; + + public static enum SDKCheckRequestFrom { + Wizard("Poky.SDK.Error.Origin.Wizard"), + Menu("Poky.SDK.Error.Origin.Menu"), + Preferences("Poky.SDK.Error.Origin.Preferences"), + Other("Poky.SDK.Error.Origin.Other"); + + private final String errorMessageID; + + private SDKCheckRequestFrom(final String errorMessageID) { + this.errorMessageID = errorMessageID; + } + + public String getErrorMessage() { + return YoctoSDKMessages.getString(errorMessageID); + } + }; + + public static void checkIfGloballySelectedYoctoProfileIsValid() throws YoctoGeneralException { + YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); + IPreferenceStore selectedProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile()); + YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selectedProfileStore); + + SDKCheckResults result = checkYoctoSDK(elem); + if (result != SDKCheckResults.SDK_PASS){ + String strErrorMsg = getErrorMessage(result, SDKCheckRequestFrom.Wizard); + throw new YoctoGeneralException(strErrorMsg); + } + } + + public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) { + if (elem.getStrToolChainRoot().isEmpty()) + return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY; + else { + File fToolChain = new File(elem.getStrToolChainRoot()); + if (!fToolChain.exists()) + return SDKCheckResults.TOOLCHAIN_LOCATION_NONEXIST; + } + + if (elem.getStrSysrootLoc().isEmpty()) { + return SDKCheckResults.SYSROOT_EMPTY; + } else { + File fSysroot = new File(elem.getStrSysrootLoc()); + if (!fSysroot.exists()) + return SDKCheckResults.SYSROOT_NONEXIST; + } + + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { + //Check for SDK compatible with the host arch + String platform = getPlatformArch(); + String sysroot_dir_str = elem.getStrToolChainRoot() + "/" + SYSROOTS_DIR; + File sysroot_dir = new File(sysroot_dir_str); + if (!sysroot_dir.exists()) + return SDKCheckResults.TOOLCHAIN_NO_SYSROOT; + + String toolchain_host_arch = null; + + try { + toolchain_host_arch = findHostArch(sysroot_dir); + } catch(NullPointerException e) { + return SDKCheckResults.TOOLCHAIN_NO_SYSROOT; + } + + if (!toolchain_host_arch.equalsIgnoreCase(platform)) { + if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86")) + return SDKCheckResults.TOOLCHAIN_HOST_MISMATCH; + } + } + + if (elem.getStrTarget().isEmpty() && elem.getStrTargetsArray().length > 0) { + return SDKCheckResults.SDK_NO_TARGET_SELECTED; + } + + if (elem.getIntTargetIndex() < 0 || elem.getStrTarget().isEmpty()) { + //if this is poky tree mode, prompt user whether bitbake meta-ide-support is executed? + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE) + return SDKCheckResults.ENV_SETUP_SCRIPT_NONEXIST; + else + return SDKCheckResults.SDK_TARGET_EMPTY; + } else { + String sFileName; + + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { + sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); + } else { + //POKY TREE Mode + sFileName = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX + + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); + } + + try { + File file = new File(sFileName); + boolean bVersion = false; + + if (file.exists()) { + BufferedReader input = new BufferedReader(new FileReader(file)); + + try { + String line = null; + + while ((line = input.readLine()) != null) { + if (line.startsWith("export "+ SDK_VERSION)) { + int beginIndex = 2; + String sVersion = ""; + for (;;) { + char cValue = line.charAt(line.indexOf('=') + beginIndex++); + + if ((cValue != '.') && (!Character.isDigit(cValue)) && (cValue != '+')) + break; + else + sVersion += String.valueOf(cValue); + } + + for (int i = 0; i < saInvalidVer.length; i++) { + if (!sVersion.equals(saInvalidVer[i])) { + bVersion = true; + break; + } + } + + break; + } + } + } finally { + input.close(); + } + + if (!bVersion) + return SDKCheckResults.WRONG_ADT_VERSION; + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { + if (elem.getStrQemuKernelLoc().isEmpty()) { + return SDKCheckResults.QEMU_KERNEL_EMPTY; + } else { + File fQemuKernel = new File(elem.getStrQemuKernelLoc()); + if (!fQemuKernel.exists()) + return SDKCheckResults.QEMU_KERNEL_NONEXIST; + } + } + + return SDKCheckResults.SDK_PASS; + } + + public static String getErrorMessage(SDKCheckResults result, SDKCheckRequestFrom from) { + String strErrorMsg; + strErrorMsg = from.getErrorMessage(); + strErrorMsg += "\n" + result.getMessage(); + strErrorMsg += "\n" + result.getAdvice(); + + return strErrorMsg; + } + + private static String getPlatformArch() { + String value = null; + try + { + Runtime rt = Runtime.getRuntime(); + Process proc = rt.exec("uname -m"); + InputStream stdin = proc.getInputStream(); + InputStreamReader isr = new InputStreamReader(stdin); + BufferedReader br = new BufferedReader(isr); + String line = null; + + while ( (line = br.readLine()) != null) { + value = line; + } + proc.waitFor(); + + } catch (Throwable t) { + t.printStackTrace(); + } + return value; + } + + private static String findHostArch(File sysroot_dir) { + FilenameFilter nativeFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + if (name.endsWith("sdk-linux")) { + return true; + } else { + return false; + } + } + }; + + File[] files = sysroot_dir.listFiles(nativeFilter); + String arch = null; + + for (File file : files) { + if (file.isDirectory()) { + String path = file.getName(); + String[] subPath = path.split("-"); + arch = subPath[0]; + } else { + continue; + } + } + + return arch; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java new file mode 100644 index 0000000..8fe40d3 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class YoctoSDKMessages { + private static final String RESOURCE_BUNDLE= YoctoSDKMessages.class.getName(); + private static ResourceBundle fgResourceBundle; + static { + try { + fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE); + } catch (MissingResourceException x) { + fgResourceBundle = null; + } + } + + private YoctoSDKMessages() { + } + + public static String getString(String key) { + try { + return fgResourceBundle.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } catch (NullPointerException e) { + return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * Gets a string from the resource bundle and formats it with the argument + * + * @param key the string used to get the bundle value, must not be null + */ + public static String getFormattedString(String key, Object arg) { + return MessageFormat.format(getString(key), new Object[] { arg }); + } + + /** + * Gets a string from the resource bundle and formats it with arguments + */ + public static String getFormattedString(String key, Object[] args) { + return MessageFormat.format(getString(key), args); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties new file mode 100644 index 0000000..e3f3308 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + * BMW Car IT - added keys for target profiles + *******************************************************************************/ +Wizard.SDK.Warning.Title = Invalid Yocto Project ADT Location +Wizard.SDK.Error.ProjectName = Project name "{0}" is invalid! \nNone of these characters are accepted inside project names: whitespaces, {1} + +Poky.SDK.Location.Empty = Specified Toolchain Root Location is empty. +Poky.SDK.Location.Empty.Advice = You need specify Toolchain Root Location before building any project. +Poky.SDK.Location.Nonexist = Specified SDK toolchain directory does not exist. +Poky.SDK.Location.Nonexist.Advice = Please specify a valid toolchain directory. +Poky.SDK.Target.Empty = Specified location does not contain environment script file. +Poky.SDK.Target.Empty.Advice = You need specify Target Architecture before building any project. +Poky.SDK.No.Target.Selected = Target Architecture is not defined. +Poky.SDK.No.Target.Selected.Advice = Please choose a Target Architecture. +Poky.Sysroot.Empty = Specified Sysroot Location is empty. +Poky.Sysroot.Empty.Advice = You need specify Sysroot Location before building any project. +Poky.Sysroot.Nonexist = Specified Sysroot Location does not exist. +Poky.Sysroot.Nonexist.Advice = You need specify a valid Sysroot Location before building any project. +Poky.Qemu.Kernel.Empty = Specified QEMU kernel location is emtpy. +Poky.Qemu.Kernel.Empty.Advice = You need specify QEMU kernel image file Location before building any project. +Poky.Qemu.Kernel.Nonexist = Specified QEMU kernel image file does not exist. +Poky.Qemu.Kernel.Empty.Advice = You need specify a valid QEMU kernel image file before building any project. +Poky.ADT.Sysroot.Wrongversion = The ADT version you're using is too old. +Poky.ADT.Sysroot.Wrongversion.Advice = OECORE related items are not found in environment setup files.\nPlease upgrade to our latest ADT Version! +Poky.Env.Script.Nonexist = Specified toolchain directory does not contain a toolchain generated with "bitbake meta-ide-support". +Poky.Env.Script.Nonexist.Advice = Please run "bitbake meta-ide-support" to build the toolchain. +Poky.Toolchain.No.Sysroot = Specified Toolchain Root Location does not contain a sysroot directory. +Poky.Toolchain.No.Sysroot.Advice = Please install a valid toolchain sysroot. +Poky.Toolchain.Host.Mismatch = Toolchain and host arch mismatch. +Poky.Toolchain.Host.Mismatch.Advice = Make sure you use 32bit toolchain for 32bit host and same for 64bit machines! + +Default.Advice = \nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings. +Poky.SDK.Revalidation.Message = Please apply the changes to revalidate. + +Poky.SDK.Error.Origin.Wizard = Yocto Wizard Configuration Error: +Poky.SDK.Error.Origin.Menu = Yocto Menu Configuration Error: +Poky.SDK.Error.Origin.Preferences = Yocto Preferences Configuration Error: +Poky.SDK.Error.Origin.Other = Yocto Configuration Error: + +Menu.SDK.Console.Configure.Message = The Yocto Project ADT has been successfully set up for this project.\nTo see the environment variables created during setup,\ngo to Project > Properties > C/C++ Build > Environment. +Menu.SDK.Console.Deploy.Action.Message = \nDeploying {0} to {1} ...\n +Menu.SDK.Console.Deploy.Extract.Message = \nExtracting {0} into {1} ...\n +Menu.SDK.Console.Deploy.Success.Message = \nThe project {0} has been successfully deployed to {1}\n +Menu.SDK.Console.Deploy.Fail.Message = \nDeploying the project {0} to {1} failed!\n +Menu.SDK.Console.Undeploy.Success.Message = \nThe project {0} has been successfully undeployed from {1}\n +Menu.SDK.Console.Undeploy.Fail.Message = \nUndeploying the project {0} from {1} failed!\n + + +Menu.Deploy.Title = Deploy {0} to ... +Menu.Deploy.Message = Please specify a directory: + +Menu.Undeploy.Title = Undeploy {0} from ... +Menu.Undeploy.Message = Please specify a directory: + + +Preferences.Yocto.Config.Name = Preferences: +Preferences.SDK.Target.name = Target Preferences: +Preferences.SDK.Informing.Title = Yocto Project ADT has been successfully set up. +Preferences.SDK.Informing.Message = You might need to reconfigure your existing Yocto Project Autotools Projects to use the Yocto Project ADT. Do this from Project > Reconfigure Project! + +Preferences.Profile.Validator.InvalidName.Comma = Warning: The profile name cannot contain a comma (,). +Preferences.Profile.Validator.InvalidName.Quote = Warning: The profile name cannot contain a double quote (\"). +Preferences.Profile.Validator.InvalidName.Empty = Please provide a new profile name. +Preferences.Profile.Validator.InvalidName.Exists = Warning: The profile already exists. + +Preferences.Profiles.Title = Cross development profiles: +Preferences.Profile.New.Title = Save as ... +Preferences.Profile.New.Dialog.Title = Save as new cross development profile +Preferences.Profile.New.Dialog.Message = Please input a profile name. +Preferences.Profile.Rename.Title = Rename +Preferences.Profile.Rename.Dialog.Title = Rename cross development profile +Preferences.Profile.Rename.Dialog.Message = Please input a new profile name. +Preferences.Profile.Remove.Title = Remove +Preferences.Profile.Remove.Dialog.Title = Remove cross development profile +Preferences.Profile.Remove.Dialog.Message = Do you really want to the remove the cross development profile "{0}"?\nProjects using this cross development profile will be reconfigured to use the standard profile. +Preferences.Profile.Update.Dialog.Title = Update cross development profile +Preferences.Profile.Update.Dialog.Message = Do you really want to the update the cross development profile "{0}"?\nProjects using this cross development profile will be reconfigured. +Preferences.Profile.Standard.Modification.Title = Modify standard cross development profile +Preferences.Profile.Standard.Modification.Message = Standard cross development profile cannot be removed or renamed. + +Preferences.Profile.ProjectSpecific.Title = Use project specific settings +Preferences.Profile.ProjectSpecific.Group.Title = Project specific settings: +Preferences.Profile.ProjectSpecific.Profile.Label = Project specific profile + +Preferences.Profile.ProjectSpecific.Error.Title = Could not change to project specific target profile +Preferences.Profile.ProjectSpecific.Error.Message = The project specific target profile is not defined for the project "{0}".\nYou can define it in the project's property page. + +Console.SDK.Name = Yocto Project Console + +LaunchConfig.Type.Name = org.eclipse.ui.externaltools.ProgramLaunchConfigurationType +LaunchConfig.LaunchGroup.Value = org.eclipse.ui.externaltools.launchGroup +LaunchConfig.LaunchGroup.Attr = org.eclipse.debug.ui.favoriteGroups +LaunchConfig.BuildScope.Attr = org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE +LaunchConfig.BuildScope.Value = ${projects:} +LaunchConfig.Location.Attr = org.eclipse.ui.externaltools.ATTR_LOCATION +LaunchConfig.Arguments.Attr = org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS; + +AutotoolsProjectPostProcess.WrongProjectNature = {0} is not an Autotools project +AutotoolsProjectPostProcess.ChmodFailure = Failed to make autogen.sh executable for project: {0} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java new file mode 100644 index 0000000..9777396 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class YoctoSDKPlugin extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.yocto.sdk.ide"; + + // The shared instance + private static YoctoSDKPlugin plugin; + + /** + * The constructor + */ + public YoctoSDKPlugin() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static YoctoSDKPlugin getDefault() { + return plugin; + } + + public static IPreferenceStore getProfilePreferenceStore(String profileName) { + int profileIdentifier = profileName.hashCode(); + + return new ScopedPreferenceStore(InstanceScope.INSTANCE,getUniqueIdentifier() + "." + profileIdentifier); + } + + public static void log(IStatus status) { + ResourcesPlugin.getPlugin().getLog().log(status); + } + + public static void log(Throwable e) { + if (e instanceof InvocationTargetException) + e = ((InvocationTargetException) e).getTargetException(); + IStatus status = null; + if (e instanceof CoreException) + status = ((CoreException) e).getStatus(); + else + status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e); + log(status); + } + + public static void logErrorMessage(String message) { + log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null)); + } + + /** + * Returns active shell. + */ + public static Shell getActiveWorkbenchShell() { + IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + return window.getShell(); + } + return null; + } + + public static String getUniqueIdentifier() { + if (getDefault() == null) { + // If the default instance is not yet initialized, + // return a static identifier. This identifier must + // match the plugin id defined in plugin.xml + return PLUGIN_ID; + } + return getDefault().getBundle().getSymbolicName(); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java new file mode 100644 index 0000000..de3e905 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +public class YoctoUIElement { + public enum PokyMode + { + POKY_SDK_MODE, + POKY_TREE_MODE + }; + public enum DeviceMode + { + QEMU_MODE, + DEVICE_MODE + }; + + private String strTarget; + private String[] strTargetsArray; + private DeviceMode enumDeviceMode; + private String strQemuKernelLoc; + private String strQemuOption; + private String strSysrootLoc; + private PokyMode enumPokyMode; + private String strToolChainRoot; + private int intTargetIndex; + + public YoctoUIElement() + { + this.enumDeviceMode = DeviceMode.QEMU_MODE; + this.enumPokyMode = PokyMode.POKY_SDK_MODE; + this.strToolChainRoot = ""; + this.strQemuKernelLoc = ""; + this.strQemuOption = ""; + this.strSysrootLoc = ""; + this.intTargetIndex = -1; + this.strTarget = ""; + } + + public PokyMode getEnumPokyMode() { + return enumPokyMode; + } + public void setEnumPokyMode(PokyMode enumPokyMode) { + this.enumPokyMode = enumPokyMode; + } + public String getStrToolChainRoot() { + return strToolChainRoot; + } + public void setStrToolChainRoot(String strToolChainRoot) { + this.strToolChainRoot = strToolChainRoot; + } + public int getIntTargetIndex() { + if ((this.strTargetsArray != null) && (this.strTargetsArray.length == 1)) + return 0; + return intTargetIndex; + } + public void setIntTargetIndex(int intTargetIndex) { + this.intTargetIndex = intTargetIndex; + } + public String getStrTarget() { + return strTarget; + } + public void setStrTarget(String strTarget) { + this.strTarget = strTarget; + } + public String[] getStrTargetsArray() { + return strTargetsArray; + } + public void setStrTargetsArray(String[] strTargetsArray) { + this.strTargetsArray = strTargetsArray; + } + public DeviceMode getEnumDeviceMode() { + return enumDeviceMode; + } + public void setEnumDeviceMode(DeviceMode enumDeviceMode) { + this.enumDeviceMode = enumDeviceMode; + } + public String getStrQemuKernelLoc() { + return strQemuKernelLoc; + } + public void setStrQemuKernelLoc(String strQemuKernelLoc) { + this.strQemuKernelLoc = strQemuKernelLoc; + } + public String getStrQemuOption() { + return strQemuOption; + } + public void setStrQemuOption(String strQemuOption) { + this.strQemuOption = strQemuOption; + } + public String getStrSysrootLoc() { + return strSysrootLoc; + } + public void setStrSysrootLoc(String strSysrootLoc) { + this.strSysrootLoc = strSysrootLoc; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((enumDeviceMode == null) ? 0 : enumDeviceMode.hashCode()); + result = prime * result + ((enumPokyMode == null) ? 0 : enumPokyMode.hashCode()); + result = prime * result + intTargetIndex; + result = prime * result + ((strQemuKernelLoc == null) ? 0 : strQemuKernelLoc.hashCode()); + result = prime * result + ((strQemuOption == null) ? 0 : strQemuOption.hashCode()); + result = prime * result + ((strSysrootLoc == null) ? 0 : strSysrootLoc.hashCode()); + result = prime * result + ((strTarget == null) ? 0 : strTarget.hashCode()); + result = prime * result + ((strToolChainRoot == null) ? 0 : strToolChainRoot.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + YoctoUIElement other = (YoctoUIElement) obj; + if (enumDeviceMode != other.enumDeviceMode) + return false; + if (enumPokyMode != other.enumPokyMode) + return false; + if (intTargetIndex != other.intTargetIndex) + return false; + if (strQemuKernelLoc == null) { + if (other.strQemuKernelLoc != null) + return false; + } else if (!strQemuKernelLoc.equals(other.strQemuKernelLoc)) + return false; + if (strQemuOption == null) { + if (other.strQemuOption != null) + return false; + } else if (!strQemuOption.equals(other.strQemuOption)) + return false; + if (strSysrootLoc == null) { + if (other.strSysrootLoc != null) + return false; + } else if (!strSysrootLoc.equals(other.strSysrootLoc)) + return false; + if (strTarget == null) { + if (other.strTarget != null) + return false; + } else if (!strTarget.equals(other.strTarget)) + return false; + if (strToolChainRoot == null) { + if (other.strToolChainRoot != null) + return false; + } else if (!strToolChainRoot.equals(other.strToolChainRoot)) + return false; + return true; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java new file mode 100644 index 0000000..d192538 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java @@ -0,0 +1,555 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import java.io.File; +import java.util.ArrayList; + +import org.eclipse.cdt.ui.templateengine.uitree.InputUIElement; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; +import org.yocto.sdk.ide.preferences.PreferenceConstants; + +public class YoctoUISetting { + private static final String ENV_SCRIPT_FILE_PREFIX = "environment-setup-"; + + private SelectionListener fSelectionListener; + private ModifyListener fModifyListener; + private YoctoUIElement yoctoUIElement; + + private Group crossCompilerGroup; + + private Button btnSDKRoot; + private Button btnQemu; + private Button btnPokyRoot; + private Button btnDevice; + + private Button btnKernelLoc; + private Button btnSysrootLoc; + private Button btnToolChainLoc; + + private Text textKernelLoc; + private Text textQemuOption; + private Text textSysrootLoc; + private Text textRootLoc; + private Combo targetArchCombo; + + private Label root_label; + private Label sysroot_label; + private Label targetArchLabel; + private Label kernel_label; + private Label option_label; + + public YoctoUISetting(YoctoUIElement elem) + { + yoctoUIElement = elem; + elem.setStrTargetsArray(getTargetArray(elem)); + + fSelectionListener= new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) {} + + public void widgetSelected(SelectionEvent e) { + controlChanged(e.widget); + relayEvent(e); + } + + private void relayEvent(SelectionEvent e) { + Event event = new Event(); + event.data = e.data; + event.detail = e.detail; + event.display = e.display; + event.doit = e.doit; + event.height = e.height; + event.item = e.item; + event.stateMask = e.stateMask; + event.text = e.text; + event.time = e.time; + event.widget = e.widget; + event.width = e.width; + event.x = e.x; + event.y = e.y; + crossCompilerGroup.getParent().notifyListeners(SWT.Selection, event); + } + }; + + fModifyListener= new ModifyListener() { + public void modifyText(ModifyEvent e) { + controlModified(e.widget); + relayEvent(e); + } + + private void relayEvent(ModifyEvent e) { + Event event = new Event(); + event.data = e.data; + event.display = e.display; + event.time = e.time; + event.widget = e.widget; + crossCompilerGroup.getParent().notifyListeners(SWT.Modify, event); + } + }; + } + + private Control addControls(Control fControl, final String sKey, String sValue) + { + fControl.setData(new String[]{sKey,sValue}); + return fControl; + } + + private Control addRadioButton(Composite parent, String label, String key, boolean bSelected) { + GridData gd= new GridData(SWT.FILL, SWT.CENTER, true, false); + String sValue; + Button button= new Button(parent, SWT.RADIO); + + gd.horizontalSpan= 2; + button.setText(label); + button.setLayoutData(gd); + button.setSelection(bSelected); + + if (bSelected) + sValue = IPreferenceStore.TRUE; + else + sValue = IPreferenceStore.FALSE; + return addControls((Control)button, key, sValue); + + } + + private Control addTextControl(final Composite parent, String key, String value) { + final Text text; + + text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); + text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + text.setText(value); + text.setSize(10, 150); + + return addControls((Control)text, key, value); + } + + private Button addFileSelectButton(final Composite parent, final Text text, final String key) { + Button button = new Button(parent, SWT.PUSH | SWT.LEAD); + button.setText(InputUIElement.BROWSELABEL); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + String dirName; + if (key.equals(PreferenceConstants.TOOLCHAIN_ROOT)|| key.equals(PreferenceConstants.SYSROOT)) + dirName = new DirectoryDialog(parent.getShell()).open(); + else + dirName = new FileDialog(parent.getShell()).open(); + if (dirName != null) { + text.setText(dirName); + } + } + }); + return button; + } + + private void createQemuSetup(final Group targetGroup) + { + //QEMU Setup + kernel_label= new Label(targetGroup, SWT.NONE); + kernel_label.setText("Kernel: "); + kernel_label.setAlignment(SWT.RIGHT); + + Composite textContainer = new Composite(targetGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); + textKernelLoc= (Text)addTextControl(textContainer, PreferenceConstants.QEMU_KERNEL, yoctoUIElement.getStrQemuKernelLoc()); + btnKernelLoc = addFileSelectButton(textContainer, textKernelLoc, PreferenceConstants.QEMU_KERNEL); + + + option_label = new Label(targetGroup, SWT.NONE); + option_label.setText("Custom Option: "); + option_label.setAlignment(SWT.RIGHT); + + textContainer = new Composite(targetGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); + textQemuOption = (Text)addTextControl(textContainer, PreferenceConstants.QEMU_OPTION, yoctoUIElement.getStrQemuOption()); + +/* + rootfs_label= new Label(targetGroup, SWT.NONE); + rootfs_label.setText("Root Filesystem: "); + rootfs_label.setAlignment(SWT.RIGHT); + + textContainer = new Composite(targetGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); + textRootFSLoc= (Text)addTextControl(textContainer, PreferenceConstants.QEMU_ROOTFS, yoctoUIElement.getStrQemuRootFSLoc()); + btnRootFSLoc = addFileSelectButton(textContainer, textRootFSLoc, PreferenceConstants.QEMU_ROOTFS); + */ + + } + public void createComposite(Composite composite) + { + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + GridLayout layout = new GridLayout(2, false); + + crossCompilerGroup = new Group(composite, SWT.NONE); + layout= new GridLayout(2, false); + crossCompilerGroup.setLayout(layout); + gd= new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.horizontalSpan= 2; + crossCompilerGroup.setLayoutData(gd); + crossCompilerGroup.setText("Cross Compiler Options:"); + + if (yoctoUIElement.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { + + btnSDKRoot = (Button)addRadioButton(crossCompilerGroup, "Standalone pre-built toolchain", PreferenceConstants.SDK_MODE + "_1", true); + btnPokyRoot = (Button)addRadioButton(crossCompilerGroup, "Build system derived toolchain", PreferenceConstants.SDK_MODE + "_2", false); + } + else { + btnSDKRoot = (Button)addRadioButton(crossCompilerGroup, "Standalone pre-built toolchain", PreferenceConstants.SDK_MODE + "_1", false); + btnPokyRoot = (Button)addRadioButton(crossCompilerGroup, "Build system derived toolchain", PreferenceConstants.SDK_MODE + "_2", true); + } + + root_label = new Label(crossCompilerGroup, SWT.NONE); + root_label.setText("Toolchain Root Location: "); + Composite textContainer = new Composite(crossCompilerGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + textRootLoc = (Text)addTextControl(textContainer, + PreferenceConstants.TOOLCHAIN_ROOT, yoctoUIElement.getStrToolChainRoot()); + btnToolChainLoc = addFileSelectButton(textContainer, textRootLoc, PreferenceConstants.TOOLCHAIN_ROOT); + + sysroot_label= new Label(crossCompilerGroup, SWT.NONE); + sysroot_label.setText("Sysroot Location: "); + sysroot_label.setAlignment(SWT.RIGHT); + + textContainer = new Composite(crossCompilerGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); + textSysrootLoc= (Text)addTextControl(textContainer, PreferenceConstants.SYSROOT, yoctoUIElement.getStrSysrootLoc()); + btnSysrootLoc = addFileSelectButton(textContainer, textSysrootLoc, PreferenceConstants.SYSROOT); + + updateSDKControlState(); + targetArchLabel = new Label(crossCompilerGroup, SWT.NONE); + targetArchLabel.setText("Target Architecture: "); + + targetArchCombo= new Combo(crossCompilerGroup, SWT.READ_ONLY); + if (yoctoUIElement.getStrTargetsArray() != null) + { + targetArchCombo.setItems(yoctoUIElement.getStrTargetsArray()); + targetArchCombo.select(yoctoUIElement.getIntTargetIndex()); + } + targetArchCombo.setLayout(new GridLayout(2, false)); + targetArchCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); + this.addControls((Control)targetArchCombo, + PreferenceConstants.TOOLCHAIN_TRIPLET, String.valueOf(yoctoUIElement.getIntTargetIndex())); + + + //Target Options + GridData gd2= new GridData(SWT.FILL, SWT.LEFT, true, false); + gd2.horizontalSpan= 2; + Group targetGroup= new Group(composite, SWT.NONE); + layout= new GridLayout(); + layout.numColumns= 2; + targetGroup.setLayout(layout); + targetGroup.setLayoutData(gd2); + targetGroup.setText("Target Options:"); + + if (yoctoUIElement.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { + btnQemu = (Button)addRadioButton(targetGroup, "QEMU", PreferenceConstants.TARGET_MODE + "_1", true); + createQemuSetup(targetGroup); + + btnDevice = (Button)addRadioButton(targetGroup, "External HW", PreferenceConstants.TARGET_MODE + "_2", false); + } + else { + btnQemu = (Button)addRadioButton(targetGroup, "QEMU", PreferenceConstants.TARGET_MODE + "_1", false); + createQemuSetup(targetGroup); + + btnDevice = (Button)addRadioButton(targetGroup, "External HW", PreferenceConstants.TARGET_MODE + "_2", true); + } + + updateQemuControlState(); + + //we add the listener at the end for avoiding the useless event trigger when control + //changed or modified. + btnSDKRoot.addSelectionListener(fSelectionListener); + btnPokyRoot.addSelectionListener(fSelectionListener); + btnQemu.addSelectionListener(fSelectionListener); + btnDevice.addSelectionListener(fSelectionListener); + targetArchCombo.addSelectionListener(fSelectionListener); + textRootLoc.addModifyListener(fModifyListener); + textKernelLoc.addModifyListener(fModifyListener); + textQemuOption.addModifyListener(fModifyListener); + textSysrootLoc.addModifyListener(fModifyListener); + } + + //Load all Control values into the YoctoUIElement + public YoctoUIElement getCurrentInput() + { + YoctoUIElement elem = new YoctoUIElement(); + if (btnSDKRoot.getSelection()) + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); + else + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); + + if (btnQemu.getSelection()) + { + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); + } + else { + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); + } + elem.setStrToolChainRoot(textRootLoc.getText()); + elem.setIntTargetIndex(targetArchCombo.getSelectionIndex()); + elem.setStrTargetsArray(targetArchCombo.getItems()); + elem.setStrTarget(targetArchCombo.getText()); + elem.setStrQemuKernelLoc(textKernelLoc.getText()); + elem.setStrQemuOption(textQemuOption.getText()); + elem.setStrSysrootLoc(textSysrootLoc.getText()); + return elem; + } + + public void setCurrentInput(YoctoUIElement elem){ + elem.setStrTargetsArray(getTargetArray(elem)); + + btnSDKRoot.setSelection(false); + btnPokyRoot.setSelection(false); + if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_SDK_MODE)){ + btnSDKRoot.setSelection(true); + } + else if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_TREE_MODE)){ + btnPokyRoot.setSelection(true); + } + + btnQemu.setSelection(false); + btnDevice.setSelection(false); + if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.QEMU_MODE)){ + btnQemu.setSelection(true); + } + else if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.DEVICE_MODE)){ + btnDevice.setSelection(true); + } + + textRootLoc.setText(elem.getStrToolChainRoot()); + targetArchCombo.select(elem.getIntTargetIndex()); + if(elem.getStrTargetsArray() == null){ + targetArchCombo.setItems(new String[]{}); + } + else { + targetArchCombo.setItems(elem.getStrTargetsArray()); + } + targetArchCombo.setText(elem.getStrTarget()); + textKernelLoc.setText(elem.getStrQemuKernelLoc()); + textQemuOption.setText(elem.getStrQemuOption()); + textSysrootLoc.setText(elem.getStrSysrootLoc()); + } + + public SDKCheckResults validateInput(SDKCheckRequestFrom from, boolean showErrorDialog) { + SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(getCurrentInput()); + + //Show Error Message on the Label to help users. + if ((result != SDKCheckResults.SDK_PASS) && showErrorDialog) { + Display display = Display.getCurrent(); + ErrorDialog.openError(display.getActiveShell(), + YoctoSDKChecker.SDKCheckRequestFrom.Other.getErrorMessage(), + YoctoSDKChecker.getErrorMessage(result, from), + new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage())); + + } + + return result; + } + + public void setUIFormEnabledState(boolean isEnabled) { + btnSDKRoot.setEnabled(isEnabled); + btnPokyRoot.setEnabled(isEnabled); + + root_label.setEnabled(isEnabled); + textRootLoc.setEnabled(isEnabled); + btnToolChainLoc.setEnabled(isEnabled); + + sysroot_label.setEnabled(isEnabled); + textSysrootLoc.setEnabled(isEnabled); + btnSysrootLoc.setEnabled(isEnabled); + + targetArchLabel.setEnabled(isEnabled); + targetArchCombo.setEnabled(isEnabled); + + btnQemu.setEnabled(isEnabled); + + if(isEnabled) { + /* enabling widgets regarding + * Kernel and Custom Options + * depends on the state of the QEMU button */ + kernel_label.setEnabled(isEnabled); + option_label.setEnabled(isEnabled); + + if(btnQemu.getSelection()) { + textKernelLoc.setEnabled(isEnabled); + btnKernelLoc.setEnabled(isEnabled); + + textQemuOption.setEnabled(isEnabled); + } + } else { + /* disable all widgets regarding + * Kernel and Custom Options */ + kernel_label.setEnabled(isEnabled); + textKernelLoc.setEnabled(isEnabled); + btnKernelLoc.setEnabled(isEnabled); + + option_label.setEnabled(isEnabled); + textQemuOption.setEnabled(isEnabled); + } + + btnDevice.setEnabled(isEnabled); + } + + private void updateQemuControlState() + { + boolean bQemuMode = btnQemu.getSelection(); + + textKernelLoc.setEnabled(bQemuMode); + //textRootFSLoc.setEnabled(bQemuMode); + btnKernelLoc.setEnabled(bQemuMode); + //btnRootFSLoc.setEnabled(bQemuMode); + textQemuOption.setEnabled(bQemuMode); + } + + private void updateSDKControlState() + { + if (btnSDKRoot.getSelection()) + { + } + else { + if (!yoctoUIElement.getStrToolChainRoot().startsWith("/opt/poky")) + { + textRootLoc.setText(yoctoUIElement.getStrToolChainRoot()); + } + textRootLoc.setEnabled(true); + btnToolChainLoc.setEnabled(true); + } + } + + private void controlChanged(Widget widget) { + + if (widget == btnSDKRoot || widget == btnPokyRoot) + { + + setTargetCombo(targetArchCombo); + updateSDKControlState(); + } + + if (widget == btnDevice || widget == btnQemu) + updateQemuControlState(); + } + + private void controlModified(Widget widget) { + if (widget == textRootLoc) + { + setTargetCombo(targetArchCombo); + } + } + + /* Search current supported Target triplet from the toolchain root + * by parsing ENV script file name + */ + private static ArrayList getTargetTripletList(String strFileName) + { + File fFile = new File(strFileName); + if (!fFile.exists()) + return null; + + ArrayList arrTarget = new ArrayList(); + String[] strFileArray = fFile.list(); + for (int i = 0; i < strFileArray.length; i++) + { + if (strFileArray[i].startsWith(ENV_SCRIPT_FILE_PREFIX)) { + arrTarget.add(strFileArray[i].substring(ENV_SCRIPT_FILE_PREFIX.length())); + } + } + return arrTarget; + + } + + private static String[] getTargetArray(YoctoUIElement elem) + { + ArrayList arrTarget; + String sEnvFilePath = elem.getStrToolChainRoot(); + + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) + { + arrTarget = getTargetTripletList(sEnvFilePath); + } + else + { + arrTarget = getTargetTripletList(sEnvFilePath + "/tmp"); + } + if (arrTarget == null || arrTarget.size() <= 0) + return null; + + String [] strTargetArray = new String[arrTarget.size()]; + for (int i = 0; i < arrTarget.size(); i++) + strTargetArray[i] = arrTarget.get(i); + + return strTargetArray; + + } + + private void setTargetCombo(Combo targetCombo) + { + YoctoUIElement elem = getCurrentInput(); + //re-get Combo box items according to latest input! + elem.setStrTargetsArray(getTargetArray(elem)); + targetCombo.removeAll(); + if (elem.getStrTargetsArray() != null) + { + targetCombo.setItems(elem.getStrTargetsArray()); + for (int i = 0; i < targetCombo.getItemCount(); i++) + { + if(elem.getStrTarget().equalsIgnoreCase(targetCombo.getItem(i))) + { + targetCombo.select(i); + return; + } + if (elem.getStrTargetsArray().length == 1) + targetCombo.select(0); + targetCombo.select(-1); + } + } + //prompt user,if he use tree mode, maybe he hasn't bitbake meta-ide-support yet. + else if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE) + { + if (elem.getStrToolChainRoot().isEmpty()) + return; + else { + File fToolChain = new File(elem.getStrToolChainRoot()); + if (!fToolChain.exists()) + return; + } + } + + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java new file mode 100644 index 0000000..f39d5fd --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java @@ -0,0 +1,110 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.actions; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; + +import org.eclipse.cdt.core.CommandLauncher; +import org.eclipse.cdt.core.ConsoleOutputStream; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.resources.IConsole; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.cdt.internal.autotools.core.AutotoolsNewMakeGenerator; +import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction; +import org.eclipse.cdt.internal.autotools.ui.actions.InvokeMessages; + +import org.yocto.sdk.ide.YoctoSDKPlugin; + +@SuppressWarnings("restriction") +public class InvokeSyncAction extends InvokeAction { + protected void executeLocalConsoleCommand(final IConsole console, final String actionName, final String command, + final String[] argumentList, final IPath execDir, final String password) throws CoreException, IOException { + + String errMsg = null; + IProject project = getSelectedContainer().getProject(); + // Get a build console for the project + ConsoleOutputStream consoleOutStream = console.getOutputStream(); + // FIXME: we want to remove need for ManagedBuilderManager, but how do we + // get environment variables. + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); + IConfiguration cfg = info.getDefaultConfiguration(); + + StringBuffer buf = new StringBuffer(); + String[] consoleHeader = new String[3]; + + consoleHeader[0] = actionName; + consoleHeader[1] = cfg.getName(); + consoleHeader[2] = project.getName(); + buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ + String invokeMsg = InvokeMessages.getFormattedString("InvokeAction.console.message", //$NON-NLS-1$ + new String[]{actionName, execDir.toString()}); //$NON-NLS-1$ + buf.append(invokeMsg); + buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ + buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ + consoleOutStream.write(buf.toString().getBytes()); + consoleOutStream.flush(); + + ArrayList additionalEnvs = new ArrayList(); + String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs); + // Get a launcher for the config command + CommandLauncher launcher = new CommandLauncher(); + // Set the environment + IEnvironmentVariable variables[] = ManagedBuildManager + .getEnvironmentVariableProvider().getVariables(cfg, true); + String[] env = null; + ArrayList envList = new ArrayList(); + if (variables != null) { + for (int i = 0; i < variables.length; i++) { + envList.add(variables[i].getName() + + "=" + variables[i].getValue()); //$NON-NLS-1$ + } + // add any additional environment variables specified ahead of script + if (additionalEnvs.size() > 0) + envList.addAll(additionalEnvs); + env = (String[]) envList.toArray(new String[envList.size()]); + } + OutputStream stdout = consoleOutStream; + OutputStream stderr = consoleOutStream; + + launcher.showCommand(true); + // Run the shell script via shell command. + Process proc = launcher.execute(new Path(strippedCommand), argumentList, env, + execDir, new NullProgressMonitor()); + + if (proc != null) { + // Close the input of the process since we will never write to it + OutputStream out = proc.getOutputStream(); + if (!password.isEmpty()) { + out.write(password.getBytes()); + out.write("\n".getBytes()); + } + out.close(); + + if (launcher.waitAndRead(stdout, stderr) != CommandLauncher.OK) { + errMsg = launcher.getErrorMessage(); + } + } else { + errMsg = launcher.getErrorMessage(); + } + + if (errMsg != null) + YoctoSDKPlugin.logErrorMessage(errMsg); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java new file mode 100644 index 0000000..e3e7e60 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial implementation + *******************************************************************************/ +package org.yocto.sdk.ide.actions; + +import java.util.Map; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.State; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ITreeSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.handlers.RadioState; +import org.eclipse.ui.menus.UIElement; +import org.yocto.sdk.ide.YoctoProfileElement; +import org.yocto.sdk.ide.YoctoSDKChecker; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; +import org.yocto.sdk.ide.YoctoSDKMessages; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoUIElement; +import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; + +public class ProfileSwitchHandler extends AbstractHandler implements IElementUpdater { + private static final String PROJECT_SPECIFIC_ERROR = "Preferences.Profile.ProjectSpecific.Error.Title"; + private static final String PROJECT_SPECIFIC_ERROR_MESSAGE = "Preferences.Profile.ProjectSpecific.Error.Message"; + + public static final String PROFILE_SWITCH_COMMAND = "org.yocto.sdk.ide.targetProfile.switch"; //$NON-NLS-N$ + public static final String PROJECT_SPECIFIC_PARAMETER = "##PROJECT_SPECIFIC_PROFILE##"; //$NON-NLS-N$ + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + if(HandlerUtil.matchesRadioState(event)) { + return null; + } + + String currentState = event.getParameter(RadioState.PARAMETER_ID); + HandlerUtil.updateRadioState(event.getCommand(), currentState); + + switchProfile(getSelectedProject(event), currentState); + + return null; + } + + public IProject getSelectedProject(ExecutionEvent event) { + ISelection selection = HandlerUtil.getCurrentSelection(event); + + if (selection instanceof ITreeSelection) { + Object selectedItem = ((ITreeSelection) selection).getFirstElement(); + if (selectedItem instanceof IResource) { + return ((IResource) selectedItem).getProject(); + } else if (selectedItem instanceof ICElement) { + ICProject cProject = ((ICElement) selectedItem).getCProject(); + if (cProject != null) { + return cProject.getProject(); + } + } else if (selectedItem instanceof IAdaptable) { + Object projectObject = ((IAdaptable) selectedItem).getAdapter(IProject.class); + if (projectObject != null && projectObject instanceof IProject) { + return ((IProject) projectObject); + } + } + } + + return null; + } + + private void switchProfile(IProject project, String selectedProfile) { + if (PROJECT_SPECIFIC_PARAMETER.equals(selectedProfile)) { + YoctoUIElement yoctoUIElement = ProjectPreferenceUtils.getElem(project); + SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(yoctoUIElement); + + if ((result != SDKCheckResults.SDK_PASS)) { + Display display = Display.getCurrent(); + ErrorDialog.openError(display.getActiveShell(), + YoctoSDKMessages.getString(PROJECT_SPECIFIC_ERROR), + YoctoSDKMessages.getFormattedString(PROJECT_SPECIFIC_ERROR_MESSAGE, + project.getName()), + new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage())); + return; + } + + ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUIElement, project); + ProjectPreferenceUtils.saveUseProjectSpecificOption(project, true); + } else { + IPreferenceStore store = YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile); + YoctoUIElement yoctoUIElement = YoctoSDKUtils.getElemFromStore(store); + ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUIElement, project); + ProjectPreferenceUtils.saveUseProjectSpecificOption(project, false); + + YoctoProfileElement profileSettings = ProjectPreferenceUtils.getProfiles(project); + profileSettings.setSelectedProfile(selectedProfile); + ProjectPreferenceUtils.saveProfiles(profileSettings, project); + } + } + + /* + * Workaround for BUG 398647 to allow checking radio items + * in a dynamic contribution + * + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=398647 + */ + @Override + public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { + ICommandService service = (ICommandService) element.getServiceLocator().getService(ICommandService.class); + String state = (String) parameters.get(RadioState.PARAMETER_ID); + Command command = service.getCommand(PROFILE_SWITCH_COMMAND); + State commandState = command.getState(RadioState.STATE_ID); + if (commandState.getValue().equals(state)) { + element.setChecked(true); + } + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java new file mode 100644 index 0000000..e255fd1 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.actions; + +import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.ui.dialogs.PreferencesUtil; +import org.yocto.sdk.ide.YoctoSDKPlugin; + + +@SuppressWarnings("restriction") +public class ReconfigYoctoAction extends InvokeAction { + + public void run(IAction action) { + IContainer container = getSelectedContainer(); + if (container == null) + return; + + IProject project = container.getProject(); + + PreferenceDialog dialog = + PreferencesUtil.createPropertyDialogOn(YoctoSDKPlugin.getActiveWorkbenchShell(), + project, + "org.yocto.sdk.ide.page", + null, + null); + dialog.open(); + } + + public void dispose() { + + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java new file mode 100644 index 0000000..6d508d3 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.actions; + +import java.lang.reflect.Method; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.cdt.internal.autotools.ui.actions.AbstractAutotoolsHandler; +import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction; +import org.eclipse.swt.widgets.Display; +import org.yocto.sdk.ide.YoctoSDKPlugin; + + +@SuppressWarnings("restriction") +public class ReconfigYoctoHandler extends AbstractAutotoolsHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + ReconfigYoctoAction action = new ReconfigYoctoAction(); + Method method = null; + + try { + /* + * This is hack to workaround upstream eclipse bug #370288 + */ + Class [] params = {ExecutionEvent.class, InvokeAction.class}; + method = AbstractAutotoolsHandler.class.getDeclaredMethod("execute",params ); + } catch (NoSuchMethodException e) { + //no such method, old version of plugin org.eclipse.linuxtools.autotools.ui + method = null; + } catch (Exception e) { + throw new ExecutionException(e.getMessage(), e); + } + + if (method != null) { + //new version + Object [] params = {event, action}; + try { + return method.invoke(this, params); + }catch (Exception e) { + throw new ExecutionException(e.getMessage(), e); + } + } else { + //old version + //display a dialog to warn the user + Display.getDefault().syncExec(new Runnable() { + public void run() { + ErrorDialog.openError(null, "Change Yocto Project Settings", "Please update the plugin of \"Autotools support for CDT\"!", + new Status(IStatus.WARNING,YoctoSDKPlugin.PLUGIN_ID,"old version of plugin \"Autotools support for CDT\" detected.")); + } + }); + //try to display the dialog in the old way + Object o = event.getApplicationContext(); + if (o instanceof IEvaluationContext) { + IContainer container = getContainer((IEvaluationContext)o); + if (container != null) { + action.setSelectedContainer(container); + action.run(null); + } + } + } + + return null; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java new file mode 100644 index 0000000..4b25d94 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.actions; + +import org.eclipse.cdt.internal.autotools.ui.Console; +import org.yocto.sdk.ide.YoctoSDKMessages; + +@SuppressWarnings("restriction") +public class YoctoConsole extends Console { + private static final String CONTEXT_MENU_ID = "YoctoConsole"; + private static final String CONSOLE_NAME = YoctoSDKMessages.getString("Console.SDK.Name"); + + public YoctoConsole() { + super(CONSOLE_NAME, CONTEXT_MENU_ID); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java new file mode 100644 index 0000000..ce80d77 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.natures; + +import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; +import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.resources.IProject; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoUIElement; +import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; + +public class YoctoSDKAutotoolsProjectNature extends YoctoSDKProjectNature { + public static final String YoctoSDK_AUTOTOOLS_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature"; + + private static final String DEFAULT_HOST_STR = "host"; + private static final String DEFAULT_TARGET_STR = "target"; + private static final String DEFAULT_BUILD_STR = "build"; + private static final String DEFAULT_AUTOGEN_OPT_STR = "autogenOpts"; + + private static final String DEFAULT_CONFIGURE_STR = "configure"; + private static final String DEFAULT_AUTOGEN_STR = "autogen"; + private static final String DEFAULT_LIBTOOL_SYSROOT_PREFIX = " --with-libtool-sysroot="; + + public static void configureAutotoolsOptions(IProject project) { + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); + IConfiguration icfg = info.getDefaultConfiguration(); + YoctoUIElement elem = ProjectPreferenceUtils.getElemFromProjectEnv(project); + String sysroot_str = elem.getStrSysrootLoc(); + String id = icfg.getId(); + String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS"); + String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS"); + String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS"); + String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS"); + + String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 " + + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\""; + String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str; + String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str; + IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id); + String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS"); + + cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting); + cfg.setOption(DEFAULT_BUILD_STR, splitString(strConfigure, "--build=")); + cfg.setOption(DEFAULT_HOST_STR, splitString(strConfigure, "--host=")); + cfg.setOption(DEFAULT_TARGET_STR, splitString(strConfigure, "--target=")); + cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting); + cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure); + + AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg); + AutotoolsConfigurationManager.getInstance().saveConfigs(project); + } + + private static String splitString(String strValue, String strDelim) { + int iBeginIndex = strValue.indexOf(strDelim); + + if (iBeginIndex < 0) { + return ""; + } + int iEndIndex = strValue.indexOf(' ', iBeginIndex + 1); + + if (iEndIndex < 0) { + return strValue.substring(iBeginIndex + strDelim.length()); + } else { + return strValue.substring(iBeginIndex + strDelim.length(), iEndIndex); + } + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java new file mode 100644 index 0000000..b3d0f2c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.natures; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IContributedEnvironment; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; + +public class YoctoSDKCMakeProjectNature extends YoctoSDKProjectNature { + public static final String YoctoSDK_CMAKE_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKCMakeNature"; + + // Considered poky's cmake.bbclass for this method + public static void extendProjectEnvironmentForCMake(IProject project) { + ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); + ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); + IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); + IContributedEnvironment env = manager.getContributedEnvironment(); + String delimiter = manager.getDefaultDelimiter(); + + env.addVariable("CCACHE", "", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + env.addVariable("OECMAKE_SOURCEPATH", "..", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + String oecmakeBuildPathString = ""; + env.addVariable("OECMAKE_BUILDPATH", oecmakeBuildPathString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("EXTRA_OEMAKE", "-C " + oecmakeBuildPathString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + String ccString = YoctoSDKUtils.getEnvValue(project, "CC"); + + if (!ccString.equals("") && !ccString.equals(" ")) { + ccString.trim(); + ccString = ccString.split(" ")[0]; + } + + env.addVariable("OECMAKE_C_COMPILER", ccString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + String cxxString = YoctoSDKUtils.getEnvValue(project, "CXX"); + + if (!cxxString.equals("") && !cxxString.equals(" ")) { + cxxString.trim(); + cxxString = cxxString.split(" ")[0]; + } + + env.addVariable("OECMAKE_CXX_COMPILER", cxxString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + String hostCCArchString = YoctoSDKUtils.getEnvValue(project, "HOST_CC_ARCH"); + String toolchainOptionsString = YoctoSDKUtils.getEnvValue(project, "TOOLCHAIN_OPTIONS"); + String cppFlagsString = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS"); + String cxxFlagsString = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS"); + String selectedOptimizationString = YoctoSDKUtils.getEnvValue(project, "SELECTED_OPTIMIZATION"); + env.addVariable("OECMAKE_C_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cppFlagsString, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_CXX_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cxxFlagsString + + " -fpermissive", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_C_FLAGS_RELEASE", selectedOptimizationString + " " + cppFlagsString + " -DNDEBUG", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_CXX_FLAGS_RELEASE", selectedOptimizationString + " " + cxxFlagsString + " -DNDEBUG", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + env.addVariable("OECMAKE_RPATH", "", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable("OECMAKE_PERLNATIVE_DIR", "", + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + try { + CoreModel.getDefault().setProjectDescription(project, cpdesc); + } catch (CoreException e) { + e.printStackTrace(); + } + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java new file mode 100644 index 0000000..e1b847a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java @@ -0,0 +1,8 @@ +package org.yocto.sdk.ide.natures; + +import org.yocto.sdk.ide.YoctoSDKPlugin; + +public class YoctoSDKEmptyProjectNature extends YoctoSDKProjectNature { + + public static final String YoctoSDK_EMPTY_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKEmptyNature"; +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java new file mode 100644 index 0000000..5a2a6b1 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + * BMW Car IT - extracted in an own class + *******************************************************************************/ +package org.yocto.sdk.ide.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +public class YoctoSDKNatureUtils { + + public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException + { + IProjectDescription description = project.getDescription(); + String[] natures = description.getNatureIds(); + + for (int i = 0; i < natures.length; ++i) { + if (natureId.equals(natures[i])) + return; + } + + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = natureId; + description.setNatureIds(newNatures); + project.setDescription(description, monitor); + + } + +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java new file mode 100644 index 0000000..e3f6a35 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; +import org.yocto.sdk.ide.YoctoSDKPlugin; + +public class YoctoSDKProjectNature implements IProjectNature { + public static final String YoctoSDK_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature"; + + private IProject proj; + + public void configure() throws CoreException { + } + + public void deconfigure() throws CoreException { + } + + public IProject getProject() { + return proj; + } + + public void setProject(IProject project) { + this.proj = project; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java new file mode 100644 index 0000000..0ebbe99 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.preferences; + +/** + * Constant definitions for plug-in preferences + */ +public class PreferenceConstants { + + public static final String TOOLCHAIN_ROOT = "toolChainRoot"; + + public static final String TARGET_MODE = "TargetMode"; + + public static final String SDK_MODE = "SDKMode"; + + public static final String TARGET_ARCH_INDEX = "targeArchIndex"; + + public static final String TOOLCHAIN_TRIPLET = "toolchainTriplet"; + + public static final String QEMU_KERNEL = "QemuKernel"; + + public static final String QEMU_OPTION = "QemuOption"; + + public static final String SYSROOT = "Sysroot"; + + public static final String IP_ADDR = "IPAddr"; + + public static final String STANDARD_PROFILE_NAME = "Standard Profile"; + + public static final String PROFILES = "profiles"; + + public static final String SELECTED_PROFILE = "selectedProfile"; + + public static final String PROJECT_SPECIFIC_PROFILE = "##PROJECT_SPECIFIC_PROFILE##"; +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java new file mode 100644 index 0000000..40f37d0 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +import org.yocto.sdk.ide.YoctoSDKPlugin; + +import static org.yocto.sdk.ide.preferences.PreferenceConstants.*; + +/** + * Class used to initialize default preference values. + */ +public class PreferenceInitializer extends AbstractPreferenceInitializer { + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + public void initializeDefaultPreferences() { + IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore(); + store.setDefault(TOOLCHAIN_ROOT, ""); + store.setDefault(SDK_MODE, true); + store.setDefault(TARGET_MODE, false); + store.setDefault(TARGET_ARCH_INDEX, -1); + store.setDefault(IP_ADDR, ""); + store.setDefault(QEMU_KERNEL, ""); + store.setDefault(QEMU_OPTION, ""); + store.setDefault(SYSROOT, ""); + store.setDefault(TOOLCHAIN_TRIPLET, ""); + store.setDefault(PROFILES, "\"" + STANDARD_PROFILE_NAME + "\""); + store.setDefault(SELECTED_PROFILE, STANDARD_PROFILE_NAME); + } + +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java new file mode 100644 index 0000000..38e38b1 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2012 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.preferences; + +import org.eclipse.jface.dialogs.IInputValidator; +import org.yocto.sdk.ide.YoctoProfileElement; +import org.yocto.sdk.ide.YoctoSDKMessages; + +public class ProfileNameInputValidator implements IInputValidator { + private static final String WARNING_CONTAINS_COMMA = "Preferences.Profile.Validator.InvalidName.Comma"; + private static final String WARNING_CONTAINS_DOUBLEQUOTE = "Preferences.Profile.Validator.InvalidName.Quote"; + private static final String PROFILE_NAME_IS_EMPTY = "Preferences.Profile.Validator.InvalidName.Empty"; + private static final String WARNING_ALREADY_EXISTS = "Preferences.Profile.Validator.InvalidName.Exists"; + + private final String selectedItem; + private final YoctoProfileElement profileSetting; + + public ProfileNameInputValidator(YoctoProfileElement profileSetting) { + this(profileSetting, ""); + } + + public ProfileNameInputValidator(YoctoProfileElement profileSetting, String selectedItem) { + this.selectedItem = selectedItem; + this.profileSetting = profileSetting; + } + + @Override + public String isValid(String newText) { + if (newText.contains(",")) { + return YoctoSDKMessages.getString(WARNING_CONTAINS_COMMA); + } + + if (newText.contains("\"")) { + return YoctoSDKMessages.getString(WARNING_CONTAINS_DOUBLEQUOTE); + } + + if (newText.isEmpty()) { + return YoctoSDKMessages.getString(PROFILE_NAME_IS_EMPTY); + } + + if (selectedItemEquals(newText)) { + return null; + } + + if (profileSetting.contains(newText)) { + return YoctoSDKMessages.getString(WARNING_ALREADY_EXISTS); + } + + return null; + } + + private boolean selectedItemEquals(String newText) { + return !selectedItem.isEmpty() && newText.equals(selectedItem); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java new file mode 100644 index 0000000..4e6ca2a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java @@ -0,0 +1,307 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.preferences; + +import java.util.HashSet; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.yocto.sdk.ide.YoctoProfileElement; +import org.yocto.sdk.ide.YoctoProfileSetting; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; +import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; +import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; +import org.yocto.sdk.ide.YoctoSDKMessages; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoUIElement; +import org.yocto.sdk.ide.YoctoUISetting; + +public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private static final String NEW_DIALOG_TITLE = "Preferences.Profile.New.Dialog.Title"; + private static final String NEW_DIALOG_MESSAGE = "Preferences.Profile.New.Dialog.Message"; + private static final String UPDATE_DIALOG_TITLE = "Preferences.Profile.Update.Dialog.Title"; + private static final String UPDATE_DIALOG_MESSAGE = "Preferences.Profile.Update.Dialog.Message"; + private static final String REVALIDATION_MESSAGE = "Poky.SDK.Revalidation.Message"; + + private YoctoProfileSetting yoctoProfileSetting; + private YoctoUISetting yoctoUISetting; + + private Listener changeListener; + + public YoctoSDKPreferencePage() { + //super(GRID); + IPreferenceStore defaultStore = YoctoSDKPlugin.getDefault().getPreferenceStore(); + String profiles = defaultStore.getString(PreferenceConstants.PROFILES); + String selectedProfile = defaultStore.getString(PreferenceConstants.SELECTED_PROFILE); + + if (profiles.isEmpty()) { + profiles = defaultStore.getDefaultString(PreferenceConstants.PROFILES); + selectedProfile = defaultStore.getDefaultString(PreferenceConstants.SELECTED_PROFILE); + } + + setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)); + //setDescription(YoctoSDKMessages.getString(PREFERENCES_Yocto_CONFIG)); + YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); + this.yoctoUISetting = new YoctoUISetting(elem); + + YoctoProfileElement profileElement = new YoctoProfileElement(profiles, selectedProfile); + this.yoctoProfileSetting = new YoctoProfileSetting(profileElement, this, true); + + changeListener = new Listener() { + @Override + public void handleEvent(Event event) { + setErrorMessage(null); + setMessage(YoctoSDKMessages.getString(REVALIDATION_MESSAGE), INFORMATION); + } + }; + } + + /* + * @see IWorkbenchPreferencePage#init(IWorkbench) + */ + public void init(IWorkbench workbench) { + } + + protected Control createContents(Composite parent) { + initializeDialogUnits(parent); + final Composite composite= new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(2, false)); + + yoctoProfileSetting.createComposite(composite); + yoctoUISetting.createComposite(composite); + + composite.addListener(SWT.Modify, changeListener); + composite.addListener(SWT.Selection, changeListener); + + SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); + if (result != SDKCheckResults.SDK_PASS) { + } + + Dialog.applyDialogFont(composite); + return composite; + } + + /* + * @see IPreferencePage#performOk() + */ + public boolean performOk() { + clearMessages(); + + SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); + if (result != SDKCheckResults.SDK_PASS) { + setErrorMessage(result.getMessage()); + return false; + } + + YoctoUIElement savedElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); + YoctoUIElement modifiedElement = yoctoUISetting.getCurrentInput(); + + YoctoProfileElement savedProfileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); + YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput(); + + if (savedElement.equals(modifiedElement) && + profileElement.getSelectedProfile().equals(savedProfileElement.getSelectedProfile())) { + return true; + } + + HashSet yoctoProjects = getAffectedProjects(profileElement.getSelectedProfile()); + + if (!yoctoProjects.isEmpty()) { + boolean deleteConfirmed = + MessageDialog.openConfirm(null, YoctoSDKMessages.getString(UPDATE_DIALOG_TITLE), + YoctoSDKMessages.getFormattedString(UPDATE_DIALOG_MESSAGE, profileElement.getSelectedProfile())); + + if (!deleteConfirmed) { + return false; + } + } + + saveElemToStore(modifiedElement, getPreferenceStore()); + YoctoSDKUtils.saveProfilesToDefaultStore(profileElement); + + updateProjects(yoctoProjects, modifiedElement); + + return super.performOk(); + } + + private void clearMessages() { + setErrorMessage(null); + setMessage(null); + setTitle(getTitle()); + } + + /* + * @see PreferencePage#performDefaults() + */ + protected void performDefaults() { + YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore(); + yoctoUISetting.setCurrentInput(defaultElement); + super.performDefaults(); + } + + public void performSaveAs() { + YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput(); + YoctoUIElement uiElement = yoctoUISetting.getCurrentInput(); + + SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true); + if (result != SDKCheckResults.SDK_PASS) { + setErrorMessage(result.getMessage()); + return; + } + + InputDialog profileNameDialog = + new InputDialog(null, + YoctoSDKMessages.getString(NEW_DIALOG_TITLE), + YoctoSDKMessages.getString(NEW_DIALOG_MESSAGE), + null, + new ProfileNameInputValidator(profileElement)); + + int returnCode = profileNameDialog.open(); + if (returnCode == IDialogConstants.CANCEL_ID) { + return; + } + + profileElement.addProfile(profileNameDialog.getValue()); + yoctoProfileSetting.addProfile(profileNameDialog.getValue()); + + yoctoUISetting.setCurrentInput(uiElement); + performOk(); + } + + public void switchProfile(String selectedProfile) { + setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)); + YoctoUIElement profileElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); + yoctoUISetting.setCurrentInput(profileElement); + } + + public void renameProfile(String oldProfileName, String newProfileName) { + YoctoUIElement oldProfileElement = YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(oldProfileName)); + saveElemToStore(oldProfileElement, YoctoSDKPlugin.getProfilePreferenceStore(newProfileName)); + + renameProfileInAffectedProjects(oldProfileName, newProfileName); + } + + public void deleteProfile(String selectedProfile) + { + resetProfileInAffectedProjects(selectedProfile); + } + + /* Save IDE wide POKY Preference settings to a specific preference store */ + private void saveElemToStore(YoctoUIElement elem, IPreferenceStore store) { + store.setValue(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex()); + + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { + store.setValue(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE); + } else { + store.setValue(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE); + } + store.setValue(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc()); + store.setValue(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption()); + store.setValue(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc()); + if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { + store.setValue(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE); + } else { + store.setValue(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE); + } + store.setValue(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot()); + store.setValue(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget()); + } + + private void resetProfileInAffectedProjects(String usedProfile) + { + HashSet yoctoProjects = getAffectedProjects(usedProfile); + YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); + profileElement.setSelectedProfile(PreferenceConstants.STANDARD_PROFILE_NAME); + + for (IProject project : yoctoProjects) + { + ProjectPreferenceUtils.saveProfiles(profileElement, project); + YoctoUIElement elem = YoctoSDKUtils.getElemFromStore( + YoctoSDKPlugin.getProfilePreferenceStore(PreferenceConstants.STANDARD_PROFILE_NAME)); + ProjectPreferenceUtils.saveElemToProjectEnv(elem, project); + } + } + + private void renameProfileInAffectedProjects(String oldProfileName, String newProfileName) { + HashSet yoctoProjects = getAffectedProjects(oldProfileName); + YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); + profileElement.setSelectedProfile(newProfileName); + + for (IProject project : yoctoProjects) + { + ProjectPreferenceUtils.saveProfiles(profileElement, project); + } + } + + private void updateProjects(HashSet yoctoProjects, YoctoUIElement elem) { + for (IProject project : yoctoProjects) + { + ProjectPreferenceUtils.saveElemToProjectEnv(elem, project); + } + } + + private HashSet getAffectedProjects(String usedProfile) + { + HashSet yoctoProjects = new HashSet(); + + IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + + for (IProject project : projects) + { + try + { + if (!project.hasNature(YoctoSDKProjectNature.YoctoSDK_NATURE_ID)) { + continue; + } + } catch (CoreException e) + { + // project is closed or does not exist so don't update + continue; + } + + if (!projectUsesProfile(project, usedProfile)) { + continue; + } + + yoctoProjects.add(project); + } + return yoctoProjects; + } + + private boolean projectUsesProfile(IProject project, String profile) + { + YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project); + + if (!profileElement.getSelectedProfile().equals(profile)) { + return false; + } + + return true; + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java new file mode 100644 index 0000000..a85cbd9 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java @@ -0,0 +1,202 @@ +/******************************************************************************* + * Copyright (c) 2012 BMW Car IT GmbH. + * Copyright (c) 2010 Intel. + * 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: + * BMW Car IT GmbH - initial implementation + * Intel - initial API implementation (copied from YoctoSDKPreferencePage) + *******************************************************************************/ +package org.yocto.sdk.ide.preferences; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.ui.IWorkbenchPropertyPage; +import org.eclipse.ui.dialogs.PropertyPage; +import org.yocto.sdk.ide.YoctoProfileElement; +import org.yocto.sdk.ide.YoctoProfileSetting; +import org.yocto.sdk.ide.YoctoProjectSpecificSetting; +import org.yocto.sdk.ide.YoctoSDKChecker; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; +import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; +import org.yocto.sdk.ide.YoctoSDKMessages; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoUIElement; +import org.yocto.sdk.ide.YoctoUISetting; +import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; + +public class YoctoSDKProjectPropertyPage extends PropertyPage implements + IWorkbenchPropertyPage { + + private static final String REVALIDATION_MESSAGE = "Poky.SDK.Revalidation.Message"; + + private YoctoProfileSetting yoctoProfileSetting; + private YoctoProjectSpecificSetting yoctoProjectSpecificSetting; + private YoctoUISetting yoctoUISetting; + private IProject project = null; + + private Listener changeListener; + + public YoctoSDKProjectPropertyPage() { + changeListener = new Listener() { + @Override + public void handleEvent(Event event) { + if (getErrorMessage() != null) { + setErrorMessage(null); + setMessage(YoctoSDKMessages.getString(REVALIDATION_MESSAGE), INFORMATION); + } + } + }; + } + + @Override + protected Control createContents(Composite parent) { + IProject project = getProject(); + + YoctoProfileElement globalProfileElement= YoctoSDKUtils.getProfilesFromDefaultStore(); + YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project); + + String selectedProfile = profileElement.getSelectedProfile(); + if (!globalProfileElement.contains(selectedProfile)) { + selectedProfile = globalProfileElement.getSelectedProfile(); + } + + yoctoProfileSetting = new YoctoProfileSetting( + new YoctoProfileElement(globalProfileElement.getProfilesAsString(), selectedProfile), this, false); + boolean useProjectSpecificSetting = ProjectPreferenceUtils.getUseProjectSpecificOption(project); + + if (useProjectSpecificSetting) { + yoctoUISetting = new YoctoUISetting(ProjectPreferenceUtils.getElem(project)); + } else { + yoctoUISetting = new YoctoUISetting(YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile))); + } + + yoctoProjectSpecificSetting = new YoctoProjectSpecificSetting(yoctoProfileSetting, yoctoUISetting, this); + + initializeDialogUnits(parent); + final Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(2, false)); + + yoctoProfileSetting.createComposite(composite); + yoctoProjectSpecificSetting.createComposite(composite); + yoctoUISetting.createComposite(composite); + + if (useProjectSpecificSetting) { + yoctoProfileSetting.setUIFormEnabledState(false); + yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true); + yoctoUISetting.setUIFormEnabledState(true); + + SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); + if (result != SDKCheckResults.SDK_PASS) { + setErrorMessage(result.getMessage()); + } + } else { + yoctoProfileSetting.setUIFormEnabledState(true); + yoctoProjectSpecificSetting.setUseProjectSpecificSettings(false); + yoctoUISetting.setUIFormEnabledState(false); + } + + composite.addListener(SWT.Modify, changeListener); + composite.addListener(SWT.Selection, changeListener); + + Dialog.applyDialogFont(composite); + return composite; + } + + private IProject getProject() { + if (project != null) { + return project; + } + + IAdaptable adaptable = getElement(); + if (adaptable == null) { + throw new IllegalStateException("Project can only be retrieved after properties page has been set up."); + } + + project = (IProject) adaptable.getAdapter(IProject.class); + return project; + } + + /* + * @see PreferencePage#performDefaults() + */ + @Override + protected void performDefaults() { + YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore(); + yoctoUISetting.setCurrentInput(defaultElement); + yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true); + super.performDefaults(); + } + + /* + * @see IPreferencePage#performOk() + */ + @Override + public boolean performOk() { + clearMessages(); + + IProject project = getProject(); + + if (yoctoProjectSpecificSetting.isUsingProjectSpecificSettings()) { + SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); + if (result != SDKCheckResults.SDK_PASS) { + setErrorMessage(result.getMessage()); + return false; + } + + ProjectPreferenceUtils.saveUseProjectSpecificOption(project, true); + ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project); + ProjectPreferenceUtils.saveElem(yoctoUISetting.getCurrentInput(), project); + } else { + ProjectPreferenceUtils.saveUseProjectSpecificOption(project, false); + ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project); + } + + ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject()); + + return super.performOk(); + } + + private void clearMessages() { + setErrorMessage(null); + setMessage(null); + setTitle(getTitle()); + } + + public void switchProfile(String selectedProfile) + { + YoctoUIElement profileElement = YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)); + yoctoUISetting.setCurrentInput(profileElement); + } + + public void switchToProjectSpecificProfile() + { + YoctoUIElement profileElement = ProjectPreferenceUtils.getElem(getProject()); + SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(profileElement); + + if ((result != SDKCheckResults.SDK_PASS)) { + /* Project specific profile has not yet been defined, + * leave settings from previously selected profile + */ + return; + } + + yoctoUISetting.setCurrentInput(profileElement); + } + + public void switchToSelectedProfile() + { + switchProfile(yoctoProfileSetting.getCurrentInput().getSelectedProfile()); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java new file mode 100644 index 0000000..a06a03c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java @@ -0,0 +1,240 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * Copyright (c) 2010 Intel 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: + * Intel - initial implementation + * BMW Car IT - initial implementation and refactoring + *******************************************************************************/ +package org.yocto.sdk.ide.utils; + +import java.io.IOException; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.ConsoleOutputStream; +import org.eclipse.cdt.core.resources.IConsole; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ProjectScope; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.jface.preference.IPreferenceStore; +import org.osgi.service.prefs.BackingStoreException; +import org.yocto.sdk.ide.YoctoGeneralException; +import org.yocto.sdk.ide.YoctoProfileElement; +import org.yocto.sdk.ide.YoctoSDKMessages; +import org.yocto.sdk.ide.YoctoUIElement; +import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; +import org.yocto.sdk.ide.preferences.PreferenceConstants; + +public class ProjectPreferenceUtils { + private static final String CONSOLE_MESSAGE = "Menu.SDK.Console.Configure.Message"; + + /* Get POKY Preference settings from project's preference store */ + public static YoctoUIElement getElem(IProject project) { + IScopeContext projectScope = new ProjectScope(project); + IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); + if (projectNode == null) { + return getElemFromProjectEnv(project); + } + + YoctoUIElement elem = new YoctoUIElement(); + elem.setStrToolChainRoot(projectNode.get(PreferenceConstants.TOOLCHAIN_ROOT,"")); + elem.setStrTarget(projectNode.get(PreferenceConstants.TOOLCHAIN_TRIPLET,"")); + elem.setStrQemuKernelLoc(projectNode.get(PreferenceConstants.QEMU_KERNEL,"")); + elem.setStrSysrootLoc(projectNode.get(PreferenceConstants.SYSROOT,"")); + elem.setStrQemuOption(projectNode.get(PreferenceConstants.QEMU_OPTION,"")); + String sTemp = projectNode.get(PreferenceConstants.TARGET_ARCH_INDEX,""); + if (!sTemp.isEmpty()) { + elem.setIntTargetIndex(Integer.valueOf(sTemp).intValue()); + } + + if (projectNode.get(PreferenceConstants.SDK_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) { + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); + } else { + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); + } + + if(projectNode.get(PreferenceConstants.TARGET_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) { + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); + } else { + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); + } + return elem; + } + + /* Get POKY Preference settings from project's environment */ + public static YoctoUIElement getElemFromProjectEnv(IProject project) { + YoctoUIElement elem = new YoctoUIElement(); + elem.setStrToolChainRoot(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TOOLCHAIN_ROOT)); + elem.setStrTarget(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TOOLCHAIN_TRIPLET)); + elem.setStrQemuKernelLoc(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.QEMU_KERNEL)); + elem.setStrSysrootLoc(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.SYSROOT)); + elem.setStrQemuOption(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.QEMU_OPTION)); + String sTemp = YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TARGET_ARCH_INDEX); + + if (!sTemp.isEmpty()) { + elem.setIntTargetIndex(Integer.valueOf(sTemp).intValue()); + } + + if (YoctoSDKUtils.getEnvValue(project, PreferenceConstants.SDK_MODE).equalsIgnoreCase(IPreferenceStore.TRUE)) { + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); + } else { + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); + } + + if(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TARGET_MODE).equalsIgnoreCase(IPreferenceStore.TRUE)) { + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); + } else { + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); + } + + return elem; + } + + /* Get profiles and selected profile from the project's preference store */ + public static YoctoProfileElement getProfiles(IProject project) { + IScopeContext projectScope = new ProjectScope(project); + IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); + + if (projectNode == null) { + return YoctoSDKUtils.getProfilesFromDefaultStore(); + } + + String profiles = projectNode.get(PreferenceConstants.PROFILES, ""); + String selectedProfile = projectNode.get(PreferenceConstants.SELECTED_PROFILE, ""); + + return new YoctoProfileElement(profiles, selectedProfile); + } + + public static boolean getUseProjectSpecificOption(IProject project) { + IScopeContext projectScope = new ProjectScope(project); + IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); + if (projectNode == null) { + return false; + } + + String useProjectSpecificSettingString = projectNode.get(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, + IPreferenceStore.FALSE); + + if (useProjectSpecificSettingString.equals(IPreferenceStore.FALSE)) { + return false; + } + + return true; + } + + /* Save POKY Preference settings to project's preference store */ + public static void saveElem(YoctoUIElement elem, IProject project) { + IScopeContext projectScope = new ProjectScope(project); + IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); + if (projectNode == null) { + return; + } + + projectNode.putInt(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex()); + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { + projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE); + } else { + projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE); + } + projectNode.put(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc()); + projectNode.put(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption()); + projectNode.put(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc()); + if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { + projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE); + } else { + projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE); + } + projectNode.put(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot()); + projectNode.put(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget()); + + try { + projectNode.flush(); + } catch (BackingStoreException e) { + e.printStackTrace(); + } + } + + /* Save POKY Preference settings to project's environment */ + public static void saveElemToProjectEnv(YoctoUIElement elem, IProject project) { + ConsoleOutputStream consoleOutStream = null; + + try { + YoctoSDKUtils.setEnvironmentVariables(project, elem); + YoctoSDKUtils.createRemoteDebugAndQemuLaunchers(project, elem); + + if (project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) { + YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project); + } else if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) { + YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project); + } + + IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole"); + console.start(project); + consoleOutStream = console.getOutputStream(); + String messages = YoctoSDKMessages.getString(CONSOLE_MESSAGE); + consoleOutStream.write(messages.getBytes()); + } catch (CoreException e) { + System.out.println(e.getMessage()); + } catch (IOException e) { + System.out.println(e.getMessage()); + } catch (YoctoGeneralException e) { + System.out.println(e.getMessage()); + } finally { + if (consoleOutStream != null) { + try { + consoleOutStream.flush(); + consoleOutStream.close(); + } catch (IOException e) { + // ignore + } + } + } + } + + /* Save profiles and selected profile to the project's preference store */ + public static void saveProfiles(YoctoProfileElement profileElement, IProject project) { + IScopeContext projectScope = new ProjectScope(project); + IEclipsePreferences projectPreferences = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); + + if (projectPreferences == null) { + return; + } + + projectPreferences.put(PreferenceConstants.PROFILES, profileElement.getProfilesAsString()); + projectPreferences.put(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile()); + + try { + projectPreferences.flush(); + } catch (BackingStoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void saveUseProjectSpecificOption(IProject project, boolean useProjectSpecificSetting) { + IScopeContext projectScope = new ProjectScope(project); + IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); + if (projectNode == null) { + return; + } + + if (useProjectSpecificSetting) { + projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.TRUE); + } else { + projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.FALSE); + } + + try { + projectNode.flush(); + } catch (BackingStoreException e) { + e.printStackTrace(); + } + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java new file mode 100644 index 0000000..2ac48f8 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java @@ -0,0 +1,461 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + * BMW Car IT - add methods to use different preference stores + * Atanas Gegov (BMW Car IT) - add method to get the project environment + *******************************************************************************/ +package org.yocto.sdk.ide.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.StringTokenizer; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IContributedEnvironment; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.jface.preference.IPreferenceStore; +import org.yocto.sdk.ide.YoctoGeneralException; +import org.yocto.sdk.ide.YoctoProfileElement; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoUIElement; +import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; +import org.yocto.sdk.ide.preferences.PreferenceConstants; + +public class YoctoSDKUtils { + + private static final String DEFAULT_SYSROOT_PREFIX = "--sysroot="; + private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot="; + + private static final String DEFAULT_USR_BIN = "/usr/bin/"; + private static final String NATIVE_SYSROOT = "OECORE_NATIVE_SYSROOT"; + + public static String getEnvValue(IProject project, String strKey) + { + ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); + ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); + IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); + IContributedEnvironment env = manager.getContributedEnvironment(); + IEnvironmentVariable var = env.getVariable(strKey, ccdesc); + + if (var == null) + { + System.out.printf("ENV key %s is NULL\n", strKey); + return ""; + } + + else + return var.getValue(); + } + + /* Save project wide settings into ENV VARs including POKY preference settings + * and Environment Script File export VARs + */ + private static void setEnvVars(ICProjectDescription cpdesc, + YoctoUIElement elem, HashMap envMap) { + ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); + IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); + IContributedEnvironment env = manager.getContributedEnvironment(); + String delimiter = manager.getDefaultDelimiter(); + + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) + env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + else + env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + env.addVariable(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot(), + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget(), + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable(PreferenceConstants.TARGET_ARCH_INDEX, String.valueOf(elem.getIntTargetIndex()), + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) + env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + else + env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE, + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + env.addVariable(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc(), + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption(), + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + env.addVariable(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc(), + IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + + if (envMap == null) + { + System.out.println("ENV var hasmap is NULL, Please check ENV script File!"); + return; + } + Iterator iter = envMap.keySet().iterator(); + while (iter.hasNext()) + { + String sKey = (String)iter.next(); + String sValue = (String)envMap.get(sKey); + String targetFilePath; + File targetFile; + //replace --sysroot + if (sKey.matches("CFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("LDFLAGS") || + sKey.matches("CPPFLAGS")) { + + int SYSROOT_idx = sValue.lastIndexOf(DEFAULT_SYSROOT_PREFIX); + if (SYSROOT_idx >=0 ) + sValue = sValue.substring(0, SYSROOT_idx) + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc(); + else + sValue = " " + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc(); + targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); + targetFile = new File(targetFilePath); + if (targetFile.exists()) + sValue = sValue + "/" + elem.getStrTarget(); + } else if (sKey.matches("CONFIGURE_FLAGS")) { + int LIBTOOL_idx = sValue.lastIndexOf(LIBTOOL_SYSROOT_PREFIX); + if (LIBTOOL_idx >= 0) + sValue = sValue.substring(0, LIBTOOL_idx) + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc(); + else + sValue = " " + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc(); + targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); + targetFile = new File(targetFilePath); + if (targetFile.exists()) + sValue = sValue + "/" + elem.getStrTarget(); + } else if(sKey.matches("PKG_CONFIG_SYSROOT_DIR") || sKey.matches("OECORE_TARGET_SYSROOT")) { + sValue = elem.getStrSysrootLoc(); + targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); + targetFile = new File(targetFilePath); + if (targetFile.exists()) + sValue = sValue + "/" + elem.getStrTarget(); + } else if (sKey.matches("PKG_CONFIG_PATH")) { + sValue = elem.getStrSysrootLoc(); + targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); + targetFile = new File(targetFilePath); + if (targetFile.exists()) + sValue = sValue + "/" + elem.getStrTarget(); + sValue = sValue + "/usr/lib/pkgconfig"; + } + // env.addVariable(sKey, elem.getStrSysrootLoc(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + /* + else if (sKey.matches("PKG_CONFIG_PATH")) + env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget()+"/usr/lib/pkgconfig", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + //env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + else if (sKey.matches("PKG_CONFIG_SYSROOT_DIR")) + env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + */ + env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); + } + //add ACLOCAL OPTS for libtool 2.4 support + env.addVariable("OECORE_ACLOCAL_OPTS", + "-I " + env.getVariable(NATIVE_SYSROOT, ccdesc).getValue() + "/usr/share/aclocal", + IEnvironmentVariable.ENVVAR_REPLACE, + delimiter, + ccdesc); + return; + + } + + private static String getEnvironmentSetupFileFullPath(YoctoUIElement elem) { + String envSetupFile = ""; + + if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { + envSetupFile = elem.getStrToolChainRoot() + "/"; + } else { + //POKY TREE Mode + envSetupFile = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX; + } + envSetupFile += YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); + return envSetupFile; + } + + private static HashMap parseEnvScript(String sFileName) { + try { + HashMap envMap = new HashMap(); + File file = new File(sFileName); + + if (file.exists()) { + BufferedReader input = new BufferedReader(new FileReader(file)); + + try { + String line = null; + + while ((line = input.readLine()) != null) { + if (!line.startsWith("export")) { + continue; + } + String sKey = line.substring("export".length() + 1, line.indexOf('=')); + String sValue = line.substring(line.indexOf('=') + 1); + if (sValue.startsWith("\"") && sValue.endsWith("\"")) + sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"')); + /* If PATH ending with $PATH, we need to join with current system path */ + if (sKey.equalsIgnoreCase("PATH")) { + if (sValue.lastIndexOf("$PATH") >= 0) + sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH"); + } + envMap.put(sKey, sValue); + System.out.printf("get env key %s value %s\n", sKey, sValue); + } + } finally { + input.close(); + } + } + + return envMap; + + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public static void setEnvironmentVariables(IProject project, YoctoUIElement elem) { + ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); + + String sFileName = getEnvironmentSetupFileFullPath(elem); + HashMap envMap = parseEnvScript(sFileName); + + setEnvVars(cpdesc, elem, envMap); + try { + CoreModel.getDefault().setProjectDescription(project,cpdesc); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + public static void createRemoteDebugAndQemuLaunchers(IProject project, YoctoUIElement elem) throws YoctoGeneralException { + ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager(); + ILaunchConfigurationType configType = + lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"); + ILaunchConfigurationType debug_configType = + lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType"); + + String sPath = getEnvValue(project, "PATH"); + String sDebugName = getEnvValue(project, "GDB"); + String sysroot_str = elem.getStrSysrootLoc(); + + if (configType == null || debug_configType == null) { + throw new YoctoGeneralException("Failed to get program or remote debug launcher!"); + } + createRemoteDebugLauncher(project, lManager, debug_configType, elem.getStrTarget(), sPath, sDebugName, sysroot_str); + + ArrayList listValue = new ArrayList(); + listValue.add(new String("org.eclipse.ui.externaltools.launchGroup")); + + if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { + String sFileName = getEnvironmentSetupFileFullPath(elem); + createQemuLauncher(project, configType, listValue, sFileName, elem); + } + } + + protected static void createRemoteDebugLauncher(IProject project, + ILaunchManager lManager, ILaunchConfigurationType configType, + String sTargetTriplet, String strPath, String sDebugName, String sSysroot) { + try { + + String sDebugSubDir = DEFAULT_USR_BIN + sTargetTriplet; + StringTokenizer token = new StringTokenizer(strPath, ":"); + String strDebugger = ""; + while (token.hasMoreTokens()) + { + String sTemp = token.nextToken(); + if (sTemp.endsWith(sDebugSubDir)) { + strDebugger = sTemp + "/" + sDebugName; + break; + } + } + if (strDebugger.isEmpty()) + return; + //If get default Debugger successfully, go ahead! + + //create the gdbinit file + String sDebugInitFile = project.getLocation().toString() + "/.gdbinit"; + FileWriter out = new FileWriter(new File(sDebugInitFile)); + out.write("set sysroot " + sSysroot); + out.flush(); + out.close(); + + //set the launch configuration + String projectName = project.getName(); + String configName = projectName+"_gdb_"+sTargetTriplet; + int i; + ILaunchConfiguration[] configs=lManager.getLaunchConfigurations(configType); + for(i=0; i modes=new HashSet(); + modes.add("debug"); + w_copy.setPreferredLaunchDelegate(modes, "org.eclipse.rse.remotecdt.launch"); + w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile); + w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false); + w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger); + w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); + //TWEAK avoid loading default values in org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab + w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true); + w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName); + if (!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID)) { + String pathToCompiledBinary = ""; + if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) { + pathToCompiledBinary = "Debug/"; + } else { + pathToCompiledBinary = "src/"; + } + pathToCompiledBinary += projectName; + w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, pathToCompiledBinary); + } + + w_copy.doSave(); + } + catch (CoreException e) + { + System.out.println(e.getMessage()); + } + catch (IOException e) + { + System.out.println("Failed to generate debug init file!"); + System.out.println(e.getMessage()); + } + } + + protected static void createQemuLauncher(IProject project, + ILaunchConfigurationType configType, + ArrayList listValue, String sScriptFile, + YoctoUIElement elem) { + try { + + ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "qemu_"+elem.getStrTarget()); + + w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue); + w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm"); + + String argument = "-e \"source " + sScriptFile + ";runqemu " + qemuTargetTranslate(elem.getStrTarget()) + " " + + elem.getStrQemuKernelLoc() + " " + elem.getStrSysrootLoc() + " " + elem.getStrQemuOption() + ";bash\""; + + w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument); + w_copy.doSave(); + } catch (CoreException e) { + } + + } + + private static String qemuTargetTranslate(String strTargetArch) { + String qemu_target = ""; + if (strTargetArch.indexOf("i586") != -1) { + qemu_target = "qemux86"; + } else if (strTargetArch.indexOf("x86_64") != -1) { + qemu_target = "qemux86-64"; + } else if (strTargetArch.indexOf("arm") != -1) { + qemu_target = "qemuarm"; + } else if (strTargetArch.indexOf("mips") != -1) { + qemu_target = "qemumips"; + } else if (strTargetArch.indexOf("ppc") != -1) { + qemu_target = "qemuppc"; + } + return qemu_target; + } + + /* Get IDE wide POKY Preference settings from a specific preference store */ + public static YoctoUIElement getElemFromStore(IPreferenceStore store) { + YoctoUIElement elem = new YoctoUIElement(); + if (store.getString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE)) + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); + else + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); + + elem.setStrToolChainRoot(store.getString(PreferenceConstants.TOOLCHAIN_ROOT)); + elem.setStrTarget(store.getString(PreferenceConstants.TOOLCHAIN_TRIPLET)); + elem.setIntTargetIndex(store.getInt(PreferenceConstants.TARGET_ARCH_INDEX)); + elem.setStrQemuKernelLoc(store.getString(PreferenceConstants.QEMU_KERNEL)); + elem.setStrQemuOption(store.getString(PreferenceConstants.QEMU_OPTION)); + elem.setStrSysrootLoc(store.getString(PreferenceConstants.SYSROOT)); + + if (store.getString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE)) + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); + else + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); + + return elem; + } + + /* Get default POKY Preference settings from the default preference store */ + public static YoctoUIElement getDefaultElemFromDefaultStore() + { + IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore(); + YoctoUIElement elem = new YoctoUIElement(); + if (store.getDefaultString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE)) + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); + else + elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); + + elem.setStrToolChainRoot(store.getDefaultString(PreferenceConstants.TOOLCHAIN_ROOT)); + elem.setStrTarget(store.getDefaultString(PreferenceConstants.TOOLCHAIN_TRIPLET)); + elem.setIntTargetIndex(store.getDefaultInt(PreferenceConstants.TARGET_ARCH_INDEX)); + elem.setStrQemuKernelLoc(store.getDefaultString(PreferenceConstants.QEMU_KERNEL)); + elem.setStrQemuOption(store.getDefaultString(PreferenceConstants.QEMU_OPTION)); + elem.setStrSysrootLoc(store.getDefaultString(PreferenceConstants.SYSROOT)); + + if (store.getDefaultString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE)) + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); + else + elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); + + return elem; + } + + /* Save profiles and selected profile to the default preference store */ + public static void saveProfilesToDefaultStore(YoctoProfileElement profileElement) { + saveProfilesToStore(profileElement, YoctoSDKPlugin.getDefault().getPreferenceStore()); + } + + /* Save profiles and selected profile to a specific preference store */ + private static void saveProfilesToStore(YoctoProfileElement profileElement, IPreferenceStore store) { + store.setValue(PreferenceConstants.PROFILES, profileElement.getProfilesAsString()); + store.setValue(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile()); + } + + /* Get profiles and selected profile from the default preference store */ + public static YoctoProfileElement getProfilesFromDefaultStore() + { + return getProfilesFromStore(YoctoSDKPlugin.getDefault().getPreferenceStore()); + } + + /* Get profiles and selected profile from a specific preference store */ + private static YoctoProfileElement getProfilesFromStore(IPreferenceStore store) { + String profiles = store.getString(PreferenceConstants.PROFILES); + String selectedProfile = store.getString(PreferenceConstants.SELECTED_PROFILE); + + return new YoctoProfileElement(profiles, selectedProfile); + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java new file mode 100644 index 0000000..65dfce8 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2013 BMW Car IT GmbH. + * 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: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.utils; + +public class YoctoSDKUtilsConstants { + + public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-"; + public static final String DEFAULT_TMP_PREFIX = "/tmp/"; + public static final String PROJECT_SCOPE = "org.yocto.sdk.ide"; +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java new file mode 100644 index 0000000..f467dac --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) 2012 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.wizard; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.process.ProcessArgument; +import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; +import org.eclipse.cdt.core.templateengine.process.ProcessRunner; +import org.eclipse.cdt.core.templateengine.process.processes.Messages; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.yocto.sdk.ide.YoctoSDKMessages; +import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; + +public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner { + + public static final String CHMOD_COMMAND = "chmod +x "; //$NON-NLS-1$ + public static final String AUTOGEN_SCRIPT_NAME = "autogen.sh"; //$NON-NLS-1$ + + public NewYoctoAutotoolsProjectPostProcess() {} + + public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException { + + String projectName = args[0].getSimpleValue(); + + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + try { + if (!project.exists()) { + throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$ + } else if (!project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) { + throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + //$NON-NLS-1$ + YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.WrongProjectNature", //$NON-NLS-1$ + projectName)); + } else { + IPath path = project.getLocation(); + String path_str = path.toString(); + String autogen_cmd = CHMOD_COMMAND + path_str + File.separator + AUTOGEN_SCRIPT_NAME; + try { + Runtime rt = Runtime.getRuntime(); + Process proc = rt.exec(autogen_cmd); + InputStream stdin = proc.getInputStream(); + InputStreamReader isr = new InputStreamReader(stdin); + BufferedReader br = new BufferedReader(isr); + String line = null; + String error_message = ""; //$NON-NLS-1$ + + while ( (line = br.readLine()) != null) { + error_message = error_message + line; + } + + int exitVal = proc.waitFor(); + if (exitVal != 0) { + throw new ProcessFailureException( + YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.ChmodFailure", //$NON-NLS-1$ + projectName)); + } + } catch (Throwable t) { + t.printStackTrace(); + + } + } + } catch (Exception e) { + throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$ + } + } +} diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java new file mode 100644 index 0000000..d8c1232 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java @@ -0,0 +1,270 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide.wizard; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.process.ProcessArgument; +import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; +import org.eclipse.cdt.core.templateengine.process.ProcessRunner; +import org.eclipse.cdt.core.templateengine.process.processes.Messages; +import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; +import org.eclipse.cdt.make.core.MakeCorePlugin; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo; +import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry; +import org.eclipse.cdt.managedbuilder.core.BuildException; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.IOption; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.templateengine.ProjectCreatedActions; +import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.cdt.ui.wizards.CDTMainWizardPage; +import org.eclipse.cdt.internal.ui.wizards.ICDTCommonProjectWizard; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.preference.IPreferenceStore; +import org.yocto.sdk.ide.YoctoGeneralException; +import org.yocto.sdk.ide.YoctoProfileElement; +import org.yocto.sdk.ide.YoctoSDKChecker; +import org.yocto.sdk.ide.YoctoSDKMessages; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoUIElement; +import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; +import org.yocto.sdk.ide.natures.YoctoSDKNatureUtils; +import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; +import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; +import org.yocto.sdk.ide.utils.YoctoSDKUtils; + +@SuppressWarnings("restriction") +public class NewYoctoProjectTemplateProcess extends ProcessRunner { + protected boolean savedAutoBuildingValue; + protected ProjectCreatedActions pca; + protected IManagedBuildInfo info; + protected List illegalChars = Arrays.asList('$', '"','#','%','&','\'','(',')','*', '+', ',','.','/',':',';','<','=','>','?','@','[','\\',']','^','`','{','|','}','~'); + private static final String PROJECT_NAME_ERROR = "Wizard.SDK.Error.ProjectName"; + + private boolean isCProject; + private boolean isEmptyProject; + private boolean isAutotoolsProject; + private boolean isCMakeProject; + + public NewYoctoProjectTemplateProcess() { + pca = new ProjectCreatedActions(); + + isCProject = false; + isEmptyProject = false; + isAutotoolsProject = false; + isCMakeProject = false; + } + + private String printIllegalChars(){ + String print = ""; + for (Character ch : illegalChars) + print += ch + ", "; + print = print.substring(0, print.length() - 2); + return print; + } + + public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException { + + String projectName = args[0].getSimpleValue(); + String location = args[1].getSimpleValue(); + String artifactExtension = args[2].getSimpleValue(); + String isCProjectValue = args[3].getSimpleValue(); + String isEmptyProjetValue = args[4].getSimpleValue(); + String isAutotoolsProjectValue = args[5].getSimpleValue(); + String isCMakeProjectValue = args[6].getSimpleValue(); + + isCProject = Boolean.valueOf(isCProjectValue).booleanValue(); + isEmptyProject = Boolean.valueOf(isEmptyProjetValue).booleanValue(); + isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue(); + isCMakeProject = Boolean.valueOf(isCMakeProjectValue).booleanValue(); + + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + try { + if (!isValidProjectName(projectName)) { + + IWizardPage[] pages = MBSCustomPageManager.getPages(); + if(pages != null && pages.length > 0) { + CDTMainWizardPage cdtMainPage = (CDTMainWizardPage)pages[0]; + cdtMainPage.setPageComplete(false); + ICDTCommonProjectWizard wizard = (ICDTCommonProjectWizard) pages[0].getWizard(); + wizard.performCancel(); + + project.delete(true, null); + } + throw new ProcessFailureException(YoctoSDKMessages.getFormattedString(PROJECT_NAME_ERROR, new Object[]{projectName, printIllegalChars()})); + } + + if (!project.exists()) { + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + turnOffAutoBuild(workspace); + + IPath locationPath = null; + if (location != null && !location.trim().equals("")) { //$NON-NLS-1$ + locationPath = Path.fromPortableString(location); + } + + List configs = template.getTemplateInfo().getConfigurations(); + + if (configs == null || configs.size() == 0) { + throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$ + } + + pca.setProject(project); + pca.setProjectLocation(locationPath); + pca.setConfigs((IConfiguration[]) configs.toArray(new IConfiguration[configs.size()])); + pca.setArtifactExtension(artifactExtension); + info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject); + + addNatures(project, false, monitor); + + info.setValid(true); + ManagedBuildManager.saveBuildInfo(project, true); + + restoreAutoBuild(workspace); + } else { + + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + turnOffAutoBuild(workspace); + + YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid(); + + addNatures(project, true, monitor); + + //restoreAutoBuild(workspace); + IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager(); + IDiscoveredPathInfo pathInfo = manager.getDiscoveredInfo(project); + + if (pathInfo instanceof IPerProjectDiscoveredPathInfo) { + IPerProjectDiscoveredPathInfo projectPathInfo = + (IPerProjectDiscoveredPathInfo) pathInfo; + projectPathInfo.setIncludeMap(new LinkedHashMap()); + projectPathInfo.setSymbolMap(new LinkedHashMap()); + manager.removeDiscoveredInfo(project); + } + } + } + catch (CoreException e) + { + throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$ + } + catch (BuildException e) + { + throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$ + } + catch (YoctoGeneralException e) + { + try { + project.delete(true, monitor); + } catch (CoreException err) { + throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage() //$NON-NLS-1$ + + " " + err.getMessage()); //$NON-NLS-1$ + } + throw new OperationCanceledException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$ + } + } + + private boolean isValidProjectName(String projectName) { + Pattern pattern = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_\\-]*$"); //$NON-NLS-1$ + Matcher matcher = pattern.matcher(projectName); + return matcher.find(); + } + + private void addNatures(IProject project, boolean projectExists, IProgressMonitor monitor) + throws CoreException, YoctoGeneralException { + YoctoSDKNatureUtils.addNature(project, YoctoSDKProjectNature.YoctoSDK_NATURE_ID, monitor); + + YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid(); + + YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); + ProjectPreferenceUtils.saveProfiles(profileElement, project); + + IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile()); + YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore); + YoctoSDKUtils.setEnvironmentVariables(project, elem); + + if (isEmptyProject) { + YoctoSDKNatureUtils.addNature(project, YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID, monitor); + } + + if (isAutotoolsProject) { + AutotoolsNewProjectNature.addAutotoolsNature(project, monitor); + + if (!projectExists) { + // For each IConfiguration, create a corresponding Autotools Configuration + for (IConfiguration cfg : pca.getConfigs()) { + AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true); + } + AutotoolsConfigurationManager.getInstance().saveConfigs(project); + } + + YoctoSDKNatureUtils.addNature(project, YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID, monitor); + YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project); + } else if (isCMakeProject) { + YoctoSDKNatureUtils.addNature(project, YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID, monitor); + YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project); + } + + YoctoSDKUtils.createRemoteDebugAndQemuLaunchers(project, elem); + } + + protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException { + IWorkspaceDescription workspaceDesc = workspace.getDescription(); + savedAutoBuildingValue = workspaceDesc.isAutoBuilding(); + workspaceDesc.setAutoBuilding(false); + workspace.setDescription(workspaceDesc); + } + + protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException { + IWorkspaceDescription workspaceDesc = workspace.getDescription(); + workspaceDesc.setAutoBuilding(savedAutoBuildingValue); + workspace.setDescription(workspaceDesc); + } + + /** + * setOptionValue + * @param config + * @param option + * @param val + * @throws BuildException + */ + protected void setOptionValue(IConfiguration config, IOption option, String val) throws BuildException { + if (val != null) { + if (!option.isExtensionElement()) { + option.setValue(val); + } else { + IOption newOption = config.getToolChain().createOption(option, option.getId() + "." + ManagedBuildManager.getRandomNumber(), option.getName(), false); //$NON-NLS-1$ + newOption.setValue(val); + } + } + } +} diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties new file mode 100644 index 0000000..c7e7867 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties @@ -0,0 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - Initial implementation + *******************************************************************************/ + +#Template Default Values +EmptyProject.template.label=Empty C Autotools Project +EmptyProject.template.description=An empty C Yocto Project autotools project template diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml new file mode 100644 index 0000000..e1c1abc --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml @@ -0,0 +1,17 @@ + + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties new file mode 100644 index 0000000..416e2ef --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties @@ -0,0 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - Initial implementation + *******************************************************************************/ + +#Template Default Values +EmptyProject.template.label=Empty C++ Autotools Project +EmptyProject.template.description=An empty CPP Yocto Project autotools project template diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml new file mode 100644 index 0000000..9f1d46b --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml @@ -0,0 +1,16 @@ + + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c new file mode 100644 index 0000000..862467a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c @@ -0,0 +1,9 @@ + + +#include +#include + +int main(void) { + puts("Hello World"); /* prints Hello World */ + return 0; +} diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src new file mode 100644 index 0000000..e96420f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=@VERSION@ +Encoding=UTF-8 +Name=$(projectName) +Comment=A "$(message)" +Type=Application +Categories=Application +Exec=$(projectName) +Name[en_US]=$(message) diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL new file mode 100644 index 0000000..b8b0535 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL @@ -0,0 +1,9 @@ +Building: + $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr] + $ make + +Installing: + $ sudo make install + +Running: + $ $(projectName) \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src new file mode 100644 index 0000000..fc3bc8c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src @@ -0,0 +1,8 @@ + +bin_PROGRAMS = $(projectName) +$(projectName)_SOURCES = $(projectName).c + +AM_CFLAGS = @$(projectName)_CFLAGS@ +AM_LDFLAGS = @$(projectName)_LIBS@ + +CLEANFILES = *~ diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top new file mode 100644 index 0000000..7bee2b7 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top @@ -0,0 +1,7 @@ +SUBDIRS = $(sourceDir) + +MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \ + config.sub configure depcomp install-sh \ + ltmain.sh Makefile.in missing + + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README new file mode 100644 index 0000000..ec15541 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README @@ -0,0 +1,25 @@ +$(projectName) +Copyright (C) $(copyright). + +Brief description of project.... + +----------------------------------------------------------------------------- + Build +----------------------------------------------------------------------------- +$ ./autogen.sh $CONFIGURE_FLAGS +$ make + +----------------------------------------------------------------------------- + Build with documentation generated (usually for libraries) +----------------------------------------------------------------------------- +$ ./autogen.sh --enable-gtk-doc +$ make + +( If built with the --enable-gtk-doc flag above you can view the index.html + file in your web browser. ) +$ firefox ./docs/reference/index.html + +----------------------------------------------------------------------------- + Install +----------------------------------------------------------------------------- +$ sudo make install diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh new file mode 100755 index 0000000..7fd81e2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh @@ -0,0 +1,10 @@ +#! /bin/sh +[ -e config.cache ] && rm -f config.cache + +libtoolize --automake +aclocal ${OECORE_ACLOCAL_OPTS} +autoconf +autoheader +automake -a +./configure $@ +exit diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top new file mode 100644 index 0000000..234ab99 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top @@ -0,0 +1,37 @@ +AC_PREREQ(2.61) + +# package version number (not shared library version) +# odd micro numbers indicate in-progress development +# even micro numbers indicate released versions +m4_define($(projectName)_version_major, 0) +m4_define($(projectName)_version_minor, 1) +m4_define($(projectName)_version_micro, 0) + +m4_define([$(projectName)_version], + [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) +m4_define([$(projectName)_api_version], + [$(projectName)_version_major.$(projectName)_version_minor]) + +AC_INIT($(projectName), $(projectName)_version) +AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) +AC_CONFIG_HEADERS(config.h) + +# Checks for programs. +AC_PROG_LIBTOOL +AM_PROG_CC_C_O +AC_PROG_INSTALL + +AC_SUBST($(projectName)_CFLAGS) +AC_SUBST($(projectName)_LIBS) + +AC_OUTPUT([ +Makefile +$(sourceDir)/Makefile +]) + +echo "" +echo " $(projectName) $VERSION" +echo " =====================" +echo "" +echo " To build the project, run \"make\"" +echo "" diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties new file mode 100644 index 0000000..12830ea --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties @@ -0,0 +1,28 @@ +############################################################################### +# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Bala Torati (Symbian) - initial API and implementation +# Red Hat Inc - modification to use with Autotools project +############################################################################### + +#Template Default Values +HelloWorld.CAnsitemplate.label=Hello World ANSI C Autotools Project +HelloWorld.CAnsitemplate.description=A skeletal C Hello World project. Creates a folder for sources and autogen artifacts. +HelloWorld.basics.label=Basic Settings +HelloWorld.basics.description=Basic properties of a project +HelloWorld.author.label=Author +HelloWorld.author.description=Name of the author +HelloWorld.copyright.label=Copyright notice +HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation) +HelloWorld.copyright.default=Your copyright +HelloWorld.message.default=Hello World +HelloWorld.message.description=Your hello world greeting message +HelloWorld.message.label=Hello world greeting +HelloWorld.sourceDir.label=Source +HelloWorld.sourceDir.description=Directory for hello world project source files +HelloWorld.sourceDir.default=src diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml new file mode 100644 index 0000000..ca154ca --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml @@ -0,0 +1,143 @@ + + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c new file mode 100644 index 0000000..e40fd64 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c @@ -0,0 +1,50 @@ +#include + +static void +hello (GtkWidget * widget, gpointer data) +{ + g_print ("Hello World!\n"); +} + +static gboolean +delete_event (GtkWidget * widget, GdkEvent * event, gpointer data) +{ + g_print ("delete event occurred\n"); + return TRUE; +} + +static void +destroy (GtkWidget * widget, gpointer data) +{ + gtk_main_quit (); +} + +int +main (int argc, char *argv[]) +{ + GtkWidget *window; + GtkWidget *button; + + gtk_init (&argc, &argv); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + + g_signal_connect (G_OBJECT (window), "delete_event", + G_CALLBACK (delete_event), NULL); + g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL); + + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + button = gtk_button_new_with_label ("Hello World!"); + + g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (hello), NULL); + g_signal_connect_swapped (G_OBJECT (button), "clicked", + G_CALLBACK (gtk_widget_destroy), + G_OBJECT (window)); + + gtk_container_add (GTK_CONTAINER (window), button); + gtk_widget_show (button); + gtk_widget_show (window); + + gtk_main (); + + return 0; +} diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src new file mode 100644 index 0000000..e96420f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=@VERSION@ +Encoding=UTF-8 +Name=$(projectName) +Comment=A "$(message)" +Type=Application +Categories=Application +Exec=$(projectName) +Name[en_US]=$(message) diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL new file mode 100644 index 0000000..b8b0535 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL @@ -0,0 +1,9 @@ +Building: + $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr] + $ make + +Installing: + $ sudo make install + +Running: + $ $(projectName) \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src new file mode 100644 index 0000000..5ac2885 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src @@ -0,0 +1,8 @@ + +bin_PROGRAMS = $(projectName) +$(projectName)_SOURCES = $(projectName).c + +AM_CFLAGS = @$(projectName)_CFLAGS@ +AM_LDFLAGS = @$(projectName)_LIBS@ + +CLEANFILES = *~ diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top new file mode 100644 index 0000000..7bee2b7 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top @@ -0,0 +1,7 @@ +SUBDIRS = $(sourceDir) + +MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \ + config.sub configure depcomp install-sh \ + ltmain.sh Makefile.in missing + + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README new file mode 100644 index 0000000..ec15541 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README @@ -0,0 +1,25 @@ +$(projectName) +Copyright (C) $(copyright). + +Brief description of project.... + +----------------------------------------------------------------------------- + Build +----------------------------------------------------------------------------- +$ ./autogen.sh $CONFIGURE_FLAGS +$ make + +----------------------------------------------------------------------------- + Build with documentation generated (usually for libraries) +----------------------------------------------------------------------------- +$ ./autogen.sh --enable-gtk-doc +$ make + +( If built with the --enable-gtk-doc flag above you can view the index.html + file in your web browser. ) +$ firefox ./docs/reference/index.html + +----------------------------------------------------------------------------- + Install +----------------------------------------------------------------------------- +$ sudo make install diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh new file mode 100755 index 0000000..7fd81e2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh @@ -0,0 +1,10 @@ +#! /bin/sh +[ -e config.cache ] && rm -f config.cache + +libtoolize --automake +aclocal ${OECORE_ACLOCAL_OPTS} +autoconf +autoheader +automake -a +./configure $@ +exit diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top new file mode 100644 index 0000000..508bc13 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top @@ -0,0 +1,49 @@ +AC_PREREQ(2.61) + +# package version number (not shared library version) +# odd micro numbers indicate in-progress development +# even micro numbers indicate released versions +m4_define($(projectName)_version_major, 0) +m4_define($(projectName)_version_minor, 1) +m4_define($(projectName)_version_micro, 0) + +m4_define([$(projectName)_version], + [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) +m4_define([$(projectName)_api_version], + [$(projectName)_version_major.$(projectName)_version_minor]) + +AC_INIT($(projectName), $(projectName)_version) +AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) +AC_CONFIG_HEADERS(config.h) + +# Checks for programs. +AC_PROG_LIBTOOL +AM_PROG_CC_C_O +AC_PROG_INSTALL + +#enable pkg-config +PKG_PROG_PKG_CONFIG + +#GTK_REQUIRED_VERSION=2.0.0 +#GLIB_REQUIRED_VERSION=$GTK_REQUIRED_VERSION + +#AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION,, +# [AC_MSG_ERROR(Test for GLib failed.)], gobject) +#AM_PATH_GTK_2_0($GTK_REQUIRED_VERSION,, +# [AC_MSG_ERROR(Test for GTK failed.)]) +PKG_CHECK_MODULES($(projectName), glib-2.0 gtk+-2.0) + +AC_SUBST($(projectName)_CFLAGS) +AC_SUBST($(projectName)_LIBS) + +AC_OUTPUT([ +Makefile +$(sourceDir)/Makefile +]) + +echo "" +echo " $(projectName) $VERSION" +echo " =====================" +echo "" +echo " To build the project, run \"make\"" +echo "" diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old new file mode 100644 index 0000000..234ab99 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old @@ -0,0 +1,37 @@ +AC_PREREQ(2.61) + +# package version number (not shared library version) +# odd micro numbers indicate in-progress development +# even micro numbers indicate released versions +m4_define($(projectName)_version_major, 0) +m4_define($(projectName)_version_minor, 1) +m4_define($(projectName)_version_micro, 0) + +m4_define([$(projectName)_version], + [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) +m4_define([$(projectName)_api_version], + [$(projectName)_version_major.$(projectName)_version_minor]) + +AC_INIT($(projectName), $(projectName)_version) +AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) +AC_CONFIG_HEADERS(config.h) + +# Checks for programs. +AC_PROG_LIBTOOL +AM_PROG_CC_C_O +AC_PROG_INSTALL + +AC_SUBST($(projectName)_CFLAGS) +AC_SUBST($(projectName)_LIBS) + +AC_OUTPUT([ +Makefile +$(sourceDir)/Makefile +]) + +echo "" +echo " $(projectName) $VERSION" +echo " =====================" +echo "" +echo " To build the project, run \"make\"" +echo "" diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties new file mode 100644 index 0000000..430c04d --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties @@ -0,0 +1,28 @@ +############################################################################### +# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Bala Torati (Symbian) - initial API and implementation +# Red Hat Inc - modification to use with Autotools project +############################################################################### + +#Template Default Values +HelloWorld.CAnsitemplate.label=Hello World GTK C Autotools Project +HelloWorld.CAnsitemplate.description=A skeletal C GTK Hello World project. Creates a folder for sources and autogen artifacts. +HelloWorld.basics.label=Basic Settings +HelloWorld.basics.description=Basic properties of a project +HelloWorld.author.label=Author +HelloWorld.author.description=Name of the author +HelloWorld.copyright.label=Copyright notice +HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation) +HelloWorld.copyright.default=Your copyright +HelloWorld.message.default=Hello World +HelloWorld.message.description=Your hello world greeting message +HelloWorld.message.label=Hello world greeting +HelloWorld.sourceDir.label=Source +HelloWorld.sourceDir.description=Directory for hello world project source files +HelloWorld.sourceDir.default=src diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml new file mode 100644 index 0000000..4234ff4 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml @@ -0,0 +1,142 @@ + + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp new file mode 100644 index 0000000..986dd35 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp @@ -0,0 +1,11 @@ + + +#include + +using namespace std; + +int main(void) { + cout << "Hello World" << endl; /* prints Hello World */ + return 0; +} + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL new file mode 100644 index 0000000..b8b0535 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL @@ -0,0 +1,9 @@ +Building: + $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr] + $ make + +Installing: + $ sudo make install + +Running: + $ $(projectName) \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src new file mode 100644 index 0000000..1ea3308 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src @@ -0,0 +1,8 @@ + +bin_PROGRAMS = $(projectName) +$(projectName)_SOURCES = $(projectName).cpp + +AM_CXXFLAGS = @$(projectName)_CFLAGS@ +AM_LDFLAGS = @$(projectName)_LIBS@ + +CLEANFILES = *~ diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top new file mode 100644 index 0000000..6060599 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top @@ -0,0 +1,6 @@ +EXTRA_DIST = autogen.sh +SUBDIRS = $(sourceDir) + +DISTCHECK_CONFIGURE_FLAGS= + +CLEANFILES = *~ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README new file mode 100644 index 0000000..ec15541 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README @@ -0,0 +1,25 @@ +$(projectName) +Copyright (C) $(copyright). + +Brief description of project.... + +----------------------------------------------------------------------------- + Build +----------------------------------------------------------------------------- +$ ./autogen.sh $CONFIGURE_FLAGS +$ make + +----------------------------------------------------------------------------- + Build with documentation generated (usually for libraries) +----------------------------------------------------------------------------- +$ ./autogen.sh --enable-gtk-doc +$ make + +( If built with the --enable-gtk-doc flag above you can view the index.html + file in your web browser. ) +$ firefox ./docs/reference/index.html + +----------------------------------------------------------------------------- + Install +----------------------------------------------------------------------------- +$ sudo make install diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh new file mode 100755 index 0000000..7fd81e2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh @@ -0,0 +1,10 @@ +#! /bin/sh +[ -e config.cache ] && rm -f config.cache + +libtoolize --automake +aclocal ${OECORE_ACLOCAL_OPTS} +autoconf +autoheader +automake -a +./configure $@ +exit diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top new file mode 100644 index 0000000..5cc622b --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top @@ -0,0 +1,47 @@ +AC_PREREQ(2.61) + +# package version number (not shared library version) +# odd micro numbers indicate in-progress development +# even micro numbers indicate released versions +m4_define($(projectName)_version_major, 0) +m4_define($(projectName)_version_minor, 1) +m4_define($(projectName)_version_micro, 0) + +m4_define([$(projectName)_version], + [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) +m4_define([$(projectName)_api_version], + [$(projectName)_version_major.$(projectName)_version_minor]) + +AC_INIT($(projectName), $(projectName)_version) +AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) +AC_CONFIG_HEADERS(config.h) + +# Checks for programs. +AC_PROG_LIBTOOL +AC_PROG_CXX +AC_PROG_INSTALL + +# enable pkg-config +PKG_PROG_PKG_CONFIG + +# Checks for library functions. +#AC_CHECK_FUNCS([memset]) + +AC_SUBST($(projectName)_CFLAGS) +AC_SUBST($(projectName)_LIBS) + + +#icondir=${datadir}/icons/hicolor/32x32/apps +#AC_SUBST(icondir) + +AC_OUTPUT([ +Makefile +$(sourceDir)/Makefile +]) + +echo "" +echo " $(projectName) $VERSION" +echo " =====================" +echo "" +echo " To build the project, run \"make\"" +echo "" diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties new file mode 100644 index 0000000..0534ca6 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties @@ -0,0 +1,28 @@ +############################################################################### +# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Bala Torati (Symbian) - initial API and implementation +# Red Hat Inc - modification to use with Autotools project +############################################################################### + +#Template Default Values +HelloWorld.CCtemplate.label= Hello World C++ Autotools Project +HelloWorld.CCtemplate.description=A skeletal C++ Hello World project. Creates a folder for sources and autogen artifacts. +HelloWorld.basics.label=Basic Settings +HelloWorld.basics.description=Basic properties of a project +HelloWorld.author.label=Author +HelloWorld.author.description=Name of the author +HelloWorld.copyright.label=Copyright notice +HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation) +HelloWorld.copyright.default=Your copyright notice +HelloWorld.message.default=Hello World +HelloWorld.message.description=Your hello world greeting message +HelloWorld.message.label=Hello world greeting +HelloWorld.sourceDir.label=Source +HelloWorld.sourceDir.description=Directory for hello world project source files +HelloWorld.sourceDir.default=src diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml new file mode 100644 index 0000000..2bf76bf --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml @@ -0,0 +1,142 @@ + + diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS new file mode 100644 index 0000000..9d38b85 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS @@ -0,0 +1 @@ +$(author) diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD new file mode 100644 index 0000000..064c1cc --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD @@ -0,0 +1,24 @@ +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of PG_ORGANIZATION nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2 new file mode 100644 index 0000000..c6eecf2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2 @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later new file mode 100644 index 0000000..0f70665 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3 new file mode 100644 index 0000000..20d40b6 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1 new file mode 100644 index 0000000..fc3ffda --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1 @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3 new file mode 100644 index 0000000..3f9959f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3 @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT new file mode 100644 index 0000000..d827307 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT @@ -0,0 +1,19 @@ +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other new file mode 100644 index 0000000..54c4590 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD new file mode 100644 index 0000000..14bdd06 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD @@ -0,0 +1,29 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the PG_ORGANIZATION nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS-IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2 new file mode 100644 index 0000000..591c14e --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2 @@ -0,0 +1,19 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later new file mode 100644 index 0000000..0dae49f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later @@ -0,0 +1,21 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv3 new file mode 100644 index 0000000..c7953e5 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv3 @@ -0,0 +1,19 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.1 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.1 new file mode 100644 index 0000000..40a9603 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.1 @@ -0,0 +1,20 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv3 new file mode 100644 index 0000000..2581a03 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv3 @@ -0,0 +1,20 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 3 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT new file mode 100644 index 0000000..0ee5519 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT @@ -0,0 +1,24 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other new file mode 100644 index 0000000..1f28ac0 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other @@ -0,0 +1,9 @@ +/* + * Copyright (C) $(copyright). + * + * Author: $(author) + * + * + * Your desired license + * + */ \ No newline at end of file diff --git a/plugins/org.yocto.sdk.remotetools/.classpath b/plugins/org.yocto.sdk.remotetools/.classpath new file mode 100644 index 0000000..da264cc --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/plugins/org.yocto.sdk.remotetools/.project b/plugins/org.yocto.sdk.remotetools/.project new file mode 100644 index 0000000..6a68bf4 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/.project @@ -0,0 +1,28 @@ + + + org.yocto.sdk.remotetools + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..9b2f22e --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Aug 11 12:07:02 CST 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF b/plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5147c1a --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.yocto.sdk.remotetools; singleton:=true +Bundle-Version: 1.4.0.qualifier +Bundle-Activator: org.yocto.sdk.remotetools.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.rse.core;bundle-version="3.0.0", + org.yocto.sdk.ide, + org.eclipse.rse.terminals.ui;bundle-version="1.0.100", + org.eclipse.cdt;bundle-version="7.0.0", + org.eclipse.linuxtools.tmf.core;bundle-version="0.4.0", + org.eclipse.ui.ide;bundle-version="3.8.0", + org.eclipse.ui.console;bundle-version="3.5.100" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Import-Package: org.eclipse.core.resources, + org.eclipse.debug.internal.ui, + org.eclipse.rse.shells.ui, + org.eclipse.rse.ui.actions, + org.eclipse.tm.internal.terminal.control, + org.eclipse.tm.internal.terminal.control.actions, + org.eclipse.tm.internal.terminal.provisional.api, + org.eclipse.ui.forms.widgets, + org.yocto.remote.utils +Bundle-Vendor: %Bundle-Vendor +Bundle-ClassPath: lib/json-simple-1.1.1.jar, + . diff --git a/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties new file mode 100644 index 0000000..01de146 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties @@ -0,0 +1,5 @@ +#Generated by org.apache.felix.bundleplugin +#Sun Feb 19 14:30:57 CST 2012 +version=1.1.1 +groupId=com.googlecode.json-simple +artifactId=json-simple diff --git a/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml new file mode 100644 index 0000000..eaa330d --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + com.googlecode.json-simple + json-simple + bundle + JSON.simple + 1.1.1 + A simple Java toolkit for JSON + http://code.google.com/p/json-simple/ + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + Yidong + Yidong Fang + + architect + developer + + +8 + + + + scm:svn:http://json-simple.googlecode.com/svn/trunk/ + scm:svn:http://json-simple.googlecode.com/svn/trunk/ + http://json-simple.googlecode.com/svn/trunk/ + + + + UTF-8 + + + + + junit + junit + 4.10 + + + + + + + org.apache.felix + maven-bundle-plugin + 2.3.6 + true + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.2 + 1.2 + + + + + + diff --git a/plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..62e9daa --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,12 @@ +#Properties file for org.yocto.sdk.remotetools +category.name = Yocto Project Remote Tools +commands.category.name = Yoctol Project Tools +command.name.oprofile = oprofile +command.name.powertop = powertop +command.name.latencytop = latencytop +command.name.ust.20 = lttng2.0 trace import +command.name.perf = perf +command.name.systemtap = systemtap +command.name.yoctobsp = yocto-bsp +Bundle-Vendor = yoctoproject.org +Bundle-Name = Yocto Project Plugin Remote Tools \ No newline at end of file diff --git a/plugins/org.yocto.sdk.remotetools/build.properties b/plugins/org.yocto.sdk.remotetools/build.properties new file mode 100644 index 0000000..de68275 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/build.properties @@ -0,0 +1,10 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + OSGI-INF/l10n/bundle.properties,\ + lib/,\ + lib/json-simple-1.1.1.jar +src.includes = lib/ diff --git a/plugins/org.yocto.sdk.remotetools/icons/sample.gif b/plugins/org.yocto.sdk.remotetools/icons/sample.gif new file mode 100644 index 0000000..34fb3c9 Binary files /dev/null and b/plugins/org.yocto.sdk.remotetools/icons/sample.gif differ diff --git a/plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar b/plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar new file mode 100644 index 0000000..66347a6 Binary files /dev/null and b/plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar differ diff --git a/plugins/org.yocto.sdk.remotetools/plugin.xml b/plugins/org.yocto.sdk.remotetools/plugin.xml new file mode 100644 index 0000000..68381c4 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/plugin.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java new file mode 100644 index 0000000..33de5c1 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools; + +import org.eclipse.core.runtime.jobs.IJobManager; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.yocto.sdk.remotetools"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + + //cancel all jobs before plugin stop + IJobManager jobMan = Job.getJobManager(); + jobMan.cancel(LocalJob.LOCAL_JOB_FAMILY); + jobMan.join(LocalJob.LOCAL_JOB_FAMILY, null); + + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java new file mode 100644 index 0000000..5b082a0 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ + +package org.yocto.sdk.remotetools; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWTException; + +public class LocalJob extends Job { + + public static final String LOCAL_JOB_FAMILY = "localJobFamily"; + private String[] cmdarray; + private String[] envp; + private File dir; + private int exitValue; + private Exception exception; + private IWorkbenchWindow window; + + public LocalJob(String name, String[] cmdarray, String[] envp, File dir, IWorkbenchWindow window) { + super(name); + this.cmdarray=cmdarray; + this.envp=envp; + this.dir=dir; + this.window=window; + this.exitValue=0; + this.exception=null; + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + Process p=null; + boolean cancel=false; + + try { + //start process + p=Runtime.getRuntime().exec(cmdarray,envp,dir); + + //wait for completion + while (!cancel) { + + if(monitor.isCanceled()) + cancel=true; + + try { + exitValue=p.exitValue(); + break; + }catch (IllegalThreadStateException e) { + } + + Thread.sleep(500); + } + + }catch (IOException e) { + exception=e; + }catch (InterruptedException e){ + cancel=true; + }finally { + if(p!=null) + p.destroy(); + } + try { + if(exitValue!=0 || exception!=null) { + window.getWorkbench().getDisplay().syncExec(new Runnable() { + public void run() { + MessageDialog.openError(window.getShell(), + Messages.LocalJob_Title, + Messages.ErrorLocalJob + ": " + getName() + + (exitValue!=0 ? "\n\tExit value: " + new Integer(exitValue).toString() : new String("")) + + (exception!=null ? "\n\t" + exception.getMessage() : new String ("")) + ); + } + }); + } + }catch (SWTException e) { + e.printStackTrace(); + }catch (Exception e) { + e.printStackTrace(); + } + return (cancel!=true) ? Status.OK_STATUS : Status.CANCEL_STATUS; + } + + public boolean belongsTo(Object family) { + return family == LOCAL_JOB_FAMILY; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java new file mode 100644 index 0000000..cbf2b05 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.yocto.sdk.remotetools.messages"; //$NON-NLS-1$ + + public static String ErrorNoSubsystem; + public static String ErrorConnectSubsystem; + public static String ErrorNoHost; + public static String ErrorNoRemoteService; + + public static String ErrorOprofileViewer; + public static String ErrorOprofile; + public static String ErrorLttvGui; + public static String ErrorUstProject; + + public static String InfoDownload; + public static String InfoUpload; + + public static String BaseSettingDialog_Connection; + public static String BaseSettingDialog_New; + public static String BaseSettingDialog_Properties; + public static String Usttrace_Argument_Text; + public static String Usttrace_Application_Text; + public static String Usttrace_Trace_Loc_Text; + public static String Powertop_Time_Text; + public static String Powertop_ShowPid_Text; + public static String TerminalViewer_text; + //public static String Systemtap_KO_Text; + public static String Metadata_Location; + public static String Builddir_Location; + public static String User_ID; + public static String Remote_Host; + public static String Systemtap_Script; + public static String Systemtap_Args; + public static String Import_to_Project; + + public static String LocalJob_Title; + public static String ErrorLocalJob; + public static String RemoteShellExec_1; + public static String RemoteShellExec_2; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java new file mode 100644 index 0000000..27b5dae --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java @@ -0,0 +1,642 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.PixelConverter; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.custom.ViewForm; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Layout; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.forms.widgets.ExpandableComposite; + +/** + * Factory class to create some SWT resources. + */ +public class SWTFactory { + + /** + * Returns a width hint for a button control. + */ + public static int getButtonWidthHint(Button button) { + /*button.setFont(JFaceResources.getDialogFont());*/ + PixelConverter converter= new PixelConverter(button); + int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); + return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); + } + + /** + * Sets width and height hint for the button control. + * Note: This is a NOP if the button's layout data is not + * an instance of GridData. + * + * @param the button for which to set the dimension hint + */ + public static void setButtonDimensionHint(Button button) { + Assert.isNotNull(button); + Object gd= button.getLayoutData(); + if (gd instanceof GridData) { + ((GridData)gd).widthHint= getButtonWidthHint(button); + ((GridData)gd).horizontalAlignment = GridData.FILL; + } + } + + /** + * Creates a check box button using the parents' font + * @param parent the parent to add the button to + * @param label the label for the button + * @param image the image for the button + * @param checked the initial checked state of the button + * @param hspan the horizontal span to take up in the parent composite + * @return a new checked button set to the initial checked state + * @since 3.3 + */ + public static Button createCheckButton(Composite parent, String label, Image image, boolean checked, int hspan) { + Button button = new Button(parent, SWT.CHECK); + button.setFont(parent.getFont()); + button.setSelection(checked); + if(image != null) { + button.setImage(image); + } + if(label != null) { + button.setText(label); + } + GridData gd = new GridData(); + gd.horizontalSpan = hspan; + button.setLayoutData(gd); + setButtonDimensionHint(button); + return button; + } + + /** + * Creates and returns a new push button with the given + * label and/or image. + * + * @param parent parent control + * @param label button label or null + * @param image image of null + * + * @return a new push button + */ + public static Button createPushButton(Composite parent, String label, Image image) { + Button button = new Button(parent, SWT.PUSH); + button.setFont(parent.getFont()); + if (image != null) { + button.setImage(image); + } + if (label != null) { + button.setText(label); + } + GridData gd = new GridData(); + button.setLayoutData(gd); + setButtonDimensionHint(button); + return button; + } + + /** + * Creates and returns a new push button with the given + * label and/or image. + * + * @param parent parent control + * @param label button label or null + * @param image image of null + * @param fill the alignment for the new button + * + * @return a new push button + * @since 3.4 + */ + public static Button createPushButton(Composite parent, String label, Image image, int fill) { + Button button = new Button(parent, SWT.PUSH); + button.setFont(parent.getFont()); + if (image != null) { + button.setImage(image); + } + if (label != null) { + button.setText(label); + } + GridData gd = new GridData(fill); + button.setLayoutData(gd); + setButtonDimensionHint(button); + return button; + } + + /** + * Creates and returns a new push button with the given + * label, tooltip and/or image. + * + * @param parent parent control + * @param label button label or null + * @param tooltip the tooltip text for the button or null + * @param image image of null + * + * @return a new push button + * @since 3.6 + */ + public static Button createPushButton(Composite parent, String label, String tooltip, Image image) { + Button button = createPushButton(parent, label, image); + button.setToolTipText(tooltip); + return button; + } + + /** + * Creates and returns a new radio button with the given + * label. + * + * @param parent parent control + * @param label button label or null + * + * @return a new radio button + */ + public static Button createRadioButton(Composite parent, String label) { + Button button = new Button(parent, SWT.RADIO); + button.setFont(parent.getFont()); + if (label != null) { + button.setText(label); + } + GridData gd = new GridData(); + button.setLayoutData(gd); + setButtonDimensionHint(button); + return button; + } + + /** + * Creates and returns a new radio button with the given + * label. + * + * @param parent parent control + * @param label button label or null + * @param hspan the number of columns to span in the parent composite + * + * @return a new radio button + * @since 3.6 + */ + public static Button createRadioButton(Composite parent, String label, int hspan) { + Button button = new Button(parent, SWT.RADIO); + button.setFont(parent.getFont()); + if (label != null) { + button.setText(label); + } + GridData gd = new GridData(GridData.BEGINNING); + gd.horizontalSpan = hspan; + button.setLayoutData(gd); + setButtonDimensionHint(button); + return button; + } + + /** + * Creates a new label widget + * @param parent the parent composite to add this label widget to + * @param text the text for the label + * @param hspan the horizontal span to take up in the parent composite + * @return the new label + * @since 3.2 + * + */ + public static Label createLabel(Composite parent, String text, int hspan) { + Label l = new Label(parent, SWT.NONE); + l.setFont(parent.getFont()); + l.setText(text); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + gd.grabExcessHorizontalSpace = false; + l.setLayoutData(gd); + return l; + } + + /** + * Creates a new label widget + * @param parent the parent composite to add this label widget to + * @param text the text for the label + * @param font the font for the label + * @param hspan the horizontal span to take up in the parent composite + * @return the new label + * @since 3.3 + */ + public static Label createLabel(Composite parent, String text, Font font, int hspan) { + Label l = new Label(parent, SWT.NONE); + l.setFont(font); + l.setText(text); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + l.setLayoutData(gd); + return l; + } + + /** + * Creates a wrapping label + * @param parent the parent composite to add this label to + * @param text the text to be displayed in the label + * @param hspan the horizontal span that label should take up in the parent composite + * @param wrapwidth the width hint that the label should wrap at + * @return a new label that wraps at a specified width + * @since 3.3 + */ + public static Label createWrapLabel(Composite parent, String text, int hspan, int wrapwidth) { + Label l = new Label(parent, SWT.NONE | SWT.WRAP); + l.setFont(parent.getFont()); + l.setText(text); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + gd.widthHint = wrapwidth; + l.setLayoutData(gd); + return l; + } + + /** + * Creates a new CLabel that will wrap at the specified width and has the specified image + * @param parent the parent to add this label to + * @param text the text for the label + * @param image the image for the label + * @param hspan the h span to take up in the parent + * @param wrapwidth the with to wrap at + * @return a new CLabel + * @since 3.3 + */ + public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) { + CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP); + label.setFont(parent.getFont()); + if(text != null) { + label.setText(text); + } + if(image != null) { + label.setImage(image); + } + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + gd.widthHint = wrapwidth; + label.setLayoutData(gd); + return label; + } + + /** + * Creates a wrapping label + * @param parent the parent composite to add this label to + * @param text the text to be displayed in the label + * @param hspan the horizontal span that label should take up in the parent composite + * @return a new label that wraps at a specified width + * @since 3.3 + */ + public static Label createWrapLabel(Composite parent, String text, int hspan) { + Label l = new Label(parent, SWT.NONE | SWT.WRAP); + l.setFont(parent.getFont()); + l.setText(text); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + l.setLayoutData(gd); + return l; + } + + /** + * Creates a new text widget + * @param parent the parent composite to add this text widget to + * @param hspan the horizontal span to take up on the parent composite + * @return the new text widget + * @since 3.2 + * + */ + public static Text createSingleText(Composite parent, int hspan) { + Text t = new Text(parent, SWT.SINGLE | SWT.BORDER); + t.setFont(parent.getFont()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + t.setLayoutData(gd); + return t; + } + + /** + * Creates a new text widget + * @param parent the parent composite to add this text widget to + * @param style the style bits for the text widget + * @param hspan the horizontal span to take up on the parent composite + * @param fill the fill for the grid layout + * @return the new text widget + * @since 3.3 + */ + public static Text createText(Composite parent, int style, int hspan, int fill) { + Text t = new Text(parent, style); + t.setFont(parent.getFont()); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + t.setLayoutData(gd); + return t; + } + + /** + * Creates a new text widget + * @param parent the parent composite to add this text widget to + * @param style the style bits for the text widget + * @param hspan the horizontal span to take up on the parent composite + * @return the new text widget + * @since 3.3 + */ + public static Text createText(Composite parent, int style, int hspan) { + Text t = new Text(parent, style); + t.setFont(parent.getFont()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + t.setLayoutData(gd); + return t; + } + + /** + * Creates a new text widget + * @param parent the parent composite to add this text widget to + * @param style the style bits for the text widget + * @param hspan the horizontal span to take up on the parent composite + * @param width the desired width of the text widget + * @param height the desired height of the text widget + * @param fill the fill style for the widget + * @return the new text widget + * @since 3.3 + */ + public static Text createText(Composite parent, int style, int hspan, int width, int height, int fill) { + Text t = new Text(parent, style); + t.setFont(parent.getFont()); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + gd.widthHint = width; + gd.heightHint = height; + t.setLayoutData(gd); + return t; + } + + /** + * Creates a new text widget + * @param parent the parent composite to add this text widget to + * @param style the style bits for the text widget + * @param hspan the horizontal span to take up on the parent composite + * @param text the initial text, not null + * @return the new text widget + * @since 3.6 + */ + public static Text createText(Composite parent, int style, int hspan, String text) { + Text t = new Text(parent, style); + t.setFont(parent.getFont()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + t.setLayoutData(gd); + t.setText(text); + return t; + } + + /** + * Creates a Group widget + * @param parent the parent composite to add this group to + * @param text the text for the heading of the group + * @param columns the number of columns within the group + * @param hspan the horizontal span the group should take up on the parent + * @param fill the style for how this composite should fill into its parent + * @return the new group + * @since 3.2 + * + */ + public static Group createGroup(Composite parent, String text, int columns, int hspan, int fill) { + Group g = new Group(parent, SWT.NONE); + g.setLayout(new GridLayout(columns, false)); + g.setText(text); + g.setFont(parent.getFont()); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + g.setLayoutData(gd); + return g; + } + + /** + * Creates a Composite widget + * @param parent the parent composite to add this composite to + * @param font the font to set on the control + * @param columns the number of columns within the composite + * @param hspan the horizontal span the composite should take up on the parent + * @param fill the style for how this composite should fill into its parent + * @return the new group + * @since 3.3 + */ + public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill) { + Composite g = new Composite(parent, SWT.NONE); + g.setLayout(new GridLayout(columns, false)); + g.setFont(font); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + g.setLayoutData(gd); + return g; + } + + /** + * Creates an ExpandibleComposite widget + * @param parent the parent to add this widget to + * @param style the style for ExpandibleComposite expanding handle, and layout + * @param label the label for the widget + * @param hspan how many columns to span in the parent + * @param fill the fill style for the widget + * Can be one of GridData.FILL_HORIZONAL, GridData.FILL_BOTH or GridData.FILL_VERTICAL + * @return a new ExpandibleComposite widget + * @since 3.6 + */ + public static ExpandableComposite createExpandibleComposite(Composite parent, int style, String label, int hspan, int fill) { + ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, style); + ex.setText(label); + ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + ex.setLayoutData(gd); + return ex; + } + + /** + * Creates a composite that uses the parent's font and has a grid layout + * @param parent the parent to add the composite to + * @param columns the number of columns the composite should have + * @param hspan the horizontal span the new composite should take up in the parent + * @param fill the fill style of the composite {@link GridData} + * @return a new composite with a grid layout + * + * @since 3.3 + */ + public static Composite createComposite(Composite parent, int columns, int hspan, int fill) { + Composite g = new Composite(parent, SWT.NONE); + g.setLayout(new GridLayout(columns, false)); + g.setFont(parent.getFont()); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + g.setLayoutData(gd); + return g; + } + + /** + * Creates a vertical spacer for separating components. If applied to a + * GridLayout, this method will automatically span all of the columns of the parent + * to make vertical space + * + * @param parent the parent composite to add this spacer to + * @param numlines the number of vertical lines to make as space + * @since 3.3 + */ + public static void createVerticalSpacer(Composite parent, int numlines) { + Label lbl = new Label(parent, SWT.NONE); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + Layout layout = parent.getLayout(); + if(layout instanceof GridLayout) { + gd.horizontalSpan = ((GridLayout)parent.getLayout()).numColumns; + } + gd.heightHint = numlines; + lbl.setLayoutData(gd); + } + + /** + * creates a horizontal spacer for separating components + * @param comp + * @param numlines + * @since 3.3 + */ + public static void createHorizontalSpacer(Composite comp, int numlines) { + Label lbl = new Label(comp, SWT.NONE); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = numlines; + lbl.setLayoutData(gd); + } + + /** + * Creates a Composite widget + * @param parent the parent composite to add this composite to + * @param font the font to set on the control + * @param columns the number of columns within the composite + * @param hspan the horizontal span the composite should take up on the parent + * @param fill the style for how this composite should fill into its parent + * @param marginwidth the width of the margin to place on the sides of the composite (default is 5, specified by GridLayout) + * @param marginheight the height of the margin to place o the top and bottom of the composite + * @return the new composite + * @since 3.3 + */ + public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill, int marginwidth, int marginheight) { + Composite g = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(columns, false); + layout.marginWidth = marginwidth; + layout.marginHeight = marginheight; + g.setLayout(layout); + g.setFont(font); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + g.setLayoutData(gd); + return g; + } + + /** + * Creates a {@link ViewForm} + * @param parent + * @param style + * @param cols + * @param span + * @param fill + * @param marginwidth + * @param marginheight + * @return a new {@link ViewForm} + * @since 3.6 + */ + public static ViewForm createViewform(Composite parent, int style, int cols, int span, int fill, int marginwidth, int marginheight) { + ViewForm form = new ViewForm(parent, style); + form.setFont(parent.getFont()); + GridLayout layout = new GridLayout(cols, false); + layout.marginWidth = marginwidth; + layout.marginHeight = marginheight; + form.setLayout(layout); + GridData gd = new GridData(fill); + gd.horizontalSpan = span; + form.setLayoutData(gd); + return form; + } + + /** + * Creates a Composite widget + * @param parent the parent composite to add this composite to + * @param font the font to set on the control + * @param columns the number of columns within the composite + * @param hspan the horizontal span the composite should take up on the parent + * @param fill the style for how this composite should fill into its parent + * @param marginwidth the width of the margin to place on the sides of the composite (default is 5, specified by GridLayout) + * @param marginheight the height of the margin to place o the top and bottom of the composite + * @return the new composite + * @since 3.6 + */ + public static Composite createComposite(Composite parent, Font font, int style, int columns, int hspan, int fill, int marginwidth, int marginheight) { + Composite g = new Composite(parent, style); + GridLayout layout = new GridLayout(columns, false); + layout.marginWidth = marginwidth; + layout.marginHeight = marginheight; + g.setLayout(layout); + g.setFont(font); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + g.setLayoutData(gd); + return g; + } + + /** + * This method is used to make a combo box + * @param parent the parent composite to add the new combo to + * @param style the style for the Combo + * @param hspan the horizontal span to take up on the parent composite + * @param fill how the combo will fill into the composite + * Can be one of GridData.FILL_HORIZONAL, GridData.FILL_BOTH or GridData.FILL_VERTICAL + * @param items the item to put into the combo + * @return a new Combo instance + * @since 3.3 + */ + public static Combo createCombo(Composite parent, int style, int hspan, int fill, String[] items) { + Combo c = new Combo(parent, style); + c.setFont(parent.getFont()); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + c.setLayoutData(gd); + if (items != null){ + c.setItems(items); + } + // Some platforms open up combos in bad sizes without this, see bug 245569 + c.setVisibleItemCount(30); + c.select(0); + return c; + } + + /** + * This method is used to make a combo box with a default fill style of GridData.FILL_HORIZONTAL + * @param parent the parent composite to add the new combo to + * @param style the style for the Combo + * @param hspan the horizontal span to take up on the parent composite + * @param items the item to put into the combo + * @return a new Combo instance + * @since 3.3 + */ + public static Combo createCombo(Composite parent, int style, int hspan, String[] items) { + Combo c = new Combo(parent, style); + c.setFont(parent.getFont()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = hspan; + c.setLayoutData(gd); + if (items != null){ + c.setItems(items); + } + // Some platforms open up combos in bad sizes without this, see bug 245569 + c.setVisibleItemCount(30); + c.select(0); + return c; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java new file mode 100644 index 0000000..e7bf054 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools; + +public class YoctoBspElement { + private String metadataLoc; + private String buildLoc; + private String bspName; + private String bspOutLoc; + private String karch; + private String qarch; + private boolean validPropertiesFile; + + public YoctoBspElement() + { + this.metadataLoc = ""; + this.buildLoc = ""; + this.bspName = ""; + this.bspOutLoc = ""; + this.karch = ""; + this.qarch = ""; + this.validPropertiesFile = false; + } + + public String getMetadataLoc() { + return metadataLoc; + } + + public void setMetadataLoc(String value) { + metadataLoc = value; + } + + public String getBuildLoc() { + return buildLoc; + } + + public void setBuildLoc(String value) { + buildLoc = value; + } + + public String getBspName() { + return bspName; + } + + public void setBspName(String value) { + this.bspName = value; + } + + public String getBspOutLoc() { + return bspOutLoc; + } + + public void setBspOutLoc(String value) { + this.bspOutLoc = value; + } + + public String getKarch() { + return karch; + } + + public void setKarch(String value) { + this.karch = value; + } + + public String getQarch() { + return qarch; + } + + public void setQarch(String value) { + this.qarch = value; + } + + public boolean getValidPropertiesFile() { + return validPropertiesFile; + } + + public void setValidPropertiesFile(boolean value) { + this.validPropertiesFile = value; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java new file mode 100644 index 0000000..e88b4bd --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools; + +public class YoctoBspPropertyElement implements Comparable{ + private String name; + private String type; + private String value; + private String defaultValue; + + public YoctoBspPropertyElement() + { + this.name = ""; + this.type = ""; + this.value = ""; + this.defaultValue = ""; + } + + public String getName() { + return name; + } + + public void setName(String value) { + name = value; + } + + public String getType() { + return type; + } + + public void setType(String value) { + type = value; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String value) { + this.defaultValue = value; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public int compareTo(YoctoBspPropertyElement o) { + return type.compareTo(o.type); + } + + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java new file mode 100644 index 0000000..37ce54d --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools; + +import java.io.IOException; +import java.io.FileWriter; +import java.util.Iterator; +import java.util.Set; +import java.util.HashSet; +import java.io.FileReader; + +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; + +public class YoctoJSONHelper { + private static final String PROPERTIES_FILE = "/tmp/properties.json"; + private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json"; + + private static HashSet properties; + + public static HashSet getProperties() throws Exception { + + properties = new HashSet(); + try { + + JSONObject obj = (JSONObject)JSONValue.parse(new FileReader(PROPERTIES_FILE)); + Set keys = obj.keySet(); + if (!keys.isEmpty()) { + Iterator iter = keys.iterator(); + while (iter.hasNext()) { + String key = (String)iter.next(); + if (validKey(key)) { + JSONObject value_obj = (JSONObject)obj.get(key); + YoctoBspPropertyElement elem = new YoctoBspPropertyElement(); + elem.setName(key); + String type = (String)value_obj.get("type"); + elem.setType(type); + if (type.contentEquals("boolean")) { + elem.setDefaultValue((String)value_obj.get("default")); + } + properties.add(elem); + } + } + } + + } catch (Exception e) { + throw e; + } + return properties; + } + + public static void createBspJSONFile(HashSet properties) { + try { + JSONObject obj = new JSONObject(); + if (!properties.isEmpty()) { + Iterator it = properties.iterator(); + while (it.hasNext()) { + // Get property + YoctoBspPropertyElement propElem = (YoctoBspPropertyElement)it.next(); + obj.put(propElem.getName(), propElem.getValue()); + } + } + + FileWriter file = new FileWriter(PROPERTY_VALUE_FILE); + file.write(obj.toJSONString()); + file.flush(); + file.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static boolean validKey(String key) { + if (key.contains("kernel")) + return false; + if (key.contentEquals("qemuarch")) + return false; + return true; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java new file mode 100644 index 0000000..dacd192 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java @@ -0,0 +1,123 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.rse.core.model.IHost; +import org.yocto.remote.utils.RSEHelper; +import org.yocto.remote.utils.RemoteShellExec; + +abstract public class BaseModel implements IRunnableWithProgress { + protected IHost host; + protected String taskName; + protected String localScript; + protected String remoteExec; + protected String localFile; + protected String remoteFile; + + private static final int WORKLOAD = 100; + + private static final int INIT_PERCENT = 5; + private static final int PRE_PROCESS_PERCENT = 30; + private static final int PROCESS_PERCENT = 30; + private static final int POST_PROCESS_PERCENT = 30; + private static final int CLEAN_PERCENT = 5; + + private static final String RUN_MSG = "Running task: "; + private static final String INIT_MSG = "Initializing "; + private static final String PRE_PROCESS_MSG = "Preparing "; + private static final String PROCESS_MSG = "Processing "; + private static final String POST_PROCESS_MSG = "Finishing "; + private static final String CLEAN_MSG = "Cleaning "; + private static final String DOTS = "..."; + private static final String FAILED_ERR_MSG = " failed with exit code "; + + public void preProcess(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException{ + //upload script to remote + try { + RSEHelper.putRemoteFileInPlugin(host, localScript, remoteExec, monitor); + }catch (InterruptedException e){ + throw e; + }catch (InvocationTargetException e) { + throw e; + }catch (Exception e) { + throw new InvocationTargetException(e, e.getMessage()); + } + } + public void postProcess(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException{} + + abstract public void process(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException; + + public BaseModel(IHost host, String taskName, String localScript, String remoteExec) { + this.host = host; + this.taskName = taskName; + this.localScript = localScript; + this.remoteExec = remoteExec; + } + protected void init(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + } + + protected void clean(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + } + + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + + try { + monitor.beginTask(RUN_MSG + taskName, WORKLOAD); + + monitor.subTask(INIT_MSG + taskName + DOTS); + init(new SubProgressMonitor(monitor, INIT_PERCENT)); + + monitor.subTask(PRE_PROCESS_MSG + taskName + DOTS); + preProcess(new SubProgressMonitor(monitor, PRE_PROCESS_PERCENT)); + + monitor.subTask(PROCESS_MSG + taskName + DOTS); + process(new SubProgressMonitor(monitor, PROCESS_PERCENT)); + + monitor.subTask(POST_PROCESS_MSG + taskName + DOTS); + postProcess(new SubProgressMonitor(monitor, POST_PROCESS_PERCENT)); + } catch (InterruptedException e){ + throw new InterruptedException("User cancelled!"); + } catch (InvocationTargetException e) { + throw e; + } finally { + monitor.subTask(CLEAN_MSG + taskName + DOTS); + clean(new SubProgressMonitor(monitor, CLEAN_PERCENT)); + monitor.done(); + } + } + + protected void getDataFile(IProgressMonitor monitor) throws Exception { + RSEHelper.getRemoteFile( host, localFile, remoteFile, monitor); + } + protected void runRemoteShellExec(IProgressMonitor monitor, String args, boolean cancelable) throws Exception { + try { + RemoteShellExec exec = new RemoteShellExec(host, remoteExec); + exec.start(null, args, monitor); + monitor.worked(1); + checkTerminate(exec.getInputStream()); + int exit_code = exec.waitFor(cancelable ? monitor : null); + exec.terminate(); + if(exit_code != 0) + throw new Exception(taskName + FAILED_ERR_MSG + new Integer(exit_code).toString()); + } finally { + monitor.done(); + } + } + protected void checkTerminate(InputStream inputStream) throws IOException {} +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java new file mode 100644 index 0000000..7845959 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java @@ -0,0 +1,216 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 PalmSource, Inc. and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Ewa Matejska (PalmSource) - initial API and implementation + * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry + * Martin Oberhuber (Wind River) - [196934] hide disabled system types in remotecdt combo + * Yu-Fen Kuo (MontaVista) - [190613] Fix NPE in Remotecdt when RSEUIPlugin has not been loaded + * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code + * Johann Draschwandtner (Wind River) - [231827][remotecdt]Auto-compute default for Remote path + * Johann Draschwandtner (Wind River) - [233057][remotecdt]Fix button enablement + * Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch + * Anna Dushistova (MontaVista) - [223728] [remotecdt] connection combo is not populated until RSE is activated + * Anna Dushistova (MontaVista) - [267951] [remotecdt] Support systemTypes without files subsystem + * Lianhao Lu (Intel) - Modified for internal use + *******************************************************************************/ + +package org.yocto.sdk.remotetools.actions; + +import org.yocto.remote.utils.RSEHelper; +import org.yocto.sdk.remotetools.Messages; +import org.yocto.sdk.remotetools.SWTFactory; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.ui.actions.SystemNewConnectionAction; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +public class BaseSettingDialog extends Dialog { + + protected String title; + protected String curConn; //current rse connection name + protected IHost conn;//rse IHost + + protected Button newRemoteConnectionButton; + protected Label connectionLabel; + protected Combo connectionCombo; + protected SystemNewConnectionAction action = null; + + + protected BaseSettingDialog(Shell parentShell,String title, String connection) { + super(parentShell); + this.title=title; + this.curConn=connection; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(title); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite)super.createDialogArea(parent); + GridLayout topLayout = new GridLayout(); + comp.setLayout(topLayout); + + /* The RSE Connection dropdown with New button. */ + SWTFactory.createVerticalSpacer(comp, 1); + createRemoteConnectionGroup(comp); + + return comp; + } + + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + updateCurConn(); + } + + protected void createRemoteConnectionGroup(Composite parent) { + Composite projComp = new Composite(parent, SWT.NONE); + GridLayout projLayout = new GridLayout(); + projLayout.numColumns = 6; + projLayout.marginHeight = 0; + projLayout.marginWidth = 0; + projComp.setLayout(projLayout); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + projComp.setLayoutData(gd); + + connectionLabel = new Label(projComp, SWT.NONE); + connectionLabel.setText(Messages.BaseSettingDialog_Connection); + gd = new GridData(); + gd.horizontalSpan = 1; + connectionLabel.setLayoutData(gd); + + connectionCombo = new Combo(projComp, SWT.DROP_DOWN | SWT.READ_ONLY); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 4; + connectionCombo.setLayoutData(gd); + connectionCombo.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + //setDirty(true); + //updateLaunchConfigurationDialog(); + //useDefaultsFromConnection(); + updateCurConn(); + } + }); + + newRemoteConnectionButton = SWTFactory.createPushButton(projComp, + Messages.BaseSettingDialog_New, null); + newRemoteConnectionButton.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent evt) { + handleNewRemoteConnectionSelected(); + //updateLaunchConfigurationDialog(); + updateConnectionPulldown(); + } + }); + gd = new GridData(); + gd.horizontalSpan = 1; + newRemoteConnectionButton.setLayoutData(gd); + + updateConnectionPulldown(); + } + + protected boolean updateOkButton() { + boolean ret=false; + Button button=getButton(IDialogConstants.OK_ID); + if(button!=null) + button.setEnabled(false); + IHost currentConnectionSelected = getCurrentConnection(); + if (currentConnectionSelected != null) { + if (RSEHelper.isHostViable(currentConnectionSelected) && button != null){ + button.setEnabled(true); + ret=true; + } + } + return ret; + } + + protected void updateCurConn() { + IHost currentConnectionSelected = getCurrentConnection(); + if (currentConnectionSelected != null) { + if (RSEHelper.isHostViable(currentConnectionSelected)) + curConn=currentConnectionSelected.getAliasName(); + } + updateOkButton(); + } + + protected IHost getCurrentConnection() { + int currentSelection = connectionCombo.getSelectionIndex(); + String remoteConnection = currentSelection >= 0 ? connectionCombo + .getItem(currentSelection) : null; + return RSEHelper.getRemoteConnectionByName(remoteConnection); + } + + protected void handleNewRemoteConnectionSelected() { + if (action == null) { + action = new SystemNewConnectionAction(getShell(), + false, false, null); + } + + try { + action.run(); + } catch (Exception e) { + // Ignore + } + } + + protected void updateConnectionPulldown() { + int index=-1; + RSEHelper.waitForRSEInitCompletition(); + // already initialized + connectionCombo.removeAll(); + IHost[] connections = RSEHelper.getSuitableConnections(); + for (int i = 0; i < connections.length; i++) { + connectionCombo.add(connections[i].getAliasName()); + if(connections[i].getAliasName().equals(curConn)) + index=i; + } + + if(index>=0) { + connectionCombo.select(index); + }else if (connections.length > 0) { + connectionCombo.select(connections.length - 1); + } + + //TODO + //connectionCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT,true); + connectionCombo.pack(true); + connectionCombo.layout(); + connectionCombo.getParent().layout(); + + updateCurConn(); + } + + @Override + protected void okPressed() { + conn=getCurrentConnection(); + super.okPressed(); + } + + public IHost getHost() { + return conn; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java new file mode 100644 index 0000000..231de77 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2013 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.yocto.remote.utils.TerminalHandler; + +abstract public class DialogHandler extends TerminalHandler { + + protected BaseSettingDialog setting; + + abstract protected String getDialogTitle(); + + protected void initialize(ExecutionEvent event) throws ExecutionException{ + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + shell = window.getShell(); + setting = new SimpleSettingDialog(shell, getDialogTitle(), getConnnectionName()); + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + initialize(event); + + if(setting.open() == BaseSettingDialog.OK) { + IHost currentHost = setting.getHost(); + execute(currentHost); + } + return null; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java new file mode 100644 index 0000000..d4bbe12 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +public interface IBaseConstants { + public static final String TCF_TYPE_ID="org.eclipse.tcf.rse.systemType";//$NON-NLS-1$ + + public static final String QUALIFIER="org.yocto.sdk.remotetools";//$NON-NLS-1$ + + public static final String CONNECTION_NAME_OPROFILE = QUALIFIER + "connection.oprofile"; //$NON-NLS-1$ + public static final String CONNECTION_NAME_UST = QUALIFIER + "connection.ust"; //$NON-NLS-1$ + public static final String CONNECTION_NAME_POWERTOP = QUALIFIER + "connection.powertop"; //$NON-NLS-1$ + public static final String CONNECTION_NAME_LATENCYTOP = QUALIFIER + "connection.latencytop"; //$NON-NLS-1$ + public static final String CONNECTION_NAME_PERF = QUALIFIER + "connection.perf"; //$NON-NLS-1$ + public static final String CONNECTION_NAME_SYSTEMTAP = QUALIFIER + "connection.systemtap"; //$NON-NLS-1$ + + public static final String DIALOG_TITLE_LATENCYTOP = "Latencytop"; //$NON-NLS-1$ + public static final String DIALOG_TITLE_PERF = "Perf"; //$NON-NLS-1$ +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java new file mode 100644 index 0000000..1088dee --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + + +public class LatencytopHandler extends DialogHandler { + + protected String changeTerm = "export TERM=xterm;"; + private static String initCmd="export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin; cd; sudo latencytop\r"; + + @Override + protected String getInitCmd() { + return initCmd; + } + @Override + protected String changeTerm() { + return changeTerm; + } + @Override + protected String getConnnectionName() { + return IBaseConstants.CONNECTION_NAME_LATENCYTOP; + } + @Override + protected String getDialogTitle() { + return IBaseConstants.DIALOG_TITLE_LATENCYTOP; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java new file mode 100644 index 0000000..980737f --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.progress.IProgressService; + +public class OprofileHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + + if(OprofileModel.checkAvail()!=true) { + return null; + } + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + + SimpleSettingDialog setting=new SimpleSettingDialog( + window.getShell(), + "Oprofile", + IBaseConstants.CONNECTION_NAME_OPROFILE + ); + + if(setting.open()==BaseSettingDialog.OK) { + IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); + OprofileModel op=new OprofileModel(setting.getHost(),window); + try { + progressService.busyCursorWhile(op); + }catch (InterruptedException e) { + //user cancelled + }catch (Exception e) { + e.printStackTrace(); + MessageDialog.openError(window.getShell(), + "Oprofile", + (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); + } + } + return null; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java new file mode 100644 index 0000000..7fbe7c6 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java @@ -0,0 +1,171 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.ui.IWorkbenchWindow; +import org.yocto.remote.utils.CommonHelper; +import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.preferences.PreferenceConstants; +import org.yocto.sdk.remotetools.LocalJob; +import org.yocto.sdk.remotetools.Messages; + +public class OprofileModel extends BaseModel { + + private static final String REMOTE_EXEC = "/tmp/yocto_tool.sh"; + private static final String LOCAL_SCRIPT = "resources/yocto_tool.sh"; + + private static final String LOCAL_EXEC = "oprofile-viewer"; + + private static final String TASK_NAME = "oprofile command"; + + private IWorkbenchWindow window; + public OprofileModel(IHost host, IWorkbenchWindow window) { + super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC); + this.window = window; + } + + private void startServer(IProgressMonitor monitor) throws Exception { + String args="start -d oprofile-server"; + runRemoteShellExec(monitor, args, true); + } + + private void stopServer(IProgressMonitor monitor) throws Exception { + String args = "stop -d oprofile-server"; + runRemoteShellExec(monitor, args, false); + } + + private String getSearchPath() + { + try + { + String search=null; + IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore(); + String env_script=store.getString(PreferenceConstants.TOOLCHAIN_ROOT) + + "/" + + "environment-setup-" + + store.getString(PreferenceConstants.TOOLCHAIN_TRIPLET); + File file = new File(env_script); + + if (file.exists()) { + BufferedReader input = new BufferedReader(new FileReader(file)); + + try + { + String line = null; + + while ((line = input.readLine()) != null) + { + if (!line.startsWith("export")) + continue; + String sKey = line.substring("export".length() + 1, line.indexOf('=')); + if(!sKey.equals("PATH")) + continue; + String sValue = line.substring(line.indexOf('=') + 1); + if (sValue.startsWith("\"") && sValue.endsWith("\"")) + sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"')); + /* If PATH ending with $PATH, we need to join with current system path */ + if (sKey.equalsIgnoreCase("PATH")) { + if (sValue.lastIndexOf("$PATH") >= 0) + sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH"); + } + search=sValue; + //System.out.printf("get env key %s value %s\n", sKey, sValue); + } + + } + finally { + input.close(); + } + } + + return search; + + } + catch (IOException e) + { + e.printStackTrace(); + return null; + } + + } + + @Override + public void process(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + + boolean stopServer=true; + + try { + try { + monitor.beginTask("Starting oprofile", 100); + //start oprofile-server + monitor.subTask("Starting oprofile-server"); + startServer(new SubProgressMonitor(monitor,80)); + + //start local oprofile-viewer + monitor.subTask("oprofile-viewer is running locally"); + String searchPath=getSearchPath(); + + new LocalJob("oprofile-viewer", + (searchPath!=null) ? + new String[] {LOCAL_EXEC,"-h",host.getHostName(),"-s",searchPath} : + new String[] {LOCAL_EXEC,"-h",host.getHostName()}, + null, + null, + window).schedule(); + //we can't stop server because the oprofile-viewer is running asynchronously + stopServer=false; + + }catch (InterruptedException e) { + throw e; + }finally { + //stop oprofile-server + if(stopServer) { + monitor.subTask("Stopping oprofile-viewer"); + stopServer(new SubProgressMonitor(monitor,30)); + } + } + }catch (InterruptedException e){ + throw e; + }catch (InvocationTargetException e) { + throw e; + }catch (Exception e){ + throw new InvocationTargetException(e, e.getMessage()); + }finally { + monitor.done(); + } + } + + static public boolean checkAvail() { + boolean ret=CommonHelper.isExecAvail(LOCAL_EXEC); + + if(ret==false) { + CommonHelper.showErrorDialog("Oprofile", null,Messages.ErrorOprofileViewer); + }else { + ret=CommonHelper.isExecAvail("opreport"); + if(ret==false) { + CommonHelper.showErrorDialog("Oprofile", null,Messages.ErrorOprofile); + } + } + return ret; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java new file mode 100644 index 0000000..f3f9e49 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + + +public class PerfHandler extends DialogHandler { + + private static String initCmd="cd; perf\r"; + + @Override + protected String getInitCmd() { + return initCmd; + } + @Override + protected String getConnnectionName() { + return IBaseConstants.CONNECTION_NAME_PERF; + } + @Override + protected String getDialogTitle() { + return IBaseConstants.DIALOG_TITLE_PERF; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java new file mode 100644 index 0000000..152f142 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.progress.IProgressService; + +public class PowertopHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + + PowertopSettingDialog setting=new PowertopSettingDialog( + window.getShell() + ); + + if(setting.open()==BaseSettingDialog.OK) { + IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); + PowertopModel op=new PowertopModel(setting.getHost(),setting.getTime(),setting.getShowPid(),window.getShell().getDisplay()); + try { + progressService.busyCursorWhile(op); + }catch (InterruptedException e) { + //user cancelled + }catch (Exception e) { + e.printStackTrace(); + MessageDialog.openError(window.getShell(), + "Powertop", + (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); + } + } + return null; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java new file mode 100644 index 0000000..79bef61 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.yocto.sdk.remotetools.views.BaseFileView; + +public class PowertopModel extends BaseModel { + + private static final String REMOTE_EXEC = "/tmp/yocto_tool.sh"; + private static final String LOCAL_SCRIPT = "resources/yocto_tool.sh"; + + private static final String REMOTE_FILE_PREFIX = "/tmp/yocto-powertop-"; + private static final String LOCAL_FILE_SUFFIX = ".local"; + + private static final String TASK_NAME = "powertop command"; + + private Float time; + private boolean showpid; + Display display; + + public PowertopModel(IHost host, Float time,boolean showpid,Display display) { + super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC); + this.time=time; + this.showpid=showpid; + this.display=display; + } + + @Override + public void postProcess(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + try { + new File(localFile).delete(); + }catch (Exception e) { + + } + } + + private void generateData(IProgressMonitor monitor) throws Exception { + String currentDate = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(Calendar.getInstance().getTime()).toString(); + remoteFile = new String(REMOTE_FILE_PREFIX + currentDate); + localFile = new String(remoteFile + LOCAL_FILE_SUFFIX); + + String args = "start -l " + remoteFile + " powertop --debug --time " + time.toString(); + if(showpid) + args += " -p"; + runRemoteShellExec(monitor, args, true); + } + + @Override + public void process(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + + monitor.beginTask("Running powertop", 100); + try { + //running powertop + monitor.subTask("Generating powertop data file remotely"); + generateData(new SubProgressMonitor(monitor,30)); + //download datafile + monitor.subTask("Downloading powertop data file"); + getDataFile(new SubProgressMonitor(monitor,30)); + //show it in the powertop view + display.syncExec(new Runnable() { + public void run() { + BaseFileView view; + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + view=(BaseFileView) page.showView("org.yocto.sdk.remotetools.views.PowerTopView"); + }catch (PartInitException e) { + e.printStackTrace(); + return; + } + view.setInput(localFile); + page.bringToTop(view); + } + }); + + }catch (InterruptedException e){ + throw e; + }catch (InvocationTargetException e) { + throw e; + }catch (Exception e){ + throw new InvocationTargetException(e, e.getMessage()); + }finally { + monitor.done(); + } + + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java new file mode 100644 index 0000000..bb41a4a --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java @@ -0,0 +1,131 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +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.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.yocto.sdk.remotetools.Activator; +import org.yocto.sdk.remotetools.Messages; +import org.yocto.sdk.remotetools.SWTFactory; + +public class PowertopSettingDialog extends BaseSettingDialog { + + static protected String TITLE="Powertop"; + + protected boolean showPid=false; + protected Float time; + protected Button showPidButton; + protected Text timeText; + + protected PowertopSettingDialog(Shell parentShell, String title, String conn) { + super(parentShell,title,conn); + } + + public PowertopSettingDialog(Shell parentShell) { + this(parentShell, + TITLE, + Activator.getDefault().getDialogSettings().get(IBaseConstants.CONNECTION_NAME_POWERTOP) + ); + } + + public boolean getShowPid() { + return showPid; + } + + public Float getTime() { + return time; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite comp=(Composite)super.createDialogArea(parent); + GridLayout topLayout = new GridLayout(); + comp.setLayout(topLayout); + + /*argument*/ + SWTFactory.createVerticalSpacer(comp, 1); + createInternal(comp); + + updateOkButton(); + return comp; + } + + protected void createInternal(Composite parent) + { + Composite projComp = new Composite(parent, SWT.NONE); + GridLayout projLayout = new GridLayout(); + projLayout.numColumns = 4; + projLayout.marginHeight = 0; + projLayout.marginWidth = 0; + projComp.setLayout(projLayout); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + projComp.setLayoutData(gd); + + Label label = new Label(projComp, SWT.NONE); + label.setText(Messages.Powertop_Time_Text); + gd = new GridData(); + gd.horizontalSpan = 1; + label.setLayoutData(gd); + + timeText = new Text(projComp, SWT.SINGLE | SWT.BORDER); + timeText.setText("5"); + timeText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateOkButton(); + } + }); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 3; + timeText.setLayoutData(gd); + } + + @Override + protected boolean updateOkButton() { + boolean ret=super.updateOkButton(); + if(ret==true) { + try { + Float.valueOf(timeText.getText()); + }catch (Exception e) { + Button button=getButton(IDialogConstants.OK_ID); + if(button!=null) + button.setEnabled(false); + ret=false; + } + } + return ret; + } + + @Override + protected void okPressed() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + // store the value of the generate sections checkbox + if(getCurrentConnection()==null) { + settings.put(IBaseConstants.CONNECTION_NAME_POWERTOP, + (String)null); + }else { + settings.put(IBaseConstants.CONNECTION_NAME_POWERTOP, + getCurrentConnection().getAliasName()); + } + time=new Float(timeText.getText()); + super.okPressed(); + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java new file mode 100644 index 0000000..140d892 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import org.yocto.sdk.remotetools.Activator; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + +public class SimpleSettingDialog extends BaseSettingDialog { + + private final String connPropName; + /* + protected SimpleSettingDialog(Shell parentShell, String title, String conn) { + super(parentShell,title,conn); + } + */ + + public SimpleSettingDialog(Shell parentShell, String title, String connPropertyName) { + super(parentShell, + title, + Activator.getDefault().getDialogSettings().get(connPropertyName) + ); + connPropName=connPropertyName; + } + + @Override + protected Control createDialogArea(Composite parent) { + return super.createDialogArea(parent); + } + + @Override + protected void okPressed() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + // store the value of the generate sections checkbox + if(getCurrentConnection()==null) { + settings.put(connPropName, + (String)null); + }else { + settings.put(connPropName, + getCurrentConnection().getAliasName()); + } + super.okPressed(); + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java new file mode 100644 index 0000000..f5d34d8 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2011 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.progress.IProgressService; + +public class SystemtapHandler extends AbstractHandler { + protected SystemtapSettingDialog setting; + protected String changeTerm="export TERM=vt100;"; + protected IWorkbenchWindow window; + protected Shell shell; + + public Object execute(ExecutionEvent event) throws ExecutionException { + + this.window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + shell = window.getShell(); + setting=new SystemtapSettingDialog( + shell, "Systemtap" + ); + + + if(setting.open() == BaseSettingDialog.OK) { + + String metadata_location = ((SystemtapSettingDialog)setting).getMetadataLocation(); + String builddir_location = ((SystemtapSettingDialog)setting).getBuilddirLocation(); + String remote_host = ((SystemtapSettingDialog)setting).getRemoteHost(); + String user_id = ((SystemtapSettingDialog)setting).getUserID(); + String systemtap_script = ((SystemtapSettingDialog)setting).getSystemtapScript(); + String systemtap_args = ((SystemtapSettingDialog)setting).getSystemtapArgs(); + IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); + SystemtapModel op = new SystemtapModel(metadata_location, builddir_location, remote_host, user_id, systemtap_script, + systemtap_args,window.getShell().getDisplay()); + try { + progressService.busyCursorWhile(op); + }catch (InterruptedException e) { + //user cancelled + }catch (Exception e) { + e.printStackTrace(); + MessageDialog.openError(window.getShell(), + "Systemtap", + e.getMessage()); + } + } + return false; + } + + protected void initialize(ExecutionEvent event) throws ExecutionException { + this.window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + shell = window.getShell(); + setting=new SystemtapSettingDialog( + shell, "Systemtap" + ); + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java new file mode 100644 index 0000000..bb2fa2d --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IConsoleManager; +import org.eclipse.ui.console.MessageConsole; +import org.yocto.remote.utils.ShellSession; + +public class SystemtapModel extends BaseModel { + protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env"; + protected static final String SYSTEMTAP_CONSOLE = "Systemtap Console"; + + private static final String TASK_NAME = "systemtap command"; + + protected MessageConsole sessionConsole; + private String metadata_location; + private String builddir_location; + private String remote_host; + private String user_id; + private String systemtap_script; + private String systemtap_args; + + Display display; + + public SystemtapModel(String metadata_location, String builddir_location, String remote_host, String user_id, String systemtap_script, String systemtap_args, Display display) { + super(null, TASK_NAME, "", ""); + this.metadata_location = metadata_location; + this.builddir_location = builddir_location; + this.remote_host = remote_host; + this.user_id = user_id; + this.systemtap_script = systemtap_script; + this.systemtap_args = systemtap_args; + this.display = display; + if (sessionConsole == null) { + IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager(); + IConsole[] existing = conMan.getConsoles(); + for (int i = 0; i < existing.length; i++) + if (SYSTEMTAP_CONSOLE.equals(existing[i].getName())) { + sessionConsole = (MessageConsole) existing[i]; + break; + } + if (sessionConsole == null) { + sessionConsole = new MessageConsole(SYSTEMTAP_CONSOLE, null); + conMan.addConsoles(new IConsole[] { sessionConsole }); + } + } + + ConsolePlugin.getDefault().getConsoleManager().showConsoleView(sessionConsole); + } + + @Override + public void preProcess(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException {} + + @Override + public void process(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + try { + ShellSession shell = new ShellSession(ShellSession.SHELL_TYPE_BASH, + new File(this.metadata_location), new File(this.builddir_location), + DEFAULT_INIT_SCRIPT, sessionConsole.newOutputStream()); + boolean acceptedKey = shell.ensureKnownHostKey(user_id, remote_host); + if (acceptedKey) { + String crosstapCmd = "crosstap " + user_id + "@" + remote_host + " " + systemtap_script; + if (systemtap_args != null) + crosstapCmd = crosstapCmd + " " + systemtap_args; + shell.execute(crosstapCmd); + } + } catch (Exception e) { + throw new InvocationTargetException(e,e.getMessage()); + } + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java new file mode 100644 index 0000000..760715c --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java @@ -0,0 +1,280 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import java.io.File; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogSettings; +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.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.yocto.remote.utils.CommonHelper; +import org.yocto.sdk.remotetools.Activator; +import org.yocto.sdk.remotetools.Messages; +import org.yocto.sdk.remotetools.SWTFactory; + +public class SystemtapSettingDialog extends Dialog { + + static protected String TITLE="Systemtap Crosstap"; + protected String title; + protected String metadata_location; + protected String builddir_location; + protected String systemtap_script; + protected String user_id; + protected String remote_host; + protected String systemtap_args; + protected boolean okPressed; + protected Button metadataLocationBtn; + protected Button builddirLocationBtn; + protected Button systemtapScriptBtn; + protected Text userIDText; + protected Text remoteHostText; + protected Text systemtapArgsText; + protected Text systemtapScriptText; + protected Text metadataLocationText; + protected Text builddirLocationText; + + protected SystemtapSettingDialog(Shell parentShell, String title) { + super(parentShell); + this.title = title; + this.okPressed = false; + setShellStyle(getShellStyle() | SWT.RESIZE); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(title); + } + + public boolean isOKPressed() { + return okPressed; + } + + public String getSystemtapScript() { + return systemtap_script; + } + + public String getMetadataLocation() { + return metadata_location; + } + + public String getBuilddirLocation() { + return builddir_location; + } + + public String getRemoteHost() { + return remote_host; + } + + public String getUserID() { + return user_id; + } + + public String getSystemtapArgs() { + return systemtap_args; + } + @Override + protected Control createDialogArea(Composite parent) { + Composite comp=(Composite)super.createDialogArea(parent); + GridLayout topLayout = new GridLayout(); + comp.setLayout(topLayout); + + /*argument*/ + SWTFactory.createVerticalSpacer(comp, 1); + createInternal(comp); + + return comp; + } + + protected void createInternal(Composite parent) + { + Composite projComp = new Composite(parent, SWT.NONE); + GridLayout projLayout = new GridLayout(); + projLayout.numColumns = 2; + projLayout.marginHeight = 0; + projLayout.marginWidth = 0; + projComp.setLayout(projLayout); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + projComp.setLayoutData(gd); + + Label label = new Label(projComp, SWT.NONE); + label.setText(Messages.Metadata_Location); + Composite textContainer = new Composite(projComp, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + metadataLocationText = (Text)addTextControl(textContainer, metadata_location); + metadataLocationBtn = addDirSelectButton(textContainer, metadataLocationText); + + label = new Label(projComp, SWT.NONE); + label.setText(Messages.Builddir_Location); + textContainer = new Composite(projComp, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + builddirLocationText = (Text)addTextControl(textContainer, builddir_location); + builddirLocationBtn = addDirSelectButton(textContainer, builddirLocationText); + + label = new Label(projComp, SWT.NONE); + label.setText(Messages.User_ID); + userIDText = new Text(projComp, SWT.SINGLE | SWT.BORDER); + + if(user_id!=null) + userIDText.setText(user_id); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 1; + userIDText.setLayoutData(gd); + + label = new Label(projComp, SWT.NONE); + label.setText(Messages.Remote_Host); + + remoteHostText = new Text(projComp, SWT.SINGLE | SWT.BORDER); + if(remote_host != null) + remoteHostText.setText(remote_host); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 1; + remoteHostText.setLayoutData(gd); + + label = new Label(projComp, SWT.NONE); + label.setText(Messages.Systemtap_Script); + textContainer = new Composite(projComp, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + systemtapScriptText = (Text)addTextControl(textContainer, systemtap_script); + systemtapScriptBtn = addFileSelectButton(textContainer, systemtapScriptText); + + label = new Label(projComp, SWT.NONE); + label.setText(Messages.Systemtap_Args); + + systemtapArgsText = new Text(projComp, SWT.SINGLE | SWT.BORDER); + if(systemtap_args != null) + systemtapArgsText.setText(systemtap_args); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 1; + systemtapArgsText.setLayoutData(gd); + } + + private Control addTextControl(final Composite parent, String value) { + final Text text; + + text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); + text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + if (value != null) + text.setText(value); + text.setSize(10, 150); + return (Control)text; + } + + private Button addDirSelectButton(final Composite parent, final Text text) { + Button button = new Button(parent, SWT.PUSH | SWT.LEAD); + button.setText("Browse"); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + String dirName; + + dirName = new DirectoryDialog(parent.getShell()).open(); + if (dirName != null) { + text.setText(dirName); + } + } + }); + return button; + } + + private Button addFileSelectButton(final Composite parent, final Text text) { + Button button = new Button(parent, SWT.PUSH | SWT.LEAD); + button.setText("Browse"); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + String fileName; + + fileName = new FileDialog(parent.getShell()).open(); + if (fileName != null) { + text.setText(fileName); + } + } + }); + return button; + } + + @Override + protected void okPressed() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + metadata_location = metadataLocationText.getText(); + if ( (metadata_location == null) || metadata_location.isEmpty()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your metadata location!"); + return; + } + File metadata_dir = new File(metadata_location); + if (!metadata_dir.exists()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "The specified metadata location does not exist!"); + return; + } + if (!metadata_dir.isDirectory()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "The specified metadata location is not a directory!"); + return; + } + builddir_location = builddirLocationText.getText(); + if ( (builddir_location == null) || builddir_location.isEmpty()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your builddir location!"); + return; + } + File builddir_dir = new File(builddir_location); + if (!builddir_dir.exists()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "The specified builddir location does not exist!"); + } + if (!metadata_dir.isDirectory()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "The specified builddir location is not a directory!"); + return; + } + user_id = userIDText.getText(); + if ( (user_id == null) || user_id.isEmpty()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify remote user id!"); + return; + } + + remote_host = remoteHostText.getText(); + if ( (remote_host == null) || remote_host.isEmpty()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify remote host IP!"); + return; + } + + systemtap_script = systemtapScriptText.getText(); + if ( (systemtap_script == null) || systemtap_script.isEmpty()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your systemtap script"); + return; + } + File script_file = new File(systemtap_script); + if (!script_file.exists()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "The specified systemtap script does not exist!"); + return; + } + if (!script_file.isFile()) { + CommonHelper.showErrorDialog("SystemTap Error", null, "The specified systemtap script is not a file!"); + return; + } + systemtap_args = systemtapArgsText.getText(); + okPressed = true; + super.okPressed(); + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java new file mode 100644 index 0000000..9e18097 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.progress.IProgressService; + +import org.yocto.sdk.remotetools.Messages; + +public class Ust2Handler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + + //if(UstModel.checkAvail()!=true) { + // return null; + //} + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + + Ust2SettingDialog setting=new Ust2SettingDialog( + window.getShell() + ); + + if(setting.open()==BaseSettingDialog.OK) { + IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); + String project = setting.getProject(); + if (project == null) { + MessageDialog.openError(window.getShell(), "Lttng-ust", Messages.ErrorUstProject); + return null; + } + Ust2Model op=new Ust2Model(setting.getHost(),setting.getTrace(), project, window); + try { + progressService.busyCursorWhile(op); + }catch (InterruptedException e) { + //user cancelled + }catch (Exception e) { + e.printStackTrace(); + MessageDialog.openError(window.getShell(), + "Ust", + (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); + } + } + return null; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java new file mode 100644 index 0000000..8dcc5b3 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.ui.IWorkbenchWindow; + +public class Ust2Model extends BaseModel { + + private static final String REMOTE_EXEC = "/tmp/ust_tar.sh"; + private static final String LOCAL_SCRIPT = "resources/ust_tar.sh"; + + private static final String LOCAL_FILE_SUFFIX = ".local.tar"; + private static final String REMOTE_FILE_SUFFIX = ".tar"; + private static final String LOCAL_EXEC = "lttv-gui"; + private static final String TRACE_FOLDER_NAME = "Traces"; + private static final String DATAFILE_PREFIX = "ustfile:"; + + private static final String TASK_NAME = "ust2trace command"; + + private String trace_loc; + + private String prj_name; + + private IWorkbenchWindow window; + + public Ust2Model(IHost host, String trace, String project, IWorkbenchWindow window) { + super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC); + trace_loc = trace; + + prj_name = project; + this.window = window; + } + + @Override + protected void checkTerminate(InputStream is) throws IOException { + String temp; + BufferedReader in = new BufferedReader(new InputStreamReader(is)); + while((temp = in.readLine())!=null) { + int idx = temp.indexOf(DATAFILE_PREFIX); + if(idx != -1) { + remoteFile = temp.substring(idx + DATAFILE_PREFIX.length()); + break; + } + } + } + + private void generateData(IProgressMonitor monitor) throws Exception { + runRemoteShellExec(monitor, trace_loc, true); + if(remoteFile == null) + throw new Exception("Ust: null remote data file"); + if(remoteFile.endsWith(REMOTE_FILE_SUFFIX)==false) + throw new Exception("Wrong ust data file " + remoteFile); + + localFile = new String(remoteFile.substring(0, remoteFile.length()-4) + LOCAL_FILE_SUFFIX); + } + + private void importToProject(IProgressMonitor monitor) throws Exception { + ProcessBuilder pb = new ProcessBuilder("tar", "fx", localFile); + pb.directory(new File("/tmp")); + Process p=pb.start(); + if(p.waitFor()!=0) + throw new Exception("extract ust data files failed"); + + String traceName = localFile.substring(0,localFile.length()-LOCAL_FILE_SUFFIX.length()); + + IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); + IPath full_path = wsroot.getFullPath(); + IProject project = wsroot.getProject(prj_name); + IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME); + if (!traceFolder.exists()) { + throw new Exception("Can't find file trace folder in selected project."); + } + + String trace_str = traceName.substring(0, traceName.indexOf('-')); + traceFolder.createLink(new Path(trace_str), IResource.REPLACE, monitor); + for (IResource resource:traceFolder.members()) { + String extension = resource.getFileExtension(); + if (extension != null) + continue; + else { + //traceFolder.setPersistentProperty(TmfCommonConstants.TRACETYPE, "org.eclipse.linuxtools.tmf.ui.type.ctf"); + //resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, "org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace"); + //traceFolder.setPersistentProperty(TmfCommonConstants.TRACEICON, "icons/obj16/garland16.png"); + //traceFolder.touch(null); + } + } + } + + private String[] generateViewerParam() throws Exception { + String viewerParam=new String(LOCAL_EXEC); + int i; + + ProcessBuilder pb = new ProcessBuilder("tar", "fx", localFile); + pb.directory(new File("/tmp")); + Process p=pb.start(); + if(p.waitFor()!=0) + throw new Exception("extract ust data files failed"); + File f=new File(localFile.substring(0,localFile.length()-LOCAL_FILE_SUFFIX.length())); + File []subdir=f.listFiles(); + + for (i=0;i= 0 ? projectCombo + .getItem(currentSelection) : null; + IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); + IProject project = wsroot.getProject(importProject); + return project; + } + + protected void updateProjectPulldown() { + int index=-1; + + projectCombo.removeAll(); + IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); + IProject[] projects = wsroot.getProjects(); + + for (int i = 0; i < projects.length; ++i) { + try { + if (projects[i].isOpen() && projects[i].hasNature(TmfProjectNature.ID)) { + String projName = projects[i].getName(); + projectCombo.add(projName); + if (curProject != null) + if (projName.matches(curProject)) + index = i; + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + if(index>=0) { + projectCombo.select(index); + }else if (projectCombo.getItemCount()> 0) { + projectCombo.select(projectCombo.getItemCount() - 1); + } + + //TODO + //connectionCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT,true); + projectCombo.pack(true); + projectCombo.layout(); + projectCombo.getParent().layout(); + + updateCurProject(); + } + protected void createArgument(Composite parent) + { + } + + @Override + protected boolean updateOkButton() { + boolean ret=super.updateOkButton(); + return ret; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java new file mode 100644 index 0000000..c97afb6 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.actions; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +import org.yocto.sdk.remotetools.wizards.bsp.YoctoBSPWizard; + +public class YoctoBspHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + // Instantiates and initializes the wizard + YoctoBSPWizard bspWizard = new YoctoBSPWizard(); + //bspWizard.init(window.getWorkbench(), (IStructuredSelection)selection); + // Instantiates the wizard container with the wizard and opens it + WizardDialog dialog = new WizardDialog(window.getShell(), bspWizard); + //dialog.create(); + dialog.open(); + //YoctoBspDialog setting=new YoctoBspDialog(window.getShell()); + //setting.open(); + return null; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties new file mode 100644 index 0000000..2d6d8af --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties @@ -0,0 +1,49 @@ +################################################################################ +# Copyright (c) 2010 Intel 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: +# Intel - initial API and implementation +################################################################################ + +# NLS_MESSAGEFORMAT_VAR +# NLS_ENCODING=UTF-8 + +ErrorNoSubsystem=No subsystem found. +ErrorConnectSubsystem=Could not connect to the remote system. +ErrorNoHost=No remote host found. +ErrorNoRemoteService=No remote TCF service found. +ErrorOprofileViewer=Local application "oprofile-viewer" is NOT installed.\nPlease goto http://git.yoctoproject.org/cgit/cgit.cgi/oprofileui to install OprofileUI. +ErrorOprofile=Oprofile is NOT installed on the local host.\n Please goto http://oprofile.sourceforge.net to install Oprofile. +ErrorLttvGui=Local application "lttv-gui" is NOT installed.\nPlease goto http://lttng.org to install LTTng Viewer. +ErrorUstProject=No Lttng Project selected. If the list is empty, please create a Lttng project under File->New! + +InfoDownload=Downloading +InfoUpload=Uploading + +BaseSettingDialog_Connection=Connection +BaseSettingDialog_New=New +BaseSettingDialog_Properties=Properties +Usttrace_Argument_Text=Argument +Usttrace_Application_Text=Application +Usttrace_Trace_Loc_Text=Ust directory path +Powertop_Time_Text=Time to gather data(sec) +Powertop_ShowPid_Text=show pids in wakeups list +TerminalViewer_text=This view is dedicated to Yocto Remote tools. Please use the "Yocto Remote Tools" menu to open the view. +//Systemtap_KO_Text=Kernel Module: +Metadata_Location=Metadata Location: +Builddir_Location=Build dir Location: +User_ID=User ID: +Remote_Host=Remote Host: +Systemtap_Script=Systemtap Script: +Systemtap_Args=Systemtap Args: +Import_to_Project=Import to project: + +LocalJob_Title=Launching local application +ErrorLocalJob=Failed in launching local application + +RemoteShellExec_1=Executing {0} {1} +RemoteShellExec_2=Could not create the hostShellProcess.\n \ No newline at end of file diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java new file mode 100644 index 0000000..a5801c7 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.views; + + +import java.io.BufferedReader; +import java.io.FileReader; +import java.util.ArrayList; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.part.*; +import org.eclipse.jface.viewers.*; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.*; +import org.eclipse.swt.SWT; + + +/** + * This sample class demonstrates how to plug-in a new + * workbench view. The view shows data obtained from the + * model. The sample creates a dummy model on the fly, + * but a real implementation would connect to the model + * available either in this or another plug-in (e.g. the workspace). + * The view is connected to the model using a content provider. + *

+ * The view uses a label provider to define how model + * objects should be presented in the view. Each + * view can present the same model objects using + * different labels and icons, if needed. Alternatively, + * a single label provider can be shared between views + * in order to ensure that objects of the same type are + * presented in the same way everywhere. + *

+ */ + +public class BaseFileView extends ViewPart { + + /** + * The ID of the view as specified by the extension. + */ + public static final String ID = "org.yocto.sdk.remotetools.views.BaseFileView"; + + private TableViewer viewer; + + private String filename; + + /* + * The content provider class is responsible for + * providing objects to the view. It can wrap + * existing objects in adapters or simply return + * objects as-is. These objects may be sensitive + * to the current input of the view, or ignore + * it and always show the same content + * (like Task List, for example). + */ + + class ViewContentProvider implements IStructuredContentProvider { + public void inputChanged(Viewer v, Object oldInput, Object newInput) { + if(newInput instanceof String) + filename=(String)newInput; + } + public void dispose() { + } + public Object[] getElements(Object parent) { + ArrayList elements=new ArrayList (); + BufferedReader in; + String line; + try { + in=new BufferedReader(new FileReader(filename)); + }catch (Exception e) { + return new String [] {"Invalid file " + filename}; + } + + try { + do { + line=in.readLine(); + if(line!=null) + elements.add(line); + }while(line!=null); + }catch (Exception e) { + e.printStackTrace(); + } + return (String[]) elements.toArray(new String[elements.size()]); + } + } + class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { + public String getColumnText(Object obj, int index) { + return getText(obj); + } + public Image getColumnImage(Object obj, int index) { + //return getImage(obj); + return null; + } + public Image getImage(Object obj) { + return PlatformUI.getWorkbench(). + getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); + } + } + + /** + * The constructor. + */ + public BaseFileView() { + } + + public BaseFileView(String file) { + this(); + this.filename=file; + } + + /** + * This is a callback that will allow us + * to create the viewer and initialize it. + */ + public void createPartControl(Composite parent) { + viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + viewer.setContentProvider(new ViewContentProvider()); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setInput(filename); + } + + public void setInput(String filename) { + viewer.setInput(filename); + } + + /** + * Passing the focus request to the viewer's control. + */ + public void setFocus() { + viewer.getControl().setFocus(); + } +} \ No newline at end of file diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java new file mode 100644 index 0000000..bbb2d02 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java @@ -0,0 +1,457 @@ +/******************************************************************************* + * Copyright (c) 2002, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. + * + * Contributors: + * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work + * Yu-Fen Kuo (MontaVista) - Adapted from CommandsViewWorkbook + * Anna Dushistova (MontaVista) - Adapted from CommandsViewWorkbook + * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits + * Martin Oberhuber (Wind River) - [227571] RSE Terminal should honor Encoding set on the IHost + * Michael Scharf (Wind River) - [236203] [rseterminal] Potentially UI blocking code in TerminalViewTab.createTabItem + * Anna Dushistova (MontaVista) - [244437] [rseterminal] Possible race condition when multiple Terminals are launched after each other + * Martin Oberhuber (Wind River) - [247700] Terminal uses ugly fonts in JEE package + * Anna Dushistova (MontaVista) - [267609] [rseterminal] The first "Launch Terminal" command creates no terminal tab + ********************************************************************************/ +package org.yocto.sdk.remotetools.views; + +import java.io.UnsupportedEncodingException; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.resource.FontRegistry; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.rse.core.model.IHost; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MenuEvent; +import org.eclipse.swt.events.MenuListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.tm.internal.terminal.control.ITerminalListener; +import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; +import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCut; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste; +import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.themes.IThemeManager; + +/** + * This is the desktop view wrapper of the System View viewer. + */ +public class TerminalViewTab extends Composite { + + public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$ + + private final CTabFolder tabFolder; + + private IPropertyChangeListener propertyChangeListener; + + private Menu menu; + + private boolean fMenuAboutToShow; + + private TerminalActionCopy fActionEditCopy; + + private TerminalActionCut fActionEditCut; + + private TerminalActionPaste fActionEditPaste; + + private TerminalActionClearAll fActionEditClearAll; + + private TerminalActionSelectAll fActionEditSelectAll; + + protected class TerminalContextMenuHandler implements MenuListener, + IMenuListener { + public void menuHidden(MenuEvent event) { + fMenuAboutToShow = false; + fActionEditCopy.updateAction(fMenuAboutToShow); + } + + public void menuShown(MenuEvent e) { + + } + + public void menuAboutToShow(IMenuManager menuMgr) { + fMenuAboutToShow = true; + fActionEditCopy.updateAction(fMenuAboutToShow); + fActionEditCut.updateAction(fMenuAboutToShow); + fActionEditSelectAll.updateAction(fMenuAboutToShow); + fActionEditPaste.updateAction(fMenuAboutToShow); + fActionEditClearAll.updateAction(fMenuAboutToShow); + } + } + + public TerminalViewTab(final Composite parent, TerminalViewer viewer) { + super(parent, SWT.NONE); + tabFolder = new CTabFolder(this, SWT.NONE); + tabFolder.setLayout(new FillLayout()); + tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); + setLayout(new FillLayout()); + tabFolder.setBackground(parent.getBackground()); + tabFolder.setSimple(false); + tabFolder.setUnselectedImageVisible(false); + tabFolder.setUnselectedCloseVisible(false); + + tabFolder.setMinimizeVisible(false); + tabFolder.setMaximizeVisible(false); +//TODO setupActions(); + } + + public void dispose() { + if (propertyChangeListener != null) { + IThemeManager mgr = PlatformUI.getWorkbench().getThemeManager(); + mgr.removePropertyChangeListener(propertyChangeListener); + propertyChangeListener = null; + } + if (!tabFolder.isDisposed()) { + tabFolder.dispose(); + } + super.dispose(); + } + + public CTabFolder getFolder() { + return tabFolder; + } + + public void remove(Object root) { + + } + + public int getItemCount(){ + return tabFolder.getItemCount(); + } + + public CTabItem getSelectedTab() { + if (tabFolder.getItemCount() > 0) { + int index = tabFolder.getSelectionIndex(); + CTabItem item = tabFolder.getItem(index); + return item; + } + + return null; + } + + public void showCurrentPage() { + tabFolder.setFocus(); + } + + public void showPageFor(Object root) { + for (int i = 0; i < tabFolder.getItemCount(); i++) { + CTabItem item = tabFolder.getItem(i); + if (item.getData() == root) { + tabFolder.setSelection(item); + } + + } + } + + public void showPageFor(String tabName) { + for (int i = 0; i < tabFolder.getItemCount(); i++) { + CTabItem item = tabFolder.getItem(i); + if (item.getText().equals(tabName)) { + tabFolder.setSelection(item); + return; + } + + } + } + + public void disposePageFor(String tabName) { + for (int i = 0; i < tabFolder.getItemCount(); i++) { + CTabItem item = tabFolder.getItem(i); + if (item.getText().equals(tabName)) { + item.dispose(); + return; + } + + } + } + + public void propertyChange(PropertyChangeEvent e) { + // for now always update + if (tabFolder!=null) { + CTabItem[] items = tabFolder.getItems(); + for (int i=0; i values = new ArrayList(); + + try { + ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", command}); + // redirect error stream to collect both output & error + builder.redirectErrorStream(true); + Process process = builder.start(); + BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); + String line = null; + String errorMessage = ""; + while ( (line = br.readLine()) != null) { + String[] result = processLine(line); + String status = result[0]; + String value = result[1]; + if (status.equals(ERROR) && !value.isEmpty()) { + errorMessage += value; + continue; + } + if (!value.isEmpty()) + values.add(value); + } + int exitVal = process.waitFor(); + + // if the background process did not exit with 0 code, we should set the status accordingly + if (exitVal != 0) { + bspAction.setMessage(errorMessage); + bspAction.setItems(null); + } + } catch (Exception e) { + bspAction.setMessage(e.getMessage()); + bspAction.setItems(null); + } + if (!values.isEmpty()) { + bspAction.setMessage(null); + bspAction.setItems(values.toArray(new String[values.size()])); + } + } + + /** + * Each command ran in the background will have a different output and a different way of processing it + * @param line + * @return + */ + protected abstract String[] processLine(String line); + + public BSPAction getBspAction() { + return bspAction; + } + + public void setBspAction(BSPAction bspAction) { + this.bspAction = bspAction; + } + + public String getCommand() { + return command; + } + + public void setCommand(String command) { + this.command = command; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java new file mode 100644 index 0000000..d39ac28 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java @@ -0,0 +1,19 @@ +package org.yocto.sdk.remotetools.wizards.bsp; + +/** + * BSPThread that ignores the output of the process and returns an error if the process exits with non zero code + * @author ioana.grigoropol + * + */ +public class ErrorCollectorThread extends BSPThread{ + + public ErrorCollectorThread(String command) { + super(command); + } + + @Override + protected String[] processLine(String line) { + return null; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java new file mode 100644 index 0000000..833057a --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java @@ -0,0 +1,23 @@ +package org.yocto.sdk.remotetools.wizards.bsp; + +/** + * BSPThread that processes the output of "yocto-bsp list karch" + * @author ioana.grigoropol + * + */ +public class KernelArchGetter extends BSPThread{ + + public KernelArchGetter(String command) { + super(command); + } + + @Override + protected String[] processLine(String line) { + if (line.contains(":")) + return new String[]{SUCCESS, ""}; + line = line.replaceAll("^\\s+", ""); + line = line.replaceAll("\\s+$", ""); + return new String[]{SUCCESS, line}; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java new file mode 100644 index 0000000..4caea2c --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java @@ -0,0 +1,28 @@ +package org.yocto.sdk.remotetools.wizards.bsp; + +/** + * BSPThread that processes the output lines from running command "yocto-bsp list" for the selected kernel + * @author ioana.grigoropol + * + */ +public class KernelBranchesGetter extends BSPThread { + + public KernelBranchesGetter(String command) { + super(command); + } + + @Override + protected String[] processLine(String line) { + // [TODO : Ioana]: find a better way to identify error lines + if (!line.startsWith("[")) + return new String[]{ERROR, line + "\n"}; + + String[] items = line.split(","); + + String value = items[0]; + value = value.replace("[\"", ""); + value = value.replaceAll("\"$", ""); + return new String[]{SUCCESS, value}; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java new file mode 100644 index 0000000..ea6544f --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java @@ -0,0 +1,498 @@ +/******************************************************************************* + * Copyright (c) 2012 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.wizards.bsp; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; +import org.yocto.sdk.remotetools.YoctoBspElement; + +/** + * + * Setting up the parameters for creating the new Yocto BSP + * + * @author jzhang + */ +public class MainPage extends WizardPage { + public static final String PAGE_NAME = "Main"; + private static final String KARCH_CMD = "yocto-bsp list karch"; + private static final String QARCH_CMD = "yocto-bsp list qemu property qemuarch"; + private static final String BSP_SCRIPT = "yocto-bsp"; + private static final String PROPERTIES_CMD_PREFIX = "yocto-bsp list "; + private static final String PROPERTIES_CMD_SURFIX = " properties -o "; + private static final String PROPERTIES_FILE = "/tmp/properties.json"; + + private Button btnMetadataLoc; + private Text textMetadataLoc; + private Label labelMetadata; + + private Button btnBspOutputLoc; + private Text textBspOutputLoc; + private Label labelBspOutput; + + private Button btnBuildLoc; + private Text textBuildLoc; + private Label labelBuildLoc; + + private boolean buildDirChecked; + private BuildLocationListener buildLocationListener; + + private Text textBspName; + private Label labelBspName; + + private Combo comboKArch; + private Label labelKArch; + + private Combo comboQArch; + private Label labelQArch; + + private YoctoBspElement bspElem; + + public MainPage(YoctoBspElement element) { + super(PAGE_NAME, "yocto-bsp Main page", null); + + setMessage("Enter the required fields(with *) to create new Yocto Project BSP!"); + this.bspElem = element; + } + + @Override + public void createControl(Composite parent) { + setErrorMessage(null); + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(2, false); + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + composite.setLayout(layout); + gd.horizontalSpan = 2; + composite.setLayoutData(gd); + + labelMetadata = new Label(composite, SWT.NONE); + labelMetadata.setText("Metadata location*: "); + Composite textContainer = new Composite(composite, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + textMetadataLoc = (Text)addTextControl(textContainer, ""); + textMetadataLoc.setEnabled(false); + textMetadataLoc.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + controlChanged(e.widget); + } + }); + setBtnMetadataLoc(addFileSelectButton(textContainer, textMetadataLoc)); + + labelBuildLoc = new Label(composite, SWT.NONE); + labelBuildLoc.setText("Build location: "); + + textContainer = new Composite(composite, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + textBuildLoc = (Text)addTextControl(textContainer, ""); + buildLocationListener = new BuildLocationListener(""); + textBuildLoc.addFocusListener(buildLocationListener); + + setBtnBuilddirLoc(addFileSelectButton(textContainer, textBuildLoc)); + + labelBspName = new Label(composite, SWT.NONE); + labelBspName.setText("BSP Name*: "); + + textContainer = new Composite(composite, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + textBspName = (Text)addTextControl(textContainer, ""); + textBspName.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + controlChanged(e.widget); + } + }); + + labelBspOutput = new Label(composite, SWT.NONE); + labelBspOutput.setText("BSP output location: "); + + textContainer = new Composite(composite, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + textBspOutputLoc = (Text)addTextControl(textContainer, ""); + textBspOutputLoc.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + controlChanged(e.widget); + } + }); + setBtnBspOutLoc(addFileSelectButton(textContainer, textBspOutputLoc)); + + labelKArch = new Label(composite, SWT.NONE); + labelKArch.setText("Kernel Architecture*: "); + + textContainer = new Composite(composite, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + comboKArch = new Combo(textContainer, SWT.READ_ONLY); + comboKArch.setLayout(new GridLayout(2, false)); + comboKArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + comboKArch.setEnabled(false); + comboKArch.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + controlChanged(e.widget); + } + }); + + labelQArch = new Label(composite, SWT.NONE); + labelQArch.setText("Qemu Architecture(* for karch as qemu): "); + labelQArch.setEnabled(false); + + textContainer = new Composite(composite, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + comboQArch = new Combo(textContainer, SWT.READ_ONLY); + comboQArch.setLayout(new GridLayout(2, false)); + comboQArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + comboQArch.setEnabled(false); + comboQArch.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + controlChanged(e.widget); + } + }); + + setControl(composite); + validatePage(); + } + + private Control addTextControl(final Composite parent, String value) { + final Text text; + + text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); + text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + text.setText(value); + text.setSize(10, 150); + + return text; + } + + private Button addFileSelectButton(final Composite parent, final Text text) { + Button button = new Button(parent, SWT.PUSH | SWT.LEAD); + button.setText("Browse..."); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + String dirName = new DirectoryDialog(parent.getShell()).open(); + if (dirName != null) { + text.setText(dirName); + } + } + }); + return button; + } + + private void controlChanged(Widget widget) { + Status status = new Status(IStatus.OK, "not_used", 0, "", null); + setErrorMessage(null); + String metadataLoc = textMetadataLoc.getText(); + + if (widget == textMetadataLoc) { + resetKarchCombo(); + if (metadataLoc.length() == 0) { + status = new Status(IStatus.ERROR, "not_used", 0, "Meta data location can't be empty!", null); + } else { + File meta_data = new File(metadataLoc); + if (!meta_data.exists() || !meta_data.isDirectory()) { + status = new Status(IStatus.ERROR, "not_used", 0, + "Invalid meta data location: Make sure it exists and is a directory!", null); + } else { + File bspScript = new File(metadataLoc + "/scripts/" + BSP_SCRIPT); + if (!bspScript.exists() || !bspScript.canExecute()) + status = new Status(IStatus.ERROR, "not_used", 0, + "Make sure yocto-bsp exists under \"" + metadataLoc + "/scripts\" and is executable!", null); + else { + kernelArchesHandler(); + } + } + } + } else if (widget == comboKArch) { + String selection = comboKArch.getText(); + if (!bspElem.getKarch().contentEquals(selection)) + bspElem = new YoctoBspElement(); + if (selection.matches("qemu")) { + labelQArch.setEnabled(true); + comboQArch.setEnabled(true); + } else { + labelQArch.setEnabled(false); + comboQArch.setEnabled(false); + } + } + + String buildDir = textBuildLoc.getText(); + String outputDir = textBspOutputLoc.getText(); + String bspName = textBspName.getText(); + + if (bspName.contains(" ")) { + status = new Status(IStatus.ERROR, "not_used", 0, + "BSP name contains space which is not allowed!", null); + } + + if (!outputDir.isEmpty()){ + if (outputDir.matches(buildDir)) { + status = new Status(IStatus.ERROR, "not_used", 0, + "You've set BSP output directory the same as build directory, please leave output directory empty for this scenario!", null); + } else { + File outputDirectory = new File(outputDir); + if (outputDirectory.exists()){ + status = new Status(IStatus.ERROR, "not_used", 0, + "Your BSP output directory points to an exiting directory!", null); + } + } + } else if (buildDir.startsWith(metadataLoc) && !bspName.isEmpty()) { + String bspDirStr = metadataLoc + "/meta-" + bspName; + File bspDir = new File(bspDirStr); + if (bspDir.exists()) { + status = new Status(IStatus.ERROR, "not_used", 0, + "Your BSP with name: " + bspName + " already exist under directory: " + bspDirStr + ", please change your bsp name!", null); + } + } + + if (status.getSeverity() == IStatus.ERROR) + setErrorMessage(status.getMessage()); + + getWizard().getContainer().updateButtons(); + canFlipToNextPage(); + } + + private Status checkBuildDir() { + + String metadataLoc = textMetadataLoc.getText(); + String buildLoc = textBuildLoc.getText(); + + if (buildLoc.isEmpty()) { + buildLoc = metadataLoc + "/build"; + return createBuildDir(buildLoc); + } else { + File buildLocDir = new File(buildLoc); + if (!buildLocDir.exists()) { + return createBuildDir(buildLoc); + } else if (buildLocDir.isDirectory()) { + return createBuildDir(buildLoc); + } else { + return new Status(IStatus.ERROR, "not_used", 0, "Invalid build location: Make sure the build location is a directory!", null); + } + } + } + + private Status createBuildDir(String buildLoc) { + String metadataDir = textMetadataLoc.getText(); + + // if we do not change the directory to metadata location the script will be looked into the directory indicated by user.dir system property + // system.property usually points to the location from where eclipse was started + String createBuildDirCmd = "cd " + metadataDir + ";source " + metadataDir + "/oe-init-build-env " + buildLoc; + + try { + ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", createBuildDirCmd}); + Process proc = builder.start(); + InputStream errorStream = proc.getErrorStream(); + InputStreamReader isr = new InputStreamReader(errorStream); + BufferedReader br = new BufferedReader(isr); + String line = null; + String status = ""; + while ( (line = br.readLine()) != null) { + status += line; + } + + if (proc.waitFor() != 0) + return new Status(IStatus.ERROR, "not_used", 0, status, null);; + return new Status(IStatus.OK, "not_used", 0, "", null); + } catch (Exception e) { + return new Status(IStatus.ERROR, "not_used", 0, e.getMessage(), null); + } + } + + public YoctoBspElement getBSPElement() { + return this.bspElem; + } + + + private void resetKarchCombo() { + comboKArch.deselectAll(); + comboQArch.deselectAll(); + comboKArch.setEnabled(false); + labelQArch.setEnabled(false); + comboQArch.setEnabled(false); + } + + private void kernelArchesHandler() { + BSPAction kArchesAction = getKArches(); + if (kArchesAction.getMessage() == null && kArchesAction.getItems().length != 0) { + comboKArch.setItems(kArchesAction.getItems()); + comboKArch.setEnabled(true); + } else if (kArchesAction.getMessage() != null){ + setErrorMessage(kArchesAction.getMessage()); + return; + } + BSPAction qArchesAction = getQArches(); + if (qArchesAction.getMessage() == null && qArchesAction.getItems().length != 0) { + comboQArch.setItems(qArchesAction.getItems()); + } else if (qArchesAction.getMessage() != null) + setErrorMessage(qArchesAction.getMessage()); + + } + + @Override + public boolean canFlipToNextPage(){ + String err = getErrorMessage(); + if (err != null) + return false; + else if (!validatePage()) + return false; + return true; + } + + + public boolean validatePage() { + String metadataLoc = textMetadataLoc.getText(); + String bspname = textBspName.getText(); + String karch = comboKArch.getText(); + String qarch = comboQArch.getText(); + if (metadataLoc.isEmpty() || + bspname.isEmpty() || + karch.isEmpty()) { + return false; + } else if (karch.matches("qemu") && qarch.isEmpty()) { + return false; + } + + bspElem.setBspName(bspname); + if (!textBspOutputLoc.getText().isEmpty()) + bspElem.setBspOutLoc(textBspOutputLoc.getText()); + else + bspElem.setBspOutLoc(""); + if (!textBuildLoc.getText().isEmpty()) { + checkBuildDir(); + bspElem.setBuildLoc(textBuildLoc.getText()); + } else { + bspElem.setBuildLoc(metadataLoc + "/build"); + if (!buildDirChecked) { + checkBuildDir(); + buildDirChecked = true; + } + } + bspElem.setMetadataLoc(metadataLoc); + bspElem.setKarch(karch); + bspElem.setQarch(qarch); + + + if (!bspElem.getValidPropertiesFile()) { + boolean validPropertiesFile = true; + BSPAction action = createPropertiesFile(); + if (action.getMessage() != null) { + validPropertiesFile = false; + setErrorMessage(action.getMessage()); + } + bspElem.setValidPropertiesFile(validPropertiesFile); + } + return true; + } + + private BSPAction createPropertiesFile() { + String createPropertiesCmd = bspElem.getMetadataLoc() + "/scripts/" + + PROPERTIES_CMD_PREFIX + bspElem.getKarch() + + PROPERTIES_CMD_SURFIX + PROPERTIES_FILE; + BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new ErrorCollectorThread(createPropertiesCmd), "Creating properties file "); + progressDialog.run(false); + return progressDialog.getBspAction(); + } + + private BSPAction getKArches() { + String getKArchCmd = textMetadataLoc.getText() + "/scripts/" + KARCH_CMD; + BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelArchGetter(getKArchCmd), "Loading kernel architectures "); + progressDialog.run(false); + return progressDialog.getBspAction(); + } + + private BSPAction getQArches() { + String getQArchCmd = textMetadataLoc.getText() + "/scripts/" + QARCH_CMD; + BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new QemuArchGetter(getQArchCmd), "Loading Qemu architectures "); + progressDialog.run(false); + return progressDialog.getBspAction(); + } + + public Button getBtnMetadataLoc() { + return btnMetadataLoc; + } + + public void setBtnMetadataLoc(Button btnMetadataLoc) { + this.btnMetadataLoc = btnMetadataLoc; + } + + public Button getBtnBspOutLoc() { + return btnBspOutputLoc; + } + + public void setBtnBspOutLoc(Button btnBspOutLoc) { + this.btnBspOutputLoc = btnBspOutLoc; + } + + public Button getBtnBuilddirLoc() { + return btnBuildLoc; + } + + public void setBtnBuilddirLoc(Button btnBuilddirLoc) { + this.btnBuildLoc = btnBuilddirLoc; + } + + class BuildLocationListener implements FocusListener{ + String value; + boolean changed; + + BuildLocationListener(String value){ + this.value = value; + } + @Override + public void focusGained(FocusEvent e) { + value = ((Text)e.getSource()).getText(); + } + + @Override + public void focusLost(FocusEvent e) { + if(!((Text)e.getSource()).getText().equals(value)) { + checkBuildDir(); + buildDirChecked = true; + } + } + + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java new file mode 100644 index 0000000..df5fba5 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java @@ -0,0 +1,19 @@ +package org.yocto.sdk.remotetools.wizards.bsp; + +/** + * BSPThread that returns all the output lines of the process execution + * @author ioana.grigoropol + * + */ +public class OutputCollectorThread extends BSPThread{ + + public OutputCollectorThread(String command) { + super(command); + } + + @Override + protected String[] processLine(String line) { + return new String[]{SUCCESS, line}; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java new file mode 100644 index 0000000..18149e7 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java @@ -0,0 +1,498 @@ +/******************************************************************************* + * Copyright (c) 2012 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.wizards.bsp; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; +import org.yocto.sdk.remotetools.YoctoBspElement; +import org.yocto.sdk.remotetools.YoctoBspPropertyElement; +import org.yocto.sdk.remotetools.YoctoJSONHelper; +/** + * + * Setting up the parameters for creating the new Yocto BSP + * + * @author jzhang + */ +public class PropertiesPage extends WizardPage { + private static final String PAGE_NAME = "Properties"; + private static final String VALUES_CMD_PREFIX = "yocto-bsp list "; + private static final String VALUES_CMD_SURFIX = " property "; + private static final String KERNEL_CHOICE = "kernel_choice"; + private static final String DEFAULT_KERNEL = "use_default_kernel"; + private static final String SMP_NAME = "smp"; + private static final String EXISTING_KBRANCH_NAME = "existing_kbranch"; + private static final String NEED_NEW_KBRANCH_NAME = "need_new_kbranch"; + private static final String NEW_KBRANCH_NAME = "new_kbranch"; + private static final String QARCH_NAME = "qemuarch"; + + private static final String KERNEL_CHOICES = "choices"; + private static final String KERNEL_BRANCHES = "branches"; + + private Hashtable propertyControlMap; + HashSet properties; + + private ScrolledComposite composite; + private Composite controlContainer = null; + + private YoctoBspElement bspElem = null; + private boolean kArchChanged = false; + + private Combo kernelCombo; + private Combo branchesCombo; + + private Button newBranchButton; + private Button existingBranchButton; + + private Button smpButton; + + private Group kGroup = null; + private Group kbGroup = null; +// private Group otherSettingsGroup = null; + private Group propertyGroup = null; + + public PropertiesPage(YoctoBspElement element) { + super(PAGE_NAME, "yocto-bsp Properties page", null); + this.bspElem = element; + } + + public void onEnterPage(YoctoBspElement element) { + if (!element.getValidPropertiesFile()) { + setErrorMessage("There's no valid properties file created, please choose \"Back\" to reselect kernel architecture!"); + return; + } + + if (this.bspElem == null || this.bspElem.getKarch().isEmpty() || !this.bspElem.getKarch().contentEquals(element.getKarch())) { + kArchChanged = true; + } else + kArchChanged = false; + + this.bspElem = element; + try { + if (kArchChanged) { + updateKernelValues(KERNEL_CHOICES, KERNEL_CHOICE); + + if (propertyGroup != null) { + for (Control cntrl : propertyGroup.getChildren()) { + cntrl.dispose(); + } + } + + properties = YoctoJSONHelper.getProperties(); + + if (!properties.isEmpty()) { + + if (!element.getQarch().isEmpty()) { + YoctoBspPropertyElement qarch_elem = new YoctoBspPropertyElement(); + qarch_elem.setName(QARCH_NAME); + qarch_elem.setValue(element.getQarch()); + properties.add(qarch_elem); + } + + propertyControlMap = new Hashtable(); + + ArrayList propertiesList = new ArrayList(properties); + Collections.sort(propertiesList, Collections.reverseOrder()); + + Iterator it = propertiesList.iterator(); + Composite comp = new Composite(propertyGroup, SWT.FILL); + GridLayout layout = new GridLayout(2, false); + GridData data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1); + comp.setLayoutData(data); + comp.setLayout(layout); + + while (it.hasNext()) { + // Get property + YoctoBspPropertyElement propElem = it.next(); + String type = propElem.getType(); + String name = propElem.getName(); + if (type.contentEquals("edit")) { + new Label (propertyGroup, SWT.FILL).setText(name + ":"); + + Composite textContainer = new Composite(propertyGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(1, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + Text text = new Text(textContainer, SWT.BORDER | SWT.SINGLE); + text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + propertyControlMap.put(propElem, text); + + } else if (type.contentEquals("boolean")) { + String default_value = propElem.getDefaultValue(); + Composite labelContainer = new Composite(propertyGroup, SWT.NONE); + labelContainer.setLayout(new GridLayout(2, false)); + labelContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, false, 2, 1)); + Button button = new Button(propertyGroup, SWT.CHECK); + button.setText(name); + if (default_value.equalsIgnoreCase("y")) { + button.setSelection(true); + } else + button.setSelection(false); + propertyControlMap.put(propElem, button); + } else if (type.contentEquals("choicelist")) { + new Label (propertyGroup, SWT.NONE).setText(name + ":"); + + Composite textContainer = new Composite(propertyGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(1, false)); + textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + Combo combo = new Combo(textContainer, SWT.READ_ONLY); + combo.setLayout(new GridLayout(2, false)); + combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + combo.setItems(getBSPComboProperties(name)); + propertyControlMap.put(propElem, combo); + } + } + } + composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); + composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); + controlContainer.pack(); + this.composite.layout(true, true); + } + } catch (Exception e) { + e.printStackTrace(); + } + + + } + + + @Override + public void createControl(Composite parent) { + this.composite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); + GridLayout layout = new GridLayout(2, true); + this.composite.setLayout(layout); + + gd= new GridData(SWT.FILL, SWT.FILL, true, false); + gd.horizontalSpan = 2; + this.composite.setLayoutData(gd); + + setControl(this.composite); + + controlContainer = new Composite(composite, SWT.NONE); + controlContainer.setLayout(new GridLayout(1, true)); + controlContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + + kGroup = new Group(controlContainer, SWT.FILL); + kGroup.setLayout(new GridLayout(2, false)); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); + kGroup.setLayoutData(data); + kGroup.setText("Kernel Settings:"); + + new Label (kGroup, SWT.NONE).setText("Kernel:"); + Composite textContainer = new Composite(kGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(1, false)); + textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); + + kernelCombo = new Combo(textContainer, SWT.READ_ONLY); + kernelCombo.setLayout(new GridLayout(2, false)); + kernelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + + kernelCombo.addSelectionListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + controlChanged(e.widget); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + + kbGroup = new Group(kGroup, SWT.FILL); + kbGroup.setLayout(new GridLayout(2, true)); + data = new GridData(SWT.FILL, SWT.FILL, true, false); + data.horizontalSpan = 2; + kbGroup.setLayoutData(data); + kbGroup.setText("Branch Settings:"); + + textContainer = new Composite(kbGroup, SWT.NONE); + textContainer.setLayout(new GridLayout(2, false)); + textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); + + new Label(textContainer, SWT.NONE).setText("Kernel branch:"); + + branchesCombo = new Combo(textContainer, SWT.READ_ONLY); + branchesCombo.setLayout(new GridLayout(1, false)); + branchesCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + branchesCombo.addSelectionListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent e) { + controlChanged(e.widget); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + branchesCombo.setSize(200, 200); + + newBranchButton = new Button(kbGroup, SWT.RADIO); + newBranchButton.setText("Create a new branch from an existing one"); + newBranchButton.setSelection(true); + newBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); + SelectionListener listener = new SelectionListener() { + @Override + public void widgetDefaultSelected(SelectionEvent e) {} + + @Override + public void widgetSelected(SelectionEvent e) { + controlChanged(e.widget); + } + }; + + newBranchButton.addSelectionListener(listener); + + existingBranchButton = new Button(kbGroup, SWT.RADIO); + existingBranchButton.setText("Use existing branch"); + existingBranchButton.setSelection(false); + existingBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); + existingBranchButton.addSelectionListener(listener); + +// otherSettingsGroup = new Group(controlContainer, SWT.FILL); +// otherSettingsGroup.setLayout(new GridLayout(2, true)); +// data = new GridData(SWT.FILL, SWT.FILL, true, false); +// data.horizontalSpan = 2; +// otherSettingsGroup.setLayoutData(data); +// otherSettingsGroup.setText("Other Settings:"); + + smpButton = new Button(kGroup, SWT.CHECK); + smpButton.setText("Enable SMP support"); + smpButton.setSelection(true); + + propertyGroup = new Group(controlContainer, SWT.NONE); + propertyGroup.setLayout(new GridLayout(2, false)); + data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1); + propertyGroup.setLayoutData(data); + propertyGroup.setText("BSP specific settings:"); + + this.composite.layout(true, true); + + composite.setContent(controlContainer); + composite.setExpandHorizontal(true); + composite.setExpandVertical(true); + composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); + controlContainer.pack(); + composite.pack(); + } + + @Override + public boolean canFlipToNextPage() { + return false; + } + + public HashSet getProperties() { + String kcSelection = kernelCombo.getText(); + String kbSelection = branchesCombo.getText(); + YoctoBspPropertyElement kcElement = new YoctoBspPropertyElement(); + kcElement.setName(KERNEL_CHOICE); + kcElement.setValue(kcSelection); + properties.add(kcElement); + YoctoBspPropertyElement defaultElement = new YoctoBspPropertyElement(); + defaultElement.setName(DEFAULT_KERNEL); + defaultElement.setValue("n"); + properties.add(defaultElement); + + YoctoBspPropertyElement smpElement = new YoctoBspPropertyElement(); + smpElement.setName(SMP_NAME); + if (smpButton.getSelection()) + smpElement.setValue("y"); + else + smpElement.setValue("n"); + properties.add(smpElement); + + YoctoBspPropertyElement newKbElement = new YoctoBspPropertyElement(); + YoctoBspPropertyElement kbElement = new YoctoBspPropertyElement(); + + newKbElement.setName(NEED_NEW_KBRANCH_NAME); + if (newBranchButton.getSelection()) { + newKbElement.setValue("y"); + properties.add(newKbElement); + kbElement.setName(NEW_KBRANCH_NAME); + kbElement.setValue(kbSelection); + properties.add(kbElement); + } else { + newKbElement.setValue("n"); + properties.add(newKbElement); + kbElement.setName(EXISTING_KBRANCH_NAME); + kbElement.setValue(kbSelection); + properties.add(kbElement); + } + + return properties; + } + + public boolean validatePage() { + if (kernelCombo == null) + return false; + + if ((kernelCombo != null) && (branchesCombo != null)) { + String kcSelection = kernelCombo.getText(); + String kbSelection = branchesCombo.getText(); + if ((kcSelection == null) || (kbSelection == null) || (kcSelection.isEmpty()) || (kbSelection.isEmpty())) { + setErrorMessage("Please choose a kernel and a specific branch!"); + return false; + } + } + if ((propertyControlMap != null)) { + if (!propertyControlMap.isEmpty()) { + Enumeration keys = propertyControlMap.keys(); + while (keys.hasMoreElements()) { + YoctoBspPropertyElement key = keys.nextElement(); + Control control = propertyControlMap.get(key); + String type = key.getType(); + + if (type.contentEquals("edit")) { + String text_value = ((Text)control).getText(); + if (text_value == null) { + setErrorMessage("Field "+ key.getName() +" is not set. All of the field on this screen must be set!"); + return false; + } else { + key.setValue(text_value); + } + } else if (type.contentEquals("choicelist")) { + String choice_value = ((Combo)control).getText(); + if (choice_value == null) { + setErrorMessage("Field "+ key.getName() +" is not set. All of the field on this screen must be set!"); + return false; + } else { + key.setValue(choice_value); + } + } else { + boolean button_select = ((Button)control).getSelection(); + if (button_select) + key.setValue("y"); + else + key.setValue("n"); + } + updateProperties(key); + } + } + } + return true; + } + + private void updateProperties(YoctoBspPropertyElement element) { + Iterator it = properties.iterator(); + + while (it.hasNext()) { + YoctoBspPropertyElement propElem = it.next(); + if (propElem.getName().contentEquals(element.getName())) { + properties.remove(propElem); + properties.add(element); + break; + } else + continue; + } + } + private void controlChanged(Widget widget) { + setErrorMessage(null); + + String kernel_choice = kernelCombo.getText(); + if ((kernel_choice == null) || (kernel_choice.isEmpty())) { + setErrorMessage("Please choose kernel !"); + return; + } + if (widget == kernelCombo) { + updateKernelValues(KERNEL_BRANCHES, "\\\"" + kernel_choice + "\\\"." + NEW_KBRANCH_NAME); + } else if (widget == branchesCombo) { + setErrorMessage(null); + branchesCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT); + } else if (widget == newBranchButton || widget == existingBranchButton) { + if (newBranchButton.getSelection()) { + updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + NEW_KBRANCH_NAME); + } else { + updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + EXISTING_KBRANCH_NAME); + } + branchesCombo.deselectAll(); + } + canFlipToNextPage(); + getWizard().getContainer().updateButtons(); + this.composite.layout(true, true); + composite.pack(); + } + + private void updateKernelValues(final String value, String property) { + String build_dir = ""; + if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty()) + build_dir = bspElem.getMetadataLoc()+"/build"; + else + build_dir = bspElem.getBuildLoc(); + + String metadataLoc = bspElem.getMetadataLoc(); + String valuesCmd = "source " + metadataLoc + "/oe-init-build-env;" + metadataLoc + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property; + BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelBranchesGetter(valuesCmd), "Loading Kernel " + value); + if (value.equals(KERNEL_CHOICES)) + progressDialog.run(false); + else if (value.equals(KERNEL_BRANCHES)) + progressDialog.run(true); + + BSPAction action = progressDialog.getBspAction(); + if (action.getItems() != null) { + if (value.equals(KERNEL_CHOICES)) { + kernelCombo.setItems(action.getItems()); + kernelCombo.pack(); + kernelCombo.deselectAll(); + branchesCombo.setEnabled(false); + branchesCombo.deselectAll(); + } else if (value.equals(KERNEL_BRANCHES)) { + branchesCombo.setItems(action.getItems()); + branchesCombo.pack(); + branchesCombo.setEnabled(true); + } + composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); + } else if (action.getMessage() != null) + MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage()); + composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); + } + + private String[] getBSPComboProperties(String property) { + String build_dir = ""; + if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty()) + build_dir = bspElem.getMetadataLoc()+"/build"; + else + build_dir = bspElem.getBuildLoc(); + + String valuesCmd = "export BUILDDIR=" + build_dir + ";" + bspElem.getMetadataLoc() + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property; + BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelBranchesGetter(valuesCmd), "Loading property " + property + "values"); + progressDialog.run(false); + BSPAction action = progressDialog.getBspAction(); + + if (action.getItems() != null) { + return action.getItems(); + } else if (action.getMessage() != null) { + MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage()); + return new String[]{}; + } + return new String[]{}; + } +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java new file mode 100644 index 0000000..e235695 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java @@ -0,0 +1,27 @@ +package org.yocto.sdk.remotetools.wizards.bsp; + +/** + * BSPThread that processes the output of running "yocto-bsp list qemu property qemuarch" + * @author ioana.grigoropol + * + */ +public class QemuArchGetter extends BSPThread { + + public QemuArchGetter(String command) { + super(command); + } + + @Override + protected String[] processLine(String line) { + if (!line.startsWith("[")) + return new String[]{ERROR, line + "\n"}; + + String[] values = line.split(","); + + String value = values[0]; + value = value.replace("[\"", ""); + value = value.replaceAll("\"$", ""); + return new String[]{SUCCESS, value}; + } + +} diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java new file mode 100644 index 0000000..3ab24c0 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2010 Intel 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: + * Intel - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.remotetools.wizards.bsp; + +import java.util.HashSet; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.Wizard; +import org.yocto.sdk.remotetools.YoctoBspElement; +import org.yocto.sdk.remotetools.YoctoBspPropertyElement; +import org.yocto.sdk.remotetools.YoctoJSONHelper; + +/** + * A wizard for creating Yocto BSP. + * + * @author jzhang + * + */ +public class YoctoBSPWizard extends Wizard { + private static final String CREATE_CMD = "/scripts/yocto-bsp create "; + private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json"; + + private MainPage mainPage; + private PropertiesPage propertiesPage; + private final YoctoBspElement bspElem; + + public YoctoBSPWizard() { + super(); + bspElem = new YoctoBspElement(); + } + + @Override + public IWizardPage getNextPage(IWizardPage page) { + propertiesPage.onEnterPage(mainPage.getBSPElement()); + return propertiesPage; + } + + @Override + public void addPages() { + mainPage = new MainPage(bspElem); + addPage(mainPage); + propertiesPage = new PropertiesPage(bspElem); + addPage(propertiesPage); + } + + private BSPAction createBSP(){ + YoctoBspElement element = mainPage.getBSPElement(); + String createBspCmd = element.getMetadataLoc() + CREATE_CMD + + element.getBspName() + " " + element.getKarch(); + + if (!element.getBspOutLoc().isEmpty()) + createBspCmd = createBspCmd + " -o " + element.getBspOutLoc(); + else + createBspCmd = createBspCmd + " -o " + element.getMetadataLoc() + "/meta-" + element.getBspName(); + createBspCmd = createBspCmd + " -i " + PROPERTY_VALUE_FILE; + + BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new OutputCollectorThread(createBspCmd), "Creating BSP "); + progressDialog.run(true); + return progressDialog.getBspAction(); + } + + @Override + public boolean performFinish() { + if (propertiesPage.validatePage()) { + HashSet properties = propertiesPage.getProperties(); + YoctoJSONHelper.createBspJSONFile(properties); + + BSPAction createBSPAction = createBSP(); + if (createBSPAction.getMessage() != null && !createBSPAction.getMessage().isEmpty()) { + MessageDialog.openError(getShell(),"Yocto-BSP", createBSPAction.getMessage()); + return false; + } else { + String message = ""; + for (String item : createBSPAction.getItems()) + message += item + "\n"; + MessageDialog.openInformation(getShell(), "Yocto-BSP", message); + return true; + } + } else { + MessageDialog.openError(getShell(), "Yocto-BSP", "Property settings contains error!"); + return false; + } + + } + + @Override + public boolean canFinish() { + return (mainPage.validatePage() && propertiesPage.validatePage()); + } +} diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..7010caa --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,173 @@ +#!/bin/sh + +help () +{ + echo "Build the Yocto Eclipse plugins" + echo "Usage: [GIT_URL=url_of_repo] [DOC_GIT=url_of_repo] $0 [OPTIONS] BRANCH_NAME RELEASE_NAME [TAG_NAME]"; + echo "" + echo "Options:" + echo "-h - display this help and exit" + echo "-l - use local git repository" + echo "BRANCH_NAME - git branch name to build upon" + echo "RELEAES_NAME - release name in the final output name" + echo "TAG_NAME - git tag name to build upon. defaults to HEAD if not set" + echo "GIT_URL - use this repo for the plugins. Defaults to git://git.pokylinux.org/eclipse-poky-juno.git if not set" + echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set" + echo "" + echo "Example: $0 master r0 M1.1_rc1"; + exit 1; +} + +fail () +{ + local retval=$1 + shift $1 + echo "[Fail $retval]: $*" + echo "BUILD_TOP=${BUILD_TOP}" + cd ${TOP} + exit ${retval} +} + +find_eclipse_base () +{ + [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=${ECLIPSE_HOME} +} + +find_launcher () +{ + local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`" + for launcher in $list; do + [ -f $launcher ] && LAUNCHER=${launcher} + done +} + +find_buildfile () +{ + local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.pde.build_*/scripts/build.xml`" + for buildfile in $list; do + [ -f $buildfile ] && BUILDFILE=${buildfile} + done +} + +check_env () +{ + find_eclipse_base + find_launcher + find_buildfile + + local err=0 + [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" -o "x${BUILDFILE}" = "x" ] && err=1 + if [ $err -eq 0 ]; then + [ ! -d ${ECLIPSE_BASE} ] && err=1 + [ ! -f ${LAUNCHER} ] && err=1 + [ ! -f ${BUILDFILE} ] && err=1 + fi + + if [ $err -ne 0 ]; then + echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!" + exit 1 + fi +} + +USE_LOCAL_GIT_REPO=0 +while getopts ":lh" opt; do + case $opt in + h) + help + ;; + l) + USE_LOCAL_GIT_REPO=1 + ;; + esac +done +shift $(($OPTIND - 1)) + + +if [ $# -ne 2 ] && [ $# -ne 3 ]; then + help +fi + +#milestone +BRANCH=$1 +RELEASE=$2 + +if [ "x" = "x${3}" ] +then + TAG="HEAD" +else + TAG=$3 +fi + +TOP=`pwd` + +check_env + +#create tmp dir for build +DATE=`date +%Y%m%d%H%M` +BUILD_TOP=`echo ${BRANCH} | sed 's%/%-%'` +BUILD_TOP=${TOP}/${BUILD_TOP}_build_${DATE} +rm -rf ${BUILD_TOP} +mkdir ${BUILD_TOP} || fail $? "Create temporary build directory ${BUILD_TOP}" +BUILD_SRC=${BUILD_TOP}/src +BUILD_DIR=${BUILD_TOP}/build +mkdir ${BUILD_DIR} || fail $? "Create temporary build directory ${BUILD_DIR}" + + +#git clone +GIT_URL=${GIT_URL:-git://git.pokylinux.org/eclipse-poky-juno.git} +if [ $USE_LOCAL_GIT_REPO -eq 1 ]; then + SCRIPT_DIR=`dirname $0` + GIT_DIR=`readlink -f ${SCRIPT_DIR}/..` + GIT_URL="file://${GIT_DIR}" +fi + +GIT_DIR=${BUILD_SRC} +#mkdir ${GIT_DIR} +#cp -r features/ ${GIT_DIR} +#cp -r plugins/ ${GIT_DIR} +#cp -r tcf/ ${GIT_DIR} +git clone ${GIT_URL} ${GIT_DIR} || fail $? "git clone ${GIT_URL}" +cd ${GIT_DIR} +git checkout origin/${BRANCH} || fail $? "git checkout origin/${BRANCH}" +git checkout ${TAG} || fail $? "git checkout ${TAG}" +cd ${TOP} + +# generate and add documentation +if [ "${TAG}" = "HEAD" ]; then + ${GIT_DIR}/scripts/generate-doc.sh ${BRANCH} ${GIT_DIR} +else + ${GIT_DIR}/scripts/generate-doc.sh -t ${TAG} ${GIT_DIR} +fi + +#build +java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.bc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build" +java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.doc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build" +java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.sdk.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build" + +if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ] && + [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ] && + [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ]; then + cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ./org.yocto.bc-${RELEASE}-${DATE}.zip + cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ./org.yocto.doc-${RELEASE}-${DATE}.zip + cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ./org.yocto.sdk-${RELEASE}-${DATE}.zip + rm -rf ${BUILD_DIR} +else + fail 1 "Not finding normal build output" +fi + +#build archive for update site +java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.bc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build" +java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.doc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build" +java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.sdk.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build" + +#clean up +if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ] && + [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}-group.group.group.zip ] && + [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}-group.group.group.zip ]; then + cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ./org.yocto.sdk-${RELEASE}-${DATE}-archive.zip + rm -rf ${BUILD_TOP} +else + fail 1 "Not finding archive build output" +fi + +exit 0 diff --git a/scripts/find-version b/scripts/find-version new file mode 100755 index 0000000..55fbc58 --- /dev/null +++ b/scripts/find-version @@ -0,0 +1,62 @@ +#!/bin/sh + +help () +{ + echo "Find the installed plugin/feature version of a eclipse build environment" + echo "Usage: $0 [pluginId1/featureId1[,pluginId2/featureId2]...]"; + echo "" + echo "Options:" + echo "pluginId/featureId - comma seperated plugin or feature ids, empty for all" + echo "" + echo "Example: $0 org.eclipse.tcf.feature.group"; + exit 1; +} + +fail () +{ + local retval=$1 + shift $1 + echo "[Fail $retval]: $*" + echo "BUILD_TOP=${BUILD_TOP}" + cd ${TOP} + exit ${retval} +} + +find_eclipse_base () +{ + [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=`readlink -f ${ECLIPSE_HOME}` +} + +find_launcher () +{ + local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`" + for launcher in $list; do + [ -f $launcher ] && LAUNCHER=${launcher} + done +} + +check_env () +{ + find_eclipse_base + find_launcher + + local err=0 + [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" ] && err=1 + if [ $err -eq 0 ]; then + [ ! -d ${ECLIPSE_BASE} ] && err=1 + [ ! -f ${LAUNCHER} ] && err=1 + fi + + if [ $err -ne 0 ]; then + echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!" + exit 1 + fi +} + +if [ $# -ne 0 ] && [ $# -ne 1 ]; then + help +fi + +check_env + +java -jar ${LAUNCHER} -application org.eclipse.equinox.p2.director -destination ${ECLIPSE_BASE} -profile SDKProfile -repository file:///${ECLIPSE_BASE}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile -list $@ diff --git a/scripts/generate-doc.sh b/scripts/generate-doc.sh new file mode 100755 index 0000000..90205ee --- /dev/null +++ b/scripts/generate-doc.sh @@ -0,0 +1,88 @@ +#!/bin/sh + +help() +{ + echo "Generate and add eclipse help from yocto's documentation" + echo "Usage: [DOC_GIT=url_of_repo] $0 BRANCH_NAME PLUGIN_FOLDER" + echo " [DOC_GIT=url_of_repo] $0 -t TAG_NAME PLUGIN_FOLDER" + echo "" + echo "Options:" + echo "-h - display this help and exit" + echo "-t TAG_NAME - tag to build the documentation upon" + echo "BRANCH_NAME - branch to build the documentation upon" + echo "PLUGIN_FOLDER - root folder of the eclipse-poky project" + echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set" + exit 1 +} + +fail () +{ + local retval=$1 + shift $1 + echo "[Fail $retval]: $*" + echo "BUILD_TOP=${BUILD_TOP}" + cd ${TOP} + exit ${retval} +} + +CHECKOUT_TAG=0 +while getopts ":ht" opt; do + case $opt in + h) + help + ;; + t) + CHECKOUT_TAG=1 + ;; + esac +done +shift $(($OPTIND - 1)) + +if [ $# -ne 2 ]; then + help +fi + +if [ $CHECKOUT_TAG -eq 0 ]; then + REFERENCE=origin/$1 +else + REFERENCE=$1 +fi +PLUGIN_FOLDER=`readlink -f $2` + +TOP=`pwd` + +DOC_DIR=${PLUGIN_FOLDER}/docs +rm -rf ${DOC_DIR} +DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user +DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/ + +# git clone +DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git} + +git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}" +cd ${DOC_DIR} +git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}" +COMMIT_ID=`git rev-parse HEAD` + +# build and copy +DOCS="yocto-project-qs adt-manual kernel-dev \ + bsp-guide ref-manual dev-manual profile-manual" + +cd documentation +ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?` +if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then + echo "WARNING:" + echo "This version does not support generating eclipse help" + echo "Documentation will not be available in eclipse" + exit 1 +fi + +for DOC in ${DOCS}; do + make DOC=${DOC} eclipse + cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR} + cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR} +done + +sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html + +cd ${TOP} diff --git a/scripts/readme.txt b/scripts/readme.txt new file mode 100644 index 0000000..ba55b64 --- /dev/null +++ b/scripts/readme.txt @@ -0,0 +1,71 @@ +Note: PART I and PART II can be skipped if you have already done that. + +Part I: Base environment setup +I-1. install JDK + sudo zypper install java-1_6_0-openjdk + +I-2. install X11 related packages for eclipse running + sudo zypper install xorg-x11-xauth + +I-3. using git through a SOCKS proxy(If you're behind some firewall) +I-3.1 Create a wrapper script for netcat + cat > ~/bin/proxy-wrapper + + #!/bin/sh + PROXY=proxy-jf.intel.com + PORT=1080 + METHOD="-X 5 -x ${PROXY}:${PORT}" + + nc $METHOD $* + + Then Ctlr+D to save the file and "chmod +x ~/bin/proxy-wrapper" + + Note: if netcat is not installed, please "sudo zypper install netcat-openbsd". + +I-3.2 set git proxy environment + add the following line to your ~/.bashrc and "source ~/.bashrc" + + export GIT_PROXY_COMMAND="/somepath/bin/proxy-wrapper" + + Please be noted that it should be absolute path, since "~" is not supported. + +I-4. using svn through a http_proxy(If you're behind some firewall) + Modify the ~/.subversion/servers + + http-proxy-host = proxy.jf.intel.com + http-proxy-port = 911 + +I-5. Get the scripts from eclipse-poky git + git clone git://git.pokylinux.org/eclipse-poky.git + + The scripts used for auto builder is under the directory of "scripts". + + +Part II: Setup the build environment +II-1. Modify the scripts/setup.sh to set appropriate proxy settings. + Set PROXY to a http proxy URL and PORT to the port number. Comment out + these 2 variables if proxy is not required. + +II-2. Run scripts/setup.sh to set up the build environment. + This will install the eclipse and relevant plugins required to build + Yocto eclipse plug-in. + +Part III: Build & Install Yocto Eclipse plug-in + +To build the Yocto Eclipse plug-in, simply run +"ECLIPSE_HOME= scripts/build.sh ". + +The is the absolute path where you installed the +eclipse in step II-2. + +The is the git branch name you build based on. + +If successful, 2 files org.yocto.sdk--.zip and +org.yocto.sdk.---archive.zip will be genereated under the +directory where you invoked the "build.sh" script. + +The file with the "-archive" in its name is the archive zip used for eclipse +update manager. User should use eclipse update manager to install it. + +The file without the "-archive" in its name is the zip containing only the +plugins/features. User should unzip it to the their target eclipse to install it. diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..4e08ea2 --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,226 @@ +#!/bin/sh + +#setup eclipse building environment for Indigo. +#comment out the following line if you want to using your own http proxy setting for eclipse update site +#PROXY=http://proxy.jf.intel.com:911 + +err_exit() +{ + echo "[FAILED $1]$2" + exit $1 +} + +curdir=`pwd` + +uname_s=`uname -s` +uname_m=`uname -m` +case ${uname_s}${uname_m} in + Linuxppc*) ep_arch=linux-gtk-ppc + cdt_arch=linux.ppc + ;; + Linuxx86_64*) ep_arch=linux-gtk-x86_64 + cdt_arch=linux.x86_64 + ;; + Linuxi*86) ep_arch=linux-gtk + cdt_arch=linux.x86 + ;; + *) + echo "Unknown ${uname_s}${uname_m}" + exit 1 + ;; +esac + +#parsing proxy URLS +url=${PROXY} +if [ "x$url" != "x" ]; then + proto=`echo $url | grep :// | sed -e 's,^\(.*://\).*,\1,g'` + url=`echo $url | sed s,$proto,,g` + userpass=`echo $url | grep @ | cut -d@ -f1` + user=`echo $userpass | cut -d: -f1` + pass=`echo $userpass | grep : | cut -d: -f2` + url=`echo $url | sed s,$userpass@,,g` + host=`echo $url | cut -d: -f1` + port=`echo $url | cut -d: -f2 | sed -e 's,[^0-9],,g'` + [ "x$host" = "x" ] && err_exit 1 "Undefined proxy host" + PROXY_PARAM="-Dhttp.proxySet=true -Dhttp.proxyHost=$host" + [ "x$port" != "x" ] && PROXY_PARAM="${PROXY_PARAM} -Dhttp.proxyPort=$port" +fi + + +# prepare the base Eclipse installation in folder "eclipse" +ep_rel="R-" +ep_ver="4.2.2" +ep_date="-201302041200" +P2_disabled=false +P2_no_dropins=false +if [ ! -f eclipse/plugins/org.eclipse.swt_3.100.0.v4233d.jar ]; then + curdir2=`pwd` + if [ ! -d eclipse -o -h eclipse ]; then + if [ -d eclipse-${ep_ver}-${ep_arch} ]; then + rm -rf eclipse-${ep_ver}-${ep_arch} + fi + mkdir eclipse-${ep_ver}-${ep_arch} + cd eclipse-${ep_ver}-${ep_arch} + else + rm -rf eclipse + fi + # Eclipse SDK: Need the SDK so we can link into docs + echo "Getting Eclipse SDK..." + + wget "http://download.eclipse.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" + # The eclipse site has moments where it is overloaded. Maintaining our own mirror solves this. + #wget "http://downloads.yoctoproject.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" + tar xfz eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz || err_exit $? "extracting Eclipse SDK failed" + rm eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz + cd "${curdir2}" + if [ ! -d eclipse -o -h eclipse ]; then + if [ -e eclipse ]; then + rm eclipse + fi + ln -s eclipse-${ep_ver}-${ep_arch}/eclipse eclipse + fi +fi +if [ ! -f eclipse/startup.jar ]; then + curdir2=`pwd` + cd eclipse/plugins + if [ -h ../startup.jar ]; then + rm ../startup.jar + fi + LAUNCHER="`ls org.eclipse.equinox.launcher_*.jar | sort | tail -1`" + if [ "x${LAUNCHER}" != "x" ]; then + echo "eclipse LAUNCHER=${LAUNCHER}" + ln -s plugins/${LAUNCHER} ../startup.jar + else + echo "Eclipse: NO startup.jar LAUNCHER FOUND!" + fi + cd ${curdir2} +fi + +LAUNCHER="eclipse/startup.jar" + +get_version() +{ +#$1: repository_url +#$2: featureId +#$3: 'all' or 'max' or 'min', 'max' if not specified + local remote_vers="`java ${PROXY_PARAM} \ + -jar ${LAUNCHER} \ + -application org.eclipse.equinox.p2.director \ + -destination ${curdir}/eclipse \ + -profile SDKProfile \ + -repository $1 \ + -list $2\ + | awk 'BEGIN { FS="=" } { print $2 }'`" + + #find larget remote vers + local remote_ver="`echo ${remote_vers} | cut -d ' ' -f1`" + case $3 in + all) + remote_ver=${remote_vers} + ;; + min) + for i in ${remote_vers}; do + [ "${remote_ver}" \> "$i" ] && remote_ver="$i" + done + ;; + *) + for i in ${remote_vers}; do + [ "${remote_ver}" \< "$i" ] && remote_ver="$i" + done + ;; + esac + + echo ${remote_ver} +} + +check_local_version() +{ +# $1 unitId +# $2 min version +# $3 max version (optional) + version="`get_version file:///${curdir}/eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile $1`" + [ "$version" \< "$2" ] && return 1 + if [ "x$3" != "x" ]; then + [ "$version" \> "$3" ] && return -1 + fi + return 0 +} + +update_feature_remote() +{ +# install a feature of with version requirement [min, max) +#$1: reporsitory url +#$2: featureId +#$3: min version +#$4: max version(optional) + [ $# -lt 3 ] && err_exit 1 "update_feature_remote: invalid parameters, $*" + check_local_version $2 $3 $4 && echo "skip installed feature $2" && return 0 + local installIU="" + if [ "x$4" != "x" ]; then + #has max version requirement + for i in "`get_version $1 $2 'all'`"; do + if [ "$i" \> "$3" ] || [ "$i" = "$3" ] && [ "$i" \< "$4" ]; then + [ "$i" \> "$installIU" ] && installIU=$i + fi + done + else + #only has minimum version requirement + local max_remote_ver="`get_version $1 $2 'max'`" + [ "$max_remote_ver" \> "$3" ] || [ "$max_remote_ver" = "$3" ] && installIU=$max_remote_ver + fi + + [ "x$installIU" = "x" ] && err_exit 1 "Can NOT find candidates of $2 version($3, $4) at $1!" + installIU="$2/$installIU" + echo "try to install $installIU ..." + java ${PROXY_PARAM} -jar ${LAUNCHER} \ + -application org.eclipse.equinox.p2.director \ + -destination ${curdir}/eclipse \ + -profile SDKProfile \ + -repository $1 \ + -installIU ${installIU} || err_exit $? "installing ${installIU} failed" +} + +#Eclipse Update Site +MAIN_UPDATE_SITE="http://download.eclipse.org/releases/juno" +# The main eclipse download site is unreliable at times. For now, we're going to +# maintain a mirror of just what we need. +#MAIN_UPDATE_SITE="http://downloads.yoctoproject.org/eclipse/juno/ftp.osuosl.org/pub/eclipse/releases/juno" + +UPDATE_SITE="${MAIN_UPDATE_SITE}" + +#CDT related +CDTFEAT="8.1.0" +echo "Installing CDT..." +update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.sdk.feature.group ${CDTFEAT} +CDTREMOTEVER="6.0.0" +update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.launch.remote.feature.group ${CDTREMOTEVER} + +#RSE SDK +RSEVER="3.4.0" +TCFVER="1.0.0" +TMVER="3.3.0" +echo "Installing RSE/TCF/TM related component..." +update_feature_remote ${UPDATE_SITE} org.eclipse.rse.feature.group ${RSEVER} +update_feature_remote ${UPDATE_SITE} org.eclipse.tcf.rse.feature.feature.group ${TCFVER} +update_feature_remote ${UPDATE_SITE} org.eclipse.tm.terminal.sdk.feature.group ${TMVER} + +#AUTOTOOL +ATVER="3.0.1" +echo "Install AutoTool..." +update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.autotools.feature.group ${ATVER} + +#Lttng legacy +TMFREL="1.0.0" +echo "Install TMF..." +update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.tmf.feature.group ${TMFREL} + +#LTTng Kernel Analysis +LTTNGKAVER="1.0.0" +update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.kernel.feature.group ${LTTNGKAVER} + +echo "" +echo "Your build environment is successfully created." +echo "Run ECLIPSE_HOME=${curdir}/eclipse `dirname $0`/build.sh to build" +echo "" + +exit 0 diff --git a/tcf/lke_rse_tcf.patch b/tcf/lke_rse_tcf.patch new file mode 100644 index 0000000..6054b93 --- /dev/null +++ b/tcf/lke_rse_tcf.patch @@ -0,0 +1,2097 @@ +Index: plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF (revision 1190) ++++ plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF (working copy) +@@ -13,8 +13,16 @@ + org.eclipse.ui.views, + org.eclipse.rse.subsystems.files.core, + org.eclipse.rse.subsystems.processes.core, +- org.eclipse.rse.processes.ui ++ org.eclipse.rse.processes.ui, ++ org.eclipse.rse.subsystems.terminals.core, ++ org.eclipse.tm.tcf;bundle-version="0.3.0", ++ org.eclipse.rse.subsystems.shells.core;bundle-version="3.1.100", ++ org.eclipse.core.resources;bundle-version="3.6.0", ++ org.eclipse.tm.tcf.core;version="0.3.0" + Import-Package: org.eclipse.tm.tcf.core;version="0.3.0", ++ org.eclipse.rse.core.filters, ++ org.eclipse.tm.internal.tcf.terminals, ++ org.eclipse.rse.core.model, + org.eclipse.tm.tcf.protocol;version="0.3.0", + org.eclipse.tm.tcf.services;version="0.3.0", + org.eclipse.tm.tcf.util;version="0.3.0" +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java (revision 1190) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java (working copy) +@@ -39,6 +39,11 @@ + + private final TCFFileAdapter file_adapter = new TCFFileAdapter(); + ++ public TCFFileSubSystemConfiguration() { ++ super(); ++ setIsUnixStyle(true); ++ } ++ + @Override + public ISubSystem createSubSystemInternal(IHost host) { + TCFConnectorService connectorService = (TCFConnectorService)getConnectorService(host); +@@ -78,13 +83,12 @@ + @Override + public IConnectorService getConnectorService(IHost host) { + return TCFConnectorServiceManager.getInstance() +- .getConnectorService(host, ITCFSubSystem.class); ++ .getConnectorService(host, getServiceImplType()); + } + + @Override +- @SuppressWarnings("unchecked") +- public Class getServiceImplType() { +- return TCFFileService.class; ++ public Class getServiceImplType() { ++ return ITCFSubSystem.class; + } + + @Override +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java (revision 1190) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java (working copy) +@@ -11,6 +11,7 @@ + * Uwe Stieber (Wind River) - [271224] NPE in TCFFileService#download + * Uwe Stieber (Wind River) - [271227] Fix compiler warnings in org.eclipse.tm.tcf.rse + * Uwe Stieber (Wind River) - [274277] The TCF file service subsystem implementation is not updating the progress monitor ++ * Intel Corporation - Make recursive copy/delete available (delete/copy a folder contains files) + *******************************************************************************/ + package org.eclipse.tm.internal.tcf.rse.files; + +@@ -18,6 +19,7 @@ + import java.io.BufferedOutputStream; + import java.io.File; + import java.io.FileInputStream; ++import java.io.FileNotFoundException; + import java.io.FileOutputStream; + import java.io.IOException; + import java.io.InputStream; +@@ -131,22 +133,125 @@ + return s; + } + ++ /* Delete from UI action will call deleteBatch interface, yet ++ * for copy from UI action, it will call copy! It's totally ++ * inconsistency! For solving the problem, we have to modify ++ * the copy itself and made it recursive. We can't modify it ++ * in the same way as delete does! ++ * ++ */ ++ ++ public void internalCopy(String srcParent, ++ String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) ++ throws SystemMessageException, InterruptedException { ++ //Note the dest directory or file exist surely since UI operations have ++ //done something, rename it to copy of XXX ++ if (monitor != null) ++ { ++ if (monitor.isCanceled()) ++ { ++ throw new InterruptedException("User cancelled the copy operation!"); ++ } ++ } ++ ++ try ++ { ++ //firstly create the target directory! ++ this.createFolder(tgtParent, tgtName, monitor); ++ //then copy the next level directory! ++ final String new_srcpath = toRemotePath(srcParent, srcName); ++ final String new_tgtpath = toRemotePath(tgtParent, tgtName); ++ IHostFile[] arrFiles = internalFetch(new_srcpath, null, ++ FILE_TYPE_FILES_AND_FOLDERS, monitor); ++ if (arrFiles == null || arrFiles.length <=0 ) ++ return; ++ else ++ { ++ for (int i = 0; i < arrFiles.length; i++) ++ { ++ String srcFile = toRemotePath(new_srcpath, arrFiles[i].getName()); ++ String tgtFile = toRemotePath(new_tgtpath, arrFiles[i].getName()); ++ if (arrFiles[i].isFile()) ++ { ++ copy(srcFile, tgtFile, monitor); ++ } ++ else ++ { ++ //do recursive directory copy! ++ internalCopy(new_srcpath, arrFiles[i].getName(), new_tgtpath, ++ arrFiles[i].getName(), monitor); ++ } ++ } ++ } ++ } ++ catch (SystemMessageException e) ++ { ++ e.printStackTrace(); ++ throw new SystemMessageException(e.getSystemMessage()); ++ } ++ catch (InterruptedException e) ++ { ++ throw new InterruptedException("User cancelled the copy operation!"); ++ } ++ } ++ + public void copy(String srcParent, + String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) + throws SystemMessageException { +- final String src = toRemotePath(srcParent, srcName); +- final String tgt = toRemotePath(tgtParent, tgtName); ++ ++ if (monitor != null) ++ monitor.beginTask("Copying remote files!", 1); ++ ++ try { ++ ++ IHostFile curFile = getFile(srcParent, srcName, monitor); ++ final String srcFile = toRemotePath(srcParent, srcName); ++ final String tgtFile = toRemotePath(tgtParent, tgtName); ++ ++ if (curFile.isFile()) ++ copy(srcFile, tgtFile, monitor); ++ else if (curFile.isDirectory()) ++ { ++ internalCopy(srcParent, srcName, tgtParent, tgtName, monitor); ++ } ++ else ++ { ++ FileNotFoundException e = ++ new FileNotFoundException("Failed to find the to be " + ++ "copied file or directory!"); ++ throw new SystemMessageException(getMessage(e)); ++ } ++ } ++ catch (Exception e) { ++ // TODO Auto-generated catch block ++ if (e instanceof SystemMessageException) ++ throw (SystemMessageException)e; ++ else if (e instanceof InterruptedException) ++ { ++ System.out.println("User cancelled the copy operation!"); ++ } ++ throw new SystemOperationFailedException(Activator.PLUGIN_ID, e); ++ ++ } ++ finally { ++ if (monitor != null) ++ monitor.done(); ++ } ++ } ++ ++ public void copy(final String srcFile, final String tgtFile, IProgressMonitor monitor) ++ throws SystemMessageException { + new TCFRSETask() { + public void run() { + IFileSystem fs = connector.getFileSystemService(); +- fs.copy(src, tgt, false, false, new IFileSystem.DoneCopy() { ++ fs.copy(srcFile, tgtFile, false, false, new IFileSystem.DoneCopy() { + public void doneCopy(IToken token, FileSystemException error) { + if (error != null) error(error); + else done(Boolean.TRUE); + } + }); + } +- }.getS(monitor, "Copy: " + srcName); //$NON-NLS-1$ ++ }.getS(monitor, "Copy: " + srcFile); //$NON-NLS-1$ + } + + public void copyBatch(String[] srcParents, +@@ -226,13 +331,81 @@ + }.getS(monitor, "Delete"); //$NON-NLS-1$ + } + ++ private void internalDelete(String parent, String name, ++ IProgressMonitor monitor) ++ throws SystemMessageException, InterruptedException ++ { ++ if (monitor != null) ++ { ++ if (monitor.isCanceled()) ++ { ++ throw new InterruptedException("User cancelled the delete operation!"); ++ } ++ } ++ ++ try ++ { ++ final String new_path = toRemotePath(parent, name); ++ IHostFile[] arrFiles = internalFetch(new_path, null, ++ FILE_TYPE_FILES_AND_FOLDERS, monitor); ++ if (arrFiles == null || arrFiles.length <= 0) ++ { ++ //This is an empty directory, directly delete! ++ delete(parent, name, monitor); ++ } ++ else ++ { ++ for (int i = 0; i < arrFiles.length; i++) ++ { ++ ++ if (arrFiles[i].isFile()) ++ { ++ delete(new_path, arrFiles[i].getName(), monitor); ++ } ++ else ++ internalDelete(new_path, arrFiles[i].getName(), monitor); ++ } ++ //now the folder becomes empty, let us delete it! ++ delete(parent, name, monitor); ++ } ++ } ++ catch (SystemMessageException e) { ++ // TODO Auto-generated catch block ++ e.printStackTrace(); ++ throw new SystemMessageException(e.getSystemMessage()); ++ } ++ catch (InterruptedException e) { ++ throw new InterruptedException("User cancelled the delete operation!"); ++ } ++ } ++ + @Override + public void deleteBatch(String[] remoteParents, String[] fileNames, + IProgressMonitor monitor) +- throws SystemMessageException { +- for (int i = 0; i < remoteParents.length; i++) { +- delete(remoteParents[i], fileNames[i], monitor); ++ throws SystemMessageException { ++ if (monitor != null) ++ monitor.beginTask("Deleting selected folders or files!", remoteParents.length); ++ try ++ { ++ for (int i = 0; i < remoteParents.length; i++) { ++ IHostFile curFile = getFile(remoteParents[i], fileNames[i], monitor); ++ if (curFile.isFile()) ++ delete(remoteParents[i], fileNames[i], monitor); ++ else if (curFile.isDirectory()) ++ internalDelete(remoteParents[i], fileNames[i], monitor); ++ } + } ++ catch (Exception x) { ++ if (x instanceof SystemMessageException) throw (SystemMessageException)x; ++ else if (x instanceof InterruptedException) { ++ System.out.println("user cancelled the delete operation!"); ++ } ++ throw new SystemOperationFailedException(Activator.PLUGIN_ID, x); ++ } ++ finally { ++ if (monitor != null) ++ monitor.done(); ++ } + } + + public void download(final String parent, +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java (revision 0) +@@ -0,0 +1,28 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse; ++ ++import org.eclipse.osgi.util.NLS; ++ ++public class TCFConnectorResources extends NLS { ++ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.TCFConnectorResources"; ++ static { ++ NLS.initializeMessages(BUNDLE_NAME, TCFConnectorResources.class); ++ } ++ private TCFConnectorResources() { ++ ++ } ++ ++ public static String TCFConnectorService_Name; ++ public static String TCFConnectorService_Description; ++ public static String PropertySet_Description; ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java (revision 0) +@@ -0,0 +1,29 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++ ++package org.eclipse.tm.internal.tcf.rse; ++ ++import org.eclipse.rse.services.files.RemoteFileException; ++import org.eclipse.tm.tcf.protocol.IChannel; ++ ++public interface ITCFSessionProvider { ++ public static final int ERROR_CODE = 100; // filed error code ++ public static final int SUCCESS_CODE = 150; // login pass code ++ public static final int CONNECT_CLOSED = 200; // code for end of login attempts ++ public static final int TCP_CONNECT_TIMEOUT = 10; //seconds - TODO: Make configurable ++ ++ public IChannel getChannel(); ++ public String getSessionUserId(); ++ public String getSessionPassword(); ++ public String getSessionHostName(); ++ public boolean isSubscribed(); ++ public void Subscribe() throws RemoteFileException; ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java (revision 1190) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java (working copy) +@@ -26,10 +26,8 @@ + + private final TCFProcessAdapter process_adapter = new TCFProcessAdapter(); + +- @Override +- @SuppressWarnings("unchecked") +- public Class getServiceImplType() { +- return TCFProcessService.class; ++ public Class getServiceImplType() { ++ return ITCFSubSystem.class; + } + + @Override +@@ -50,7 +48,7 @@ + @Override + public IConnectorService getConnectorService(IHost host) { + return TCFConnectorServiceManager.getInstance() +- .getConnectorService(host, ITCFSubSystem.class); ++ .getConnectorService(host, getServiceImplType()); + } + + @Override +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java (revision 1190) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java (working copy) +@@ -10,29 +10,49 @@ + * Martin Oberhuber (Wind River) - [269682] Get port from RSE Property + * Uwe Stieber (Wind River) - [271227] Fix compiler warnings in org.eclipse.tm.tcf.rse + * Anna Dushistova (MontaVista) - [285373] TCFConnectorService should send CommunicationsEvent.BEFORE_CONNECT and CommunicationsEvent.BEFORE_DISCONNECT +- *******************************************************************************/ ++ * Intel Corporation - Make TCF being authenticated connection and attached streaming subscription/unsubscription method ++ ******************************************************************************/ + package org.eclipse.tm.internal.tcf.rse; + ++import java.io.IOException; + import java.util.ArrayList; + import java.util.HashMap; + import java.util.List; + import java.util.Map; ++import java.util.concurrent.ExecutionException; ++import java.util.concurrent.TimeUnit; ++import java.util.concurrent.TimeoutException; + + import org.eclipse.core.runtime.IProgressMonitor; + import org.eclipse.rse.core.model.IHost; +-import org.eclipse.rse.core.subsystems.BasicConnectorService; ++import org.eclipse.rse.core.model.IPropertySet; ++import org.eclipse.rse.core.model.PropertyType; ++import org.eclipse.rse.core.model.SystemSignonInformation; + import org.eclipse.rse.core.subsystems.CommunicationsEvent; ++import org.eclipse.rse.services.files.RemoteFileException; ++import org.eclipse.rse.ui.subsystems.StandardConnectorService; ++import org.eclipse.tm.internal.tcf.terminals.ITerminalsService; + import org.eclipse.tm.tcf.core.AbstractPeer; + import org.eclipse.tm.tcf.protocol.IChannel; + import org.eclipse.tm.tcf.protocol.IPeer; + import org.eclipse.tm.tcf.protocol.IService; ++import org.eclipse.tm.tcf.protocol.IToken; + import org.eclipse.tm.tcf.protocol.Protocol; + import org.eclipse.tm.tcf.services.IFileSystem; + import org.eclipse.tm.tcf.services.ILocator; ++import org.eclipse.tm.tcf.services.IStreams; + import org.eclipse.tm.tcf.services.ISysMonitor; ++import org.eclipse.tm.tcf.util.TCFTask; + ++public class TCFConnectorService extends StandardConnectorService implements ++ ITCFSessionProvider { + +-public class TCFConnectorService extends BasicConnectorService { ++ public static final String PROPERTY_SET_NAME = "TCF Connection Settings"; ++ public static final String PROPERTY_LOGIN_REQUIRED = "Login.Required"; //$NON-NLS-1$ ++ public static final String PROPERTY_PWD_REQUIRED="Pwd.Required"; ++ public static final String PROPERTY_LOGIN_PROMPT = "Login.Prompt"; //$NON-NLS-1$ ++ public static final String PROPERTY_PASSWORD_PROMPT = "Password.Prompt"; //$NON-NLS-1$ ++ public static final String PROPERTY_COMMAND_PROMPT = "Command.Prompt"; //$NON-NLS-1$ + + private IChannel channel; + private Throwable channel_error; +@@ -40,12 +60,62 @@ + + private boolean poll_timer_started; + ++ private boolean bSubscribed = false; ++ ++ /* subscribe the stream service on this TCP connection */ ++ private IStreams.StreamsListener streamListener = new IStreams.StreamsListener() { ++ public void created(String stream_type, String stream_id, ++ String context_id) { ++ System.out.printf("new stream id: %s , type: %s is created\n", ++ stream_id, stream_type); ++ } ++ ++ /** ++ * Called when a stream is disposed. ++ * ++ * @param stream_type ++ * - source type of the stream. ++ * @param stream_id ++ * - ID of the stream. ++ */ ++ public void disposed(String stream_type, String stream_id) { ++ System.out.printf("stream id: %s type: %s is disposed\n", ++ stream_id, stream_type); ++ } ++ }; ++ + public TCFConnectorService(IHost host, int port) { +- super("TCF", "Target Communication Framework", host, port); //$NON-NLS-1$ //$NON-NLS-2$ ++ super(TCFConnectorResources.TCFConnectorService_Name, ++ TCFConnectorResources.TCFConnectorService_Description, host, ++ port); //$NON-NLS-1$ //$NON-NLS-2$ ++ getTCFPropertySet(); + } ++ ++ public IPropertySet getTCFPropertySet() { ++ IPropertySet tcfSet = getPropertySet(PROPERTY_SET_NAME); ++ if (tcfSet == null) { ++ tcfSet = createPropertySet(PROPERTY_SET_NAME, TCFConnectorResources.PropertySet_Description); ++ //add default values if not set ++ tcfSet.addProperty(PROPERTY_LOGIN_REQUIRED, "true", PropertyType.getEnumPropertyType(new String[] {"true", "false"})); ++ tcfSet.addProperty(PROPERTY_PWD_REQUIRED, "false", PropertyType.getEnumPropertyType(new String[] {"true", "false"})); ++ tcfSet.addProperty(PROPERTY_LOGIN_PROMPT, "ogin: ", PropertyType.getStringPropertyType()); ++ tcfSet.addProperty(PROPERTY_PASSWORD_PROMPT, "assword: ", PropertyType.getStringPropertyType()); ++ tcfSet.addProperty(PROPERTY_COMMAND_PROMPT, "#", PropertyType.getStringPropertyType()); ++ } ++ return tcfSet; ++ } + ++ /** ++ * @return true if the associated connector service requires a password. ++ */ + @Override +- protected void internalConnect(final IProgressMonitor monitor) throws Exception { ++ public final boolean requiresPassword() { ++ return false; ++ } ++ ++ @Override ++ protected void internalConnect(final IProgressMonitor monitor) ++ throws Exception { + assert !Protocol.isDispatchThread(); + final Exception[] res = new Exception[1]; + // Fire comm event to signal state about to change +@@ -54,39 +124,55 @@ + synchronized (res) { + Protocol.invokeLater(new Runnable() { + public void run() { +- if (!connectTCFChannel(res, monitor)) add_to_wait_list(this); ++ if (!connectTCFChannel(res, monitor)) ++ add_to_wait_list(this); + } + }); + res.wait(); + } ++ if (res[0] != null) throw res[0]; + monitor.done(); +- if (res[0] != null) throw res[0]; + } + + @Override +- protected void internalDisconnect(final IProgressMonitor monitor) throws Exception { ++ protected void internalDisconnect(final IProgressMonitor monitor) ++ throws Exception { + assert !Protocol.isDispatchThread(); + final Exception[] res = new Exception[1]; + // Fire comm event to signal state about to change + fireCommunicationsEvent(CommunicationsEvent.BEFORE_DISCONNECT); + monitor.beginTask("Disconnecting " + getHostName(), 1); //$NON-NLS-1$ +- synchronized (res) { +- Protocol.invokeLater(new Runnable() { +- public void run() { +- if (!disconnectTCFChannel(res, monitor)) add_to_wait_list(this); +- } +- }); +- res.wait(); ++ try { ++ /* First UnSubscribe TCP channel */ ++ Unsubscribe(); ++ /* Disconnecting TCP channel */ ++ synchronized (res) { ++ Protocol.invokeLater(new Runnable() { ++ public void run() { ++ if (!disconnectTCFChannel(res, monitor)) ++ add_to_wait_list(this); ++ } ++ }); ++ res.wait(); ++ } ++ if (res[0] != null) throw res[0]; ++ + } +- monitor.done(); +- if (res[0] != null) throw res[0]; ++ catch (Exception e) { ++ e.printStackTrace(); ++ throw new RemoteFileException("Error creating Terminal", e); //$NON-NLS-1$ ++ } ++ finally { ++ monitor.done(); ++ } + } + + public boolean isConnected() { + final boolean res[] = new boolean[1]; + Protocol.invokeAndWait(new Runnable() { + public void run() { +- res[0] = channel != null && channel.getState() == IChannel.STATE_OPEN; ++ res[0] = channel != null ++ && channel.getState() == IChannel.STATE_OPEN; + } + }); + return res[0]; +@@ -108,7 +194,8 @@ + if (wait_list.isEmpty()) return; + Runnable[] r = wait_list.toArray(new Runnable[wait_list.size()]); + wait_list.clear(); +- for (int i = 0; i < r.length; i++) r[i].run(); ++ for (int i = 0; i < r.length; i++) ++ r[i].run(); + } + + private boolean connectTCFChannel(Exception[] res, IProgressMonitor monitor) { +@@ -117,9 +204,12 @@ + case IChannel.STATE_OPEN: + case IChannel.STATE_CLOSED: + synchronized (res) { +- if (channel_error instanceof Exception) res[0] = (Exception)channel_error; +- else if (channel_error != null) res[0] = new Exception(channel_error); +- else res[0] = null; ++ if (channel_error instanceof Exception) ++ res[0] = (Exception) channel_error; ++ else if (channel_error != null) ++ res[0] = new Exception(channel_error); ++ else ++ res[0] = null; + res.notify(); + return true; + } +@@ -137,7 +227,7 @@ + String host = getHostName().toLowerCase(); + int port = getConnectPort(); + if (port <= 0) { +- //Default fallback ++ // Default fallback + port = TCFConnectorServiceManager.TCF_PORT; + } + IPeer peer = null; +@@ -146,8 +236,8 @@ + for (IPeer p : locator.getPeers().values()) { + Map attrs = p.getAttributes(); + if ("TCP".equals(attrs.get(IPeer.ATTR_TRANSPORT_NAME)) && //$NON-NLS-1$ +- host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST)) && +- port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) { ++ host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST)) ++ && port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) { + peer = p; + break; + } +@@ -171,17 +261,18 @@ + + public void congestionLevel(int level) { + } +- + public void onChannelClosed(Throwable error) { + assert channel != null; + channel.removeChannelListener(this); + channel_error = error; ++ + if (wait_list.isEmpty()) { + fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR); + } + else { + run_wait_list(); + } ++ bSubscribed = false; + channel = null; + channel_error = null; + } +@@ -192,7 +283,8 @@ + return false; + } + +- private boolean disconnectTCFChannel(Exception[] res, IProgressMonitor monitor) { ++ private boolean disconnectTCFChannel(Exception[] res, ++ IProgressMonitor monitor) { + if (channel == null || channel.getState() == IChannel.STATE_CLOSED) { + synchronized (res) { + res[0] = null; +@@ -212,9 +304,12 @@ + } + + public V getService(Class service_interface) { +- if (channel == null || channel.getState() != IChannel.STATE_OPEN) throw new Error("Not connected"); //$NON-NLS-1$ ++ if (channel == null || channel.getState() != IChannel.STATE_OPEN) ++ throw new Error("Not connected"); //$NON-NLS-1$ + V m = channel.getRemoteService(service_interface); +- if (m == null) throw new Error("Remote peer does not support " + service_interface.getName() + " service"); //$NON-NLS-1$ //$NON-NLS-2$ ++ if (m == null) ++ throw new Error( ++ "Remote peer does not support " + service_interface.getName() + " service"); //$NON-NLS-1$ //$NON-NLS-2$ + return m; + } + +@@ -225,4 +320,111 @@ + public IFileSystem getFileSystemService() { + return getService(IFileSystem.class); + } ++ ++ public IChannel getChannel() { ++ // TODO Auto-generated method stub ++ return channel; ++ } ++ ++ public String getSessionHostName() { ++ // TODO Auto-generated method stub ++ String hostName = ""; ++ IHost host = getHost(); ++ if (host != null) hostName = host.getHostName(); ++ return hostName; ++ } ++ ++ public String getSessionUserId() { ++ // TODO Auto-generated method stub ++ return getUserId(); ++ } ++ ++ public String getSessionPassword() { ++ // TODO Auto-generated method stub ++ String password = ""; ++ SystemSignonInformation ssi = getSignonInformation(); ++ if (ssi != null) { ++ password = ssi.getPassword(); ++ } ++ return password; ++ } ++ ++ public boolean isSubscribed() { ++ // TODO Auto-generated method stub ++ return bSubscribed; ++ } ++ ++ public void Unsubscribe() throws IOException { ++ if (bSubscribed) { ++ System.out ++ .println("Unsubscribe streams before disconnecting TCP channel."); ++ try { ++ new TCFTask() { ++ public void run() { ++ IStreams streams = getService(IStreams.class); ++ streams.unsubscribe(ITerminalsService.NAME, streamListener, ++ new IStreams.DoneUnsubscribe() { ++ public void doneUnsubscribe(IToken token, ++ Exception error) { ++ // TODO Auto-generated method stub ++ System.out.printf( ++ "stream type %s unsubscribed\n", ++ ITerminalsService.NAME); ++ done(this); ++ } ++ }); ++ } ++ }.get(1, TimeUnit.SECONDS); ++ } ++ catch (InterruptedException e) { ++ new IOException("Meet " + e.getMessage() + " when Unsubsribe streams"); ++ } ++ catch (ExecutionException e) { ++ new IOException("Meet " + e.getMessage() + " when Unsubsribe streams"); ++ } ++ catch (TimeoutException e) { ++ new IOException("Meet " + e.getMessage() + " when Unsubsribe streams"); ++ } ++ bSubscribed = false; ++ } ++ ++ } ++ ++ public void Subscribe() throws RemoteFileException { ++ try { ++ new TCFTask() { ++ public void run() { ++ if (bSubscribed) { ++ done(this); ++ } ++ else { ++ bSubscribed = true; ++ IStreams streams = getService(IStreams.class); ++ streams.subscribe(ITerminalsService.NAME, streamListener, ++ new IStreams.DoneSubscribe() { ++ public void doneSubscribe(IToken token, ++ Exception error) { ++ // TODO Auto-generated method stub ++ System.out.println("Stream subscribed"); ++ if (error != null) { ++ System.out.println("subscribe error"); ++ bSubscribed = false; ++ error(error); ++ } ++ else ++ done(this); ++ } ++ ++ }); ++ }} ++ }.getIO(); ++ ++ } ++ catch (Exception e) { ++ e.printStackTrace(); ++ throw new RemoteFileException( ++ "Error When Subscribe Terminal streams!", e); //$NON-NLS-1$ ++ } ++ ++ } + } +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java (revision 0) +@@ -0,0 +1,35 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.shells; ++ ++import org.eclipse.osgi.util.NLS; ++ ++public class TCFShellServiceResources extends NLS { ++ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.shells.TCFShellServiceResources"; //$NON-NLS-1$ ++ ++ public static String TCFPlugin_Unexpected_Exception; ++ ++ public static String TCFShellService_Description; ++ ++ public static String TCFShellService_Name; ++ ++ static { ++ // initialize resource bundle ++ NLS.initializeMessages(BUNDLE_NAME, TCFShellServiceResources.class); ++ } ++ ++ private TCFShellServiceResources(){ ++ } ++ ++} ++ ++ ++ +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java (revision 0) +@@ -0,0 +1,444 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.shells; ++ ++import java.io.BufferedWriter; ++import java.io.IOException; ++import java.io.InputStream; ++import java.io.OutputStream; ++import java.io.OutputStreamWriter; ++import java.io.Writer; ++import java.util.Map; ++ ++import org.eclipse.core.runtime.IStatus; ++import org.eclipse.rse.core.model.IPropertySet; ++import org.eclipse.rse.services.clientserver.PathUtility; ++import org.eclipse.rse.services.clientserver.messages.CommonMessages; ++import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds; ++import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; ++import org.eclipse.rse.services.clientserver.messages.SystemMessage; ++import org.eclipse.rse.services.clientserver.messages.SystemMessageException; ++import org.eclipse.rse.services.terminals.AbstractTerminalShell; ++import org.eclipse.rse.services.terminals.ITerminalService; ++import org.eclipse.rse.ui.SystemBasePlugin; ++import org.eclipse.tm.internal.tcf.rse.ITCFSessionProvider; ++import org.eclipse.tm.internal.tcf.rse.TCFConnectorService; ++import org.eclipse.tm.internal.tcf.rse.TCFRSETask; ++import org.eclipse.tm.internal.tcf.terminals.ITerminalsService; ++import org.eclipse.tm.tcf.protocol.IChannel; ++import org.eclipse.tm.tcf.protocol.IToken; ++import org.eclipse.tm.tcf.services.IStreams; ++ ++ ++public class TCFTerminalShell extends AbstractTerminalShell { ++ private ITCFSessionProvider fSessionProvider; ++ private IChannel fChannel; ++ private String fPtyType; ++ private ITerminalsService.TerminalContext terminalContext; ++ private String fEncoding; ++ private InputStream fInputStream; ++ private OutputStream fOutputStream; ++ private Writer fOutputStreamWriter; ++ private int fWidth = 0; ++ private int fHeight = 0; ++ private String fContextID; ++ private String in_id; ++ private String out_id; ++ private boolean connected = false; ++ private ITerminalsService terminal; ++ private int status; ++ ++ private IPropertySet tcfPropertySet = null; ++ ++ private static String defaultEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding(); ++ private ITerminalsService.TerminalsListener listeners = new ITerminalsService.TerminalsListener(){ ++ ++ public void exited(String terminalId, int exitCode) { ++ // TODO Auto-generated method stub ++ System.out.printf("Console terminal shell %s exited, current shell ID %s\n", terminalId, terminalContext.getID()); ++ if(!terminalContext.getID().equals(terminalId)) ++ return; ++ terminal.removeListener(listeners); ++ TCFTerminalShell.this.connected = false; ++ } ++ ++ ++ public void winSizeChanged(String terminalId, int newWidth, ++ int newHeight) { ++ // TODO Auto-generated method stub ++ System.out.printf("Console terminal shell %s new width %d, height %d\n", terminalId, newWidth, newHeight); ++ } ++ }; ++ ++ private class LoginThread extends Thread { ++ ++ private String username; ++ private String password; ++ private int status = ITCFSessionProvider.SUCCESS_CODE; ++ public LoginThread(String username, String password) { ++ this.username = username; ++ this.password = password; ++ } ++ ++ public void run() { ++ tcfPropertySet = ((TCFConnectorService)fSessionProvider).getTCFPropertySet(); ++ String login_required = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_LOGIN_REQUIRED); ++ String login_prompt = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_LOGIN_PROMPT); ++ String password_prompt =tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_PASSWORD_PROMPT); ++ String command_prompt = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_COMMAND_PROMPT); ++ String pwd_required = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_PWD_REQUIRED); ++ ++ if (Boolean.valueOf(login_required).booleanValue()) { ++ status = ITCFSessionProvider.SUCCESS_CODE; ++ if (login_prompt != null && login_prompt.length() > 0) { ++ status = readUntil(login_prompt,fInputStream); ++ write(username + "\n"); ++ } ++ if (Boolean.valueOf(pwd_required).booleanValue()) { ++ if (status == ITCFSessionProvider.SUCCESS_CODE && password_prompt != null && password_prompt.length() > 0) { ++ status = readUntil(password_prompt,fInputStream); ++ write(password + "\n"); ++ } ++ } ++ if (status == ITCFSessionProvider.SUCCESS_CODE && command_prompt != null && command_prompt.length() > 0) { ++ status = readUntil(command_prompt,fInputStream); ++ write("\n"); ++ } ++ } else { ++ if (command_prompt != null && command_prompt.length() > 0) { ++ status = readUntil(command_prompt,fInputStream); ++ write("\n"); ++ } ++ } ++ } ++ ++ public int readUntil(String pattern,InputStream in) { ++ try { ++ char lastChar = pattern.charAt(pattern.length() - 1); ++ StringBuffer sb = new StringBuffer(); ++ int ch = in.read(); ++ while (ch >= 0) { ++ char tch = (char) ch; ++ sb.append(tch); ++ if (tch=='t' && sb.indexOf("incorrect") >= 0) { //$NON-NLS-1$ ++ return ITCFSessionProvider.ERROR_CODE; ++ } ++ if (tch=='d' && sb.indexOf("closed") >= 0) { //$NON-NLS-1$ ++ return ITCFSessionProvider.CONNECT_CLOSED; ++ } ++ if (tch == lastChar) { ++ if (sb.toString().endsWith(pattern)) { ++ return ITCFSessionProvider.SUCCESS_CODE; ++ } ++ } ++ ch = in.read(); ++ } ++ } ++ catch (Exception e) { ++ e.printStackTrace(); ++ SystemBasePlugin.logError(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), e); ++ } ++ return ITCFSessionProvider.CONNECT_CLOSED; ++ } ++ ++ public int getLoginStatus() { ++ return this.status; ++ } ++ ++ } ++ ++ public void write(String value) { ++ try { ++ int len = value.length() + 6; ++ fOutputStream.write(value.getBytes()); ++ System.out.printf("value is %s\n", value); ++ System.out.printf("write: ******************".substring(0, len <= 24 ? len : 24)); //$NON-NLS-1$ ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ private int login(String username, String password) throws InterruptedException ++ { ++ long millisToEnd = System.currentTimeMillis() + ITCFSessionProvider.TCP_CONNECT_TIMEOUT*1000; ++ LoginThread checkLogin = new LoginThread(username, password); ++ status = ITCFSessionProvider.ERROR_CODE; ++ checkLogin.start(); ++ while (checkLogin.isAlive() && System.currentTimeMillis()null if not ++ * relevant ++ * @param encoding The default encoding to use for initial command. ++ * @param environment Environment array to set, or null if ++ * not relevant. ++ * @param initialWorkingDirectory initial directory to open the Terminal in. ++ * Use null or empty String ("") to start in a ++ * default directory. Empty String will typically start in the ++ * home directory. ++ * @param commandToRun initial command to send. ++ * @throws SystemMessageException in case anything goes wrong. Channels and ++ * Streams are all cleaned up again in this case. ++ * @see ITerminalService ++ */ ++ public TCFTerminalShell(final ITCFSessionProvider sessionProvider, final String ptyType, ++ final String encoding, final String[] environment, ++ String initialWorkingDirectory, String commandToRun) ++ throws SystemMessageException { ++ Map map_ids; ++ Exception nestedException = null; ++ try { ++ fSessionProvider = sessionProvider; ++ fEncoding = encoding; ++ fPtyType = ptyType; ++ fChannel = fSessionProvider.getChannel(); ++ ++ if (fChannel == null || fChannel.getState() != IChannel.STATE_OPEN) ++ throw new Exception("TCP channel is not connected!"); ++ if (((TCFConnectorService)sessionProvider).isSubscribed() == false) ++ ((TCFConnectorService)sessionProvider).Subscribe(); ++ assert (((TCFConnectorService)sessionProvider).isSubscribed()); ++ ++ new TCFRSETask() { ++ public void run() { ++ terminal = ((TCFConnectorService)sessionProvider).getService(ITerminalsService.class); ++ terminal.addListener(listeners); ++ terminal.launch(ptyType, encoding, environment, new ITerminalsService.DoneLaunch() { ++ public void doneLaunch(IToken token, Exception error, ++ ITerminalsService.TerminalContext terminal) { ++ // TODO Auto-generated method stub ++ ++ terminalContext = terminal; ++ if (error != null) ++ error(error); ++ else done(terminal); ++ } ++ }); ++ } ++ ++ }.getS(null, TCFShellServiceResources.TCFShellService_Name); //$NON-NLS-1$ ++ ++ fPtyType = terminalContext.getPtyType(); ++ fEncoding = terminalContext.getEncoding(); ++ fContextID = terminalContext.getID(); ++ fWidth = terminalContext.getWidth(); ++ fHeight = terminalContext.getHeight(); ++ map_ids = terminalContext.getProperties(); ++ in_id = (String)map_ids.get(ITerminalsService.PROP_STDOUT_ID); ++ out_id = (String)map_ids.get(ITerminalsService.PROP_STDIN_ID); ++ ++ String user = fSessionProvider.getSessionUserId(); ++ String password = fSessionProvider.getSessionPassword(); //$NON-NLS-1$ ++ status = ITCFSessionProvider.ERROR_CODE; ++ ++ IStreams streams = ((TCFConnectorService)sessionProvider).getService(IStreams.class); ++ fOutputStream = new TCFTerminalOutputStream(streams, out_id); ++ fInputStream = new TCFTerminalInputStream(streams, in_id); ++ if (fEncoding != null) { ++ fOutputStreamWriter = new BufferedWriter(new OutputStreamWriter(fOutputStream, encoding)); ++ } else { ++ // default encoding == System.getProperty("file.encoding") ++ // TODO should try to determine remote encoding if possible ++ fOutputStreamWriter = new BufferedWriter(new OutputStreamWriter(fOutputStream)); ++ } ++ ++ try { ++ status = login(user, password); ++ } ++ finally ++ { ++ if ((status == ITCFSessionProvider.CONNECT_CLOSED)) ++ System.out.print("First time login fails, retry!"); ++ } ++ ++ //give another chance of retrying ++ if ((status == ITCFSessionProvider.CONNECT_CLOSED)) ++ { ++ ((TCFConnectorService)sessionProvider).Unsubscribe(); ++ ((TCFConnectorService)sessionProvider).Subscribe(); ++ assert (((TCFConnectorService)sessionProvider).isSubscribed()); ++ status = login(user, password); ++ } ++ ++ connected = true; ++ if (initialWorkingDirectory!=null && initialWorkingDirectory.length()>0 ++ && !initialWorkingDirectory.equals(".") //$NON-NLS-1$ ++ && !initialWorkingDirectory.equals("Command Shell") //$NON-NLS-1$ //FIXME workaround for bug 153047 ++ ) { ++ writeToShell("cd " + PathUtility.enQuoteUnix(initialWorkingDirectory)); //$NON-NLS-1$ ++ } ++ ++ if (commandToRun != null && commandToRun.length() > 0) { ++ writeToShell(commandToRun); ++ } ++ ++ } ++ catch (Exception e) ++ { ++ e.printStackTrace(); ++ nestedException = e; ++ } ++ finally { ++ if (status == ITCFSessionProvider.SUCCESS_CODE) { ++ System.out.println("TCF shell Service: Connected"); //$NON-NLS-1$ ++ } ++ else { ++ System.out.println("TCF shell Service: Connect failed"); //$NON-NLS-1$ ++ SystemMessage msg; ++ ++ if (nestedException!=null) { ++ msg = new SimpleSystemMessage(org.eclipse.tm.internal.tcf.rse.Activator.PLUGIN_ID, ++ ICommonMessageIds.MSG_EXCEPTION_OCCURRED, ++ IStatus.ERROR, ++ CommonMessages.MSG_EXCEPTION_OCCURRED, nestedException); ++ } else { ++ String strErr; ++ if (status == ITCFSessionProvider.CONNECT_CLOSED) ++ strErr = "Connection closed!"; ++ else if (status == ITCFSessionProvider.ERROR_CODE) ++ strErr = "Login Incorrect or meet other unknown error!"; ++ else ++ strErr = "Not identified Errors"; ++ ++ msg = new SimpleSystemMessage(org.eclipse.tm.internal.tcf.rse.Activator.PLUGIN_ID, ++ ICommonMessageIds.MSG_COMM_AUTH_FAILED, ++ IStatus.ERROR, ++ strErr, ++ "Meet error when trying to login in!"); ++ msg.makeSubstitution(((TCFConnectorService)fSessionProvider).getHost().getAliasName()); ++ } ++ throw new SystemMessageException(msg); ++ } ++ } ++ ++ } ++ ++ public void writeToShell(String command) throws IOException { ++ if (isActive()) { ++ if ("#break".equals(command)) { //$NON-NLS-1$ ++ command = "\u0003"; // Unicode 3 == Ctrl+C //$NON-NLS-1$ ++ } else { ++ command += "\r\n"; //$NON-NLS-1$ ++ } ++ fOutputStreamWriter.write(command); ++ } ++ } ++ ++ public void exit() { ++ ++ // TODO Auto-generated method stub ++ if (fChannel == null || (fChannel.getState() == IChannel.STATE_CLOSED) || !connected) { ++ System.out.println("This terminal shell exits already!"); ++ return; ++ } ++ try { ++ getOutputStream().close(); ++ getInputStream().close(); ++ ++ } ++ catch (IOException ioe) { ++ // TODO Auto-generated catch block ++ ioe.printStackTrace(); ++ } //$NON-NLS-1$ ++ ++ try { ++ new TCFRSETask() { ++ public void run() { ++ terminalContext.exit(new ITerminalsService.DoneCommand(){ ++ public void doneCommand(IToken token, ++ Exception error) { ++ // TODO Auto-generated method stub ++ if (error != null) ++ error(error); ++ else { ++ System.out.println("terminal exit command sent"); ++ done(this); ++ } ++ } ++ }); ++ }}.getS(null, TCFShellServiceResources.TCFShellService_Name); //seems no need block here. need further modification. ++ } ++ catch (SystemMessageException e) { ++ // TODO Auto-generated catch block ++ e.printStackTrace(); ++ } //$NON-NLS-1$; ++ } ++ ++ public InputStream getInputStream() { ++ // TODO Auto-generated method stub ++ return fInputStream; ++ } ++ ++ public OutputStream getOutputStream() { ++ // TODO Auto-generated method stub ++ return fOutputStream; ++ } ++ ++ public boolean isActive() { ++ // TODO Auto-generated method stub ++ if (fChannel != null && !(fChannel.getState() == IChannel.STATE_CLOSED) && connected) { ++ return true; ++ } ++ exit(); ++ // shell is not active: check for session lost ++ return false; ++ } ++ ++ public String getPtyType() { ++ return fPtyType; ++ } ++ ++ public void setTerminalSize(int newWidth, int newHeight) { ++ // do nothing ++ if (fChannel == null || (fChannel.getState() == IChannel.STATE_CLOSED) || !connected) { ++ System.out.println("This terminal shell exits already, can't set size!"); ++ return; ++ } ++ ++ try { ++ new TCFRSETask() { ++ public void run() { ++ if (fChannel != null && connected) { ++ terminal.setWinSize(fContextID, fWidth, fHeight, new ITerminalsService.DoneCommand(){ ++ ++ public void doneCommand(IToken token, Exception error) { ++ // TODO Auto-generated method stub ++ if (error != null) ++ error(error); ++ else ++ done(this); ++ ++ }}); ++ ++ } ++ }}.getS(null, TCFShellServiceResources.TCFShellService_Name); ++ } ++ catch (SystemMessageException e) { ++ // TODO Auto-generated catch block ++ e.printStackTrace(); ++ } //$NON-NLS-1$; ++ } ++ ++ public String getDefaultEncoding() { ++ if (fEncoding != null) return fEncoding; ++ return defaultEncoding; ++ } ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java (revision 0) +@@ -0,0 +1,33 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.shells; ++ ++import org.eclipse.osgi.util.NLS; ++ ++ ++public class TCFLoginProperties extends NLS { ++ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.shells.TCFLoginProperties"; //$NON-NLS-1$ ++ public static final String PropertySet_Description = "TCF Shell login word settings"; ++ public static String TCFLOGIN_REQUIRED; ++ public static String TCFPWD_REQUIRED; ++ public static String TCFLOGIN_PROMPT; ++ public static String TCFPASSWORD_PROMPT; ++ public static String TCFCOMMAND_PROMPT; ++ ++ static { ++ NLS.initializeMessages(BUNDLE_NAME, TCFLoginProperties.class); ++ } ++ ++ private TCFLoginProperties() { ++ } ++ ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java (revision 0) +@@ -0,0 +1,198 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.shells; ++import java.util.ArrayList; ++import java.util.StringTokenizer; ++ ++import org.eclipse.core.runtime.IPath; ++import org.eclipse.core.runtime.NullProgressMonitor; ++import org.eclipse.core.runtime.Path; ++import org.eclipse.rse.core.subsystems.ISubSystem; ++import org.eclipse.rse.internal.services.shells.TerminalServiceHostShell; ++import org.eclipse.rse.services.shells.IHostOutput; ++import org.eclipse.rse.services.shells.IHostShell; ++import org.eclipse.rse.services.shells.IHostShellChangeEvent; ++import org.eclipse.rse.services.shells.ParsedOutput; ++import org.eclipse.rse.services.shells.Patterns; ++import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; ++import org.eclipse.rse.subsystems.shells.core.model.ISystemOutputRemoteTypes; ++import org.eclipse.rse.subsystems.shells.core.model.RemoteError; ++import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput; ++import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; ++import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput; ++import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ServiceCommandShell; ++ ++@SuppressWarnings("restriction") ++public class TCFServiceCommandShell extends ServiceCommandShell { ++ private Patterns _patterns; ++ private String _workingDir; ++ private String _curCommand; ++ private IRemoteFileSubSystem _fs; ++ ++ public TCFServiceCommandShell(IRemoteCmdSubSystem cmdSS, ++ IHostShell hostShell) { ++ super(cmdSS, hostShell); ++ // TODO Auto-generated constructor stub ++ _patterns = new Patterns(); ++ _patterns.update("cmd"); //$NON-NLS-1$ ++ ISubSystem[] sses = cmdSS.getHost().getSubSystems(); ++ for (int i = 0; i < sses.length; i++) ++ { ++ if (sses[i] instanceof IRemoteFileSubSystem) ++ { ++ _fs = (IRemoteFileSubSystem)sses[i]; ++ break; ++ } ++ } ++ } ++ ++ public Object getContext() ++ { ++ String workingDir = _workingDir; ++ if (workingDir != null && workingDir.length() > 0) ++ { ++ try { ++ return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor()); ++ } ++ catch (Exception e) ++ { ++ e.printStackTrace(); ++ } ++ } ++ return null; ++ ++ } ++ ++ public String getContextString() ++ { ++ return _workingDir; ++ } ++ ++ public void shellOutputChanged(IHostShellChangeEvent event) ++ { ++ IHostOutput[] lines = event.getLines(); ++ boolean gotCommand = false; ++ ArrayList outputs = new ArrayList(lines.length); ++ for (int i = 0; i < lines.length; i++) ++ { ++ String line = lines[i].getString(); ++ System.out.println("shellOutput:"+line); ++ System.out.printf("cur command %s\n", _curCommand); ++ if (line.endsWith(getPromptCommand())) { ++ continue; //ignore our synthetic prompt command ++ } ++ ParsedOutput parsedMsg = null; ++ if (!gotCommand && line.equals(_curCommand)) { ++ gotCommand = true; ++ continue; //ignore remote command echo ++ } else ++ { ++ try ++ { ++ // Bug 160202: Remote shell dies. ++ if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$ ++ parsedMsg = _patterns.matchLine(line); ++ ++ // Bug 160202: Remote shell dies. ++ if (_curCommand != null) { ++ String temp = _curCommand.trim(); ++ StringTokenizer tokenizer = new StringTokenizer(temp); ++ ++ if (tokenizer.countTokens() == 2) { ++ String token1 = tokenizer.nextToken(); ++ String token2 = tokenizer.nextToken(); ++ ++ if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$ ++ if (line.startsWith("total")) { //$NON-NLS-1$ ++ parsedMsg = null; ++ } ++ } ++ } ++ } ++ } ++ } ++ catch (Throwable e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ RemoteOutput output = null; ++ ++ String type = "stdout"; //$NON-NLS-1$ ++ ++ if (parsedMsg != null) { ++ type = parsedMsg.type; ++ } ++ ++ if (event.isError()) { ++ output = new RemoteError(this, type); ++ } ++ else { ++ output = new RemoteOutput(this, type); ++ } ++ ++ output.setText(line); ++ if (parsedMsg != null) ++ { ++ String file = parsedMsg.file; ++ if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT)) ++ { ++ _workingDir = file; ++ output.setAbsolutePath(_workingDir); ++ } ++ else if(_workingDir!=null) ++ { ++ IPath p = new Path(_workingDir).append(file); ++ output.setAbsolutePath(p.toString()); ++ } ++ else ++ { ++ output.setAbsolutePath(file); ++ } ++ if (parsedMsg.line > 0){ ++ output.setLine(parsedMsg.line); ++ } ++ } ++ ++ addOutput(output); ++ outputs.add(output); ++ } ++ ++ IRemoteOutput[] remoteOutputs = outputs.toArray(new IRemoteOutput[outputs.size()]); ++ notifyOutputChanged(remoteOutputs, false); ++ } ++ ++ /** ++ * Return the prompt command, such that lines ending with the ++ * prompt command can be removed from output. ++ * Should be overridden in case the IHostShell used for this ++ * service is not an SshHostShell. ++ * @return String promptCommand ++ */ ++ protected String getPromptCommand() { ++ IHostShell shell = getHostShell(); ++ if (shell instanceof TerminalServiceHostShell) { ++ return ((TerminalServiceHostShell)shell).getPromptCommand(); ++ } ++ //return something impossible such that nothing is ever matched ++ return "\uffff"; //$NON-NLS-1$ ++ } ++ ++ public void writeToShell(String cmd) ++ { ++ _curCommand = cmd; ++ _patterns.update(cmd); ++ System.out.println("execute: cmd " + cmd); ++ super.writeToShell(cmd); ++ ++ } ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java (revision 0) +@@ -0,0 +1,148 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.shells; ++ ++import java.io.IOException; ++import java.io.InputStream; ++ ++import org.eclipse.tm.tcf.protocol.IToken; ++import org.eclipse.tm.tcf.services.IStreams; ++import org.eclipse.tm.tcf.util.TCFTask; ++ ++public class TCFTerminalInputStream extends InputStream { ++ private IStreams streams; ++ private boolean connected = true;;/* The stream is connected or not */ ++ String is_id; ++ private int value; ++ private boolean bEof = false;; ++ ++ public TCFTerminalInputStream(final IStreams streams, final String is_id) throws IOException{ ++ if (streams == null) ++ throw new IOException("TCP streams is null"); ++ this.streams = streams; ++ this.is_id = is_id; ++ } ++ ++ /* read must be synchronized */ ++ @Override ++ public synchronized int read() throws IOException { ++ // TODO Auto-generated method stub ++ if (!connected) ++ throw new IOException("istream is not connected"); ++ if (bEof) ++ return -1; ++ try { ++ new TCFTask() { ++ public void run() { ++ streams.read(is_id, 1, new IStreams.DoneRead() { ++ public void doneRead(IToken token, Exception error, int lostSize, ++ byte[] data, boolean eos) { ++ // TODO Auto-generated method stub ++ if (error != null) { ++ error(error); ++ return; ++ } ++ bEof = eos; ++ if (data != null) { ++ value = (int)data[0]; ++ if (data.length != 1) { ++ System.out.println("TCF inputstream read one byte, yet return more than one byte!"); ++ } ++ } ++ else ++ value = -1; ++ done(this); ++ } ++ }); ++ } ++ }.getIO(); ++ } ++ catch (Exception e) { ++ e.printStackTrace(); ++ throw new IOException(e); ++ } ++ return value; ++ } ++ ++ private static class Buffer { ++ byte[] buf; ++ Buffer() { ++ } ++ } ++ private Buffer buffer; ++ ++ public synchronized int read(byte b[], final int off, final int len) throws IOException { ++ ++ ++ if (!connected) ++ throw new IOException("istream is not connected"); ++ if (bEof) return -1; ++ if (b == null) { ++ throw new NullPointerException(); ++ } else if (off < 0 || len < 0 || len > b.length - off) { ++ throw new IndexOutOfBoundsException(); ++ } else if (len == 0) { ++ return 0; ++ } ++ try { ++ new TCFTask() { ++ public void run() { ++ streams.read(is_id, len, new IStreams.DoneRead() { ++ public void doneRead(IToken token, Exception error, int lostSize, ++ byte[] data, boolean eos) { ++ // TODO Auto-generated method stub ++ if (error != null) { ++ error(error); ++ return; ++ } ++ bEof = eos; ++ if (data != null) { ++ buffer = new Buffer(); ++ buffer.buf = data; ++ ++ } ++ done(buffer); ++ } ++ }); ++ } ++ }.getIO(); ++ ++ if (buffer.buf != null) { ++ int length = buffer.buf.length; ++ System.arraycopy(buffer.buf, 0, b, off, length); ++ System.out.println("read a line:"+ new String(b, off,length)); ++ return length; ++ } ++ else if (bEof) ++ return -1; ++ else return 0; ++ } catch (Exception ee) { ++ ee.printStackTrace(); ++ throw new IOException(ee); ++ } ++ } ++ ++ public void close() throws IOException { ++ if (!connected) return; ++ new TCFTask() { ++ public void run() { ++ streams.disconnect(is_id, new IStreams.DoneDisconnect() { ++ public void doneDisconnect(IToken token, Exception error) { ++ connected = false; ++ done(this); ++ } ++ }); ++ } ++ }.getIO(); ++ connected = false; ++ } ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java (revision 0) +@@ -0,0 +1,110 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.shells; ++ ++import java.io.IOException; ++ ++import java.io.OutputStream; ++ ++import org.eclipse.tm.tcf.protocol.IToken; ++import org.eclipse.tm.tcf.services.IStreams; ++import org.eclipse.tm.tcf.util.TCFTask; ++ ++public class TCFTerminalOutputStream extends OutputStream { ++ ++ private final IStreams streams; ++ private boolean connected = true; ++ private boolean write_eof; ++ String os_id; ++ ++ public TCFTerminalOutputStream(final IStreams streams, final String os_id) throws IOException{ ++ if (streams == null) throw new IOException("istream is null"); ++ this.streams = streams; ++ this.os_id = os_id; ++ write_eof = false; ++ } ++ ++ @Override ++ public synchronized void write(final byte b[], final int off, final int len) throws IOException { ++ /* If eof is written, we can't write anything into the stream */ ++ if (!connected || write_eof) ++ throw new IOException("stream is not connected or write_eof already!"); ++ System.out.println("write line: " + new String(b, off, len) ); ++ try { ++ new TCFTask() { ++ public void run() { ++ streams.write(os_id, b, off, len, new IStreams.DoneWrite() { ++ public void doneWrite(IToken token, Exception error) { ++ // TODO: stream write error handling ++ if (error != null) error(error); ++ done(this); ++ } ++ }); ++ ++ } ++ }.getIO(); ++ } ++ catch (Exception e) ++ { ++ throw new IOException(e); ++ } ++ } ++ ++ @Override ++ public synchronized void write(int b) throws IOException { ++ ++ // TODO Auto-generated method stub ++ try { ++ final byte[] buf = new byte[1]; ++ buf[0] = (byte)b; ++ this.write(buf, 0, 1); ++ } ++ catch(IOException ioe) { ++ ioe.printStackTrace(); ++ throw new IOException(ioe); ++ } ++ ++ } ++ ++ /* close must be called --Need to reconsider it in the future*/ ++ public void close() throws IOException { ++ if (!connected) ++ return; ++ try { ++ new TCFTask() { ++ public void run() { ++ streams.eos(os_id, new IStreams.DoneEOS() { ++ public void doneEOS(IToken token, Exception error) { ++ // TODO Auto-generated method stub ++ write_eof = true; ++ done(this); ++ } ++ }); ++ } ++ }.getIO(); ++ new TCFTask() { ++ public void run() { ++ streams.disconnect(os_id, new IStreams.DoneDisconnect() { ++ public void doneDisconnect(IToken token, Exception error) { ++ connected = false; ++ done(this); ++ } ++ }); ++ ++ } ++ }.getIO(); ++ } ++ catch(Exception e) { ++ throw new IOException(e); ++ } ++ } ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties (revision 0) +@@ -0,0 +1,3 @@ ++TCFPlugin_Unexpected_Exception=Unexpected {0}: {1} ++TCFShellService_Name=TCF Shell Service ++TCFShellService_Description=TCF Shell Service Description +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java (revision 0) +@@ -0,0 +1,70 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.shells; ++ ++import org.eclipse.rse.core.model.IHost; ++import org.eclipse.rse.core.subsystems.IConnectorService; ++import org.eclipse.rse.core.subsystems.ISubSystem; ++import org.eclipse.rse.services.shells.IHostShell; ++import org.eclipse.rse.services.shells.IShellService; ++import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; ++import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IServiceCommandShell; ++import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem; ++import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystemConfiguration; ++import org.eclipse.tm.internal.tcf.rse.*; ++import org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalService; ++ ++ ++public class TCFShellSubSystemConfiguration extends ++ ShellServiceSubSystemConfiguration { ++ ++ public TCFShellSubSystemConfiguration() { ++ super(); ++ } ++ ++ /** ++ * Instantiate and return an instance of OUR subsystem. ++ * Do not populate it yet though! ++ * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost) ++ */ ++ public ISubSystem createSubSystemInternal(IHost host) ++ { ++ TCFConnectorService connectorService = (TCFConnectorService)getConnectorService(host); ++ ISubSystem subsys = new ShellServiceSubSystem(host, connectorService, createShellService(host)); ++ return subsys; ++ } ++ ++ public IConnectorService getConnectorService(IHost host) { ++ return TCFConnectorServiceManager.getInstance().getConnectorService(host, getServiceImplType()); ++} ++ ++ public void setConnectorService(IHost host, ++ IConnectorService connectorService) { ++ TCFConnectorServiceManager.getInstance().setConnectorService(host, getServiceImplType(), connectorService); ++ } ++ ++ public Class getServiceImplType() ++ { ++ return ITCFSubSystem.class; ++ } ++ ++ public IServiceCommandShell createRemoteCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) { ++ return new TCFServiceCommandShell(cmdSS, hostShell); ++ } ++ ++ public IShellService createShellService(IHost host) { ++ TCFConnectorService cserv = (TCFConnectorService)getConnectorService(host); ++ ++ return (IShellService) (new TCFTerminalService(cserv)).getAdapter(IShellService.class); ++ } ++ ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties (revision 0) +@@ -0,0 +1,3 @@ ++TCFConnectorService_Name=TCF Connector Service ++TCFConnectorService_Description=Target Communication Framework ++PropertySet_Description=TCF login properties. Set these according to your remote system's login prompts. +\ No newline at end of file +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties (revision 0) +@@ -0,0 +1,3 @@ ++TCFPlugin_Unexpected_Exception=Unexpected {0}: {1} ++TCFTerminalService_Name=TCF Terminal Service ++TCFTerminalService_Description=TCF Terminal Service Description +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java (revision 0) +@@ -0,0 +1,64 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.terminals; ++ ++import org.eclipse.rse.core.model.IHost; ++import org.eclipse.rse.core.subsystems.IConnectorService; ++import org.eclipse.rse.core.subsystems.ISubSystem; ++import org.eclipse.rse.services.terminals.ITerminalService; ++import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem; ++import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystemConfiguration; ++import org.eclipse.tm.internal.tcf.rse.ITCFSubSystem; ++import org.eclipse.tm.internal.tcf.rse.TCFConnectorService; ++import org.eclipse.tm.internal.tcf.rse.TCFConnectorServiceManager; ++ ++public class TCFTerminalServiceSubSystemConfiguration extends ++ TerminalServiceSubSystemConfiguration { ++ ++ ++ /** ++ * Instantiate and return an instance of OUR subsystem. Do not populate it ++ * yet though! ++ * ++ * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost) ++ */ ++ public ISubSystem createSubSystemInternal(IHost host) { ++ TCFConnectorService connectorService = (TCFConnectorService) getConnectorService(host); ++ ISubSystem subsys = new TerminalServiceSubSystem(host, ++ connectorService, createTerminalService(host)); ++ return subsys; ++ } ++ ++ /** ++ * @inheritDoc ++ * @since 1.0 ++ */ ++ public ITerminalService createTerminalService(IHost host) { ++ TCFConnectorService cserv = (TCFConnectorService) getConnectorService(host); ++ return new TCFTerminalService(cserv); ++ } ++ ++ public IConnectorService getConnectorService(IHost host) { ++ return TCFConnectorServiceManager.getInstance().getConnectorService( ++ host, getServiceImplType()); ++ } ++ ++ public void setConnectorService(IHost host, ++ IConnectorService connectorService) { ++ TCFConnectorServiceManager.getInstance().setConnectorService(host, ++ getServiceImplType(), connectorService); ++ } ++ ++ public Class getServiceImplType() { ++ return ITCFSubSystem.class; ++ } ++ ++} +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java (revision 0) +@@ -0,0 +1,36 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.terminals; ++ ++import org.eclipse.osgi.util.NLS; ++ ++public class TCFTerminalServiceResources extends NLS { ++ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalServiceResources"; //$NON-NLS-1$ ++ ++ public static String TCFPlugin_Unexpected_Exception; ++ ++ public static String TCFTerminalService_Description; ++ ++ public static String TCFTerminalService_Name; ++ ++ static { ++ // initialize resource bundle ++ NLS.initializeMessages(BUNDLE_NAME, TCFTerminalServiceResources.class); ++ } ++ ++ private TCFTerminalServiceResources(){ ++ ++ } ++ ++} ++ ++ ++ +Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java (revision 0) +@@ -0,0 +1,57 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel Corporation - initial API and implementation ++ ******************************************************************************/ ++package org.eclipse.tm.internal.tcf.rse.terminals; ++ ++import org.eclipse.core.runtime.IProgressMonitor; ++ ++import org.eclipse.rse.services.clientserver.messages.SystemMessageException; ++import org.eclipse.rse.services.terminals.AbstractTerminalService; ++import org.eclipse.rse.services.terminals.ITerminalShell; ++import org.eclipse.tm.internal.tcf.rse.ITCFSessionProvider; ++import org.eclipse.tm.internal.tcf.rse.shells.TCFTerminalShell; ++ ++public class TCFTerminalService extends AbstractTerminalService{ ++ private final ITCFSessionProvider fSessionProvider; ++ ++ /** ++ * Return the TCF property set, and fill it with default values if it has ++ * not been created yet. Extender may override in order to set different ++ * default values. ++ * ++ * @return a property set holding properties understood by the TCF ++ * connector service. ++ */ ++ public ITerminalShell launchTerminal(String ptyType, String encoding, ++ String[] environment, String initialWorkingDirectory, ++ String commandToRun, IProgressMonitor monitor) ++ throws SystemMessageException { ++ // TODO Auto-generated method stub ++ TCFTerminalShell hostShell = new TCFTerminalShell(fSessionProvider, ptyType, encoding, environment, initialWorkingDirectory, commandToRun); ++ return hostShell; ++ } ++ ++ ++ public TCFTerminalService(ITCFSessionProvider sessionProvider) { ++ fSessionProvider = sessionProvider; ++ } ++ ++ public ITCFSessionProvider getSessionProvider() { ++ return fSessionProvider; ++ } ++ @Override ++ public String getName() { ++ return TCFTerminalServiceResources.TCFTerminalService_Name; ++ } ++ @Override ++ public String getDescription() { ++ return TCFTerminalServiceResources.TCFTerminalService_Description; ++ } ++} +Index: plugins/org.eclipse.tm.tcf.rse/plugin.xml +=================================================================== +--- plugins/org.eclipse.tm.tcf.rse/plugin.xml (revision 1190) ++++ plugins/org.eclipse.tm.tcf.rse/plugin.xml (working copy) +@@ -37,6 +37,22 @@ + vendor="Wind River"> + + ++ ++ ++ ++ + + + + ++ ++ ++ ++ + + Import->General->"Existing projects into workspace", + browse to the "tcf_local/plugins" direcotry, and click "OK". + 2) Check the following plugins: + org.eclipse.tm.tcf + org.eclipse.tm.tcf.core + org.eclipse.tm.tcf.rse + org.eclipse.tm.tcf.terminals + 3) Click "Finish" to import the eclipse plugins. + 4) Select Project->"Build All" to build the plugins. If the + build process complains about missing dependent plugin, + please see Note 2 below. + + +II. Usage +================================ +On remote target side +1. Build & run tcf agent on target. +(This step can be skipped if the agent is already included in +the poky generated iamge) + + - cd to direcotry "org.eclipse.tm.tcf.terminals.agent". + - type "make" to build the tcf agent. + - run the tcf agent with root privilege on target. + e.g. sudo obj/GNU/Linux/x86_64/Debug/agent -Llog.txt + +On Host side +2. Launch the RSE plugin for TCF(org.eclipse.tm.tcf.rse). +Make sure the org.eclipse.tm.tcf.terminals plugin is launched along +with that plugin. + +3. CDT remote debug. + 1) Choose from menu Run->"Debug Configurations..."-> + "C/C++ Remote Application", and click the "New launch configuration" + button. + 2) In the "Main" tab, click "New..." button and it will launch a + "New Connection" wizard. + 3) In the "New Connection" dialogue, choose "TCF" as system type and + click "Next". + 4) Input the ip address of the remote target machine in "Host name:", + choose an arbitary unique name for "Connection name:", and click + "Next". + 5) Make sure "org.eclipse.tm.tcf.rse.Terminals" is checked, make sure + you have input the correct TCF session properties in the TCF + Connector Service and click "Next". (See Note 3 below) + 6) Make sure "org.eclipse.tm.tcf.rse.Files" is checked and click "Next". + 7) Make sure "org.eclipse.tm.tcf.rse.Processes" is checked and click + "Next". + 8) Make sure "org.eclipse.tm.tcf.rse.Shells" is checked, make sure you + have input the correct TCF session properties in the TCF Connector + Service. (See Note 3 below) + 9) Click "Finish" to close the "New Connection" dialogue. + 10) In the "Main" tab, choose the connection just created from the + "Connection" drop-list. + 11) In the "Main" tab, enter the "Remote Absolute File Path for + C/C++ Application". This is where the debugged application to be + downloaded to the remote target side. e.g. "/tmp/helloworld". + 12) In the "Debugger" tab, please choose the correct "GDB debugger". + Usually you should choose the cross-gdb which matches the host + and target machine. (see Known limitations 2.) + 13) Click "Debug". + 14) In the popped up "Enter Password" dialogue, enter the correct + "User ID" and "Password" and click "OK". It will be used to + login to the remote target machine. + +III. Note +================================ +1. Sometimes the eclispe would report a exception of + "Java.lang.OutOfMemoryError: PermGen space" and the application hangs. + This is because the JVM garbage collection doesn't clean the permenant + generation space, which is used to store meta-data descriptions of + classes. To fix this problem, please add "-XX:MaxPermSize=256M" to the + "VM arguements" when launching the plug-ins. + +2. The following eclipse plugins should be installed before building + TCF related plugins. + + CDT v6.0.2: http://download.eclipse.org/tools/cdt/releases/galileo + RSE v3.1.2: http://download.eclipse.org/dsdp/tm/updates/3.1/ + +3. TCF Connector Service Properties. +The TCF connector service properties are used for the TCF based RSE +terminals and shells subsystems. + +To change these properties, click the "TCF Connection Settings" under +the "Available Services" in the wizard, in the right, a list of +properties is shown and ready for change. + +Here is a list of the properties: + + - Command.Prompt + This is a string of which the shell/terminal prompt string on the remote + target system will end with. The default value is + "# "(Pay attention there is a space after the '#'). + + - Login.Prompt + This is a string of which the login prompt string on the remote target + system will end with. The default value is "ogin: "(Pay attention + there is a space after the ':'). + + - Login.Required + Set to "true" if the remote target system requires the user to input + login user name for terminal/shell services. Otherwise set to "false". + The default value is "true". + + - Password.Prompt + This is a string of which the password prompt string on the remote target + system will end with. The default value is "assword: ".(Pay attention + there is a space after the ':') + + - Pwd.Required + Setting to "true" if the remote target system requires the user to input + password for terminal/shell services. Otherwise set to "false". The + default value is "false". + +IV. Known limitations +================================ +1. Authentication retry is not implemented. The user only has one chance to + input the correct password. If it fails, the user needs to re-launch + shell/terminal. If the user has checked the "Save password" in the prompt + dialogue, it needs to be disconnected and re-connected. + +2. Users have to set the correct cross-gdb debugger manually in the + "Debugger" tab in the remote debug configuration. diff --git a/tcf/terminals_agent.patch b/tcf/terminals_agent.patch new file mode 100644 index 0000000..d9ca505 --- /dev/null +++ b/tcf/terminals_agent.patch @@ -0,0 +1,1042 @@ +Index: org.eclipse.tm.tcf.terminals.agent/terminals.c +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0) +@@ -0,0 +1,860 @@ ++/******************************************************************************* ++ * Copyright (c) 2008 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ * Intel - implemented terminals service ++ *******************************************************************************/ ++ ++/* ++ * Sample TCF service implementation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#ifndef TIOCGWINSZ ++#include ++#endif ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define TERMINALS_DEBUG 1 ++ ++#define TERMINALS_NO_LOGIN 0 ++ ++static const char * TERMINALS = "Terminals"; ++ ++#if defined(WIN32) ++# include ++# ifdef _MSC_VER ++# pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union (in winternl.h) */ ++# include ++# else ++# include ++# endif ++# ifndef STATUS_INFO_LENGTH_MISMATCH ++# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) ++# endif ++# ifndef SystemHandleInformation ++# define SystemHandleInformation 16 ++# endif ++# error("unsupported WIN32!") ++#elif defined(_WRS_KERNEL) ++# include ++# include ++# include ++# include ++# include ++# error("unsupported WRS!") ++#else ++# include ++# include ++# include ++# if TERMINALS_NO_LOGIN ++# define TERM_LAUNCH_EXEC "/bin/bash" ++# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, NULL} ++# else ++# define TERM_LAUNCH_EXEC "/bin/login" ++# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, "-p", NULL} ++# endif ++#endif ++ ++#define PIPE_SIZE 0x1000 ++#define TERM_PROP_DEF_SIZE 256 ++ ++typedef struct Terminal ++{ ++ LINK link; ++ int pid; /*pid of the login process of the terminal*/ ++ TCFBroadcastGroup * bcg; ++ int inp; ++ int out; ++ int err; ++ struct TerminalInput * inp_struct; ++ struct TerminalOutput * out_struct; ++ struct TerminalOutput * err_struct; ++ char inp_id[256]; ++ char out_id[256]; ++ char err_id[256]; ++ ++ char pty_type[TERM_PROP_DEF_SIZE]; ++ char encoding[TERM_PROP_DEF_SIZE]; ++ unsigned long width; ++ unsigned long height; ++ long exit_code; ++ ++ Channel *channel; ++} Terminal; ++ ++typedef struct TerminalOutput ++{ ++ Terminal * prs; ++ AsyncReqInfo req; ++ int req_posted; ++ char buf[PIPE_SIZE]; ++ size_t buf_pos; ++ int eos; ++ VirtualStream * vstream; ++} TerminalOutput; ++ ++typedef struct TerminalInput ++{ ++ Terminal * prs; ++ AsyncReqInfo req; ++ int req_posted; ++ char buf[PIPE_SIZE]; ++ size_t buf_pos; ++ size_t buf_len; ++ int eos; ++ VirtualStream * vstream; ++} TerminalInput; ++ ++#define link2term(A) ((Terminal *)((char *)(A) - offsetof(Terminal, link))) ++ ++static LINK terms_list; ++#if defined(_WRS_KERNEL) ++static SEM_ID prs_list_lock = NULL; ++#endif ++ ++static Terminal * find_terminal(int pid) ++{ ++ LINK * qhp = &terms_list; ++ LINK * qp = qhp->next; ++ ++ while (qp != qhp) { ++ Terminal * prs = link2term(qp); ++ if (prs->pid == pid) ++ return prs; ++ qp = qp->next; ++ } ++ return NULL; ++} ++ ++static char * tid2id(int tid) ++{ ++ static char s[64]; ++ char * p = s + sizeof(s); ++ unsigned long n = (long) tid; ++ *(--p) = 0; ++ do { ++ *(--p) = (char) (n % 10 + '0'); ++ n = n / 10; ++ } while (n != 0); ++ ++ *(--p) = 'T'; ++ return p; ++} ++ ++static int id2tid(const char * id) ++{ ++ int tid = 0; ++ if (id == NULL) ++ return 0; ++ if (id[0] != 'T') ++ return 0; ++ if (id[1] == 0) ++ return 0; ++ tid = (unsigned) strtol(id + 1, (char **) &id, 10); ++ if (id[0] != 0) ++ return 0; ++ return tid; ++} ++ ++static void write_context(OutputStream * out, int tid) ++{ ++ Terminal * prs = find_terminal(tid); ++ ++ write_stream(out, '{'); ++ ++ if (prs != NULL) { ++ if (*prs->pty_type) { ++ json_write_string(out, "PtyType"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->pty_type); ++ write_stream(out, ','); ++ } ++ ++ if (*prs->encoding) { ++ json_write_string(out, "Encoding"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->encoding); ++ write_stream(out, ','); ++ } ++ ++ json_write_string(out, "Width"); ++ write_stream(out, ':'); ++ json_write_ulong(out, prs->width); ++ write_stream(out, ','); ++ ++ json_write_string(out, "Height"); ++ write_stream(out, ':'); ++ json_write_ulong(out, prs->height); ++ write_stream(out, ','); ++ ++ if (*prs->inp_id) { ++ json_write_string(out, "StdInID"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->inp_id); ++ write_stream(out, ','); ++ } ++ if (*prs->out_id) { ++ json_write_string(out, "StdOutID"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->out_id); ++ write_stream(out, ','); ++ } ++ if (*prs->err_id) { ++ json_write_string(out, "StdErrID"); ++ write_stream(out, ':'); ++ json_write_string(out, prs->err_id); ++ write_stream(out, ','); ++ } ++ } ++ ++ json_write_string(out, "ID"); ++ write_stream(out, ':'); ++ json_write_string(out, tid2id(tid)); ++ ++ write_stream(out, '}'); ++} ++ ++static void send_event_terminal_exited(OutputStream * out, Terminal * prs) ++{ ++ write_stringz(out, "E"); ++ write_stringz(out, TERMINALS); ++ write_stringz(out, "exited"); ++ ++ json_write_string(out, tid2id(prs->pid)); ++ write_stream(out, 0); ++ ++ json_write_ulong(out, prs->exit_code); ++ write_stream(out, 0); ++ ++ write_stream(out, MARKER_EOM); ++} ++ ++static void send_event_terminal_win_size_changed(OutputStream * out, ++ Terminal * prs) ++{ ++ write_stringz(out, "E"); ++ write_stringz(out, TERMINALS); ++ write_stringz(out, "winSizeChanged"); ++ ++ json_write_string(out, tid2id(prs->pid)); ++ write_stream(out, 0); ++ ++ json_write_long(out, prs->width); ++ write_stream(out, 0); ++ ++ json_write_long(out, prs->height); ++ write_stream(out, 0); ++ ++ write_stream(out, MARKER_EOM); ++} ++ ++static int kill_term(Terminal *term) ++{ ++ int err = 0; ++ ++#if defined(WIN32) ++ HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, term->pid); ++ if (h == NULL) ++ { ++ err = set_win32_errno(GetLastError()); ++ } ++ else ++ { ++ if (!TerminateProcess(h, 1)) err = set_win32_errno(GetLastError()); ++ if (!CloseHandle(h) && !err) err = set_win32_errno(GetLastError()); ++ } ++#else ++ if (kill(term->pid, SIGTERM) < 0) ++ err = errno; ++#endif ++ return err; ++} ++ ++static void command_exit(char * token, Channel * c) ++{ ++ int err = 0; ++ char id[256]; ++ unsigned tid; ++ Terminal *term = NULL; ++ ++ json_read_string(&c->inp, id, sizeof(id)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ tid = id2tid(id); ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ ++ if (tid == 0) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ term = find_terminal(tid); ++ if (term == NULL) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ err = kill_term(term); ++ } ++ } ++ ++ write_errno(&c->out, err); ++ write_stream(&c->out, MARKER_EOM); ++} ++ ++static void terminal_exited(Terminal * prs) ++{ ++ Trap trap; ++ ++ if (set_trap(&trap)) { ++ send_event_terminal_exited(&prs->bcg->out, prs); ++ clear_trap(&trap); ++ } else { ++ trace(LOG_ALWAYS, "Exception sending terminal exited event: %d %s", ++ trap.error, errno_to_str(trap.error)); ++ } ++ ++#if defined(_WRS_KERNEL) ++ semTake(prs_list_lock, WAIT_FOREVER); ++#endif ++ list_remove(&prs->link); ++ close(prs->inp); ++ close(prs->out); ++ if (prs->out != prs->err) ++ close(prs->err); ++ if (prs->inp_struct) { ++ TerminalInput * inp = prs->inp_struct; ++ if (!inp->req_posted) { ++ virtual_stream_delete(inp->vstream); ++ loc_free(inp); ++ } else { ++ inp->prs = NULL; ++ } ++ } ++ if (prs->out_struct) ++ prs->out_struct->prs = NULL; ++ if (prs->err_struct) ++ prs->err_struct->prs = NULL; ++ loc_free(prs); ++#if defined(_WRS_KERNEL) ++ semGive(prs_list_lock); ++#endif ++} ++ ++static void terminal_input_streams_callback(VirtualStream * stream, ++ int event_code, void * args) ++{ ++ TerminalInput * inp = (TerminalInput *) args; ++ ++ assert(inp->vstream == stream); ++ if (!inp->req_posted) { ++ if (inp->buf_pos >= inp->buf_len && !inp->eos) { ++ inp->buf_pos = inp->buf_len = 0; ++ virtual_stream_get_data(stream, inp->buf, sizeof(inp->buf), ++ &inp->buf_len, &inp->eos); ++ } ++ if (inp->buf_pos < inp->buf_len) { ++ inp->req.u.fio.bufp = inp->buf + inp->buf_pos; ++ inp->req.u.fio.bufsz = inp->buf_len - inp->buf_pos; ++ inp->req_posted = 1; ++ async_req_post(&inp->req); ++ } ++ } ++} ++ ++static void write_terminal_input_done(void * x) ++{ ++ AsyncReqInfo * req = (AsyncReqInfo *) x; ++ TerminalInput * inp = (TerminalInput *) req->client_data; ++ ++ inp->req_posted = 0; ++ if (inp->prs == NULL) { ++ /* Process has exited */ ++ virtual_stream_delete(inp->vstream); ++ loc_free(inp); ++ } else { ++ int wr = inp->req.u.fio.rval; ++ ++ if (wr < 0) { ++ int err = inp->req.error; ++ trace(LOG_ALWAYS, "Can't write terminal input stream: %d %s", err, ++ errno_to_str(err)); ++ inp->buf_pos = inp->buf_len = 0; ++ } else { ++ inp->buf_pos += wr; ++ } ++ ++ terminal_input_streams_callback(inp->vstream, 0, inp); ++ } ++} ++ ++static void write_terminal_input(Terminal * prs) ++{ ++ TerminalInput * inp = prs->inp_struct = (TerminalInput *) loc_alloc_zero( ++ sizeof(TerminalInput)); ++ inp->prs = prs; ++ inp->req.client_data = inp; ++ inp->req.done = write_terminal_input_done; ++ inp->req.type = AsyncReqWrite; ++ inp->req.u.fio.fd = prs->inp; ++ virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE, ++ VS_ENABLE_REMOTE_WRITE, terminal_input_streams_callback, inp, ++ &inp->vstream); ++ virtual_stream_get_id(inp->vstream, prs->inp_id, sizeof(prs->inp_id)); ++} ++ ++static void terminal_output_streams_callback(VirtualStream * stream, ++ int event_code, void * args) ++{ ++ TerminalOutput * out = (TerminalOutput *) args; ++ ++ assert(out->vstream == stream); ++ if (!out->req_posted) { ++ int buf_len = out->req.u.fio.rval; ++ int err = 0; ++ int eos = 0; ++ ++ if (buf_len < 0) { ++ buf_len = 0; ++ err = out->req.error; ++ } ++ if (buf_len == 0) ++ eos = 1; ++ if (out->prs == NULL) { ++ eos = 1; ++ err = 0; ++ } ++ ++ assert(buf_len <= (int)sizeof(out->buf)); ++ assert(out->buf_pos <= (size_t)buf_len); ++ assert(out->req.u.fio.bufp == out->buf); ++#ifdef __linux__ ++ if (err == EIO) ++ err = 0; ++#endif ++ if (err) ++ trace(LOG_ALWAYS, "Can't read terminal output stream: %d %s", err, ++ errno_to_str(err)); ++ ++ if (out->buf_pos < (size_t) buf_len || out->eos != eos) { ++ size_t done = 0; ++ virtual_stream_add_data(stream, out->buf + out->buf_pos, buf_len ++ - out->buf_pos, &done, eos); ++ out->buf_pos += done; ++ if (eos) ++ out->eos = 1; ++ } ++ ++ if (out->buf_pos >= (size_t) buf_len) { ++ if (!eos) { ++ out->req_posted = 1; ++ async_req_post(&out->req); ++ } else if (virtual_stream_is_empty(stream)) { ++ if (out->prs != NULL) { ++ if (out == out->prs->out_struct) ++ out->prs->out_struct = NULL; ++ if (out == out->prs->err_struct) ++ out->prs->err_struct = NULL; ++ } ++ virtual_stream_delete(stream); ++ loc_free(out); ++ } ++ } ++ } // end if(!out->req_posted) ++} ++ ++static void read_terminal_output_done(void * x) ++{ ++ AsyncReqInfo * req = (AsyncReqInfo *) x; ++ TerminalOutput * out = (TerminalOutput *) req->client_data; ++ ++ out->buf_pos = 0; ++ out->req_posted = 0; ++ terminal_output_streams_callback(out->vstream, 0, out); ++} ++ ++static TerminalOutput * read_terminal_output(Terminal * prs, int fd, char * id, ++ size_t id_size) ++{ ++ TerminalOutput * out = (TerminalOutput *) loc_alloc_zero( ++ sizeof(TerminalOutput)); ++ out->prs = prs; ++ out->req.client_data = out; ++ out->req.done = read_terminal_output_done; ++ out->req.type = AsyncReqRead; ++ out->req.u.fio.bufp = out->buf; ++ out->req.u.fio.bufsz = sizeof(out->buf); ++ out->req.u.fio.fd = fd; ++ virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE, ++ VS_ENABLE_REMOTE_READ, terminal_output_streams_callback, out, ++ &out->vstream); ++ virtual_stream_get_id(out->vstream, id, id_size); ++ out->req_posted = 1; ++ async_req_post(&out->req); ++ return out; ++} ++ ++static char **envp_add(char **old_envp, int old_envp_len, char *env) ++{ ++ char **new_envp = NULL; ++ int i; ++ int env_size; ++ int old_envp_size; ++ ++ assert(old_envp || (old_envp==NULL && old_envp_len==0)); ++ assert(env); ++ assert(*env); ++ ++ for (i = 0, old_envp_size = 0; i < old_envp_len; i++) { ++ old_envp_size += sizeof(char *); //size of env pointer ++ old_envp_size += strlen(old_envp[i]) + 1; //size of env string, including trailing '\0' ++ } ++ assert((old_envp && old_envp[i]==NULL) || (old_envp==NULL)); ++ old_envp_size += sizeof(char *);//last null pointer ++ ++ env_size = strlen(env); //new env string size ++ ++ new_envp = loc_alloc(old_envp_size + sizeof(char *) + env_size + 1); ++ if (new_envp != NULL) { ++ new_envp[0] = (char *) new_envp + old_envp_size + sizeof(char *); //setting new env ptr ++ strcpy(new_envp[0], env); //copy new env string ++ if (old_envp) { ++ memcpy(&new_envp[1], old_envp, old_envp_size); //copy old envp ++ } else { ++ new_envp[1] = NULL; ++ } ++ } ++ return new_envp; ++} ++ ++static int start_terminal(Channel * c, char *pty_type, char *encoding, ++ char ** envp, int envp_len, char * exe, char ** args, int *pid, ++ Terminal ** prs) ++{ ++ int err = 0; ++ int fd_tty_master = -1; ++ char * tty_slave_name = NULL; ++ struct winsize size; ++ char **newenvp = envp; ++ ++ memset(&size, 0, sizeof(struct winsize)); ++ fd_tty_master = posix_openpt(O_RDWR | O_NOCTTY); ++ if (fd_tty_master < 0 || grantpt(fd_tty_master) < 0 || unlockpt( ++ fd_tty_master) < 0) ++ err = errno; ++ if (!err) { ++ tty_slave_name = ptsname(fd_tty_master); ++ if (tty_slave_name == NULL) ++ err = EINVAL; ++ } ++ ++ if (ioctl(fd_tty_master, TIOCGWINSZ, (char *) &size) < 0) ++ err = errno; ++ ++ if (!err && fd_tty_master < 3) { ++ int fd0 = fd_tty_master; ++ if ((fd_tty_master = dup(fd_tty_master)) < 0 || close(fd0)) ++ err = errno; ++ } ++ ++ if (!err) { ++ *pid = fork(); ++ if (*pid < 0) ++ err = errno; ++ if (*pid == 0) { ++ int fd = -1; ++ int fd_tty_slave = -1; ++ char env_term[TERM_PROP_DEF_SIZE]; ++ ++ if (*pty_type) { ++ snprintf(env_term, sizeof(env_term), "TERM=%s", pty_type); ++ newenvp = envp_add(envp, envp_len, env_term); ++ if (newenvp == NULL) { ++ err = ENOMEM; ++ } else if (envp) { ++ loc_free(envp); ++ envp = NULL; ++ } ++ } ++ ++ if (!err && *encoding) { ++ envp = newenvp; ++ envp_len += 1; ++ snprintf(env_term, sizeof(env_term), "LANG=%s", encoding); ++ newenvp = envp_add(envp, envp_len, env_term); ++ if (newenvp == NULL) { ++ err = ENOMEM; ++ } else if (envp) { ++ loc_free(envp); ++ envp = NULL; ++ } ++ } ++ ++ setsid(); ++ ++ if (!err && (fd = sysconf(_SC_OPEN_MAX)) < 0) ++ err = errno; ++ if (!err && (fd_tty_slave = open(tty_slave_name, O_RDWR)) < 0) ++ err = errno; ++#if defined(TIOCSCTTY) ++ if (!err && (ioctl(fd_tty_slave, TIOCSCTTY, (char *) 0)) < 0) ++ err = errno; ++#endif ++ if (!err && dup2(fd_tty_slave, 0) < 0) ++ err = errno; ++ if (!err && dup2(fd_tty_slave, 1) < 0) ++ err = errno; ++ if (!err && dup2(fd_tty_slave, 2) < 0) ++ err = errno; ++ while (!err && fd > 3) ++ close(--fd); ++ if (!err) { ++ execve(exe, args, newenvp); ++ err = errno; ++ } ++ if (newenvp) ++ loc_free(newenvp); ++ err = 1; ++ if (err < 1) ++ err = EINVAL; ++ else if (err > 0xff) ++ err = EINVAL; ++ exit(err); ++ } ++ } ++ ++ if (!err) { ++ *prs = (Terminal *) loc_alloc_zero(sizeof(Terminal)); ++ (*prs)->inp = fd_tty_master; ++ (*prs)->out = fd_tty_master; ++ (*prs)->err = fd_tty_master; ++ (*prs)->pid = *pid; ++ (*prs)->bcg = c->bcg; ++ (*prs)->channel = c; ++ if (*pty_type) ++ snprintf((*prs)->pty_type, sizeof((*prs)->pty_type), "%s", pty_type); ++ if (*encoding) ++ snprintf((*prs)->encoding, sizeof((*prs)->encoding), "%s", encoding); ++ (*prs)->width = size.ws_row; ++ (*prs)->height = size.ws_col; ++ list_add_first(&(*prs)->link, &terms_list); ++ } ++ ++ if (!err) ++ return 0; ++ errno = err; ++ return -1; ++} ++ ++static void command_get_context(char * token, Channel * c) ++{ ++ int err = 0; ++ char id[256]; ++ int tid; ++ Terminal *term; ++ ++ json_read_string(&c->inp, id, sizeof(id)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ tid = id2tid(id); ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ ++ if (tid == 0) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ term = find_terminal(tid); ++ if (term == NULL) { ++ err = ERR_INV_CONTEXT; ++ } else { ++ write_context(&c->out, tid); ++ write_stream(&c->out, 0); ++ } ++ } ++ ++ write_errno(&c->out, err); ++ write_stream(&c->out, MARKER_EOM); ++} ++ ++static void command_launch(char * token, Channel * c) ++{ ++ int pid = 0; ++ int err = 0; ++ char encoding[TERM_PROP_DEF_SIZE]; ++ char pty_type[TERM_PROP_DEF_SIZE]; ++ char *args[] = TERM_LAUNCH_ARGS; ++ ++ char ** envp = NULL; ++ int envp_len = 0; ++ ++ Terminal * prs = NULL; ++ Trap trap; ++ ++ if (set_trap(&trap)) { ++ json_read_string(&c->inp, pty_type, sizeof(pty_type)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ json_read_string(&c->inp, encoding, sizeof(encoding)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ envp = json_read_alloc_string_array(&c->inp, &envp_len); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ if (err == 0 && start_terminal(c, pty_type, encoding, envp, envp_len, ++ TERM_LAUNCH_EXEC, args, &pid, &prs) < 0) ++ err = errno; ++ if (prs != NULL) { ++ write_terminal_input(prs); ++ prs->out_struct = read_terminal_output(prs, prs->out, prs->out_id, ++ sizeof(prs->out_id)); ++ if (prs->out != prs->err) ++ prs->err_struct = read_terminal_output(prs, prs->err, ++ prs->err_id, sizeof(prs->err_id)); ++ } ++ if (!err) { ++ add_waitpid_process(pid); ++ } ++ //write result back ++ { ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ write_errno(&c->out, err); ++ if (err || pid == 0) { ++ write_stringz(&c->out, "null"); ++ } else { ++ write_context(&c->out, pid); ++ write_stream(&c->out, 0); ++ } ++ write_stream(&c->out, MARKER_EOM); ++ } ++ clear_trap(&trap); ++ } ++ ++ loc_free(envp); ++ ++ if (trap.error) ++ exception(trap.error); ++} ++ ++static void command_set_win_size(char * token, Channel * c) ++{ ++ int err = 0; ++ struct winsize size; ++ char id[256]; ++ unsigned tid; ++ Terminal *term = NULL; ++ ++ json_read_string(&c->inp, id, sizeof(id)); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ size.ws_col=json_read_ulong(&c->inp); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ size.ws_row=json_read_ulong(&c->inp); ++ if (read_stream(&c->inp) != 0) ++ exception(ERR_JSON_SYNTAX); ++ if (read_stream(&c->inp) != MARKER_EOM) ++ exception(ERR_JSON_SYNTAX); ++ ++ tid = id2tid(id); ++ ++ if(tid==0 || (term=find_terminal(tid))==NULL) { ++ err=ERR_INV_CONTEXT; ++ }else if (term->width != size.ws_col || term->height != size.ws_row) { ++ if(ioctl(term->inp,TIOCSWINSZ,&size)<0) { ++ err=errno; ++ } ++ if(!err) { ++ term->width=size.ws_col; ++ term->height=size.ws_row; ++ send_event_terminal_win_size_changed(&term->channel->out,term); ++ } ++ } ++ ++ write_stringz(&c->out, "R"); ++ write_stringz(&c->out, token); ++ write_errno(&c->out, err); ++ write_stream(&c->out, MARKER_EOM); ++ ++} ++ ++static void waitpid_listener(int pid, int exited, int exit_code, int signal, ++ int event_code, int syscall, void * args) ++{ ++ if (exited) { ++ Terminal * prs = find_terminal(pid); ++ if (prs) { ++ if (signal != 0) ++ prs->exit_code = -signal; ++ else ++ prs->exit_code = exit_code; ++ terminal_exited(prs); ++ } ++ } ++} ++ ++static void channel_close_listener(Channel * c) ++{ ++ LINK * l = NULL; ++ ++ for (l = terms_list.next; l != &terms_list;) { ++ Terminal * term = link2term(l); ++ l = l->next; ++ if (term->channel == c) { ++ trace(LOG_ALWAYS, "Terminal is left launched: T%d", term->pid); ++ kill_term(term); ++ } ++ } ++} ++ ++void ini_terminals_service(Protocol * proto) ++{ ++#if defined(_WRS_KERNEL) ++ prs_list_lock = semMCreate(SEM_Q_PRIORITY); ++ if (prs_list_lock == NULL) check_error(errno); ++ if (taskCreateHookAdd((FUNCPTR)task_create_hook) != OK) check_error(errno); ++ if (taskDeleteHookAdd((FUNCPTR)task_delete_hook) != OK) check_error(errno); ++#endif ++ list_init(&terms_list); ++ ++ add_waitpid_listener(waitpid_listener, NULL); ++ add_channel_close_listener(channel_close_listener); ++ ++ add_command_handler(proto, TERMINALS, "getContext", command_get_context); ++ add_command_handler(proto, TERMINALS, "launch", command_launch); ++ add_command_handler(proto, TERMINALS, "exit", command_exit); ++ add_command_handler(proto, TERMINALS, "setWinSize", command_set_win_size); ++} +Index: org.eclipse.tm.tcf.terminals.agent/main/services-ext.h +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0) +@@ -0,0 +1,26 @@ ++/******************************************************************************* ++ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ * Intel - implemented terminals service ++ *******************************************************************************/ ++ ++/* ++ * Services initialization code extension point. ++ * If the agent is built with additional user-defined services, ++ * a customized version of services-ext.h file can be added to compiler headers search paths. ++ */ ++ ++#include "terminals.h" ++ ++static void ini_ext_services(Protocol * proto, TCFBroadcastGroup * bcg) { ++ ini_terminals_service(proto); ++} +Index: org.eclipse.tm.tcf.terminals.agent/terminals.h +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0) +@@ -0,0 +1,28 @@ ++/******************************************************************************* ++ * Copyright (c) 2008 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ * Intel - implemented terminals service ++ *******************************************************************************/ ++ ++/* ++ * TCF terminals service header file. ++ */ ++ ++#ifndef TERMINALS_H_ ++#define TERMINALS_H_ ++ ++#include ++#include ++ ++extern void ini_terminals_service(Protocol * proto); ++ ++#endif /*TERMINALS_H_*/ +Index: org.eclipse.tm.tcf.terminals.agent/config.h +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/config.h (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/config.h (revision 0) +@@ -0,0 +1,64 @@ ++/******************************************************************************* ++ * Copyright (c) 2008 Wind River Systems, Inc. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * and Eclipse Distribution License v1.0 which accompany this distribution. ++ * The Eclipse Public License is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * and the Eclipse Distribution License is available at ++ * http://www.eclipse.org/org/documents/edl-v10.php. ++ * ++ * Contributors: ++ * Wind River Systems - initial API and implementation ++ * Intel - implemented terminals service ++ *******************************************************************************/ ++ ++/* ++ * This file contains "define" statements that control agent configuration. ++ * SERVICE_* definitions control which service implementations are included into the agent. ++ * ++ * This is example agent configuration. It includes only few standard services, ++ * and one example service: Day Time. ++ */ ++ ++#ifndef D_config ++#define D_config ++ ++#include ++ ++#if defined(WIN32) || defined(__CYGWIN__) ++# define TARGET_UNIX 0 ++#elif defined(_WRS_KERNEL) ++# define TARGET_UNIX 0 ++#else ++# define TARGET_UNIX 1 ++#endif ++ ++#define SERVICE_Locator 1 ++#define SERVICE_Processes 1 ++#define SERVICE_Streams 1 ++#define SERVICE_FileSystem 1 ++#define SERVICE_SysMonitor TARGET_UNIX ++ ++#define ENABLE_ZeroCopy 1 ++ ++#if !defined(ENABLE_Splice) ++# if ENABLE_ZeroCopy ++# include ++# if defined(SPLICE_F_MOVE) ++# define ENABLE_Splice 1 ++# else ++# define ENABLE_Splice 0 ++# endif ++# else ++# define ENABLE_Splice 0 ++# endif ++#endif ++ ++#define ENABLE_SSL 0 ++ ++#define ENABLE_Trace 1 ++#define ENABLE_Discovery 1 ++ ++ ++#endif /* D_config */ +Index: org.eclipse.tm.tcf.terminals.agent/Makefile +=================================================================== +--- org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0) ++++ org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0) +@@ -0,0 +1,39 @@ ++TCF_AGENT_DIR=../agent ++ ++include $(TCF_AGENT_DIR)/Makefile.inc ++ ++override CFLAGS += $(foreach dir,$(INCDIRS),-I$(dir)) $(OPTS) ++ ++HFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.h)) $(HFILES) ++CFILES := $(sort $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c)) $(CFILES)) ++ ++#no using SSL ++LIBS = -lpthread -lrt ++ ++EXECS = $(BINDIR)/agent$(EXTEXE) ++ ++all: $(EXECS) ++ ++$(BINDIR)/libtcf$(EXTLIB) : $(OFILES) ++ $(AR) rcs $@ $^ ++ ++$(BINDIR)/agent$(EXTEXE): $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) ++ $(CC) $(CFLAGS) -o $@ $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) $(LIBS) ++ ++$(BINDIR)/%$(EXTOBJ): %.c $(HFILES) Makefile ++ @mkdir -p $(dir $@) ++ $(CC) $(CFLAGS) -c -o $@ $< ++ ++$(BINDIR)/%$(EXTOBJ): $(TCF_AGENT_DIR)/%.c $(HFILES) Makefile ++ @mkdir -p $(dir $@) ++ $(CC) $(CFLAGS) -c -o $@ $< ++ ++install: all ++ install -d -m 755 $(INSTALLROOT)$(SBIN) ++ install -d -m 755 $(INSTALLROOT)$(INIT) ++ install -c $(BINDIR)/agent -m 755 $(INSTALLROOT)$(SBIN)/tcf-agent ++ install -c $(TCF_AGENT_DIR)/main/tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent ++ ++clean: ++ rm -rf $(BINDIR) ++ diff --git a/tcf/terminals_plugin.patch b/tcf/terminals_plugin.patch new file mode 100644 index 0000000..352e151 --- /dev/null +++ b/tcf/terminals_plugin.patch @@ -0,0 +1,618 @@ +Index: plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF (revision 0) +@@ -0,0 +1,14 @@ ++Manifest-Version: 1.0 ++Bundle-ManifestVersion: 2 ++Bundle-Name: %pluginName ++Bundle-SymbolicName: org.eclipse.tm.tcf.terminals;singleton:=true ++Bundle-Version: 0.3.0.qualifier ++Bundle-Activator: org.eclipse.tm.internal.tcf.terminals.Activator ++Bundle-Vendor: %providerName ++Require-Bundle: org.eclipse.core.runtime, ++ org.eclipse.tm.tcf ++Bundle-ActivationPolicy: lazy ++Bundle-RequiredExecutionEnvironment: JavaSE-1.6 ++Import-Package: org.eclipse.tm.tcf.core;version="0.3.0", ++ org.eclipse.tm.tcf.protocol;version="0.3.0" ++Export-Package: org.eclipse.tm.internal.tcf.terminals +Index: plugins/org.eclipse.tm.tcf.terminals/.classpath +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/.classpath (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/.classpath (revision 0) +@@ -0,0 +1,7 @@ ++ ++ ++ ++ ++ ++ ++ +Index: plugins/org.eclipse.tm.tcf.terminals/.project +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/.project (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/.project (revision 0) +@@ -0,0 +1,28 @@ ++ ++ ++ org.eclipse.tm.tcf.terminals ++ ++ ++ ++ ++ ++ org.eclipse.jdt.core.javabuilder ++ ++ ++ ++ ++ org.eclipse.pde.ManifestBuilder ++ ++ ++ ++ ++ org.eclipse.pde.SchemaBuilder ++ ++ ++ ++ ++ ++ org.eclipse.pde.PluginNature ++ org.eclipse.jdt.core.javanature ++ ++ +Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java (revision 0) +@@ -0,0 +1,191 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel - initial API and implementation ++ *******************************************************************************/ ++ ++package org.eclipse.tm.internal.tcf.terminals; ++ ++import java.io.IOException; ++import java.util.HashMap; ++import java.util.Map; ++ ++import org.eclipse.tm.internal.tcf.terminals.ITerminalsService; ++import org.eclipse.tm.tcf.core.Command; ++import org.eclipse.tm.tcf.protocol.IChannel; ++import org.eclipse.tm.tcf.protocol.IToken; ++import org.eclipse.tm.tcf.protocol.JSON; ++import org.eclipse.tm.tcf.protocol.Protocol; ++ ++public class TerminalsServiceProxy implements ITerminalsService { ++ ++ private final IChannel channel; ++ private final Map listeners = ++ new HashMap(); ++ ++ private class TerminalContext implements ITerminalsService.TerminalContext { ++ ++ private final Map props; ++ ++ TerminalContext(Map props) { ++ this.props = props; ++ } ++ ++ public String getID() { ++ return (String)props.get(PROP_ID); ++ } ++ ++ public String getPtyType() { ++ return (String)props.get(PROP_PTY_TYPE); ++ } ++ ++ public String getEncoding() { ++ return (String)props.get(PROP_ENCODING); ++ } ++ ++ public int getWidth() { ++ return ((Integer)props.get(PROP_WIDTH)).intValue(); ++ } ++ ++ public int getHeight() { ++ return ((Integer)props.get(PROP_HEIGHT)).intValue(); ++ } ++ ++ public IToken exit(final DoneCommand done) { ++ return new Command(channel, TerminalsServiceProxy.this, ++ "exit", new Object[]{ getID() }) { ++ @Override ++ public void done(Exception error, Object[] args) { ++ if (error == null) { ++ assert args.length == 1; ++ error = toError(args[0]); ++ } ++ done.doneCommand(token, error); ++ } ++ }.token; ++ } ++ ++ public Map getProperties() { ++ return props; ++ } ++ ++ public String toString() { ++ return "[Terminals Context " + props.toString() + "]"; ++ } ++ } ++ ++ TerminalsServiceProxy(IChannel channel) { ++ this.channel = channel; ++ } ++ ++ /** ++ * Return service name, as it appears on the wire - a TCF name of the service. ++ */ ++ public String getName() { ++ return NAME; ++ } ++ ++ public IToken getContext(String id, final DoneGetContext done) ++ { ++ return new Command(channel, this, ++ "getContext", new Object[]{ id }) { ++ @SuppressWarnings("unchecked") ++ @Override ++ public void done(Exception error, Object[] args) { ++ TerminalContext ctx = null; ++ if (error == null) { ++ assert args.length == 2; ++ error = toError(args[0]); ++ if (args[1] != null) ctx = new TerminalContext((Map)args[1]); ++ } ++ done.doneGetContext(token, error, ctx); ++ } ++ }.token; ++ } ++ ++ public IToken launch(String type, String encoding, String[] environment, final DoneLaunch done) ++ { ++ return new Command(channel, this, "launch", ++ new Object[]{ type, encoding, environment}) { ++ @SuppressWarnings("unchecked") ++ @Override ++ public void done(Exception error, Object[] args) { ++ TerminalContext ctx=null; ++ if (error == null) { ++ assert args.length == 2; ++ error = toError(args[0]); ++ if (args[1] != null) ctx = new TerminalContext((Map)args[1]); ++ } ++ done.doneLaunch(token, error, ctx); ++ } ++ }.token; ++ } ++ ++ public IToken setWinSize(String context_id, int newWidth, int newHeight, final DoneCommand done) ++ { ++ return new Command(channel, this, "setWinSize", ++ new Object[]{ context_id, newWidth, newHeight}) { ++ @Override ++ public void done(Exception error, Object[] args) { ++ if (error == null) { ++ assert args.length == 1; ++ error = toError(args[0]); ++ } ++ done.doneCommand(token, error); ++ } ++ }.token; ++ } ++ ++ public void addListener(final TerminalsListener listener) ++ { ++ IChannel.IEventListener l = new IChannel.IEventListener() { ++ public void event(String name, byte[] data) { ++ try { ++ Object[] args = JSON.parseSequence(data); ++ if (name.equals("exited")) { ++ assert args.length == 2; ++ listener.exited((String)args[0], ((Number)args[1]).intValue()); ++ }else if(name.equals("winSizeChanged")) { ++ assert args.length == 3; ++ listener.winSizeChanged((String)args[0], ((Number)args[1]).intValue(), ((Number)args[2]).intValue()); ++ }else { ++ throw new IOException("Terminals service: unknown event: " + name); ++ } ++ }catch (Throwable x) { ++ channel.terminate(x); ++ } ++ } ++ }; ++ channel.addEventListener(this, l); ++ listeners.put(listener, l); ++ } ++ ++ public void removeListener(TerminalsListener listener) { ++ IChannel.IEventListener l = listeners.remove(listener); ++ if (l != null) channel.removeEventListener(this, l); ++ } ++ ++ static { ++ /* ++ * Make Terminal Service proxy available to all potential clients by creating ++ * the proxy object every time a TCF communication channel is opened. ++ * Note: extension point "org.eclipse.tm.tcf.startup" is used to load this class ++ * at TCF startup time, so proxy factory is properly activated even if nobody ++ * import directly from this plugin. ++ */ ++ Protocol.addChannelOpenListener(new Protocol.ChannelOpenListener() { ++ ++ public void onChannelOpen(IChannel channel) { ++ // Check if remote server provides Daytime service ++ if (channel.getRemoteService(ITerminalsService.NAME) == null) return; ++ // Create service proxy ++ channel.setServiceProxy(ITerminalsService.class, new TerminalsServiceProxy(channel)); ++ } ++ }); ++ } ++} +Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java (revision 0) +@@ -0,0 +1,193 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel - initial API and implementation ++ *******************************************************************************/ ++ ++package org.eclipse.tm.internal.tcf.terminals; ++ ++import java.util.Map; ++ ++import org.eclipse.tm.tcf.protocol.IService; ++import org.eclipse.tm.tcf.protocol.IToken; ++ ++/** ++ * ITerminalsService allows to launch a new terminal on the remote target system. ++ */ ++public interface ITerminalsService extends IService { ++ ++ /** ++ * This service name, as it appears on the wire - a TCF name of the service. ++ */ ++ static final String NAME = "Terminals"; ++ /** ++ * Retrieve context info for given context ID. ++ * A context corresponds to an terminal. ++ * Context IDs are valid across TCF services, so it is allowed to issue ++ * 'ITerminals.getContext' command with a context that was obtained, ++ * for example, from Memory service. ++ * However, 'ITerminals.getContext' is supposed to return only terminal specific data, ++ * If the ID is not a terminal ID, 'ITerminals.getContext' may not return any ++ * useful information ++ * ++ * @param id – context ID. ++ * @param done - call back interface called when operation is completed. ++ */ ++ IToken getContext(String id, DoneGetContext done); ++ ++ /** ++ * Client call back interface for getContext(). ++ */ ++ interface DoneGetContext { ++ /** ++ * Called when contexts data retrieval is done. ++ * @param error – error description if operation failed, null if succeeded. ++ * @param context – context data. ++ */ ++ void doneGetContext(IToken token, Exception error, TerminalContext context); ++ } ++ /** ++ * Context property names. ++ */ ++ static final String ++ /** The TCF context ID */ ++ PROP_ID = "ID", ++ ++ /** The pty type */ ++ PROP_PTY_TYPE = "PtyType", ++ ++ /** terminal encoding */ ++ PROP_ENCODING = "Encoding", ++ ++ /** window width size */ ++ PROP_WIDTH = "Width", ++ ++ /** window height size */ ++ PROP_HEIGHT = "Height", ++ ++ /** Process standard input stream ID */ ++ PROP_STDIN_ID = "StdInID", ++ ++ /** Process standard output stream ID */ ++ PROP_STDOUT_ID = "StdOutID", ++ ++ /** Process standard error stream ID */ ++ PROP_STDERR_ID = "StdErrID"; ++ ++ interface TerminalContext { ++ ++ /** ++ * Get context ID. ++ * Same as getProperties().get(“ID”) ++ */ ++ String getID(); ++ ++ /** ++ * Get terminal type. ++ * Same as getProperties().get(“PtyType”) ++ */ ++ String getPtyType(); ++ ++ /** ++ * Get encoding. ++ * Same as getProperties().get(“Encoding”) ++ */ ++ String getEncoding(); ++ ++ /** ++ * Get width. ++ * Same as getProperties().get(“Width”) ++ */ ++ int getWidth(); ++ ++ /** ++ * Get height. ++ * Same as getProperties().get(“Height”) ++ */ ++ int getHeight(); ++ ++ /** ++ * Get all available context properties. ++ * @return Map 'property name' -> 'property value' ++ */ ++ Map getProperties(); ++ ++ /** ++ * Exit the terminal. ++ * @param done - call back interface called when operation is completed. ++ * @return pending command handle, can be used to cancel the command. ++ */ ++ IToken exit(DoneCommand done); ++ } ++ ++ interface DoneCommand { ++ void doneCommand(IToken token, Exception error); ++ } ++ /** ++ * Launch a new terminal toremote machine. ++ * @param type - requested terminal type for the new terminal. ++ * @param encoding - requested encoding for the new terminal. ++ * @param environment - Array of environment variable strings. ++ * if null then default set of environment variables will be used. ++ * @param done - call back interface called when operation is completed. ++ * @return pending command handle, can be used to cancel the command. ++ */ ++ IToken launch(String type, String encoding, String[] environment, ++ DoneLaunch done); ++ ++ /** ++ * Call-back interface to be called when "start" command is complete. ++ */ ++ interface DoneLaunch { ++ void doneLaunch(IToken token, Exception error, TerminalContext terminal); ++ } ++ ++ ++ /** ++ * Set the terminal widows size ++ * @param context_id - context ID. ++ * @param signal - signal code. ++ * @param done - call back interface called when operation is completed. ++ * @return pending command handle, can be used to cancel the command. ++ */ ++ IToken setWinSize(String context_id, int newWidth, int newHeight, DoneCommand done); ++ ++ /** ++ * Add terminals service event listener. ++ * @param listener - event listener implementation. ++ */ ++ void addListener(TerminalsListener listener); ++ ++ /** ++ * Remove terminals service event listener. ++ * @param listener - event listener implementation. ++ */ ++ void removeListener(TerminalsListener listener); ++ ++ /** ++ * Process event listener is notified when a terminal exits. ++ * Event are reported only for terminals that were started by 'launch' command. ++ */ ++ interface TerminalsListener { ++ ++ /** ++ * Called when a terminal exits. ++ * @param terminal_id - terminal context ID ++ * @param exit_code - terminal exit code ++ */ ++ void exited(String terminal_id, int exit_code); ++ ++ /** ++ * Called when a terminal exits. ++ * @param terminal_id - terminal context ID ++ * @param newWidth – new terminal width ++ * @param newHeight – new terminal height ++ */ ++ void winSizeChanged (String terminal_id, int newWidth, int newHeight); ++ } ++} +Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java (revision 0) +@@ -0,0 +1,61 @@ ++/******************************************************************************* ++ * Copyright (c) 2010 Intel Corporation. and others. ++ * All rights reserved. This program and the accompanying materials ++ * are made available under the terms of the Eclipse Public License v1.0 ++ * which accompanies this distribution, and is available at ++ * http://www.eclipse.org/legal/epl-v10.html ++ * ++ * Contributors: ++ * Intel - initial API and implementation ++ *******************************************************************************/ ++ ++package org.eclipse.tm.internal.tcf.terminals; ++ ++import org.eclipse.core.runtime.Plugin; ++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.eclipse.tm.tcf.terminals"; ++ ++ // The shared instance ++ private static Activator plugin; ++ ++ /** ++ * 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; ++ } ++ ++} +Index: plugins/org.eclipse.tm.tcf.terminals/plugin.properties +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/plugin.properties (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/plugin.properties (revision 0) +@@ -0,0 +1,13 @@ ++############################################################################### ++# Copyright (c) 2010 Intel, Inc. and others. ++# All rights reserved. This program and the accompanying materials ++# are made available under the terms of the Eclipse Public License v1.0 ++# which accompanies this distribution, and is available at ++# http://www.eclipse.org/legal/epl-v10.html ++# ++# Contributors: ++# Intel - initial implementation ++############################################################################### ++pluginName = TCF Terminals service (Incubation) ++providerName = Eclipse.org ++ +Index: plugins/org.eclipse.tm.tcf.terminals/build.properties +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/build.properties (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/build.properties (revision 0) +@@ -0,0 +1,8 @@ ++source.. = src/ ++output.. = bin/ ++bin.includes = META-INF/,\ ++ .,\ ++ plugin.xml,\ ++ about.html,\ ++ plugin.properties ++src.includes = about.html +Index: plugins/org.eclipse.tm.tcf.terminals/plugin.xml +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/plugin.xml (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/plugin.xml (revision 0) +@@ -0,0 +1,11 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ +Index: plugins/org.eclipse.tm.tcf.terminals/about.html +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/about.html (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/about.html (revision 0) +@@ -0,0 +1,28 @@ ++ ++ ++ ++ ++About ++ ++ ++

About This Content

++ ++

January 10, 2008

++

License

++ ++

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise ++indicated below, the Content is provided to you under the terms and conditions of the ++Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available ++at http://www.eclipse.org/legal/epl-v10.html. ++For purposes of the EPL, "Program" will mean the Content.

++ ++

If you did not receive this Content directly from the Eclipse Foundation, the Content is ++being redistributed by another party ("Redistributor") and different terms and conditions may ++apply to your use of any object code in the Content. Check the Redistributor's license that was ++provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise ++indicated below, the terms and conditions of the EPL still apply to any source code in the Content ++and such source code may be obtained at http://www.eclipse.org.

++ ++ ++ +\ No newline at end of file +Index: plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs +=================================================================== +--- plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs (revision 0) ++++ plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs (revision 0) +@@ -0,0 +1,8 @@ ++#Mon Jun 07 11:42:38 CST 2010 ++eclipse.preferences.version=1 ++org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled ++org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 ++org.eclipse.jdt.core.compiler.compliance=1.6 ++org.eclipse.jdt.core.compiler.problem.assertIdentifier=error ++org.eclipse.jdt.core.compiler.problem.enumIdentifier=error ++org.eclipse.jdt.core.compiler.source=1.6 -- cgit v1.2.3-54-g00ecf