summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Dudau <adrian.dudau@enea.com>2013-12-12 13:36:50 +0100
committerAdrian Dudau <adrian.dudau@enea.com>2013-12-12 15:25:03 +0100
commit41ac47d732eed8392d60d0f6773e5a279d49b999 (patch)
treecf19d099db9cfdb8d73aa21c31e7aa1cc86ff860
downloadeclipse-poky-juno-master.tar.gz
initial commit of Enea Linux 3.1HEADmaster
Migrated from the internal git server on the dora-enea branch Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
-rw-r--r--.gitignore1
-rw-r--r--features/org.yocto.bc.headless.build/.project11
-rw-r--r--features/org.yocto.bc.headless.build/build.properties262
-rw-r--r--features/org.yocto.bc.headless.build/customTargets.xml212
-rw-r--r--features/org.yocto.bc/.project17
-rw-r--r--features/org.yocto.bc/build.properties3
-rw-r--r--features/org.yocto.bc/feature.properties163
-rw-r--r--features/org.yocto.bc/feature.xml42
-rw-r--r--features/org.yocto.bc/license.html107
-rw-r--r--features/org.yocto.doc.headless.build/.project11
-rw-r--r--features/org.yocto.doc.headless.build/build.properties262
-rw-r--r--features/org.yocto.doc.headless.build/customTargets.xml212
-rw-r--r--features/org.yocto.doc/.project17
-rw-r--r--features/org.yocto.doc/build.properties3
-rw-r--r--features/org.yocto.doc/feature.properties163
-rw-r--r--features/org.yocto.doc/feature.xml35
-rw-r--r--features/org.yocto.doc/license.html107
-rw-r--r--features/org.yocto.sdk.headless.build/.project11
-rw-r--r--features/org.yocto.sdk.headless.build/build.properties262
-rw-r--r--features/org.yocto.sdk.headless.build/customTargets.xml212
-rw-r--r--features/org.yocto.sdk.site/.project17
-rw-r--r--features/org.yocto.sdk.site/category.xml18
-rw-r--r--features/org.yocto.sdk.site/index.html60
-rw-r--r--features/org.yocto.sdk.site/site.xml18
-rw-r--r--features/org.yocto.sdk.site/web/site.css12
-rw-r--r--features/org.yocto.sdk.site/web/site.xsl214
-rw-r--r--features/org.yocto.sdk/.project17
-rw-r--r--features/org.yocto.sdk/build.properties6
-rw-r--r--features/org.yocto.sdk/feature.properties163
-rw-r--r--features/org.yocto.sdk/feature.xml109
-rw-r--r--features/org.yocto.sdk/license.html107
-rw-r--r--features/org.yocto.sdk/sourceTemplateFeature/feature.properties163
-rw-r--r--features/org.yocto.sdk/sourceTemplateFeature/license.html107
-rw-r--r--features/org.yocto.sdk/sourceTemplatePlugin/license.html107
-rw-r--r--features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties163
-rw-r--r--plugins/org.yocto.bc.ui/.classpath7
-rw-r--r--plugins/org.yocto.bc.ui/.project28
-rw-r--r--plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF19
-rw-r--r--plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties6
-rw-r--r--plugins/org.yocto.bc.ui/build.properties7
-rw-r--r--plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpgbin0 -> 10247 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/BUG_logo_128.pngbin0 -> 8804 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/OE_logo_128.pngbin0 -> 8248 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/OE_logo_64.pngbin0 -> 5250 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/OE_logo_96.pngbin0 -> 6712 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/OE_logo_full.pngbin0 -> 12480 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/beagle_128.pngbin0 -> 15639 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/binary.gifbin0 -> 366 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/cf_obj.gifbin0 -> 230 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gifbin0 -> 361 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/clean.gifbin0 -> 183 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/details_view.gifbin0 -> 368 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/function.gifbin0 -> 204 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/icon16_OE.gifbin0 -> 383 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/import_wiz.gifbin0 -> 327 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/importdir_wiz.pngbin0 -> 6184 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gifbin0 -> 587 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/oe_decorator.gifbin0 -> 267 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/poky_128.pngbin0 -> 3555 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/read_only.gifbin0 -> 851 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/refresh.gifbin0 -> 330 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/releng_gears.gifbin0 -> 159 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/sample.gifbin0 -> 983 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/sample_decorator.gifbin0 -> 854 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/topic.gifbin0 -> 354 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/trash.gifbin0 -> 590 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/variable.gifbin0 -> 126 bytes
-rw-r--r--plugins/org.yocto.bc.ui/icons/watchlist_view.gifbin0 -> 158 bytes
-rw-r--r--plugins/org.yocto.bc.ui/local.conf125
-rw-r--r--plugins/org.yocto.bc.ui/plugin.xml344
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java24
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java62
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java50
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java739
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java18
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ICommandResponseHandler.java15
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java105
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java248
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java266
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java64
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/AbstractBitbakeCommandAction.java199
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeBuildRecipeAction.java24
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeCleanRecipeAction.java26
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeImportAction.java106
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/BitbakeRebuildRecipeAction.java29
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java84
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java328
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java50
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java48
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java48
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java78
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java177
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java118
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java106
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java48
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java107
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java118
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java62
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java75
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java195
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java94
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java127
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java47
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java21
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties14
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java69
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java48
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java515
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java78
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java30
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java133
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java108
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java15
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java48
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java89
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java43
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java60
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java165
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java145
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java56
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java149
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java215
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java543
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java236
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java166
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java404
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java247
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java50
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java102
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java262
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java43
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/.classpath7
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/.project28
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties40
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/build.properties7
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/plugin.xml283
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java50
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java281
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java57
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties29
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java186
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java49
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java118
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt34
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c21
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties31
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml61
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt34
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp21
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties31
-rw-r--r--plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml61
-rw-r--r--plugins/org.yocto.doc.user/.classpath6
-rw-r--r--plugins/org.yocto.doc.user/.project28
-rw-r--r--plugins/org.yocto.doc.user/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties3
-rw-r--r--plugins/org.yocto.doc.user/about.html.in189
-rw-r--r--plugins/org.yocto.doc.user/build.properties9
-rw-r--r--plugins/org.yocto.doc.user/html/book.css1
-rw-r--r--plugins/org.yocto.doc.user/plugin.xml39
-rw-r--r--plugins/org.yocto.doc.user/toc.xml24
-rw-r--r--plugins/org.yocto.remote.utils/.classpath7
-rw-r--r--plugins/org.yocto.remote.utils/.project28
-rw-r--r--plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF27
-rw-r--r--plugins/org.yocto.remote.utils/build.properties5
-rwxr-xr-xplugins/org.yocto.remote.utils/resources/ust_tar.sh19
-rwxr-xr-xplugins/org.yocto.remote.utils/resources/yocto_tool.sh125
-rwxr-xr-xplugins/org.yocto.remote.utils/resources/yocto_ust.sh35
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java62
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java46
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java26
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java35
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java344
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java140
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java332
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java132
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/.classpath6
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/.project28
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties7
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/build.properties6
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml222
-rw-r--r--plugins/org.yocto.sdk.ide.doc.user/plugin.xml13
-rw-r--r--plugins/org.yocto.sdk.ide/.classpath7
-rw-r--r--plugins/org.yocto.sdk.ide/.project32
-rw-r--r--plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF37
-rw-r--r--plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties16
-rw-r--r--plugins/org.yocto.sdk.ide/build.properties9
-rw-r--r--plugins/org.yocto.sdk.ide/plugin.xml327
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java69
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java126
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java32
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java104
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java245
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java88
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java291
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java56
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties107
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java116
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java161
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java555
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java110
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java134
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java44
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java78
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java24
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java79
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java92
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java8
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java39
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java36
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java43
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java44
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java63
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java307
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java202
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java240
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java461
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java18
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java81
-rw-r--r--plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java270
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties14
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml17
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties14
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml16
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c9
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src9
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog0
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL9
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src8
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top7
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS0
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README25
-rwxr-xr-xplugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh10
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top37
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties28
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml143
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c50
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src9
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog0
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL9
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src8
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top7
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS0
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README25
-rwxr-xr-xplugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh10
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top49
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old37
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties28
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml142
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp11
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog0
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL9
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src8
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top6
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS0
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README25
-rwxr-xr-xplugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh10
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top47
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties28
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml142
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS1
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD24
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2339
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later340
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3674
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1502
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3165
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT19
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other1
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD29
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv219
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later21
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv319
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.120
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv320
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT24
-rw-r--r--plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other9
-rw-r--r--plugins/org.yocto.sdk.remotetools/.classpath8
-rw-r--r--plugins/org.yocto.sdk.remotetools/.project28
-rw-r--r--plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF29
-rw-r--r--plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties5
-rw-r--r--plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml65
-rw-r--r--plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties12
-rw-r--r--plugins/org.yocto.sdk.remotetools/build.properties10
-rw-r--r--plugins/org.yocto.sdk.remotetools/icons/sample.gifbin0 -> 983 bytes
-rw-r--r--plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jarbin0 -> 23737 bytes
-rw-r--r--plugins/org.yocto.sdk.remotetools/plugin.xml142
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java79
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java101
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java62
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java642
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java88
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java65
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java89
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java123
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java216
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java42
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java27
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java35
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java55
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java171
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java30
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java48
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java109
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java131
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java54
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java70
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java88
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java280
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java59
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java166
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java104
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java170
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java38
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties49
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java140
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java457
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java139
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java32
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java47
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java92
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java19
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java23
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java28
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java498
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java19
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java498
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java27
-rw-r--r--plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java99
-rwxr-xr-xscripts/build.sh173
-rwxr-xr-xscripts/find-version62
-rwxr-xr-xscripts/generate-doc.sh88
-rw-r--r--scripts/readme.txt71
-rwxr-xr-xscripts/setup.sh226
-rw-r--r--tcf/lke_rse_tcf.patch2097
-rw-r--r--tcf/readme175
-rw-r--r--tcf/terminals_agent.patch1042
-rw-r--r--tcf/terminals_plugin.patch618
344 files changed, 33456 insertions, 0 deletions
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.bc.headless.build</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 </buildSpec>
9 <natures>
10 </natures>
11</projectDescription>
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 @@
1###############################################################################
2# Copyright (c) 2003, 2009 IBM Corporation and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# IBM Corporation - initial API and implementation
10###############################################################################
11#####################
12# Parameters describing how and where to execute the build.
13# Typical users need only update the following properties:
14# baseLocation - where things you are building against are installed
15# bootclasspath - The base jars to compile against (typicaly rt.jar)
16# configs - the list of {os, ws, arch} configurations to build.
17#
18# Of course any of the settings here can be overridden by spec'ing
19# them on the command line (e.g., -DbaseLocation=d:/eclipse
20
21#The type of the top level element we are building, generally "feature"
22topLevelElementType = feature
23#The id of the top level element we are building
24topLevelElementId = org.yocto.bc
25
26############# PRODUCT/PACKAGING CONTROL #############
27product=/plugin or feature id/path/to/.product
28runPackager=true
29
30#Set the name of the archive that will result from the product build.
31#archiveNamePrefix=
32
33# The prefix that will be used in the generated archive.
34archivePrefix=eclipse
35
36# The location underwhich all of the build output will be collected.
37collectingFolder=${archivePrefix}
38
39# The list of {os, ws, arch} configurations to build. This
40# value is a '&' separated list of ',' separate triples. For example,
41# configs=win32,win32,x86 & linux,motif,x86
42# By default the value is *,*,*
43configs = *, *, *
44#configs=win32, win32, x86 & \
45# win32,win32,x86_64 & \
46# win32,win32,wpf & \
47# linux, gtk, ppc & \
48# linux, gtk, x86 & \
49# linux, gtk, x86_64 & \
50# linux, motif, x86 & \
51# solaris, motif, sparc & \
52# solaris, gtk, sparc & \
53# aix, motif, ppc & \
54# hpux, motif, ia64_32 & \
55# macosx, carbon, ppc & \
56# macosx, carbon, x86 & \
57# macosx, cocoa, ppc & \
58# macosx, cocoa, x86 & \
59# macosx, cocoa, x86_64
60
61# By default PDE creates one archive (result) per entry listed in the configs property.
62# Setting this value to true will cause PDE to only create one output containing all
63# artifacts for all the platforms listed in the configs property.
64# To control the output format for the group, add a "group, group, group - <format>" entry to the
65# archivesFormat.
66#groupConfigurations=true
67
68#The format of the archive. By default a zip is created using antZip.
69#The list can only contain the configuration for which the desired format is different than zip.
70#archivesFormat=win32, win32, x86 - antZip& \
71# linux, gtk, ppc - antZip &\
72# linux, gtk, x86 - antZip& \
73# linux, gtk, x86_64 - antZip& \
74# linux, motif, x86 - antZip& \
75# solaris, motif, sparc - antZip& \
76# solaris, gtk, sparc - antZip& \
77# aix, motif, ppc - antZip& \
78# hpux, motif, PA_RISC - antZip& \
79# macosx, carbon, ppc - antZip
80
81#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles.
82allowBinaryCycles = true
83
84#Sort bundles depenedencies across all features instead of just within a given feature.
85#flattenDependencies = true
86
87#Parallel compilation, requires flattenedDependencies=true
88#parallelCompilation=true
89#parallelThreadCount=
90#parallelThreadsPerProcessor=
91
92#Set to true if you want the output to be ready for an update jar (no site.xml generated)
93outputUpdateJars = true
94
95#Set to true for Jnlp generation
96#codebase should be a URL that will be used as the root of all relative URLs in the output.
97#generateJnlp=false
98#jnlp.codebase=<codebase url>
99#jnlp.j2se=<j2se version>
100#jnlp.locale=<a locale>
101#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features
102#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built
103
104#Set to true if you want to sign jars
105#signJars=false
106#sign.alias=<alias>
107#sign.keystore=<keystore location>
108#sign.storepass=<keystore password>
109#sign.keypass=<key password>
110
111#Arguments to send to the zip executable
112zipargs=
113
114#Arguments to send to the tar executable
115tarargs=
116
117#Control the creation of a file containing the version included in each configuration - on by default
118#generateVersionsLists=false
119
120############## BUILD NAMING CONTROL ################
121# The directory into which the build elements are fetched and where
122# the build takes place.
123#buildDirectory=
124
125# Type of build. Used in naming the build output. Typically this value is
126# one of I, N, M, S, ...
127buildType=I
128
129# ID of the build. Used in naming the build output.
130buildId=TestBuild
131
132# Label for the build. Used in naming the build output
133buildLabel=${buildType}.${buildId}
134
135# Timestamp for the build. Used in naming the build output
136timestamp=007
137
138#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
139#The value will only be applied to plugin or features indicating build.properties, qualifier = context
140#forceContextQualifier=<the value for the qualifier>
141
142#Enable / disable the generation of a suffix for the features that use .qualifier.
143#The generated suffix is computed according to the content of the feature
144#generateFeatureVersionSuffix=true
145
146############# BASE CONTROL #############
147# Settings for the base Eclipse components and Java class libraries
148# against which you are building.
149# Base location for anything the build needs to compile against. For example,
150# in most RCP app or a plug-in, the baseLocation should be the location of a previously
151# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack.
152
153#base=<path/to/parent/of/eclipse>
154#baseLocation=${base}/eclipse
155
156#Folder containing repositories whose content is needed to compile against
157#repoBaseLocation=${base}/repos
158#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against
159#transformedRepoLocation=${base}/transformedRepos
160
161#Os/Ws/Arch/nl of the eclipse specified by baseLocation
162#baseos=win32
163#basews=win32
164#basearch=x86
165
166#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
167filteredDependencyCheck=false
168
169#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons)
170resolution.devMode=false
171
172#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :)
173#a location is one of:
174#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo
175#- a directory that contains a /plugins or /features subdirectory
176#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml
177#pluginPath=
178
179skipBase=true
180eclipseURL=<url for eclipse download site>
181eclipseBuildId=<Id of Eclipse build to get>
182eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip
183
184
185############# MAP FILE CONTROL ################
186# This section defines CVS tags to use when fetching the map files from the repository.
187# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml
188
189skipMaps=true
190mapsRepo=:pserver:anonymous@example.com/path/to/repo
191mapsRoot=path/to/maps
192mapsCheckoutTag=HEAD
193
194#tagMaps=true
195mapsTagTag=v${buildId}
196
197
198############ REPOSITORY CONTROL ###############
199# This section defines properties parameterizing the repositories where plugins, fragments
200# bundles and features are being obtained from.
201
202# The tags to use when fetching elements to build.
203# By default thebuilder will use whatever is in the maps.
204# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the
205# overriding value
206# For example fetchTag=CVS=HEAD, SVN=v20050101
207# fetchTag=HEAD
208skipFetch=true
209
210
211############# JAVA COMPILER OPTIONS ##############
212# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE
213#bootclasspath=${java.home}/lib/rt.jar
214
215# specific JRE locations to compile against. These values are used to compile bundles specifying a
216# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support
217#CDC-1.0/Foundation-1.0= /path/to/rt.jar
218#CDC-1.1/Foundation-1.1=
219#OSGi/Minimum-1.0=
220#OSGi/Minimum-1.1=
221#JRE-1.1=
222#J2SE-1.2=
223#J2SE-1.3=
224#J2SE-1.4=
225#J2SE-1.5=
226#JavaSE-1.6=
227#PersonalJava-1.1=
228#PersonalJava-1.2=
229#CDC-1.0/PersonalBasis-1.0=
230#CDC-1.0/PersonalJava-1.0=
231#CDC-1.1/PersonalBasis-1.1=
232#CDC-1.1/PersonalJava-1.1=
233
234# Specify the output format of the compiler log when eclipse jdt is used
235logExtension=.log
236
237# Whether or not to include debug info in the output jars
238javacDebugInfo=false
239
240# Whether or not to fail the build if there are compiler errors
241javacFailOnError=true
242
243# Enable or disable verbose mode of the compiler
244javacVerbose=true
245
246# Extra arguments for the compiler. These are specific to the java compiler being used.
247#compilerArg=
248
249# 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
250javacSource=1.6
251
252# 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.
253javacTarget=1.6
254
255#individualSourceBundles=true
256
257#p2.gathering=true
258p2.compress=true
259#p2.category.site=file:${buildDirectory}/site.xml
260p2.category.definition=file:${buildDirectory}/category.xml
261p2.metadata.repo.name=Yocto Project Update Site
262p2.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 @@
1<project name="Build specific targets and properties" default="noDefault">
2
3 <!-- ===================================================================== -->
4 <!-- Run a given ${target} on all elements being built -->
5 <!-- Add on <ant> task for each top level element being built. -->
6 <!-- ===================================================================== -->
7 <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
8 <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
9
10 <import file="${allElementsFile}" />
11 <target name="allElements">
12 <antcall target="allElementsDelegator" />
13 </target>
14
15 <!-- ===================================================================== -->
16 <!-- ===================================================================== -->
17 <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
18 <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
19 <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
20 </target>
21
22 <target name="checkLocalBase">
23 <available file="${base}" property="skipBase" />
24 </target>
25
26 <!-- ===================================================================== -->
27 <!-- Check out map files from correct repository -->
28 <!-- Replace values for mapsCheckoutTag as desired. -->
29 <!-- ===================================================================== -->
30 <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
31 <property name="mapsCheckoutTag" value="HEAD" />
32 <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
33 </target>
34
35 <target name="checkLocalMaps">
36 <available property="skipMaps" file="${buildDirectory}/maps" />
37 </target>
38
39 <target name="tagMapFiles" if="tagMaps">
40 <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
41 </target>
42
43 <!-- ===================================================================== -->
44
45 <target name="clean" unless="noclean">
46 <antcall target="allElements">
47 <param name="target" value="cleanElement" />
48 </antcall>
49 </target>
50
51 <target name="gatherLogs">
52 <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
53 <antcall target="allElements">
54 <param name="target" value="gatherLogs" />
55 </antcall>
56 <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
57 <fileset dir="${buildDirectory}/features">
58 <include name="**/*.log.zip" />
59 </fileset>
60 </unzip>
61 </target>
62
63 <!-- ===================================================================== -->
64 <!-- Steps to do before setup -->
65 <!-- ===================================================================== -->
66 <target name="preSetup">
67 <delete dir="${buildDirectory}/plugins"/>
68 <mkdir dir="${buildDirectory}/plugins"/>
69 <copy todir="${buildDirectory}/plugins" failonerror="true">
70 <fileset dir="${otherSrcDirectory}/plugins"/>
71 </copy>
72 <delete dir="${buildDirectory}/features"/>
73 <copy todir="${buildDirectory}/features" failonerror="true" >
74 <fileset dir="${otherSrcDirectory}/features"/>
75 </copy>
76 <antcall target="prepareForP2" />
77 </target>
78
79 <target name="prepareForP2" if="p2.gathering">
80 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" />
81 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/category.xml" todir="${buildDirectory}" />
82 <xmlproperty file="${otherSrcDirectory}/features/org.yocto.bc/feature.xml" />
83 <replace file="${buildDirectory}/category.xml">
84 <replacefilter token="@bcfeatureVersion@" value="${feature(version)}"/>
85 </replace>
86 </target>
87
88 <!-- ===================================================================== -->
89 <!-- Steps to do after setup but before starting the build proper -->
90 <!-- ===================================================================== -->
91 <target name="postSetup">
92 <antcall target="getBaseComponents" />
93 </target>
94
95 <!-- ===================================================================== -->
96 <!-- Steps to do before fetching the build elements -->
97 <!-- ===================================================================== -->
98 <target name="preFetch">
99 </target>
100
101 <!-- ===================================================================== -->
102 <!-- Steps to do after fetching the build elements -->
103 <!-- ===================================================================== -->
104 <target name="postFetch">
105 </target>
106
107 <!-- ===================================================================== -->
108 <!-- Steps to do before the repositories are being processed -->
109 <!-- ===================================================================== -->
110 <target name="preProcessRepos">
111 </target>
112
113 <!-- ===================================================================== -->
114 <!-- Steps to do after the repositories have been processed -->
115 <!-- ===================================================================== -->
116 <target name="postProcessRepos">
117 </target>
118
119 <!-- ===================================================================== -->
120 <!-- Steps to do before generating the build scripts. -->
121 <!-- ===================================================================== -->
122 <target name="preGenerate">
123 </target>
124
125 <!-- ===================================================================== -->
126 <!-- Steps to do after generating the build scripts. -->
127 <!-- ===================================================================== -->
128 <target name="postGenerate">
129 <antcall target="clean" />
130 </target>
131
132 <!-- ===================================================================== -->
133 <!-- Steps to do before running the build.xmls for the elements being built. -->
134 <!-- ===================================================================== -->
135 <target name="preProcess">
136 </target>
137
138 <!-- ===================================================================== -->
139 <!-- Steps to do after running the build.xmls for the elements being built. -->
140 <!-- ===================================================================== -->
141 <target name="postProcess">
142 </target>
143
144 <!-- ===================================================================== -->
145 <!-- Steps to do before running assemble. -->
146 <!-- ===================================================================== -->
147 <target name="preAssemble">
148 </target>
149
150 <!-- ===================================================================== -->
151 <!-- Steps to do after running assemble. -->
152 <!-- ===================================================================== -->
153 <target name="postAssemble">
154 </target>
155
156 <!-- ===================================================================== -->
157 <!-- Steps to do before running package. -->
158 <!-- ===================================================================== -->
159 <target name="prePackage">
160 </target>
161
162 <!-- ===================================================================== -->
163 <!-- Steps to do after running package. -->
164 <!-- ===================================================================== -->
165 <target name="postPackage">
166 </target>
167
168 <!-- ===================================================================== -->
169 <!-- Steps to do after the build is done. -->
170 <!-- ===================================================================== -->
171 <target name="postBuild">
172 <antcall target="gatherLogs" />
173 <antcall target="updateSiteContent" />
174 </target>
175
176 <target name="updateSiteContent" if="p2.gathering">
177 <property file="${buildDirectory}/finalFeaturesVersions.properties" />
178 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" />
179 <replace file="${buildDirectory}/site.xml">
180 <replacefilter token="@bcgenVersion@" value="${org.yocto.bc}"/>
181 </replace>
182 <zip destfile="${buildDirectory}/${buildLabel}/org.yocto.bc-${buildId}-group.group.group.zip" update="true">
183 <zipfileset dir="${buildDirectory}">
184 <include name="site.xml"/>
185 </zipfileset>
186 <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site">
187 <include name="index.html"/>
188 </zipfileset>
189 <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site/web" prefix="web"/>
190 </zip>
191 </target>
192
193 <!-- ===================================================================== -->
194 <!-- Steps to do to test the build results -->
195 <!-- ===================================================================== -->
196 <target name="test">
197 </target>
198
199 <!-- ===================================================================== -->
200 <!-- Steps to do to publish the build results -->
201 <!-- ===================================================================== -->
202 <target name="publish">
203 </target>
204
205 <!-- ===================================================================== -->
206 <!-- Default target -->
207 <!-- ===================================================================== -->
208 <target name="noDefault">
209 <echo message="You must specify a target when invoking this file" />
210 </target>
211
212</project>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.bc</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.pde.FeatureBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 </buildSpec>
14 <natures>
15 <nature>org.eclipse.pde.FeatureNature</nature>
16 </natures>
17</projectDescription>
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 @@
1bin.includes = feature.xml,\
2 license.html,\
3 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 @@
1###############################################################################
2# Copyright (c) 2010 Intel, Inc. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Intel - initial implementation
10###############################################################################
11
12# "featureName" property - name of the feature
13featureName=Yocto Project Bitbake Commander Plug-in
14
15# "providerName" property - name of the company that provides the feature
16providerName=yoctoproject.org
17
18# "updateSiteName" property - label for the update site
19updateSiteName=Yocto Project Update Site
20
21# "description" property - description of the feature
22description=\
23Eclipse plug-in for developing bitbake commander project using Yocto Project
24
25# copyright
26copyright=\
27Copyright (c) 2012 Intel, Inc. and others. \
28All rights reserved. This program and the accompanying materials \
29are made available under the terms of the Eclipse Public License v1.0 \
30which accompanies this distribution, and is available at \
31http://www.eclipse.org/legal/epl-v10.html
32################ end of copyright property ####################################
33
34# "licenseURL" property - URL of the "Feature License"
35# do not translate value - just change to point to a locale-specific HTML page
36licenseURL=license.html
37
38# "license" property - text of the "Feature Update License"
39# should be plain text version of license agreement pointed to be "licenseURL"
40license=\
41Eclipse Foundation Software User Agreement\n\
42April 14, 2010\n\
43\n\
44Usage Of Content\n\
45\n\
46THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
47OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
48USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
49AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
50NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
51AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
52AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
53OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
54TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
55OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
56BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
57\n\
58Applicable Licenses\n\
59\n\
60Unless otherwise indicated, all Content made available by the\n\
61Eclipse Foundation is provided to you under the terms and conditions of\n\
62the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
63provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
64For purposes of the EPL, "Program" will mean the Content.\n\
65\n\
66Content includes, but is not limited to, source code, object code,\n\
67documentation and other files maintained in the Eclipse Foundation source code\n\
68repository ("Repository") in software modules ("Modules") and made available\n\
69as downloadable archives ("Downloads").\n\
70\n\
71 - Content may be structured and packaged into modules to facilitate delivering,\n\
72 extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
73 plug-in fragments ("Fragments"), and features ("Features").\n\
74 - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
75 in a directory named "plugins".\n\
76 - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
77 Each Feature may be packaged as a sub-directory in a directory named "features".\n\
78 Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
79 numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
80 - Features may also include other Features ("Included Features"). Within a Feature, files\n\
81 named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
82\n\
83The terms and conditions governing Plug-ins and Fragments should be\n\
84contained in files named "about.html" ("Abouts"). The terms and\n\
85conditions governing Features and Included Features should be contained\n\
86in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
87Licenses may be located in any directory of a Download or Module\n\
88including, but not limited to the following locations:\n\
89\n\
90 - The top-level (root) directory\n\
91 - Plug-in and Fragment directories\n\
92 - Inside Plug-ins and Fragments packaged as JARs\n\
93 - Sub-directories of the directory named "src" of certain Plug-ins\n\
94 - Feature directories\n\
95\n\
96Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
97Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
98Update License") during the installation process. If the Feature contains\n\
99Included Features, the Feature Update License should either provide you\n\
100with the terms and conditions governing the Included Features or inform\n\
101you where you can locate them. Feature Update Licenses may be found in\n\
102the "license" property of files named "feature.properties" found within a Feature.\n\
103Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
104terms and conditions (or references to such terms and conditions) that\n\
105govern your use of the associated Content in that directory.\n\
106\n\
107THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
108TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
109SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
110\n\
111 - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
112 - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
113 - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
114 - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
115 - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
116\n\
117IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
118TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
119is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
120govern that particular Content.\n\
121\n\
122\n\Use of Provisioning Technology\n\
123\n\
124The Eclipse Foundation makes available provisioning software, examples of which include,\n\
125but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
126the purpose of allowing users to install software, documentation, information and/or\n\
127other materials (collectively "Installable Software"). This capability is provided with\n\
128the intent of allowing such users to install, extend and update Eclipse-based products.\n\
129Information about packaging Installable Software is available at\n\
130http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
131\n\
132You may use Provisioning Technology to allow other parties to install Installable Software.\n\
133You shall be responsible for enabling the applicable license agreements relating to the\n\
134Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
135in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
136making it available in accordance with the Specification, you further acknowledge your\n\
137agreement to, and the acquisition of all necessary rights to permit the following:\n\
138\n\
139 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
140 the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
141 extending or updating the functionality of an Eclipse-based product.\n\
142 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
143 Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
144 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
145 govern the use of the Installable Software ("Installable Software Agreement") and such\n\
146 Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
147 with the Specification. Such Installable Software Agreement must inform the user of the\n\
148 terms and conditions that govern the Installable Software and must solicit acceptance by\n\
149 the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
150 indication of agreement by the user, the provisioning Technology will complete installation\n\
151 of the Installable Software.\n\
152\n\
153Cryptography\n\
154\n\
155Content may contain encryption software. The country in which you are\n\
156currently may have restrictions on the import, possession, and use,\n\
157and/or re-export to another country, of encryption software. BEFORE\n\
158using any encryption software, please check the country's laws,\n\
159regulations and policies concerning the import, possession, or use, and\n\
160re-export of encryption software, to see if this is permitted.\n\
161\n\
162Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
163########### 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<feature
3 id="org.yocto.bc"
4 label="%featureName"
5 version="1.4.0.qualifier"
6 provider-name="%providerName">
7
8 <description>
9 %description
10 </description>
11
12 <copyright>
13 %copyright
14 </copyright>
15
16 <license url="%licenseURL">
17 %license
18 </license>
19
20 <url>
21 <update label="%updateSiteName" url="http://yoctoproject.org/downloads/eclipse-plugin/"/>
22 </url>
23
24 <requires>
25 <import plugin="org.eclipse.ui"/>
26 <import plugin="org.eclipse.core.runtime"/>
27 <import plugin="org.eclipse.core.resources"/>
28 <import plugin="org.eclipse.jface.text"/>
29 <import plugin="org.eclipse.ui.editors"/>
30 <import plugin="org.eclipse.ui.ide"/>
31 <import plugin="org.eclipse.ui.console"/>
32 <import plugin="org.eclipse.core.filesystem"/>
33 </requires>
34
35 <plugin
36 id="org.yocto.bc.ui"
37 download-size="0"
38 install-size="0"
39 version="0.0.0"
40 unpack="false"/>
41
42</feature>
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 @@
1<?xml version="1.0" encoding="ISO-8859-1" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6<title>Eclipse Foundation Software User Agreement</title>
7</head>
8
9<body lang="EN-US">
10<h2>Eclipse Foundation Software User Agreement</h2>
11<p>April 14, 2010</p>
12
13<h3>Usage Of Content</h3>
14
15<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
16 (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
17 CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
18 OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
19 NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
20 CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
21
22<h3>Applicable Licenses</h3>
23
24<p>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
25 (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
26 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
27
28<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
29 repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
30
31<ul>
32 <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
33 <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
34 <li>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 &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
35 and/or Fragments associated with that Feature.</li>
36 <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
37</ul>
38
39<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
40Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
41including, but not limited to the following locations:</p>
42
43<ul>
44 <li>The top-level (root) directory</li>
45 <li>Plug-in and Fragment directories</li>
46 <li>Inside Plug-ins and Fragments packaged as JARs</li>
47 <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
48 <li>Feature directories</li>
49</ul>
50
51<p>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 (&quot;Feature Update License&quot;) during the
52installation 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
53inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
54Such 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
55that directory.</p>
56
57<p>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
58OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
59
60<ul>
61 <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
62 <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
63 <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
64 <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
65 <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
66</ul>
67
68<p>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
69contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
70
71
72<h3>Use of Provisioning Technology</h3>
73
74<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
75 Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
76 other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
77 install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
78 href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
79 (&quot;Specification&quot;).</p>
80
81<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
82 applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
83 in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
84 Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
85
86<ol>
87 <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
88 on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
89 product.</li>
90 <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
91 accessed and copied to the Target Machine.</li>
92 <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
93 Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
94 Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
95 the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
96 indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
97</ol>
98
99<h3>Cryptography</h3>
100
101<p>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
102 another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
103 possession, or use, and re-export of encryption software, to see if this is permitted.</p>
104
105<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
106</body>
107</html>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.doc.headless.build</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 </buildSpec>
9 <natures>
10 </natures>
11</projectDescription>
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 @@
1###############################################################################
2# Copyright (c) 2003, 2009 IBM Corporation and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# IBM Corporation - initial API and implementation
10###############################################################################
11#####################
12# Parameters describing how and where to execute the build.
13# Typical users need only update the following properties:
14# baseLocation - where things you are building against are installed
15# bootclasspath - The base jars to compile against (typicaly rt.jar)
16# configs - the list of {os, ws, arch} configurations to build.
17#
18# Of course any of the settings here can be overridden by spec'ing
19# them on the command line (e.g., -DbaseLocation=d:/eclipse
20
21#The type of the top level element we are building, generally "feature"
22topLevelElementType = feature
23#The id of the top level element we are building
24topLevelElementId = org.yocto.doc
25
26############# PRODUCT/PACKAGING CONTROL #############
27product=/plugin or feature id/path/to/.product
28runPackager=true
29
30#Set the name of the archive that will result from the product build.
31#archiveNamePrefix=
32
33# The prefix that will be used in the generated archive.
34archivePrefix=eclipse
35
36# The location underwhich all of the build output will be collected.
37collectingFolder=${archivePrefix}
38
39# The list of {os, ws, arch} configurations to build. This
40# value is a '&' separated list of ',' separate triples. For example,
41# configs=win32,win32,x86 & linux,motif,x86
42# By default the value is *,*,*
43configs = *, *, *
44#configs=win32, win32, x86 & \
45# win32,win32,x86_64 & \
46# win32,win32,wpf & \
47# linux, gtk, ppc & \
48# linux, gtk, x86 & \
49# linux, gtk, x86_64 & \
50# linux, motif, x86 & \
51# solaris, motif, sparc & \
52# solaris, gtk, sparc & \
53# aix, motif, ppc & \
54# hpux, motif, ia64_32 & \
55# macosx, carbon, ppc & \
56# macosx, carbon, x86 & \
57# macosx, cocoa, ppc & \
58# macosx, cocoa, x86 & \
59# macosx, cocoa, x86_64
60
61# By default PDE creates one archive (result) per entry listed in the configs property.
62# Setting this value to true will cause PDE to only create one output containing all
63# artifacts for all the platforms listed in the configs property.
64# To control the output format for the group, add a "group, group, group - <format>" entry to the
65# archivesFormat.
66#groupConfigurations=true
67
68#The format of the archive. By default a zip is created using antZip.
69#The list can only contain the configuration for which the desired format is different than zip.
70#archivesFormat=win32, win32, x86 - antZip& \
71# linux, gtk, ppc - antZip &\
72# linux, gtk, x86 - antZip& \
73# linux, gtk, x86_64 - antZip& \
74# linux, motif, x86 - antZip& \
75# solaris, motif, sparc - antZip& \
76# solaris, gtk, sparc - antZip& \
77# aix, motif, ppc - antZip& \
78# hpux, motif, PA_RISC - antZip& \
79# macosx, carbon, ppc - antZip
80
81#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles.
82allowBinaryCycles = true
83
84#Sort bundles depenedencies across all features instead of just within a given feature.
85#flattenDependencies = true
86
87#Parallel compilation, requires flattenedDependencies=true
88#parallelCompilation=true
89#parallelThreadCount=
90#parallelThreadsPerProcessor=
91
92#Set to true if you want the output to be ready for an update jar (no site.xml generated)
93outputUpdateJars = true
94
95#Set to true for Jnlp generation
96#codebase should be a URL that will be used as the root of all relative URLs in the output.
97#generateJnlp=false
98#jnlp.codebase=<codebase url>
99#jnlp.j2se=<j2se version>
100#jnlp.locale=<a locale>
101#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features
102#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built
103
104#Set to true if you want to sign jars
105#signJars=false
106#sign.alias=<alias>
107#sign.keystore=<keystore location>
108#sign.storepass=<keystore password>
109#sign.keypass=<key password>
110
111#Arguments to send to the zip executable
112zipargs=
113
114#Arguments to send to the tar executable
115tarargs=
116
117#Control the creation of a file containing the version included in each configuration - on by default
118#generateVersionsLists=false
119
120############## BUILD NAMING CONTROL ################
121# The directory into which the build elements are fetched and where
122# the build takes place.
123#buildDirectory=
124
125# Type of build. Used in naming the build output. Typically this value is
126# one of I, N, M, S, ...
127buildType=I
128
129# ID of the build. Used in naming the build output.
130buildId=TestBuild
131
132# Label for the build. Used in naming the build output
133buildLabel=${buildType}.${buildId}
134
135# Timestamp for the build. Used in naming the build output
136timestamp=007
137
138#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
139#The value will only be applied to plugin or features indicating build.properties, qualifier = context
140#forceContextQualifier=<the value for the qualifier>
141
142#Enable / disable the generation of a suffix for the features that use .qualifier.
143#The generated suffix is computed according to the content of the feature
144#generateFeatureVersionSuffix=true
145
146############# BASE CONTROL #############
147# Settings for the base Eclipse components and Java class libraries
148# against which you are building.
149# Base location for anything the build needs to compile against. For example,
150# in most RCP app or a plug-in, the baseLocation should be the location of a previously
151# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack.
152
153#base=<path/to/parent/of/eclipse>
154#baseLocation=${base}/eclipse
155
156#Folder containing repositories whose content is needed to compile against
157#repoBaseLocation=${base}/repos
158#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against
159#transformedRepoLocation=${base}/transformedRepos
160
161#Os/Ws/Arch/nl of the eclipse specified by baseLocation
162#baseos=win32
163#basews=win32
164#basearch=x86
165
166#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
167filteredDependencyCheck=false
168
169#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons)
170resolution.devMode=false
171
172#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :)
173#a location is one of:
174#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo
175#- a directory that contains a /plugins or /features subdirectory
176#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml
177#pluginPath=
178
179skipBase=true
180eclipseURL=<url for eclipse download site>
181eclipseBuildId=<Id of Eclipse build to get>
182eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip
183
184
185############# MAP FILE CONTROL ################
186# This section defines CVS tags to use when fetching the map files from the repository.
187# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml
188
189skipMaps=true
190mapsRepo=:pserver:anonymous@example.com/path/to/repo
191mapsRoot=path/to/maps
192mapsCheckoutTag=HEAD
193
194#tagMaps=true
195mapsTagTag=v${buildId}
196
197
198############ REPOSITORY CONTROL ###############
199# This section defines properties parameterizing the repositories where plugins, fragments
200# bundles and features are being obtained from.
201
202# The tags to use when fetching elements to build.
203# By default thebuilder will use whatever is in the maps.
204# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the
205# overriding value
206# For example fetchTag=CVS=HEAD, SVN=v20050101
207# fetchTag=HEAD
208skipFetch=true
209
210
211############# JAVA COMPILER OPTIONS ##############
212# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE
213#bootclasspath=${java.home}/lib/rt.jar
214
215# specific JRE locations to compile against. These values are used to compile bundles specifying a
216# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support
217#CDC-1.0/Foundation-1.0= /path/to/rt.jar
218#CDC-1.1/Foundation-1.1=
219#OSGi/Minimum-1.0=
220#OSGi/Minimum-1.1=
221#JRE-1.1=
222#J2SE-1.2=
223#J2SE-1.3=
224#J2SE-1.4=
225#J2SE-1.5=
226#JavaSE-1.6=
227#PersonalJava-1.1=
228#PersonalJava-1.2=
229#CDC-1.0/PersonalBasis-1.0=
230#CDC-1.0/PersonalJava-1.0=
231#CDC-1.1/PersonalBasis-1.1=
232#CDC-1.1/PersonalJava-1.1=
233
234# Specify the output format of the compiler log when eclipse jdt is used
235logExtension=.log
236
237# Whether or not to include debug info in the output jars
238javacDebugInfo=false
239
240# Whether or not to fail the build if there are compiler errors
241javacFailOnError=true
242
243# Enable or disable verbose mode of the compiler
244javacVerbose=true
245
246# Extra arguments for the compiler. These are specific to the java compiler being used.
247#compilerArg=
248
249# 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
250javacSource=1.6
251
252# 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.
253javacTarget=1.6
254
255#individualSourceBundles=true
256
257#p2.gathering=true
258p2.compress=true
259#p2.category.site=file:${buildDirectory}/site.xml
260p2.category.definition=file:${buildDirectory}/category.xml
261p2.metadata.repo.name=Yocto Project Update Site
262p2.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 @@
1<project name="Build specific targets and properties" default="noDefault">
2
3 <!-- ===================================================================== -->
4 <!-- Run a given ${target} on all elements being built -->
5 <!-- Add on <ant> task for each top level element being built. -->
6 <!-- ===================================================================== -->
7 <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
8 <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
9
10 <import file="${allElementsFile}" />
11 <target name="allElements">
12 <antcall target="allElementsDelegator" />
13 </target>
14
15 <!-- ===================================================================== -->
16 <!-- ===================================================================== -->
17 <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
18 <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
19 <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
20 </target>
21
22 <target name="checkLocalBase">
23 <available file="${base}" property="skipBase" />
24 </target>
25
26 <!-- ===================================================================== -->
27 <!-- Check out map files from correct repository -->
28 <!-- Replace values for mapsCheckoutTag as desired. -->
29 <!-- ===================================================================== -->
30 <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
31 <property name="mapsCheckoutTag" value="HEAD" />
32 <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
33 </target>
34
35 <target name="checkLocalMaps">
36 <available property="skipMaps" file="${buildDirectory}/maps" />
37 </target>
38
39 <target name="tagMapFiles" if="tagMaps">
40 <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
41 </target>
42
43 <!-- ===================================================================== -->
44
45 <target name="clean" unless="noclean">
46 <antcall target="allElements">
47 <param name="target" value="cleanElement" />
48 </antcall>
49 </target>
50
51 <target name="gatherLogs">
52 <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
53 <antcall target="allElements">
54 <param name="target" value="gatherLogs" />
55 </antcall>
56 <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
57 <fileset dir="${buildDirectory}/features">
58 <include name="**/*.log.zip" />
59 </fileset>
60 </unzip>
61 </target>
62
63 <!-- ===================================================================== -->
64 <!-- Steps to do before setup -->
65 <!-- ===================================================================== -->
66 <target name="preSetup">
67 <delete dir="${buildDirectory}/plugins"/>
68 <mkdir dir="${buildDirectory}/plugins"/>
69 <copy todir="${buildDirectory}/plugins" failonerror="true">
70 <fileset dir="${otherSrcDirectory}/plugins"/>
71 </copy>
72 <delete dir="${buildDirectory}/features"/>
73 <copy todir="${buildDirectory}/features" failonerror="true" >
74 <fileset dir="${otherSrcDirectory}/features"/>
75 </copy>
76 <antcall target="prepareForP2" />
77 </target>
78
79 <target name="prepareForP2" if="p2.gathering">
80 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" />
81 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/category.xml" todir="${buildDirectory}" />
82 <xmlproperty file="${otherSrcDirectory}/features/org.yocto.doc/feature.xml" />
83 <replace file="${buildDirectory}/category.xml">
84 <replacefilter token="@docFeatureVersion@" value="${feature(version)}"/>
85 </replace>
86 </target>
87
88 <!-- ===================================================================== -->
89 <!-- Steps to do after setup but before starting the build proper -->
90 <!-- ===================================================================== -->
91 <target name="postSetup">
92 <antcall target="getBaseComponents" />
93 </target>
94
95 <!-- ===================================================================== -->
96 <!-- Steps to do before fetching the build elements -->
97 <!-- ===================================================================== -->
98 <target name="preFetch">
99 </target>
100
101 <!-- ===================================================================== -->
102 <!-- Steps to do after fetching the build elements -->
103 <!-- ===================================================================== -->
104 <target name="postFetch">
105 </target>
106
107 <!-- ===================================================================== -->
108 <!-- Steps to do before the repositories are being processed -->
109 <!-- ===================================================================== -->
110 <target name="preProcessRepos">
111 </target>
112
113 <!-- ===================================================================== -->
114 <!-- Steps to do after the repositories have been processed -->
115 <!-- ===================================================================== -->
116 <target name="postProcessRepos">
117 </target>
118
119 <!-- ===================================================================== -->
120 <!-- Steps to do before generating the build scripts. -->
121 <!-- ===================================================================== -->
122 <target name="preGenerate">
123 </target>
124
125 <!-- ===================================================================== -->
126 <!-- Steps to do after generating the build scripts. -->
127 <!-- ===================================================================== -->
128 <target name="postGenerate">
129 <antcall target="clean" />
130 </target>
131
132 <!-- ===================================================================== -->
133 <!-- Steps to do before running the build.xmls for the elements being built. -->
134 <!-- ===================================================================== -->
135 <target name="preProcess">
136 </target>
137
138 <!-- ===================================================================== -->
139 <!-- Steps to do after running the build.xmls for the elements being built. -->
140 <!-- ===================================================================== -->
141 <target name="postProcess">
142 </target>
143
144 <!-- ===================================================================== -->
145 <!-- Steps to do before running assemble. -->
146 <!-- ===================================================================== -->
147 <target name="preAssemble">
148 </target>
149
150 <!-- ===================================================================== -->
151 <!-- Steps to do after running assemble. -->
152 <!-- ===================================================================== -->
153 <target name="postAssemble">
154 </target>
155
156 <!-- ===================================================================== -->
157 <!-- Steps to do before running package. -->
158 <!-- ===================================================================== -->
159 <target name="prePackage">
160 </target>
161
162 <!-- ===================================================================== -->
163 <!-- Steps to do after running package. -->
164 <!-- ===================================================================== -->
165 <target name="postPackage">
166 </target>
167
168 <!-- ===================================================================== -->
169 <!-- Steps to do after the build is done. -->
170 <!-- ===================================================================== -->
171 <target name="postBuild">
172 <antcall target="gatherLogs" />
173 <antcall target="updateSiteContent" />
174 </target>
175
176 <target name="updateSiteContent" if="p2.gathering">
177 <property file="${buildDirectory}/finalFeaturesVersions.properties" />
178 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" />
179 <replace file="${buildDirectory}/site.xml">
180 <replacefilter token="@docGenVersion@" value="${org.yocto.doc}"/>
181 </replace>
182 <zip destfile="${buildDirectory}/${buildLabel}/org.yocto.doc-${buildId}-group.group.group.zip" update="true">
183 <zipfileset dir="${buildDirectory}">
184 <include name="site.xml"/>
185 </zipfileset>
186 <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site">
187 <include name="index.html"/>
188 </zipfileset>
189 <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site/web" prefix="web"/>
190 </zip>
191 </target>
192
193 <!-- ===================================================================== -->
194 <!-- Steps to do to test the build results -->
195 <!-- ===================================================================== -->
196 <target name="test">
197 </target>
198
199 <!-- ===================================================================== -->
200 <!-- Steps to do to publish the build results -->
201 <!-- ===================================================================== -->
202 <target name="publish">
203 </target>
204
205 <!-- ===================================================================== -->
206 <!-- Default target -->
207 <!-- ===================================================================== -->
208 <target name="noDefault">
209 <echo message="You must specify a target when invoking this file" />
210 </target>
211
212</project>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.doc</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.pde.FeatureBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 </buildSpec>
14 <natures>
15 <nature>org.eclipse.pde.FeatureNature</nature>
16 </natures>
17</projectDescription>
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 @@
1bin.includes = feature.xml,\
2 license.html,\
3 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 @@
1###############################################################################
2# Copyright (c) 2010 Intel, Inc. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Intel - initial implementation
10###############################################################################
11
12# "featureName" property - name of the feature
13featureName=Yocto Project Documentation Plug-in
14
15# "providerName" property - name of the company that provides the feature
16providerName=yoctoproject.org
17
18# "updateSiteName" property - label for the update site
19updateSiteName=Yocto Project Update Site
20
21# "description" property - description of the feature
22description=\
23Eclipse plug-in containing the documentation of the Yocto Project
24
25# copyright
26copyright=\
27Copyright (c) 2013 Intel, Inc. and others. \
28All rights reserved. This program and the accompanying materials \
29are made available under the terms of the Eclipse Public License v1.0 \
30which accompanies this distribution, and is available at \
31http://www.eclipse.org/legal/epl-v10.html
32################ end of copyright property ####################################
33
34# "licenseURL" property - URL of the "Feature License"
35# do not translate value - just change to point to a locale-specific HTML page
36licenseURL=license.html
37
38# "license" property - text of the "Feature Update License"
39# should be plain text version of license agreement pointed to be "licenseURL"
40license=\
41Eclipse Foundation Software User Agreement\n\
42April 14, 2010\n\
43\n\
44Usage Of Content\n\
45\n\
46THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
47OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
48USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
49AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
50NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
51AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
52AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
53OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
54TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
55OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
56BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
57\n\
58Applicable Licenses\n\
59\n\
60Unless otherwise indicated, all Content made available by the\n\
61Eclipse Foundation is provided to you under the terms and conditions of\n\
62the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
63provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
64For purposes of the EPL, "Program" will mean the Content.\n\
65\n\
66Content includes, but is not limited to, source code, object code,\n\
67documentation and other files maintained in the Eclipse Foundation source code\n\
68repository ("Repository") in software modules ("Modules") and made available\n\
69as downloadable archives ("Downloads").\n\
70\n\
71 - Content may be structured and packaged into modules to facilitate delivering,\n\
72 extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
73 plug-in fragments ("Fragments"), and features ("Features").\n\
74 - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
75 in a directory named "plugins".\n\
76 - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
77 Each Feature may be packaged as a sub-directory in a directory named "features".\n\
78 Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
79 numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
80 - Features may also include other Features ("Included Features"). Within a Feature, files\n\
81 named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
82\n\
83The terms and conditions governing Plug-ins and Fragments should be\n\
84contained in files named "about.html" ("Abouts"). The terms and\n\
85conditions governing Features and Included Features should be contained\n\
86in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
87Licenses may be located in any directory of a Download or Module\n\
88including, but not limited to the following locations:\n\
89\n\
90 - The top-level (root) directory\n\
91 - Plug-in and Fragment directories\n\
92 - Inside Plug-ins and Fragments packaged as JARs\n\
93 - Sub-directories of the directory named "src" of certain Plug-ins\n\
94 - Feature directories\n\
95\n\
96Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
97Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
98Update License") during the installation process. If the Feature contains\n\
99Included Features, the Feature Update License should either provide you\n\
100with the terms and conditions governing the Included Features or inform\n\
101you where you can locate them. Feature Update Licenses may be found in\n\
102the "license" property of files named "feature.properties" found within a Feature.\n\
103Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
104terms and conditions (or references to such terms and conditions) that\n\
105govern your use of the associated Content in that directory.\n\
106\n\
107THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
108TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
109SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
110\n\
111 - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
112 - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
113 - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
114 - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
115 - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
116\n\
117IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
118TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
119is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
120govern that particular Content.\n\
121\n\
122\n\Use of Provisioning Technology\n\
123\n\
124The Eclipse Foundation makes available provisioning software, examples of which include,\n\
125but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
126the purpose of allowing users to install software, documentation, information and/or\n\
127other materials (collectively "Installable Software"). This capability is provided with\n\
128the intent of allowing such users to install, extend and update Eclipse-based products.\n\
129Information about packaging Installable Software is available at\n\
130http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
131\n\
132You may use Provisioning Technology to allow other parties to install Installable Software.\n\
133You shall be responsible for enabling the applicable license agreements relating to the\n\
134Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
135in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
136making it available in accordance with the Specification, you further acknowledge your\n\
137agreement to, and the acquisition of all necessary rights to permit the following:\n\
138\n\
139 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
140 the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
141 extending or updating the functionality of an Eclipse-based product.\n\
142 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
143 Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
144 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
145 govern the use of the Installable Software ("Installable Software Agreement") and such\n\
146 Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
147 with the Specification. Such Installable Software Agreement must inform the user of the\n\
148 terms and conditions that govern the Installable Software and must solicit acceptance by\n\
149 the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
150 indication of agreement by the user, the provisioning Technology will complete installation\n\
151 of the Installable Software.\n\
152\n\
153Cryptography\n\
154\n\
155Content may contain encryption software. The country in which you are\n\
156currently may have restrictions on the import, possession, and use,\n\
157and/or re-export to another country, of encryption software. BEFORE\n\
158using any encryption software, please check the country's laws,\n\
159regulations and policies concerning the import, possession, or use, and\n\
160re-export of encryption software, to see if this is permitted.\n\
161\n\
162Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
163########### 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<feature
3 id="org.yocto.doc"
4 label="%featureName"
5 version="1.4.0.qualifier"
6 provider-name="%providerName">
7
8 <description>
9 %description
10 </description>
11
12 <copyright>
13 %copyright
14 </copyright>
15
16 <license url="%licenseURL">
17 %license
18 </license>
19
20 <url>
21 <update label="%updateSiteName" url="http://yoctoproject.org/downloads/eclipse-plugin/"/>
22 </url>
23
24 <requires>
25 <import plugin="org.eclipse.help"/>
26 </requires>
27
28 <plugin
29 id="org.yocto.doc.user"
30 download-size="0"
31 install-size="0"
32 version="0.0.0"
33 unpack="false"/>
34
35</feature>
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 @@
1<?xml version="1.0" encoding="ISO-8859-1" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6<title>Eclipse Foundation Software User Agreement</title>
7</head>
8
9<body lang="EN-US">
10<h2>Eclipse Foundation Software User Agreement</h2>
11<p>April 14, 2010</p>
12
13<h3>Usage Of Content</h3>
14
15<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
16 (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
17 CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
18 OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
19 NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
20 CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
21
22<h3>Applicable Licenses</h3>
23
24<p>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
25 (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
26 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
27
28<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
29 repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
30
31<ul>
32 <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
33 <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
34 <li>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 &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
35 and/or Fragments associated with that Feature.</li>
36 <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
37</ul>
38
39<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
40Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
41including, but not limited to the following locations:</p>
42
43<ul>
44 <li>The top-level (root) directory</li>
45 <li>Plug-in and Fragment directories</li>
46 <li>Inside Plug-ins and Fragments packaged as JARs</li>
47 <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
48 <li>Feature directories</li>
49</ul>
50
51<p>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 (&quot;Feature Update License&quot;) during the
52installation 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
53inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
54Such 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
55that directory.</p>
56
57<p>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
58OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
59
60<ul>
61 <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
62 <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
63 <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
64 <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
65 <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
66</ul>
67
68<p>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
69contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
70
71
72<h3>Use of Provisioning Technology</h3>
73
74<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
75 Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
76 other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
77 install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
78 href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
79 (&quot;Specification&quot;).</p>
80
81<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
82 applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
83 in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
84 Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
85
86<ol>
87 <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
88 on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
89 product.</li>
90 <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
91 accessed and copied to the Target Machine.</li>
92 <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
93 Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
94 Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
95 the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
96 indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
97</ol>
98
99<h3>Cryptography</h3>
100
101<p>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
102 another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
103 possession, or use, and re-export of encryption software, to see if this is permitted.</p>
104
105<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
106</body>
107</html>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.sdk.headless.build</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 </buildSpec>
9 <natures>
10 </natures>
11</projectDescription>
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 @@
1###############################################################################
2# Copyright (c) 2003, 2009 IBM Corporation and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# IBM Corporation - initial API and implementation
10###############################################################################
11#####################
12# Parameters describing how and where to execute the build.
13# Typical users need only update the following properties:
14# baseLocation - where things you are building against are installed
15# bootclasspath - The base jars to compile against (typicaly rt.jar)
16# configs - the list of {os, ws, arch} configurations to build.
17#
18# Of course any of the settings here can be overridden by spec'ing
19# them on the command line (e.g., -DbaseLocation=d:/eclipse
20
21#The type of the top level element we are building, generally "feature"
22topLevelElementType = feature
23#The id of the top level element we are building
24topLevelElementId = org.yocto.sdk
25
26############# PRODUCT/PACKAGING CONTROL #############
27product=/plugin or feature id/path/to/.product
28runPackager=true
29
30#Set the name of the archive that will result from the product build.
31#archiveNamePrefix=
32
33# The prefix that will be used in the generated archive.
34archivePrefix=eclipse
35
36# The location underwhich all of the build output will be collected.
37collectingFolder=${archivePrefix}
38
39# The list of {os, ws, arch} configurations to build. This
40# value is a '&' separated list of ',' separate triples. For example,
41# configs=win32,win32,x86 & linux,motif,x86
42# By default the value is *,*,*
43configs = *, *, *
44#configs=win32, win32, x86 & \
45# win32,win32,x86_64 & \
46# win32,win32,wpf & \
47# linux, gtk, ppc & \
48# linux, gtk, x86 & \
49# linux, gtk, x86_64 & \
50# linux, motif, x86 & \
51# solaris, motif, sparc & \
52# solaris, gtk, sparc & \
53# aix, motif, ppc & \
54# hpux, motif, ia64_32 & \
55# macosx, carbon, ppc & \
56# macosx, carbon, x86 & \
57# macosx, cocoa, ppc & \
58# macosx, cocoa, x86 & \
59# macosx, cocoa, x86_64
60
61# By default PDE creates one archive (result) per entry listed in the configs property.
62# Setting this value to true will cause PDE to only create one output containing all
63# artifacts for all the platforms listed in the configs property.
64# To control the output format for the group, add a "group, group, group - <format>" entry to the
65# archivesFormat.
66#groupConfigurations=true
67
68#The format of the archive. By default a zip is created using antZip.
69#The list can only contain the configuration for which the desired format is different than zip.
70#archivesFormat=win32, win32, x86 - antZip& \
71# linux, gtk, ppc - antZip &\
72# linux, gtk, x86 - antZip& \
73# linux, gtk, x86_64 - antZip& \
74# linux, motif, x86 - antZip& \
75# solaris, motif, sparc - antZip& \
76# solaris, gtk, sparc - antZip& \
77# aix, motif, ppc - antZip& \
78# hpux, motif, PA_RISC - antZip& \
79# macosx, carbon, ppc - antZip
80
81#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles.
82allowBinaryCycles = true
83
84#Sort bundles depenedencies across all features instead of just within a given feature.
85#flattenDependencies = true
86
87#Parallel compilation, requires flattenedDependencies=true
88#parallelCompilation=true
89#parallelThreadCount=
90#parallelThreadsPerProcessor=
91
92#Set to true if you want the output to be ready for an update jar (no site.xml generated)
93outputUpdateJars = true
94
95#Set to true for Jnlp generation
96#codebase should be a URL that will be used as the root of all relative URLs in the output.
97#generateJnlp=false
98#jnlp.codebase=<codebase url>
99#jnlp.j2se=<j2se version>
100#jnlp.locale=<a locale>
101#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features
102#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built
103
104#Set to true if you want to sign jars
105#signJars=false
106#sign.alias=<alias>
107#sign.keystore=<keystore location>
108#sign.storepass=<keystore password>
109#sign.keypass=<key password>
110
111#Arguments to send to the zip executable
112zipargs=
113
114#Arguments to send to the tar executable
115tarargs=
116
117#Control the creation of a file containing the version included in each configuration - on by default
118#generateVersionsLists=false
119
120############## BUILD NAMING CONTROL ################
121# The directory into which the build elements are fetched and where
122# the build takes place.
123#buildDirectory=
124
125# Type of build. Used in naming the build output. Typically this value is
126# one of I, N, M, S, ...
127buildType=I
128
129# ID of the build. Used in naming the build output.
130buildId=TestBuild
131
132# Label for the build. Used in naming the build output
133buildLabel=${buildType}.${buildId}
134
135# Timestamp for the build. Used in naming the build output
136timestamp=007
137
138#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
139#The value will only be applied to plugin or features indicating build.properties, qualifier = context
140#forceContextQualifier=<the value for the qualifier>
141
142#Enable / disable the generation of a suffix for the features that use .qualifier.
143#The generated suffix is computed according to the content of the feature
144#generateFeatureVersionSuffix=true
145
146############# BASE CONTROL #############
147# Settings for the base Eclipse components and Java class libraries
148# against which you are building.
149# Base location for anything the build needs to compile against. For example,
150# in most RCP app or a plug-in, the baseLocation should be the location of a previously
151# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack.
152
153#base=<path/to/parent/of/eclipse>
154#baseLocation=${base}/eclipse
155
156#Folder containing repositories whose content is needed to compile against
157#repoBaseLocation=${base}/repos
158#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against
159#transformedRepoLocation=${base}/transformedRepos
160
161#Os/Ws/Arch/nl of the eclipse specified by baseLocation
162#baseos=win32
163#basews=win32
164#basearch=x86
165
166#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
167filteredDependencyCheck=false
168
169#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons)
170resolution.devMode=false
171
172#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :)
173#a location is one of:
174#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo
175#- a directory that contains a /plugins or /features subdirectory
176#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml
177#pluginPath=
178
179skipBase=true
180eclipseURL=<url for eclipse download site>
181eclipseBuildId=<Id of Eclipse build to get>
182eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip
183
184
185############# MAP FILE CONTROL ################
186# This section defines CVS tags to use when fetching the map files from the repository.
187# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml
188
189skipMaps=true
190mapsRepo=:pserver:anonymous@example.com/path/to/repo
191mapsRoot=path/to/maps
192mapsCheckoutTag=HEAD
193
194#tagMaps=true
195mapsTagTag=v${buildId}
196
197
198############ REPOSITORY CONTROL ###############
199# This section defines properties parameterizing the repositories where plugins, fragments
200# bundles and features are being obtained from.
201
202# The tags to use when fetching elements to build.
203# By default thebuilder will use whatever is in the maps.
204# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the
205# overriding value
206# For example fetchTag=CVS=HEAD, SVN=v20050101
207# fetchTag=HEAD
208skipFetch=true
209
210
211############# JAVA COMPILER OPTIONS ##############
212# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE
213#bootclasspath=${java.home}/lib/rt.jar
214
215# specific JRE locations to compile against. These values are used to compile bundles specifying a
216# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support
217#CDC-1.0/Foundation-1.0= /path/to/rt.jar
218#CDC-1.1/Foundation-1.1=
219#OSGi/Minimum-1.0=
220#OSGi/Minimum-1.1=
221#JRE-1.1=
222#J2SE-1.2=
223#J2SE-1.3=
224#J2SE-1.4=
225#J2SE-1.5=
226#JavaSE-1.6=
227#PersonalJava-1.1=
228#PersonalJava-1.2=
229#CDC-1.0/PersonalBasis-1.0=
230#CDC-1.0/PersonalJava-1.0=
231#CDC-1.1/PersonalBasis-1.1=
232#CDC-1.1/PersonalJava-1.1=
233
234# Specify the output format of the compiler log when eclipse jdt is used
235logExtension=.log
236
237# Whether or not to include debug info in the output jars
238javacDebugInfo=false
239
240# Whether or not to fail the build if there are compiler errors
241javacFailOnError=true
242
243# Enable or disable verbose mode of the compiler
244javacVerbose=true
245
246# Extra arguments for the compiler. These are specific to the java compiler being used.
247#compilerArg=
248
249# 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
250javacSource=1.6
251
252# 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.
253javacTarget=1.6
254
255#individualSourceBundles=true
256
257#p2.gathering=true
258p2.compress=true
259#p2.category.site=file:${buildDirectory}/site.xml
260p2.category.definition=file:${buildDirectory}/category.xml
261p2.metadata.repo.name=Yocto Project Update Site
262p2.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 @@
1<project name="Build specific targets and properties" default="noDefault">
2
3 <!-- ===================================================================== -->
4 <!-- Run a given ${target} on all elements being built -->
5 <!-- Add on <ant> task for each top level element being built. -->
6 <!-- ===================================================================== -->
7 <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
8 <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
9
10 <import file="${allElementsFile}" />
11 <target name="allElements">
12 <antcall target="allElementsDelegator" />
13 </target>
14
15 <!-- ===================================================================== -->
16 <!-- ===================================================================== -->
17 <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
18 <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
19 <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
20 </target>
21
22 <target name="checkLocalBase">
23 <available file="${base}" property="skipBase" />
24 </target>
25
26 <!-- ===================================================================== -->
27 <!-- Check out map files from correct repository -->
28 <!-- Replace values for mapsCheckoutTag as desired. -->
29 <!-- ===================================================================== -->
30 <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
31 <property name="mapsCheckoutTag" value="HEAD" />
32 <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
33 </target>
34
35 <target name="checkLocalMaps">
36 <available property="skipMaps" file="${buildDirectory}/maps" />
37 </target>
38
39 <target name="tagMapFiles" if="tagMaps">
40 <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
41 </target>
42
43 <!-- ===================================================================== -->
44
45 <target name="clean" unless="noclean">
46 <antcall target="allElements">
47 <param name="target" value="cleanElement" />
48 </antcall>
49 </target>
50
51 <target name="gatherLogs">
52 <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
53 <antcall target="allElements">
54 <param name="target" value="gatherLogs" />
55 </antcall>
56 <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
57 <fileset dir="${buildDirectory}/features">
58 <include name="**/*.log.zip" />
59 </fileset>
60 </unzip>
61 </target>
62
63 <!-- ===================================================================== -->
64 <!-- Steps to do before setup -->
65 <!-- ===================================================================== -->
66 <target name="preSetup">
67 <delete dir="${buildDirectory}/plugins"/>
68 <mkdir dir="${buildDirectory}/plugins"/>
69 <copy todir="${buildDirectory}/plugins" failonerror="true">
70 <fileset dir="${otherSrcDirectory}/plugins"/>
71 </copy>
72 <delete dir="${buildDirectory}/features"/>
73 <copy todir="${buildDirectory}/features" failonerror="true" >
74 <fileset dir="${otherSrcDirectory}/features"/>
75 </copy>
76 <antcall target="prepareForP2" />
77 </target>
78
79 <target name="prepareForP2" if="p2.gathering">
80 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" />
81 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/category.xml" todir="${buildDirectory}" />
82 <xmlproperty file="${otherSrcDirectory}/features/org.yocto.sdk/feature.xml" />
83 <replace file="${buildDirectory}/category.xml">
84 <replacefilter token="@featureVersion@" value="${feature(version)}"/>
85 </replace>
86 </target>
87
88 <!-- ===================================================================== -->
89 <!-- Steps to do after setup but before starting the build proper -->
90 <!-- ===================================================================== -->
91 <target name="postSetup">
92 <antcall target="getBaseComponents" />
93 </target>
94
95 <!-- ===================================================================== -->
96 <!-- Steps to do before fetching the build elements -->
97 <!-- ===================================================================== -->
98 <target name="preFetch">
99 </target>
100
101 <!-- ===================================================================== -->
102 <!-- Steps to do after fetching the build elements -->
103 <!-- ===================================================================== -->
104 <target name="postFetch">
105 </target>
106
107 <!-- ===================================================================== -->
108 <!-- Steps to do before the repositories are being processed -->
109 <!-- ===================================================================== -->
110 <target name="preProcessRepos">
111 </target>
112
113 <!-- ===================================================================== -->
114 <!-- Steps to do after the repositories have been processed -->
115 <!-- ===================================================================== -->
116 <target name="postProcessRepos">
117 </target>
118
119 <!-- ===================================================================== -->
120 <!-- Steps to do before generating the build scripts. -->
121 <!-- ===================================================================== -->
122 <target name="preGenerate">
123 </target>
124
125 <!-- ===================================================================== -->
126 <!-- Steps to do after generating the build scripts. -->
127 <!-- ===================================================================== -->
128 <target name="postGenerate">
129 <antcall target="clean" />
130 </target>
131
132 <!-- ===================================================================== -->
133 <!-- Steps to do before running the build.xmls for the elements being built. -->
134 <!-- ===================================================================== -->
135 <target name="preProcess">
136 </target>
137
138 <!-- ===================================================================== -->
139 <!-- Steps to do after running the build.xmls for the elements being built. -->
140 <!-- ===================================================================== -->
141 <target name="postProcess">
142 </target>
143
144 <!-- ===================================================================== -->
145 <!-- Steps to do before running assemble. -->
146 <!-- ===================================================================== -->
147 <target name="preAssemble">
148 </target>
149
150 <!-- ===================================================================== -->
151 <!-- Steps to do after running assemble. -->
152 <!-- ===================================================================== -->
153 <target name="postAssemble">
154 </target>
155
156 <!-- ===================================================================== -->
157 <!-- Steps to do before running package. -->
158 <!-- ===================================================================== -->
159 <target name="prePackage">
160 </target>
161
162 <!-- ===================================================================== -->
163 <!-- Steps to do after running package. -->
164 <!-- ===================================================================== -->
165 <target name="postPackage">
166 </target>
167
168 <!-- ===================================================================== -->
169 <!-- Steps to do after the build is done. -->
170 <!-- ===================================================================== -->
171 <target name="postBuild">
172 <antcall target="gatherLogs" />
173 <antcall target="updateSiteContent" />
174 </target>
175
176 <target name="updateSiteContent" if="p2.gathering">
177 <property file="${buildDirectory}/finalFeaturesVersions.properties" />
178 <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" />
179 <replace file="${buildDirectory}/site.xml">
180 <replacefilter token="@genVersion@" value="${org.yocto.sdk}"/>
181 </replace>
182 <zip destfile="${buildDirectory}/${buildLabel}/org.yocto.sdk-${buildId}-group.group.group.zip" update="true">
183 <zipfileset dir="${buildDirectory}">
184 <include name="site.xml"/>
185 </zipfileset>
186 <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site">
187 <include name="index.html"/>
188 </zipfileset>
189 <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site/web" prefix="web"/>
190 </zip>
191 </target>
192
193 <!-- ===================================================================== -->
194 <!-- Steps to do to test the build results -->
195 <!-- ===================================================================== -->
196 <target name="test">
197 </target>
198
199 <!-- ===================================================================== -->
200 <!-- Steps to do to publish the build results -->
201 <!-- ===================================================================== -->
202 <target name="publish">
203 </target>
204
205 <!-- ===================================================================== -->
206 <!-- Default target -->
207 <!-- ===================================================================== -->
208 <target name="noDefault">
209 <echo message="You must specify a target when invoking this file" />
210 </target>
211
212</project>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.sdk.site</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.pde.UpdateSiteBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 </buildSpec>
14 <natures>
15 <nature>org.eclipse.pde.UpdateSiteNature</nature>
16 </natures>
17</projectDescription>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<site>
3 <feature url="features/org.yocto.sdk_@featureVersion@.jar" id="org.yocto.sdk" version="@featureVersion@">
4 <category name="Yocto Project ADT"/>
5 </feature>
6 <feature url="features/org.yocto.sdk.source_@featureVersion@.jar" id="org.yocto.sdk.source" version="@featureVersion@">
7 <category name="Yocto Project ADT"/>
8 </feature>
9 <feature url="features/org.yocto.bc_@bcfeatureVersion@.jar" id="org.yocto.bc" version="@bcfeatureVersion@">
10 <category name="Yocto Project Bitbake Commander"/>
11 </feature>
12 <feature url="features/org.yocto.doc_@docFeatureVersion@.jar" id="org.yocto.doc" version="@docFeatureVersion@">
13 <category name="Yocto Project Documentation"/>
14 </feature>
15 <category-def name="Yocto Project ADT" label="Yocto Project ADT Plug-in"/>
16 <category-def name="Yocto Project Bitbake Commander" label="Yocto Project Bitbake Commander Plug-in"/>
17 <category-def name="Yocto Project Documentation" label="Yocto Project Documentation plug-in"/>
18</site>
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 @@
1<html>
2<head>
3<title>org.yocto.sdk.site</title>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<style>@import url("web/site.css");</style>
6<script type="text/javascript">
7 var returnval = 0;
8 var stylesheet, xmlFile, cache, doc;
9 function init(){
10 // NSCP 7.1+ / Mozilla 1.4.1+ / Safari
11 // Use the standard DOM Level 2 technique, if it is supported
12 if (document.implementation && document.implementation.createDocument) {
13 xmlFile = document.implementation.createDocument("", "", null);
14 stylesheet = document.implementation.createDocument("", "", null);
15 if (xmlFile.load){
16 xmlFile.load("site.xml");
17 stylesheet.load("web/site.xsl");
18 } else {
19 alert("Document could not be loaded by browser.");
20 }
21 xmlFile.addEventListener("load", transform, false);
22 stylesheet.addEventListener("load", transform, false);
23 }
24 //IE 6.0+ solution
25 else if (window.ActiveXObject) {
26 xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0");
27 xmlFile.async = false;
28 xmlFile.load("site.xml");
29 stylesheet = new ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0");
30 stylesheet.async = false;
31 stylesheet.load("web/site.xsl");
32 cache = new ActiveXObject("msxml2.XSLTemplate.3.0");
33 cache.stylesheet = stylesheet;
34 transformData();
35 }
36 }
37 // separate transformation function for IE 6.0+
38 function transformData(){
39 var processor = cache.createProcessor();
40 processor.input = xmlFile;
41 processor.transform();
42 data.innerHTML = processor.output;
43 }
44 // separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+
45 function transform(){
46 returnval+=1;
47 if (returnval==2){
48 var processor = new XSLTProcessor();
49 processor.importStylesheet(stylesheet);
50 doc = processor.transformToDocument(xmlFile);
51 document.getElementById("data").innerHTML = doc.documentElement.innerHTML;
52 }
53 }
54</script>
55</head>
56<body onload="init();">
57<!--[insert static HTML here]-->
58<div id="data"><!-- this is where the transformed data goes --></div>
59</body>
60</html>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<site>
3 <description name="Yocto Project update site" url="http://yoctoproject.org/downloads/eclipse-plugin/">
4 Yocto Project update site
5 </description>
6 <feature url="features/org.yocto.sdk_@genVersion@.jar" id="org.yocto.sdk" version="@genVersion@">
7 <category name="Yocto Project ADT"/>
8 </feature>
9 <category-def name="Yocto Project ADT" label="Yocto Project ADT plug-in"/>
10 <feature url="features/org.yocto.bc_@bcgenVersion@.jar" id="org.yocto.bc" version="@bcgenVersion@">
11 <category name="Yocto Project Bitbake Commander"/>
12 </feature>
13 <category-def name="Yocto Project Bitbake Commander" label="Yocto Project Bitbake Commander plug-in"/>
14 <feature url="features/org.yocto.doc_@docGenVersion@.jar" id="org.yocto.doc" version="@docGenVersion@">
15 <category name="Yocto Project Documentation"/>
16 </feature>
17 <category-def name="Yocto Project Documentation" label="Yocto Project Documentation plug-in"/>
18</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 @@
1<STYLE type="text/css">
2td.spacer {padding-bottom: 10px; padding-top: 10px;}
3.title { font-family: sans-serif; color: #99AACC;}
4.bodyText { font-family: sans-serif; font-size: 9pt; color:#000000; }
5.sub-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white;}
6.log-text {font-family: sans-serif; font-style: normal; font-weight: lighter; font-size: 8pt; color:black;}
7.big-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white; border-top:10px solid white;}
8.light-row {background:#FFFFFF}
9.dark-row {background:#EEEEFF}
10.header {background:#99AADD}
11#indent {word-wrap : break-word;width :300px;text-indent:10px;}
12</STYLE>
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 @@
1<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl="urn:schemas-microsoft-com:xslt">
2<xsl:output method="html" encoding="UTF-8"/>
3<xsl:key name="cat" match="category" use="@name"/>
4<xsl:template match="/">
5<xsl:for-each select="site">
6 <html>
7 <head>
8 <title>org.yocto.sdk.site</title>
9 <style>@import url("web/site.css");</style>
10 </head>
11 <body>
12 <h1 class="title">org.yocto.sdk.site</h1>
13 <p class="bodyText"><xsl:value-of select="description"/></p>
14 <table width="100%" border="0" cellspacing="1" cellpadding="2">
15 <xsl:for-each select="category-def">
16 <xsl:sort select="@label" order="ascending" case-order="upper-first"/>
17 <xsl:sort select="@name" order="ascending" case-order="upper-first"/>
18 <xsl:if test="count(key('cat',@name)) != 0">
19 <tr class="header">
20 <td class="sub-header" width="30%">
21 <xsl:value-of select="@name"/>
22 </td>
23 <td class="sub-header" width="70%">
24 <xsl:value-of select="@label"/>
25 </td>
26 </tr>
27 <xsl:for-each select="key('cat',@name)">
28 <xsl:sort select="ancestor::feature//@version" order="ascending"/>
29 <xsl:sort select="ancestor::feature//@id" order="ascending" case-order="upper-first"/>
30 <tr>
31 <xsl:choose>
32 <xsl:when test="(position() mod 2 = 1)">
33 <xsl:attribute name="class">dark-row</xsl:attribute>
34 </xsl:when>
35 <xsl:otherwise>
36 <xsl:attribute name="class">light-row</xsl:attribute>
37 </xsl:otherwise>
38 </xsl:choose>
39 <td class="log-text" id="indent">
40 <xsl:choose>
41 <xsl:when test="ancestor::feature//@label">
42 <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@label"/></a>
43 <br/>
44 <div id="indent">
45 (<xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/>)
46 </div>
47 </xsl:when>
48 <xsl:otherwise>
49 <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/></a>
50 </xsl:otherwise>
51 </xsl:choose>
52 <br />
53 </td>
54 <td>
55 <table>
56 <xsl:if test="ancestor::feature//@os">
57 <tr><td class="log-text" id="indent">Operating Systems:</td>
58 <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@os"/></td>
59 </tr>
60 </xsl:if>
61 <xsl:if test="ancestor::feature//@ws">
62 <tr><td class="log-text" id="indent">Windows Systems:</td>
63 <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@ws"/></td>
64 </tr>
65 </xsl:if>
66 <xsl:if test="ancestor::feature//@nl">
67 <tr><td class="log-text" id="indent">Languages:</td>
68 <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@nl"/></td>
69 </tr>
70 </xsl:if>
71 <xsl:if test="ancestor::feature//@arch">
72 <tr><td class="log-text" id="indent">Architecture:</td>
73 <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@arch"/></td>
74 </tr>
75 </xsl:if>
76 </table>
77 </td>
78 </tr>
79 </xsl:for-each>
80 <tr><td class="spacer"><br/></td><td class="spacer"><br/></td></tr>
81 </xsl:if>
82 </xsl:for-each>
83 <xsl:if test="count(feature) &gt; count(feature/category)">
84 <tr class="header">
85 <td class="sub-header" colspan="2">
86 Uncategorized
87 </td>
88 </tr>
89 </xsl:if>
90 <xsl:choose>
91 <xsl:when test="function-available('msxsl:node-set')">
92 <xsl:variable name="rtf-nodes">
93 <xsl:for-each select="feature[not(category)]">
94 <xsl:sort select="@id" order="ascending" case-order="upper-first"/>
95 <xsl:sort select="@version" order="ascending" />
96 <xsl:value-of select="."/>
97 <xsl:copy-of select="." />
98 </xsl:for-each>
99 </xsl:variable>
100 <xsl:variable name="myNodeSet" select="msxsl:node-set($rtf-nodes)/*"/>
101 <xsl:for-each select="$myNodeSet">
102 <tr>
103 <xsl:choose>
104 <xsl:when test="position() mod 2 = 1">
105 <xsl:attribute name="class">dark-row</xsl:attribute>
106 </xsl:when>
107 <xsl:otherwise>
108 <xsl:attribute name="class">light-row</xsl:attribute>
109 </xsl:otherwise>
110 </xsl:choose>
111 <td class="log-text" id="indent">
112 <xsl:choose>
113 <xsl:when test="@label">
114 <a href="{@url}"><xsl:value-of select="@label"/></a>
115 <br />
116 <div id="indent">
117 (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>)
118 </div>
119 </xsl:when>
120 <xsl:otherwise>
121 <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a>
122 </xsl:otherwise>
123 </xsl:choose>
124 <br /><br />
125 </td>
126 <td>
127 <table>
128 <xsl:if test="@os">
129 <tr><td class="log-text" id="indent">Operating Systems:</td>
130 <td class="log-text" id="indent"><xsl:value-of select="@os"/></td>
131 </tr>
132 </xsl:if>
133 <xsl:if test="@ws">
134 <tr><td class="log-text" id="indent">Windows Systems:</td>
135 <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td>
136 </tr>
137 </xsl:if>
138 <xsl:if test="@nl">
139 <tr><td class="log-text" id="indent">Languages:</td>
140 <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td>
141 </tr>
142 </xsl:if>
143 <xsl:if test="@arch">
144 <tr><td class="log-text" id="indent">Architecture:</td>
145 <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td>
146 </tr>
147 </xsl:if>
148 </table>
149 </td>
150 </tr>
151 </xsl:for-each>
152 </xsl:when>
153 <xsl:otherwise>
154 <xsl:for-each select="feature[not(category)]">
155 <xsl:sort select="@id" order="ascending" case-order="upper-first"/>
156 <xsl:sort select="@version" order="ascending" />
157 <tr>
158 <xsl:choose>
159 <xsl:when test="count(preceding-sibling::feature[not(category)]) mod 2 = 1">
160 <xsl:attribute name="class">dark-row</xsl:attribute>
161 </xsl:when>
162 <xsl:otherwise>
163 <xsl:attribute name="class">light-row</xsl:attribute>
164 </xsl:otherwise>
165 </xsl:choose>
166 <td class="log-text" id="indent">
167 <xsl:choose>
168 <xsl:when test="@label">
169 <a href="{@url}"><xsl:value-of select="@label"/></a>
170 <br />
171 <div id="indent">
172 (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>)
173 </div>
174 </xsl:when>
175 <xsl:otherwise>
176 <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a>
177 </xsl:otherwise>
178 </xsl:choose>
179 <br /><br />
180 </td>
181 <td>
182 <table>
183 <xsl:if test="@os">
184 <tr><td class="log-text" id="indent">Operating Systems:</td>
185 <td class="log-text" id="indent"><xsl:value-of select="@os"/></td>
186 </tr>
187 </xsl:if>
188 <xsl:if test="@ws">
189 <tr><td class="log-text" id="indent">Windows Systems:</td>
190 <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td>
191 </tr>
192 </xsl:if>
193 <xsl:if test="@nl">
194 <tr><td class="log-text" id="indent">Languages:</td>
195 <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td>
196 </tr>
197 </xsl:if>
198 <xsl:if test="@arch">
199 <tr><td class="log-text" id="indent">Architecture:</td>
200 <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td>
201 </tr>
202 </xsl:if>
203 </table>
204 </td>
205 </tr>
206 </xsl:for-each>
207 </xsl:otherwise>
208 </xsl:choose>
209 </table>
210 </body>
211 </html>
212</xsl:for-each>
213</xsl:template>
214</xsl:stylesheet>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.sdk</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.pde.FeatureBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 </buildSpec>
14 <natures>
15 <nature>org.eclipse.pde.FeatureNature</nature>
16 </natures>
17</projectDescription>
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 @@
1bin.includes = feature.xml,\
2 license.html,\
3 feature.properties
4
5generate.feature@org.yocto.sdk.source=org.yocto.sdk
6
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 @@
1###############################################################################
2# Copyright (c) 2010 Intel, Inc. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Intel - initial implementation
10###############################################################################
11
12# "featureName" property - name of the feature
13featureName=Yocto Project ADT Plug-in
14
15# "providerName" property - name of the company that provides the feature
16providerName=yoctoproject.org
17
18# "updateSiteName" property - label for the update site
19updateSiteName=Yocto Project Update Site
20
21# "description" property - description of the feature
22description=\
23Eclipse plug-ins for developing embedded applications using Yocto Project
24
25# copyright
26copyright=\
27Copyright (c) 2010 Intel, Inc. and others. \
28All rights reserved. This program and the accompanying materials \
29are made available under the terms of the Eclipse Public License v1.0 \
30which accompanies this distribution, and is available at \
31http://www.eclipse.org/legal/epl-v10.html
32################ end of copyright property ####################################
33
34# "licenseURL" property - URL of the "Feature License"
35# do not translate value - just change to point to a locale-specific HTML page
36licenseURL=license.html
37
38# "license" property - text of the "Feature Update License"
39# should be plain text version of license agreement pointed to be "licenseURL"
40license=\
41Eclipse Foundation Software User Agreement\n\
42April 14, 2010\n\
43\n\
44Usage Of Content\n\
45\n\
46THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
47OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
48USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
49AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
50NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
51AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
52AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
53OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
54TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
55OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
56BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
57\n\
58Applicable Licenses\n\
59\n\
60Unless otherwise indicated, all Content made available by the\n\
61Eclipse Foundation is provided to you under the terms and conditions of\n\
62the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
63provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
64For purposes of the EPL, "Program" will mean the Content.\n\
65\n\
66Content includes, but is not limited to, source code, object code,\n\
67documentation and other files maintained in the Eclipse Foundation source code\n\
68repository ("Repository") in software modules ("Modules") and made available\n\
69as downloadable archives ("Downloads").\n\
70\n\
71 - Content may be structured and packaged into modules to facilitate delivering,\n\
72 extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
73 plug-in fragments ("Fragments"), and features ("Features").\n\
74 - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
75 in a directory named "plugins".\n\
76 - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
77 Each Feature may be packaged as a sub-directory in a directory named "features".\n\
78 Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
79 numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
80 - Features may also include other Features ("Included Features"). Within a Feature, files\n\
81 named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
82\n\
83The terms and conditions governing Plug-ins and Fragments should be\n\
84contained in files named "about.html" ("Abouts"). The terms and\n\
85conditions governing Features and Included Features should be contained\n\
86in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
87Licenses may be located in any directory of a Download or Module\n\
88including, but not limited to the following locations:\n\
89\n\
90 - The top-level (root) directory\n\
91 - Plug-in and Fragment directories\n\
92 - Inside Plug-ins and Fragments packaged as JARs\n\
93 - Sub-directories of the directory named "src" of certain Plug-ins\n\
94 - Feature directories\n\
95\n\
96Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
97Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
98Update License") during the installation process. If the Feature contains\n\
99Included Features, the Feature Update License should either provide you\n\
100with the terms and conditions governing the Included Features or inform\n\
101you where you can locate them. Feature Update Licenses may be found in\n\
102the "license" property of files named "feature.properties" found within a Feature.\n\
103Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
104terms and conditions (or references to such terms and conditions) that\n\
105govern your use of the associated Content in that directory.\n\
106\n\
107THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
108TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
109SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
110\n\
111 - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
112 - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
113 - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
114 - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
115 - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
116\n\
117IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
118TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
119is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
120govern that particular Content.\n\
121\n\
122\n\Use of Provisioning Technology\n\
123\n\
124The Eclipse Foundation makes available provisioning software, examples of which include,\n\
125but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
126the purpose of allowing users to install software, documentation, information and/or\n\
127other materials (collectively "Installable Software"). This capability is provided with\n\
128the intent of allowing such users to install, extend and update Eclipse-based products.\n\
129Information about packaging Installable Software is available at\n\
130http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
131\n\
132You may use Provisioning Technology to allow other parties to install Installable Software.\n\
133You shall be responsible for enabling the applicable license agreements relating to the\n\
134Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
135in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
136making it available in accordance with the Specification, you further acknowledge your\n\
137agreement to, and the acquisition of all necessary rights to permit the following:\n\
138\n\
139 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
140 the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
141 extending or updating the functionality of an Eclipse-based product.\n\
142 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
143 Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
144 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
145 govern the use of the Installable Software ("Installable Software Agreement") and such\n\
146 Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
147 with the Specification. Such Installable Software Agreement must inform the user of the\n\
148 terms and conditions that govern the Installable Software and must solicit acceptance by\n\
149 the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
150 indication of agreement by the user, the provisioning Technology will complete installation\n\
151 of the Installable Software.\n\
152\n\
153Cryptography\n\
154\n\
155Content may contain encryption software. The country in which you are\n\
156currently may have restrictions on the import, possession, and use,\n\
157and/or re-export to another country, of encryption software. BEFORE\n\
158using any encryption software, please check the country's laws,\n\
159regulations and policies concerning the import, possession, or use, and\n\
160re-export of encryption software, to see if this is permitted.\n\
161\n\
162Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
163########### 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright (c) 2011 Intel, Inc. and others.
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Eclipse Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/epl-v10.html
8
9 Contributors:
10 Intel - initial API and implementation
11 BMW Car IT - added user documentation plugin to the feature
12 -->
13<feature
14 id="org.yocto.sdk"
15 label="%featureName"
16 version="1.4.0.qualifier"
17 provider-name="%providerName">
18
19 <description>
20 %description
21 </description>
22
23 <copyright>
24 %copyright
25 </copyright>
26
27 <license url="%licenseURL">
28 %license
29 </license>
30
31 <url>
32 <update label="%updateSiteName" url="http://yoctoproject.org/downloads/eclipse-plugin/"/>
33 </url>
34
35 <includes
36 id="org.yocto.sdk.source"/>
37
38 <requires>
39 <import plugin="org.eclipse.core.runtime"/>
40 <import plugin="org.eclipse.osgi"/>
41 <import plugin="org.eclipse.ui"/>
42 <import plugin="org.eclipse.rse.core"/>
43 <import plugin="org.eclipse.rse.ui"/>
44 <import plugin="org.eclipse.rse.services"/>
45 <import plugin="org.eclipse.ui.views"/>
46 <import plugin="org.eclipse.rse.subsystems.files.core"/>
47 <import plugin="org.eclipse.rse.subsystems.processes.core"/>
48 <import plugin="org.eclipse.rse.processes.ui"/>
49 <import plugin="org.eclipse.rse.subsystems.terminals.core"/>
50 <import plugin="org.eclipse.tcf" version="1.0.0" match="greaterOrEqual"/>
51 <import plugin="org.eclipse.cdt.ui" version="5.1.2" match="greaterOrEqual"/>
52 <import plugin="org.eclipse.cdt.core" version="5.1.2" match="greaterOrEqual"/>
53 <import plugin="org.eclipse.core.resources" version="3.5.1" match="greaterOrEqual"/>
54 <import plugin="org.eclipse.debug.core" version="3.5.1" match="greaterOrEqual"/>
55 <import plugin="org.eclipse.cdt.managedbuilder.core"/>
56 <import plugin="org.eclipse.cdt.autotools.core" version="1.1.0" match="greaterOrEqual"/>
57 <import plugin="org.eclipse.cdt.autotools.ui" version="1.0.1" match="greaterOrEqual"/>
58 <import plugin="org.eclipse.cdt.managedbuilder.ui" version="5.1.0" match="greaterOrEqual"/>
59 <import plugin="org.eclipse.core.expressions" version="3.4.100" match="greaterOrEqual"/>
60 <import plugin="org.eclipse.rse.files.ui" version="3.1.1" match="greaterOrEqual"/>
61 <import plugin="org.eclipse.rse.subsystems.shells.core" version="3.1.0" match="greaterOrEqual"/>
62 <import plugin="org.eclipse.tcf.core" version="1.0.0" match="greaterOrEqual"/>
63 <import plugin="org.eclipse.cdt.launch.remote" version="2.2.0" match="greaterOrEqual"/>
64 <import plugin="org.eclipse.tm.terminal" version="3.0.1" match="greaterOrEqual"/>
65 <import plugin="org.eclipse.rse.terminals.ui" version="1.0.100" match="greaterOrEqual"/>
66 <import plugin="org.eclipse.debug.ui"/>
67 <import plugin="org.eclipse.ui.forms"/>
68 <import plugin="org.eclipse.jface.text"/>
69 <import plugin="org.eclipse.ui.editors"/>
70 <import plugin="org.eclipse.ui.ide"/>
71 <import plugin="org.eclipse.ui.console"/>
72 <import plugin="org.eclipse.core.filesystem"/>
73 </requires>
74
75 <plugin
76 id="org.yocto.sdk.ide"
77 download-size="0"
78 install-size="0"
79 version="0.0.0"
80 unpack="false"/>
81
82 <plugin
83 id="org.yocto.remote.utils"
84 download-size="0"
85 install-size="0"
86 version="0.0.0"
87 unpack="false"/>
88
89 <plugin
90 id="org.yocto.sdk.remotetools"
91 download-size="0"
92 install-size="0"
93 version="0.0.0"
94 unpack="false"/>
95
96 <plugin
97 id="org.yocto.sdk.ide.doc.user"
98 download-size="0"
99 install-size="0"
100 version="0.0.0"
101 unpack="false"/>
102
103 <plugin
104 id="org.yocto.cmake.managedbuilder"
105 download-size="0"
106 install-size="0"
107 version="0.0.0"
108 unpack="false"/>
109</feature>
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 @@
1<?xml version="1.0" encoding="ISO-8859-1" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6<title>Eclipse Foundation Software User Agreement</title>
7</head>
8
9<body lang="EN-US">
10<h2>Eclipse Foundation Software User Agreement</h2>
11<p>April 14, 2010</p>
12
13<h3>Usage Of Content</h3>
14
15<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
16 (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
17 CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
18 OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
19 NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
20 CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
21
22<h3>Applicable Licenses</h3>
23
24<p>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
25 (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
26 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
27
28<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
29 repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
30
31<ul>
32 <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
33 <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
34 <li>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 &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
35 and/or Fragments associated with that Feature.</li>
36 <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
37</ul>
38
39<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
40Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
41including, but not limited to the following locations:</p>
42
43<ul>
44 <li>The top-level (root) directory</li>
45 <li>Plug-in and Fragment directories</li>
46 <li>Inside Plug-ins and Fragments packaged as JARs</li>
47 <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
48 <li>Feature directories</li>
49</ul>
50
51<p>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 (&quot;Feature Update License&quot;) during the
52installation 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
53inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
54Such 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
55that directory.</p>
56
57<p>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
58OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
59
60<ul>
61 <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
62 <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
63 <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
64 <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
65 <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
66</ul>
67
68<p>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
69contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
70
71
72<h3>Use of Provisioning Technology</h3>
73
74<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
75 Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
76 other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
77 install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
78 href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
79 (&quot;Specification&quot;).</p>
80
81<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
82 applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
83 in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
84 Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
85
86<ol>
87 <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
88 on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
89 product.</li>
90 <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
91 accessed and copied to the Target Machine.</li>
92 <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
93 Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
94 Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
95 the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
96 indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
97</ol>
98
99<h3>Cryptography</h3>
100
101<p>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
102 another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
103 possession, or use, and re-export of encryption software, to see if this is permitted.</p>
104
105<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
106</body>
107</html>
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 @@
1###############################################################################
2# Copyright (c) 2011 Intel, Inc. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Intel - initial implementation
10###############################################################################
11
12# "featureName" property - name of the feature
13featureName=Yocto Project ADT Plug-in - Source
14
15# "providerName" property - name of the company that provides the feature
16providerName=yoctoproject.org
17
18# "updateSiteName" property - label for the update site
19updateSiteName=Yocto Project Update Site
20
21# "description" property - description of the feature
22description=\
23Eclipse plug-ins for developing embedded applications using Yocto Project
24
25# copyright
26copyright=\
27Copyright (c) 2011 Intel, Inc. and others. \
28All rights reserved. This program and the accompanying materials \
29are made available under the terms of the Eclipse Public License v1.0 \
30which accompanies this distribution, and is available at \
31http://www.eclipse.org/legal/epl-v10.html
32################ end of copyright property ####################################
33
34# "licenseURL" property - URL of the "Feature License"
35# do not translate value - just change to point to a locale-specific HTML page
36licenseURL=license.html
37
38# "license" property - text of the "Feature Update License"
39# should be plain text version of license agreement pointed to be "licenseURL"
40license=\
41Eclipse Foundation Software User Agreement\n\
42April 14, 2010\n\
43\n\
44Usage Of Content\n\
45\n\
46THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
47OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
48USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
49AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
50NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
51AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
52AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
53OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
54TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
55OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
56BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
57\n\
58Applicable Licenses\n\
59\n\
60Unless otherwise indicated, all Content made available by the\n\
61Eclipse Foundation is provided to you under the terms and conditions of\n\
62the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
63provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
64For purposes of the EPL, "Program" will mean the Content.\n\
65\n\
66Content includes, but is not limited to, source code, object code,\n\
67documentation and other files maintained in the Eclipse Foundation source code\n\
68repository ("Repository") in software modules ("Modules") and made available\n\
69as downloadable archives ("Downloads").\n\
70\n\
71 - Content may be structured and packaged into modules to facilitate delivering,\n\
72 extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
73 plug-in fragments ("Fragments"), and features ("Features").\n\
74 - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
75 in a directory named "plugins".\n\
76 - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
77 Each Feature may be packaged as a sub-directory in a directory named "features".\n\
78 Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
79 numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
80 - Features may also include other Features ("Included Features"). Within a Feature, files\n\
81 named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
82\n\
83The terms and conditions governing Plug-ins and Fragments should be\n\
84contained in files named "about.html" ("Abouts"). The terms and\n\
85conditions governing Features and Included Features should be contained\n\
86in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
87Licenses may be located in any directory of a Download or Module\n\
88including, but not limited to the following locations:\n\
89\n\
90 - The top-level (root) directory\n\
91 - Plug-in and Fragment directories\n\
92 - Inside Plug-ins and Fragments packaged as JARs\n\
93 - Sub-directories of the directory named "src" of certain Plug-ins\n\
94 - Feature directories\n\
95\n\
96Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
97Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
98Update License") during the installation process. If the Feature contains\n\
99Included Features, the Feature Update License should either provide you\n\
100with the terms and conditions governing the Included Features or inform\n\
101you where you can locate them. Feature Update Licenses may be found in\n\
102the "license" property of files named "feature.properties" found within a Feature.\n\
103Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
104terms and conditions (or references to such terms and conditions) that\n\
105govern your use of the associated Content in that directory.\n\
106\n\
107THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
108TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
109SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
110\n\
111 - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
112 - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
113 - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
114 - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
115 - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
116\n\
117IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
118TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
119is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
120govern that particular Content.\n\
121\n\
122\n\Use of Provisioning Technology\n\
123\n\
124The Eclipse Foundation makes available provisioning software, examples of which include,\n\
125but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
126the purpose of allowing users to install software, documentation, information and/or\n\
127other materials (collectively "Installable Software"). This capability is provided with\n\
128the intent of allowing such users to install, extend and update Eclipse-based products.\n\
129Information about packaging Installable Software is available at\n\
130http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
131\n\
132You may use Provisioning Technology to allow other parties to install Installable Software.\n\
133You shall be responsible for enabling the applicable license agreements relating to the\n\
134Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
135in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
136making it available in accordance with the Specification, you further acknowledge your\n\
137agreement to, and the acquisition of all necessary rights to permit the following:\n\
138\n\
139 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
140 the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
141 extending or updating the functionality of an Eclipse-based product.\n\
142 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
143 Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
144 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
145 govern the use of the Installable Software ("Installable Software Agreement") and such\n\
146 Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
147 with the Specification. Such Installable Software Agreement must inform the user of the\n\
148 terms and conditions that govern the Installable Software and must solicit acceptance by\n\
149 the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
150 indication of agreement by the user, the provisioning Technology will complete installation\n\
151 of the Installable Software.\n\
152\n\
153Cryptography\n\
154\n\
155Content may contain encryption software. The country in which you are\n\
156currently may have restrictions on the import, possession, and use,\n\
157and/or re-export to another country, of encryption software. BEFORE\n\
158using any encryption software, please check the country's laws,\n\
159regulations and policies concerning the import, possession, or use, and\n\
160re-export of encryption software, to see if this is permitted.\n\
161\n\
162Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
163########### 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 @@
1<?xml version="1.0" encoding="ISO-8859-1" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6<title>Eclipse Foundation Software User Agreement</title>
7</head>
8
9<body lang="EN-US">
10<h2>Eclipse Foundation Software User Agreement</h2>
11<p>April 14, 2010</p>
12
13<h3>Usage Of Content</h3>
14
15<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
16 (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
17 CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
18 OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
19 NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
20 CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
21
22<h3>Applicable Licenses</h3>
23
24<p>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
25 (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
26 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
27
28<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
29 repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
30
31<ul>
32 <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
33 <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
34 <li>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 &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
35 and/or Fragments associated with that Feature.</li>
36 <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
37</ul>
38
39<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
40Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
41including, but not limited to the following locations:</p>
42
43<ul>
44 <li>The top-level (root) directory</li>
45 <li>Plug-in and Fragment directories</li>
46 <li>Inside Plug-ins and Fragments packaged as JARs</li>
47 <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
48 <li>Feature directories</li>
49</ul>
50
51<p>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 (&quot;Feature Update License&quot;) during the
52installation 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
53inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
54Such 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
55that directory.</p>
56
57<p>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
58OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
59
60<ul>
61 <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
62 <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
63 <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
64 <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
65 <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
66</ul>
67
68<p>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
69contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
70
71
72<h3>Use of Provisioning Technology</h3>
73
74<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
75 Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
76 other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
77 install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
78 href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
79 (&quot;Specification&quot;).</p>
80
81<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
82 applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
83 in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
84 Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
85
86<ol>
87 <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
88 on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
89 product.</li>
90 <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
91 accessed and copied to the Target Machine.</li>
92 <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
93 Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
94 Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
95 the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
96 indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
97</ol>
98
99<h3>Cryptography</h3>
100
101<p>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
102 another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
103 possession, or use, and re-export of encryption software, to see if this is permitted.</p>
104
105<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
106</body>
107</html>
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 @@
1<?xml version="1.0" encoding="ISO-8859-1" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6<title>Eclipse Foundation Software User Agreement</title>
7</head>
8
9<body lang="EN-US">
10<h2>Eclipse Foundation Software User Agreement</h2>
11<p>April 14, 2010</p>
12
13<h3>Usage Of Content</h3>
14
15<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
16 (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
17 CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
18 OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
19 NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
20 CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
21
22<h3>Applicable Licenses</h3>
23
24<p>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
25 (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
26 For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
27
28<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
29 repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
30
31<ul>
32 <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
33 <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
34 <li>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 &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
35 and/or Fragments associated with that Feature.</li>
36 <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
37</ul>
38
39<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
40Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
41including, but not limited to the following locations:</p>
42
43<ul>
44 <li>The top-level (root) directory</li>
45 <li>Plug-in and Fragment directories</li>
46 <li>Inside Plug-ins and Fragments packaged as JARs</li>
47 <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
48 <li>Feature directories</li>
49</ul>
50
51<p>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 (&quot;Feature Update License&quot;) during the
52installation 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
53inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
54Such 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
55that directory.</p>
56
57<p>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
58OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
59
60<ul>
61 <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
62 <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
63 <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
64 <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
65 <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
66</ul>
67
68<p>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
69contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
70
71
72<h3>Use of Provisioning Technology</h3>
73
74<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
75 Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
76 other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
77 install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
78 href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
79 (&quot;Specification&quot;).</p>
80
81<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
82 applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
83 in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
84 Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
85
86<ol>
87 <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
88 on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
89 product.</li>
90 <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
91 accessed and copied to the Target Machine.</li>
92 <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
93 Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
94 Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
95 the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
96 indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
97</ol>
98
99<h3>Cryptography</h3>
100
101<p>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
102 another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
103 possession, or use, and re-export of encryption software, to see if this is permitted.</p>
104
105<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
106</body>
107</html>
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 @@
1###############################################################################
2# Copyright (c) 2011 Intel, Inc. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Intel - initial implementation
10###############################################################################
11
12# "featureName" property - name of the feature
13pluginName=Yocto Project ADT Plug-in - Source
14
15# "providerName" property - name of the company that provides the feature
16providerName=yoctoproject.org
17
18# "updateSiteName" property - label for the update site
19updateSiteName=Yocto Project Update Site
20
21# "description" property - description of the feature
22description=\
23Eclipse plug-ins for developing embedded applications using Yocto Project
24
25# copyright
26copyright=\
27Copyright (c) 2011 Intel, Inc. and others. \
28All rights reserved. This program and the accompanying materials \
29are made available under the terms of the Eclipse Public License v1.0 \
30which accompanies this distribution, and is available at \
31http://www.eclipse.org/legal/epl-v10.html
32################ end of copyright property ####################################
33
34# "licenseURL" property - URL of the "Feature License"
35# do not translate value - just change to point to a locale-specific HTML page
36licenseURL=license.html
37
38# "license" property - text of the "Feature Update License"
39# should be plain text version of license agreement pointed to be "licenseURL"
40license=\
41Eclipse Foundation Software User Agreement\n\
42April 14, 2010\n\
43\n\
44Usage Of Content\n\
45\n\
46THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
47OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
48USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
49AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
50NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
51AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
52AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
53OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
54TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
55OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
56BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
57\n\
58Applicable Licenses\n\
59\n\
60Unless otherwise indicated, all Content made available by the\n\
61Eclipse Foundation is provided to you under the terms and conditions of\n\
62the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
63provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
64For purposes of the EPL, "Program" will mean the Content.\n\
65\n\
66Content includes, but is not limited to, source code, object code,\n\
67documentation and other files maintained in the Eclipse Foundation source code\n\
68repository ("Repository") in software modules ("Modules") and made available\n\
69as downloadable archives ("Downloads").\n\
70\n\
71 - Content may be structured and packaged into modules to facilitate delivering,\n\
72 extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
73 plug-in fragments ("Fragments"), and features ("Features").\n\
74 - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
75 in a directory named "plugins".\n\
76 - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
77 Each Feature may be packaged as a sub-directory in a directory named "features".\n\
78 Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
79 numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
80 - Features may also include other Features ("Included Features"). Within a Feature, files\n\
81 named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
82\n\
83The terms and conditions governing Plug-ins and Fragments should be\n\
84contained in files named "about.html" ("Abouts"). The terms and\n\
85conditions governing Features and Included Features should be contained\n\
86in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
87Licenses may be located in any directory of a Download or Module\n\
88including, but not limited to the following locations:\n\
89\n\
90 - The top-level (root) directory\n\
91 - Plug-in and Fragment directories\n\
92 - Inside Plug-ins and Fragments packaged as JARs\n\
93 - Sub-directories of the directory named "src" of certain Plug-ins\n\
94 - Feature directories\n\
95\n\
96Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
97Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
98Update License") during the installation process. If the Feature contains\n\
99Included Features, the Feature Update License should either provide you\n\
100with the terms and conditions governing the Included Features or inform\n\
101you where you can locate them. Feature Update Licenses may be found in\n\
102the "license" property of files named "feature.properties" found within a Feature.\n\
103Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
104terms and conditions (or references to such terms and conditions) that\n\
105govern your use of the associated Content in that directory.\n\
106\n\
107THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
108TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
109SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
110\n\
111 - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
112 - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
113 - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
114 - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
115 - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
116\n\
117IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
118TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
119is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
120govern that particular Content.\n\
121\n\
122\n\Use of Provisioning Technology\n\
123\n\
124The Eclipse Foundation makes available provisioning software, examples of which include,\n\
125but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
126the purpose of allowing users to install software, documentation, information and/or\n\
127other materials (collectively "Installable Software"). This capability is provided with\n\
128the intent of allowing such users to install, extend and update Eclipse-based products.\n\
129Information about packaging Installable Software is available at\n\
130http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
131\n\
132You may use Provisioning Technology to allow other parties to install Installable Software.\n\
133You shall be responsible for enabling the applicable license agreements relating to the\n\
134Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
135in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
136making it available in accordance with the Specification, you further acknowledge your\n\
137agreement to, and the acquisition of all necessary rights to permit the following:\n\
138\n\
139 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
140 the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
141 extending or updating the functionality of an Eclipse-based product.\n\
142 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
143 Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
144 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
145 govern the use of the Installable Software ("Installable Software Agreement") and such\n\
146 Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
147 with the Specification. Such Installable Software Agreement must inform the user of the\n\
148 terms and conditions that govern the Installable Software and must solicit acceptance by\n\
149 the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
150 indication of agreement by the user, the provisioning Technology will complete installation\n\
151 of the Installable Software.\n\
152\n\
153Cryptography\n\
154\n\
155Content may contain encryption software. The country in which you are\n\
156currently may have restrictions on the import, possession, and use,\n\
157and/or re-export to another country, of encryption software. BEFORE\n\
158using any encryption software, please check the country's laws,\n\
159regulations and policies concerning the import, possession, or use, and\n\
160re-export of encryption software, to see if this is permitted.\n\
161\n\
162Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
163########### 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="src" path="src"/>
4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
5 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
6 <classpathentry kind="output" path="bin"/>
7</classpath>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.bc.ui</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.jdt.core.javabuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.pde.ManifestBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.pde.SchemaBuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 </buildSpec>
24 <natures>
25 <nature>org.eclipse.pde.PluginNature</nature>
26 <nature>org.eclipse.jdt.core.javanature</nature>
27 </natures>
28</projectDescription>
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 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: %Bundle-Name
4Bundle-SymbolicName: org.yocto.bc.ui;singleton:=true
5Bundle-Version: 1.4.0.qualifier
6Bundle-Activator: org.yocto.bc.ui.Activator
7Bundle-Vendor: %Bundle-Vendor
8Require-Bundle: org.eclipse.ui,
9 org.eclipse.core.runtime,
10 org.eclipse.cdt.core;bundle-version="5.2.0",
11 org.eclipse.core.resources,
12 org.eclipse.debug.core;bundle-version="3.6.0",
13 org.eclipse.jface.text,
14 org.eclipse.ui.editors,
15 org.eclipse.ui.ide,
16 org.eclipse.ui.console,
17 org.eclipse.core.filesystem
18Eclipse-LazyStart: true
19Bundle-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 @@
1#Properties file for org.yocto.bc.ui
2command.name = LaunchHOB
3command.label.0 = Launch HOB
4command.mnemonic = L
5Bundle-Vendor = yoctoproject.org
6Bundle-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 @@
1source.. = src/
2output.. = bin/
3bin.includes = plugin.xml,\
4 META-INF/,\
5 .,\
6 icons/,\
7 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/OE_logo_128.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/OE_logo_64.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/OE_logo_96.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/OE_logo_full.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/beagle_128.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/binary.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/cf_obj.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/clean.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/details_view.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/function.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/icon16_OE.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/import_wiz.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/importdir_wiz.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/oe_decorator.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/poky_128.png
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/read_only.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/refresh.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/releng_gears.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/sample.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/sample_decorator.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/topic.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/trash.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/variable.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/icons/watchlist_view.gif
Binary files 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 @@
1# Where to cache the files Poky downloads
2DL_DIR ?= "${OEROOT}/sources"
3
4BBPATH += "${OEROOT}/meta-bug/*/*.bb \
5 ${OEROOT}/meta-oe/*/*.bb \
6 "
7
8# Poky has various extra metadata collections (openmoko, extras).
9# To enable these, uncomment all (or some of) the following lines:
10BBFILES = "\
11 ${OEROOT}/meta/packages/*/*.bb \
12 ${OEROOT}/meta-bug/packages/*/*.bb \
13 ${OEROOT}/meta-oe/packages/*/*.bb \
14 ${OEROOT}/meta-jalimo/packages/*/*.bb \
15 ${OEROOT}/meta-extras/packages/*/*.bb \
16 "
17BBFILE_COLLECTIONS = "normal bug"
18BBFILE_PATTERN_normal = "^${OEROOT}/meta/"
19BBFILE_PATTERN_bug = "^${OEROOT}/meta-bug/"
20BBFILE_PRIORITY_normal = "5"
21BBFILE_PRIORITY_bug = "5"
22
23
24BBMASK = ""
25
26# The machine to target
27MACHINE ?= "bug"
28# Other supported machines
29#MACHINE ?= "qemux86"
30
31DISTRO ?= "poky"
32# For bleeding edge / experimental / unstable package versions
33# DISTRO ?= "poky-bleeding"
34
35# EXTRA_IMAGE_FEATURES allows extra packages to be added to the generated images
36# (Some of these are automatically added to certain image types)
37# "dbg-pkgs" - add -dbg packages for all installed packages
38# (adds symbol information for debugging/profiling)
39# "dev-pkgs" - add -dev packages for all installed packages
40# (useful if you want to develop against libs in the image)
41# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.)
42# "tools-debug" - add debugging tools (gdb, strace)
43# "tools-profile" - add profiling tools (oprofile, exmap, lttng valgrind (x86 only))
44# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.)
45# "debug-tweaks" - make an image for suitable of development
46# e.g. ssh root access has a blank password
47# There are other application targets too, see meta/classes/poky-image.bbclass
48# and meta/packages/tasks/task-poky.bb for more details.
49
50EXTRA_IMAGE_FEATURES = "tools-debug tools-profile tools-testapps debug-tweaks"
51
52EXTRA_IMAGE_FEATURES_mx31ads = "tools-testapps debug-tweaks"
53
54# A list of packaging systems used in generated images
55# The first package type listed will be used for rootfs generation
56# include 'package_deb' for debs
57# include 'package_ipk' for ipks
58#PACKAGE_CLASSES ?= "package_deb package_ipk"
59PACKAGE_CLASSES ?= "package_ipk"
60
61# POKYMODE controls the characteristics of the generated packages/images by
62# telling poky which type of toolchain to use.
63#
64# Options include several different EABI combinations and a compatibility
65# mode for the OABI mode poky previously used.
66#
67# The default is "eabi"
68# Use "oabi" for machines with kernels < 2.6.18 on ARM for example.
69# Use "external-MODE" to use the precompiled external toolchains where MODE
70# is the type of external toolchain to use e.g. eabi.
71# POKYMODE = "external-eabi"
72
73# Uncomment this to specify where BitBake should create its temporary files.
74# Note that a full build of everything in OpenEmbedded will take GigaBytes of hard
75# disk space, so make sure to free enough space. The default TMPDIR is
76# <build directory>/tmp
77TMPDIR = "${OEROOT}/build/tmp"
78
79# Uncomment and set to allow bitbake to execute multiple tasks at once.
80# Note, This option is currently experimental - YMMV.
81# BB_NUMBER_THREADS = "1"
82# Also, make can be passed flags so it run parallel threads e.g.:
83PARALLEL_MAKE = "-j 2"
84
85# Uncomment this if you are using the Openedhand provided qemu deb - see README
86# ASSUME_PROVIDED += "qemu-native"
87
88IMAGE_LINGUAS = "en-us"
89LIMIT_BUILT_LOCALES = "en_US"
90ENABLE_BINARY_LOCALE_GENERATION = "0"
91
92# Comment this out if you don't have a 3.x gcc version available and wish
93# poky to build one for you. The 3.x gcc is required to build qemu-native.
94# ASSUME_PROVIDED += "gcc3-native"
95
96# Uncomment these two if you want BitBake to build images useful for debugging.
97# DEBUG_BUILD = "1"
98# INHIBIT_PACKAGE_STRIP = "1"
99
100# Uncomment these to build a package such that you can use gprof to profile it.
101# NOTE: This will only work with 'linux' targets, not
102# 'linux-uclibc', as uClibc doesn't provide the necessary
103# object files. Also, don't build glibc itself with these
104# flags, or it'll fail to build.
105#
106# PROFILE_OPTIMIZATION = "-pg"
107# SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}"
108# LDFLAGS =+ "-pg"
109
110# Uncomment this if you want BitBake to emit debugging output
111# BBDEBUG = "yes"
112# Uncomment this if you want BitBake to emit the log if a build fails.
113BBINCLUDELOGS = "yes"
114
115# Specifies a location to search for pre-generated tarballs when fetching
116# a cvs:// URI. Uncomment this, if you not want to pull directly from CVS.
117# CVS_TARBALL_STASH = "http://folks.o-hand.com/~richard/poky/sources/"
118
119# Set this if you wish to make pkgconfig libraries from your system available
120# for native builds. Combined with extra ASSUME_PROVIDEDs this can allow
121# native builds of applications like oprofileui-native (unsupported feature).
122#EXTRA_NATIVE_PKGCONFIG_PATH = ":/usr/lib/pkgconfig"
123#ASSUME_PROVIDED += "gtk+-native libglade-native"
124
125# 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<?eclipse version="3.2"?>
3<plugin>
4<extension
5 point="org.eclipse.ui.newWizards">
6 <category
7 name="Yocto Project BitBake Commander"
8 id="org.yocto.bc.ui">
9 </category>
10 <wizard
11 category="org.yocto.bc.ui"
12 class="org.yocto.bc.ui.wizards.install.InstallWizard"
13 icon="icons/icon16_OE.gif"
14 id="org.yocto.bc.ui.wizards.install.InstallWizard"
15 name="New Yocto Project"
16 project="true"/>
17 </extension>
18 <extension
19 id="org.yocto.bc.ui.builder.BitbakeCommanderNature"
20 name="Yocto Bitbake Commander Project Nature"
21 point="org.eclipse.core.resources.natures">
22 <runtime>
23 <run
24 class="org.yocto.bc.ui.builder.BitbakeCommanderNature">
25 </run>
26 </runtime>
27 </extension>
28 <extension
29 point="org.eclipse.ui.commands">
30 <command
31 id="org.yocto.bc.ui.command.launchHob"
32 name="%command.name">
33 </command>
34 </extension>
35 <extension
36 point="org.eclipse.ui.handlers">
37 <handler
38 class="org.yocto.bc.ui.actions.LaunchHobHandler"
39 commandId="org.yocto.bc.ui.command.launchHob">
40 </handler>
41 </extension>
42 <!--
43 <extension
44 point="org.eclipse.ui.popupMenus">
45 <objectContribution
46 adaptable="true"
47 id="org.yocto.bc.ui.contribution2"
48 nameFilter="*.bb"
49 objectClass="org.eclipse.core.resources.IFile">
50 <action
51 class="org.yocto.bc.ui.actions.BitbakeBuildRecipeAction"
52 enablesFor="+"
53 icon="icons/binary.gif"
54 id="org.yocto.bc.ui.BuildPackagePopupAction"
55 label="Build"
56 menubarPath="org.yocto.bc.ui.menu1/group1"
57 tooltip="Build a package">
58 </action>
59 <action
60 class="org.yocto.bc.ui.actions.BitbakeCleanRecipeAction"
61 enablesFor="+"
62 icon="icons/trash.gif"
63 id="org.yocto.bc.ui.CleanPackagePopupAction"
64 label="Clean"
65 menubarPath="org.yocto.bc.ui.menu1/group1"
66 tooltip="Clean a package">
67 </action>
68 <action
69 class="org.yocto.bc.ui.actions.BitbakeImportAction"
70 enablesFor="+"
71 icon="icons/import_wiz.gif"
72 id="org.yocto.bc.ui.BitbakeImportPopupAction"
73 label="Import"
74 menubarPath="org.yocto.bc.ui.menu1/group1"
75 tooltip="Import package sources as Eclipse project.">
76 </action>
77 <menu
78 id="org.yocto.bc.ui.menu1"
79 label="BitBake"
80 path="additions">
81 <separator
82 name="bc.separator1">
83 </separator>
84 </menu>
85 <action
86 class="org.yocto.bc.ui.actions.BitbakeRebuildRecipeAction"
87 enablesFor="+"
88 icon="icons/refresh.gif"
89 id="org.yocto.bc.ui.BuildPackagePopupAction"
90 label="Rebuild"
91 menubarPath="org.yocto.bc.ui.menu1/group1"
92 tooltip="Rebuild a package">
93 </action>
94 </objectContribution>
95 </extension>
96 -->
97 <extension
98 point="org.eclipse.ui.menus">
99 <menuContribution
100 locationURI="menu:project">
101 <command
102 commandId="org.yocto.bc.ui.command.launchHob"
103 id="hob"
104 label="%command.label.0"
105 mnemonic="%command.mnemonic"
106 style="push">
107 <visibleWhen
108 checkEnabled="false">
109 <and>
110 <count
111 value="1">
112 </count>
113 <iterate>
114 <adapt
115 type="org.eclipse.core.resources.IResource">
116 <test
117 property="org.eclipse.core.resources.projectNature"
118 value="org.yocto.bc.ui.builder.BitbakeCommanderNature">
119 </test>
120 </adapt>
121 </iterate>
122 </and>
123 </visibleWhen>
124 </command>
125 </menuContribution>
126 </extension>
127 <extension
128 id="xmlProblem"
129 name="XML Problem"
130 point="org.eclipse.core.resources.markers">
131 <super
132 type="org.eclipse.core.resources.problemmarker">
133 </super>
134 <persistent
135 value="true">
136 </persistent>
137 </extension>
138 <extension
139 point="org.eclipse.ui.editors">
140 <editor
141 class="org.yocto.bc.ui.editors.bitbake.BitBakeFileEditor"
142 contributorClass="org.yocto.bc.ui.editors.bitbake.RecipeEditorActionContributor"
143 default="true"
144 extensions="bb,inc,bbclass,conf"
145 icon="icons/topic.gif"
146 id="org.yocto.bc.ui.editors.BitBakeFileEditor"
147 name="Yocto Project BitBake Recipe Editor">
148 </editor>
149 </extension>
150 <extension
151 point="org.eclipse.ui.newWizards">
152 <category
153 name="Yocto Project BitBake Commander"
154 id="org.yocto.bc.ui">
155 </category>
156 <wizard
157 name="BitBake Recipe"
158 icon="icons/new_cheatsheet_wiz.gif"
159 category="org.yocto.bc.ui"
160 class="org.yocto.bc.ui.wizards.NewBitBakeFileRecipeWizard"
161 id="org.yocto.bc.ui.wizards.NewRecipeWizard">
162 </wizard>
163 </extension>
164 <extension
165 point="org.eclipse.ui.perspectives">
166 <perspective
167 class="org.yocto.bc.ui.perspectives.BitbakeCommanderPerspective"
168 icon="icons/icon16_OE.gif"
169 id="org.yocto.bc.ui.perspectives.BitbakeCommanderPerspective"
170 name="BitBake Commander">
171 </perspective>
172 </extension>
173 <extension
174 point="org.eclipse.ui.ide.filesystemSupport">
175 <filesystemContributor
176 class="org.yocto.bc.ui.filesystem.OEFileSystemContributor"
177 label="OpenEmbeddedFS"
178 scheme="OEFS">
179 </filesystemContributor>
180 </extension>
181 <extension
182 point="org.eclipse.core.filesystem.filesystems">
183 <filesystem
184 scheme="OEFS">
185 <run
186 class="org.yocto.bc.ui.filesystem.OEFileSystem">
187 </run>
188 </filesystem>
189 </extension>
190 <!--
191 <extension
192 point="org.eclipse.ui.views">
193 <category
194 id="org.yocto.bc.ui"
195 name="Yocto Bitbake Commander">
196 </category>
197 <view
198 category="org.yocto.bc.ui"
199 class="org.yocto.bc.ui.views.RecipeView"
200 icon="icons/cheatsheet_obj.gif"
201 id="org.yocto.bc.ui.views.RecipeView"
202 name="Recipes">
203 </view>
204 </extension>
205 -->
206 <extension
207 point="org.eclipse.ui.actionSets">
208 <actionSet
209 id="org.yocto.bc.ui.actionSet"
210 label="BitBake UI Action Set"
211 visible="true">
212 <action
213 class="org.yocto.bc.ui.actions.LaunchNewRecipeWizardAction"
214 icon="icons/new_cheatsheet_wiz.gif"
215 id="org.yocto.bc.ui.actions.NewRecipeAction"
216 label="&amp;New Recipe"
217 toolbarPath="bbuiGroup"
218 tooltip="New BitBake Recipe">
219 </action>
220 <action
221 class="org.yocto.bc.ui.actions.LaunchVariableWizardAction"
222 icon="icons/watchlist_view.gif"
223 id="org.yocto.bc.ui.actions.LaunchVariableWizardAction"
224 label="&amp;BitBake Variable Wizard"
225 toolbarPath="bbuiGroup2"
226 tooltip="BitBake Variables">
227 </action>
228 <action
229 class="org.yocto.bc.ui.actions.LaunchNewBitBakeProjectWizardAction"
230 icon="icons/cf_obj.gif"
231 id="org.yocto.bc.ui.wizards.project.NewProjectWizard"
232 label="New Project"
233 toolbarPath="bbuiGroup"
234 tooltip="New BitBake Commander Project">
235 </action>
236 </actionSet>
237 <!--
238 <actionSet
239 id="org.yocto.bc.ui.actionSet1"
240 label="Command Action Set"
241 visible="true">
242 <action
243 class="org.yocto.bc.ui.actions.BitbakeBuildRecipeAction"
244 enablesFor="+"
245 icon="icons/binary.gif"
246 id="org.yocto.bc.ui.BuildPackage"
247 label="Build Package"
248 toolbarPath="bbcGroup"
249 tooltip="Build Package">
250 </action>
251 <action
252 class="org.yocto.bc.ui.actions.BitbakeCleanRecipeAction"
253 enablesFor="+"
254 icon="icons/trash.gif"
255 id="org.yocto.bc.ui.CleanPackage"
256 label="Clean Package"
257 toolbarPath="bbcGroup"
258 tooltip="Clean Package">
259 </action>
260 <action
261 class="org.yocto.bc.ui.actions.BitbakeImportAction"
262 enablesFor="+"
263 icon="icons/import_wiz.gif"
264 id="org.yocto.bc.ui.ImportPackage"
265 label="Import Package"
266 toolbarPath="bbcGroup"
267 tooltip="Imports the Package as a Workspace Project">
268 </action>
269 <action
270 class="org.yocto.bc.ui.actions.BitbakeRebuildRecipeAction"
271 enablesFor="+"
272 icon="icons/refresh.gif"
273 id="org.yocto.bc.ui.RebuildPackage"
274 label="Rebuild Package"
275 toolbarPath="bbcGroup"
276 tooltip="Rebuild Package">
277 </action>
278 </actionSet>
279 -->
280 </extension>
281 <!--
282 <extension
283 point="org.eclipse.ui.importWizards">
284 <category
285 id="org.yocto.bc.ui.importWizards.sampleCategory"
286 name="Yocto BitBake Commander">
287 </category>
288 <wizard
289 category="org.yocto.bc.ui.importWizards.sampleCategory"
290 class="org.yocto.bc.ui.wizards.importProject.ImportYoctoProjectWizard"
291 icon="icons/icon16_OE.gif"
292 id="org.yocto.bc.ui.importWizards.ImportWizard"
293 name="Import Yocto Project">
294 <description>
295 Import an existing install of Yocto Project into your workspace.
296 </description>
297 </wizard>
298 </extension>
299 -->
300 <extension
301 point="org.eclipse.ui.decorators">
302 <decorator
303 adaptable="true"
304 class="org.yocto.bc.ui.decorators.ReadOnly"
305 id="org.yocto.bc.ui.decorators.ReadOnly"
306 label="Read-only Decorator"
307 lightweight="true"
308 state="true">
309 <enablement>
310 <and>
311 <objectClass
312 name="org.eclipse.core.resources.IResource">
313 </objectClass>
314 <or>
315 <objectClass
316 name="org.eclipse.core.resources.IFolder">
317 </objectClass>
318 <objectClass
319 name="org.eclipse.core.resources.IFile">
320 </objectClass>
321 </or>
322 </and>
323 </enablement>
324 </decorator>
325 <decorator
326 adaptable="true"
327 icon="icons/oe_decorator.gif"
328 id="org.yocto.bc.ui.decorator.project"
329 label="BBC Project Decorator"
330 lightweight="true"
331 location="TOP_RIGHT"
332 class="org.yocto.bc.ui.decorators.ProjectDecorator"
333 state="true">
334 <enablement>
335 <or>
336 <objectClass
337 name="org.eclipse.core.resources.IProject">
338 </objectClass>
339 </or>
340 </enablement>
341 </decorator>
342 </extension>
343
344</plugin>
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.bitbake;
12
13/**
14 * Constants for commonly used bitbake variables.
15 * @author kgilmer
16 *
17 */
18public class BBCommonVars {
19 public final static String WORKDIR = "WORKDIR";
20 public static final String PN = "PN";
21 public static final String S = "S";
22 public static final String PV = "PV";
23
24}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 * Lianhao Lu (Intel) - add more bitbake keywords and functions
11 *******************************************************************************/
12package org.yocto.bc.bitbake;
13
14import java.util.Comparator;
15import java.util.Map;
16import java.util.TreeMap;
17
18/**
19 * Here is where all BitBake-related information is centralized.
20 * @author kgilmer
21 *
22 */
23public class BBLanguageHelper {
24
25 public static final String[] BITBAKE_KEYWORDS = new String[] { "inherit", "require", "export", "addtask", "python", "include", "fakeroot", "addhandler", "def"};
26 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"};
27 public static final String[] BITBAKE_STANDARD_FUNCTIONS = new String[] { "fetch", "unpack", "patch", "configure", "compile", "install", "populate_sysroot", "package"};
28 public static final String BITBAKE_RECIPE_FILE_EXTENSION = "bb";
29
30 /**
31 * @return A map of names and descriptions of commonly used BitBake variables.
32 */
33 public static Map<String, String> getCommonBitbakeVariables() {
34 Map<String, String> m = new TreeMap<String, String>(new Comparator<Object>() {
35
36 public int compare(Object o1, Object o2) {
37
38 return ((String) o1).compareTo(((String) o2));
39 }
40
41 });
42
43 m.put("SECTION", "Category of package");
44 m.put("PR", "Package Release Number");
45 m.put("SRC_URI", "Location of package sources");
46 m.put("DESCRIPTION", "Description of package");
47 m.put("EXTRA_OEMAKE", "Extra flags to pass to the package makefile");
48 m.put("EXTRA_OECONF", "Extra configuration flags for the package makefile");
49 m.put("DEPENDS", "The set of build-time dependent packages");
50 m.put("RDEPENDS", "The set of run-time dependent packages");
51 m.put("HOMEPAGE", "Homepage of the package");
52 m.put("LICENSE", "License of the package");
53 m.put("FILES_${PN}", "Full file path of files on target.");
54 m.put("S", "Package source directory");
55 m.put("PV", "Package version");
56 m.put("AUTHOR", "Author or maintainer of package");
57 m.put("PRIORITY", "Priority of package");
58
59 return m;
60 }
61
62}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.bitbake;
12
13import java.io.IOException;
14
15import org.eclipse.jface.preference.JFacePreferences;
16import org.eclipse.jface.resource.JFaceResources;
17import org.eclipse.swt.widgets.Display;
18import org.eclipse.ui.console.ConsolePlugin;
19import org.eclipse.ui.console.IConsole;
20import org.eclipse.ui.console.MessageConsole;
21import org.eclipse.ui.console.MessageConsoleStream;
22
23/**
24 * Represents the bitbake environment of a recipe package.
25 * @author kgilmer
26 *
27 */
28public class BBRecipe extends BBSession {
29 private final BBSession session;
30 private final String filePath;
31
32 public BBRecipe(BBSession session, String filePath) throws IOException {
33 super(session.shell, session.pinfo.getRootPath());
34 this.session = session;
35 this.filePath = filePath;
36 this.parsingCmd = "DISABLE_SANITY_CHECKS=1 bitbake -e -b " + filePath;
37 }
38
39 @Override
40 public void initialize() throws Exception {
41 if (this.size() == 0) {
42 //System.out.println("Failed to parse " + filePath);
43 //throw new IOException("Failed to parse " + filePath);
44 }
45 }
46
47 protected String getDefaultDepends() {
48 return this.filePath;
49 }
50}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.bitbake;
12
13import java.io.BufferedReader;
14import java.io.File;
15import java.io.FileFilter;
16import java.io.IOException;
17import java.io.StringReader;
18import java.util.ArrayList;
19import java.util.Arrays;
20import java.util.Collection;
21import java.util.Hashtable;
22import java.util.Iterator;
23import java.util.List;
24import java.util.Map;
25import java.util.Set;
26import java.util.Stack;
27import java.util.concurrent.locks.ReentrantReadWriteLock;
28import java.util.concurrent.locks.Lock;
29
30import org.eclipse.core.resources.IFile;
31import org.eclipse.core.resources.IProject;
32import org.eclipse.core.resources.IResource;
33import org.eclipse.core.runtime.IProgressMonitor;
34import org.eclipse.core.runtime.IStatus;
35import org.eclipse.core.runtime.Status;
36import org.eclipse.jface.preference.JFacePreferences;
37import org.eclipse.jface.resource.JFaceResources;
38import org.eclipse.ui.console.ConsolePlugin;
39import org.eclipse.ui.console.IConsole;
40import org.eclipse.ui.console.IConsoleManager;
41import org.eclipse.ui.console.MessageConsole;
42import org.eclipse.ui.console.MessageConsoleStream;
43import org.eclipse.ui.progress.WorkbenchJob;
44
45import org.yocto.bc.ui.model.IModelElement;
46import org.yocto.bc.ui.model.ProjectInfo;
47
48/**
49 * BBSession encapsulates a global bitbake configuration and is the primary interface
50 * for actions against a BitBake installation.
51 *
52 * @author kgilmer
53 *
54 */
55public class BBSession implements IBBSessionListener, IModelElement, Map {
56 public static final int TYPE_VARIABLE_ASSIGNMENT = 1;
57 public static final int TYPE_UNKNOWN = 2;
58 public static final int TYPE_STATEMENT = 3;
59 public static final int TYPE_FLAG = 4;
60
61 public static final String BUILDDIR_INDICATORS [] = {
62 File.separatorChar + "conf" + File.separatorChar + "local.conf",
63 File.separatorChar + "conf" + File.separatorChar + "bblayers.conf",
64 };
65
66 protected final ProjectInfo pinfo;
67 protected final ShellSession shell;
68 protected Map properties = null;
69 protected List <String> depends = null;
70 protected boolean initialized = false;
71 protected MessageConsole sessionConsole;
72 private final ReentrantReadWriteLock rwlock = new ReentrantReadWriteLock();
73 private final Lock rlock = rwlock.readLock();
74 private final Lock wlock = rwlock.writeLock();
75 protected String parsingCmd;
76 private boolean silent = false;
77
78 public BBSession(ShellSession ssession, String projectRoot) throws IOException {
79 shell = ssession;
80 this.pinfo = new ProjectInfo();
81 pinfo.setLocation(projectRoot);
82 pinfo.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(projectRoot));
83 this.parsingCmd = "DISABLE_SANITY_CHECKS=1 bitbake -e";
84 }
85
86 public BBSession(ShellSession ssession, String projectRoot, boolean silent) throws IOException {
87 this(ssession, projectRoot);
88 this.silent = silent;
89 }
90
91 private Collection adapttoIPath(List<File> asList, IProject project) {
92
93 List pathList = new ArrayList();
94
95 for (Iterator i = asList.iterator(); i.hasNext();) {
96 File f = (File) i.next();
97 IFile ff = project.getFile(stripLeading(f.toString(), project.getLocationURI().getPath()));
98 if (ff.exists()) {
99 pathList.add(ff);
100 }
101 }
102
103 return pathList;
104 }
105
106 private String appendAll(String[] elems, int st) {
107 StringBuffer sb = new StringBuffer();
108
109 for (int i = st; i < elems.length; ++i) {
110 sb.append(elems[i]);
111 }
112
113 return sb.toString();
114 }
115
116 private int charCount(String trimmed, char c) {
117 int i = 0;
118 int p = 0;
119
120 while ((p = trimmed.indexOf(c, p)) > -1) {
121 i++;
122 p++;
123 }
124
125 return i;
126 }
127
128 public void clear() {
129 throw new RuntimeException("BB configuration is read-only.");
130 }
131
132 public boolean containsKey(Object arg0) {
133 try {
134 checkValidAndLock(true);
135 return properties.containsKey(arg0);
136 } catch (Exception e) {
137 e.printStackTrace();
138 return false;
139 }finally {
140 rlock.unlock();
141 }
142 }
143
144 public boolean containsValue(Object arg0) {
145 try {
146 checkValidAndLock(true);
147 return properties.containsValue(arg0);
148 } catch (Exception e) {
149 e.printStackTrace();
150 return false;
151 }finally {
152 rlock.unlock();
153 }
154 }
155
156 public Set entrySet() {
157 try {
158 checkValidAndLock(true);
159 return properties.entrySet();
160 } catch (Exception e) {
161 e.printStackTrace();
162 return null;
163 }finally {
164 rlock.unlock();
165 }
166 }
167
168 @Override
169 public boolean equals(Object arg0) {
170 try {
171 checkValidAndLock(true);
172 return properties.equals(arg0);
173 } catch (Exception e) {
174 e.printStackTrace();
175 return false;
176 }finally {
177 rlock.unlock();
178 }
179 }
180
181 public ShellSession getShell() {
182 return shell;
183 }
184
185 public String getProjInfoRoot() {
186 return pinfo.getRootPath();
187 }
188
189 /**
190 * Recursively generate list of Recipe files from a root directory.
191 *
192 * @param rootDir
193 * @param recipes
194 * @param fileExtension
195 * @param project
196 */
197 private void findRecipes(File rootDir, List recipes, final String fileExtension, IProject project) {
198 File[] children = rootDir.listFiles(new FileFilter() {
199
200 public boolean accept(File pathname) {
201 return pathname.isFile() && pathname.getName().endsWith(fileExtension);
202 }
203
204 });
205
206 if (children != null && children.length > 0) {
207 recipes.addAll(adapttoIPath(Arrays.asList(children), project));
208 }
209
210 File[] childDirs = rootDir.listFiles(new FileFilter() {
211
212 public boolean accept(File pathname) {
213 return pathname.isDirectory();
214 }
215
216 });
217
218 if (childDirs != null && childDirs.length > 0) {
219 for (int i = 0; i < childDirs.length; ++i) {
220 findRecipes(childDirs[i], recipes, fileExtension, project);
221 }
222 }
223 }
224
225 private Collection findRecipes(List paths, IProject project) {
226 List recipes = new ArrayList();
227
228 for (Iterator i = paths.iterator(); i.hasNext();) {
229 String rawPath = (String) i.next();
230 String[] elems = rawPath.split("\\*/\\*");
231
232 if (elems.length == 2) {
233
234 File rootDir = new File(elems[0]);
235
236 findRecipes(rootDir, recipes, elems[1], project);
237 }
238 }
239
240 return recipes;
241 }
242
243 public Object get(Object arg0) {
244 try {
245 checkValidAndLock(true);
246 return properties.get(arg0);
247 } catch (Exception e) {
248 e.printStackTrace();
249 return null;
250 }finally {
251 rlock.unlock();
252 }
253 }
254
255 private List getBitBakeKeywords() {
256 return Arrays.asList(BBLanguageHelper.BITBAKE_KEYWORDS);
257 }
258
259 /**
260 * @return A MessageConsole for this BB session.
261 */
262 public MessageConsole getConsole() {
263 if (sessionConsole == null) {
264 String cName = ProjectInfoHelper.getProjectName(pinfo.getRootPath()) + " Console";
265 IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager();
266 IConsole[] existing = conMan.getConsoles();
267 for (int i = 0; i < existing.length; i++)
268 if (cName.equals(existing[i].getName())) {
269 sessionConsole = (MessageConsole) existing[i];
270 break;
271 }
272 if (sessionConsole == null) {
273 sessionConsole = new MessageConsole(cName, null);
274 conMan.addConsoles(new IConsole[] { sessionConsole });
275 }
276 }
277
278 ConsolePlugin.getDefault().getConsoleManager().showConsoleView(sessionConsole);
279
280 return sessionConsole;
281 }
282
283 private int getLineType(String line) {
284
285 if (line.contains("=")) {
286 return TYPE_VARIABLE_ASSIGNMENT;
287 }
288
289 for (Iterator i = getBitBakeKeywords().iterator(); i.hasNext();) {
290 if (line.startsWith((String) i.next())) {
291 return TYPE_STATEMENT;
292 }
293 }
294
295 if (line.contains(":")) {
296 return TYPE_FLAG;
297 }
298
299 return TYPE_UNKNOWN;
300 }
301
302 public Collection getRecipeFiles(IProject project) {
303 try {
304 checkValidAndLock(true);
305 if (!initialized) {
306 throw new RuntimeException(this.getClass().getName() + " is not initialized.");
307 }
308 String bbfiles = (String) this.properties.get("BBFILES");
309 List paths = parseBBFiles(bbfiles);
310 return findRecipes(paths, project);
311 } catch (Exception e) {
312 return null;
313 }
314 finally {
315 rlock.unlock();
316 }
317 }
318
319 @Override
320 public int hashCode() {
321 try {
322 checkValidAndLock(true);
323 return properties.hashCode();
324 } catch (Exception e) {
325 e.printStackTrace();
326 return 0;
327 }finally {
328 rlock.unlock();
329 }
330 }
331
332 protected int checkExecuteError(String result, int code) {
333 String recipe = getDefaultDepends();
334 String text = "Parsing " + ((recipe != null) ? ("recipe " + recipe) : "base configurations");
335 if (code != 0) {
336 text = text + " ERROR!\n" + result;
337 }else {
338 text = text + " SUCCESS.\n";
339 }
340 if(!silent) {
341 displayInConsole(text, code, false);
342 }
343 return code;
344 }
345
346 protected void displayInConsole(final String result, final int code, boolean clear) {
347 MessageConsole console = getConsole();
348 final MessageConsoleStream info = console.newMessageStream();
349 if(clear)
350 console.clearConsole();
351 new WorkbenchJob("Display parsing result") {
352 public IStatus runInUIThread(IProgressMonitor monitor) {
353 if(code != 0) {
354 info.setColor(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
355 }
356 try {
357 info.println(result);
358 info.close();
359 }catch (Exception e) {
360 e.printStackTrace();
361 }
362 return Status.OK_STATUS;
363 }
364 }.schedule();
365 }
366
367 private void checkValidAndLock(boolean rdlck) throws Exception {
368 if(rdlck)
369 rlock.lock();
370 else
371 wlock.lock();
372 if(!initialized) {
373 //upgrade lock manually
374 if(rdlck) {
375 rlock.unlock();
376 wlock.lock();
377 }
378 try {
379 if(!initialized) { //recheck
380 int [] codes = {-1};
381 String result = shell.execute(parsingCmd, codes);
382 if(checkExecuteError(result, codes[0]) == 0) {
383 properties = parseBBEnvironment(result);
384 } else {
385 properties = parseBBEnvironment("");
386 }
387 initialized = true;
388 }
389 } finally {
390 //downgrade lock
391 if(rdlck) {
392 rlock.lock();
393 wlock.unlock();
394 }
395 }
396 }
397 //not release lock
398 }
399
400 public void initialize() throws Exception {
401 try {
402 checkValidAndLock(false);
403 }finally {
404 wlock.unlock();
405 }
406 }
407
408 private boolean isBlockEnd(String trimmed) {
409 return charCount(trimmed, '}') > charCount(trimmed, '{');
410 // return trimmed.indexOf('}') > -1 && trimmed.indexOf('{') == -1;
411 }
412
413 private boolean isBlockStart(String trimmed) {
414 return charCount(trimmed, '{') > charCount(trimmed, '}');
415 // return trimmed.indexOf('{') > -1 && trimmed.indexOf('}') == -1;
416 }
417
418 public boolean isEmpty() {
419 try {
420 checkValidAndLock(true);
421 return properties.isEmpty();
422 } catch (Exception e) {
423 e.printStackTrace();
424 return true;
425 }finally {
426 rlock.unlock();
427 }
428 }
429
430 public Set keySet() {
431 try {
432 checkValidAndLock(true);
433 return properties.keySet();
434 } catch (Exception e) {
435 e.printStackTrace();
436 return null;
437 }finally {
438 rlock.unlock();
439 }
440 }
441
442 protected void parse(String content, Map outMap) throws Exception {
443 BufferedReader reader = new BufferedReader(new StringReader(content));
444 String line;
445 boolean inLine = false;
446 StringBuffer sb = null;
447 Stack blockStack = new Stack();
448
449 while ((line = reader.readLine()) != null) {
450 String trimmed = line.trim();
451 if (trimmed.length() == 0 || line.startsWith("#")) {
452 // weed out the blank and comment lines
453 continue;
454 }
455 // Now we look for block start ends, and ignore all code within
456 // blocks.
457 if (isBlockStart(trimmed)) {
458 blockStack.push(trimmed);
459 } else if (isBlockEnd(trimmed)) {
460 blockStack.pop();
461
462 }
463
464 if (!blockStack.isEmpty()) {
465 // we are in a code block, continue until we break into global
466 // scope.
467 continue;
468 }
469 if (trimmed.endsWith("\\")) {
470 if (!inLine) {
471 inLine = true;
472 sb = new StringBuffer(trimmed.substring(0, trimmed.length() - 1));
473 } else {
474 sb.append(trimmed.substring(0, trimmed.length() - 1));
475 }
476 // Only parse the line when we have the complete contents.
477 continue;
478 } else if (inLine) {
479 inLine = false;
480 line = sb.toString();
481 }
482
483 parseLine(line, outMap);
484 }
485 }
486
487 private void parseAdditiveAssignment(String line, String operator, Map mo) throws Exception {
488 String[] elems = splitAssignment(line, "\\+=");
489
490 if (elems.length != 2) {
491 throw new Exception("Unable to parse additive variable assignment in line: " + line);
492 }
493
494 if (!mo.containsKey(elems[0])) {
495 mo.put(elems[0].trim(), elems[1]);
496 } else {
497 String existing = (String) mo.get(elems[0]);
498 if (operator.equals("+=")) {
499 mo.put(elems[0], existing + elems[1]);
500 } else {
501 mo.put(elems[0], elems[1] + existing);
502 }
503 }
504 }
505
506 protected String getDefaultDepends() {
507 return null;
508 }
509
510 protected Map parseBBEnvironment(String bbOut) throws Exception {
511 Map env = new Hashtable();
512 this.depends = new ArrayList<String>();
513
514 parse(bbOut, env);
515
516 String included = (String) env.get("BBINCLUDED");
517 if(getDefaultDepends() != null) {
518 this.depends.add(getDefaultDepends());
519 }
520 if(included != null) {
521 this.depends.addAll(Arrays.asList(included.split(" ")));
522 }
523
524 return env;
525 }
526
527
528 private List parseBBFiles(String bbfiles) {
529 return Arrays.asList(bbfiles.split(" "));
530 }
531
532 //Map delegate methods
533
534 private void parseConditionalAssignment(String line, Map mo) throws Exception {
535 String[] elems = splitAssignment(line, "\\?=");
536
537 if (elems.length != 2) {
538 throw new Exception("Unable to parse conditional variable assignment in line: " + line);
539 }
540
541 if (!mo.containsKey(elems[0].trim())) {
542 mo.put(elems[0].trim(), elems[1].trim());
543 }
544 }
545
546 private void parseImmediateAssignment(String line, String delimiter, Map mo) throws Exception {
547 String[] elems = splitAssignment(line, delimiter);
548
549 mo.put(elems[0], substitute(elems[1], mo));
550 }
551
552 private void parseKeyValue(String line, String delimiter, Map mo) throws Exception {
553 String[] elems = splitAssignment(line, delimiter);
554
555 mo.put(elems[0], elems[1]);
556 }
557
558 private void parseLine(String line, Map mo) throws Exception {
559
560 switch (getLineType(line)) {
561 case TYPE_VARIABLE_ASSIGNMENT:
562 parseVariableAssignment(line, mo);
563 break;
564 case TYPE_STATEMENT:
565 case TYPE_FLAG:
566 // for now ignore statements
567 break;
568 case TYPE_UNKNOWN:
569 // we'll gloss over unknown lines as well;
570 break;
571 default:
572 throw new Exception("Unable to parse line: " + line);
573 }
574 }
575
576 private void parseVariableAssignment(String line, Map mo) throws Exception {
577 if (line.contains("?=")) {
578 parseConditionalAssignment(line, mo);
579 } else if (line.contains("+=")) {
580 parseAdditiveAssignment(line, "+=", mo);
581 } else if (line.contains("=+")) {
582 parseAdditiveAssignment(line, "=+", mo);
583 } else if (line.contains(":=")) {
584 parseImmediateAssignment(line, ":=", mo);
585 } else {
586 parseKeyValue(line, "=", mo);
587 }
588
589 }
590
591 private List parseVars(String line) {
592 List l = new ArrayList();
593
594 int i = 0;
595
596 while ((i = line.indexOf("${", i)) > -1) {
597 int i2 = line.indexOf("}", i);
598
599 l.add(line.subSequence(i + 2, i2));
600 i++;
601 }
602
603 return l;
604 }
605
606 public Object put(Object arg0, Object arg1) {
607 throw new RuntimeException("BB configuration is read-only.");
608 }
609
610 public void putAll(Map arg0) {
611 throw new RuntimeException("BB configuration is read-only.");
612 }
613
614 public Object remove(Object arg0) {
615 throw new RuntimeException("BB configuration is read-only.");
616 }
617
618 private String removeQuotes(String line) {
619 line = line.trim();
620
621 if (line.startsWith("\"")) {
622 line = line.substring(1);
623 }
624
625 if (line.endsWith("\"")) {
626 line = line.substring(0, line.length() - 1);
627 }
628
629 return line;
630 }
631
632 public int size() {
633 try {
634 checkValidAndLock(true);
635 return properties.size();
636 }catch (Exception e) {
637 e.printStackTrace();
638 return 0;
639 }finally {
640 rlock.unlock();
641 }
642 }
643
644 private String[] splitAssignment(String line, String seperator) throws Exception {
645 String[] elems = line.split(seperator);
646
647 if (elems.length < 2) {
648 throw new Exception("Unable to parse assignment in line: " + line);
649 } else if (elems.length == 2) {
650
651 elems[0] = elems[0].trim(); // Clean up trailing or leading spaces.
652 if (elems[0].startsWith("export ")) {
653 elems[0] = elems[0].substring("export ".length()).trim();
654 }
655 elems[1] = removeQuotes(elems[1]); // Evaluate variables
656
657 return elems;
658 } else {
659 String[] retVal = new String[2];
660
661 retVal[0] = elems[0];
662 if (retVal[0].startsWith("export ")) {
663 retVal[0] = retVal[0].substring("export ".length()).trim();
664 }
665 retVal[1] = appendAll(elems, 1);
666
667 return retVal;
668 }
669 }
670
671 private String stripLeading(String target, String leading) {
672 if (target.startsWith(leading)) {
673 target = target.substring(leading.length());
674 }
675
676 return target;
677 }
678
679 /**
680 * Return a string with variable substitutions in place.
681 *
682 * @param expression
683 * @return Input string with any substitutions from this file.
684 */
685 public String substitute(String expression, Map mo) {
686
687 List vars = parseVars(expression);
688
689 for (Iterator i = vars.iterator(); i.hasNext();) {
690 String varName = (String) i.next();
691 String varToken = "${" + varName + "}";
692
693 if (mo.containsKey(varName)) {
694 expression = expression.replace(varToken, (String) mo.get(varName));
695 } else if (System.getProperty(varName) != null) {
696 expression = expression.replace(varToken, System.getProperty(varName));
697 } else if (varName.toUpperCase().equals("HOME")) {
698 expression = expression.replace(varToken, System.getProperty("user.home"));
699 }
700 }
701
702 return expression;
703 }
704
705 public Collection values() {
706 try {
707 checkValidAndLock(true);
708 return properties.values();
709 } catch (Exception e) {
710 e.printStackTrace();
711 return null;
712 }finally {
713 rlock.unlock();
714 }
715 }
716
717 public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed) {
718 wlock.lock();
719 try {
720 if (initialized && (removed != null || changed != null)) {
721 for(int i=0;removed != null && i<removed.length;i++) {
722 if (this.depends.contains(removed[i].getLocation().toString())) {
723 initialized = false;
724 return;
725 }
726 }
727 for(int i=0;changed != null && i<changed.length;i++) {
728 if (this.depends.contains(changed[i].getLocation().toString())) {
729 initialized = false;
730 return;
731 }
732 }
733 }
734 }
735 finally {
736 wlock.unlock();
737 }
738 }
739}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java
new file mode 100644
index 0000000..4d0054f
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java
@@ -0,0 +1,18 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11
12package org.yocto.bc.bitbake;
13
14import org.eclipse.core.resources.IResource;
15
16public interface IBBSessionListener {
17 public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed);
18}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ICommandResponseHandler.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ICommandResponseHandler.java
new file mode 100644
index 0000000..4c44352
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ICommandResponseHandler.java
@@ -0,0 +1,15 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.bitbake;
12
13public interface ICommandResponseHandler {
14 public void response(String line, boolean isError);
15}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
new file mode 100644
index 0000000..25dac97
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
@@ -0,0 +1,105 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.bitbake;
12
13import java.io.BufferedReader;
14import java.io.File;
15import java.io.FileOutputStream;
16import java.io.FileReader;
17import java.io.IOException;
18
19import org.eclipse.core.resources.IProject;
20import org.eclipse.core.resources.ResourcesPlugin;
21
22import org.yocto.bc.ui.model.ProjectInfo;
23
24/**
25 * A helper class for ProjectInfo related tasks.
26 *
27 * @author kgilmer
28 *
29 */
30public class ProjectInfoHelper {
31
32 protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
33 /**
34 * @param path
35 * @return The path to bitbake init script
36 * @throws IOException
37 */
38 public static String getInitScriptPath(String path) throws IOException {
39 String val = path + File.separator + DEFAULT_INIT_SCRIPT;
40
41 File inFile = new File(path, ".eclipse-data");
42 if(inFile.exists()) {
43 BufferedReader br = new BufferedReader(new FileReader(inFile));
44 val = br.readLine();
45 br.close();
46 }
47
48 return val;
49 }
50
51 public static String getInitScript(String path) throws IOException {
52 File inFile = new File(path);
53 BufferedReader br = new BufferedReader(new FileReader(inFile));
54 StringBuffer sb = new StringBuffer();
55 String line = null;
56
57 while ((line = br.readLine()) != null) {
58 sb.append(line);
59 }
60
61 br.close();
62
63 return sb.toString();
64 }
65
66 public static String getProjectName(String projectRoot) {
67 IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
68 for (int i = 0; i < projects.length; ++i) {
69 try {
70 if (projects[i].getLocationURI().getPath().equals(projectRoot)) {
71 return projects[i].getName();
72 }
73
74 } catch (Exception e) {
75 // TODO Auto-generated catch block
76 e.printStackTrace();
77 }
78 }
79
80 return null;
81 }
82
83 /**
84 * This method will store the path to the bitbake init script for future
85 * reference.
86 *
87 * @param path
88 * @param projInfo
89 * @throws IOException
90 */
91 public static void store(String path, ProjectInfo projInfo) throws IOException {
92 writeToFile(path, projInfo.getInitScriptPath());
93 }
94
95 private static void writeToFile(String path, String init) throws IOException {
96 File outFile = new File(path, ".eclipse-data");
97 FileOutputStream fos = new FileOutputStream(outFile);
98
99 fos.write(init.getBytes());
100
101 fos.flush();
102 fos.close();
103 }
104
105}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
new file mode 100644
index 0000000..4719865
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
@@ -0,0 +1,248 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.bitbake;
12
13import java.io.BufferedReader;
14import java.io.File;
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.InputStreamReader;
18import java.io.OutputStream;
19import java.io.Writer;
20
21/**
22 * A class for Linux shell sessions.
23 * @author kgilmer
24 *
25 */
26public class ShellSession {
27 /**
28 * Bash shell
29 */
30 public static final int SHELL_TYPE_BASH = 1;
31 /**
32 * sh shell
33 */
34 public static final int SHELL_TYPE_SH = 2;
35 private volatile boolean interrupt = false;
36 /**
37 * String used to isolate command execution
38 */
39 public static final String TERMINATOR = "#234o987dsfkcqiuwey18837032843259d";
40 public static final String LT = System.getProperty("line.separator");
41
42 public static String getFilePath(String file) throws IOException {
43 File f = new File(file);
44
45 if (!f.exists() || f.isDirectory()) {
46 throw new IOException("Path passed is not a file: " + file);
47 }
48
49 StringBuffer sb = new StringBuffer();
50
51 String elems[] = file.split(File.separator);
52
53 for (int i = 0; i < elems.length - 1; ++i) {
54 sb.append(elems[i]);
55 sb.append(File.separator);
56 }
57
58 return sb.toString();
59 }
60 private Process process;
61
62 private OutputStream pos = null;
63 //private File initFile = null;
64 private String shellPath = null;
65 private final String initCmd;
66 private final File root;
67 private final Writer out;
68
69
70 public ShellSession(int shellType, File root, String initCmd, Writer out) throws IOException {
71 this.root = root;
72 this.initCmd = initCmd;
73 if (out == null) {
74 this.out = new NullWriter();
75 } else {
76 this.out = out;
77 }
78 if (shellType == SHELL_TYPE_SH) {
79 shellPath = "/bin/sh";
80 }
81 shellPath = "/bin/bash";
82
83 initializeShell();
84 }
85
86 private void initializeShell() throws IOException {
87 process = Runtime.getRuntime().exec(shellPath);
88 pos = process.getOutputStream();
89
90 if (root != null) {
91 out.write(execute("cd " + root.getAbsolutePath()));
92 }
93
94 if (initCmd != null) {
95 out.write(execute("source " + initCmd));
96 }
97 }
98
99 synchronized
100 public String execute(String command) throws IOException {
101 return execute(command, (int [])null);
102 }
103
104 synchronized
105 public String execute(String command, int[] retCode) throws IOException {
106 String errorMessage = null;
107 interrupt = false;
108 out.write(command);
109 out.write(LT);
110
111 sendToProcessAndTerminate(command);
112
113 if (process.getErrorStream().available() > 0) {
114 byte[] msg = new byte[process.getErrorStream().available()];
115
116 process.getErrorStream().read(msg, 0, msg.length);
117 out.write(new String(msg));
118 out.write(LT);
119 errorMessage = "Error while executing: " + command + LT + new String(msg);
120 }
121
122 BufferedReader br = new BufferedReader(new InputStreamReader(process
123 .getInputStream()));
124
125 StringBuffer sb = new StringBuffer();
126 String line = null;
127
128 while (((line = br.readLine()) != null) && !line.endsWith(TERMINATOR) && !interrupt) {
129 sb.append(line);
130 sb.append(LT);
131 out.write(line);
132 out.write(LT);
133 }
134
135 if (interrupt) {
136 process.destroy();
137 initializeShell();
138 interrupt = false;
139 }else if (line != null && retCode != null) {
140 try {
141 retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR)));
142 }catch (NumberFormatException e) {
143 throw new IOException("Can NOT get return code" + command + LT + line);
144 }
145 }
146
147 if (errorMessage != null) {
148 throw new IOException(errorMessage);
149 }
150
151 return sb.toString();
152 }
153
154synchronized
155 public void execute(String command, ICommandResponseHandler handler) throws IOException {
156 System.out.println(command);
157 execute(command, TERMINATOR, handler);
158 }
159
160 synchronized
161 public void execute(String command, String terminator, ICommandResponseHandler handler) throws IOException {
162 interrupt = false;
163 InputStream errIs = process.getErrorStream();
164 if (errIs.available() > 0) {
165 clearErrorStream(errIs);
166 }
167 sendToProcessAndTerminate(command);
168
169 BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
170 String std = null;
171
172 do {
173 if (errIs.available() > 0) {
174 byte[] msg = new byte[errIs.available()];
175
176 errIs.read(msg, 0, msg.length);
177 out.write(new String(msg));
178 handler.response(new String(msg), true);
179 }
180
181 std = br.readLine();
182
183 if (std != null && !std.endsWith(terminator)) {
184 out.write(std);
185 handler.response(std, false);
186 }
187
188 } while (std != null && !std.endsWith(terminator) && !interrupt);
189
190 if (interrupt) {
191 process.destroy();
192 initializeShell();
193 interrupt = false;
194 }
195 }
196
197 private void clearErrorStream(InputStream is) {
198
199 try {
200 byte b[] = new byte[is.available()];
201 is.read(b);
202 System.out.println("clearing: " + new String(b));
203 } catch (IOException e) {
204 e.printStackTrace();
205 //Ignore any error
206 }
207 }
208
209 /**
210 * Send command string to shell process and add special terminator string so
211 * reader knows when output is complete.
212 *
213 * @param command
214 * @throws IOException
215 */
216 private void sendToProcessAndTerminate(String command) throws IOException {
217 pos.write(command.getBytes());
218 pos.write(LT.getBytes());
219 pos.flush();
220 pos.write("echo $?".getBytes());
221 pos.write(TERMINATOR.getBytes());
222 pos.write(LT.getBytes());
223 pos.flush();
224 }
225
226 /**
227 * Interrupt any running processes.
228 */
229 public void interrupt() {
230 interrupt = true;
231 }
232
233 private class NullWriter extends Writer {
234
235 @Override
236 public void close() throws IOException {
237 }
238
239 @Override
240 public void flush() throws IOException {
241 }
242
243 @Override
244 public void write(char[] cbuf, int off, int len) throws IOException {
245 }
246
247 }
248}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui;
12
13import java.io.File;
14import java.io.IOException;
15import java.io.Writer;
16import java.lang.reflect.InvocationTargetException;
17import java.util.Hashtable;
18import java.util.Iterator;
19import java.util.Map;
20
21import org.eclipse.core.resources.IProject;
22import org.eclipse.core.resources.IResource;
23import org.eclipse.core.resources.IResourceChangeEvent;
24import org.eclipse.core.resources.IResourceChangeListener;
25import org.eclipse.core.resources.ResourcesPlugin;
26import org.eclipse.core.runtime.CoreException;
27import org.eclipse.jface.resource.ImageDescriptor;
28import org.eclipse.jface.resource.ImageRegistry;
29import org.eclipse.ui.plugin.AbstractUIPlugin;
30import org.osgi.framework.BundleContext;
31
32import org.yocto.bc.bitbake.BBRecipe;
33import org.yocto.bc.bitbake.BBSession;
34import org.yocto.bc.bitbake.ProjectInfoHelper;
35import org.yocto.bc.bitbake.ShellSession;
36import org.yocto.bc.ui.model.ProjectInfo;
37import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation;
38
39public class Activator extends AbstractUIPlugin {
40
41 // The plug-in ID
42 public static final String PLUGIN_ID = "org.yocto.bc.ui";
43 public static final String IMAGE_VARIABLE = "IMAGE_VARIABLE";
44 public static final String IMAGE_FUNCTION = "IMAGE_FUNCTION";
45
46 // The shared instance
47 private static Activator plugin;
48 private static Map shellMap;
49 private static Map projInfoMap;
50 private static Hashtable bbSessionMap;
51 private static Hashtable bbRecipeMap;
52
53 private IResourceChangeListener listener = new BCResourceChangeListener();
54
55 public static BBRecipe getBBRecipe(BBSession session, String filePath) throws IOException {
56 if (bbRecipeMap == null) {
57 bbRecipeMap = new Hashtable();
58 }
59
60 String key = session.getProjInfoRoot() + filePath;
61 BBRecipe recipe = (BBRecipe) bbRecipeMap.get(key);
62 if (recipe == null) {
63 recipe = new BBRecipe(session,filePath);
64 bbRecipeMap.put(key, recipe);
65 }
66
67 return recipe;
68 }
69
70 /**
71 * Get or create a BitBake session passing in ProjectInfo
72 * @param pinfo
73 * @return
74 * @throws IOException
75 */
76 public static BBSession getBBSession(String projectRoot, Writer out) throws IOException {
77 if (bbSessionMap == null) {
78 bbSessionMap = new Hashtable();
79 }
80
81 BBSession bbs = (BBSession) bbSessionMap.get(projectRoot);
82
83 if (bbs == null) {
84 bbs = new BBSession(getShellSession(projectRoot, out), projectRoot);
85 bbSessionMap.put(projectRoot, bbs);
86 }
87
88 return bbs;
89 }
90
91 /**
92 * Get or create a BitBake session passing in ProjectInfo
93 * @param pinfo
94 * @return
95 * @throws IOException
96 */
97 public static BBSession getBBSession(String projectRoot) throws IOException {
98 if (bbSessionMap == null) {
99 bbSessionMap = new Hashtable();
100 }
101
102 BBSession bbs = (BBSession) bbSessionMap.get(projectRoot);
103
104 if (bbs == null) {
105 bbs = new BBSession(getShellSession(projectRoot, null), projectRoot);
106 bbSessionMap.put(projectRoot, bbs);
107 }
108
109 return bbs;
110 }
111
112 /**
113 * Returns the shared instance
114 *
115 * @return the shared instance
116 */
117 public static Activator getDefault() {
118 return plugin;
119 }
120
121 /**
122 * Returns an image descriptor for the image file at the given
123 * plug-in relative path
124 *
125 * @param path the path
126 * @return the image descriptor
127 */
128 public static ImageDescriptor getImageDescriptor(String path) {
129 return imageDescriptorFromPlugin(PLUGIN_ID, path);
130 }
131
132 public static ProjectInfo getProjInfo(String location) throws CoreException, InvocationTargetException, InterruptedException {
133 if (projInfoMap == null) {
134 projInfoMap = new Hashtable();
135 }
136
137 ProjectInfo pi = (ProjectInfo) projInfoMap.get(location);
138
139 if (pi == null) {
140 pi = new ProjectInfo();
141 pi.setLocation(location);
142 try {
143 pi.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(location));
144 } catch (IOException e) {
145 throw new InvocationTargetException(e);
146 }
147 }
148
149 return pi;
150 }
151
152 public static void notifyAllBBSession(IResource[] added, IResource[] removed, IResource[] changed) {
153 Iterator iter;
154 if(bbRecipeMap != null) {
155 iter = bbRecipeMap.values().iterator();
156 while(iter.hasNext()) {
157 BBRecipe p = (BBRecipe)iter.next();
158 p.changeNotified(added, removed, changed);
159 }
160 }
161
162 if(bbSessionMap != null) {
163 iter= bbSessionMap.values().iterator();
164 while(iter.hasNext()) {
165 BBSession p = (BBSession)iter.next();
166 p.changeNotified(added, removed, changed);
167 }
168 }
169 }
170
171 /**
172 * @param absolutePath
173 * @return a cached shell session for a given project root.
174 * @throws IOException
175 */
176 private static ShellSession getShellSession(String absolutePath, Writer out) throws IOException {
177 if (shellMap == null) {
178 shellMap = new Hashtable();
179 }
180
181 ShellSession ss = (ShellSession) shellMap.get(absolutePath);
182
183 if (ss == null) {
184 ss = new ShellSession(ShellSession.SHELL_TYPE_BASH, new File(absolutePath), ProjectInfoHelper.getInitScriptPath(absolutePath), out);
185 }
186
187 return ss;
188 }
189
190 private static String loadInit(String absolutePath) throws CoreException {
191 IProject [] prjs = ResourcesPlugin.getWorkspace().getRoot().getProjects();
192 IProject foundPrj = null;
193
194 for (int i = 0; i < prjs.length; ++i) {
195 IProject p = prjs[i];
196
197 System.out
198 .println(p.getDescription().getLocationURI().getPath());
199
200 if (p.getDescription().getLocationURI().getPath().equals(absolutePath)) {
201 foundPrj = p;
202 break;
203 }
204 }
205
206 if (foundPrj == null) {
207 throw new RuntimeException("Unable to find project associated with path! " + absolutePath);
208 }
209
210 return foundPrj.getPersistentProperty(CreateBBCProjectOperation.BBC_PROJECT_INIT);
211 }
212
213 public static void putProjInfo(String location, ProjectInfo pinfo) {
214 if (projInfoMap == null) {
215 projInfoMap = new Hashtable();
216 }
217
218
219
220 projInfoMap.put(location, pinfo);
221 }
222
223 /**
224 * The constructor
225 */
226 public Activator() {
227 }
228
229 /*
230 * (non-Javadoc)
231 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
232 */
233 @Override
234 public void start(BundleContext context) throws Exception {
235 super.start(context);
236 plugin = this;
237 ResourcesPlugin.getWorkspace().addResourceChangeListener(
238 listener, IResourceChangeEvent.POST_CHANGE);
239 }
240
241 /*
242 * (non-Javadoc)
243 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
244 */
245 @Override
246 public void stop(BundleContext context) throws Exception {
247 ResourcesPlugin.getWorkspace().removeResourceChangeListener(
248 listener);
249 plugin = null;
250 super.stop(context);
251 }
252
253 /**
254 * Reset a configuration
255 * @param path
256 */
257 public static void resetBBSession(String path) {
258 shellMap.remove(path);
259 bbSessionMap.remove(path);
260 }
261
262 protected void initializeImageRegistry(ImageRegistry reg) {
263 reg.put(IMAGE_VARIABLE, Activator.getImageDescriptor("icons/variable.gif"));
264 reg.put(IMAGE_FUNCTION, Activator.getImageDescriptor("icons/function.gif"));
265 }
266}
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 @@
1package org.yocto.bc.ui;
2
3import java.util.HashSet;
4
5import org.eclipse.core.resources.IFile;
6import org.eclipse.core.resources.IProject;
7import org.eclipse.core.resources.IResourceChangeEvent;
8import org.eclipse.core.resources.IResourceChangeListener;
9import org.eclipse.core.resources.IResource;
10import org.eclipse.core.resources.IResourceDelta;
11import org.eclipse.core.resources.IResourceDeltaVisitor;
12import org.eclipse.core.runtime.*;
13import org.yocto.bc.ui.builder.BitbakeCommanderNature;
14
15public class BCResourceChangeListener implements IResourceChangeListener {
16
17 public void resourceChanged(IResourceChangeEvent event) {
18 final HashSet<IResource> removed = new HashSet<IResource>();
19 final HashSet<IResource> changed = new HashSet<IResource>();
20 switch (event.getType()) {
21 case IResourceChangeEvent.POST_CHANGE:
22 try {
23 event.getDelta().accept(new IResourceDeltaVisitor() {
24 public boolean visit(IResourceDelta delta) throws CoreException {
25 IResource res = delta.getResource();
26 Boolean visit= true;
27 if (res instanceof IProject) {
28 visit = false;
29 try {
30 if(((IProject) res).isOpen() &&
31 ((IProject) res).hasNature(BitbakeCommanderNature.NATURE_ID)){
32 visit = true;
33 }
34 }catch (CoreException e) {
35 }
36 }
37 if (visit && (res instanceof IFile))
38 {
39 switch (delta.getKind()) {
40 case IResourceDelta.REMOVED:
41 removed.add(res);
42 break;
43 case IResourceDelta.CHANGED:
44 changed.add(res);
45 break;
46 }
47 }
48 return visit; // visit the children
49 }
50 });
51 //notify all the sessions
52 Activator.notifyAllBBSession(null,
53 removed.toArray(new IResource[removed.size()]),
54 changed.toArray(new IResource[changed.size()]));
55
56 }catch (CoreException e) {
57 e.printStackTrace();
58 }
59 break;
60 default:
61 break;
62 }
63 }
64}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import java.io.IOException;
14
15import org.eclipse.core.resources.IFile;
16import org.eclipse.core.resources.IProject;
17import org.eclipse.core.runtime.CoreException;
18import org.eclipse.core.runtime.IProgressMonitor;
19import org.eclipse.core.runtime.IStatus;
20import org.eclipse.core.runtime.Status;
21import org.eclipse.core.runtime.jobs.Job;
22import org.eclipse.jface.action.IAction;
23import org.eclipse.jface.preference.JFacePreferences;
24import org.eclipse.jface.resource.JFaceResources;
25import org.eclipse.jface.viewers.ISelection;
26import org.eclipse.jface.viewers.IStructuredSelection;
27import org.eclipse.swt.graphics.Color;
28import org.eclipse.ui.IWorkbenchWindow;
29import org.eclipse.ui.IWorkbenchWindowActionDelegate;
30import org.eclipse.ui.console.MessageConsole;
31import org.eclipse.ui.console.MessageConsoleStream;
32
33import org.yocto.bc.bitbake.BBLanguageHelper;
34import org.yocto.bc.bitbake.BBSession;
35import org.yocto.bc.bitbake.ICommandResponseHandler;
36import org.yocto.bc.ui.Activator;
37import org.yocto.bc.ui.builder.BitbakeCommanderNature;
38
39public abstract class AbstractBitbakeCommandAction implements IWorkbenchWindowActionDelegate {
40
41 private class CommandJob extends Job {
42
43 public CommandJob() {
44 super(getJobTitle());
45 }
46
47 @Override
48 protected IStatus run(IProgressMonitor monitor) {
49 String cmds[] = getCommands();
50 return execCommands(cmds, monitor);
51 }
52
53 }
54 protected IAction action;
55 protected IFile recipe;
56 protected BBSession bbs;
57
58 private Color commandColor, responseColor, errorColor;
59 private boolean errorOccurred = false;
60
61 public AbstractBitbakeCommandAction() {
62 commandColor = JFaceResources.getColorRegistry().get(JFacePreferences.ACTIVE_HYPERLINK_COLOR);
63 responseColor = JFaceResources.getColorRegistry().get(JFacePreferences.HYPERLINK_COLOR);
64 errorColor = JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR);
65 }
66
67 private void checkEnabled(IFile file) {
68 try {
69 if (file.getFileExtension() == null || !file.getFileExtension().equals(BBLanguageHelper.BITBAKE_RECIPE_FILE_EXTENSION)) {
70 action.setEnabled(false);
71 return;
72 }
73
74 IProject project = file.getProject();
75 if (!(project.hasNature(BitbakeCommanderNature.NATURE_ID))) {
76 action.setEnabled(false);
77 return;
78 }
79
80 bbs = Activator.getBBSession(project.getLocationURI().getPath());
81
82 if (bbs != null) {
83 recipe = file;
84 action.setEnabled(true);
85 }
86
87 } catch (CoreException e) {
88 action.setEnabled(false);
89 e.printStackTrace();
90 } catch (Exception e) {
91 action.setEnabled(false);
92 e.printStackTrace();
93 }
94 }
95
96 public void dispose() {
97 }
98
99 /**
100 * Execute array of commands with bitbake and put output in console.
101 *
102 * @param cmds
103 * @param monitor
104 * @return
105 */
106 protected IStatus execCommands(String[] cmds, final IProgressMonitor monitor) {
107 MessageConsole mc = bbs.getConsole();
108 final MessageConsoleStream cmd = mc.newMessageStream();
109 cmd.setColor(commandColor);
110 final MessageConsoleStream out = mc.newMessageStream();
111 final MessageConsoleStream err = mc.newMessageStream();
112 err.setColor(errorColor);
113
114 try {
115 for (int i = 0; i < cmds.length; ++i) {
116 cmd.println(cmds[i]);
117 monitor.subTask(cmds[i]);
118 bbs.getShell().execute(cmds[i], new ICommandResponseHandler() {
119
120 public void response(String line, boolean isError) {
121 if (monitor.isCanceled()) {
122 cmd.println("Interrupting process by user request.");
123 bbs.getShell().interrupt();
124 }
125
126 if (isError) {
127 err.println(line);
128 errorOccurred();
129 } else if (line.startsWith("ERROR:")) {
130 err.println(line);
131 } else {
132 out.println(line);
133 }
134 }
135 });
136 }
137 } catch (IOException e) {
138 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
139 } finally {
140 try {
141 if (errorOccurred) {
142 cmd.println("At least one error occured while executing this command. Check output for more details.");
143 }
144 cmd.close();
145 out.close();
146 err.close();
147 } catch (IOException e) {
148 e.printStackTrace();
149 }
150 }
151
152 return Status.OK_STATUS;
153 }
154
155 protected void errorOccurred() {
156 errorOccurred = true;
157 }
158
159 /**
160 * Return the command to be executed.
161 *
162 * @return
163 */
164 public abstract String[] getCommands();
165
166 public Job getJob() {
167 return new CommandJob();
168 }
169
170 /**
171 * Return the title of the job.
172 *
173 * @return
174 */
175 public abstract String getJobTitle();
176
177 public void init(IWorkbenchWindow window) {
178 }
179
180 public void run(IAction action) {
181 Job job = getJob();
182 job.schedule();
183 }
184
185 public void selectionChanged(IAction action, ISelection selection) {
186 this.action = action;
187 if (selection instanceof IStructuredSelection) {
188 Object sel = ((IStructuredSelection) selection).getFirstElement();
189
190 if (sel instanceof IFile) {
191 checkEnabled((IFile) sel);
192 return;
193 }
194 }
195
196 action.setEnabled(false);
197 }
198
199} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13public class BitbakeBuildRecipeAction extends AbstractBitbakeCommandAction {
14
15 @Override
16 public String [] getCommands() {
17 return new String[] {"bitbake -b " + recipe.getLocationURI().getPath()};
18 }
19
20 @Override
21 public String getJobTitle() {
22 return "Building " + recipe.getName();
23 }
24} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13public class BitbakeCleanRecipeAction extends AbstractBitbakeCommandAction {
14
15 @Override
16 public String [] getCommands() {
17 return new String[] {"bitbake -c clean -b " + recipe.getLocationURI().getPath()};
18 }
19
20 @Override
21 public String getJobTitle() {
22 return "Cleaning " + recipe.getName();
23 }
24
25
26} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import java.io.File;
14
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.resources.IProjectDescription;
17import org.eclipse.core.resources.IResource;
18import org.eclipse.core.resources.IWorkspaceRoot;
19import org.eclipse.core.resources.ResourcesPlugin;
20import org.eclipse.core.runtime.IProgressMonitor;
21import org.eclipse.core.runtime.IStatus;
22import org.eclipse.core.runtime.Status;
23import org.eclipse.core.runtime.jobs.Job;
24
25import org.yocto.bc.bitbake.BBCommonVars;
26import org.yocto.bc.bitbake.BBRecipe;
27import org.yocto.bc.ui.Activator;
28
29public class BitbakeImportAction extends AbstractBitbakeCommandAction {
30
31 private class ImportJob extends Job {
32
33 public ImportJob() {
34 super(getJobTitle());
35 }
36
37 @Override
38 protected IStatus run(IProgressMonitor monitor) {
39
40 try {
41 BBRecipe br = new BBRecipe(bbs, recipe.getLocationURI().getPath());
42 br.initialize();
43 String filePath = (String) br.get(BBCommonVars.S);
44
45 //"${WORKDIR}/${PN}-${PV}"
46 if (filePath == null) {
47 filePath = ((String) br.get(BBCommonVars.WORKDIR)) + File.separator + ((String) br.get(BBCommonVars.PN)) + "-" + ((String) br.get(BBCommonVars.PV));
48 }
49
50 String projectName = (String) br.get(BBCommonVars.PN);
51
52 if (filePath == null || projectName == null) {
53 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to parse recipe file.");
54 }
55
56 File workdir = new File(filePath);
57
58 if (workdir.exists() && workdir.isFile()) {
59 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, workdir.getPath() + " is an invalid workdir.");
60 }
61
62 if (!workdir.exists()) {
63 execCommands(new String[] {"bitbake -c patch -b " + recipe.getLocationURI().getPath()}, monitor);
64 }
65
66 if (!workdir.exists()) {
67 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to retrieve sources from BitBake. Consult console.");
68 }
69
70 IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
71 IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
72 IProject proj = wsroot.getProject(projectName);
73 proj.create(desc, monitor);
74 proj.open(monitor);
75
76 String copyCmd = "cp -r " + workdir.getAbsolutePath() + File.separator + "* \"" + proj.getLocationURI().getPath() + "\"";
77 execCommands(new String[] {copyCmd} , monitor);
78
79 proj.refreshLocal(IResource.DEPTH_INFINITE, monitor);
80
81 } catch (Exception e) {
82 e.printStackTrace();
83 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to create project.", e);
84 }
85
86 return Status.OK_STATUS;
87 }
88
89 }
90
91 @Override
92 public String [] getCommands() {
93 return null;
94 }
95
96
97 @Override
98 public Job getJob() {
99 return new ImportJob();
100 }
101
102 @Override
103 public String getJobTitle() {
104 return "Importing " + recipe.getName();
105 }
106} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13/**
14 * Rebuild a recipe.
15 * @author kgilmer
16 *
17 */
18public class BitbakeRebuildRecipeAction extends AbstractBitbakeCommandAction {
19
20 @Override
21 public String [] getCommands() {
22 return new String[] {"bitbake -c rebuild -b " + recipe.getLocationURI().getPath()};
23 }
24
25 @Override
26 public String getJobTitle() {
27 return "Rebuilding " + recipe.getName();
28 }
29} \ 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 @@
1/*******************************************************************************
2 * Copyright (c) 2011 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import org.eclipse.ui.PlatformUI;
14import org.eclipse.ui.IWorkbench;
15import org.eclipse.ui.IWorkbenchPage;
16import org.eclipse.ui.IWorkbenchWindow;
17
18import org.eclipse.core.resources.IProject;
19import org.eclipse.core.resources.IResource;
20import org.eclipse.core.runtime.IAdaptable;
21import org.eclipse.jface.action.IAction;
22import org.eclipse.jface.viewers.ISelection;
23import org.eclipse.jface.viewers.IStructuredSelection;
24
25import org.eclipse.swt.widgets.Shell;
26
27import org.yocto.bc.ui.builder.BitbakeCommanderNature;
28
29
30public class LaunchHobAction {
31 private static final String DIALOG_TITLE = "Launch HOB";
32
33 public void run(IAction action) {
34 IResource resource = getSelectedResource();
35 if (resource == null)
36 return;
37
38 IProject project = resource.getProject();
39 LaunchHobDialog hobDialog = new LaunchHobDialog(new Shell(), DIALOG_TITLE, project);
40 hobDialog.open();
41 String buildDir = hobDialog.getBuildDir();
42
43 if (buildDir != null) {
44 try {
45 BitbakeCommanderNature.launchHob(project,buildDir);
46 } catch (Exception e){
47 System.out.println(e.getMessage());
48 }
49 }
50
51 }
52
53 public void dispose() {
54
55 }
56
57 private IResource getSelectedResource() {
58 IWorkbench iworkbench = PlatformUI.getWorkbench();
59 if (iworkbench == null){
60 return null;
61 }
62 IWorkbenchWindow iworkbenchwindow = iworkbench.getActiveWorkbenchWindow();
63 if (iworkbenchwindow == null) {
64 return null;
65 }
66 IWorkbenchPage iworkbenchpage = iworkbenchwindow.getActivePage();
67 if (iworkbenchpage == null) {
68 return null;
69 }
70 ISelection sel = iworkbenchpage.getSelection();
71
72 if (!(sel instanceof IStructuredSelection))
73 return null;
74 IStructuredSelection ss = (IStructuredSelection) sel;
75 Object element = ss.getFirstElement();
76 if (element instanceof IResource)
77 return (IResource) element;
78 if (!(element instanceof IAdaptable))
79 return null;
80 IAdaptable adaptable = (IAdaptable)element;
81 Object adapter = adaptable.getAdapter(IResource.class);
82 return (IResource) adapter;
83 }
84}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2011 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import java.util.Map;
14import java.util.Iterator;
15import java.util.Map.Entry;
16import java.util.ArrayList;
17import java.util.HashMap;
18import java.util.HashSet;
19import java.io.File;
20import java.io.IOException;
21
22import org.eclipse.jface.dialogs.Dialog;
23import org.eclipse.jface.dialogs.IDialogConstants;
24
25import org.eclipse.swt.SWT;
26import org.eclipse.swt.events.ModifyEvent;
27import org.eclipse.swt.events.ModifyListener;
28import org.eclipse.swt.events.SelectionAdapter;
29import org.eclipse.swt.events.SelectionEvent;
30import org.eclipse.swt.events.SelectionListener;
31import org.eclipse.swt.layout.GridData;
32import org.eclipse.swt.layout.GridLayout;
33import org.eclipse.swt.widgets.Button;
34import org.eclipse.swt.widgets.Combo;
35import org.eclipse.swt.widgets.Composite;
36import org.eclipse.swt.widgets.Control;
37import org.eclipse.swt.widgets.DirectoryDialog;
38import org.eclipse.swt.widgets.Display;
39import org.eclipse.swt.widgets.Label;
40import org.eclipse.swt.widgets.MessageBox;
41import org.eclipse.swt.widgets.Shell;
42import org.eclipse.swt.widgets.Widget;
43
44import org.eclipse.core.resources.IProject;
45import org.eclipse.core.resources.IProjectDescription;
46import org.eclipse.core.resources.ICommand;
47
48import org.yocto.bc.ui.builder.BitbakeBuilder;
49import org.yocto.bc.ui.builder.BitbakeCommanderNature;
50
51public class LaunchHobDialog extends Dialog {
52 private String title;
53 private Button buildButton;
54 private SelectionListener fSelectionListener;
55 private ModifyListener fModifyListener;
56 private Combo build_dir_combo;
57
58 private IProject project;
59 private Shell shell;
60 private String build_dir;
61
62 public LaunchHobDialog(Shell parentShell, String dialogTitle, IProject project) {
63 super(parentShell);
64 this.shell = parentShell;
65 this.project = project;
66 this.title = dialogTitle;
67 setShellStyle(getShellStyle() | SWT.RESIZE);
68
69 fSelectionListener= new SelectionListener() {
70 public void widgetDefaultSelected(SelectionEvent e) {}
71
72 public void widgetSelected(SelectionEvent e) {
73 controlChanged(e.widget);
74 }
75 };
76
77 fModifyListener= new ModifyListener() {
78 public void modifyText(ModifyEvent e) {
79 controlModified(e.widget);
80 }
81 };
82
83 }
84
85 public String getBuildDir() {
86 return build_dir;
87 }
88 @Override
89 protected Control createDialogArea(Composite parent) {
90 final Composite result = (Composite) super.createDialogArea(parent);
91
92 try {
93 createComposite(result);
94 } catch (Exception e) {
95 // TODO Auto-generated catch block
96 System.out.println("Have you ever set the project specific Yocto Settings?");
97 System.out.println(e.getMessage());
98 }
99
100 return result;
101 }
102
103 private void createComposite(Composite composite) throws Exception{
104 Label root_label, sysroot_label;
105
106 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
107 GridLayout layout = new GridLayout(2, false);
108 composite.setLayout(layout);
109
110 gd= new GridData(SWT.FILL, SWT.CENTER, true, false);
111 gd.horizontalSpan= 2;
112 composite.setLayoutData(gd);
113
114 Label build_dir_label = new Label(composite, SWT.NONE);
115 build_dir_label.setText("Bitbake build directory: ");
116 Composite textContainer = new Composite(composite, SWT.NONE);
117 textContainer.setLayout(new GridLayout(2, false));
118 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
119
120 build_dir_combo = new Combo(textContainer, SWT.DROP_DOWN);
121 build_dir_combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
122 initializeBuildCombo();
123
124 Button buildButton = addDirSelectButton(textContainer, build_dir_combo);
125
126 //we add the listener at the end for avoiding the useless event trigger when control
127 //changed or modified.
128 buildButton.addSelectionListener(fSelectionListener);
129 build_dir_combo.addModifyListener(fModifyListener);
130 }
131
132 private Button addDirSelectButton(final Composite parent, final Combo combo) {
133 Button button = new Button(parent, SWT.PUSH | SWT.LEAD);
134 button.setText("Browse");
135 button.addSelectionListener(new SelectionAdapter() {
136 @Override
137 public void widgetSelected(SelectionEvent event) {
138 String dirName = new DirectoryDialog(parent.getShell()).open();
139
140 if (dirName != null) {
141 combo.add(dirName);
142 combo.setText(dirName);
143 }
144 }
145 });
146 return button;
147 }
148 @Override
149 protected void configureShell(Shell newShell) {
150 super.configureShell(newShell);
151 newShell.setText(title);
152 }
153
154 protected void buttonPressed(int buttonId) {
155 if (buttonId == IDialogConstants.OK_ID) {
156 try {
157 build_dir = build_dir_combo.getText().toString();
158 updateBuildSpec(build_dir);
159 super.buttonPressed(buttonId);
160 } catch (Exception e) {
161 // TODO Auto-generated catch block
162 System.out.println(e.getMessage());
163 }
164 }
165 else if (buttonId == IDialogConstants.CANCEL_ID)
166 {
167 super.buttonPressed(buttonId);
168 }
169 }
170
171 private boolean validateInput() {
172 boolean valid = false;
173 String build_dir = build_dir_combo.getText().toString();
174 if ((build_dir == null) || build_dir.isEmpty()) {
175 Display display = Display.getCurrent();
176 Shell shell = new Shell(display);
177 MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
178 msgBox.setText("Yocto Configuration Error");
179 msgBox.setMessage("The specified build directory is empty!");
180 msgBox.open();
181 if (shell != null)
182 shell.dispose();
183 return valid;
184 }
185 String project_path = project.getLocation().toString();
186 File project_dir_file = new File(project_path);
187 File build_dir_file = new File(build_dir);
188 try {
189 if (isSubDirectory(project_dir_file, build_dir_file)) {
190 Display display = Display.getCurrent();
191 Shell shell = new Shell(display);
192 MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
193 msgBox.setText("Yocto Configuration Error");
194 msgBox.setMessage("The specified build directory is a sub-dir of project path: " + project_path);
195 msgBox.open();
196 if (shell != null)
197 shell.dispose();
198 } else
199 valid = true;
200 } catch (IOException e) {
201 System.out.println(e.getMessage());
202 }
203 return valid;
204 }
205
206 private boolean isSubDirectory(File baseDir, File subDir) throws IOException {
207 baseDir = baseDir.getCanonicalFile();
208 subDir = subDir.getCanonicalFile();
209
210 File parentFile = subDir;
211 while (parentFile != null) {
212 if (baseDir.equals(parentFile)) {
213 return true;
214 }
215 parentFile = parentFile.getParentFile();
216 }
217 return false;
218 }
219
220 private void controlChanged(Widget widget) {
221
222 if (widget == buildButton)
223 {
224 }
225 }
226
227 private void controlModified(Widget widget) {
228 if (widget == build_dir_combo)
229 {
230
231 }
232 }
233
234 private void initializeBuildCombo()
235 {
236 ArrayList<String> items = new ArrayList<String> ();
237
238 try {
239 IProjectDescription desc = project.getDescription();
240
241 ICommand[] buildSpec = desc.getBuildSpec();
242 if ((buildSpec != null) && (buildSpec.length != 0))
243 {
244 for (int i = 0; i < buildSpec.length; i++) {
245 ICommand cmd = buildSpec[i];
246 if (cmd.getBuilderName().equalsIgnoreCase(BitbakeBuilder.HOB_BUILD_ID))
247 {
248 Map<String, String> args = cmd.getArguments();
249 if ((args != null) && !args.isEmpty())
250 {
251 Iterator entries = args.entrySet().iterator();
252 while (entries.hasNext()) {
253 Entry thisEntry = (Entry) entries.next();
254 String key = (String)thisEntry.getKey();
255 if (key.equalsIgnoreCase(BitbakeCommanderNature.BUILD_DIR_KEY)) {
256 build_dir_combo.removeAll();
257 build_dir_combo.setItems(getValues((String)thisEntry.getValue()));
258 }
259 }
260 }
261 }
262 }
263 }
264 } catch (Exception e) {
265 System.out.println(e.getMessage());
266 }
267 }
268
269 private String[] getValues(String value) {
270
271 if ((value != null) && !value.isEmpty())
272 {
273 String[] pieces = value.split(",");
274 for (int i = 0; i < pieces.length; i++)
275 {
276 int start = pieces[i].indexOf("[");
277 if (start >= 0)
278 pieces[i] = pieces[i].substring(start+1);
279 int end = pieces[i].indexOf("]");
280 if (end >= 0)
281 pieces[i] = pieces[i].substring(0, end);
282 pieces[i] = pieces[i].trim();
283 }
284 return pieces;
285 }
286 return null;
287 }
288
289 private void updateBuildSpec(String build_dir)
290 {
291 try {
292 String[] items = build_dir_combo.getItems();
293 HashSet values = new HashSet();
294 Map<String, String> args = new HashMap<String, String>();
295 values.add(build_dir);
296 for (int i = 0; i < items.length; i++) {
297 values.add(items[i]);
298 }
299 args.put(BitbakeCommanderNature.BUILD_DIR_KEY, values.toString());
300 IProjectDescription desc = project.getDescription();
301 ICommand[] buildSpec = desc.getBuildSpec();
302 boolean found = false;
303 if ((buildSpec != null) || (buildSpec.length != 0)) {
304 for (int i = 0; i < buildSpec.length; i++) {
305 ICommand cmd = buildSpec[i];
306 if (cmd.getBuilderName().equalsIgnoreCase(BitbakeBuilder.HOB_BUILD_ID)) {
307 cmd.setArguments(args);
308 desc.setBuildSpec(buildSpec);
309 found = true;
310 break;
311 }
312 }
313 }
314 if (!found) {
315 ICommand[] newBuildSpec = new ICommand[buildSpec.length + 1];
316 System.arraycopy(buildSpec, 0, newBuildSpec, 0, buildSpec.length);
317 ICommand cmd = desc.newCommand();
318 cmd.setBuilderName(BitbakeBuilder.HOB_BUILD_ID);
319 cmd.setArguments(args);
320 newBuildSpec[newBuildSpec.length - 1] = cmd;
321 desc.setBuildSpec(newBuildSpec);
322 }
323 project.setDescription(desc, null);
324 } catch (Exception e) {
325 System.out.println(e.getMessage());
326 }
327 }
328}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2011 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import org.eclipse.core.commands.ExecutionEvent;
14import org.eclipse.core.commands.ExecutionException;
15import org.eclipse.core.commands.IHandlerListener;
16import org.eclipse.core.commands.IHandler;
17
18public class LaunchHobHandler implements IHandler {
19
20 public Object execute(ExecutionEvent event) throws ExecutionException {
21 LaunchHobAction a = new LaunchHobAction();
22 a.run(null);
23 return null;
24 }
25
26 public void addHandlerListener(IHandlerListener handlerListener) {
27 // TODO Auto-generated method stub
28
29 }
30
31 public void dispose() {
32 // TODO Auto-generated method stub
33
34 }
35
36 public boolean isEnabled() {
37 // TODO Auto-generated method stub
38 return true;
39 }
40
41 public boolean isHandled() {
42 // TODO Auto-generated method stub
43 return true;
44 }
45
46 public void removeHandlerListener(IHandlerListener handlerListener) {
47 // TODO Auto-generated method stub
48
49 }
50}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import org.eclipse.jface.action.IAction;
14import org.eclipse.jface.viewers.ISelection;
15import org.eclipse.jface.viewers.IStructuredSelection;
16import org.eclipse.jface.wizard.WizardDialog;
17import org.eclipse.ui.IWorkbenchWindow;
18import org.eclipse.ui.IWorkbenchWindowActionDelegate;
19
20import org.yocto.bc.ui.wizards.importProject.ImportYoctoProjectWizard;
21
22public class LaunchNewBitBakeProjectWizardAction implements IWorkbenchWindowActionDelegate {
23
24 private IWorkbenchWindow window;
25 private IStructuredSelection selection;
26
27 public void dispose() {
28 }
29
30 public void init(IWorkbenchWindow window) {
31 this.window = window;
32 }
33
34 public void run(IAction action) {
35 ImportYoctoProjectWizard wizard = new ImportYoctoProjectWizard();
36
37 wizard.init(window.getWorkbench(), selection);
38 WizardDialog wd = new WizardDialog(window.getShell(), wizard);
39 wd.create();
40 wd.open();
41 }
42
43 public void selectionChanged(IAction action, ISelection selection) {
44 if (selection instanceof IStructuredSelection) {
45 this.selection = (IStructuredSelection) selection;
46 }
47 }
48} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import org.eclipse.jface.action.IAction;
14import org.eclipse.jface.viewers.ISelection;
15import org.eclipse.jface.viewers.IStructuredSelection;
16import org.eclipse.jface.wizard.WizardDialog;
17import org.eclipse.ui.IWorkbenchWindow;
18import org.eclipse.ui.IWorkbenchWindowActionDelegate;
19
20import org.yocto.bc.ui.wizards.NewBitBakeFileRecipeWizard;
21
22public class LaunchNewRecipeWizardAction implements IWorkbenchWindowActionDelegate {
23
24 private IWorkbenchWindow window;
25 private IStructuredSelection selection;
26
27 public void dispose() {
28 }
29
30 public void init(IWorkbenchWindow window) {
31 this.window = window;
32 }
33
34 public void run(IAction action) {
35 NewBitBakeFileRecipeWizard wizard = new NewBitBakeFileRecipeWizard();
36
37 wizard.init(window.getWorkbench(), selection);
38 WizardDialog wd = new WizardDialog(window.getShell(), wizard);
39 wd.create();
40 wd.open();
41 }
42
43 public void selectionChanged(IAction action, ISelection selection) {
44 if (selection instanceof IStructuredSelection) {
45 this.selection = (IStructuredSelection) selection;
46 }
47 }
48} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.actions;
12
13import java.io.IOException;
14import java.util.Map;
15
16import org.eclipse.core.resources.IProject;
17import org.eclipse.core.resources.IResource;
18import org.eclipse.core.runtime.CoreException;
19import org.eclipse.jface.action.IAction;
20import org.eclipse.jface.viewers.ISelection;
21import org.eclipse.jface.viewers.IStructuredSelection;
22import org.eclipse.jface.wizard.WizardDialog;
23import org.eclipse.ui.IWorkbenchWindow;
24import org.eclipse.ui.IWorkbenchWindowActionDelegate;
25
26import org.yocto.bc.ui.Activator;
27import org.yocto.bc.ui.builder.BitbakeCommanderNature;
28import org.yocto.bc.ui.wizards.variable.VariableWizard;
29
30/**
31 * Action to launch the Variable Wizard.
32 * @author kgilmer
33 *
34 */
35public class LaunchVariableWizardAction implements IWorkbenchWindowActionDelegate {
36
37 private IWorkbenchWindow window;
38 private Map session;
39
40 public void dispose() {
41 }
42
43 public void init(IWorkbenchWindow window) {
44 this.window = window;
45 }
46
47 public void run(IAction action) {
48 VariableWizard wizard = new VariableWizard(session);
49
50 WizardDialog wd = new WizardDialog(window.getShell(), wizard);
51 wd.create();
52 wd.open();
53 }
54
55 public void selectionChanged(IAction action, ISelection selection) {
56 session = null;
57
58 if (selection instanceof IStructuredSelection) {
59 Object element = ((IStructuredSelection)selection).getFirstElement();
60
61 if (element instanceof IResource) {
62 IProject p = ((IResource)element).getProject();
63
64 try {
65 if (p.isOpen() && p.hasNature(BitbakeCommanderNature.NATURE_ID)) {
66 session = Activator.getBBSession(((IResource)element).getProject().getLocationURI().getPath());
67 }
68 } catch (IOException e) {
69 e.printStackTrace();
70 } catch (CoreException e) {
71 e.printStackTrace();
72 }
73 }
74 }
75
76 action.setEnabled(session != null);
77 }
78} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.builder;
12
13import java.util.Map;
14
15import javax.xml.parsers.ParserConfigurationException;
16import javax.xml.parsers.SAXParser;
17import javax.xml.parsers.SAXParserFactory;
18
19import org.eclipse.core.resources.IFile;
20import org.eclipse.core.resources.IMarker;
21import org.eclipse.core.resources.IProject;
22import org.eclipse.core.resources.IResource;
23import org.eclipse.core.resources.IResourceDelta;
24import org.eclipse.core.resources.IResourceDeltaVisitor;
25import org.eclipse.core.resources.IncrementalProjectBuilder;
26import org.eclipse.core.runtime.CoreException;
27import org.eclipse.core.runtime.IProgressMonitor;
28import org.xml.sax.SAXException;
29
30public class BitbakeBuilder extends IncrementalProjectBuilder {
31
32 class SampleDeltaVisitor implements IResourceDeltaVisitor {
33 /*
34 * (non-Javadoc)
35 *
36 * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
37 */
38 public boolean visit(IResourceDelta delta) throws CoreException {
39 IResource resource = delta.getResource();
40 switch (delta.getKind()) {
41 case IResourceDelta.ADDED:
42 // handle added resource
43 //checkXML(resource);
44 break;
45 case IResourceDelta.REMOVED:
46 // handle removed resource
47 break;
48 case IResourceDelta.CHANGED:
49 // handle changed resource
50 //checkXML(resource);
51 break;
52 }
53 //return true to continue visiting children.
54 return true;
55 }
56 }
57/*
58 class SampleResourceVisitor implements IResourceVisitor {
59 public boolean visit(IResource resource) {
60
61 return true;
62 }
63 }
64*/
65/* class XMLErrorHandler extends DefaultHandler {
66
67 private IFile file;
68
69 public XMLErrorHandler(IFile file) {
70 this.file = file;
71 }
72
73 private void addMarker(SAXParseException e, int severity) {
74 BitbakeBuilder.this.addMarker(file, e.getMessage(), e
75 .getLineNumber(), severity);
76 }
77
78 @Override
79 public void error(SAXParseException exception) throws SAXException {
80 addMarker(exception, IMarker.SEVERITY_ERROR);
81 }
82
83 @Override
84 public void fatalError(SAXParseException exception) throws SAXException {
85 addMarker(exception, IMarker.SEVERITY_ERROR);
86 }
87
88 @Override
89 public void warning(SAXParseException exception) throws SAXException {
90 addMarker(exception, IMarker.SEVERITY_WARNING);
91 }
92 }
93*/
94 public static final String BUILDER_ID = "org.yocto.bc.ui.builder.BitbakeBuilder";
95 public static final String HOB_BUILD_ID = "org.yocto.bc.ui.builder.HOB";
96
97 private static final String MARKER_TYPE = "org.yocto.bc.ui.xmlProblem";
98
99 private SAXParserFactory parserFactory;
100
101 private void addMarker(IFile file, String message, int lineNumber,
102 int severity) {
103 try {
104 IMarker marker = file.createMarker(MARKER_TYPE);
105 marker.setAttribute(IMarker.MESSAGE, message);
106 marker.setAttribute(IMarker.SEVERITY, severity);
107 if (lineNumber == -1) {
108 lineNumber = 1;
109 }
110 marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
111 } catch (CoreException e) {
112 }
113 }
114
115 /*
116 * (non-Javadoc)
117 *
118 * @see org.eclipse.core.internal.events.InternalBuilder#build(int,
119 * java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
120 */
121 @Override
122 protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
123 throws CoreException {
124 if (kind == FULL_BUILD) {
125 fullBuild(monitor);
126 } else {
127 IResourceDelta delta = getDelta(getProject());
128 if (delta == null) {
129 fullBuild(monitor);
130 } else {
131 incrementalBuild(delta, monitor);
132 }
133 }
134 return null;
135 }
136
137 /*void checkXML(IResource resource) {
138 if (resource instanceof IFile && resource.getName().endsWith(".xml")) {
139 IFile file = (IFile) resource;
140 deleteMarkers(file);
141 XMLErrorHandler reporter = new XMLErrorHandler(file);
142 try {
143 getParser().parse(file.getContents(), reporter);
144 } catch (Exception e1) {
145 }
146 }
147 }*/
148
149 private void deleteMarkers(IFile file) {
150 try {
151 file.deleteMarkers(MARKER_TYPE, false, IResource.DEPTH_ZERO);
152 } catch (CoreException ce) {
153 }
154 }
155
156 protected void fullBuild(final IProgressMonitor monitor)
157 throws CoreException {
158 /*try {
159 getProject().accept(new SampleResourceVisitor());
160 } catch (CoreException e) {
161 }*/
162 }
163
164 private SAXParser getParser() throws ParserConfigurationException,
165 SAXException {
166 if (parserFactory == null) {
167 parserFactory = SAXParserFactory.newInstance();
168 }
169 return parserFactory.newSAXParser();
170 }
171
172 protected void incrementalBuild(IResourceDelta delta,
173 IProgressMonitor monitor) throws CoreException {
174 // the visitor does the work.
175 delta.accept(new SampleDeltaVisitor());
176 }
177}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 * Jessica Zhang - extend to support HOB build
11 *******************************************************************************/
12package org.yocto.bc.ui.builder;
13
14import java.util.ArrayList;
15
16import org.eclipse.core.resources.ICommand;
17import org.eclipse.core.resources.IProject;
18import org.eclipse.core.resources.IProjectDescription;
19import org.eclipse.core.resources.IProjectNature;
20import org.eclipse.core.runtime.CoreException;
21import org.eclipse.debug.core.DebugPlugin;
22import org.eclipse.debug.core.ILaunchConfigurationType;
23import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
24import org.eclipse.debug.core.ILaunchManager;
25
26
27public class BitbakeCommanderNature implements IProjectNature {
28
29 /**
30 * ID of this project nature
31 */
32 public static final String NATURE_ID = "org.yocto.bc.ui.builder.BitbakeCommanderNature";
33 public static final String BUILD_DIR_KEY = "org.yocto.bc.ui.builder.BitbakeCommander.BuildDir";
34 private IProject project;
35
36 public static void launchHob(IProject project, String buildDir) {
37 try {
38 ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
39 ILaunchConfigurationType configType =
40 lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
41 ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "hob");
42 ArrayList<String> listValue = new ArrayList<String>();
43 listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
44 w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);
45 w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm");
46
47 String init_script = project.getLocation().toString() + "/oe-init-build-env ";
48 String argument = "-e \"source " + init_script + buildDir + ";hob";// + ";bash\"";
49
50 w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);
51 w_copy.launch(ILaunchManager.RUN_MODE, null);
52
53 } catch (CoreException e) {
54 System.out.println(e.getMessage());
55 }
56 }
57 /*
58 * (non-Javadoc)
59 *
60 * @see org.eclipse.core.resources.IProjectNature#configure()
61 */
62 public void configure() throws CoreException {
63 IProjectDescription desc = project.getDescription();
64 ICommand[] commands = desc.getBuildSpec();
65
66 for (int i = 0; i < commands.length; ++i) {
67 if (commands[i].getBuilderName().equals(BitbakeBuilder.BUILDER_ID)) {
68 return;
69 }
70 }
71
72 ICommand[] newCommands = new ICommand[commands.length + 1];
73 System.arraycopy(commands, 0, newCommands, 0, commands.length);
74 ICommand command = desc.newCommand();
75 command.setBuilderName(BitbakeBuilder.BUILDER_ID);
76 newCommands[newCommands.length - 1] = command;
77 desc.setBuildSpec(newCommands);
78 project.setDescription(desc, null);
79 }
80
81 /*
82 * (non-Javadoc)
83 *
84 * @see org.eclipse.core.resources.IProjectNature#deconfigure()
85 */
86 public void deconfigure() throws CoreException {
87 IProjectDescription description = getProject().getDescription();
88 ICommand[] commands = description.getBuildSpec();
89 for (int i = 0; i < commands.length; ++i) {
90 if (commands[i].getBuilderName().equals(BitbakeBuilder.BUILDER_ID)) {
91 ICommand[] newCommands = new ICommand[commands.length - 1];
92 System.arraycopy(commands, 0, newCommands, 0, i);
93 System.arraycopy(commands, i + 1, newCommands, i,
94 commands.length - i - 1);
95 description.setBuildSpec(newCommands);
96 return;
97 }
98 }
99 }
100
101 /*
102 * (non-Javadoc)
103 *
104 * @see org.eclipse.core.resources.IProjectNature#getProject()
105 */
106 public IProject getProject() {
107 return project;
108 }
109
110 /*
111 * (non-Javadoc)
112 *
113 * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
114 */
115 public void setProject(IProject project) {
116 this.project = project;
117 }
118}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.builder;
12
13import java.util.Iterator;
14
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.resources.IProjectDescription;
17import org.eclipse.core.runtime.CoreException;
18import org.eclipse.core.runtime.IAdaptable;
19import org.eclipse.jface.action.IAction;
20import org.eclipse.jface.viewers.ISelection;
21import org.eclipse.jface.viewers.IStructuredSelection;
22import org.eclipse.ui.IObjectActionDelegate;
23import org.eclipse.ui.IWorkbenchPart;
24
25public class ToggleNatureAction implements IObjectActionDelegate {
26
27 private ISelection selection;
28
29 /*
30 * (non-Javadoc)
31 *
32 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
33 */
34 public void run(IAction action) {
35 if (selection instanceof IStructuredSelection) {
36 for (Iterator it = ((IStructuredSelection) selection).iterator(); it
37 .hasNext();) {
38 Object element = it.next();
39 IProject project = null;
40 if (element instanceof IProject) {
41 project = (IProject) element;
42 } else if (element instanceof IAdaptable) {
43 project = (IProject) ((IAdaptable) element)
44 .getAdapter(IProject.class);
45 }
46 if (project != null) {
47 toggleNature(project);
48 }
49 }
50 }
51 }
52
53 /*
54 * (non-Javadoc)
55 *
56 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
57 * org.eclipse.jface.viewers.ISelection)
58 */
59 public void selectionChanged(IAction action, ISelection selection) {
60 this.selection = selection;
61 }
62
63 /*
64 * (non-Javadoc)
65 *
66 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
67 * org.eclipse.ui.IWorkbenchPart)
68 */
69 public void setActivePart(IAction action, IWorkbenchPart targetPart) {
70 }
71
72 /**
73 * Toggles sample nature on a project
74 *
75 * @param project
76 * to have sample nature added or removed
77 */
78 private void toggleNature(IProject project) {
79 try {
80 IProjectDescription description = project.getDescription();
81 String[] natures = description.getNatureIds();
82
83 for (int i = 0; i < natures.length; ++i) {
84 if (BitbakeCommanderNature.NATURE_ID.equals(natures[i])) {
85 // Remove the nature
86 String[] newNatures = new String[natures.length - 1];
87 System.arraycopy(natures, 0, newNatures, 0, i);
88 System.arraycopy(natures, i + 1, newNatures, i,
89 natures.length - i - 1);
90 description.setNatureIds(newNatures);
91 project.setDescription(description, null);
92 return;
93 }
94 }
95
96 // Add the nature
97 String[] newNatures = new String[natures.length + 1];
98 System.arraycopy(natures, 0, newNatures, 0, natures.length);
99 newNatures[natures.length] = BitbakeCommanderNature.NATURE_ID;
100 description.setNatureIds(newNatures);
101 project.setDescription(description, null);
102 } catch (CoreException e) {
103 }
104 }
105
106}
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 @@
1package org.yocto.bc.ui.decorators;
2
3import org.eclipse.core.resources.IProject;
4import org.eclipse.core.runtime.CoreException;
5import org.eclipse.jface.resource.ImageDescriptor;
6import org.eclipse.jface.viewers.IDecoration;
7import org.eclipse.jface.viewers.ILabelProviderListener;
8import org.eclipse.jface.viewers.ILightweightLabelDecorator;
9
10import org.yocto.bc.ui.Activator;
11import org.yocto.bc.ui.builder.BitbakeCommanderNature;
12
13public class ProjectDecorator implements ILightweightLabelDecorator {
14
15 private ImageDescriptor image;
16
17 public ProjectDecorator() {
18 image = Activator.getImageDescriptor("icons/oe_decorator.gif");
19 }
20
21
22 public void decorate(Object element, IDecoration decoration) {
23 IProject p = (IProject) element;
24
25 try {
26 if (p.isOpen() && p.hasNature(BitbakeCommanderNature.NATURE_ID)) {
27 decoration.addOverlay(image, IDecoration.TOP_RIGHT);
28 }
29 } catch (CoreException e) {
30 e.printStackTrace();
31 }
32 }
33
34 public void addListener(ILabelProviderListener arg0) {
35 }
36
37 public void dispose() {
38 }
39
40 public boolean isLabelProperty(Object arg0, String arg1) {
41 return false;
42 }
43
44
45 public void removeListener(ILabelProviderListener arg0) {
46 }
47
48}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.decorators;
12
13import java.net.URL;
14
15import org.eclipse.core.resources.IResource;
16import org.eclipse.core.resources.ResourceAttributes;
17import org.eclipse.core.runtime.Path;
18import org.eclipse.core.runtime.Platform;
19import org.eclipse.jface.resource.ImageDescriptor;
20import org.eclipse.jface.viewers.IDecoration;
21import org.eclipse.jface.viewers.ILabelProviderListener;
22import org.eclipse.jface.viewers.ILightweightLabelDecorator;
23
24/**
25 * An example showing how to control when an element is decorated. This example
26 * decorates only elements that are instances of IResource and whose attribute
27 * is 'Read-only'.
28 *
29 * @see ILightweightLabelDecorator
30 */
31public class ReadOnly implements ILightweightLabelDecorator {
32 /**
33 * String constants for the various icon placement options from the template
34 * wizard.
35 */
36 public static final String TOP_RIGHT = "TOP_RIGHT";
37
38 public static final String TOP_LEFT = "TOP_LEFT";
39
40 public static final String BOTTOM_RIGHT = "BOTTOM_RIGHT";
41
42 public static final String BOTTOM_LEFT = "BOTTOM_LEFT";
43
44 public static final String UNDERLAY = "UNDERLAY";
45
46 /** The integer value representing the placement options */
47 private int quadrant;
48
49 /** The icon image location in the project folder */
50 private String iconPath = "icons/read_only.gif"; //NON-NLS-1
51
52 /**
53 * The image description used in
54 * <code>addOverlay(ImageDescriptor, int)</code>
55 */
56 private ImageDescriptor descriptor;
57
58 /* (non-Javadoc)
59 * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
60 */
61 public void decorate(Object element, IDecoration decoration) {
62 /**
63 * Checks that the element is an IResource with the 'Read-only' attribute
64 * and adds the decorator based on the specified image description and the
65 * integer representation of the placement option.
66 */
67 IResource resource = (IResource) element;
68 ResourceAttributes attrs = resource.getResourceAttributes();
69 if(attrs!=null) {
70 if (attrs.isReadOnly()){
71 URL url = Platform.find(
72 Platform.getBundle("org.yocto.bc.ui"), new Path(iconPath)); //NON-NLS-1
73
74 if (url == null)
75 return;
76 descriptor = ImageDescriptor.createFromURL(url);
77 quadrant = IDecoration.TOP_RIGHT;
78 decoration.addOverlay(descriptor,quadrant);
79 }
80 }
81 }
82
83 /* (non-Javadoc)
84 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
85 */
86 public void addListener(ILabelProviderListener listener) {
87 }
88
89 /* (non-Javadoc)
90 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
91 */
92 public void dispose() {
93 }
94
95 /* (non-Javadoc)
96 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
97 */
98 public boolean isLabelProperty(Object element, String property) {
99 return false;
100 }
101
102 /* (non-Javadoc)
103 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
104 */
105 public void removeListener(ILabelProviderListener listener) {
106 }
107} \ 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 @@
1/**
2 *
3 */
4package org.yocto.bc.ui.editors.bitbake;
5
6import java.io.File;
7import java.util.Map;
8
9import org.eclipse.core.runtime.IProgressMonitor;
10import org.eclipse.core.runtime.IStatus;
11import org.eclipse.core.runtime.Status;
12import org.eclipse.core.runtime.jobs.Job;
13import org.eclipse.jface.text.IRegion;
14import org.eclipse.jface.text.ITextHover;
15import org.eclipse.jface.text.ITextViewer;
16import org.eclipse.jface.text.Region;
17
18import org.yocto.bc.bitbake.BBRecipe;
19import org.yocto.bc.bitbake.BBSession;
20import org.yocto.bc.ui.Activator;
21
22/**
23 * Maps BB Variables in the editor to BBSession
24 * @author kgilmer
25 *
26 */
27class BBVariableTextHover implements ITextHover {
28 private final BBSession session;
29 private volatile Map envMap;
30
31 public BBVariableTextHover(BBSession session, String file) {
32 this.session = session;
33 envMap = session;
34 LoadRecipeJob loadRecipeJob = new LoadRecipeJob(getFilename(file), file);
35 loadRecipeJob.schedule();
36 }
37
38 private String getFilename(String file) {
39
40 String [] elems = file.split(File.separator);
41
42 return elems[elems.length - 1];
43 }
44
45 public IRegion getHoverRegion(ITextViewer tv, int off) {
46 return new Region(off, 0);
47 }
48
49 public String getHoverInfo(ITextViewer tv, IRegion r) {
50 try {
51 IRegion lineRegion = tv.getDocument().getLineInformationOfOffset(r.getOffset());
52
53 return getBBVariable(tv.getDocument().get(lineRegion.getOffset(), lineRegion.getLength()).toCharArray(), r.getOffset() - lineRegion.getOffset());
54 } catch (Exception e) {
55 return "";
56 }
57 }
58
59 private String getBBVariable(char[] line, int offset) {
60 // Find start of word.
61 int i = offset;
62
63 while (line[i] != ' ' && line[i] != '$' && i > 0) {
64 i--;
65 }
66
67 if (i < 0 || line[i] != '$') {
68 return ""; //this is not a BB variable.
69 }
70
71 // find end of word
72 int start = i;
73 i = offset;
74
75 while (line[i] != ' ' && line[i] != '}' && i <= line.length) {
76 i++;
77 }
78
79 if (line[i] != '}') {
80 return ""; //this bb variable didn't terminate as expected
81 }
82
83 String key = new String(line, start + 2, i - start - 2);
84 String val = (String) envMap.get(key);
85
86 if (val == null) {
87 val = "";
88 }
89
90 if (val.length() > 64) {
91 val = val.substring(0, 64) + '\n' + val.substring(65);
92 }
93
94 return val;
95 }
96
97 private class LoadRecipeJob extends Job {
98 private final String filePath;
99
100 public LoadRecipeJob(String name, String filePath) {
101 super("Extracting BitBake environment for " + name);
102 this.filePath = filePath;
103 }
104
105 @Override
106 protected IStatus run(IProgressMonitor mon) {
107 try {
108 BBRecipe recipe = Activator.getBBRecipe(session, filePath);
109 recipe.initialize();
110 envMap = recipe;
111 } catch (Exception e) {
112 return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unable to load session for " + filePath, e);
113 }
114
115 return Status.OK_STATUS;
116 }
117 }
118} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.editors.bitbake;
12
13import org.eclipse.jface.text.IDocument;
14import org.eclipse.jface.text.IDocumentExtension3;
15import org.eclipse.jface.text.IDocumentPartitioner;
16import org.eclipse.jface.text.rules.FastPartitioner;
17import org.eclipse.jface.text.rules.IPredicateRule;
18import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
19import org.eclipse.jface.text.rules.SingleLineRule;
20import org.eclipse.jface.text.rules.Token;
21import org.eclipse.ui.editors.text.FileDocumentProvider;
22
23/**
24 * Document provider for BB recipe.
25 * @author kgilmer
26 *
27 */
28public class BitBakeDocumentProvider extends FileDocumentProvider {
29 /**
30 * The recipe partitioning. It contains two partition types: {@link #RECIPE_CODE} and
31 * {@link #RECIPE_COMMENT}.
32 */
33 public static final String RECIPE_PARTITIONING= "org.recipeeditor.recipepartitioning"; //$NON-NLS-1$
34
35 public static final String RECIPE_CODE= IDocument.DEFAULT_CONTENT_TYPE;
36 public static final String RECIPE_COMMENT= "RECIPE_COMMENT"; //$NON-NLS-1$
37
38 private static final String[] CONTENT_TYPES= {
39 RECIPE_CODE,
40 RECIPE_COMMENT
41 };
42
43 private IDocumentPartitioner createRecipePartitioner() {
44 IPredicateRule[] rules= { new SingleLineRule("#", null, new Token(RECIPE_COMMENT), (char) 0, true, false) }; //$NON-NLS-1$
45
46 RuleBasedPartitionScanner scanner= new RuleBasedPartitionScanner();
47 scanner.setPredicateRules(rules);
48
49 return new FastPartitioner(scanner, CONTENT_TYPES);
50 }
51
52 @Override
53 protected void setupDocument(Object element,IDocument document) {
54 if (document instanceof IDocumentExtension3) {
55 IDocumentExtension3 ext= (IDocumentExtension3) document;
56 IDocumentPartitioner partitioner= createRecipePartitioner();
57 ext.setDocumentPartitioner(RECIPE_PARTITIONING, partitioner);
58 partitioner.connect(document);
59 }
60 }
61
62}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.editors.bitbake;
12
13import java.io.IOException;
14import java.util.ResourceBundle;
15
16import org.eclipse.core.resources.IFile;
17import org.eclipse.core.resources.IProject;
18import org.eclipse.core.runtime.Status;
19import org.eclipse.ui.IEditorInput;
20import org.eclipse.ui.IEditorSite;
21import org.eclipse.ui.PartInitException;
22import org.eclipse.ui.part.FileEditorInput;
23import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
24import org.eclipse.ui.texteditor.ContentAssistAction;
25import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
26
27import org.yocto.bc.ui.Activator;
28
29/**
30 * Editor for BB Recipe
31 * @author kgilmer
32 *
33 */
34public class BitBakeFileEditor extends AbstractDecoratedTextEditor {
35
36 public static final String EDITOR_ID = "org.yocto.bc.ui.editors.BitBakeFileEditor";
37 static final String CONTENT_ASSIST= "ContentAssist";
38 private BitBakeSourceViewerConfiguration viewerConfiguration;
39 private IFile targetFile;
40
41 public BitBakeFileEditor() {
42 super();
43 viewerConfiguration = new BitBakeSourceViewerConfiguration(getSharedColors(), getPreferenceStore());
44 setSourceViewerConfiguration(viewerConfiguration);
45 setDocumentProvider(new BitBakeDocumentProvider());
46 }
47
48 @Override
49 protected void createActions() {
50 super.createActions();
51
52 ResourceBundle bundle= RecipeEditorMessages.getBundle();
53 ContentAssistAction action= new ContentAssistAction(bundle, "contentAssist.", this); //$NON-NLS-1$
54 action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
55 setAction(CONTENT_ASSIST, action);
56 }
57
58 @Override
59 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
60
61 if (input instanceof FileEditorInput) {
62 IProject p = ((FileEditorInput)input).getFile().getProject();
63 targetFile = ((FileEditorInput)input).getFile();
64 viewerConfiguration.setTargetFile(targetFile);
65
66 try {
67 viewerConfiguration.setBBSession(Activator.getBBSession(p.getLocationURI().getPath()));
68 } catch (IOException e) {
69 e.printStackTrace();
70 throw new PartInitException(Status.CANCEL_STATUS);
71 }
72 }
73 super.init(site, input);
74 }
75} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.editors.bitbake;
12
13import org.eclipse.core.resources.IFile;
14import org.eclipse.jface.preference.IPreferenceStore;
15import org.eclipse.jface.text.ITextHover;
16import org.eclipse.jface.text.TextAttribute;
17import org.eclipse.jface.text.contentassist.ContentAssistant;
18import org.eclipse.jface.text.contentassist.IContentAssistant;
19import org.eclipse.jface.text.presentation.IPresentationReconciler;
20import org.eclipse.jface.text.presentation.PresentationReconciler;
21import org.eclipse.jface.text.reconciler.IReconciler;
22import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
23import org.eclipse.jface.text.rules.IRule;
24import org.eclipse.jface.text.rules.IToken;
25import org.eclipse.jface.text.rules.IWordDetector;
26import org.eclipse.jface.text.rules.RuleBasedScanner;
27import org.eclipse.jface.text.rules.SingleLineRule;
28import org.eclipse.jface.text.rules.Token;
29import org.eclipse.jface.text.rules.WordRule;
30import org.eclipse.jface.text.source.ISharedTextColors;
31import org.eclipse.jface.text.source.ISourceViewer;
32import org.eclipse.swt.SWT;
33import org.eclipse.swt.graphics.Color;
34import org.eclipse.swt.graphics.RGB;
35import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
36
37import org.yocto.bc.bitbake.BBLanguageHelper;
38import org.yocto.bc.bitbake.BBSession;
39
40public class BitBakeSourceViewerConfiguration extends TextSourceViewerConfiguration {
41
42 private static final class WordDetector implements IWordDetector {
43 public boolean isWordPart(char c) {
44 return !Character.isWhitespace(c);
45 }
46
47 public boolean isWordStart(char c) {
48 return !Character.isWhitespace(c);
49 }
50 }
51
52 private final ISharedTextColors fSharedColors;
53 private BBSession session;
54 private IFile targetFile;
55 private BBVariableTextHover textHover = null;
56
57 public BitBakeSourceViewerConfiguration(ISharedTextColors sharedColors, IPreferenceStore store) {
58 super(store);
59 fSharedColors = sharedColors;
60 }
61
62 protected void setTargetFile(IFile targetFile) {
63 this.targetFile = targetFile;
64 }
65
66 public ITextHover getTextHover(ISourceViewer sv, String contentType) {
67 //only .bb file support Text Hover.
68 if (textHover == null && targetFile.getFileExtension().equals(BBLanguageHelper.BITBAKE_RECIPE_FILE_EXTENSION)) {
69 textHover = new BBVariableTextHover(session, targetFile.getLocationURI().getPath());
70 }
71
72 return textHover;
73 }
74
75 private void addDamagerRepairer(PresentationReconciler reconciler, RuleBasedScanner commentScanner, String contentType) {
76 DefaultDamagerRepairer commentDamagerRepairer = new DefaultDamagerRepairer(commentScanner);
77 reconciler.setDamager(commentDamagerRepairer, contentType);
78 reconciler.setRepairer(commentDamagerRepairer, contentType);
79 }
80
81 private RuleBasedScanner createCommentScanner() {
82 Color green = fSharedColors.getColor(new RGB(16, 96, 16));
83 RuleBasedScanner commentScanner = new RuleBasedScanner();
84 commentScanner.setDefaultReturnToken(new Token(new TextAttribute(green, null, SWT.ITALIC)));
85 return commentScanner;
86 }
87
88 private IRule createCustomFunctionRule() {
89 Color blue = fSharedColors.getColor(new RGB(130, 0, 0));
90 IRule rule = new CustomFunctionRule(new Token(new TextAttribute(blue, null, SWT.BOLD)));
91
92 return rule;
93 }
94
95 private SingleLineRule createFunctionNameRule() {
96 Color red = fSharedColors.getColor(new RGB(150, 0, 96));
97 SingleLineRule stepRule = new SingleLineRule("do_", ")", new Token(new TextAttribute(red, null, SWT.BOLD))); //$NON-NLS-1$ //$NON-NLS-2$
98 stepRule.setColumnConstraint(0);
99 return stepRule;
100 }
101
102 private SingleLineRule createInlineVariableRule() {
103 Color blue = fSharedColors.getColor(new RGB(50, 50, 100));
104 SingleLineRule stepRule = new SingleLineRule("${", "}", new Token(new TextAttribute(blue, null, SWT.BOLD))); //$NON-NLS-1$ //$NON-NLS-2$
105 return stepRule;
106 }
107
108 private WordRule createKeywordRule() {
109 WordRule keywordRule = new WordRule(new WordDetector());
110 IToken token = new Token(new TextAttribute(fSharedColors.getColor(new RGB(96, 96, 0)), null, SWT.NONE));
111
112 for (int i = 0; i < BBLanguageHelper.BITBAKE_KEYWORDS.length; ++i) {
113
114 keywordRule.addWord(BBLanguageHelper.BITBAKE_KEYWORDS[i], token);
115 keywordRule.setColumnConstraint(0);
116 }
117
118 return keywordRule;
119 }
120
121 private RuleBasedScanner createRecipeScanner() {
122 RuleBasedScanner recipeScanner = new RuleBasedScanner();
123
124 IRule[] rules = { createKeywordRule(), createShellKeywordRule(), createStringLiteralRule(), createVariableRule(), createFunctionNameRule(), createCustomFunctionRule(),
125 createInlineVariableRule() };
126 recipeScanner.setRules(rules);
127 return recipeScanner;
128 }
129
130 private WordRule createShellKeywordRule() {
131 WordRule keywordRule = new WordRule(new WordDetector());
132 IToken token = new Token(new TextAttribute(fSharedColors.getColor(new RGB(0, 64, 92)), null, SWT.NONE));
133
134 for (int i = 0; i < BBLanguageHelper.SHELL_KEYWORDS.length; ++i) {
135 keywordRule.addWord(BBLanguageHelper.SHELL_KEYWORDS[i], token);
136 }
137
138 return keywordRule;
139 }
140
141 private SingleLineRule createStringLiteralRule() {
142 Color red = fSharedColors.getColor(new RGB(50, 50, 100));
143 SingleLineRule rule = new SingleLineRule("\"", "\"", new Token(new TextAttribute(red, null, SWT.NONE)), '\\');
144
145 return rule;
146 }
147
148 private IRule createVariableRule() {
149 Color blue = fSharedColors.getColor(new RGB(0, 0, 200));
150 IRule rule = new VariableRule(new Token(new TextAttribute(blue, null, SWT.NONE)));
151
152 return rule;
153 }
154
155 @Override
156 public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
157 return new String[] { BitBakeDocumentProvider.RECIPE_CODE, BitBakeDocumentProvider.RECIPE_COMMENT };
158 }
159
160 @Override
161 public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
162 return BitBakeDocumentProvider.RECIPE_PARTITIONING;
163 }
164
165 @Override
166 public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
167 ContentAssistant assistant = new ContentAssistant();
168 assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
169
170 // assistant.setContentAssistProcessor(new HippieProposalProcessor(),
171 // BitBakeDocumentProvider.RECIPE_COMMENT);
172 assistant.setContentAssistProcessor(new RecipeCompletionProcessor(), BitBakeDocumentProvider.RECIPE_CODE);
173
174 return assistant;
175 }
176
177 public IReconciler getReconciler(ISourceViewer sourceViewer) {
178 return null;
179 }
180
181 @Override
182 public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
183 PresentationReconciler reconciler = new PresentationReconciler();
184 reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
185
186 addDamagerRepairer(reconciler, createCommentScanner(), BitBakeDocumentProvider.RECIPE_COMMENT);
187 addDamagerRepairer(reconciler, createRecipeScanner(), BitBakeDocumentProvider.RECIPE_CODE);
188
189 return reconciler;
190 }
191
192 public void setBBSession(BBSession session) {
193 this.session = session;
194 }
195}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.editors.bitbake;
12
13import org.eclipse.jface.text.rules.ICharacterScanner;
14import org.eclipse.jface.text.rules.IRule;
15import org.eclipse.jface.text.rules.IToken;
16import org.eclipse.jface.text.rules.Token;
17
18/**
19 * Rule for def_ BB Recipe functions
20 * @author kgilmer
21 *
22 */
23final class CustomFunctionRule implements IRule {
24
25 /** Token to return for this rule */
26 private final IToken fToken;
27
28 /**
29 * Creates a new operator rule.
30 *
31 * @param token
32 * Token to use for this rule
33 */
34 public CustomFunctionRule(IToken token) {
35 fToken = token;
36 }
37
38 public IToken evaluate(ICharacterScanner scanner) {
39 if (scanner.getColumn() > 0) {
40 return Token.UNDEFINED;
41 }
42
43 int i = scanner.read();
44 int c = 1;
45
46 if (!Character.isLetter(i) && i != 10) {
47 scanner.unread();
48 return Token.UNDEFINED;
49 }
50
51 if (i == 'd' && scanAhead(scanner, "o_".toCharArray())) {
52 scanner.unread();
53 return Token.UNDEFINED;
54 }
55
56 while (i != ICharacterScanner.EOF && i != 10) {
57 i = scanner.read();
58 c++;
59
60 if (i == '(') {
61 readUntil(scanner, ')');
62
63 return fToken;
64 }
65 }
66
67 for (int t = 0; t < c; t++) {
68 scanner.unread();
69 }
70
71 return Token.UNDEFINED;
72 }
73
74 private void readUntil(ICharacterScanner scanner, int c) {
75 int i;
76 do {
77 i = scanner.read();
78 } while (! (i == ICharacterScanner.EOF) && ! (i == c));
79 }
80
81 private boolean scanAhead(ICharacterScanner scanner, char [] chars) {
82 boolean v = true;
83 for (int i = 0; i < chars.length; ++i) {
84 if (! (scanner.read() == chars[i])) {
85 v = false;
86 for (int j = 0; j < i; ++j) {
87 scanner.unread();
88 }
89 break;
90 }
91 }
92 return v;
93 }
94} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 * Lianhao Lu (Intel) - remove compile warnings
11 *******************************************************************************/
12package org.yocto.bc.ui.editors.bitbake;
13
14import java.util.ArrayList;
15import java.util.Arrays;
16import java.util.Iterator;
17import java.util.List;
18import java.util.Map;
19
20import org.eclipse.jface.text.IDocument;
21import org.eclipse.jface.text.ITextViewer;
22import org.eclipse.jface.text.Region;
23import org.eclipse.jface.text.contentassist.ICompletionProposal;
24import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
25import org.eclipse.jface.text.contentassist.IContextInformation;
26import org.eclipse.jface.text.contentassist.IContextInformationValidator;
27import org.eclipse.jface.text.templates.DocumentTemplateContext;
28import org.eclipse.jface.text.templates.Template;
29import org.eclipse.jface.text.templates.TemplateContext;
30import org.eclipse.jface.text.templates.TemplateContextType;
31import org.eclipse.jface.text.templates.TemplateProposal;
32import org.eclipse.swt.graphics.Image;
33import org.eclipse.ui.ide.IDE.SharedImages;
34import org.eclipse.ui.PlatformUI;
35
36import org.yocto.bc.bitbake.BBLanguageHelper;
37import org.yocto.bc.ui.Activator;
38
39class RecipeCompletionProcessor implements IContentAssistProcessor {
40
41 private static final String CONTEXT_ID= "bitbake_variables"; //$NON-NLS-1$
42 private final TemplateContextType fContextType= new TemplateContextType(CONTEXT_ID, "Common BitBake Variables"); //$NON-NLS-1$
43 //private final TemplateContextType fKeywordContextType= new TemplateContextType("bitbake_keywords", "BitBake Keywords"); //$NON-NLS-1$
44 private final TemplateContextType fFunctionContextType = new TemplateContextType("bitbake_functions", "BitBake Functions");
45
46 RecipeCompletionProcessor() {
47 }
48
49 public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
50 IDocument document= viewer.getDocument();
51 Region region= new Region(offset, 0);
52
53 TemplateContext templateContext= new DocumentTemplateContext(fContextType, document, offset, 0);
54 //TemplateContext keywordContext = new DocumentTemplateContext(fKeywordContextType, document, offset, 0);
55 TemplateContext functionContext = new DocumentTemplateContext(fFunctionContextType, document, offset, 0);
56
57 List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
58
59 getVariableTemplateProposals(templateContext, region, proposals);
60 // getKeywordTemplateProposals(keywordContext, region, proposals);
61 getAddTaskTemplateProposals(templateContext, region, proposals);
62 getFunctionTemplateProposals(functionContext, region, proposals);
63
64 return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
65 }
66
67 public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
68 return null;
69 }
70
71 private Template generateVariableTemplate(String name, String description) {
72
73 return new Template(name, description, CONTEXT_ID, name + " = \"${" + name.toLowerCase() + "}\"", false);
74 }
75
76 private void getAddTaskTemplateProposals(TemplateContext templateContext, Region region, List<ICompletionProposal> p) {
77 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)));
78 }
79
80
81 public char[] getCompletionProposalAutoActivationCharacters() {
82 return null;
83 }
84
85 public char[] getContextInformationAutoActivationCharacters() {
86 return null;
87 }
88
89 public IContextInformationValidator getContextInformationValidator() {
90 return null;
91 }
92
93 public String getErrorMessage() {
94 return null;
95 }
96
97 private void getFunctionTemplateProposals(TemplateContext templateContext, Region region, List<ICompletionProposal> p) {
98 String [] keywords = BBLanguageHelper.BITBAKE_STANDARD_FUNCTIONS;
99 Image img = Activator.getDefault().getImageRegistry().get(Activator.IMAGE_FUNCTION);
100 Arrays.sort(keywords);
101
102 for (int i = 0; i < keywords.length; ++i) {
103 p.add(new TemplateProposal(new Template(keywords[i], keywords[i] + " function", CONTEXT_ID, "do_" + keywords[i] + "() {\n\n}", false), templateContext, region, img));
104 }
105 }
106 /*
107 private void getKeywordTemplateProposals(TemplateContext templateContext, Region region, List<TemplateProposal> p) {
108 String [] keywords = BBLanguageHelper.BITBAKE_KEYWORDS;
109
110 Arrays.sort(keywords);
111
112 for (int i = 0; i < keywords.length; ++i) {
113 p.add(new TemplateProposal(new Template(keywords[i], keywords[i] + " keyword", CONTEXT_ID, keywords[i] + " ", false),templateContext, region, null));
114 }
115 }
116 */
117
118 private void getVariableTemplateProposals(TemplateContext templateContext, Region region, List<ICompletionProposal> p) {
119 Map<String, String> n = BBLanguageHelper.getCommonBitbakeVariables();
120 Image img = Activator.getDefault().getImageRegistry().get(Activator.IMAGE_VARIABLE);
121 for (Iterator<String> i = n.keySet().iterator(); i.hasNext();) {
122 String name = (String) i.next();
123 String description = (String) n.get(name);
124 p.add(new TemplateProposal(generateVariableTemplate(name, description), templateContext, region, img));
125 }
126 }
127} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.editors.bitbake;
12
13import org.eclipse.jface.action.IMenuManager;
14import org.eclipse.ui.IEditorPart;
15import org.eclipse.ui.IWorkbenchActionConstants;
16import org.eclipse.ui.editors.text.TextEditorActionContributor;
17import org.eclipse.ui.texteditor.ITextEditor;
18import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
19import org.eclipse.ui.texteditor.RetargetTextEditorAction;
20
21public class RecipeEditorActionContributor extends TextEditorActionContributor {
22
23 private RetargetTextEditorAction fContentAssist;
24
25 public RecipeEditorActionContributor() {
26 fContentAssist= new RetargetTextEditorAction(RecipeEditorMessages.getBundle(), "contentAssist."); //$NON-NLS-1$
27 fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
28 }
29
30 @Override
31 public void contributeToMenu(IMenuManager menu) {
32 super.contributeToMenu(menu);
33
34 IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
35 if (editMenu != null) {
36 editMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fContentAssist);
37 }
38 }
39
40 @Override
41 public void setActiveEditor(IEditorPart part) {
42 super.setActiveEditor(part);
43 if (part instanceof ITextEditor) {
44 fContentAssist.setAction(getAction((ITextEditor) part, BitBakeFileEditor.CONTENT_ASSIST));
45 }
46 }
47}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.editors.bitbake;
12
13import java.util.ResourceBundle;
14
15public class RecipeEditorMessages {
16
17 public static ResourceBundle getBundle() {
18 return ResourceBundle.getBundle(RecipeEditorMessages.class.getName());
19 }
20
21}
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 @@
1#########################################################
2# Copyright (c) 2006 IBM Corporation and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Common Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/cpl-v10.html
7#
8# Contributors:
9# IBM Corporation - initial API and implementation
10##########################################################
11contentAssist.label=Content Assist
12contentAssist.tooltip=Content Assist
13contentAssist.image=
14contentAssist.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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.editors.bitbake;
12
13import org.eclipse.jface.text.rules.ICharacterScanner;
14import org.eclipse.jface.text.rules.IRule;
15import org.eclipse.jface.text.rules.IToken;
16import org.eclipse.jface.text.rules.Token;
17
18final class VariableRule implements IRule {
19
20 /** Token to return for this rule */
21 private final IToken fToken;
22
23 /**
24 * Creates a new operator rule.
25 *
26 * @param token
27 * Token to use for this rule
28 */
29 public VariableRule(IToken token) {
30 fToken = token;
31 }
32
33 public IToken evaluate(ICharacterScanner scanner) {
34 if (scanner.getColumn() > 0) {
35 return Token.UNDEFINED;
36 }
37
38 int i = scanner.read();
39 int c = 1;
40
41 if (!Character.isLetter(i) && i != 10) {
42 scanner.unread();
43 return Token.UNDEFINED;
44 }
45
46 int p = i;
47
48 while (i != ICharacterScanner.EOF && i != 10) {
49 p = i;
50 i = scanner.read();
51 c++;
52
53 if (i == '=') {
54 scanner.unread();
55
56 if (p == '?' || p == '+') {
57 scanner.unread();
58 }
59 return fToken;
60 }
61 }
62
63 for (int t = 0; t < c; t++) {
64 scanner.unread();
65 }
66
67 return Token.UNDEFINED;
68 }
69} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.filesystem;
12
13import org.eclipse.osgi.util.NLS;
14
15/**
16 * Provides translatable messages for the file system bundle
17 */
18public class Messages extends NLS {
19 private static final String BUNDLE_NAME = "org.eclipse.core.internal.filesystem.messages"; //$NON-NLS-1$
20
21 public static String copying;
22 public static String couldnotDelete;
23 public static String couldnotDeleteReadOnly;
24 public static String couldNotLoadLibrary;
25 public static String couldNotMove;
26 public static String couldNotRead;
27 public static String couldNotWrite;
28 public static String deleteProblem;
29 public static String deleting;
30 public static String failedCreateWrongType;
31 public static String failedMove;
32 public static String failedReadDuringWrite;
33 public static String fileExists;
34 public static String fileNotFound;
35 public static String moving;
36 public static String noFileSystem;
37 public static String noImplDelete;
38 public static String noImplWrite;
39 public static String noScheme;
40 public static String notAFile;
41 public static String readOnlyParent;
42
43 static {
44 // initialize resource bundles
45 NLS.initializeMessages(BUNDLE_NAME, Messages.class);
46 }
47
48}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2005, 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Ken Gilmer - adaptation from internal class.
11 *******************************************************************************/
12package org.yocto.bc.ui.filesystem;
13
14import java.io.File;
15import java.io.FileInputStream;
16import java.io.FileNotFoundException;
17import java.io.FileOutputStream;
18import java.io.IOException;
19import java.io.InputStream;
20import java.io.OutputStream;
21import java.net.URI;
22import java.util.List;
23
24import org.eclipse.core.filesystem.EFS;
25import org.eclipse.core.filesystem.IFileInfo;
26import org.eclipse.core.filesystem.IFileStore;
27import org.eclipse.core.filesystem.IFileSystem;
28import org.eclipse.core.filesystem.URIUtil;
29import org.eclipse.core.filesystem.provider.FileInfo;
30import org.eclipse.core.filesystem.provider.FileStore;
31import org.eclipse.core.runtime.CoreException;
32import org.eclipse.core.runtime.IPath;
33import org.eclipse.core.runtime.IProgressMonitor;
34import org.eclipse.core.runtime.IStatus;
35import org.eclipse.core.runtime.MultiStatus;
36import org.eclipse.core.runtime.NullProgressMonitor;
37import org.eclipse.core.runtime.Status;
38import org.eclipse.osgi.util.NLS;
39import org.yocto.bc.bitbake.BBSession;
40import org.yocto.bc.bitbake.ProjectInfoHelper;
41import org.yocto.bc.bitbake.ShellSession;
42
43/**
44 * File system implementation based on storage of files in the local
45 * operating system's file system.
46 */
47public class OEFile extends FileStore {
48 private static int attributes(File aFile) {
49 if (!aFile.exists() || aFile.canWrite())
50 return EFS.NONE;
51 return EFS.ATTRIBUTE_READ_ONLY;
52 }
53
54 /**
55 * The java.io.File that this store represents.
56 */
57 protected final File file;
58 private List ignorePaths;
59
60 /**
61 * The absolute file system path of the file represented by this store.
62 */
63 protected final String filePath;
64
65 private final String root;
66
67 /**
68 * Creates a new local file.
69 *
70 * @param file The file this local file represents
71 * @param root
72 */
73 public OEFile(File file, List ignorePaths, String root) {
74 this.file = file;
75 this.ignorePaths = ignorePaths;
76 this.root = root;
77 this.filePath = file.getAbsolutePath();
78 }
79
80 /**
81 * This method is called after a failure to modify a file or directory.
82 * Check to see if the parent is read-only and if so then
83 * throw an exception with a more specific message and error code.
84 *
85 * @param target The file that we failed to modify
86 * @param exception The low level exception that occurred, or <code>null</code>
87 * @throws CoreException A more specific exception if the parent is read-only
88 */
89 private void checkReadOnlyParent(File target, Throwable exception) throws CoreException {
90 File parent = target.getParentFile();
91 if (parent != null && (attributes(parent) & EFS.ATTRIBUTE_READ_ONLY) != 0) {
92 String message = NLS.bind(Messages.readOnlyParent, target.getAbsolutePath());
93 Policy.error(EFS.ERROR_PARENT_READ_ONLY, message, exception);
94 }
95 }
96
97 @Override
98 public String[] childNames(int options, IProgressMonitor monitor) {
99 String[] names = file.list();
100 return (names == null ? EMPTY_STRING_ARRAY : names);
101 }
102
103 /*
104 * detect if the path is potential builddir
105 */
106 private boolean isPotentialBuildDir(String path) {
107 boolean ret = true;
108 for (int i=0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) {
109 if((new File(path + BBSession.BUILDDIR_INDICATORS[i])).exists() == false) {
110 ret=false;
111 break;
112 }
113 }
114 return ret;
115 }
116
117 /*
118 * try to find items for ignoreList
119 */
120 private void updateIgnorePaths(String path, List list) {
121 if(isPotentialBuildDir(path)) {
122 BBSession config = null;
123 try {
124 ShellSession shell = new ShellSession(ShellSession.SHELL_TYPE_BASH, new File(root),
125 ProjectInfoHelper.getInitScriptPath(root) + " " + path, null);
126 config = new BBSession(shell, root, true);
127 config.initialize();
128 } catch(Exception e) {
129 e.printStackTrace();
130 return;
131 }
132 if (config.get("TMPDIR") == null || config.get("DL_DIR") == null || config.get("SSTATE_DIR") == null) {
133 //wrong guess about the buildDir
134 return;
135 }else {
136 if(!list.contains(config.get("TMPDIR"))) {
137 list.add(config.get("TMPDIR"));
138 }
139 if(!list.contains(config.get("DL_DIR"))) {
140 list.add(config.get("DL_DIR"));
141 }
142 if(!list.contains(config.get("SSTATE_DIR"))) {
143 list.add(config.get("SSTATE_DIR"));
144 }
145 }
146 }
147 }
148
149 @Override
150 public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {
151 String[] children = childNames(options, monitor);
152 IFileStore[] wrapped = new IFileStore[children.length];
153
154 for (int i = 0; i < wrapped.length; i++) {
155 String fullPath = file.toString() +File.separatorChar + children[i];
156
157 updateIgnorePaths(fullPath, ignorePaths);
158 if (ignorePaths.contains(fullPath)) {
159 wrapped[i] = getDeadChild(children[i]);
160 } else {
161 wrapped[i] = getChild(children[i]);
162 }
163 }
164
165 return wrapped;
166 }
167
168 @Override
169 public void copy(IFileStore destFile, int options, IProgressMonitor monitor) throws CoreException {
170 if (destFile instanceof OEFile) {
171 File source = file;
172 File destination = ((OEFile) destFile).file;
173 //handle case variants on a case-insensitive OS, or copying between
174 //two equivalent files in an environment that supports symbolic links.
175 //in these nothing needs to be copied (and doing so would likely lose data)
176 try {
177 if (source.getCanonicalFile().equals(destination.getCanonicalFile())) {
178 //nothing to do
179 return;
180 }
181 } catch (IOException e) {
182 String message = NLS.bind(Messages.couldNotRead, source.getAbsolutePath());
183 Policy.error(EFS.ERROR_READ, message, e);
184 }
185 }
186 //fall through to super implementation
187 super.copy(destFile, options, monitor);
188 }
189
190 @Override
191 public void delete(int options, IProgressMonitor monitor) throws CoreException {
192 if (monitor == null)
193 monitor = new NullProgressMonitor();
194 else
195 monitor = new NullProgressMonitor();
196 try {
197 monitor.beginTask(NLS.bind(Messages.deleting, this), 200);
198 String message = Messages.deleteProblem;
199 MultiStatus result = new MultiStatus(Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null);
200
201 //don't allow Eclipse to delete entire OE directory
202
203 if (!isProject()) {
204 internalDelete(file, filePath, result, monitor);
205 }
206
207 if (!result.isOK())
208 throw new CoreException(result);
209 } finally {
210 monitor.done();
211 }
212 }
213
214 @Override
215 public boolean equals(Object obj) {
216 if (!(obj instanceof OEFile))
217 return false;
218
219 OEFile otherFile = (OEFile) obj;
220
221 return file.equals(otherFile.file);
222 }
223
224 @Override
225 public IFileInfo fetchInfo(int options, IProgressMonitor monitor) {
226 //in-lined non-native implementation
227 FileInfo info = new FileInfo(file.getName());
228 final long lastModified = file.lastModified();
229 if (lastModified <= 0) {
230 //if the file doesn't exist, all other attributes should be default values
231 info.setExists(false);
232 return info;
233 }
234 info.setLastModified(lastModified);
235 info.setExists(true);
236 info.setLength(file.length());
237 info.setDirectory(file.isDirectory());
238 info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, file.exists() && !file.canWrite());
239 info.setAttribute(EFS.ATTRIBUTE_HIDDEN, file.isHidden());
240 return info;
241 }
242
243 @Override
244 public IFileStore getChild(IPath path) {
245 return new OEFile(new File(file, path.toOSString()), ignorePaths, root);
246 }
247
248 @Override
249 public IFileStore getChild(String name) {
250 return new OEFile(new File(file, name), ignorePaths, root);
251 }
252
253 private IFileStore getDeadChild(String name) {
254 return new OEIgnoreFile(new File(file, name));
255 }
256
257 /*
258 * (non-Javadoc)
259 * @see org.eclipse.core.filesystem.IFileStore#getFileSystem()
260 */
261 @Override
262 public IFileSystem getFileSystem() {
263 return OEFileSystem.getInstance();
264 }
265
266 @Override
267 public String getName() {
268 return file.getName();
269 }
270
271 @Override
272 public IFileStore getParent() {
273 File parent = file.getParentFile();
274 return parent == null ? null : new OEFile(parent, ignorePaths, root);
275 }
276
277 @Override
278 public int hashCode() {
279 return file.hashCode();
280 }
281
282 /**
283 * Deletes the given file recursively, adding failure info to
284 * the provided status object. The filePath is passed as a parameter
285 * to optimize java.io.File object creation.
286 */
287 private boolean internalDelete(File target, String pathToDelete, MultiStatus status, IProgressMonitor monitor) {
288 //first try to delete - this should succeed for files and symbolic links to directories
289 if (target.delete() || !target.exists())
290 return true;
291 if (target.isDirectory()) {
292 monitor.subTask(NLS.bind(Messages.deleting, target));
293 String[] list = target.list();
294 if (list == null)
295 list = EMPTY_STRING_ARRAY;
296 int parentLength = pathToDelete.length();
297 boolean failedRecursive = false;
298 for (int i = 0, imax = list.length; i < imax; i++) {
299 //optimized creation of child path object
300 StringBuffer childBuffer = new StringBuffer(parentLength + list[i].length() + 1);
301 childBuffer.append(pathToDelete);
302 childBuffer.append(File.separatorChar);
303 childBuffer.append(list[i]);
304 String childName = childBuffer.toString();
305 // try best effort on all children so put logical OR at end
306 failedRecursive = !internalDelete(new java.io.File(childName), childName, status, monitor) || failedRecursive;
307 monitor.worked(1);
308 }
309 try {
310 // don't try to delete the root if one of the children failed
311 if (!failedRecursive && target.delete())
312 return true;
313 } catch (Exception e) {
314 // we caught a runtime exception so log it
315 String message = NLS.bind(Messages.couldnotDelete, target.getAbsolutePath());
316 status.add(new Status(IStatus.ERROR, Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, e));
317 return false;
318 }
319 }
320 //if we got this far, we failed
321 String message = null;
322 if (fetchInfo().getAttribute(EFS.ATTRIBUTE_READ_ONLY))
323 message = NLS.bind(Messages.couldnotDeleteReadOnly, target.getAbsolutePath());
324 else
325 message = NLS.bind(Messages.couldnotDelete, target.getAbsolutePath());
326 status.add(new Status(IStatus.ERROR, Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null));
327 return false;
328 }
329
330 @Override
331 public boolean isParentOf(IFileStore other) {
332 if (!(other instanceof OEFile))
333 return false;
334 String thisPath = filePath;
335 String thatPath = ((OEFile) other).filePath;
336 int thisLength = thisPath.length();
337 int thatLength = thatPath.length();
338 //if equal then not a parent
339 if (thisLength >= thatLength)
340 return false;
341 if (getFileSystem().isCaseSensitive()) {
342 if (thatPath.indexOf(thisPath) != 0)
343 return false;
344 } else {
345 if (thatPath.toLowerCase().indexOf(thisPath.toLowerCase()) != 0)
346 return false;
347 }
348 //The common portion must end with a separator character for this to be a parent of that
349 return thisPath.charAt(thisLength - 1) == File.separatorChar || thatPath.charAt(thisLength) == File.separatorChar;
350 }
351
352 /**
353 * @return
354 */
355 private boolean isProject() {
356 return this.file.toString().equals(root);
357 }
358
359 @Override
360 public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
361 boolean shallow = (options & EFS.SHALLOW) != 0;
362 //must be a directory
363 if (shallow)
364 file.mkdir();
365 else
366 file.mkdirs();
367 if (!file.isDirectory()) {
368 checkReadOnlyParent(file, null);
369 String message = NLS.bind(Messages.failedCreateWrongType, filePath);
370 Policy.error(EFS.ERROR_WRONG_TYPE, message);
371 }
372 return this;
373 }
374
375 @Override
376 public void move(IFileStore destFile, int options, IProgressMonitor monitor) throws CoreException {
377 if (!(destFile instanceof OEFile)) {
378 super.move(destFile, options, monitor);
379 return;
380 }
381 File source = file;
382 File destination = ((OEFile) destFile).file;
383 boolean overwrite = (options & EFS.OVERWRITE) != 0;
384 monitor = Policy.monitorFor(monitor);
385 try {
386 monitor.beginTask(NLS.bind(Messages.moving, source.getAbsolutePath()), 10);
387 //this flag captures case renaming on a case-insensitive OS, or moving
388 //two equivalent files in an environment that supports symbolic links.
389 //in these cases we NEVER want to delete anything
390 boolean sourceEqualsDest = false;
391 try {
392 sourceEqualsDest = source.getCanonicalFile().equals(destination.getCanonicalFile());
393 } catch (IOException e) {
394 String message = NLS.bind(Messages.couldNotMove, source.getAbsolutePath());
395 Policy.error(EFS.ERROR_WRITE, message, e);
396 }
397 if (!sourceEqualsDest && !overwrite && destination.exists()) {
398 String message = NLS.bind(Messages.fileExists, destination.getAbsolutePath());
399 Policy.error(EFS.ERROR_EXISTS, message);
400 }
401 if (source.renameTo(destination)) {
402 // double-check to ensure we really did move
403 // since java.io.File#renameTo sometimes lies
404 if (!sourceEqualsDest && source.exists()) {
405 // XXX: document when this occurs
406 if (destination.exists()) {
407 // couldn't delete the source so remove the destination and throw an error
408 // XXX: if we fail deleting the destination, the destination (root) may still exist
409 new OEFile(destination, ignorePaths, root).delete(EFS.NONE, null);
410 String message = NLS.bind(Messages.couldnotDelete, source.getAbsolutePath());
411 Policy.error(EFS.ERROR_DELETE, message);
412 }
413 // source exists but destination doesn't so try to copy below
414 } else {
415 if (!destination.exists()) {
416 // neither the source nor the destination exist. this is REALLY bad
417 String message = NLS.bind(Messages.failedMove, source.getAbsolutePath(), destination.getAbsolutePath());
418 Policy.error(EFS.ERROR_WRITE, message);
419 }
420 //the move was successful
421 monitor.worked(10);
422 return;
423 }
424 }
425 // for some reason renameTo didn't work
426 if (sourceEqualsDest) {
427 String message = NLS.bind(Messages.couldNotMove, source.getAbsolutePath());
428 Policy.error(EFS.ERROR_WRITE, message, null);
429 }
430 // fall back to default implementation
431 super.move(destFile, options, Policy.subMonitorFor(monitor, 10));
432 } finally {
433 monitor.done();
434 }
435 }
436
437 @Override
438 public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
439 monitor = Policy.monitorFor(monitor);
440 try {
441 monitor.beginTask("", 1); //$NON-NLS-1$
442 return new FileInputStream(file);
443 } catch (FileNotFoundException e) {
444 String message;
445 if (!file.exists())
446 message = NLS.bind(Messages.fileNotFound, filePath);
447 else if (file.isDirectory())
448 message = NLS.bind(Messages.notAFile, filePath);
449 else
450 message = NLS.bind(Messages.couldNotRead, filePath);
451 Policy.error(EFS.ERROR_READ, message, e);
452 return null;
453 } finally {
454 monitor.done();
455 }
456 }
457
458 @Override
459 public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
460 monitor = Policy.monitorFor(monitor);
461 try {
462 monitor.beginTask("", 1); //$NON-NLS-1$
463 return new FileOutputStream(file, (options & EFS.APPEND) != 0);
464 } catch (FileNotFoundException e) {
465 checkReadOnlyParent(file, e);
466 String message;
467 String path = filePath;
468 if (file.isDirectory())
469 message = NLS.bind(Messages.notAFile, path);
470 else
471 message = NLS.bind(Messages.couldNotWrite, path);
472 Policy.error(EFS.ERROR_WRITE, message, e);
473 return null;
474 } finally {
475 monitor.done();
476 }
477 }
478
479 @Override
480 public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
481 boolean success = true;
482
483 //native does not currently set last modified
484 if ((options & EFS.SET_LAST_MODIFIED) != 0)
485 success &= file.setLastModified(info.getLastModified());
486 if (!success && !file.exists())
487 Policy.error(EFS.ERROR_NOT_EXISTS, NLS.bind(Messages.fileNotFound, filePath));
488 }
489
490 /* (non-Javadoc)
491 * @see org.eclipse.core.filesystem.provider.FileStore#toLocalFile(int, org.eclipse.core.runtime.IProgressMonitor)
492 */
493 @Override
494 public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException {
495 if (options == EFS.CACHE)
496 return super.toLocalFile(options, monitor);
497 return file;
498 }
499
500 /* (non-Javadoc)
501 * @see org.eclipse.core.filesystem.IFileStore#toString()
502 */
503 @Override
504 public String toString() {
505 return file.toString();
506 }
507
508 /* (non-Javadoc)
509 * @see org.eclipse.core.filesystem.IFileStore#toURI()
510 */
511 @Override
512 public URI toURI() {
513 return URIUtil.toURI(filePath);
514 }
515}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.filesystem;
12
13import java.io.File;
14import java.net.URI;
15import java.util.ArrayList;
16import java.util.Hashtable;
17import java.util.List;
18import java.util.Map;
19
20import org.eclipse.core.filesystem.IFileStore;
21import org.eclipse.core.filesystem.IFileSystem;
22import org.eclipse.core.filesystem.provider.FileSystem;
23
24import org.yocto.bc.bitbake.BBSession;
25import org.yocto.bc.ui.Activator;
26
27/**
28 * A filesystem that ignores specific OE directories that contain derived information.
29 * @author kgilmer
30 *
31 */
32public class OEFileSystem extends FileSystem {
33
34 private static IFileSystem ref;
35 public static IFileSystem getInstance() {
36 return ref;
37 }
38
39 private Map fileStoreCache;
40
41 public OEFileSystem() {
42 ref = this;
43 fileStoreCache = new Hashtable();
44 }
45
46 @Override
47 public IFileStore getStore(URI uri) {
48
49 OEFile uf = (OEFile) fileStoreCache.get(uri);
50
51 if (uf == null) {
52 BBSession config = null;
53 try {
54 config = Activator.getBBSession(uri.getPath());
55 config.initialize();
56 } catch (Exception e) {
57 e.printStackTrace();
58 return new OEIgnoreFile(new File(uri.getPath()));
59 }
60
61 if (config.get("TMPDIR") == null || config.get("DL_DIR") == null || config.get("SSTATE_DIR")== null) {
62 throw new RuntimeException("Invalid local.conf: TMPDIR or DL_DIR or SSTATE_DIR undefined.");
63 }
64
65 List ignoreList = new ArrayList();
66
67 //These directories are ignored because they contain too many files for Eclipse to handle efficiently.
68 ignoreList.add(config.get("TMPDIR"));
69 ignoreList.add(config.get("DL_DIR"));
70 ignoreList.add(config.get("SSTATE_DIR"));
71
72 uf = new OEFile(new File(uri.getPath()), ignoreList, uri.getPath());
73 fileStoreCache.put(uri, uf);
74 }
75
76 return uf;
77 }
78}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.filesystem;
12
13import java.net.URI;
14
15import org.eclipse.swt.widgets.Shell;
16import org.eclipse.ui.ide.fileSystem.FileSystemContributor;
17
18public class OEFileSystemContributor extends FileSystemContributor {
19
20 @Override
21 public URI browseFileSystem(String initialPath, Shell shell) {
22 return null;
23 }
24
25 @Override
26 public URI getURI(String string) {
27 return super.getURI(string);
28 }
29
30}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.filesystem;
12
13import java.io.File;
14import java.io.InputStream;
15import java.io.OutputStream;
16import java.net.URI;
17
18import org.eclipse.core.filesystem.IFileInfo;
19import org.eclipse.core.filesystem.IFileStore;
20import org.eclipse.core.filesystem.IFileSystem;
21import org.eclipse.core.filesystem.provider.FileInfo;
22import org.eclipse.core.runtime.CoreException;
23import org.eclipse.core.runtime.IPath;
24import org.eclipse.core.runtime.IProgressMonitor;
25
26public class OEIgnoreFile implements IFileStore {
27
28 private final File file;
29
30 public OEIgnoreFile(File file) {
31 this.file = file;
32 }
33
34 public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException {
35
36 return new IFileInfo[0];
37 }
38
39 public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
40 return new String[0];
41 }
42
43 public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {
44
45 return new IFileStore[0];
46 }
47
48 public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
49 // TODO Auto-generated method stub
50
51 }
52
53 public void delete(int options, IProgressMonitor monitor) throws CoreException {
54 // TODO Auto-generated method stub
55
56 }
57
58 public IFileInfo fetchInfo() {
59 // TODO Auto-generated method stub
60 return new FileInfo(file.getName());
61 }
62
63 public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
64 return new FileInfo(file.getName());
65 }
66
67 public Object getAdapter(Class adapter) {
68 // TODO Auto-generated method stub
69 return null;
70 }
71
72 public IFileStore getChild(IPath path) {
73 // TODO Auto-generated method stub
74 return null;
75 }
76
77
78
79 public IFileStore getChild(String name) {
80 return null;
81 }
82
83 public IFileSystem getFileSystem() {
84 // TODO Auto-generated method stub
85 return OEFileSystem.getInstance();
86 }
87
88 public String getName() {
89 return file.getName();
90 }
91
92 public IFileStore getParent() {
93 // TODO Auto-generated method stub
94 return null;
95 }
96
97 public boolean isParentOf(IFileStore other) {
98 // TODO Auto-generated method stub
99 return false;
100 }
101
102 public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
103 return null;
104 }
105
106 public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
107 }
108
109 public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
110 return null;
111 }
112
113 public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
114 return null;
115 }
116
117 public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
118 }
119
120 public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException {
121 return file;
122 }
123
124 public URI toURI() {
125 return file.toURI();
126 }
127
128 public IFileStore getFileStore(IPath path) {
129 return null;
130 }
131
132
133}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2000, 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.filesystem;
12
13import java.io.IOException;
14import java.io.InputStream;
15import java.io.OutputStream;
16import java.util.Date;
17
18import org.eclipse.core.runtime.CoreException;
19import org.eclipse.core.runtime.IProgressMonitor;
20import org.eclipse.core.runtime.NullProgressMonitor;
21import org.eclipse.core.runtime.OperationCanceledException;
22import org.eclipse.core.runtime.Status;
23import org.eclipse.core.runtime.SubProgressMonitor;
24
25import org.yocto.bc.ui.Activator;
26
27/**
28 * Grab bag of utility methods for the file system plugin
29 */
30public class Policy {
31
32 /**
33 * General debug flag for the plugin
34 */
35 public static boolean DEBUG = false;
36
37 public static final String PI_FILE_SYSTEM = "org.eclipse.core.filesystem"; //$NON-NLS-1$
38
39 public static void checkCanceled(IProgressMonitor monitor) {
40 if (monitor.isCanceled())
41 throw new OperationCanceledException();
42 }
43
44 /**
45 * Print a debug message to the console.
46 * Pre-pend the message with the current date and the name of the current thread.
47 */
48 public static void debug(String message) {
49 StringBuffer buffer = new StringBuffer();
50 buffer.append(new Date(System.currentTimeMillis()));
51 buffer.append(" - ["); //$NON-NLS-1$
52 buffer.append(Thread.currentThread().getName());
53 buffer.append("] "); //$NON-NLS-1$
54 buffer.append(message);
55 System.out.println(buffer.toString());
56 }
57
58 public static void error(int code, String message) throws CoreException {
59 error(code, message, null);
60 }
61
62 public static void error(int code, String message, Throwable exception) throws CoreException {
63 int severity = code == 0 ? 0 : 1 << (code % 100 / 33);
64 throw new CoreException(new Status(severity, PI_FILE_SYSTEM, code, message, exception));
65 }
66
67 public static void log(int severity, String message, Throwable t) {
68 if (message == null)
69 message = ""; //$NON-NLS-1$
70 Activator.getDefault().getLog().log(new Status(severity, PI_FILE_SYSTEM, 1, message, t));
71 }
72
73 public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
74 return monitor == null ? new NullProgressMonitor() : monitor;
75 }
76
77 /**
78 * Closes a stream and ignores any resulting exception.
79 */
80 public static void safeClose(InputStream in) {
81 try {
82 if (in != null)
83 in.close();
84 } catch (IOException e) {
85 //ignore
86 }
87 }
88
89 /**
90 * Closes a stream and ignores any resulting exception.
91 */
92 public static void safeClose(OutputStream out) {
93 try {
94 if (out != null)
95 out.close();
96 } catch (IOException e) {
97 //ignore
98 }
99 }
100
101 public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
102 if (monitor == null)
103 return new NullProgressMonitor();
104 if (monitor instanceof NullProgressMonitor)
105 return monitor;
106 return new SubProgressMonitor(monitor, ticks);
107 }
108}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.model;
12
13public interface IModelElement {
14 public void initialize() throws Exception;
15}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.model;
12
13
14public class ProjectInfo implements IModelElement {
15 private String name;
16 private String location;
17 private String init;
18
19 public ProjectInfo() {
20 }
21
22 public String getInitScriptPath() {
23 return init;
24 }
25 public String getProjectName() {
26 return name;
27 }
28 public String getRootPath() {
29 return location;
30 }
31 public void initialize() throws Exception {
32 name = new String();
33 location = new String();
34 init = new String();
35 }
36
37 public void setInitScriptPath(String init) {
38 this.init = init;
39 }
40
41 public void setLocation(String location) {
42 this.location = location;
43 }
44
45 public void setName(String name) {
46 this.name = name;
47 }
48}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.perspectives;
12
13import org.eclipse.ui.IFolderLayout;
14import org.eclipse.ui.IPageLayout;
15import org.eclipse.ui.IPerspectiveFactory;
16import org.eclipse.ui.console.IConsoleConstants;
17
18import org.yocto.bc.ui.views.RecipeView;
19
20public class BitbakeCommanderPerspective implements IPerspectiveFactory {
21
22 private IPageLayout factory;
23
24 public BitbakeCommanderPerspective() {
25 super();
26 }
27
28 private void addActionSets() {
29 factory.addActionSet("org.yocto.bc.ui.actionSet");
30 factory.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); // NON-NLS-1
31 }
32
33 private void addNewWizardShortcuts() {
34 factory.addNewWizardShortcut("org.yocto.bc.ui.wizards.NewRecipeWizard");// NON-NLS-1
35 //factory.addNewWizardShortcut("org.yocto.bc.ui.wizards.newproject.NewBBCProjectWizard");// NON-NLS-1
36 factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");// NON-NLS-1
37 }
38
39 private void addPerspectiveShortcuts() {
40 // factory.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective");
41 // //NON-NLS-1
42 // factory.addPerspectiveShortcut("org.eclipse.team.cvs.ui.cvsPerspective");
43 // //NON-NLS-1
44 factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); // NON-NLS-1
45 }
46
47 private void addViews() {
48 IFolderLayout bottom = factory.createFolder("bottomRight", // NON-NLS-1
49 IPageLayout.BOTTOM, 0.75f, factory.getEditorArea());
50
51 bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
52 bottom.addView("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1
53 bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
54
55 IFolderLayout topLeft = factory.createFolder("topLeft", // NON-NLS-1
56 IPageLayout.LEFT, 0.25f, factory.getEditorArea());
57 topLeft.addView(IPageLayout.ID_RES_NAV);
58 //llu detach RecipeView
59 //topLeft.addView(RecipeView.ID_VIEW); // NON-NLS-1
60
61 }
62
63 private void addViewShortcuts() {
64 // factory.addShowViewShortcut("org.eclipse.ant.ui.views.AntView");
65 // //NON-NLS-1
66 // factory.addShowViewShortcut("org.eclipse.team.ccvs.ui.AnnotateView");
67 // //NON-NLS-1
68 // factory.addShowViewShortcut("org.eclipse.pde.ui.DependenciesView");
69 // //NON-NLS-1
70 // factory.addShowViewShortcut("org.eclipse.jdt.junit.ResultView");
71 // //NON-NLS-1
72 factory.addShowViewShortcut("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1
73 factory.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
74 // factory.addShowViewShortcut(JavaUI.ID_PACKAGES);
75 factory.addShowViewShortcut(IPageLayout.ID_RES_NAV);
76 // factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
77 // factory.addShowViewShortcut(IPageLayout.ID_OUTLINE);
78 }
79
80 public void createInitialLayout(IPageLayout factory) {
81 this.factory = factory;
82 addViews();
83 addActionSets();
84 addNewWizardShortcuts();
85 addPerspectiveShortcuts();
86 addViewShortcuts();
87 }
88
89}
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 @@
1package org.yocto.bc.ui.popup.actions;
2
3import org.eclipse.jface.action.IAction;
4import org.eclipse.jface.dialogs.MessageDialog;
5import org.eclipse.jface.viewers.ISelection;
6import org.eclipse.swt.widgets.Shell;
7import org.eclipse.ui.IActionDelegate;
8import org.eclipse.ui.IObjectActionDelegate;
9import org.eclipse.ui.IWorkbenchPart;
10
11public class NewAction implements IObjectActionDelegate {
12
13 /**
14 * Constructor for Action1.
15 */
16 public NewAction() {
17 super();
18 }
19
20 /**
21 * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
22 */
23 public void setActivePart(IAction action, IWorkbenchPart targetPart) {
24 }
25
26 /**
27 * @see IActionDelegate#run(IAction)
28 */
29 public void run(IAction action) {
30 Shell shell = new Shell();
31 MessageDialog.openInformation(
32 shell,
33 "Yocto Project BitBake Commander UI Plug-in",
34 "New Action was executed.");
35 }
36
37 /**
38 * @see IActionDelegate#selectionChanged(IAction, ISelection)
39 */
40 public void selectionChanged(IAction action, ISelection selection) {
41 }
42
43}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.views;
12
13import java.util.ArrayList;
14import java.util.Collection;
15import java.util.List;
16
17import org.eclipse.core.resources.IProject;
18import org.eclipse.core.resources.IProjectNature;
19import org.eclipse.core.resources.ResourcesPlugin;
20import org.eclipse.core.runtime.CoreException;
21import org.eclipse.jface.viewers.IStructuredContentProvider;
22import org.eclipse.jface.viewers.Viewer;
23
24import org.yocto.bc.bitbake.BBSession;
25import org.yocto.bc.ui.Activator;
26import org.yocto.bc.ui.builder.BitbakeCommanderNature;
27
28class RecipeContentProvider implements IStructuredContentProvider {
29 public void dispose() {
30 }
31
32 public Object[] getElements(Object parent) {
33 List recipes = new ArrayList();
34 IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
35 IProjectNature nature = null;
36 for (int i = 0; i < projects.length; ++i) {
37 try {
38 if (projects[i].isOpen() && projects[i].hasNature(BitbakeCommanderNature.NATURE_ID)) {
39 recipes.addAll(getRecipesFromProject(projects[i]));
40 }
41 } catch (CoreException e) {
42 // TODO Auto-generated catch block
43 e.printStackTrace();
44 } catch (Exception e) {
45 // TODO Auto-generated catch block
46 e.printStackTrace();
47 }
48 }
49
50 return recipes.toArray();
51 }
52
53 private Collection getRecipesFromProject(IProject project) throws Exception {
54 BBSession session = Activator.getBBSession(project.getLocationURI().getPath(), null);
55 return session.getRecipeFiles(project);
56 }
57
58 public void inputChanged(Viewer v, Object oldInput, Object newInput) {
59 }
60} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.views;
12
13import org.eclipse.core.resources.IFile;
14import org.eclipse.jface.action.Action;
15import org.eclipse.jface.action.IMenuListener;
16import org.eclipse.jface.action.IMenuManager;
17import org.eclipse.jface.action.IToolBarManager;
18import org.eclipse.jface.action.MenuManager;
19import org.eclipse.jface.action.Separator;
20import org.eclipse.jface.viewers.DoubleClickEvent;
21import org.eclipse.jface.viewers.IDoubleClickListener;
22import org.eclipse.jface.viewers.ISelection;
23import org.eclipse.jface.viewers.IStructuredSelection;
24import org.eclipse.jface.viewers.ITableLabelProvider;
25import org.eclipse.jface.viewers.LabelProvider;
26import org.eclipse.jface.viewers.TableViewer;
27import org.eclipse.jface.viewers.ViewerSorter;
28import org.eclipse.swt.SWT;
29import org.eclipse.swt.graphics.Image;
30import org.eclipse.swt.widgets.Composite;
31import org.eclipse.swt.widgets.Menu;
32import org.eclipse.ui.IActionBars;
33import org.eclipse.ui.ISharedImages;
34import org.eclipse.ui.IWorkbenchActionConstants;
35import org.eclipse.ui.PartInitException;
36import org.eclipse.ui.PlatformUI;
37import org.eclipse.ui.part.FileEditorInput;
38import org.eclipse.ui.part.ViewPart;
39
40import org.yocto.bc.ui.editors.bitbake.BitBakeFileEditor;
41
42public class RecipeView extends ViewPart {
43 class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
44 public Image getColumnImage(Object obj, int index) {
45 return getImage(obj);
46 }
47
48 public String getColumnText(Object obj, int index) {
49
50 if (obj instanceof IFile) {
51 return ((IFile) obj).getName();
52 }
53
54 return getText(obj);
55 }
56
57 @Override
58 public Image getImage(Object obj) {
59 return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
60 }
61 }
62 public static final String ID_VIEW = "org.yocto.bc.ui.views.RecipeView";
63private TableViewer viewer;
64
65 /* private Action action1;
66 private Action action2;
67 */ private Action doubleClickAction;
68
69 private void contributeToActionBars() {
70 IActionBars bars = getViewSite().getActionBars();
71 fillLocalPullDown(bars.getMenuManager());
72 fillLocalToolBar(bars.getToolBarManager());
73 }
74
75 @Override
76 public void createPartControl(Composite parent) {
77 viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
78 viewer.setContentProvider(new RecipeContentProvider());
79 viewer.setLabelProvider(new ViewLabelProvider());
80 viewer.setSorter(new ViewerSorter());
81 viewer.setInput(getViewSite());
82 makeActions();
83 hookContextMenu();
84 hookDoubleClickAction();
85 contributeToActionBars();
86 }
87
88 private void fillContextMenu(IMenuManager manager) {
89/* manager.add(action1);
90 manager.add(action2);
91*/ // Other plug-ins can contribute there actions here
92 manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
93 }
94
95 private void fillLocalPullDown(IMenuManager manager) {
96/* manager.add(action1);
97 manager.add(new Separator());
98 manager.add(action2);
99*/ }
100
101 private void fillLocalToolBar(IToolBarManager manager) {
102/* manager.add(action1);
103 manager.add(action2);
104*/ }
105
106 private void hookContextMenu() {
107 MenuManager menuMgr = new MenuManager("#PopupMenu");
108 menuMgr.setRemoveAllWhenShown(true);
109 menuMgr.addMenuListener(new IMenuListener() {
110 public void menuAboutToShow(IMenuManager manager) {
111 RecipeView.this.fillContextMenu(manager);
112 }
113 });
114 Menu menu = menuMgr.createContextMenu(viewer.getControl());
115 viewer.getControl().setMenu(menu);
116 getSite().registerContextMenu(menuMgr, viewer);
117 }
118
119 private void hookDoubleClickAction() {
120 viewer.addDoubleClickListener(new IDoubleClickListener() {
121 public void doubleClick(DoubleClickEvent event) {
122 doubleClickAction.run();
123 }
124 });
125 }
126
127 private void makeActions() {
128/* action1 = new Action() {
129 public void run() {
130 }
131 };
132 action1.setText("Action 1");
133 action1.setToolTipText("Action 1 tooltip");
134 action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
135
136 action2 = new Action() {
137 public void run() {
138 }
139 };
140 action2.setText("Action 2");
141 action2.setToolTipText("Action 2 tooltip");
142 action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
143*/ doubleClickAction = new Action() {
144 @Override
145 public void run() {
146 ISelection selection = viewer.getSelection();
147 Object obj = ((IStructuredSelection) selection).getFirstElement();
148
149 if (obj instanceof IFile) {
150 try {
151 RecipeView.this.getViewSite().getPage().openEditor(new FileEditorInput((IFile) obj), BitBakeFileEditor.EDITOR_ID);
152 } catch (PartInitException e) {
153 // TODO Auto-generated catch block
154 e.printStackTrace();
155 }
156 }
157 }
158 };
159 }
160
161 @Override
162 public void setFocus() {
163 viewer.getControl().setFocus();
164 }
165} \ 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 @@
1/*******************************************************************************
2 * Copyright (c) 2011 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.wizards;
12
13import org.eclipse.jface.viewers.ISelection;
14import org.eclipse.swt.widgets.Text;
15import java.util.ArrayList;
16
17public class BitbakeRecipeUIElement {
18
19 private String container;
20 private String file;
21 private String description;
22 private String license;
23 private String checksum;
24 private String homepage;
25 private String author;
26 private String section;
27 private String srcuri;
28 private String md5sum;
29 private String sha256sum;
30 private String metaDir;
31 private ArrayList inheritance;
32
33 public BitbakeRecipeUIElement()
34 {
35 this.container = "";
36 this.file = "";
37 this.description = "";
38 this.license = "";
39 this.checksum = "";
40 this.homepage = "";
41 this.author = "";
42 this.section = "";
43 this.srcuri = "";
44 this.md5sum = "";
45 this.sha256sum = "";
46 this.inheritance = new ArrayList();
47 this.metaDir = "";
48 }
49
50 public String getContainer() {
51 return container;
52 }
53 public void setContainer(String value) {
54 this.container = value;
55 }
56 public String getFile() {
57 return file;
58 }
59 public void setFile(String value) {
60 this.file = value;
61 }
62 public String getDescription() {
63 return description;
64 }
65
66 public void setDescription(String value) {
67 this.description = value;
68 }
69
70 public String getLicense() {
71 return license;
72 }
73
74 public void setLicense(String value) {
75 this.license = value;
76 }
77
78 public String getChecksum() {
79 return checksum;
80 }
81 public void setChecksum(String value) {
82 this.checksum = value;
83 }
84
85 public String getHomePage() {
86 return homepage;
87 }
88
89 public void setHomePage(String value) {
90 this.homepage = value;
91 }
92
93 public String getAuthor() {
94 return author;
95 }
96
97 public void setAuthor(String value) {
98 this.author = value;
99 }
100
101 public String getSection() {
102 return section;
103 }
104 public void setSection(String value) {
105 this.section = value;
106 }
107 public String getSrcuri() {
108 return srcuri;
109 }
110 public void setSrcuri(String value) {
111 this.srcuri = value;
112 }
113
114 public String getMd5sum() {
115 return md5sum;
116 }
117
118 public void setMd5sum(String value) {
119 this.md5sum = value;
120 }
121
122 public String getsha256sum() {
123 return sha256sum;
124 }
125
126 public void setSha256sum(String value) {
127 this.sha256sum = value;
128 }
129
130 public ArrayList<String> getInheritance() {
131 return inheritance;
132 }
133
134 public void setInheritance(ArrayList<String> value) {
135 this.inheritance = value;
136 }
137
138 public String getMetaDir() {
139 return metaDir;
140 }
141
142 public void setMetaDir(String value) {
143 metaDir = value;
144 }
145}
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 @@
1package org.yocto.bc.ui.wizards;
2import java.util.Map;
3
4import org.eclipse.jface.wizard.Wizard;
5import org.eclipse.swt.widgets.Composite;
6
7
8
9public abstract class FiniteStateWizard extends Wizard {
10 private boolean finishable = false;
11 private boolean canFinish = false;
12
13 public FiniteStateWizard() {
14 }
15
16 public abstract boolean performFinish();
17
18 /**
19 * @return Returns if the wizard is finishable in its current state.
20 */
21 public boolean isFinishable() {
22 return finishable;
23 }
24 /**
25 * @param finishable Change the finish state of the wizard.
26 */
27 public void setFinishable(boolean finishable) {
28 this.finishable = finishable;
29 }
30
31 /* (non-Javadoc)
32 * @see org.eclipse.jface.wizard.IWizard#createPageControls(org.eclipse.swt.widgets.Composite)
33 */
34 public void createPageControls(Composite pageContainer) {
35 super.createPageControls(pageContainer);
36 }
37
38 /*
39 * (non-Javadoc) Method declared on IWizard.
40 */
41 public boolean canFinish() {
42 if (canFinish)
43 return true;
44 return super.canFinish();
45 }
46
47 public void setCanFinish(boolean canFinish) {
48 this.canFinish = canFinish;
49 }
50
51 /**
52 * Retrive the model object from the wizard.
53 * @return
54 */
55 public abstract Map getModel();
56}
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 @@
1package org.yocto.bc.ui.wizards;
2import java.util.Map;
3
4import org.eclipse.jface.viewers.ISelectionChangedListener;
5import org.eclipse.jface.viewers.SelectionChangedEvent;
6import org.eclipse.jface.wizard.WizardPage;
7import org.eclipse.swt.events.ModifyEvent;
8import org.eclipse.swt.events.ModifyListener;
9import org.eclipse.swt.events.SelectionEvent;
10import org.eclipse.swt.events.SelectionListener;
11import org.eclipse.swt.widgets.Composite;
12import org.eclipse.swt.widgets.Event;
13import org.eclipse.swt.widgets.Listener;
14
15public abstract class FiniteStateWizardPage extends WizardPage {
16 protected Map model = null;
17 protected FiniteStateWizard wizard = null;
18 private static boolean previousState = false;
19 /**
20 * @param pageName
21 */
22 protected FiniteStateWizardPage(String name, Map model) {
23 super(name);
24 this.model = model;
25 this.setPageComplete(false);
26 }
27
28 /*
29 * (non-Javadoc)
30 *
31 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
32 */
33 public abstract void createControl(Composite parent);
34
35 protected void setModelWizard() {
36 if (wizard == null) {
37 wizard = (FiniteStateWizard)FiniteStateWizardPage.this.getWizard();
38 }
39 }
40
41 /**
42 * Add page validation logic here. Returning <code>true</code> means that
43 * the page is complete and the user can go to the next page.
44 *
45 * @return
46 */
47 protected abstract boolean validatePage();
48
49 /**
50 * This method should be implemented by ModelWizardPage classes. This method
51 * is called after the <code>validatePage()</code> returns successfully.
52 * Update the model with the contents of the controls on the page.
53 */
54 protected abstract void updateModel();
55
56 /**
57 * Helper method to see if a field has some sort of text in it.
58 * @param value
59 * @return
60 */
61 protected boolean hasContents(String value) {
62 if (value == null || value.length() == 0) {
63 return false;
64 }
65
66 return true;
67 }
68
69 /**
70 * This method is called right before a page is displayed.
71 * This occurs on user action (Next/Back buttons).
72 */
73 public abstract void pageDisplay();
74
75 /**
76 * This method is called on the concrete WizardPage after the user has
77 * gone to the page after.
78 */
79 public abstract void pageCleanup();
80
81 /* (non-Javadoc)
82 * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
83 */
84 public void setVisible(boolean arg0) {
85
86 if (!arg0 && previousState) {
87 pageCleanup();
88 } else if (arg0 && !previousState) {
89 pageDisplay();
90 } else if (arg0 && previousState) {
91 pageDisplay();
92 }
93
94 previousState = arg0;
95
96 super.setVisible(arg0);
97 }
98
99 public class ValidationListener implements SelectionListener, ModifyListener, Listener, ISelectionChangedListener {
100
101 /*
102 * (non-Javadoc)
103 *
104 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
105 */
106 public void widgetSelected(SelectionEvent e) {
107 validate();
108 }
109
110 /*
111 * (non-Javadoc)
112 *
113 * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
114 */
115 public void widgetDefaultSelected(SelectionEvent e) {
116 }
117
118 /*
119 * (non-Javadoc)
120 *
121 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
122 */
123 public void modifyText(ModifyEvent e) {
124 validate();
125 }
126
127 public void validate() {
128 if (validatePage()) {
129 updateModel();
130 setPageComplete(true);
131 return;
132 }
133
134 setPageComplete(false);
135 }
136
137 /* (non-Javadoc)
138 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
139 */
140 public void handleEvent(Event event) {
141
142 validate();
143 }
144
145 public void selectionChanged(SelectionChangedEvent event) {
146 validate();
147 }
148 }
149}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 * Jessica Zhang (Intel) - Extend to support auto-fill base on src_uri value
11 *******************************************************************************/
12package org.yocto.bc.ui.wizards;
13
14import java.io.ByteArrayInputStream;
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.File;
18import java.lang.reflect.InvocationTargetException;
19import java.util.ArrayList;
20
21import org.eclipse.core.resources.IContainer;
22import org.eclipse.core.resources.IFile;
23import org.eclipse.core.resources.IResource;
24import org.eclipse.core.resources.IWorkspaceRoot;
25import org.eclipse.core.resources.ResourcesPlugin;
26import org.eclipse.core.runtime.CoreException;
27import org.eclipse.core.runtime.IProgressMonitor;
28import org.eclipse.core.runtime.IStatus;
29import org.eclipse.core.runtime.Path;
30import org.eclipse.core.runtime.Status;
31import org.eclipse.jface.dialogs.MessageDialog;
32import org.eclipse.jface.operation.IRunnableWithProgress;
33import org.eclipse.jface.viewers.ISelection;
34import org.eclipse.jface.viewers.IStructuredSelection;
35import org.eclipse.jface.wizard.Wizard;
36import org.eclipse.ui.INewWizard;
37import org.eclipse.ui.IWorkbench;
38import org.eclipse.ui.IWorkbenchPage;
39import org.eclipse.ui.IWorkbenchWizard;
40import org.eclipse.ui.PartInitException;
41import org.eclipse.ui.PlatformUI;
42import org.eclipse.ui.ide.IDE;
43
44import org.yocto.bc.bitbake.BBLanguageHelper;
45
46public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
47 private NewBitBakeFileRecipeWizardPage page;
48 private ISelection selection;
49
50 public NewBitBakeFileRecipeWizard() {
51 super();
52 setNeedsProgressMonitor(true);
53 }
54
55 @Override
56 public void addPages() {
57 page = new NewBitBakeFileRecipeWizardPage(selection);
58 addPage(page);
59 }
60
61 private void doFinish(BitbakeRecipeUIElement element, IProgressMonitor monitor) throws CoreException {
62 String fileName = element.getFile();
63 monitor.beginTask("Creating " + fileName, 2);
64 IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
65 IResource resource = root.findMember(new Path(element.getContainer()));
66 if (!resource.exists() || !(resource instanceof IContainer)) {
67 throwCoreException("Container \"" + element.getContainer() + "\" does not exist.");
68 }
69 IContainer container = (IContainer) resource;
70
71 // If the extension wasn't specified, assume .bb
72 if (!fileName.endsWith(".bb") && !fileName.endsWith(".inc") && !fileName.endsWith(".conf")) {
73 fileName = fileName + ".bb";
74 }
75
76 final IFile file = container.getFile(new Path(fileName));
77 try {
78 InputStream stream = openContentStream(element);
79 if (file.exists()) {
80 file.setContents(stream, true, true, monitor);
81 } else {
82 file.create(stream, true, monitor);
83 }
84 stream.close();
85 } catch (IOException e) {
86 }
87 monitor.worked(1);
88 monitor.setTaskName("Opening file for editing...");
89 getShell().getDisplay().asyncExec(new Runnable() {
90 public void run() {
91 IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
92 try {
93 IDE.openEditor(page, file, true);
94 } catch (PartInitException e) {
95 }
96 }
97 });
98 monitor.worked(1);
99 }
100
101 /**
102 * We will accept the selection in the workbench to see if we can initialize
103 * from it.
104 *
105 * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
106 */
107 public void init(IWorkbench workbench, IStructuredSelection selection) {
108 this.selection = selection;
109 }
110
111 /**
112 * We will initialize file contents with a sample text.
113 * @param srcuri
114 * @param author
115 * @param homepage
116 * @param license
117 * @param description
118 * @param fileName
119 * @param newPage
120 */
121
122 private InputStream openContentStream(BitbakeRecipeUIElement element) {
123
124 StringBuffer sb = new StringBuffer();
125
126 sb.append("DESCRIPTION = \"" + element.getDescription() + "\"\n");
127
128 if (element.getAuthor().length() > 0) {
129 sb.append("AUTHOR = \"" + element.getAuthor() + "\"\n");
130 }
131
132 if (element.getHomePage().length() > 0) {
133 sb.append("HOMEPAGE = \"" + element.getHomePage() + "\"\n");
134 }
135
136 if (element.getSection().length() > 0) {
137 sb.append("SECTION = \"" + element.getSection() + "\"\n");
138 }
139
140 if (element.getLicense().length() > 0) {
141 sb.append("LICENSE = \"" + element.getLicense() + "\"\n");
142 }
143
144 if (element.getChecksum().length() > 0) {
145 sb.append("LIC_FILES_CHKSUM = \"" + element.getChecksum() + "\"\n");
146 }
147
148 if (element.getSrcuri().length() > 0) {
149 sb.append("SRC_URI = \"" + element.getSrcuri() + "\"\n");
150 }
151
152 if (element.getMd5sum().length() > 0) {
153 sb.append("SRC_URI[md5sum] = \"" + element.getMd5sum() + "\"\n");
154 }
155
156 if (element.getsha256sum().length() > 0) {
157 sb.append("SRC_URI[sha256sum] = \"" + element.getsha256sum() + "\"\n");
158 }
159
160 ArrayList<String> inheritance = element.getInheritance();
161 if (!inheritance.isEmpty()) {
162 Object ia[] = inheritance.toArray();
163 String inheritance_str = "inherit ";
164 for(int i=0; i<ia.length; i++)
165 inheritance_str += ((String) ia[i]) + " ";
166 sb.append(inheritance_str);
167 }
168 sb.append("\n");
169
170 return new ByteArrayInputStream(sb.toString().getBytes());
171 }
172
173 @Override
174 public boolean performFinish() {
175 final BitbakeRecipeUIElement element = page.getUIElement();
176
177 IRunnableWithProgress op = new IRunnableWithProgress() {
178 public void run(IProgressMonitor monitor) throws InvocationTargetException {
179 try {
180 doFinish(element, monitor);
181 File temp_dir = new File(element.getMetaDir() + "/temp");
182 if (temp_dir.exists()) {
183 File working_dir = new File(element.getMetaDir());
184
185 String rm_cmd = "rm -rf temp";
186 final Process process = Runtime.getRuntime().exec(rm_cmd, null, working_dir);
187 int returnCode = process.waitFor();
188 if (returnCode != 0) {
189 throw new Exception("Failed to clean up the temp dir");
190 }
191 }
192 } catch (Exception e) {
193 throw new InvocationTargetException(e);
194 } finally {
195 monitor.done();
196 }
197 }
198 };
199 try {
200 getContainer().run(true, false, op);
201 } catch (InterruptedException e) {
202 return false;
203 } catch (InvocationTargetException e) {
204 Throwable realException = e.getTargetException();
205 MessageDialog.openError(getShell(), "Error", realException.getMessage());
206 return false;
207 }
208 return true;
209 }
210
211 private void throwCoreException(String message) throws CoreException {
212 IStatus status = new Status(IStatus.ERROR, "org.yocto.bc.ui", IStatus.OK, message, null);
213 throw new CoreException(status);
214 }
215} \ No newline at end of file
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
new file mode 100644
index 0000000..61878b9
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
@@ -0,0 +1,543 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 * Jessica Zhang (Intel) - Extend to support auto-fill base on src_uri value
11 *******************************************************************************/
12package org.yocto.bc.ui.wizards;
13
14import org.eclipse.core.resources.IContainer;
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.resources.IResource;
17import org.eclipse.core.resources.ResourcesPlugin;
18import org.eclipse.core.runtime.Path;
19import org.eclipse.core.runtime.IPath;
20import org.eclipse.jface.viewers.ISelection;
21import org.eclipse.jface.viewers.IStructuredSelection;
22import org.eclipse.jface.window.Window;
23import org.eclipse.jface.wizard.WizardPage;
24import org.eclipse.swt.SWT;
25import org.eclipse.swt.events.ModifyEvent;
26import org.eclipse.swt.events.ModifyListener;
27import org.eclipse.swt.events.SelectionAdapter;
28import org.eclipse.swt.events.SelectionEvent;
29import org.eclipse.swt.layout.GridData;
30import org.eclipse.swt.layout.GridLayout;
31import org.eclipse.swt.widgets.Button;
32import org.eclipse.swt.widgets.Composite;
33import org.eclipse.swt.widgets.DirectoryDialog;
34import org.eclipse.swt.widgets.FileDialog;
35import org.eclipse.swt.widgets.Label;
36import org.eclipse.swt.widgets.Text;
37import org.eclipse.ui.dialogs.ContainerSelectionDialog;
38
39import java.util.HashMap;
40import java.util.Hashtable;
41import java.util.Set;
42import java.util.ArrayList;
43import java.util.Enumeration;
44import java.util.Iterator;
45
46import java.io.BufferedReader;
47import java.io.InputStreamReader;
48import java.io.File;
49import java.io.FileReader;
50import java.io.IOException;
51import java.io.FileInputStream;
52import java.io.InputStream;
53import java.io.FilenameFilter;
54import java.security.MessageDigest;
55import java.math.BigInteger;
56
57public class NewBitBakeFileRecipeWizardPage extends WizardPage {
58 private Text containerText;
59 private Text fileText;
60
61 private Text descriptionText;
62 private Text licenseText;
63 private Text checksumText;
64 private Text homepageText;
65 private Text authorText;
66 private Text sectionText;
67 private Text srcuriText;
68 private Text md5sumText;
69 private Text sha256sumText;
70 private BitbakeRecipeUIElement element;
71
72 private ISelection selection;
73 private String metaDirLoc;
74 private ArrayList inheritance;
75
76 public NewBitBakeFileRecipeWizardPage(ISelection selection) {
77 super("wizardPage");
78 setTitle("BitBake Recipe");
79 setDescription("Create a new BitBake recipe.");
80 this.selection = selection;
81 element = new BitbakeRecipeUIElement();
82 inheritance = new ArrayList();
83 }
84
85 public void createControl(Composite parent) {
86 final Composite container = new Composite(parent, SWT.NULL);
87 GridLayout layout = new GridLayout();
88 container.setLayout(layout);
89 layout.numColumns = 3;
90 layout.verticalSpacing = 9;
91
92 Label label = new Label(container, SWT.NULL);
93 GridData gd = new GridData();
94 gd.horizontalSpan = 3;
95 label.setLayoutData(gd);
96
97 label = new Label(container, SWT.NULL);
98 label.setText("Recipe &Directory:");
99
100 containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
101 gd = new GridData(GridData.FILL_HORIZONTAL);
102 containerText.setLayoutData(gd);
103 containerText.addModifyListener(new ModifyListener() {
104 public void modifyText(ModifyEvent e) {
105 dialogChanged();
106 }
107 });
108
109 Button buttonBrowse = new Button(container, SWT.PUSH);
110 buttonBrowse.setText("Browse...");
111 buttonBrowse.addSelectionListener(new SelectionAdapter() {
112 @Override
113 public void widgetSelected(SelectionEvent e) {
114 handleBrowse(container, containerText);
115 }
116 });
117
118 label = new Label(container, SWT.NULL);
119 gd = new GridData();
120 gd.horizontalSpan = 3;
121 label.setLayoutData(gd);
122
123 label = new Label(container, SWT.NULL);
124 label.setText("SRC_&URI:");
125
126 srcuriText = new Text(container, SWT.BORDER | SWT.SINGLE);
127 gd = new GridData(GridData.FILL_HORIZONTAL);
128 srcuriText.setLayoutData(gd);
129 srcuriText.addModifyListener(new ModifyListener() {
130 public void modifyText(ModifyEvent e) {
131 dialogChanged();
132 }
133 });
134
135 Button buttonP = new Button(container, SWT.PUSH);
136 buttonP.setText("Populate...");
137 buttonP.addSelectionListener(new SelectionAdapter() {
138 @Override
139 public void widgetSelected(SelectionEvent e) {
140 handlePopulate();
141 }
142 });
143
144 createField(container, "&Recipe Name:", (fileText = new Text(container, SWT.BORDER | SWT.SINGLE)));
145 createField(container, "SRC_URI[&md5sum]:", (md5sumText = new Text(container, SWT.BORDER | SWT.SINGLE)));
146 createField(container, "SRC_URI[&sha256sum]:", (sha256sumText = new Text(container, SWT.BORDER | SWT.SINGLE)));
147 createField(container, "License File &Checksum:", (checksumText = new Text(container, SWT.BORDER | SWT.SINGLE)));
148 createField(container, "&Package Description:", (descriptionText = new Text(container, SWT.BORDER | SWT.SINGLE)));
149 createField(container, "&License:", (licenseText = new Text(container, SWT.BORDER | SWT.SINGLE)));
150
151 createField(container, "&Homepage:", (homepageText = new Text(container, SWT.BORDER | SWT.SINGLE)));
152 createField(container, "Package &Author:", (authorText = new Text(container, SWT.BORDER | SWT.SINGLE)));
153 createField(container, "&Section:", (sectionText = new Text(container, SWT.BORDER | SWT.SINGLE)));
154
155 initialize();
156 dialogChanged();
157 setControl(container);
158 }
159
160 private void createField(Composite container, String title, Text control) {
161 Label label = new Label(container, SWT.NONE);
162 label.setText(title);
163 label.moveAbove(control);
164
165 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
166 gd.horizontalSpan = 2;
167 control.setLayoutData(gd);
168 control.addModifyListener(new ModifyListener() {
169
170 public void modifyText(ModifyEvent e) {
171 dialogChanged();
172 }
173
174 });
175 }
176
177 private void dialogChanged() {
178 String containerName = containerText.getText();
179 IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(containerName));
180 String fileName = fileText.getText();
181
182 if (containerName.length() == 0) {
183 updateStatus("Directory must be specified");
184 return;
185 }
186
187 if (container == null || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
188 updateStatus("File container must exist");
189 return;
190 }
191 if (!container.isAccessible()) {
192 updateStatus("Project must be writable");
193 return;
194 }
195
196 IProject project = container.getProject();
197 metaDirLoc = project.getLocation().toString() + "/meta";
198
199 if (fileName.length() == 0) {
200 updateStatus("File name must be specified");
201 return;
202 }
203 if (fileName.contains(" ")) {
204 updateStatus("File name must be valid with no space in it");
205 return;
206 }
207 if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
208 updateStatus("File name must be valid");
209 return;
210 }
211
212 if (descriptionText.getText().length() == 0) {
213 updateStatus("Recipe must have a description");
214 return;
215 }
216
217 if (licenseText.getText().length() == 0) {
218 updateStatus("Recipe must have a license");
219 return;
220 }
221
222 if (srcuriText.getText().length() == 0) {
223 updateStatus("SRC_URI can't be empty");
224 }
225
226 updateStatus(null);
227 }
228
229 public BitbakeRecipeUIElement getUIElement() {
230 element.setAuthor(authorText.getText());
231 element.setChecksum(checksumText.getText());
232 element.setContainer(containerText.getText());
233 element.setDescription(descriptionText.getText());
234 element.setFile(fileText.getText());
235 element.setHomePage(homepageText.getText());
236 element.setLicense(licenseText.getText());
237 element.setMd5sum(md5sumText.getText());
238 element.setSection(sectionText.getText());
239 element.setSha256sum(sha256sumText.getText());
240 element.setSrcuri(srcuriText.getText());
241 element.setInheritance(inheritance);
242 element.setMetaDir(metaDirLoc);
243
244 return element;
245 }
246
247 private void handleBrowse(final Composite parent, final Text text) {
248 ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select project directory");
249 if (dialog.open() == Window.OK) {
250 Object[] result = dialog.getResult();
251 if (result.length == 1) {
252 text.setText(((Path) result[0]).toString());
253 }
254 }
255 }
256
257 private void handlePopulate() {
258 String src_uri = srcuriText.getText();
259 if ((src_uri.startsWith("http://") || src_uri.startsWith("ftp://"))
260 && (src_uri.endsWith("tar.gz") || src_uri.endsWith("tar.bz2"))) {
261
262 HashMap<String, String> mirror_map = createMirrorLookupTable();
263
264 populateRecipeName(src_uri);
265 populateSrcuriChecksum(src_uri);
266 String extractDir = extractPackage(src_uri);
267 populateLicensefileChecksum(extractDir);
268 updateSrcuri(mirror_map, src_uri);
269 populateInheritance(extractDir);
270 } else if (src_uri.startsWith("file://")) {
271 String path_str = src_uri.substring(7);
272 File package_dir = new File(path_str);
273 if (package_dir.isDirectory()) {
274 String package_name = path_str.substring(path_str.lastIndexOf("/")+1);
275 fileText.setText(package_name+".bb");
276 populateLicensefileChecksum(path_str);
277 populateInheritance(path_str);
278 }
279 }
280
281 }
282
283 private String extractPackage(String src_uri) {
284 try {
285 File working_dir = new File(metaDirLoc+"/temp");
286 int idx = src_uri.lastIndexOf("/");
287 String tar_file = src_uri.substring(idx+1);
288 int tar_file_surfix_idx = tar_file.lastIndexOf(".tar");
289 String tar_file_surfix = tar_file.substring(tar_file_surfix_idx);
290 String tar_file_path = metaDirLoc+"/temp/"+tar_file;
291
292 String tar_cmd = "";
293 int tar_idx = 0;
294 if (tar_file_surfix.matches(".tar.gz")) {
295 tar_cmd = "tar -zxvf "+ tar_file_path;
296 tar_idx = tar_file_path.lastIndexOf(".tar.gz");
297 } else if (tar_file_surfix.matches(".tar.bz2")) {
298 tar_idx = tar_file_path.lastIndexOf(".tar.bz2");
299 tar_cmd = "tar -xvf " + tar_file_path;
300 }
301 final Process process = Runtime.getRuntime().exec(tar_cmd, null, working_dir);
302 int returnCode = process.waitFor();
303 if (returnCode == 0) {
304 return tar_file_path.substring(0, tar_idx);
305 }
306 } catch (Exception e) {
307 e.printStackTrace();
308 }
309 return null;
310 }
311
312 private void populateInheritance(String extractDir) {
313 File extract_dir = new File(extractDir);
314
315 File[] files = extract_dir.listFiles();
316 for (File file : files) {
317 if (file.isDirectory())
318 continue;
319 else {
320 if (file.getName().equalsIgnoreCase("cmakelists.txt"))
321 inheritance.add("cmake");
322 else if (file.getName().equalsIgnoreCase("setup.py"))
323 inheritance.add("disutils");
324 else {
325 String pattern = "configure.[ac|.in]";
326 if (file.getName().equalsIgnoreCase("configure.ac") || file.getName().equalsIgnoreCase("configure.in"))
327 inheritance.add("autotools");
328 else
329 continue;
330 }
331 }
332 }
333 }
334
335 private void populateLicensefileChecksum(String extractDir) {
336 String licenseFileChecksum_str = null;
337 String licenseFilePath = null;
338
339 try {
340 File extract_dir = new File(extractDir);
341
342 FilenameFilter copyFilter = new FilenameFilter() {
343 public boolean accept(File dir, String name) {
344 if (name.startsWith("COPYING")) {
345 return true;
346 } else {
347 return false;
348 }
349 }
350 };
351
352 File copyFile = null;
353 File[] files = extract_dir.listFiles(copyFilter);
354 for (File file : files) {
355 if (file.isDirectory())
356 continue;
357 else {
358 copyFile = file;
359 licenseFilePath = file.getCanonicalPath();
360 break;
361 }
362 }
363
364 MessageDigest digest_md5 = MessageDigest.getInstance("MD5");
365 InputStream is = new FileInputStream(copyFile);
366 byte[] buffer = new byte[8192];
367 int read = 0;
368
369 while( (read = is.read(buffer)) > 0) {
370 digest_md5.update(buffer, 0, read);
371 }
372 byte[] md5sum = digest_md5.digest();
373 BigInteger bigInt_md5 = new BigInteger(1, md5sum);
374 licenseFileChecksum_str = bigInt_md5.toString(16);
375 is.close();
376 } catch (Exception e) {
377 throw new RuntimeException("Unable to process file for MD5 calculation", e);
378 }
379
380 if (licenseFileChecksum_str != null) {
381 int idx = licenseFilePath.lastIndexOf("/");
382 String license_file_name = licenseFilePath.substring(idx+1);
383 checksumText.setText("file://"+license_file_name+";md5="+licenseFileChecksum_str);
384 }
385 }
386
387 private void populateSrcuriChecksum(String src_uri) {
388 String md5sum_str = null;
389 String sha256sum_str = null;
390
391 try {
392 File working_dir = new File(metaDirLoc+"/temp");
393 working_dir.mkdir();
394 String download_cmd = "wget " + src_uri;
395 final Process process = Runtime.getRuntime().exec(download_cmd, null, working_dir);
396 int returnCode = process.waitFor();
397 if (returnCode == 0) {
398 int idx = src_uri.lastIndexOf("/");
399 String tar_file = src_uri.substring(idx+1);
400 String tar_file_path = metaDirLoc+"/temp/"+tar_file;
401 MessageDigest digest_md5 = MessageDigest.getInstance("MD5");
402 MessageDigest digest_sha256 = MessageDigest.getInstance("SHA-256");
403 File f = new File(tar_file_path);
404 InputStream is = new FileInputStream(f);
405 byte[] buffer = new byte[8192];
406 int read = 0;
407 try {
408 while( (read = is.read(buffer)) > 0) {
409 digest_md5.update(buffer, 0, read);
410 digest_sha256.update(buffer, 0, read);
411 }
412 byte[] md5sum = digest_md5.digest();
413 byte[] sha256sum = digest_sha256.digest();
414 BigInteger bigInt_md5 = new BigInteger(1, md5sum);
415 BigInteger bigInt_sha256 = new BigInteger(1, sha256sum);
416 md5sum_str = bigInt_md5.toString(16);
417 sha256sum_str = bigInt_sha256.toString(16);
418 }
419 catch(IOException e) {
420 throw new RuntimeException("Unable to process file for MD5", e);
421 }
422 finally {
423 try {
424 is.close();
425 }
426 catch(IOException e) {
427 throw new RuntimeException("Unable to close input stream for MD5 calculation", e);
428 }
429 }
430 if (md5sum_str != null)
431 md5sumText.setText(md5sum_str);
432 if (sha256sum_str != null)
433 sha256sumText.setText(sha256sum_str);
434 }
435 } catch (Exception e) {
436 e.printStackTrace();
437 }
438 }
439
440 private HashMap<String, String> createMirrorLookupTable() {
441 HashMap<String, String> mirror_map = new HashMap<String, String>();
442 File mirror_file = new File(metaDirLoc+"/classes/mirrors.bbclass");
443
444 try {
445 if (mirror_file.exists()) {
446 BufferedReader input = new BufferedReader(new FileReader(mirror_file));
447
448 try
449 {
450 String line = null;
451 String delims = "[\\t]+";
452
453 while ((line = input.readLine()) != null)
454 {
455 String[] tokens = line.split(delims);
456 if (tokens.length < 2)
457 continue;
458 String ending_str = " \\n \\";
459 int idx = tokens[1].lastIndexOf(ending_str);
460 String key = tokens[1].substring(0, idx);
461 mirror_map.put(key, tokens[0]);
462 }
463 }
464 finally {
465 input.close();
466 }
467 }
468 }
469 catch (IOException e)
470 {
471 e.printStackTrace();
472
473 }
474 return mirror_map;
475 }
476
477 private void populateRecipeName(String src_uri) {
478 String file_name = fileText.getText();
479 if (!file_name.isEmpty())
480 return;
481 String delims = "[/]+";
482 String recipe_file = null;
483
484 String[] tokens = src_uri.split(delims);
485 if (tokens.length > 0) {
486 String tar_file = tokens[tokens.length - 1];
487 int surfix_idx = 0;
488 if (tar_file.endsWith(".tar.gz"))
489 surfix_idx = tar_file.lastIndexOf(".tar.gz");
490 else
491 surfix_idx = tar_file.lastIndexOf(".tar.bz2");
492 int sept_idx = tar_file.lastIndexOf("-");
493 recipe_file = tar_file.substring(0, sept_idx)+"_"+tar_file.substring(sept_idx+1, surfix_idx)+".bb";
494 }
495 if (recipe_file != null)
496 fileText.setText(recipe_file);
497 }
498
499 private void updateSrcuri(HashMap<String, String> mirrorsMap, String src_uri) {
500 Set<String> mirrors = mirrorsMap.keySet();
501 Iterator iter = mirrors.iterator();
502 String mirror_key = null;
503
504 while (iter.hasNext()) {
505 String value = (String)iter.next();
506 if (src_uri.startsWith(value)) {
507 mirror_key = value;
508 break;
509 }
510 }
511
512 if (mirror_key != null) {
513 String replace_string = (String)mirrorsMap.get(mirror_key);
514 if (replace_string != null)
515 src_uri = replace_string+src_uri.substring(mirror_key.length());
516 }
517 int idx = src_uri.lastIndexOf("-");
518 String new_src_uri = src_uri.substring(0, idx)+"-${PV}.tar.gz";
519 srcuriText.setText(new_src_uri);
520 }
521
522 private void initialize() {
523 if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
524 IStructuredSelection ssel = (IStructuredSelection) selection;
525 if (ssel.size() > 1)
526 return;
527 Object obj = ssel.getFirstElement();
528 if (obj instanceof IResource) {
529 IContainer container;
530 if (obj instanceof IContainer)
531 container = (IContainer) obj;
532 else
533 container = ((IResource) obj).getParent();
534 containerText.setText(container.getFullPath().toString());
535 }
536 }
537 }
538
539 private void updateStatus(String message) {
540 setErrorMessage(message);
541 setPageComplete(message == null);
542 }
543} \ 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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.wizards.importProject;
12
13import java.io.File;
14import java.util.Map;
15
16import org.eclipse.core.resources.IProject;
17import org.eclipse.core.resources.IResource;
18import org.eclipse.core.resources.IWorkspaceRoot;
19import org.eclipse.core.resources.ResourcesPlugin;
20import org.eclipse.core.runtime.IStatus;
21import org.eclipse.swt.SWT;
22import org.eclipse.swt.events.SelectionAdapter;
23import org.eclipse.swt.events.SelectionEvent;
24import org.eclipse.swt.layout.GridData;
25import org.eclipse.swt.layout.GridLayout;
26import org.eclipse.swt.widgets.Button;
27import org.eclipse.swt.widgets.Composite;
28import org.eclipse.swt.widgets.DirectoryDialog;
29import org.eclipse.swt.widgets.FileDialog;
30import org.eclipse.swt.widgets.Label;
31import org.eclipse.swt.widgets.Text;
32import org.eclipse.ui.PlatformUI;
33
34import org.yocto.bc.ui.wizards.FiniteStateWizardPage;
35
36/**
37 * Main property page for new project wizard.
38 * @author kgilmer
39 *
40 */
41public class BBCProjectPage extends FiniteStateWizardPage {
42
43 private class FileOpenSelectionAdapter extends SelectionAdapter {
44 @Override
45 public void widgetSelected(SelectionEvent e) {
46 FileDialog fd = new FileDialog(PlatformUI.getWorkbench()
47 .getDisplay().getActiveShell(), SWT.OPEN);
48
49 fd.setText("Open Configuration Script");
50 fd.setFilterPath(txtProjectLocation.getText());
51
52 String selected = fd.open();
53
54 if (selected != null) {
55 txtInit.setText(selected);
56 updateModel();
57 }
58 }
59 }
60 public static final String PAGE_TITLE = "Yocto Project BitBake Commander Project";
61 private Text txtProjectLocation;
62
63 private Text txtInit;
64 private ValidationListener validationListener;
65 private Text txtProjectName;
66
67 public BBCProjectPage(Map model) {
68 super(PAGE_TITLE, model);
69 setTitle("Create new Yocto Project BitBake Commander project");
70 setMessage("Enter information to create a BitBake Commander project.");
71 }
72
73 public void createControl(Composite parent) {
74 GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL);
75 GridData gdVU = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
76
77 Composite top = new Composite(parent, SWT.NONE);
78 top.setLayoutData(new GridData(GridData.FILL_BOTH));
79 top.setLayout(new GridLayout());
80
81 Composite projectNameComp = new Composite(top, SWT.NONE);
82 GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL);
83 projectNameComp.setLayoutData(gdProjName);
84 projectNameComp.setLayout(new GridLayout(2, false));
85 Label lblProjectName = new Label(projectNameComp, SWT.NONE);
86 lblProjectName.setText("N&ame:");
87
88 txtProjectName = new Text(projectNameComp, SWT.BORDER);
89 txtProjectName.setLayoutData(gdFillH);
90 txtProjectName.setFocus();
91 validationListener = new ValidationListener();
92
93 txtProjectName.addModifyListener(validationListener);
94
95 Label lblProjectLocation = new Label(projectNameComp, SWT.None);
96 lblProjectLocation.setText("&Location:");
97
98 Composite locComposite = new Composite(projectNameComp, SWT.NONE);
99 GridData gd = new GridData(GridData.VERTICAL_ALIGN_END
100 | GridData.FILL_HORIZONTAL);
101 gd.horizontalIndent = 0;
102 locComposite.setLayoutData(gd);
103 GridLayout gl = new GridLayout(2, false);
104 gl.marginWidth = 0;
105 locComposite.setLayout(gl);
106
107 txtProjectLocation = new Text(locComposite, SWT.BORDER);
108 txtProjectLocation.setLayoutData(gdFillH);
109 txtProjectLocation.addModifyListener(validationListener);
110
111 Button button = new Button(locComposite, SWT.PUSH);
112 button.setText("Browse...");
113 button.addSelectionListener(new SelectionAdapter() {
114 @Override
115 public void widgetSelected(SelectionEvent e) {
116 handleBrowse();
117 }
118 });
119
120 Label lblInit = new Label(projectNameComp, SWT.NONE);
121 lblInit.setText("Init Script:");
122
123 Composite initComposite = new Composite(projectNameComp, SWT.NONE);
124 gd = new GridData(GridData.VERTICAL_ALIGN_END
125 | GridData.FILL_HORIZONTAL);
126 gd.horizontalIndent = 0;
127 initComposite.setLayoutData(gd);
128 gl = new GridLayout(2, false);
129 gl.marginWidth = 0;
130 initComposite.setLayout(gl);
131
132 txtInit = new Text(initComposite, SWT.BORDER);
133 GridData gdi = new GridData(GridData.FILL_HORIZONTAL);
134 txtInit.setLayoutData(gdi);
135 txtInit.addModifyListener(validationListener);
136
137 Button btnLoadInit = new Button(initComposite, SWT.PUSH);
138 btnLoadInit.setLayoutData(gdVU);
139 btnLoadInit.setText("Choose...");
140 btnLoadInit.addSelectionListener(new FileOpenSelectionAdapter());
141
142 if (System.getenv("OEROOT") != null) {
143 txtProjectLocation.setText(System.getenv("OEROOT"));
144 }
145
146 setControl(top);
147 }
148
149 private void handleBrowse() {
150 DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.None);
151 String dir = dialog.open();
152 if (dir != null) {
153 txtProjectLocation.setText(dir);
154 }
155 }
156
157 private String getFileSegment(String initScriptPath) {
158 //return the first segment of " " seperated array, or full string if no " " exists
159 return initScriptPath.split(" ")[0];
160 }
161
162 private boolean isValidProjectName(String projectName) {
163 if (projectName.indexOf('$') > -1) {
164 return false;
165 }
166
167 return true;
168 }
169
170
171 @Override
172 public void pageCleanup() {
173 // TODO Auto-generated method stub
174
175 }
176
177 @Override
178 public void pageDisplay() {
179 // TODO Auto-generated method stub
180
181 }
182
183 @Override
184 protected void updateModel() {
185 model.put(ImportYoctoProjectWizard.KEY_NAME, txtProjectName.getText());
186 model.put(ImportYoctoProjectWizard.KEY_LOCATION, txtProjectLocation.getText());
187 model.put(ImportYoctoProjectWizard.KEY_INITPATH, txtInit.getText());
188 }
189
190
191 @Override
192 protected boolean validatePage() {
193 IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
194
195 IStatus validate = ResourcesPlugin.getWorkspace().validateName(txtProjectName.getText(), IResource.PROJECT);
196
197 if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) {
198 setErrorMessage("Invalid project name: " + txtProjectName.getText());
199 return false;
200 }
201
202 IProject proj = wsroot.getProject(txtProjectName.getText());
203 if (proj.exists()) {
204 setErrorMessage("A project with the name " + txtProjectName.getText()
205 + " already exists");
206 return false;
207 }
208
209 if (txtProjectLocation.getText().trim().length() == 0) {
210 setErrorMessage("Set directory that contains Poky tree");
211 return false;
212 }
213
214 File f = new File(txtProjectLocation.getText());
215 if (!f.exists() || !f.isDirectory()) {
216 setErrorMessage("Invalid Directory");
217 return false;
218 }
219
220 if (txtInit.getText().length() == 0) {
221 setErrorMessage("Set configuration file before BitBake is launched.");
222 return false;
223 }
224
225 File f2 = new File(getFileSegment(txtInit.getText()));
226 if (!f2.exists() || f2.isDirectory()) {
227 setErrorMessage("The configuration file is invalid.");
228 return false;
229 }
230
231 setErrorMessage(null);
232 setMessage("All the entries are valid, press \"Finish\" to create the new yocto bitbake project,"+
233 "this will take a while. Please don't interrupt till there's output in the Yocto Console window...");
234 return true;
235 }
236}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2011 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.wizards.importProject;
12
13import java.io.IOException;
14import java.io.Writer;
15import java.util.Hashtable;
16import java.util.Map;
17
18import org.eclipse.core.runtime.IStatus;
19import org.eclipse.core.runtime.Status;
20import org.eclipse.jface.viewers.IStructuredSelection;
21import org.eclipse.ui.IImportWizard;
22import org.eclipse.ui.IWorkbench;
23import org.eclipse.ui.IWorkbenchPage;
24import org.eclipse.ui.IWorkbenchWindow;
25import org.eclipse.ui.PlatformUI;
26import org.eclipse.ui.console.ConsolePlugin;
27import org.eclipse.ui.console.IConsole;
28import org.eclipse.ui.console.IConsoleConstants;
29import org.eclipse.ui.console.IConsoleManager;
30import org.eclipse.ui.console.IConsoleView;
31import org.eclipse.ui.console.MessageConsole;
32
33import org.yocto.bc.ui.Activator;
34import org.yocto.bc.ui.model.ProjectInfo;
35import org.yocto.bc.ui.wizards.FiniteStateWizard;
36
37import org.yocto.bc.ui.wizards.newproject.BBConfigurationInitializeOperation;
38import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation;
39
40public class ImportYoctoProjectWizard extends FiniteStateWizard implements IImportWizard {
41 protected final static String KEY_OEROOT = "OEROOT";
42 public static final String KEY_NAME = "NAME";
43 public static final String KEY_LOCATION = "LOCATION";
44 public static final String KEY_INITPATH = "INITPATH";
45 protected static final String KEY_PINFO = "PINFO";
46
47 private Map projectModel;
48 private IWorkbench workbench;
49 private IStructuredSelection selection;
50
51 private MessageConsole myConsole;
52
53 public ImportYoctoProjectWizard() {
54 projectModel = new Hashtable();
55 }
56
57 public Map getModel() {
58 return projectModel;
59 }
60
61 @Override
62 public void addPages() {
63 addPage(new BBCProjectPage(projectModel));
64 //addPage(new ConsolePage(projectModel));
65 }
66
67
68 public boolean performFinish() {
69 ProjectInfo pinfo = new ProjectInfo();
70 pinfo.setInitScriptPath((String) projectModel.get(ImportYoctoProjectWizard.KEY_INITPATH));
71 pinfo.setLocation((String) projectModel.get(ImportYoctoProjectWizard.KEY_LOCATION));
72 pinfo.setName((String) projectModel.get(ImportYoctoProjectWizard.KEY_NAME));
73
74 try {
75 ConsoleWriter cw = new ConsoleWriter();
76 this.getContainer().run(false, false, new BBConfigurationInitializeOperation(pinfo, cw));
77 myConsole.newMessageStream().println(cw.getContents());
78 } catch (Exception e) {
79 Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
80 this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage());
81 //valid = false;
82 //setPageComplete(valid);
83 return false;
84 }
85
86 //valid = true;
87 projectModel.put(ImportYoctoProjectWizard.KEY_PINFO, pinfo);
88 //setPageComplete(valid);
89 //ProjectInfo pinfo = (ProjectInfo) projectModel.get(KEY_PINFO);
90 Activator.putProjInfo(pinfo.getRootPath(), pinfo);
91 try {
92 getContainer().run(false, false, new CreateBBCProjectOperation(pinfo));
93 } catch (Exception e) {
94 Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
95 this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage());
96 return false;
97 }
98
99 return true;
100 }
101
102 public void init(IWorkbench workbench, IStructuredSelection selection) {
103 this.workbench = workbench;
104 this.selection = selection;
105 this.setNeedsProgressMonitor(true);
106 setWindowTitle("BitBake Commander Project");
107
108 myConsole = findConsole("Yocto Console");
109 IWorkbench wb = PlatformUI.getWorkbench();
110 IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
111 IWorkbenchPage page = win.getActivePage();
112 String id = IConsoleConstants.ID_CONSOLE_VIEW;
113 try {
114 IConsoleView view = (IConsoleView) page.showView(id);
115 view.display(myConsole);
116 } catch (Exception e) {
117 e.printStackTrace();
118 }
119 }
120
121 private MessageConsole findConsole(String name) {
122 ConsolePlugin plugin = ConsolePlugin.getDefault();
123 IConsoleManager conMan = plugin.getConsoleManager();
124 IConsole[] existing = conMan.getConsoles();
125 for (int i = 0; i < existing.length; i++)
126 if (name.equals(existing[i].getName()))
127 return (MessageConsole) existing[i];
128 // no console found, so create a new one
129 MessageConsole myConsole = new MessageConsole(name, null);
130 conMan.addConsoles(new IConsole[] { myConsole });
131 return myConsole;
132 }
133
134 private class ConsoleWriter extends Writer {
135
136 private StringBuffer sb;
137
138 public ConsoleWriter() {
139 sb = new StringBuffer();
140 }
141 @Override
142 public void close() throws IOException {
143 }
144
145 public String getContents() {
146 return sb.toString();
147 }
148
149 @Override
150 public void flush() throws IOException {
151 }
152
153 @Override
154 public void write(char[] cbuf, int off, int len) throws IOException {
155 //txtConsole.getText().concat(new String(cbuf));
156 sb.append(cbuf);
157 }
158
159 @Override
160 public void write(String str) throws IOException {
161 sb.append(str);
162 }
163
164 }
165
166}
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 @@
1package org.yocto.bc.ui.wizards.install;
2
3import java.io.BufferedReader;
4import java.io.File;
5import java.io.FileInputStream;
6import java.io.FileDescriptor;
7import java.io.InputStream;
8import java.io.IOException;
9import java.io.InputStreamReader;
10import java.io.OutputStream;
11import java.io.Writer;
12import java.util.ArrayList;
13import java.util.Hashtable;
14import java.util.Map;
15import java.util.regex.Matcher;
16import java.util.regex.Pattern;
17import java.lang.reflect.InvocationTargetException;
18import java.net.URL;
19
20import org.eclipse.core.runtime.IProgressMonitor;
21import org.eclipse.core.runtime.IStatus;
22import org.eclipse.core.runtime.NullProgressMonitor;
23import org.eclipse.core.runtime.Path;
24import org.eclipse.core.runtime.Status;
25import org.eclipse.jface.operation.IRunnableWithProgress;
26import org.eclipse.jface.viewers.IStructuredSelection;
27import org.eclipse.jface.wizard.IWizardPage;
28import org.eclipse.jface.wizard.WizardPage;
29
30import org.eclipse.ui.PlatformUI;
31import org.eclipse.ui.IWorkbench;
32import org.eclipse.ui.IWorkbenchWizard;
33import org.eclipse.ui.IWorkbenchPage;
34import org.eclipse.ui.IWorkbenchWindow;
35import org.eclipse.ui.console.IConsoleConstants;
36import org.eclipse.ui.console.MessageConsole;
37import org.eclipse.ui.console.MessageConsoleStream;
38import org.eclipse.ui.console.ConsolePlugin;
39import org.eclipse.ui.console.IConsoleManager;
40import org.eclipse.ui.console.IConsole;
41import org.eclipse.ui.console.IConsoleView;
42import org.eclipse.ui.progress.IProgressService;
43
44import org.yocto.bc.bitbake.ICommandResponseHandler;
45import org.yocto.bc.bitbake.ShellSession;
46import org.yocto.bc.ui.Activator;
47import org.yocto.bc.ui.model.ProjectInfo;
48import org.yocto.bc.ui.wizards.FiniteStateWizard;
49
50import org.yocto.bc.ui.wizards.newproject.BBConfigurationInitializeOperation;
51import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation;
52
53/**
54 * A wizard for installing a fresh copy of an OE system.
55 *
56 * @author kgilmer
57 *
58 * A Wizard for creating a fresh Yocto bitbake project and new poky build tree from git
59 *
60 * @modified jzhang
61 *
62 */
63public class InstallWizard extends FiniteStateWizard implements
64 IWorkbenchWizard {
65
66 static final String KEY_PINFO = "KEY_PINFO";
67 protected static final String OPTION_MAP = "OPTION_MAP";
68 protected static final String INSTALL_SCRIPT = "INSTALL_SCRIPT";
69 protected static final String INSTALL_DIRECTORY = "Install Directory";
70 protected static final String INIT_SCRIPT = "Init Script";
71
72 protected static final String PROJECT_NAME = "Project Name";
73 protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
74 protected static final String DEFAULT_INSTALL_DIR = "~/yocto";
75
76 protected static final String GIT_CLONE = "Git Clone";
77 public static final String VALIDATION_FILE = DEFAULT_INIT_SCRIPT;
78
79 private Map model;
80 private MessageConsole myConsole;
81
82 public InstallWizard() {
83 this.model = new Hashtable();
84 model.put(INSTALL_DIRECTORY, DEFAULT_INSTALL_DIR);
85 model.put(INIT_SCRIPT, DEFAULT_INIT_SCRIPT);
86
87 setWindowTitle("Yocto Project BitBake Commander");
88 setNeedsProgressMonitor(true);
89
90 myConsole = findConsole("Yocto Project Console");
91 IWorkbench wb = PlatformUI.getWorkbench();
92 IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
93 IWorkbenchPage page = win.getActivePage();
94 String id = IConsoleConstants.ID_CONSOLE_VIEW;
95 try {
96 IConsoleView view = (IConsoleView) page.showView(id);
97 view.display(myConsole);
98 } catch (Exception e) {
99 e.printStackTrace();
100 }
101 }
102
103 private MessageConsole findConsole(String name) {
104 ConsolePlugin plugin = ConsolePlugin.getDefault();
105 IConsoleManager conMan = plugin.getConsoleManager();
106 IConsole[] existing = conMan.getConsoles();
107 for (int i = 0; i < existing.length; i++)
108 if (name.equals(existing[i].getName()))
109 return (MessageConsole) existing[i];
110 // no console found, so create a new one
111 MessageConsole myConsole = new MessageConsole(name, null);
112 conMan.addConsoles(new IConsole[] { myConsole });
113 return myConsole;
114 }
115
116 public InstallWizard(IStructuredSelection selection) {
117 model = new Hashtable();
118 }
119
120 /*
121 * @Override public IWizardPage getNextPage(IWizardPage page) { if (page
122 * instanceof WelcomePage) { if (model.containsKey(WelcomePage.ACTION_USE))
123 * { return bbcProjectPage; } } else if (page instanceof ProgressPage) {
124 * return bitbakePage; }
125 *
126 * if (super.getNextPage(page) != null) { System.out.println("next page: " +
127 * super.getNextPage(page).getClass().getName()); } else {
128 * System.out.println("end page"); }
129 *
130 * return super.getNextPage(page); }
131 *
132 * @Override public boolean canFinish() { System.out.println("can finish: "
133 * + super.canFinish()); return super.canFinish(); }
134 */
135 @Override
136 public void addPages() {
137 addPage(new OptionsPage(model));
138 }
139
140 @Override
141 public Map getModel() {
142 return model;
143 }
144
145 @Override
146 public boolean performFinish() {
147 BCCommandResponseHandler cmdOut = new BCCommandResponseHandler(
148 myConsole);
149
150 WizardPage page = (WizardPage) getPage("Options");
151 page.setPageComplete(true);
152 Map options = (Map) model;
153 String install_dir = "";
154 if (options.containsKey(INSTALL_DIRECTORY)) {
155 install_dir = (String) options.get(INSTALL_DIRECTORY);
156 }
157
158 try {
159 if (((Boolean)options.get(GIT_CLONE)).booleanValue()) {
160 String []git_clone_cmd = {"git", "clone", "--progress", "git://git.pokylinux.org/poky.git", install_dir};
161 final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
162
163 this.getContainer().run(true,true,
164 new LongtimeRunningTask("Checking out Yocto git repository",
165 git_clone_cmd, null, null,
166 cmdOut,
167 new ICalculatePercentage() {
168 public float calWorkloadDone(String info) throws IllegalArgumentException {
169 Matcher m=pattern.matcher(info.trim());
170 if(m.matches()) {
171 return new Float(m.group(1)) / 100;
172 }else {
173 throw new IllegalArgumentException();
174 }
175 }
176 }
177 )
178 );
179 }
180
181 if (!cmdOut.hasError()) {
182
183 String initPath = install_dir + "/"
184 + (String) options.get(INIT_SCRIPT);
185 String prjName = (String) options.get(PROJECT_NAME);
186 ProjectInfo pinfo = new ProjectInfo();
187 pinfo.setInitScriptPath(initPath);
188 pinfo.setLocation(install_dir);
189 pinfo.setName(prjName);
190
191 ConsoleWriter cw = new ConsoleWriter();
192 this.getContainer().run(false, false,
193 new BBConfigurationInitializeOperation(pinfo, cw));
194
195 myConsole.newMessageStream().println(cw.getContents());
196
197 model.put(InstallWizard.KEY_PINFO, pinfo);
198 Activator.putProjInfo(pinfo.getRootPath(), pinfo);
199
200 this.getContainer().run(false, false,
201 new CreateBBCProjectOperation(pinfo));
202 return true;
203 }
204 } catch (Exception e) {
205 Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
206 IStatus.ERROR, e.getMessage(), e));
207 this.getContainer().getCurrentPage().setDescription(
208 "Failed to create project: " + e.getMessage());
209 }
210 return false;
211 }
212
213 public void init(IWorkbench workbench, IStructuredSelection selection) {
214 }
215
216 private interface ICalculatePercentage {
217 public float calWorkloadDone(String info) throws IllegalArgumentException;
218 }
219
220 private class LongtimeRunningTask implements IRunnableWithProgress {
221 private String []cmdArray;
222 private String []envp;
223 private File dir;
224 private ICommandResponseHandler handler;
225 private Process p;
226 private String taskName;
227 static public final int TOTALWORKLOAD=100;
228 private int reported_workload;
229 ICalculatePercentage cal;
230
231 public LongtimeRunningTask(String taskName,
232 String []cmdArray, String []envp, File dir,
233 ICommandResponseHandler handler,
234 ICalculatePercentage calculator) {
235 this.taskName=taskName;
236 this.cmdArray=cmdArray;
237 this.envp=envp;
238 this.dir=dir;
239 this.handler=handler;
240 this.p=null;
241 this.cal=calculator;
242 }
243
244 private void reportProgress(IProgressMonitor monitor,String info) {
245 if(cal == null) {
246 monitor.worked(1);
247 }else {
248 float percentage;
249 try {
250 percentage=cal.calWorkloadDone(info);
251 } catch (IllegalArgumentException e) {
252 //can't get percentage
253 return;
254 }
255 int delta=(int) (TOTALWORKLOAD * percentage - reported_workload);
256 if( delta > 0 ) {
257 monitor.worked(delta);
258 reported_workload += delta;
259 }
260 }
261 }
262
263 synchronized public void run(IProgressMonitor monitor)
264 throws InvocationTargetException, InterruptedException {
265
266 boolean cancel=false;
267 reported_workload=0;
268
269 try {
270 monitor.beginTask(taskName, TOTALWORKLOAD);
271
272 p=Runtime.getRuntime().exec(cmdArray,envp,dir);
273 BufferedReader inbr = new BufferedReader(new InputStreamReader(p.getInputStream()));
274 BufferedReader errbr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
275 String info;
276 while (!cancel) {
277 if(monitor.isCanceled())
278 {
279 cancel=true;
280 throw new InterruptedException("User Cancelled");
281 }
282
283 info=null;
284 //reading stderr
285 while (errbr.ready()) {
286 info=errbr.readLine();
287 //some application using stderr to print out information
288 handler.response(info, false);
289 }
290 //reading stdout
291 while (inbr.ready()) {
292 info=inbr.readLine();
293 handler.response(info, false);
294 }
295
296 //report progress
297 if(info!=null)
298 reportProgress(monitor,info);
299
300 //check if exit
301 try {
302 int exitValue=p.exitValue();
303 if (exitValue != 0) {
304 handler.response(
305 taskName + " failed with the return value " + new Integer(exitValue).toString(),
306 true);
307 }
308 break;
309 }catch (IllegalThreadStateException e) {
310 }
311
312 Thread.sleep(500);
313 }
314 } catch (IOException e) {
315 throw new InvocationTargetException(e);
316 } finally {
317 monitor.done();
318 if (p != null ) {
319 p.destroy();
320 }
321 }
322 }
323 }
324
325 private class BCCommandResponseHandler implements ICommandResponseHandler {
326 private MessageConsoleStream myConsoleStream;
327 private Boolean errorOccured = false;
328
329 public BCCommandResponseHandler(MessageConsole console) {
330 try {
331 this.myConsoleStream = console.newMessageStream();
332 } catch (Exception e) {
333 e.printStackTrace();
334 }
335 }
336
337 public void printDialog(String msg) {
338 try {
339 myConsoleStream.println(msg);
340 } catch (Exception e) {
341 e.printStackTrace();
342 }
343 }
344
345 public Boolean hasError() {
346 return errorOccured;
347 }
348
349 public void response(String line, boolean isError) {
350 try {
351 if (isError) {
352 myConsoleStream.println(line);
353 errorOccured = true;
354 } else {
355 myConsoleStream.println(line);
356 }
357 } catch (Exception e) {
358 e.printStackTrace();
359 }
360 }
361
362 public void printCmd(String cmd) {
363 try {
364 myConsoleStream.println(cmd);
365 } catch (Exception e) {
366 e.printStackTrace();
367 }
368 }
369 }
370
371 private class ConsoleWriter extends Writer {
372
373 private StringBuffer sb;
374
375 public ConsoleWriter() {
376 sb = new StringBuffer();
377 }
378
379 @Override
380 public void close() throws IOException {
381 }
382
383 public String getContents() {
384 return sb.toString();
385 }
386
387 @Override
388 public void flush() throws IOException {
389 }
390
391 @Override
392 public void write(char[] cbuf, int off, int len) throws IOException {
393 // txtConsole.getText().concat(new String(cbuf));
394 sb.append(cbuf);
395 }
396
397 @Override
398 public void write(String str) throws IOException {
399 sb.append(str);
400 }
401
402 }
403
404}
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 @@
1package org.yocto.bc.ui.wizards.install;
2
3import java.io.IOException;
4import java.io.File;
5import java.net.URI;
6import java.util.ArrayList;
7import java.util.Hashtable;
8import java.util.Iterator;
9import java.util.List;
10import java.util.Map;
11
12import org.eclipse.core.resources.IProject;
13import org.eclipse.core.resources.IProjectDescription;
14import org.eclipse.core.resources.IResource;
15import org.eclipse.core.resources.IWorkspaceRoot;
16import org.eclipse.core.resources.ResourcesPlugin;
17import org.eclipse.core.runtime.CoreException;
18import org.eclipse.core.runtime.IStatus;
19import org.eclipse.swt.SWT;
20import org.eclipse.swt.events.SelectionAdapter;
21import org.eclipse.swt.events.SelectionEvent;
22import org.eclipse.swt.layout.GridData;
23import org.eclipse.swt.layout.GridLayout;
24import org.eclipse.swt.widgets.Button;
25import org.eclipse.swt.widgets.Composite;
26import org.eclipse.swt.widgets.Control;
27import org.eclipse.swt.widgets.DirectoryDialog;
28import org.eclipse.swt.widgets.FileDialog;
29import org.eclipse.swt.widgets.Label;
30import org.eclipse.swt.widgets.Text;
31import org.eclipse.ui.PlatformUI;
32
33import org.yocto.bc.ui.wizards.FiniteStateWizard;
34import org.yocto.bc.ui.wizards.FiniteStateWizardPage;
35import org.yocto.bc.ui.wizards.FiniteStateWizardPage.ValidationListener;
36
37/**
38 * Select which flavor of OE is to be installed.
39 *
40 * @author kgilmer
41 *
42 * Setting up the parameters for creating the new Yocto Bitbake project
43 *
44 * @modified jzhang
45 */
46public class OptionsPage extends FiniteStateWizardPage {
47
48 private Map vars;
49 private Composite c1;
50 private Composite top;
51
52 private List controlList;
53 private boolean controlsCreated = false;
54
55 private Text txtProjectLocation;
56
57 private Text txtInit;
58 private ValidationListener validationListener;
59 private Text txtProjectName;
60 private Button gitButton;
61
62 protected OptionsPage(Map model) {
63 super("Options", model);
64 //setTitle("Create new yocto bitbake project");
65 setMessage("Enter these parameters to create new Yocto Project BitBake commander project");
66 }
67
68 @Override
69 public void createControl(Composite parent) {
70 top = new Composite(parent, SWT.None);
71 top.setLayout(new GridLayout());
72 top.setLayoutData(new GridData(GridData.FILL_BOTH));
73
74 GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL);
75 GridData gdVU = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
76
77 Composite projectNameComp = new Composite(top, SWT.NONE);
78 GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL);
79 projectNameComp.setLayoutData(gdProjName);
80 projectNameComp.setLayout(new GridLayout(2, false));
81 Label lblProjectName = new Label(projectNameComp, SWT.NONE);
82 lblProjectName.setText("Project N&ame:");
83
84 txtProjectName = new Text(projectNameComp, SWT.BORDER);
85 txtProjectName.setLayoutData(gdFillH);
86 txtProjectName.setFocus();
87 validationListener = new ValidationListener();
88
89 txtProjectName.addModifyListener(validationListener);
90
91 Label lblProjectLocation = new Label(projectNameComp, SWT.None);
92 lblProjectLocation.setText("&Project Location:");
93
94 Composite locComposite = new Composite(projectNameComp, SWT.NONE);
95 GridData gd = new GridData(GridData.VERTICAL_ALIGN_END
96 | GridData.FILL_HORIZONTAL);
97 gd.horizontalIndent = 0;
98 locComposite.setLayoutData(gd);
99 GridLayout gl = new GridLayout(2, false);
100 gl.marginWidth = 0;
101 locComposite.setLayout(gl);
102
103 txtProjectLocation = new Text(locComposite, SWT.BORDER);
104 txtProjectLocation.setLayoutData(gdFillH);
105 txtProjectLocation.addModifyListener(validationListener);
106
107 Button button = new Button(locComposite, SWT.PUSH);
108 button.setText("Browse...");
109 button.addSelectionListener(new SelectionAdapter() {
110 @Override
111 public void widgetSelected(SelectionEvent e) {
112 handleBrowse();
113 }
114 });
115
116 //Label lblGit = new Label(projectNameComp, SWT.None);
117 //lblGit.setText("Clone from &Git Repository?");
118
119 Composite gitComposite = new Composite(projectNameComp, SWT.NONE);
120 gd = new GridData(GridData.VERTICAL_ALIGN_END
121 | GridData.FILL_HORIZONTAL);
122 gd.horizontalIndent = 0;
123 gitComposite.setLayoutData(gd);
124 gl = new GridLayout(1, false);
125 gl.marginWidth = 0;
126 gitComposite.setLayout(gl);
127
128 gitButton = new Button(gitComposite, SWT.CHECK);
129 gitButton.setText("Clone from Yocto Project &Git Repository");
130 gitButton.setEnabled(true);
131 gitButton.addSelectionListener(validationListener);
132
133 setControl(top);
134 }
135
136 private void handleBrowse() {
137 DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.None);
138 String dir = dialog.open();
139 if (dir != null) {
140 txtProjectLocation.setText(dir);
141 }
142 }
143
144 @Override
145 public void pageCleanup() {
146
147 }
148
149 @Override
150 public void pageDisplay() {
151 }
152
153 @Override
154
155 protected void updateModel() {
156 model.put(InstallWizard.INSTALL_DIRECTORY, txtProjectLocation.getText()+File.separator+txtProjectName.getText());
157 model.put(InstallWizard.PROJECT_NAME, txtProjectName.getText());
158 model.put(InstallWizard.GIT_CLONE, new Boolean(gitButton.getSelection()));
159 }
160
161 private boolean isValidProjectName(String projectName) {
162 if (projectName.indexOf('$') > -1) {
163 return false;
164 }
165
166 return true;
167 }
168 @Override
169 protected boolean validatePage() {
170 IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
171
172 IStatus validate = ResourcesPlugin.getWorkspace().validateName(txtProjectName.getText(), IResource.PROJECT);
173
174 if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) {
175 setErrorMessage("Invalid project name: " + txtProjectName.getText());
176 return false;
177 }
178
179 IProject proj = wsroot.getProject(txtProjectName.getText());
180 if (proj.exists()) {
181 setErrorMessage("A project with the name " + txtProjectName.getText()
182 + " already exists");
183 return false;
184 }
185
186 String projectLoc = txtProjectLocation.getText();
187 File checkProject_dir = new File(projectLoc);
188 if (!checkProject_dir.isDirectory()) {
189 setErrorMessage("The project location directory " + txtProjectLocation.getText() + " is not valid");
190 return false;
191 }
192
193 String projectPath = projectLoc + File.separator+txtProjectName.getText();
194 File git_dir=new File(projectPath);
195 if(!gitButton.getSelection()) {
196 if(!git_dir.isDirectory() || !git_dir.exists()) {
197 setErrorMessage("Directory " + txtProjectLocation.getText()+File.separator+txtProjectName.getText() + " does not exist, please select git clone.");
198 return false;
199 }else if(!new File(projectPath + File.separator + InstallWizard.VALIDATION_FILE).exists()) {
200 setErrorMessage("Directory " + txtProjectLocation.getText()+File.separator+txtProjectName.getText() + " seems invalid, please use other directory or project name.");
201 return false;
202 }
203 }else {
204 // git check
205 if(git_dir.exists()) {
206 setErrorMessage("Directory " + txtProjectLocation.getText()+File.separator+txtProjectName.getText() + " exists, please unselect git clone.");
207 return false;
208 }
209 }
210
211 try {
212 URI location = new URI("file://" + txtProjectLocation.getText()+File.separator+txtProjectName.getText());
213
214 IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location);
215 if (!status.isOK()) {
216 setErrorMessage(status.getMessage());
217 return false;
218 }
219 } catch (Exception e) {
220 setErrorMessage("Run into error while trying to validate entries!");
221 return false;
222 }
223 setErrorMessage(null);
224 setMessage("All the entries are valid, press \"Finish\" to start the process, "+
225 "this will take a while. Please don't interrupt till there's output in the Yocto Console window...");
226 return true;
227 }
228
229 private class FileOpenSelectionAdapter extends SelectionAdapter {
230 @Override
231 public void widgetSelected(SelectionEvent e) {
232 FileDialog fd = new FileDialog(PlatformUI.getWorkbench()
233 .getDisplay().getActiveShell(), SWT.OPEN);
234
235 fd.setText("Open Configuration Script");
236 fd.setFilterPath(txtProjectLocation.getText());
237
238 String selected = fd.open();
239
240 if (selected != null) {
241 txtInit.setText(selected);
242 updateModel();
243 }
244 }
245 }
246
247}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.wizards.newproject;
12
13import java.io.Writer;
14import java.lang.reflect.InvocationTargetException;
15
16import org.eclipse.core.runtime.IProgressMonitor;
17import org.eclipse.jface.operation.IRunnableWithProgress;
18
19import org.yocto.bc.bitbake.BBSession;
20import org.yocto.bc.bitbake.ProjectInfoHelper;
21import org.yocto.bc.ui.Activator;
22import org.yocto.bc.ui.model.ProjectInfo;
23
24public class BBConfigurationInitializeOperation implements IRunnableWithProgress {
25
26 private final ProjectInfo pinfo;
27 private final Writer writer;
28
29 public BBConfigurationInitializeOperation(ProjectInfo pinfo) {
30 this.pinfo = pinfo;
31 writer = null;
32 }
33
34 public BBConfigurationInitializeOperation(ProjectInfo pinfo, Writer writer) {
35 this.pinfo = pinfo;
36 this.writer = writer;
37 }
38
39 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
40 BBSession session;
41 try {
42 ProjectInfoHelper.store(pinfo.getRootPath(), pinfo);
43 session = Activator.getBBSession(pinfo.getRootPath(), writer);
44 session.initialize();
45
46 } catch (Exception e) {
47 throw new InvocationTargetException(e);
48 }
49 }
50}
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 @@
1/*****************************************************************************
2 * Copyright (c) 2009 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 *******************************************************************************/
11package org.yocto.bc.ui.wizards.newproject;
12
13import java.io.IOException;
14import java.lang.reflect.InvocationTargetException;
15import java.net.URI;
16import java.net.URISyntaxException;
17import java.util.Arrays;
18import java.util.Vector;
19
20import org.eclipse.core.resources.IProject;
21import org.eclipse.core.resources.IProjectDescription;
22import org.eclipse.core.resources.IWorkspace;
23import org.eclipse.core.resources.IWorkspaceRoot;
24import org.eclipse.core.resources.ResourcesPlugin;
25import org.eclipse.core.runtime.CoreException;
26import org.eclipse.core.runtime.IProgressMonitor;
27import org.eclipse.core.runtime.IStatus;
28import org.eclipse.core.runtime.QualifiedName;
29import org.eclipse.core.runtime.Status;
30import org.eclipse.ui.actions.WorkspaceModifyOperation;
31
32import org.yocto.bc.bitbake.ProjectInfoHelper;
33import org.yocto.bc.ui.Activator;
34import org.yocto.bc.ui.builder.BitbakeCommanderNature;
35import org.yocto.bc.ui.model.ProjectInfo;
36
37
38/**
39 * Creates a bbc project
40 * @author kgilmer
41 *
42 */
43public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
44
45 public static final String OEFS_SCHEME = "OEFS://";
46 public static final QualifiedName BBC_PROJECT_INIT = new QualifiedName(null, "BBC_PROJECT_INIT");
47 public static void addNatureToProject(IProject proj, String nature_id, IProgressMonitor monitor) throws CoreException {
48 IProjectDescription desc = proj.getDescription();
49 Vector natureIds = new Vector();
50
51 natureIds.add(nature_id);
52 natureIds.addAll(Arrays.asList(desc.getNatureIds()));
53 desc.setNatureIds((String[]) natureIds.toArray(new String[natureIds.size()]));
54
55 proj.setDescription(desc, monitor);
56 }
57
58 private ProjectInfo projInfo;
59
60 public CreateBBCProjectOperation(ProjectInfo projInfo) {
61 this.projInfo = projInfo;
62 }
63
64 protected void addNatures(IProject proj, IProgressMonitor monitor) throws CoreException {
65 addNatureToProject(proj, BitbakeCommanderNature.NATURE_ID, monitor);
66 }
67
68 private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInfo2) throws CoreException {
69 IProjectDescription desc = workspace.newProjectDescription(projInfo2.getProjectName());
70
71 try {
72 desc.setLocationURI(new URI(OEFS_SCHEME + projInfo2.getRootPath()));
73 } catch (URISyntaxException e) {
74 throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to load filesystem.", e));
75 }
76
77 return desc;
78 }
79
80 @Override
81 protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
82 IProjectDescription desc = createProjectDescription(ResourcesPlugin.getWorkspace(), projInfo);
83
84 IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
85
86 IProject proj = wsroot.getProject(projInfo.getProjectName());
87 proj.create(desc, monitor);
88 try {
89 ProjectInfoHelper.store(proj.getLocationURI().getPath(), projInfo);
90 } catch (IOException e) {
91 throw new InvocationTargetException(e);
92 }
93
94 proj.open(monitor);
95
96 addNatures(proj, monitor);
97 }
98
99 public ProjectInfo getProjectInfo() {
100 return projInfo;
101 }
102}
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 @@
1package org.yocto.bc.ui.wizards.variable;
2
3import java.util.Comparator;
4import java.util.Map;
5
6import org.eclipse.jface.viewers.ILabelProviderListener;
7import org.eclipse.jface.viewers.IStructuredContentProvider;
8import org.eclipse.jface.viewers.ITableLabelProvider;
9import org.eclipse.jface.viewers.TableViewer;
10import org.eclipse.jface.viewers.Viewer;
11import org.eclipse.jface.viewers.ViewerFilter;
12import org.eclipse.jface.viewers.ViewerSorter;
13import org.eclipse.swt.SWT;
14import org.eclipse.swt.events.SelectionAdapter;
15import org.eclipse.swt.events.SelectionEvent;
16import org.eclipse.swt.graphics.Image;
17import org.eclipse.swt.layout.GridData;
18import org.eclipse.swt.layout.GridLayout;
19import org.eclipse.swt.widgets.Composite;
20import org.eclipse.swt.widgets.Table;
21import org.eclipse.swt.widgets.TableColumn;
22import org.eclipse.swt.widgets.Text;
23
24import org.yocto.bc.ui.wizards.FiniteStateWizardPage;
25
26/**
27 * The wizard page for the Variable Wizard.
28 * @author kgilmer
29 *
30 */
31public class VariablePage extends FiniteStateWizardPage {
32
33 private Text txtName;
34 private Text txtValue;
35 private TableViewer viewer;
36 private TableColumn c1;
37 private TableColumn c2;
38
39 protected VariablePage(Map model) {
40 super("Yocto Project BitBake Commander", model);
41 setTitle("Yocto Project BitBake Variable Viewer");
42 setDescription("Sort and fitler global BitBake variables by name or value.");
43 }
44
45 @Override
46 public void createControl(Composite parent) {
47 Composite top = new Composite(parent, SWT.None);
48 top.setLayout(new GridLayout(2, true));
49 top.setLayoutData(new GridData(GridData.FILL_BOTH));
50
51 ValidationListener listener = new ValidationListener();
52
53 txtName = new Text(top, SWT.BORDER);
54 txtName.addModifyListener(listener);
55 txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
56
57 txtValue = new Text(top, SWT.BORDER);
58 txtValue.addModifyListener(listener);
59 txtValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
60
61 viewer = new TableViewer(top);
62
63 Table table = viewer.getTable();
64 table.setLinesVisible(true);
65 table.setHeaderVisible(true);
66 GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
67 data.heightHint = 200;
68 data.horizontalSpan = 2;
69 table.setLayoutData(data);
70 c1 = new TableColumn(table, SWT.NONE);
71 c1.setText("Name");
72 c1.setWidth(200);
73 c1.addSelectionListener(new SelectionAdapter() {
74 public void widgetSelected(SelectionEvent event) {
75 ((VariableViewerSorter) viewer.getSorter()).doSort(0);
76 viewer.refresh();
77 }
78 });
79
80 c2 = new TableColumn(table, SWT.NONE);
81 c2.setText("Value");
82 c2.setWidth(200);
83 c2.addSelectionListener(new SelectionAdapter() {
84 public void widgetSelected(SelectionEvent event) {
85 ((VariableViewerSorter) viewer.getSorter()).doSort(1);
86 viewer.refresh();
87 }
88 });
89
90 viewer.setContentProvider(new VariableContentProvider());
91 viewer.setLabelProvider(new VariableLabelProvider());
92 viewer.setSorter(new VariableViewerSorter());
93
94 viewer.setFilters(new ViewerFilter[] {new MapViewerFilter()});
95 setControl(top);
96 }
97
98 @Override
99 public void pageCleanup() {
100
101 }
102
103 @Override
104 public void pageDisplay() {
105 viewer.setInput(model);
106 }
107
108 @Override
109 protected void updateModel() {
110 viewer.refresh();
111 }
112
113 @Override
114 protected boolean validatePage() {
115 return true;
116 }
117
118 /**
119 * A content provider for the variable wizard dialog.
120 * @author kgilmer
121 *
122 */
123 private class VariableContentProvider implements IStructuredContentProvider {
124
125 public Object[] getElements(Object inputElement) {
126 return model.keySet().toArray();
127 }
128
129 public void dispose() {
130
131 }
132
133 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
134
135 }
136 }
137
138 /**
139 * A label provider for variable wizard dialog.
140 * @author kgilmer
141 *
142 */
143 private class VariableLabelProvider implements ITableLabelProvider {
144
145 public Image getColumnImage(Object element, int columnIndex) {
146 return null;
147 }
148
149 public String getColumnText(Object element, int columnIndex) {
150 String val;
151
152 switch (columnIndex) {
153 case 0:
154 val = element.toString();
155 break;
156 case 1:
157 val = (String) model.get(element);
158 break;
159 default:
160 val = "";
161 break;
162 }
163
164 return val;
165 }
166
167 public void addListener(ILabelProviderListener listener) {
168
169 }
170
171 public void dispose() {
172
173 }
174
175 public boolean isLabelProperty(Object element, String property) {
176 return false;
177 }
178
179 public void removeListener(ILabelProviderListener listener) {
180
181 }
182
183 }
184
185 /**
186 *
187 * A tableviewer sorter found on the internet.
188 *
189 */
190 class VariableViewerSorter extends ViewerSorter {
191 private static final int ASCENDING = 0;
192
193 private static final int DESCENDING = 1;
194
195 private int column;
196
197 private int direction;
198
199 public void doSort(int column) {
200 if (column == this.column) {
201 // Same column as last sort; toggle the direction
202 direction = 1 - direction;
203 } else {
204 // New column; do an ascending sort
205 this.column = column;
206 direction = ASCENDING;
207 }
208 }
209
210 public int compare(Viewer viewer, Object e1, Object e2) {
211 int rc = 0;
212 Comparator c = this.getComparator();
213 // Determine which column and do the appropriate sort
214 switch (column) {
215 case 0:
216 rc = c.compare(e1, e2);
217 break;
218 case 1:
219 rc = c.compare(model.get(e1), model.get(e2));
220 break;
221 }
222
223 // If descending order, flip the direction
224 if (direction == DESCENDING)
225 rc = -rc;
226
227 return rc;
228 }
229 }
230
231 /**
232 * A filter for the name/value model.
233 * @author kgilmer
234 *
235 */
236 private class MapViewerFilter extends ViewerFilter {
237
238 public MapViewerFilter() {
239 }
240
241 @Override
242 public boolean select(Viewer viewer, Object parentElement, Object element) {
243 String keyFilter = txtName.getText();
244 String valFilter = txtValue.getText();
245
246 String elem = (String) element;
247 String val = (String) model.get(element);
248
249 if (keyFilter.length() > 0 && elem.indexOf(keyFilter) == -1 ) {
250 return false;
251 }
252
253 if (valFilter.length() > 0 && val.indexOf(valFilter) == -1 ) {
254 return false;
255 }
256
257 return true;
258 }
259
260 }
261
262}
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 @@
1package org.yocto.bc.ui.wizards.variable;
2
3import java.util.Hashtable;
4import java.util.Map;
5
6import org.eclipse.jface.viewers.IStructuredSelection;
7
8import org.yocto.bc.ui.wizards.FiniteStateWizard;
9
10/**
11 * This wizard is used to view, filter, and search for BitBake variables and variable contents.
12 * @author kgilmer
13 *
14 */
15public class VariableWizard extends FiniteStateWizard {
16
17 private Map model;
18
19 public VariableWizard(Map model) {
20 this.model = model;
21 setWindowTitle("Yocto Project BitBake Commander");
22 }
23
24 public VariableWizard(IStructuredSelection selection) {
25 model = new Hashtable();
26 }
27
28 @Override
29 public void addPages() {
30 addPage(new VariablePage(model));
31 }
32
33 @Override
34 public Map getModel() {
35 return model;
36 }
37
38 @Override
39 public boolean performFinish() {
40 return true;
41 }
42
43}
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 <classpathentry kind="src" path="src"/>
6 <classpathentry kind="output" path="bin"/>
7</classpath>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.cmake.managedbuilder</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.jdt.core.javabuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.pde.ManifestBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.pde.SchemaBuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 </buildSpec>
24 <natures>
25 <nature>org.eclipse.pde.PluginNature</nature>
26 <nature>org.eclipse.jdt.core.javanature</nature>
27 </natures>
28</projectDescription>
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 @@
1#Wed Jul 14 11:43:59 CEST 2010
2eclipse.preferences.version=1
3org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5org.eclipse.jdt.core.compiler.compliance=1.6
6org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8org.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 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: %Bundle-Name
4Bundle-SymbolicName: org.yocto.cmake.managedbuilder;singleton:=true
5Bundle-Version: 1.4.0.qualifier
6Bundle-Activator: org.yocto.cmake.managedbuilder.Activator
7Bundle-Vendor: %Bundle-Vendor
8Require-Bundle: org.eclipse.cdt.managedbuilder.core,
9 org.eclipse.cdt.core;bundle-version="5.2.1",
10 org.eclipse.core.resources;bundle-version="3.6.0",
11 org.eclipse.core.runtime;bundle-version="3.6.0",
12 org.eclipse.ui.console;bundle-version="3.5.0",
13 org.eclipse.ui;bundle-version="3.6.2",
14 org.yocto.sdk.ide
15Bundle-RequiredExecutionEnvironment: JavaSE-1.6
16Bundle-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 @@
1#/*******************************************************************************
2# * Copyright (c) 2013 BMW Car IT GmbH.
3# * All rights reserved. This program and the accompanying materials
4# * are made available under the terms of the Eclipse Public License v1.0
5# * which accompanies this distribution, and is available at
6# * http://www.eclipse.org/legal/epl-v10.html
7# *
8# * Contributors:
9# * BMW Car IT - initial implementation
10# *******************************************************************************/
11
12Bundle-Vendor = yoctoproject.org
13Bundle-Name = Yocto CMake Plugin
14
15# Artefact type
16yocto.cmake.artefactType=Yocto Project ADT CMake Project
17
18# Extension name
19extension.name=Yocto CMake Managed Builder
20
21# Builder
22builder.name=Yocto CMake Environment Builder
23
24# Toolchain
25toolchain=Yocto CMake Build (Toolchain)
26
27# Configuration names
28config.debug.name=Debug
29config.debug.description=Builds a version of the project which is ready for debugging
30
31# CMake configure
32cmakeconfigure.name=CMake configure
33cmakeconfigure.options=CMake Options
34cmakeconfigure.sourcepath=Relative source path
35cmakeconfigure.toolchaincmakefilepath=Relative toolchain.cmake path
36cmakeconfigure.debugsymbols=Compile with debug symbols
37cmakeconfigure.verbosemakefile=Generate verbose Makefiles
38cmakeconfigure.wdev=Enable developer warnings (-Wdev)
39cmakeconfigure.wnodev=Suppress developer warnings (-Wno-dev)
40cmakeconfigure.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 @@
1source.. = src/
2output.. = bin/
3bin.includes = META-INF/,\
4 .,\
5 plugin.xml,\
6 templates/,\
7 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<?eclipse version="3.4"?>
3<plugin>
4 <extension
5 point="org.eclipse.cdt.managedbuilder.core.buildProperties">
6 <propertyValue
7 id="org.yocto.sdk.ide.buildArtefact.cmake.exe"
8 name="%yocto.cmake.artefactType"
9 property="org.eclipse.cdt.build.core.buildArtefactType">
10 </propertyValue>
11 </extension>
12 <extension
13 id="org.yocto.cmake.managedbuilder"
14 name="%extension.name"
15 point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
16 <managedBuildRevision
17 fileVersion="4.0.0">
18 </managedBuildRevision>
19 <builder
20 id="org.yocto.cmake.managedbuilder.builder"
21 name="%builder.name"
22 buildfileGenerator="org.yocto.cmake.managedbuilder.YoctoCMakeMakefileGenerator"
23 cleanBuildTarget="clean"
24 command="make"
25 isVariableCaseSensitive="false"
26 supportsManagedBuild="true">
27 </builder>
28 <tool
29 id="org.yocto.cmake.managedbuilder.cmakeconfigure"
30 name="%cmakeconfigure.name"
31 command="cmake"
32 commandLinePattern="${COMMAND} ${FLAGS} "
33 natureFilter="both">
34 <optionCategory
35 id="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
36 name="%cmakeconfigure.options">
37 </optionCategory>
38 <option
39 category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
40 defaultValue="${OECMAKE_SOURCEPATH}"
41 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath"
42 isAbstract="false"
43 name="%cmakeconfigure.sourcepath"
44 resourceFilter="all"
45 valueType="string">
46 </option>
47 <option
48 category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
49 defaultValue="-DCMAKE_TOOLCHAIN_FILE=${OECMAKE_SOURCEPATH}/toolchain.cmake"
50 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath"
51 isAbstract="false"
52 name="%cmakeconfigure.toolchaincmakefilepath"
53 resourceFilter="all"
54 valueType="string">
55 </option>
56 <option
57 category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
58 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols"
59 name="%cmakeconfigure.debugsymbols"
60 isAbstract="false"
61 resourceFilter="all"
62 valueType="enumerated">
63 <enumeratedOptionValue
64 command="-DCMAKE_BUILD_TYPE=DEBUG"
65 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.eOV1"
66 isDefault="true"
67 name="Yes (-DCMAKE_BUILD_TYPE=DEBUG)">
68 </enumeratedOptionValue>
69 <enumeratedOptionValue
70 command=""
71 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.eOV2"
72 name="No">
73 </enumeratedOptionValue>
74 </option>
75 <option
76 category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
77 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile"
78 name="%cmakeconfigure.verbosemakefile"
79 isAbstract="false"
80 resourceFilter="all"
81 valueType="enumerated">
82 <enumeratedOptionValue
83 command="-DCMAKE_VERBOSE_MAKEFILE=1"
84 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.eOV1"
85 isDefault="true"
86 name="Yes (-DCMAKE_VERBOSE_MAKEFILE=1)">
87 </enumeratedOptionValue>
88 <enumeratedOptionValue
89 command="-DCMAKE_VERBOSE_MAKEFILE=0"
90 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.eOV2"
91 name="No (-DCMAKE_VERBOSE_MAKEFILE=0)">
92 </enumeratedOptionValue>
93 </option>
94 <option
95 category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
96 command="-Wdev"
97 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn"
98 isAbstract="false"
99 name="%cmakeconfigure.wdev"
100 resourceFilter="all"
101 valueType="boolean">
102 </option>
103 <option
104 category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
105 command="-Wno-dev"
106 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn"
107 isAbstract="false"
108 name="%cmakeconfigure.wnodev"
109 resourceFilter="all"
110 valueType="boolean">
111 </option>
112 <option
113 category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options"
114 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags"
115 isAbstract="false"
116 name="%cmakeconfigure.otherflags"
117 resourceFilter="all"
118 tip="e.g.: --warn-unused-vars --debug-output -DCMAKE_SOME_OPTION=something"
119 valueType="string">
120 </option>
121 </tool>
122 <toolChain
123 id="org.yocto.cmake.managedbuilder.toolchain.gnu.exe"
124 name="%toolchain"
125 supportsManagedBuild="true">
126 <targetPlatform
127 id="org.yocto.cmake.managedbuilder.target.gnu.exe"
128 isAbstract="false"
129 superClass="cdt.managedbuild.target.gnu.platform.base">
130 </targetPlatform>
131 <builder
132 id="org.yocto.cmake.managedbuilder.builder.gnu.exe"
133 isAbstract="false"
134 isVariableCaseSensitive="false"
135 superClass="org.yocto.cmake.managedbuilder.builder">
136 </builder>
137 <tool
138 id="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe"
139 isAbstract="false"
140 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure">
141 </tool>
142 <tool
143 id="org.yocto.cmake.managedbuilder.compiler.gnu.exe"
144 isAbstract="false"
145 natureFilter="ccnature"
146 superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
147 </tool>
148 <tool
149 id="org.yocto.cmake.managedbuilder.linker.gnu.exe"
150 isAbstract="false"
151 natureFilter="ccnature"
152 superClass="cdt.managedbuild.tool.gnu.cpp.linker">
153 </tool>
154 <tool
155 id="org.yocto.cmake.managedbuilder.compiler.gnu.c.exe"
156 isAbstract="false"
157 natureFilter="cnature"
158 superClass="cdt.managedbuild.tool.gnu.c.compiler">
159 </tool>
160 <tool
161 id="org.yocto.cmake.managedbuilder.linker.gnu.c.exe"
162 isAbstract="false"
163 natureFilter="cnature"
164 superClass="cdt.managedbuild.tool.gnu.c.linker">
165 </tool>
166 </toolChain>
167 <projectType
168 buildArtefactType="org.yocto.sdk.ide.buildArtefact.cmake.exe"
169 id="org.yocto.sdk.ide.projectTypeCMake"
170 isAbstract="false"
171 isTest="false">
172 <configuration
173 buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
174 buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
175 cleanCommand="rm -rf"
176 description="%config.debug.description"
177 id="org.yocto.cmake.managedbuilder.configuration.gnu.exe.debug"
178 name="%config.debug.name"
179 parent="cdt.managedbuild.config.gnu.base">
180 <toolChain
181 id="org.yocto.cmake.managedbuilder.toolchain.gnu.exe.debug"
182 superClass="org.yocto.cmake.managedbuilder.toolchain.gnu.exe"
183 supportsManagedBuild="true">
184 <targetPlatform
185 id="org.yocto.cmake.managedbuilder.target.gnu.exe.debug"
186 isAbstract="false"
187 superClass="org.yocto.cmake.managedbuilder.target.gnu.exe">
188 </targetPlatform>
189 <builder
190 cleanBuildTarget="clean"
191 id="org.yocto.cmake.managedbuilder.builder.gnu.exe.debug"
192 isVariableCaseSensitive="false"
193 superClass="org.yocto.cmake.managedbuilder.builder.gnu.exe">
194 </builder>
195 <tool
196 commandLinePattern="${COMMAND} ${FLAGS} "
197 id="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe.debug"
198 isAbstract="false"
199 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe">
200 <option
201 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath.gnu.exe.debug"
202 isAbstract="false"
203 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath">
204 </option>
205 <option
206 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath.gnu.exe.debug"
207 isAbstract="false"
208 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath">
209 </option>
210 <option
211 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.gnu.exe.debug"
212 isAbstract="false"
213 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols">
214 </option>
215 <option
216 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.gnu.exe.debug"
217 isAbstract="false"
218 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile">
219 </option>
220 <option
221 defaultValue="FALSE"
222 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn.gnu.exe.debug"
223 isAbstract="false"
224 resourceFilter="all"
225 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn"
226 valueType="boolean">
227 </option>
228 <option
229 defaultValue="TRUE"
230 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn.gnu.exe.debug"
231 isAbstract="false"
232 resourceFilter="all"
233 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn"
234 valueType="boolean">
235 </option>
236 <option
237 id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags.gnu.exe.debug"
238 isAbstract="false"
239 superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags">
240 </option>
241 </tool>
242 <tool
243 id="org.yocto.cmake.managedbuilder.compiler.gnu.exe.debug"
244 isAbstract="false"
245 superClass="org.yocto.cmake.managedbuilder.compiler.gnu.exe">
246 </tool>
247 <tool
248 id="org.yocto.cmake.managedbuilder.linker.gnu.exe.debug"
249 isAbstract="false"
250 superClass="org.yocto.cmake.managedbuilder.linker.gnu.exe">
251 </tool>
252 <tool
253 id="org.yocto.cmake.managedbuilder.compiler.gnu.exe.c.debug"
254 isAbstract="false"
255 superClass="org.yocto.cmake.managedbuilder.compiler.gnu.c.exe">
256 </tool>
257 <tool
258 id="org.yocto.cmake.managedbuilder.linker.gnu.exe.c.debug"
259 isAbstract="false"
260 superClass="org.yocto.cmake.managedbuilder.linker.gnu.c.exe">
261 </tool>
262 </toolChain>
263 </configuration>
264 </projectType>
265 </extension>
266 <extension
267 point="org.eclipse.cdt.core.templates">
268 <template
269 filterPattern=".*gcc"
270 id="org.yocto.cmake.managedbuilder.template.helloWorldCCMakeProject"
271 isCategory="false"
272 location="templates/projecttemplates/HelloWorldCCMakeProject/template.xml"
273 projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe">
274 </template>
275 <template
276 filterPattern=".*g\+\+"
277 id="org.yocto.cmake.managedbuilder.template.helloWorldCPPCMakeProject"
278 isCategory="false"
279 location="templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml"
280 projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe">
281 </template>
282 </extension>
283</plugin>
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.cmake.managedbuilder;
12
13import org.eclipse.core.runtime.Plugin;
14import org.osgi.framework.BundleContext;
15
16public class Activator extends Plugin {
17
18 /** The plug-in ID. */
19 public static final String PLUGIN_ID = "org.yocto.cmake.managedbuilder"; //$NON-NLS-1$
20
21 /** The shared activator instance. */
22 private static Activator plugin;
23
24 /*
25 * (non-Javadoc)
26 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
27 */
28 @Override
29 public void start(BundleContext context) throws Exception {
30 super.start(context);
31 plugin = this;
32 }
33
34 /*
35 * (non-Javadoc)
36 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
37 */
38 @Override
39 public void stop(BundleContext context) throws Exception {
40 plugin = null;
41 super.stop(context);
42 }
43
44 /**
45 * @return the shared instance of the Activator
46 */
47 public static Activator getDefault() {
48 return plugin;
49 }
50}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.cmake.managedbuilder;
12
13import java.io.ByteArrayInputStream;
14import java.io.InputStream;
15
16import org.eclipse.cdt.managedbuilder.core.IBuilder;
17import org.eclipse.cdt.managedbuilder.core.IConfiguration;
18import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
19import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
20import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
21import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2;
22import org.eclipse.core.resources.IFile;
23import org.eclipse.core.resources.IProject;
24import org.eclipse.core.resources.IResource;
25import org.eclipse.core.resources.IResourceDelta;
26import org.eclipse.core.runtime.CoreException;
27import org.eclipse.core.runtime.IPath;
28import org.eclipse.core.runtime.IProgressMonitor;
29import org.eclipse.core.runtime.IStatus;
30import org.eclipse.core.runtime.MultiStatus;
31import org.eclipse.core.runtime.jobs.Job;
32import org.yocto.cmake.managedbuilder.job.ExecuteConfigureJob;
33import org.yocto.sdk.ide.utils.YoctoSDKUtils;
34
35public class YoctoCMakeMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
36
37 private static final String TOOLCHAINCMAKE_FILE_NAME = "toolchain.cmake"; //$NON-NLS-1$
38 private static final String MAKEFILE_NAME = "Makefile"; //$NON-NLS-1$
39 private static final String CMAKE_FILE_NAME = "CMakeLists.txt"; //$NON-NLS-1$
40 private static final String CMAKECACHE_FILE_NAME = "CMakeCache.txt"; //$NON-NLS-1$
41
42 private IProject project;
43 private int lastBuildInfoChecksum = 0;
44 private IConfiguration configuration;
45 private IProgressMonitor monitor;
46 private IPath buildDir = null;
47
48 @Override
49 public String getMakefileName() {
50 return MAKEFILE_NAME;
51 }
52
53 @Override
54 public IPath getBuildWorkingDir() {
55 IPath buildWorkingDir = null;
56
57 if (buildDir != null) {
58 buildWorkingDir = buildDir.removeFirstSegments(1);
59 }
60
61 return buildWorkingDir;
62 }
63
64 @Override
65 public boolean isGeneratedResource(IResource resource) {
66 return false;
67 }
68
69 @Override
70 public void initialize(IProject project, IManagedBuildInfo info,
71 IProgressMonitor monitor) {
72 this.project = project;
73 this.configuration = info.getDefaultConfiguration();
74 this.monitor = monitor;
75
76 if (info.getDefaultConfiguration() != null) {
77 buildDir = project.getFolder(info.getConfigurationName()).getFullPath();
78 }
79 }
80
81 @Override
82 public void initialize(int buildKind, IConfiguration configuration, IBuilder builder,
83 IProgressMonitor monitor) {
84 this.project = configuration.getOwner().getProject();
85 this.configuration = configuration;
86 this.monitor = monitor;
87 this.buildDir = project.getFolder(configuration.getName()).getFullPath();
88 }
89
90 @Override
91 public void generateDependencies() throws CoreException {
92 // nothing to do here
93 }
94
95 @Override
96 public void regenerateDependencies(boolean force) throws CoreException {
97 generateDependencies();
98 }
99
100 @Override
101 public MultiStatus generateMakefiles(IResourceDelta delta)
102 throws CoreException {
103 int currentBuildInfoChecksum = ManagedBuildManager.getBuildInfo(project).hashCode();
104
105 IFile cmakeFile = project.getFile(CMAKE_FILE_NAME);
106 IResourceDelta cmakeDelta = delta.findMember(cmakeFile.getProjectRelativePath());
107 IResourceDelta[] deltas = delta
108 .getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED);
109
110 if (deltas.length > 0 || cmakeDelta != null || currentBuildInfoChecksum != lastBuildInfoChecksum) {
111 lastBuildInfoChecksum = currentBuildInfoChecksum;
112 return regenerateMakefiles();
113 } else {
114 // CMake is not needed to run prior to building
115 // just return that makefile generation is completed
116 return new MultiStatus(
117 ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.OK,
118 new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.ok.makefilesStillValid")), null); //$NON-NLS-1$
119 }
120 }
121
122 @Override
123 public MultiStatus regenerateMakefiles() throws CoreException {
124 String taskName =
125 YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configure.creatingMakefiles"); //$NON-NLS-1$
126 monitor.beginTask(taskName, 20);
127
128 IFile cmakeFile = project.getFile(CMAKE_FILE_NAME);
129 if (!cmakeFile.exists()) {
130 return new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.CANCEL,
131 new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.cancel.missingCMakeList")), null); //$NON-NLS-1$
132 }
133
134 // Retrieve Build directory
135 IPath workingDir = getBuildWorkingDir();
136 IPath location = project.getLocation().append(workingDir);
137 monitor.worked(1);
138
139 // Create build directory if it doesn't exist
140 if (!location.toFile().exists()) {
141 monitor.subTask(
142 YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.creatingBuildDirectory")); //$NON-NLS-1$
143 location.toFile().mkdirs();
144 } else {
145 monitor.subTask(
146 YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.removingCacheFiles")); //$NON-NLS-1$
147 IFile cmakeCache = project.getFile(workingDir.append(CMAKECACHE_FILE_NAME));
148 cmakeCache.delete(true, monitor);
149 }
150 monitor.setTaskName(taskName);
151
152 createToolchainCMakeFile(workingDir);
153
154 // Create the Makefiles by executing cmake
155 ExecuteConfigureJob job =
156 new ExecuteConfigureJob(
157 YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configureJob.name"), //$NON-NLS-1$
158 project, configuration, location);
159 job.setPriority(Job.BUILD);
160 job.setUser(false);
161
162 job.schedule();
163 try {
164 job.join();
165 monitor.done();
166 return new MultiStatus(
167 Activator.PLUGIN_ID, job.getResult().getSeverity(),
168 job.getResult().getMessage(), null);
169 } catch (InterruptedException e) {
170 return new MultiStatus(
171 Activator.PLUGIN_ID,
172 IStatus.ERROR, new String(
173 YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed")), null); //$NON-NLS-1$
174 }
175 }
176
177 private String createCMakeSetStatement(String variable, String value, String cacheOption) {
178 String setStatement = "set("; //$NON-NLS-1$
179 setStatement += variable + " " + value; //$NON-NLS-1$
180 if(cacheOption != null && !cacheOption.equals("")) { //$NON-NLS-1$
181 setStatement += " " + cacheOption; //$NON-NLS-1$
182 }
183 setStatement += ")\n"; //$NON-NLS-1$
184 return setStatement;
185 }
186
187 // Considered poky's cmake.bbclass for this method
188 private void createToolchainCMakeFile(IPath workingDir) {
189 String toolchainCMakeFileContentAsString = "# CMake system name must be something like \"Linux\".\n" + //$NON-NLS-1$
190 "# This is important for cross-compiling.\n"; //$NON-NLS-1$
191
192 String targetArchValue = YoctoSDKUtils.getEnvValue(project, "TARGET_ARCH"); //$NON-NLS-1$
193 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_SYSTEM_PROCESSOR", targetArchValue, null); //$NON-NLS-1$
194
195 String oeCMakeCCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_COMPILER"); //$NON-NLS-1$
196 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_COMPILER", oeCMakeCCompilerValue, null); //$NON-NLS-1$
197
198 String oeCMakeCXXCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_COMPILER"); //$NON-NLS-1$
199 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_COMPILER", oeCMakeCXXCompilerValue, null); //$NON-NLS-1$
200
201 String oeCMakeCFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS"); //$NON-NLS-1$
202 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS", //$NON-NLS-1$
203 "\"" + oeCMakeCFlagsValue + "\"", "CACHE STRING \"CFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
204
205 String oeCMakeCXXFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS"); //$NON-NLS-1$
206 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS", //$NON-NLS-1$
207 "\"" + oeCMakeCXXFlagsValue + "\"", "CACHE STRING \"CXXFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
208
209 String oeCMakeCFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS_RELEASE"); //$NON-NLS-1$
210 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS_RELEASE", //$NON-NLS-1$
211 "\"" + oeCMakeCFlagsReleaseValue + "\"", "CACHE STRING \"CFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
212
213 String oeCMakeCXXFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS_RELEASE"); //$NON-NLS-1$
214 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS_RELEASE", //$NON-NLS-1$
215 "\"" + oeCMakeCXXFlagsReleaseValue + "\"", "CACHE STRING \"CXXFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
216
217 String oeCMakeCLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_LINK_FLAGS"); //$NON-NLS-1$
218 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_LINK_FLAGS", //$NON-NLS-1$
219 "\"" + oeCMakeCLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
220
221 String oeCMakeCXXLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_LINK_FLAGS"); //$NON-NLS-1$
222 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_LINK_FLAGS", //$NON-NLS-1$
223 "\"" + oeCMakeCXXLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
224
225 toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$
226 toolchainCMakeFileContentAsString += "# only search in the paths provided so cmake doesnt pick\n"; //$NON-NLS-1$
227 toolchainCMakeFileContentAsString += "# up libraries and tools from the native build machine\n"; //$NON-NLS-1$
228
229 String findRootPathValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_HOST"); //$NON-NLS-1$
230 findRootPathValue += " "; //$NON-NLS-1$
231 findRootPathValue += YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_NATIVE"); //$NON-NLS-1$
232 findRootPathValue += " "; //$NON-NLS-1$
233 findRootPathValue += YoctoSDKUtils.getEnvValue(project, "CROSS_DIR"); //$NON-NLS-1$
234 findRootPathValue += " "; //$NON-NLS-1$
235 findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_PERLNATIVE_DIR"); //$NON-NLS-1$
236 findRootPathValue += " "; //$NON-NLS-1$
237 findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_EXTRA_ROOT_PATH"); //$NON-NLS-1$
238 findRootPathValue += " "; //$NON-NLS-1$
239 findRootPathValue += YoctoSDKUtils.getEnvValue(project, "EXTERNAL_TOOLCHAIN"); //$NON-NLS-1$
240 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH", findRootPathValue, null); //$NON-NLS-1$
241
242 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$
243 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$
244 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$
245 toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$
246
247 toolchainCMakeFileContentAsString += "# Use qt.conf settings\n"; //$NON-NLS-1$
248 toolchainCMakeFileContentAsString += createCMakeSetStatement("ENV{QT_CONF_PATH}", "qt.conf", null); //$NON-NLS-1$ //$NON-NLS-2$
249 toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$
250
251 toolchainCMakeFileContentAsString += "# We need to set the rpath to the correct directory as cmake does not provide any\n"; //$NON-NLS-1$
252 toolchainCMakeFileContentAsString += "# directory as rpath by default\n"; //$NON-NLS-1$
253
254 String oeCMakeRPathValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_RPATH"); //$NON-NLS-1$
255 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_INSTALL_RPATH", oeCMakeRPathValue, null); //$NON-NLS-1$
256
257 toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$
258 toolchainCMakeFileContentAsString += "# Use native cmake modules\n"; //$NON-NLS-1$
259
260 String stagingDatadirValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DATADIR"); //$NON-NLS-1$
261 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_MODULE_PATH", //$NON-NLS-1$
262 stagingDatadirValue + "/cmake/Modules/", null); //$NON-NLS-1$
263
264 toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$
265 toolchainCMakeFileContentAsString += "# add for non /usr/lib libdir, e.g. /usr/lib64\n"; //$NON-NLS-1$
266 toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_LIBRARY_PATH", //$NON-NLS-1$
267 "${libdir} ${base_libdir}", null); //$NON-NLS-1$
268
269 InputStream toolchainCMakeFileContent = new ByteArrayInputStream(toolchainCMakeFileContentAsString.getBytes());
270
271 IFile toolchainCMakeFile = project.getFile(TOOLCHAINCMAKE_FILE_NAME);
272 try {
273 if (toolchainCMakeFile.exists()) {
274 toolchainCMakeFile.delete(true, monitor);
275 }
276 toolchainCMakeFile.create(toolchainCMakeFileContent, true, monitor);
277 } catch (CoreException e) {
278 e.printStackTrace();
279 }
280 }
281}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.cmake.managedbuilder;
12
13import java.text.MessageFormat;
14import java.util.MissingResourceException;
15import java.util.ResourceBundle;
16
17public class YoctoCMakeMessages {
18
19 private static final String RESOURCE_BUNDLE= YoctoCMakeMessages.class.getName();
20 private static ResourceBundle fgResourceBundle;
21 static {
22 try {
23 fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
24 } catch (MissingResourceException x) {
25 fgResourceBundle = null;
26 }
27 }
28
29 private YoctoCMakeMessages() {
30 }
31
32 public static String getString(String key) {
33 try {
34 return fgResourceBundle.getString(key);
35 } catch (MissingResourceException e) {
36 return '!' + key + '!';
37 } catch (NullPointerException e) {
38 return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
39 }
40 }
41
42 /**
43 * Gets a string from the resource bundle and formats it with the argument
44 *
45 * @param key the string used to get the bundle value, must not be null
46 */
47 public static String getFormattedString(String key, Object arg) {
48 return MessageFormat.format(getString(key), new Object[] { arg });
49 }
50
51 /**
52 * Gets a string from the resource bundle and formats it with arguments
53 */
54 public static String getFormattedString(String key, Object[] args) {
55 return MessageFormat.format(getString(key), args);
56 }
57}
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 @@
1#/*******************************************************************************
2# * Copyright (c) 2013 BMW Car IT GmbH.
3# * All rights reserved. This program and the accompanying materials
4# * are made available under the terms of the Eclipse Public License v1.0
5# * which accompanies this distribution, and is available at
6# * http://www.eclipse.org/legal/epl-v10.html
7# *
8# * Contributors:
9# * BMW Car IT - initial implementation
10# *******************************************************************************/
11
12# Job
13ExecuteConfigureJob.runConfigure=Running configure
14ExecuteConfigureJob.consoleName=Configure using CMake [{0}]
15ExecuteConfigureJob.buildingMakefile=Building Makefile
16ExecuteConfigureJob.warning.aborted=Build of project has been aborted
17ExecuteConfigureJob.error.couldNotStart=Build of project could not be started
18ExecuteConfigureJob.error.buildFailed=Build of project failed
19ExecuteConfigureJob.cmakeWarning.dialogTitle=Unable to run command "cmake"
20ExecuteConfigureJob.cmakeWarning.dialogMessage=Please make sure that cmake is installed properly on this machine.
21
22# File generator
23YoctoCMakeMakefileGenerator.configureJob.name=Configuring project
24YoctoCMakeMakefileGenerator.configure.creatingMakefiles=Generating Makefiles using CMake
25YoctoCMakeMakefileGenerator.cancel.missingCMakeList=CMakeLists.txt file is missing
26YoctoCMakeMakefileGenerator.creatingBuildDirectory=Creating build directory
27YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed=Makefile generation failed during configuration process
28YoctoCMakeMakefileGenerator.ok.makefilesStillValid=Makefiles are still valid.
29YoctoCMakeMakefileGenerator.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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.cmake.managedbuilder.job;
12
13import java.io.IOException;
14import java.util.Arrays;
15import java.util.HashMap;
16import java.util.LinkedList;
17import java.util.Map;
18
19import org.eclipse.cdt.core.CCorePlugin;
20import org.eclipse.cdt.core.envvar.IContributedEnvironment;
21import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
22import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
23import org.eclipse.cdt.core.model.CoreModel;
24import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
25import org.eclipse.cdt.core.settings.model.ICProjectDescription;
26import org.eclipse.cdt.managedbuilder.core.BuildException;
27import org.eclipse.cdt.managedbuilder.core.IConfiguration;
28import org.eclipse.cdt.managedbuilder.core.ITool;
29import org.eclipse.core.resources.IProject;
30import org.eclipse.core.runtime.IPath;
31import org.eclipse.core.runtime.IProgressMonitor;
32import org.eclipse.core.runtime.IStatus;
33import org.eclipse.core.runtime.Status;
34import org.eclipse.core.runtime.jobs.Job;
35import org.eclipse.jface.dialogs.MessageDialog;
36import org.eclipse.swt.widgets.Display;
37import org.eclipse.ui.console.IOConsoleOutputStream;
38import org.yocto.cmake.managedbuilder.Activator;
39import org.yocto.cmake.managedbuilder.YoctoCMakeMessages;
40import org.yocto.cmake.managedbuilder.util.ConsoleUtility;
41import org.yocto.cmake.managedbuilder.util.SystemProcess;
42
43
44public class ExecuteConfigureJob extends Job {
45 private SystemProcess configureProcess;
46 private LinkedList<String> configureCommand;
47 private IProject project;
48 private IConfiguration configuration;
49 private IPath location;
50
51
52 public ExecuteConfigureJob(String name,
53 IProject project, IConfiguration configuration, IPath location) {
54 super(name);
55 this.project = project;
56 this.configuration = configuration;
57 this.location = location;
58 createCommands();
59 createProcesses();
60 }
61
62 protected void createCommands() {
63 configureCommand = new LinkedList<String>();
64
65 ITool[] configure = configuration
66 .getToolsBySuperClassId("org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe"); //$NON-NLS-1$
67
68 addCommand(configure[0]);
69
70 try {
71 addFlags(configure[0]);
72 } catch (BuildException e) {
73 // ignore this exception
74 }
75 }
76
77 private void addCommand(ITool configure) {
78 String command = configuration.getToolCommand(configure);
79 configureCommand.add(command);
80 }
81
82 private void addFlags(ITool configure) throws BuildException {
83 String[] flags = configure.getToolCommandFlags(
84 project.getLocation(), location);
85 for (String flag : flags) {
86 if (flag.contains(" ")) { //$NON-NLS-1$
87 String[] separatedFlags = flag.trim().split(" "); //$NON-NLS-1$
88 configureCommand.addAll(Arrays.asList(separatedFlags));
89 } else {
90 configureCommand.add(flag);
91 }
92 }
93 }
94
95 protected void createProcesses() {
96 configureProcess =
97 new SystemProcess(configureCommand, location.toFile(), getEnvVariablesAsMap(project));
98 }
99
100 private Map<String,String> getEnvVariablesAsMap (IProject project) {
101 Map<String, String> result = new HashMap<String, String>();
102
103 ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
104 ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration();
105 IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager();
106 IContributedEnvironment env = manager.getContributedEnvironment();
107
108 for(IEnvironmentVariable var : env.getVariables(ccdesc)) {
109 result.put(var.getName(), var.getValue());
110 }
111
112 return result;
113 }
114
115 /* (non-Javadoc)
116 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
117 */
118 @Override
119 protected IStatus run(IProgressMonitor monitor) {
120 monitor.beginTask(
121 YoctoCMakeMessages.getString("ExecuteConfigureJob.runConfigure"), 20); //$NON-NLS-1$
122
123 IOConsoleOutputStream cos =
124 ConsoleUtility.getConsoleOutput(YoctoCMakeMessages.getFormattedString("ExecuteConfigureJob.consoleName", //$NON-NLS-1$
125 project.getName()));
126 monitor.worked(1);
127
128 try {
129 return buildProject(monitor, cos);
130 } catch (IOException e) {
131 if(e.getMessage().startsWith("Cannot run program \"cmake\"")) { //$NON-NLS-1$
132 Display.getDefault().asyncExec(new Runnable() {
133 @Override
134 public void run() {
135 MessageDialog.openWarning(null,
136 YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogTitle"), //$NON-NLS-1$
137 YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogMessage")); //$NON-NLS-1$
138 }
139 });
140 return Status.OK_STATUS;
141 } else {
142 return new Status(Status.ERROR,
143 Activator.PLUGIN_ID, Status.OK,
144 YoctoCMakeMessages.getString("ExecuteConfigureJob.error.couldNotStart"), e); //$NON-NLS-1$
145 }
146 } catch (InterruptedException e) {
147 return new Status(Status.WARNING,
148 Activator.PLUGIN_ID,
149 YoctoCMakeMessages.getString("ExecuteConfigureJob.warning.aborted")); //$NON-NLS-1$
150 } finally {
151 try {
152 cos.close();
153 } catch (IOException e) {
154 cos = null;
155 }
156 }
157 }
158
159 private IStatus buildProject(IProgressMonitor monitor,
160 IOConsoleOutputStream cos) throws IOException, InterruptedException {
161 monitor.subTask(
162 YoctoCMakeMessages.getString("ExecuteConfigureJob.buildingMakefile")); //$NON-NLS-1$
163 configureProcess.start(cos);
164 int exitValue = configureProcess.waitForResultAndStop();
165 monitor.worked(15);
166
167 if (exitValue != 0) {
168 return new Status(Status.ERROR, Activator.PLUGIN_ID,
169 YoctoCMakeMessages.getString("ExecuteConfigureJob.error.buildFailed") + " " + exitValue); //$NON-NLS-1$ //$NON-NLS-2$
170 }
171
172 return Status.OK_STATUS;
173 }
174
175 /* (non-Javadoc)
176 * @see org.eclipse.core.runtime.jobs.Job#canceling()
177 */
178 /**
179 * Cancels the job and interrupts the system process.
180 * {@inheritDoc}
181 */
182 @Override
183 protected void canceling() {
184 configureProcess.interrupt();
185 }
186}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.cmake.managedbuilder.util;
12
13import org.eclipse.ui.console.ConsolePlugin;
14import org.eclipse.ui.console.IConsole;
15import org.eclipse.ui.console.IOConsoleOutputStream;
16import org.eclipse.ui.console.MessageConsole;
17
18
19public class ConsoleUtility {
20
21 public static IOConsoleOutputStream getConsoleOutput(String consoleName) {
22 return getConsole(consoleName).newOutputStream();
23 }
24
25 public static MessageConsole getConsole(String consoleName) {
26 MessageConsole foundConsole = findConsole(consoleName);
27 if (foundConsole != null) {
28 foundConsole.clearConsole();
29 } else {
30 foundConsole = new MessageConsole(consoleName, null);
31 ConsolePlugin.getDefault().
32 getConsoleManager().addConsoles(new IConsole[] { foundConsole });
33 }
34
35 return foundConsole;
36 }
37
38 public static MessageConsole findConsole(String consoleName) {
39 IConsole[] consoles =
40 ConsolePlugin.getDefault().getConsoleManager().getConsoles();
41 for (IConsole console : consoles) {
42 if (console.getName().equals(consoleName)) {
43 return (MessageConsole) console;
44 }
45 }
46
47 return null;
48 }
49}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.cmake.managedbuilder.util;
12
13import java.io.File;
14import java.io.IOException;
15import java.io.InputStream;
16import java.io.OutputStream;
17import java.util.LinkedList;
18import java.util.Map;
19
20public class SystemProcess {
21
22 private LinkedList<String> command = new LinkedList<String>();
23 private File workingDirectory;
24 private ProcessBuilder builder;
25 private Process process;
26 private StreamPipe outputRedirector;
27
28 public SystemProcess(LinkedList<String> command) {
29 this(command, null);
30 }
31
32 public SystemProcess(LinkedList<String> command, File directory) {
33 this(command, directory, null);
34 }
35
36 public SystemProcess(LinkedList<String> command, File directory, Map<String, String> additionalEnvironmentVariables) {
37 super();
38 this.command = command;
39 if (directory != null) {
40 this.workingDirectory = directory;
41 }
42 setUpProcessBuilder(additionalEnvironmentVariables);
43 }
44
45 private void setUpProcessBuilder(Map<String, String> additionalEnvironmentVariables) {
46 builder = new ProcessBuilder(command);
47 if (workingDirectory != null) {
48 builder.directory(workingDirectory);
49 }
50 builder.redirectErrorStream(true);
51
52 if(additionalEnvironmentVariables != null && !additionalEnvironmentVariables.isEmpty()) {
53 builder.environment().putAll(additionalEnvironmentVariables);
54 }
55 }
56
57 public void start(OutputStream out) throws IOException {
58 if (builder != null) {
59 process = builder.start();
60 outputRedirector = redirectOutput(process, out);
61 }
62 }
63
64 public int waitForResultAndStop() throws InterruptedException {
65 if (process == null) {
66 return -1;
67 }
68
69 process.waitFor();
70 outputRedirector.interrupt();
71
72 return process.exitValue();
73 }
74
75 public void interrupt() {
76 process.destroy();
77 }
78
79 private StreamPipe redirectOutput(Process process, OutputStream out) {
80 InputStream in = process.getInputStream();
81 StreamPipe stdoutPipe = new StreamPipe(in, out);
82 stdoutPipe.start();
83
84 return stdoutPipe;
85 }
86
87
88 private class StreamPipe extends Thread {
89 private InputStream in;
90 private OutputStream out;
91 boolean shutdown = false;
92
93 public StreamPipe(InputStream in, OutputStream out) {
94 this.in = in;
95 this.out = out;
96 }
97
98 @Override
99 public void run() {
100 byte[] buffer = new byte[1024];
101 int length = 0;
102
103 try {
104 while(!shutdown && ((length = in.read(buffer)) > -1)) {
105 out.write(buffer, 0, length);
106 }
107 } catch (IOException e) {
108 e.printStackTrace();
109 }
110 }
111
112 @Override
113 public void interrupt() {
114 shutdown = true;
115 super.interrupt();
116 }
117 }
118}
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 @@
1cmake_minimum_required (VERSION 2.8.1)
2
3######## Project settings ########
4PROJECT($(projectName))
5SET(LICENSE "TBD")
6
7######## Build and include settings ########
8include_directories(
9 inc
10)
11
12link_directories(
13 ${LINK_DIRECTORIES}
14)
15
16
17file(GLOB SOURCES
18 "src/*.c"
19)
20
21add_executable(
22 $(projectName)
23
24 ${SOURCES}
25)
26
27TARGET_LINK_LIBRARIES(
28 $(projectName)
29)
30
31######## Install targets ########
32INSTALL(TARGETS $(projectName)
33 RUNTIME DESTINATION usr/bin
34)
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 @@
1/** @mainpage $(projectName) - $(vendor)
2 *
3 * @author $(author) <$(email)>
4 * @version $(projectVersion)
5**/
6
7
8#include <stdio.h>
9/**
10 * Main class of project $(projectName)
11 *
12 * @param argc the number of arguments
13 * @param argv the arguments from the commandline
14 * @returns exit code of the application
15 */
16int main(int argc, char **argv) {
17 // print a greeting to the console
18 printf("Hello World!\n");
19
20 return 0;
21}
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 @@
1#/*******************************************************************************
2# * Copyright (c) 2013 BMW Car IT GmbH.
3# * All rights reserved. This program and the accompanying materials
4# * are made available under the terms of the Eclipse Public License v1.0
5# * which accompanies this distribution, and is available at
6# * http://www.eclipse.org/legal/epl-v10.html
7# *
8# * Contributors:
9# * BMW Car IT - initial implementation
10# *******************************************************************************/
11
12# Template
13template.vendor=Yocto Project
14template.name=Hello World C CMake Project
15template.description=A simple C hello world project based on CMake
16
17# General Settings
18general.name=General settings
19general.description=Author properties of the project
20general.author.name=Author
21general.author.description=The author of the project
22general.author.default=anonymous
23general.email.name=Email address
24general.email.description=The email address of the project's author
25general.email.default=anony@mo.us
26general.vendor.name=Vendor
27general.vendor.description=The vendor of the project
28general.vendor.default=None
29general.projectVersion.name=Version
30general.projectVersion.description=The version of the project
31general.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 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<template type="ProjTempl"
3 version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov"
4 id="org.yocto.cmake.template.exe.helloWorldCCMakeProject" label="%template.name"
5 description="%template.description">
6
7 <property-group id="general_settings" label="%general.name"
8 description="%general.description" type="PAGES-ONLY">
9 <property id="author" label="%general.author.name" description="%general.author.description"
10 default="%general.author.default" type="input" hidden="false" mandatory="false"
11 persist="true" />
12
13 <property id="email" label="%general.email.name"
14 description="%general.email.description" default="%general.email.default"
15 type="input" hidden="false" mandatory="false" persist="true" />
16
17 <property id="vendor" label="%general.vendor.name"
18 description="%general.vendor.description" default="%general.vendor.default"
19 type="input" hidden="false" mandatory="false" persist="true" />
20
21 <property id="projectVersion" label="%general.projectVersion.name"
22 description="%general.projectVersion.description" checkproject="false"
23 default="%general.projectVersion.default" type="input"
24 pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" />
25 </property-group>
26
27 <process type="org.yocto.sdk.ide.NewYoctoProject">
28 <simple name="name" value="$(projectName)" />
29 <simple name="artifactExtension" value="exe" />
30 <simple name="isCProject" value="true" />
31 <simple name="isEmptyProject" value="false" />
32 <simple name="isAutotoolsProject" value="false" />
33 <simple name="isCMakeProject" value="true" />
34 </process>
35
36 <process type="org.eclipse.cdt.core.CreateSourceFolder">
37 <simple name="projectName" value="$(projectName)" />
38 <simple name="path" value="src" />
39 </process>
40
41 <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder">
42 <simple name="projectName" value="$(projectName)" />
43 <simple name="path" value="inc" />
44 </process>
45
46 <process type="org.eclipse.cdt.core.AddFiles">
47 <simple name="projectName" value="$(projectName)" />
48 <complex-array name="files">
49 <element>
50 <simple name="source" value="src/main.c" />
51 <simple name="target" value="src/main.c" />
52 <simple name="replaceable" value="true" />
53 </element>
54 <element>
55 <simple name="source" value="src/CMakeLists.txt" />
56 <simple name="target" value="CMakeLists.txt" />
57 <simple name="replaceable" value="true" />
58 </element>
59 </complex-array>
60 </process>
61</template>
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 @@
1cmake_minimum_required (VERSION 2.8.1)
2
3######## Project settings ########
4PROJECT($(projectName))
5SET(LICENSE "TBD")
6
7######## Build and include settings ########
8include_directories(
9 inc
10)
11
12link_directories(
13 ${LINK_DIRECTORIES}
14)
15
16
17file(GLOB SOURCES
18 "src/*.cpp"
19)
20
21add_executable(
22 $(projectName)
23
24 ${SOURCES}
25)
26
27TARGET_LINK_LIBRARIES(
28 $(projectName)
29)
30
31######## Install targets ########
32INSTALL(TARGETS $(projectName)
33 RUNTIME DESTINATION usr/bin
34)
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 @@
1/** @mainpage $(projectName) - $(vendor)
2 *
3 * @author $(author) <$(email)>
4 * @version $(projectVersion)
5**/
6
7
8#include <stdio.h>
9/**
10 * Main class of project $(projectName)
11 *
12 * @param argc the number of arguments
13 * @param argv the arguments from the commandline
14 * @returns exit code of the application
15 */
16int main(int argc, char **argv) {
17 // print a greeting to the console
18 printf("Hello World!\n");
19
20 return 0;
21}
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 @@
1#/*******************************************************************************
2# * Copyright (c) 2013 BMW Car IT GmbH.
3# * All rights reserved. This program and the accompanying materials
4# * are made available under the terms of the Eclipse Public License v1.0
5# * which accompanies this distribution, and is available at
6# * http://www.eclipse.org/legal/epl-v10.html
7# *
8# * Contributors:
9# * BMW Car IT - initial implementation
10# *******************************************************************************/
11
12# Template
13template.vendor=Yocto Project
14template.name=Hello World C++ CMake Project
15template.description=A simple C++ hello world project based on CMake
16
17# General Settings
18general.name=General settings
19general.description=Author properties of the project
20general.author.name=Author
21general.author.description=The author of the project
22general.author.default=anonymous
23general.email.name=Email address
24general.email.description=The email address of the project's author
25general.email.default=anony@mo.us
26general.vendor.name=Vendor
27general.vendor.description=The vendor of the project
28general.vendor.default=None
29general.projectVersion.name=Version
30general.projectVersion.description=The version of the project
31general.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 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<template type="ProjTempl"
3 version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov"
4 id="org.yocto.cmake.template.exe.helloWorldCPPCMakeProject" label="%template.name"
5 description="%template.description">
6
7 <property-group id="general_settings" label="%general.name"
8 description="%general.description" type="PAGES-ONLY">
9 <property id="author" label="%general.author.name" description="%general.author.description"
10 default="%general.author.default" type="input" hidden="false" mandatory="false"
11 persist="true" />
12
13 <property id="email" label="%general.email.name"
14 description="%general.email.description" default="%general.email.default"
15 type="input" hidden="false" mandatory="false" persist="true" />
16
17 <property id="vendor" label="%general.vendor.name"
18 description="%general.vendor.description" default="%general.vendor.default"
19 type="input" hidden="false" mandatory="false" persist="true" />
20
21 <property id="projectVersion" label="%general.projectVersion.name"
22 description="%general.projectVersion.description" checkproject="false"
23 default="%general.projectVersion.default" type="input"
24 pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" />
25 </property-group>
26
27 <process type="org.yocto.sdk.ide.NewYoctoProject">
28 <simple name="name" value="$(projectName)" />
29 <simple name="artifactExtension" value="exe" />
30 <simple name="isCProject" value="false" />
31 <simple name="isEmptyProject" value="false" />
32 <simple name="isAutotoolsProject" value="false" />
33 <simple name="isCMakeProject" value="true" />
34 </process>
35
36 <process type="org.eclipse.cdt.core.CreateSourceFolder">
37 <simple name="projectName" value="$(projectName)" />
38 <simple name="path" value="src" />
39 </process>
40
41 <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder">
42 <simple name="projectName" value="$(projectName)" />
43 <simple name="path" value="inc" />
44 </process>
45
46 <process type="org.eclipse.cdt.core.AddFiles">
47 <simple name="projectName" value="$(projectName)" />
48 <complex-array name="files">
49 <element>
50 <simple name="source" value="src/main.cpp" />
51 <simple name="target" value="src/main.cpp" />
52 <simple name="replaceable" value="true" />
53 </element>
54 <element>
55 <simple name="source" value="src/CMakeLists.txt" />
56 <simple name="target" value="CMakeLists.txt" />
57 <simple name="replaceable" value="true" />
58 </element>
59 </complex-array>
60 </process>
61</template>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 <classpathentry kind="output" path="bin"/>
6</classpath>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.doc.user</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.jdt.core.javabuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.pde.ManifestBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.pde.SchemaBuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 </buildSpec>
24 <natures>
25 <nature>org.eclipse.pde.PluginNature</nature>
26 <nature>org.eclipse.jdt.core.javanature</nature>
27 </natures>
28</projectDescription>
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 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: %Bundle-Name
4Bundle-SymbolicName: org.yocto.doc.user;singleton:=true
5Bundle-Version: 1.4.0.qualifier
6Bundle-Vendor: %Bundle-Vendor
7Bundle-RequiredExecutionEnvironment: JavaSE-1.6
8Require-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 @@
1#Properties file for org.yocto.doc.user
2Bundle-Vendor = yoctoproject.org
3Bundle-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 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6<title>About</title>
7</head>
8<body lang="EN-US">
9 <h2>About This Content</h2>
10
11 <p>
12 <em>December, 2012</em>
13 </p>
14 <h3>License</h3>
15
16 <p>
17 Copyright (c) 2010 Intel, Inc. and others.
18 All rights reserved. This program and the accompanying materials
19 are made available under the terms of the Eclipse Public License v1.0
20 which accompanies this distribution, and is available at <br />
21 <a href="http://www.eclipse.org/legal/epl-v10.html">
22 http://www.eclipse.org/legal/epl-v10.html
23 </a>
24 </p>
25
26 <h3>Third Party Content</h3>
27 <p>The Content includes items that have been sourced from the Yocto project
28 as set out below. If you did not receive this Content directly
29 from the Linux Foundation, the following is provided for
30 informational purposes only, and you should look to the
31 Redistributor's license for terms and conditions of use.</p>
32 <p>
33 <strong>
34 Yocto Project Quick Start
35 </strong>
36 <br />
37 <br />
38 This short document lets you get started with the Yocto Project
39 quickly and start building an image.
40 <br />
41 <br />
42 <em>License:</em>
43 <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode">
44 http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode
45 </a>
46 <br />
47 <em>Source Code Repository:</em>
48 <a href="git://git.yoctoproject.org/yocto-docs">
49 git://git.yoctoproject.org/yocto-docs
50 </a>
51 <br />
52 <em>Commit:</em> @COMMIT_ID-yocto-project-qs@
53 <br />
54 <br />
55 <strong>
56 Yocto Project Application Developer's Guide:
57 </strong>
58 <br />
59 <br />
60 This manual shows you how to setup and use the Application Development
61 Toolkit (ADT) and stand-alone cross-development toolchains so you can
62 develop user-space applications.
63 <br />
64 <br />
65 <em>License:</em>
66 <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode">
67 http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode
68 </a>
69 <br />
70 <em>Source Code Repository:</em>
71 <a href="git://git.yoctoproject.org/yocto-docs">
72 git://git.yoctoproject.org/yocto-docs
73 </a>
74 <br />
75 <em>Commit:</em> @COMMIT_ID-adt-manual@
76 <br />
77 <br />
78 <strong>
79 Yocto Project Development Manual:
80 </strong>
81 <br />
82 <br />
83 This manual describes how to use the Yocto Project to develop
84 embedded Linux images and user-space applications to run on
85 targeted devices.
86 <br />
87 <br />
88 <em>License:</em>
89 <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode">
90 http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode
91 </a>
92 <br />
93 <em>Source Code Repository:</em>
94 <a href="git://git.yoctoproject.org/yocto-docs">
95 git://git.yoctoproject.org/yocto-docs
96 </a>
97 <br />
98 <em>Commit:</em> @COMMIT_ID-dev-manual@
99 <br />
100 <br />
101 <strong>
102 Yocto Project Reference Manual:
103 </strong>
104 <br />
105 <br />
106 This manual is the complete reference guide to the Poky component.
107 It also contains a chapter on Board Support Package (BSP) development.
108 <br />
109 <br />
110 <em>License:</em>
111 <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode">
112 http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode
113 </a>
114 <br />
115 <em>Source Code Repository:</em>
116 <a href="git://git.yoctoproject.org/yocto-docs">
117 git://git.yoctoproject.org/yocto-docs
118 </a>
119 <br />
120 <em>Commit:</em> @COMMIT_ID-ref-manual@
121 <br />
122 <br />
123 <strong>
124 Yocto Project Board Support Package (BSP) Developer's Guide:
125 </strong>
126 <br />
127 <br />
128 This brief document defines a structure for BSP components.
129 Having a commonly understood layout encourages standardization.
130 <br />
131 <br />
132 <em>License:</em>
133 <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode">
134 http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode
135 </a>
136 <br />
137 <em>Source Code Repository:</em>
138 <a href="git://git.yoctoproject.org/yocto-docs">
139 git://git.yoctoproject.org/yocto-docs
140 </a>
141 <br />
142 <em>Commit:</em> @COMMIT_ID-bsp-guide@
143 <br />
144 <br />
145 <strong>
146 Yocto Project Linux Kernel Development Manual:
147 </strong>
148 <br />
149 <br />
150 This document describes the architecture of the Yocto Project
151 kernel and provides some work flow examples.
152 <br />
153 <br />
154 <em>License:</em>
155 <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode">
156 http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode
157 </a>
158 <br />
159 <em>Source Code Repository:</em>
160 <a href="git://git.yoctoproject.org/yocto-docs">
161 git://git.yoctoproject.org/yocto-docs
162 </a>
163 <br />
164 <em>Commit:</em> @COMMIT_ID-kernel-dev@
165 <br />
166 <br />
167 <strong>
168 Yocto Project Profiling and Tracing Manual:
169 </strong>
170 <br />
171 <br />
172 This manual presents a set of common and generally useful
173 tracing and profiling schemes along with their application
174 (as appropriate) to each tool.
175 <br />
176 <br />
177 <em>License:</em>
178 <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode">
179 http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode
180 </a>
181 <br />
182 <em>Source Code Repository:</em>
183 <a href="git://git.yoctoproject.org/yocto-docs">
184 git://git.yoctoproject.org/yocto-docs
185 </a>
186 <br />
187 <em>Commit:</em> @COMMIT_ID-profile-manual@
188 </p>
189</body>
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 @@
1bin.includes = plugin.xml,\
2 .,\
3 META-INF/,\
4 OSGI-INF/,\
5 html/,\
6 toc.xml,\
7 about.html
8src.includes = html/,\
9 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<?eclipse version="3.4"?>
3<plugin>
4 <extension
5 point="org.eclipse.help.toc">
6 <toc
7 file="toc.xml"
8 primary="true">
9 </toc>
10 <toc
11 file="html/adt-manual-toc.xml"
12 primary="false">
13 </toc>
14 <toc
15 file="html/yocto-project-qs-toc.xml"
16 primary="false">
17 </toc>
18 <toc
19 file="html/dev-manual-toc.xml"
20 primary="false">
21 </toc>
22 <toc
23 file="html/ref-manual-toc.xml"
24 primary="false">
25 </toc>
26 <toc
27 file="html/bsp-guide-toc.xml"
28 primary="false">
29 </toc>
30 <toc
31 file="html/kernel-dev-toc.xml"
32 primary="false">
33 </toc>
34 <toc
35 file="html/profile-manual-toc.xml"
36 primary="false">
37 </toc>
38 </extension>
39</plugin>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2 <toc label="Yocto Project Documentation">
3 <topic label="Yocto Project Quick Start">
4 <link toc="html/yocto-project-qs-toc.xml"/>
5 </topic>
6 <topic label="Yocto·Project·Application·Developer&apos;s·Guide">
7 <link toc="html/adt-manual-toc.xml"/>
8 </topic>
9 <topic label="Yocto Project Development Manual">
10 <link toc="html/dev-manual-toc.xml"/>
11 </topic>
12 <topic label="Yocto Project Reference Manual">
13 <link toc="html/ref-manual-toc.xml"/>
14 </topic>
15 <topic label="Yocto Project Board Support Package Developer&apos;s Guide">
16 <link toc="html/bsp-guide-toc.xml"/>
17 </topic>
18 <topic label="Yocto Project Linux Kernel Development Manual">
19 <link toc="html/kernel-dev-toc.xml"/>
20 </topic>
21 <topic label="Yocto Project Tracing and Profiling Manual">
22 <link toc="html/profile-manual-toc.xml"/>
23 </topic>
24 </toc>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 <classpathentry kind="src" path="src"/>
6 <classpathentry kind="output" path="bin"/>
7</classpath>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.remote.utils</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.jdt.core.javabuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.pde.ManifestBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.pde.SchemaBuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 </buildSpec>
24 <natures>
25 <nature>org.eclipse.pde.PluginNature</nature>
26 <nature>org.eclipse.jdt.core.javanature</nature>
27 </natures>
28</projectDescription>
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 @@
1eclipse.preferences.version=1
2org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4org.eclipse.jdt.core.compiler.compliance=1.6
5org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7org.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 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: Utils
4Bundle-SymbolicName: org.yocto.remote.utils
5Bundle-Version: 1.0.0.qualifier
6Bundle-Activator: org.yocto.remote.utils.Activator
7Require-Bundle: org.eclipse.ui,
8 org.eclipse.core.runtime
9Bundle-ActivationPolicy: lazy
10Bundle-RequiredExecutionEnvironment: JavaSE-1.6
11Import-Package: org.eclipse.rse.core,
12 org.eclipse.rse.core.model,
13 org.eclipse.rse.core.subsystems,
14 org.eclipse.rse.internal.terminals.ui,
15 org.eclipse.rse.internal.terminals.ui.views,
16 org.eclipse.rse.services,
17 org.eclipse.rse.services.files,
18 org.eclipse.rse.services.shells,
19 org.eclipse.rse.services.terminals,
20 org.eclipse.rse.subsystems.files.core.servicesubsystem,
21 org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem,
22 org.eclipse.rse.subsystems.terminals.core,
23 org.eclipse.rse.subsystems.terminals.core.elements,
24 org.eclipse.rse.ui,
25 org.eclipse.tm.internal.terminal.control,
26 org.eclipse.tm.internal.terminal.provisional.api
27Export-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 @@
1source.. = src/
2output.. = bin/
3bin.includes = META-INF/,\
4 resources/,\
5 .
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 @@
1#!/bin/sh
2
3#set PATH to include sbin dirs
4export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
5
6if [ ! -d "$@" ] || [ -z "$@" ]; then
7 exit 1
8fi
9
10DATESTRING="$(date +%Y%m%d%H%M%S%N)"
11BASENAME=`basename $@`
12DATAFILE=/tmp/${BASENAME}-${DATESTRING}.tar
13cd $@
14cd ..
15
16tar -cf ${DATAFILE} ${BASENAME} &> /dev/null || exit $?
17
18echo -e "ustfile:$DATAFILE\n"
19
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 @@
1#!/bin/sh
2
3help ()
4{
5 echo "Usage $0 command [options] application [application argument]"
6 echo "command:"
7 echo " start - start an application"
8 echo " stop - stop an application"
9 echo " restart - restart an application"
10 echo ""
11 echo "options: -d | -l <log file>"
12 echo " -d - start an application as a singleton daemon"
13 echo " -l <log file name> - redirect the standard output/error in the the file"
14 echo " note: Option -d and -l are exclusive to each other"
15 exit 1
16}
17
18killproc() { # kill the named process(es)
19 pid=`/bin/pidof $1`
20 [ "x$pid" != "x" ] && kill $pid
21}
22
23start ()
24{
25 pid=`/bin/pidof $APP`
26 [ "x$pid" != "x" ] && return 0
27
28 if [ "x$DAEMON" != "x" ]; then
29 if [ "x$APPARG" != "x" ]; then
30 start-stop-daemon -S -b --oknodo -x $APP -- $APPARG
31 else
32 start-stop-daemon -S -b --oknodo -x $APP
33 fi
34
35 #wait for sometime for the backend app to bring up & daemonzie
36 ret=$?
37 if [ $ret -eq 0 ]; then
38 sleep 1
39 fi
40 return $ret
41 elif [ "x$LOGFILE" != "x" ]; then
42 $APP $APPARG $>${LOGFILE}
43 else
44 $APP $APPARG
45 fi
46}
47
48stop ()
49{
50 if [ "x$DAEMON" != "x" ]; then
51 start-stop-daemon -K -x $APP
52 else
53 count=0
54 while [ -n "`/bin/pidof $APP`" -a $count -lt 10 ] ; do
55 killproc $APP >& /dev/null
56 sleep 1
57 RETVAL=$?
58 if [ $RETVAL != 0 -o -n "`/bin/pidof $APP`" ] ; then
59 sleep 3
60 fi
61 count=`expr $count + 1`
62 done
63 fi
64}
65
66restart ()
67{
68 stop
69 sleep 1
70 start
71}
72
73#set PATH to include sbin dirs
74export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
75
76#get command
77case $1 in
78start) CMD=$1; shift 1
79 ;;
80stop) CMD=$1; shift 1
81 ;;
82*) help
83 ;;
84esac
85
86#get options
87while [ $# -gt 0 ]; do
88 case $1 in
89 -d) DAEMON=true; shift 1
90 ;;
91 -l) LOGFILE=$2; shift 2
92 ;;
93 *) break
94 ;;
95 esac
96done
97
98#get application
99APP=$1
100shift 1
101
102#get app argument
103APPARG="$@"
104
105#validate options
106if [ "x$DAEMON" != "x" -a "x$LOGFILE" != "x" ]; then
107 help
108fi
109if [ "x$DAEMON" != "x" ]; then
110 APP=`which $APP`
111fi
112if [ "x$APP" == "x" ]; then
113 help
114fi
115
116#run script
117case $CMD in
118start) start
119 ;;
120stop) stop
121 ;;
122restart)
123 restart
124 ;;
125esac
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 @@
1#!/bin/sh
2
3#set PATH to include sbin dirs
4export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
5
6DATESTRING="$(date +%Y%m%d%H%M%S%N)"
7TEMPFILE="/tmp/yocto-ust-tmp-$DATESTRING"
8
9rm -f ${TEMPFILE}
10usttrace $@ &> ${TEMPFILE}
11ret=$?
12
13if [ $ret -ne 0 ]; then
14 cat $TEMPFILE
15 rm -f $TEMPFILE
16 exit $ret
17fi
18
19#search for output dir
20USTDIR=`cat ${TEMPFILE} | awk '/^Trace was output in:/ { print $5}'`
21rm -f ${TEMPFILE}
22
23if [ -z "$USTDIR" ]; then
24 exit 1
25fi
26
27BASENAME=`basename $USTDIR`
28DATAFILE=/tmp/${BASENAME}.tar
29cd $USTDIR
30cd ..
31
32tar -cf ${DATAFILE} ${BASENAME} &> /dev/null || exit $?
33
34echo -e "ustfile:$DATAFILE\n"
35
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.remote.utils;
12
13import org.eclipse.ui.plugin.AbstractUIPlugin;
14import org.osgi.framework.BundleContext;
15
16/**
17 * The activator class controls the plug-in life cycle
18 */
19public class Activator extends AbstractUIPlugin {
20
21 // The plug-in ID
22 public static final String PLUGIN_ID = "org.yocto.remote.utils"; //$NON-NLS-1$
23
24 // The shared instance
25 private static Activator plugin;
26
27 /**
28 * The constructor
29 */
30 public Activator() {
31 }
32
33 /*
34 * (non-Javadoc)
35 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
36 */
37 @Override
38 public void start(BundleContext context) throws Exception {
39 super.start(context);
40 plugin = this;
41 }
42
43 /*
44 * (non-Javadoc)
45 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
46 */
47 @Override
48 public void stop(BundleContext context) throws Exception {
49 plugin = null;
50 super.stop(context);
51 }
52
53 /**
54 * Returns the shared instance
55 *
56 * @return the shared instance
57 */
58 public static Activator getDefault() {
59 return plugin;
60 }
61
62}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.remote.utils;
12
13import org.eclipse.core.runtime.IStatus;
14import org.eclipse.core.runtime.Status;
15import org.eclipse.jface.dialogs.ErrorDialog;
16import org.eclipse.swt.widgets.Display;
17
18public class CommonHelper {
19
20 static public boolean isExecAvail(String exec) {
21 boolean ret = false;
22 try {
23 Process p = Runtime.getRuntime().exec(new String[] {"which", exec});
24 p.waitFor();
25 if(p.exitValue() == 0) {
26 ret = true;
27 }
28 } catch (Exception e) {
29 e.printStackTrace();
30 }
31 return ret;
32 }
33
34 public static void showErrorDialog(final String dialogTitle, final String errorMessage, final String reason) {
35 //needs to be run in the ui thread otherwise swt throws invalid thread access
36 Display.getDefault().syncExec(new Runnable() {
37 @Override
38 public void run() {
39 ErrorDialog.openError(null, dialogTitle, errorMessage,
40 new Status(IStatus.ERROR,Activator.PLUGIN_ID,reason));
41 }
42 });
43
44 }
45
46}
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 @@
1package org.yocto.remote.utils;
2
3import org.eclipse.jface.dialogs.MessageDialog;
4
5public class DialogRunnable implements Runnable{
6 int type = 0;
7 boolean result;
8 public static final int QUESTION = 1;
9 public static final int ERROR = 2;
10 String title;
11 String message;
12
13 DialogRunnable(String title, String message, int type){
14 this.title = title;
15 this.message = message;
16 this.type = type;
17 }
18 @Override
19 public void run() {
20 if (type == QUESTION) {
21 result = MessageDialog.openQuestion(null, title, message);
22 } else if (type == ERROR) {
23 MessageDialog.openError(null, title, message);
24 }
25 }
26} \ 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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.remote.utils;
12
13import org.eclipse.osgi.util.NLS;
14
15public class Messages extends NLS {
16
17 private static final String BUNDLE_NAME = "org.yocto.remote.utils.messages"; //$NON-NLS-1$
18
19 public static String ErrorNoSubsystem;
20 public static String ErrorConnectSubsystem;
21
22 public static String InfoDownload;
23 public static String InfoUpload;
24
25 public static String RemoteShellExec_1;
26 public static String RemoteShellExec_2;
27
28 static {
29 // initialize resource bundle
30 NLS.initializeMessages(BUNDLE_NAME, Messages.class);
31 }
32
33 private Messages() {
34 }
35}
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 @@
1/********************************************************************************
2 * Copyright (c) 2013 MontaVista Software, Inc and Others.
3 * This program and the accompanying materials are made available under the terms
4 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
5 * available at http://www.eclipse.org/legal/epl-v10.html
6 *
7 * Contributors:
8 * Anna Dushistova (MontaVista) - initial API and implementation
9 * Lianhao Lu (Intel) - Modified to add other file operations.
10 * Ioana Grigoropol (Intel) - Separated remote functionality
11 ********************************************************************************/
12package org.yocto.remote.utils;
13
14import java.io.BufferedInputStream;
15import java.io.BufferedOutputStream;
16import java.io.File;
17import java.io.FileOutputStream;
18import java.io.InputStream;
19import java.util.ArrayList;
20import java.util.Arrays;
21import java.util.Iterator;
22
23import org.eclipse.core.runtime.CoreException;
24import org.eclipse.core.runtime.FileLocator;
25import org.eclipse.core.runtime.IProgressMonitor;
26import org.eclipse.core.runtime.IStatus;
27import org.eclipse.core.runtime.MultiStatus;
28import org.eclipse.core.runtime.OperationCanceledException;
29import org.eclipse.core.runtime.Path;
30import org.eclipse.core.runtime.Status;
31import org.eclipse.core.runtime.SubProgressMonitor;
32import org.eclipse.osgi.util.NLS;
33import org.eclipse.rse.core.IRSECoreStatusCodes;
34import org.eclipse.rse.core.IRSESystemType;
35import org.eclipse.rse.core.RSECorePlugin;
36import org.eclipse.rse.core.model.IHost;
37import org.eclipse.rse.core.model.ISubSystemConfigurationCategories;
38import org.eclipse.rse.core.model.ISystemRegistry;
39import org.eclipse.rse.core.subsystems.ISubSystem;
40import org.eclipse.rse.services.IService;
41import org.eclipse.rse.services.files.IFileService;
42import org.eclipse.rse.services.shells.HostShellProcessAdapter;
43import org.eclipse.rse.services.shells.IHostShell;
44import org.eclipse.rse.services.shells.IShellService;
45import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
46import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem;
47import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
48
49public class RSEHelper {
50 private final static String EXIT_CMD = "exit"; //$NON-NLS-1$
51 private final static String CMD_DELIMITER = ";"; //$NON-NLS-1$
52
53 public static IHost getRemoteConnectionByName(String remoteConnection) {
54 if (remoteConnection == null)
55 return null;
56 IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHosts();
57 for (int i = 0; i < connections.length; i++)
58 if (connections[i].getAliasName().equals(remoteConnection))
59 return connections[i];
60 return null; // TODO Connection is not found in the list--need to react
61 // somehow, throw the exception?
62
63 }
64
65 public static IService getConnectedRemoteFileService(
66 IHost currentConnection, IProgressMonitor monitor) throws Exception {
67 final ISubSystem subsystem = getFileSubsystem(currentConnection);
68
69 if (subsystem == null)
70 throw new Exception(Messages.ErrorNoSubsystem);
71
72 try {
73 subsystem.connect(monitor, false);
74 } catch (CoreException e) {
75 throw e;
76 } catch (OperationCanceledException e) {
77 throw new CoreException(Status.CANCEL_STATUS);
78 }
79
80 if (!subsystem.isConnected())
81 throw new Exception(Messages.ErrorConnectSubsystem);
82
83 return ((IFileServiceSubSystem) subsystem).getFileService();
84 }
85
86 public static ISubSystem getFileSubsystem(IHost host) {
87 if (host == null)
88 return null;
89 ISubSystem[] subSystems = host.getSubSystems();
90 for (int i = 0; i < subSystems.length; i++) {
91 if (subSystems[i] instanceof IFileServiceSubSystem)
92 return subSystems[i];
93 }
94 return null;
95 }
96
97 public static IService getConnectedShellService(
98 IHost currentConnection, IProgressMonitor monitor) throws Exception {
99 final ISubSystem subsystem = getShellSubsystem(currentConnection);
100
101 if (subsystem == null)
102 throw new Exception(Messages.ErrorNoSubsystem);
103
104 try {
105 subsystem.connect(monitor, false);
106 } catch (CoreException e) {
107 throw e;
108 } catch (OperationCanceledException e) {
109 throw new CoreException(Status.CANCEL_STATUS);
110 }
111
112 if (!subsystem.isConnected())
113 throw new Exception(Messages.ErrorConnectSubsystem);
114
115 return ((IShellServiceSubSystem) subsystem).getShellService();
116 }
117
118 public static ISubSystem getShellSubsystem(IHost host) {
119 if (host == null)
120 return null;
121 ISubSystem[] subSystems = host.getSubSystems();
122 for (int i = 0; i < subSystems.length; i++) {
123 if (subSystems[i] instanceof IShellServiceSubSystem)
124 return subSystems[i];
125 }
126 return null;
127 }
128
129 public static IHost[] getSuitableConnections() {
130
131 //we only get RSE connections with files&cmds subsystem
132 ArrayList <IHost> filConnections = new ArrayList <IHost>(Arrays.asList(RSECorePlugin.getTheSystemRegistry()
133 .getHostsBySubSystemConfigurationCategory(ISubSystemConfigurationCategories.SUBSYSTEM_CATEGORY_FILES))); //$NON-NLS-1$
134
135 ArrayList <IHost> terminalConnections = new ArrayList <IHost>(Arrays.asList(RSECorePlugin.getTheSystemRegistry()
136 .getHostsBySubSystemConfigurationCategory("terminal")));//$NON-NLS-1$
137
138 ArrayList <IHost> shellConnections = new ArrayList <IHost>(Arrays.asList(RSECorePlugin.getTheSystemRegistry()
139 .getHostsBySubSystemConfigurationCategory("shells"))); //$NON-NLS-1$
140
141 Iterator <IHost>iter = filConnections.iterator();
142 while(iter.hasNext()){
143 IHost fileConnection = iter.next();
144 if(!terminalConnections.contains(fileConnection) && !shellConnections.contains(fileConnection)){
145 iter.remove();
146 }
147 IRSESystemType sysType = fileConnection.getSystemType();
148 if (sysType == null || !sysType.isEnabled()) {
149 iter.remove();
150 }
151 }
152
153 return filConnections.toArray(new IHost[filConnections.size()]);
154 }
155
156 public static void putRemoteFileInPlugin(IHost connection, String locaPathInPlugin, String remoteExePath,
157 IProgressMonitor monitor) throws Exception {
158
159 assert(connection != null);
160 monitor.beginTask(Messages.InfoUpload, 100);
161
162 IFileService fileService;
163 try {
164 fileService = (IFileService) getConnectedRemoteFileService(
165 connection,
166 new SubProgressMonitor(monitor, 5));
167 InputStream inputStream = FileLocator.openStream(
168 Activator.getDefault().getBundle(), new Path(locaPathInPlugin), false);
169 Path remotePath = new Path(remoteExePath);
170
171 //TODO workaround for now
172 //in case the underlying scp file service doesn't support inputStream upload
173 BufferedInputStream bis = new BufferedInputStream(inputStream);
174 File tempFile = File.createTempFile("scp", "temp"); //$NON-NLS-1$ //$NON-NLS-2$
175 FileOutputStream os = new FileOutputStream(tempFile);
176 BufferedOutputStream bos = new BufferedOutputStream(os);
177 byte[] buffer = new byte[1024];
178 int readCount;
179 while( (readCount = bis.read(buffer)) > 0)
180 {
181 bos.write(buffer, 0, readCount);
182 }
183 bos.close();
184 fileService.upload(tempFile, remotePath.removeLastSegments(1)
185 .toString(), remotePath.lastSegment(), true, null, null,
186 new SubProgressMonitor(monitor, 80));
187 // Need to change the permissions to match the original file
188 // permissions because of a bug in upload
189 remoteShellExec(
190 connection,
191 "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
192
193 } finally {
194 monitor.done();
195 }
196 return;
197 }
198
199 public static void getRemoteFile(IHost connection, String localExePath, String remoteExePath,
200 IProgressMonitor monitor) throws Exception {
201
202 assert(connection!=null);
203 monitor.beginTask(Messages.InfoDownload, 100);
204
205 IFileService fileService;
206 try {
207 fileService = (IFileService) getConnectedRemoteFileService(
208 connection,
209 new SubProgressMonitor(monitor, 10));
210 File file = new File(localExePath);
211 file.deleteOnExit();
212 monitor.worked(5);
213 Path remotePath = new Path(remoteExePath);
214 fileService.download(remotePath.removeLastSegments(1).toString(),
215 remotePath.lastSegment(),file,true, null,
216 new SubProgressMonitor(monitor, 85));
217 // Need to change the permissions to match the original file
218 // permissions because of a bug in upload
219 //RemoteApplication p = remoteShellExec(
220 // config,
221 // "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
222 //Thread.sleep(500);
223 //p.destroy();
224
225 } finally {
226 monitor.done();
227 }
228 return;
229 }
230
231 public static ITerminalServiceSubSystem getTerminalSubSystem(
232 IHost connection) {
233 ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
234 ISubSystem[] subsystems = systemRegistry.getSubSystems(connection);
235 for (int i = 0; i < subsystems.length; i++) {
236 if (subsystems[i] instanceof ITerminalServiceSubSystem) {
237 ITerminalServiceSubSystem subSystem = (ITerminalServiceSubSystem) subsystems[i];
238 return subSystem;
239 }
240 }
241 return null;
242 }
243
244 public static String spaceEscapify(String inputString) {
245 if (inputString == null)
246 return null;
247
248 return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$
249 }
250
251 public static Process remoteShellExec(IHost connection,
252 String prelaunchCmd, String remoteCommandPath, String arguments,
253 IProgressMonitor monitor) throws CoreException {
254
255 monitor.beginTask(NLS.bind(Messages.RemoteShellExec_1,
256 remoteCommandPath, arguments), 10);
257 String realRemoteCommand = arguments == null ? spaceEscapify(remoteCommandPath)
258 : spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$
259
260 String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD;
261
262 if(prelaunchCmd != null) {
263 if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$
264 remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand;
265 }
266
267 IShellService shellService;
268 Process p = null;
269 try {
270 shellService = (IShellService) getConnectedShellService(
271 connection,
272 new SubProgressMonitor(monitor, 7));
273
274 // This is necessary because runCommand does not actually run the
275 // command right now.
276 String env[] = new String[0];
277 try {
278 IHostShell hostShell = shellService.launchShell(
279 "", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$
280 hostShell.writeToShell(remoteCommand);
281 p = new HostShellProcessAdapter(hostShell);
282 } catch (Exception e) {
283 if (p != null) {
284 p.destroy();
285 }
286 abort(Messages.RemoteShellExec_2, e,
287 IRSECoreStatusCodes.EXCEPTION_OCCURRED);
288 }
289 } catch (Exception e1) {
290 abort(e1.getMessage(), e1,
291 IRSECoreStatusCodes.EXCEPTION_OCCURRED);
292 }
293
294 monitor.done();
295 return p;
296 }
297
298 /**
299 * Throws a core exception with an error status object built from the given
300 * message, lower level exception, and error code.
301 *
302 * @param message
303 * the status message
304 * @param exception
305 * lower level exception associated with the error, or
306 * <code>null</code> if none
307 * @param code
308 * error code
309 */
310 public static void abort(String message, Throwable exception, int code) throws CoreException {
311 IStatus status;
312 if (exception != null) {
313 MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, code, message, exception);
314 multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, exception.getLocalizedMessage(), exception));
315 status = multiStatus;
316 } else {
317 status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, message, null);
318 }
319 throw new CoreException(status);
320 }
321 /**
322 * Checks whether a IHost associated system's is enabled and not a local one
323 * @param host
324 * @return
325 */
326 public static boolean isHostViable(IHost host) {
327 IRSESystemType sysType = host.getSystemType();
328 if (sysType != null && sysType.isEnabled() && !sysType.isLocal())
329 return true;
330 return false;
331 }
332
333 /**
334 * Ensures that RSECorePlugin is initialized before performing any actions
335 */
336 public static void waitForRSEInitCompletition() {
337 if (!RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL))
338 try {
339 RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL);
340 } catch (InterruptedException e) {
341 return;
342 }
343 }
344}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.remote.utils;
12
13import java.io.BufferedReader;
14import java.io.IOException;
15import java.io.InputStream;
16import java.io.InputStreamReader;
17import java.io.OutputStream;
18
19import org.eclipse.core.runtime.IProgressMonitor;
20import org.eclipse.rse.core.model.IHost;
21
22public class RemoteShellExec {
23
24 public static final int
25 STATE_NULL = 0,
26 STATE_RUNNING = 1,
27 STATE_EXITED = 2;
28
29 private final String command;
30 private final IHost host;
31
32 private InputStream fInStream;
33 private OutputStream fOutStream;
34 private InputStream fErrStream;
35 private Process remoteShellProcess;
36
37 private int exitCode = 0;
38 private int status = STATE_NULL;
39
40 private final String RETURN_VALUE_TAG = "org.yocto.sdk.remotetools.RVTAG";
41 private final String RETURN_VALUE_CMD = ";echo \"" + RETURN_VALUE_TAG + "$?\"";
42
43 public RemoteShellExec(IHost host, String command) {
44 assert(host != null);
45 this.host = host;
46 this.command = command;
47 }
48
49 public int getStatus() {
50 return status;
51 }
52
53 public int getExitCode() {
54 return exitCode;
55 }
56
57 private void reset() {
58 fInStream = null;
59 fOutStream = null;
60 fErrStream = null;
61
62 remoteShellProcess = null;
63 exitCode = 0;
64 status = STATE_NULL;
65 }
66
67 public InputStream getInputStream() {
68 return fInStream;
69 }
70
71 public OutputStream getOutputStream() {
72 return fOutStream;
73 }
74
75 public InputStream getErrStream() {
76 return fErrStream;
77 }
78
79 public synchronized void start(String prelaunchCmd, String argument, IProgressMonitor monitor) throws Exception {
80 if(status == STATE_RUNNING)
81 return;
82
83 reset();
84 argument = (argument == null ? RETURN_VALUE_CMD : argument + RETURN_VALUE_CMD);
85 remoteShellProcess = RSEHelper.remoteShellExec(this.host, prelaunchCmd, this.command, argument, monitor);
86 fInStream = remoteShellProcess.getInputStream();
87 fOutStream = remoteShellProcess.getOutputStream();
88 fErrStream = remoteShellProcess.getErrorStream();
89 status = STATE_RUNNING;
90 }
91
92 public synchronized void terminate() throws Exception {
93 if(status != STATE_RUNNING || remoteShellProcess != null)
94 return;
95
96 remoteShellProcess.destroy();
97 reset();
98 }
99
100 public int waitFor(IProgressMonitor monitor) throws InterruptedException {
101 while(status == STATE_RUNNING) {
102 if(monitor != null) {
103 if(monitor.isCanceled()) {
104 throw new InterruptedException("User Cancelled");
105 }
106 }
107
108 try {
109 remoteShellProcess.waitFor();
110 }catch(InterruptedException e){
111 //get the return value
112 try {
113 if(fInStream.available() != 0) {
114 BufferedReader in = new BufferedReader(new InputStreamReader(fInStream));
115 String thisline;
116 int idx;
117 while((thisline = in.readLine()) != null) {
118 if(thisline.indexOf(RETURN_VALUE_CMD) == -1) {
119 idx = thisline.indexOf(RETURN_VALUE_TAG);
120 if(idx != -1) {
121 try {
122 exitCode=(new Integer(thisline.substring(idx+RETURN_VALUE_TAG.length()))).intValue();
123 }catch(NumberFormatException e2) {
124 }
125 break;
126 }
127 }
128 }
129 }
130 }catch(IOException e1) {
131 //do nothing
132 }
133 }finally {
134 status=STATE_EXITED;
135 }
136 }
137 return exitCode;
138 }
139}
140
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 @@
1/*****************************************************************************
2 * Copyright (c) 2013 Ken Gilmer
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 * Jessica Zhang - Adopt for Yocto Tools plugin
11 *******************************************************************************/
12package org.yocto.remote.utils;
13
14import java.io.BufferedReader;
15import java.io.File;
16import java.io.IOException;
17import java.io.InputStream;
18import java.io.InputStreamReader;
19import java.io.OutputStream;
20import java.io.OutputStreamWriter;
21import java.lang.reflect.InvocationTargetException;
22import java.util.regex.Matcher;
23import java.util.regex.Pattern;
24
25import org.eclipse.swt.widgets.Display;
26
27public class ShellSession {
28 /**
29 * Bash shell
30 */
31 public static final int SHELL_TYPE_BASH = 1;
32 /**
33 * sh shell
34 */
35 public static final int SHELL_TYPE_SH = 2;
36 private volatile boolean interrupt = false;
37 /**
38 * String used to isolate command execution
39 */
40 public static final String TERMINATOR = "build$";
41 public static final String LT = System.getProperty("line.separator");
42 private Process process;
43
44 private OutputStream pos = null;
45
46 private String shellPath = null;
47 private final String initCmd;
48 private final File root;
49 private final File builddir;
50
51 private OutputStreamWriter out;
52
53 public static String getFilePath(String file) throws IOException {
54 File f = new File(file);
55
56 if (!f.exists() || f.isDirectory()) {
57 throw new IOException("Path passed is not a file: " + file);
58 }
59
60 StringBuffer sb = new StringBuffer();
61
62 String elems[] = file.split(File.separator);
63
64 for (int i = 0; i < elems.length - 1; ++i) {
65 sb.append(elems[i]);
66 sb.append(File.separator);
67 }
68
69 return sb.toString();
70 }
71
72 public ShellSession(int shellType, File root, File builddir, String initCmd, OutputStream out) throws IOException {
73 this.root = root;
74 this.builddir = builddir;
75 this.initCmd = initCmd;
76 if (out == null) {
77 this.out = new OutputStreamWriter(null);
78 } else {
79 this.out = new OutputStreamWriter(out);
80 }
81 if (shellType == SHELL_TYPE_SH) {
82 shellPath = "/bin/sh";
83 }
84 shellPath = "/bin/bash";
85
86 initializeShell();
87 }
88
89 private void initializeShell() throws IOException {
90 process = Runtime.getRuntime().exec(shellPath);
91 pos = process.getOutputStream();
92
93 if (root != null) {
94 execute("cd " + root.getAbsolutePath());
95 }
96
97 if (initCmd != null) {
98 execute("source " + initCmd + " " + builddir.getAbsolutePath());
99 }
100 }
101
102 synchronized
103 public String execute(String command, int[] retCode) throws IOException {
104 String errorMessage = null;
105
106 interrupt = false;
107 out.write(command);
108 out.write(LT);
109
110 sendToProcessAndTerminate(command);
111
112 if (process.getErrorStream().available() > 0) {
113 byte[] msg = new byte[process.getErrorStream().available()];
114
115 process.getErrorStream().read(msg, 0, msg.length);
116 String msg_str = new String(msg);
117 out.write(msg_str);
118 out.write(LT);
119 if (!msg_str.contains("WARNING"))
120 errorMessage = "Error while executing: " + command + LT + new String(msg);
121 }
122
123 BufferedReader br = new BufferedReader(new InputStreamReader(process
124 .getInputStream()));
125
126 StringBuffer sb = new StringBuffer();
127 String line = null;
128
129 while (true) {
130 line = br.readLine();
131 if (line != null) {
132 sb.append(line);
133 sb.append(LT);
134 out.write(line);
135 out.write(LT);
136 }
137 if (line.endsWith(TERMINATOR))
138 break;
139 }
140 if (interrupt) {
141 process.destroy();
142 initializeShell();
143 interrupt = false;
144 }else if (line != null && retCode != null) {
145 try {
146 retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR)));
147 }catch (NumberFormatException e) {
148 throw new IOException("Can NOT get return code" + command + LT + line);
149 }
150 }
151 out.flush();
152 if (errorMessage != null) {
153 throw new IOException(errorMessage);
154 }
155 return sb.toString();
156 }
157
158 synchronized
159 public void execute(String command) throws IOException {
160 interrupt = false;
161 String errorMessage = null;
162
163 sendToProcessAndTerminate(command);
164 boolean cancel = false;
165 try {
166 InputStream is = process.getInputStream();
167 InputStream es = process.getErrorStream();
168 String info;
169 while (!cancel) {
170 info = null;
171 StringBuffer buffer = new StringBuffer();
172 int c;
173 while (is.available() > 0) {
174 c = is.read();
175 char ch = (char) c;
176 buffer.append(ch);
177 if (ch == '\n') {
178 info = buffer.toString();
179 if (!info.trim().endsWith(TERMINATOR)) {
180 out.write(info);
181 out.write(LT);
182 buffer.delete(0, buffer.length());
183 } else {
184 cancel = true;
185 break;
186 }
187 }
188 }
189 while (es.available() > 0) {
190 c = es.read();
191 char ch = (char) c;
192 buffer.append(ch);
193 if (ch == '\n') {
194 info = buffer.toString();
195 if (!info.contains("WARNING"))
196 errorMessage += info;
197 out.write(info);
198 out.write(LT);
199 buffer.delete(0, buffer.length());
200 }
201 }
202 }
203 } catch (IOException e) {
204 try {
205 throw new InvocationTargetException(e);
206 } catch (InvocationTargetException e1) {
207 e1.printStackTrace();
208 }
209 }
210 out.flush();
211 if (errorMessage != null) {
212 throw new IOException(errorMessage);
213 }
214 if (interrupt) {
215 process.destroy();
216 initializeShell();
217 interrupt = false;
218 }
219 }
220 synchronized
221 public boolean ensureKnownHostKey(String user, String host) throws IOException {
222
223 boolean loadKeysMatch = false;
224 boolean accepted = false;
225 Process proc = Runtime.getRuntime().exec("ssh -o LogLevel=DEBUG3 " + user + "@" + host);
226 Pattern patternLoad = Pattern.compile("^debug3: load_hostkeys: loaded (\\d+) keys");
227 Pattern patternAuthSucceeded = Pattern.compile("^debug1: Authentication succeeded.*");
228
229 try {
230 InputStream es = proc.getErrorStream();
231 String info;
232 while (!loadKeysMatch) {
233 info = null;
234 StringBuffer buffer = new StringBuffer();
235 int c;
236 while (es.available() > 0) {
237 c = es.read();
238 char ch = (char) c;
239 buffer.append(ch);
240 if (ch == '\r') {
241 info = buffer.toString().trim();
242 Matcher m = patternLoad.matcher(info);
243 if(m.matches()) {
244 int keys = new Integer(m.group(1));
245 if (keys == 0) {
246 proc.destroy();
247 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);
248 Display.getDefault().syncExec(runnable);
249 accepted = runnable.result;
250 if (accepted){
251 proc = Runtime.getRuntime().exec("ssh -o StrictHostKeyChecking=no " + user + "@" + host);//add host key to known_hosts
252 try {
253 Thread.sleep(2000); //wait for process to finish
254 } catch (InterruptedException e) {
255 e.printStackTrace();
256 }
257 proc.destroy();
258 } else {
259 Display.getDefault().syncExec( new DialogRunnable("Host authenticity", "Host key verification failed.", DialogRunnable.ERROR));
260 }
261 } else {
262 String errorMsg = "";
263 // wait to check if key is the same and authentication succeeds
264 while (es.available() > 0) {
265 c = es.read();
266 ch = (char) c;
267 buffer.append(ch);
268 if (ch == '\r') {
269 info = buffer.toString().trim();
270 Matcher mAuthS = patternAuthSucceeded.matcher(info);
271 if(mAuthS.matches()) {
272 accepted = true;
273 break;
274 } else {
275 if (!info.startsWith("debug"))
276 errorMsg += info + "\n";
277 }
278 try {
279 Thread.sleep(100);
280 } catch (InterruptedException e) {
281 // TODO Auto-generated catch block
282 e.printStackTrace();
283 }
284 buffer.delete(0, buffer.length());
285 }
286 }
287 if (!accepted && !errorMsg.isEmpty()) {
288 Display.getDefault().syncExec( new DialogRunnable("Host authenticity", errorMsg, DialogRunnable.ERROR));
289 }
290 }
291 loadKeysMatch = true;
292 break;
293 }
294 buffer.delete(0, buffer.length());
295 }
296 }
297 }
298 es.close();
299 } catch (IOException e) {
300 try {
301 throw new InvocationTargetException(e);
302 } catch (InvocationTargetException e1) {
303 e1.printStackTrace();
304 }
305 }
306 return accepted;
307 }
308
309 /**
310 * Send command string to shell process and add special terminator string so
311 * reader knows when output is complete.
312 *
313 * @param command
314 * @throws IOException
315 */
316 private void sendToProcessAndTerminate(String command) throws IOException {
317 pos.write(command.getBytes());
318 pos.write(LT.getBytes());
319 pos.flush();
320 pos.write("echo $?".getBytes());
321 pos.write(TERMINATOR.getBytes());
322 pos.write(LT.getBytes());
323 pos.flush();
324 }
325
326 /**
327 * Interrupt any running processes.
328 */
329 public void interrupt() {
330 interrupt = true;
331 }
332}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.remote.utils;
12
13import org.eclipse.core.commands.AbstractHandler;
14import org.eclipse.core.commands.ExecutionException;
15import org.eclipse.core.runtime.IProgressMonitor;
16import org.eclipse.core.runtime.NullProgressMonitor;
17import org.eclipse.core.runtime.OperationCanceledException;
18import org.eclipse.jface.dialogs.ProgressMonitorDialog;
19import org.eclipse.jface.operation.IRunnableWithProgress;
20import org.eclipse.rse.core.model.IHost;
21import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
22import org.eclipse.rse.internal.terminals.ui.views.RSETerminalConnector;
23import org.eclipse.rse.internal.terminals.ui.views.TerminalViewTab;
24import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer;
25import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI;
26import org.eclipse.rse.services.terminals.ITerminalShell;
27import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
28import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
29import org.eclipse.rse.ui.SystemBasePlugin;
30import org.eclipse.swt.custom.CTabItem;
31import org.eclipse.swt.events.DisposeEvent;
32import org.eclipse.swt.events.DisposeListener;
33import org.eclipse.swt.widgets.Shell;
34import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
35import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
36
37abstract public class TerminalHandler extends AbstractHandler {
38
39
40 protected Shell shell;
41
42 protected String changeTerm = "export TERM=vt100;";
43
44 abstract protected String getInitCmd();
45 abstract protected String getConnnectionName();
46 abstract protected String getDialogTitle();
47
48 protected String changeTerm() {
49 return changeTerm;
50 }
51
52 protected ITerminalShell getTerminalShellFromTab(CTabItem item) {
53 ITerminalShell terminalShell = null;
54 ITerminalViewControl terminalViewControl = (ITerminalViewControl) item
55 .getData(TerminalViewTab.DATA_KEY_CONTROL);
56 ITerminalConnector terminalConnector = terminalViewControl
57 .getTerminalConnector();
58 if (terminalConnector instanceof RSETerminalConnector) {
59 RSETerminalConnector rseTerminalConnector = (RSETerminalConnector) terminalConnector;
60 terminalShell = rseTerminalConnector.getTerminalHostShell();
61 }
62 return terminalShell;
63 }
64
65 protected boolean preProcess(final ITerminalServiceSubSystem terminalSubSystem) {
66 if (!terminalSubSystem.isConnected()) {
67 try {
68 ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
69 dialog.run(true, true, new IRunnableWithProgress(){
70 @Override
71 public void run(IProgressMonitor monitor) {
72 monitor.beginTask("Connecting to remote target ...", 100);
73 try {
74 terminalSubSystem.connect(new NullProgressMonitor(), false);
75 monitor.done();
76 } catch (Exception e) {
77 CommonHelper.showErrorDialog("Connection failure", null, e.getMessage());
78 monitor.done();
79
80 }
81 }
82 });
83 } catch (OperationCanceledException e) {
84 // user canceled, return silently
85 return false;
86 } catch (Exception e) {
87 SystemBasePlugin.logError(e.getLocalizedMessage(), e);
88 return false;
89 }
90 } else
91 return true;
92 return false;
93 }
94
95 public void execute(IHost host) throws ExecutionException {
96
97 final ITerminalServiceSubSystem terminalSubSystem = RSEHelper.getTerminalSubSystem(host);
98
99 if (terminalSubSystem != null) {
100 TerminalsUI terminalsUI = TerminalsUI.getInstance();
101 TerminalViewer viewer = terminalsUI.activateTerminalsView();
102 if (preProcess(terminalSubSystem)) {
103 CTabItem tab = viewer.getTabFolder().createTabItem(
104 terminalSubSystem.getHost(), changeTerm() + getInitCmd());
105 //since RSETerminalConnector not exit the shell during the diconnection,
106 //we have manually exit it here
107 try {
108 tab.addDisposeListener(new DisposeListener() {
109 @Override
110 public void widgetDisposed(DisposeEvent e) {
111 Object source = e.getSource();
112 if (source instanceof CTabItem) {
113 CTabItem currentItem = (CTabItem) source;
114 ITerminalShell shell=getTerminalShellFromTab(currentItem);
115 if(shell!=null) {
116 shell.exit();
117 }
118 }
119 }
120 });
121 }catch(Exception e) {
122 e.printStackTrace();
123 }
124 TerminalElement element = TerminalServiceHelper
125 .createTerminalElement(tab, terminalSubSystem);
126 terminalSubSystem.addChild(element);
127
128 }
129 }
130 }
131
132}
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 <classpathentry kind="output" path="bin"/>
6</classpath>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.sdk.ide.doc.user</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.jdt.core.javabuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.pde.ManifestBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.pde.SchemaBuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 </buildSpec>
24 <natures>
25 <nature>org.eclipse.pde.PluginNature</nature>
26 <nature>org.eclipse.jdt.core.javanature</nature>
27 </natures>
28</projectDescription>
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 @@
1#Fri Mar 04 13:59:33 CET 2011
2eclipse.preferences.version=1
3org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5org.eclipse.jdt.core.compiler.compliance=1.6
6org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8org.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 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: %Bundle-Name
4Bundle-SymbolicName: org.yocto.sdk.ide.doc.user;singleton:=true
5Bundle-Version: 1.4.0.qualifier
6Bundle-Vendor: %Bundle-Vendor
7Bundle-RequiredExecutionEnvironment: JavaSE-1.6
8Require-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 @@
1#Properties file for org.yocto.sdk.ide.doc.user
2Bundle-Vendor = yoctoproject.org
3Bundle-Name = Yocto User Help
4
5category.name = Yocto Project
6
7cheatsheet.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 @@
1bin.includes = plugin.xml,\
2 .,\
3 META-INF/,\
4 OSGI-INF/,\
5 cheatsheets/
6src.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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3/*******************************************************************************
4 * Copyright (c) 2012 BMW Car IT GmbH.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors:
11 * Atanas Gegov - initial cheat sheet for creating the hello world project.
12 *******************************************************************************
13-->
14<cheatsheet title="Creating a Hello World ANSI C or C++ Autotools Project">
15 <intro>
16 <description>
17 This cheat sheet will guide you through the process of creating and
18 building a &quot;Hello World ANSI C Autotools Project&quot; or
19 a &quot;Hello World C++ Autotools Project&quot;
20 application that uses a Yocto Project template.
21 </description>
22 </intro>
23 <item title="Open the C/C++ Perspective" dialog="false" skip="true">
24 <description>
25 Select <b>Window</b> &gt; <b>Open Perspective</b> &gt;
26 <b>Other...</b> from the menu bar.<br/>
27 Choose <b>C/C++</b> from the <b>Open Perspective</b> dialog.
28 Click <b>OK</b>.
29 </description>
30 <command
31 required="false"
32 serialization="org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.cdt.ui.CPerspective)">
33 </command>
34 </item>
35 <item title="Specify a toolchain and sysroot location" dialog="true" skip="true">
36 <description>
37 You need to specify a toolchain and sysroot location before
38 building any project in the workspace.
39 </description>
40 <subitem>
41 <description>
42 The global settings can be modified in the <b>Yocto Project ADT</b>
43 section of the eclipse preferences. Select <b>Window</b> &gt;
44 <b>Preferences</b> from the menu bar and then select the section
45 <b>Yocto Project ADT</b>. These settings are the default ones for
46 every project you create in the workspace.
47 </description>
48 <command
49 required="false"
50 serialization="org.eclipse.ui.window.preferences(preferencePageId=org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage)">
51 </command>
52 </subitem>
53 <subitem>
54 <description>
55 Choose in the <b>Cross Compiler Options</b> the
56 <b>Standalone pre-built toolchain</b>.
57 </description>
58 </subitem>
59 <subitem>
60 <description>
61 Provide a <b>Toolchain Root Location</b> (e.g.
62 /opt/poky/1.3 or some other location on the filesystem).
63 </description>
64 </subitem>
65 <subitem>
66 <description>
67 Provide a <b>Sysroot Location</b>. This is the filesystem
68 containing libraries, headers etc. used while cross-building
69 binaries for the target.
70 </description>
71 </subitem>
72 <subitem>
73 <description>
74 If more than one toolchain is found in the <b>Toolchain
75 Root Location</b>, use the drop-down box to select the <b>Target
76 Architecture</b>. Make sure that the selected sysroot matches
77 the toolchain.
78 </description>
79 </subitem>
80 <subitem>
81 <description>
82 Choose in the <b>Target Options</b> whether the target is a QEMU
83 emulation (kernel location required) or an external hardware.
84 The target is used for running or remote debugging the binaries
85 created for it.
86 </description>
87 </subitem>
88 <subitem>
89 <description>
90 Save the settings with <b>Apply</b> and <b>OK</b>. You can later
91 change these settings for any project from the menu
92 <b>Project</b> &gt; <b>Change Yocto Project Settings</b>.
93 </description>
94 </subitem>
95 </item>
96 <item title="Choose the programming language for the project" dialog="true">
97 <description>
98 Choose between the available &quot;Hello World ANSI C Autotools
99 Project&quot; or the &quot;Hello World C++ Autotools Project&quot;
100 template projects.
101 </description>
102 <command returns="progLanguage"
103 serialization="org.eclipse.ui.dialogs.openMessageDialog(title=Select Programming Language,buttonLabel0=C++,message=Select the programming language for the Hello World Autotools Project project,buttonLabel1=C)"/>
104 <onCompletion> You selected ${progLanguage}.</onCompletion>
105 </item>
106 <item title="Create a Hello World Autotools Project">
107 <description>
108 Create a Yocto Project ADT Project &quot;Hello World ANSI C Autotools
109 Project&quot; or &quot;Hello World C++ Autotools Project&quot;
110 by using the appropriate Project wizard.
111 </description>
112 <conditional-subitem condition="${progLanguage}">
113 <subitem when="C++">
114 <description>
115 Click <b>File</b> &gt; <b>New</b> &gt; <b>C++ Project</b> to
116 launch the C++ Project wizard.
117 </description>
118 <command
119 required="false"
120 serialization="org.eclipse.ui.newWizard(newWizardId=org.eclipse.cdt.ui.wizards.NewCWizard1)">
121 </command>
122 </subitem>
123 <subitem when="C">
124 <description>
125 Click <b>File</b> &gt; <b>New</b> &gt; <b>C Project</b> to
126 launch the C Project wizard.
127 </description>
128 <command
129 required="false"
130 serialization="org.eclipse.ui.newWizard(newWizardId=org.eclipse.cdt.ui.wizards.NewCWizard2)">
131 </command>
132 </subitem>
133 </conditional-subitem>
134 <conditional-subitem condition="${progLanguage}">
135 <subitem when="C++">
136 <description>
137 Enter <b>HelloWorld</b> as the project name, then select
138 <b>Yocto Project ADT Project</b> &gt;
139 <b>Hello World C++ Autotools Project</b> from the Project type
140 list and click <b>Next</b>.
141 </description>
142 </subitem>
143 <subitem when="C">
144 <description>
145 Enter <b>HelloWorld</b> as the project name, then select
146 <b>Yocto Project ADT Project</b> &gt;
147 <b>Hello World ANSI C Autotools Project</b> from the Project type
148 list and click <b>Next</b>.
149 </description>
150 </subitem>
151 </conditional-subitem>
152 <subitem skip="true">
153 <description>
154 Fill in the name of the <b>Author</b>. Make some changes in the
155 other fields if needed. Possibly change the <b>License</b> from
156 the drop-down box and click <b>Next</b>.
157 </description>
158 </subitem>
159 <subitem skip="true">
160 <description>
161 If needed make some Advanced settings. Confirm them with
162 <b>Apply</b> and <b>OK</b>.
163 </description>
164 </subitem>
165 <subitem>
166 <description>
167 Click <b>Finish</b> to create the project in your workspace. You
168 will find the created project in the <b>Project Explorer</b> view.
169 </description>
170 </subitem>
171 </item>
172 <item title="Build the project" dialog="true">
173 <description>
174 Create the project&apos;s binary using a specified toolchain and
175 sysroot.
176 </description>
177 <subitem>
178 <description>
179 Make sure that the project is on focus in the
180 <b>Project Explorer</b> view.
181 </description>
182 </subitem>
183 <subitem>
184 <description>
185 If you want to change the default settings for toolchain and
186 sysroot location go to <b>Project</b> &gt;
187 <b>Change Yocto Project Settings</b> in the menu bar. Finish the
188 editing by pressing <b>OK</b>.
189 </description>
190 </subitem>
191 <subitem>
192 <description>
193 If you have changed the settings in the previous step, call
194 <b>Project</b> &gt; <b>Reconfigure Project</b> to reconfigure the
195 project with these new settings (e.g. create the correct Makefiles
196 that make use of the selected toolchain and sysroot).
197 </description>
198 </subitem>
199 <subitem>
200 <description>
201 Build the project with a click on the hammer symbol in the
202 Toolbar. Alternatively, go to <b>Project</b> &gt;
203 <b>Build Project</b>. If you didn&apos;t change the default
204 toolchain and sysroot, now the configuring step will be executed
205 at first, followed by the build step itself.
206 </description>
207 </subitem>
208 <subitem>
209 <description>
210 Observe the output in the different consoles (e.g.
211 <b>Configure [HelloWorld]</b> and
212 <b>CDT Build Console [HelloWorld]</b>) to check if everything
213 was successful.
214 </description>
215 </subitem>
216 <onCompletion>
217 Congratulations, you have completed this cheat sheet! You may
218 continue with editing, rebuilding or debugging the
219 Hello World Autotools Project.
220 </onCompletion>
221 </item>
222</cheatsheet>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<?eclipse version="3.4"?>
3<plugin>
4 <extension point="org.eclipse.ui.cheatsheets.cheatSheetContent">
5 <category id="org.yocto.sdk.ide.doc.user.cheatsheets" name="%category.name">
6 </category>
7 <cheatsheet category="org.yocto.sdk.ide.doc.user.cheatsheets"
8 composite="false" contentFile="cheatsheets/createNewHelloWorldProject.xml"
9 id="org.yocto.sdk.ide.doc.user.cheatsheet.helloworldProject"
10 name="%cheatsheet.name">
11 </cheatsheet>
12 </extension>
13</plugin>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 <classpathentry kind="src" path="src"/>
6 <classpathentry kind="output" path="bin"/>
7</classpath>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.sdk.ide</name>
4 <comment></comment>
5 <projects>
6 <project>org.eclipse.tm.tcf</project>
7 <project>org.eclipse.tm.tcf.core</project>
8 <project>org.eclipse.tm.tcf.rse</project>
9 <project>org.eclipse.tm.tcf.terminals</project>
10 </projects>
11 <buildSpec>
12 <buildCommand>
13 <name>org.eclipse.jdt.core.javabuilder</name>
14 <arguments>
15 </arguments>
16 </buildCommand>
17 <buildCommand>
18 <name>org.eclipse.pde.ManifestBuilder</name>
19 <arguments>
20 </arguments>
21 </buildCommand>
22 <buildCommand>
23 <name>org.eclipse.pde.SchemaBuilder</name>
24 <arguments>
25 </arguments>
26 </buildCommand>
27 </buildSpec>
28 <natures>
29 <nature>org.eclipse.pde.PluginNature</nature>
30 <nature>org.eclipse.jdt.core.javanature</nature>
31 </natures>
32</projectDescription>
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 @@
1#Mon May 03 15:24:21 PDT 2010
2eclipse.preferences.version=1
3org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5org.eclipse.jdt.core.compiler.compliance=1.6
6org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8org.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 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: %Bundle-Name
4Bundle-SymbolicName: org.yocto.sdk.ide;singleton:=true
5Bundle-Version: 1.4.0.qualifier
6Bundle-Activator: org.yocto.sdk.ide.YoctoSDKPlugin
7Bundle-Vendor: %Bundle-Vendor
8Require-Bundle: org.eclipse.ui,
9 org.eclipse.cdt.ui;bundle-version="5.1.2",
10 org.eclipse.core.runtime,
11 org.eclipse.cdt.core;bundle-version="5.1.2",
12 org.eclipse.core.resources;bundle-version="3.5.1",
13 org.eclipse.debug.core;bundle-version="3.5.1",
14 org.eclipse.cdt.managedbuilder.core,
15 org.eclipse.cdt.autotools.core;bundle-version="1.1.0",
16 org.eclipse.cdt.autotools.ui;bundle-version="1.0.1",
17 org.eclipse.cdt.managedbuilder.ui;bundle-version="8.0.0",
18 org.eclipse.core.expressions;bundle-version="3.4.100",
19 org.eclipse.rse.files.ui;bundle-version="3.1.1",
20 org.eclipse.rse.services;bundle-version="3.2.200",
21 org.eclipse.rse.core;bundle-version="3.1.1",
22 org.eclipse.rse.ui;bundle-version="3.1.1",
23 org.eclipse.rse.subsystems.files.core;bundle-version="3.1.1",
24 org.eclipse.rse.subsystems.shells.core;bundle-version="3.1.0",
25 org.eclipse.cdt.launch.remote;bundle-version="2.4.0",
26 org.eclipse.cdt.debug.mi.core;bundle-version="7.1.0",
27 org.eclipse.cdt.debug.core;bundle-version="7.1.0",
28 org.eclipse.debug.ui;bundle-version="3.5.1",
29 org.eclipse.ui.ide;bundle-version="3.8.0"
30Bundle-RequiredExecutionEnvironment: JavaSE-1.6
31Bundle-ActivationPolicy: lazy
32Export-Package: org.yocto.sdk.ide,
33 org.yocto.sdk.ide.natures,
34 org.yocto.sdk.ide.utils,
35 org.yocto.sdk.ide.actions,
36 org.yocto.sdk.ide.preferences,
37 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 @@
1#Properties file for org.Yocto.sdk.ide
2page.name.0 = Yocto Project ADT
3extension.name.0 = YoctoSDKNature
4extension.name.1 = YoctoSDKAutotoolsNature
5extension.name.2 = YoctoSDKCMakeNature
6command.name = ReconfigureYoctoProject
7command.label.0 = Change Yocto Project Settings
8command.mnemonic = C
9command.targetProfileSwitch.name = Change Target Profile
10command.targetProfileSwitch.label = Target Profiles
11command.targetProfileSwitch.description = Changes the target profile of a selected project
12command.targetProfileSwitch.parameter.name = Selected Target Profile
13projectType.name.0 = Yocto Project ADT Autotools Project
14projectProperties.label.0 = Yocto Project Settings
15Bundle-Vendor = yoctoproject.org
16Bundle-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 @@
1source.. = src/
2output.. = bin/
3bin.includes = META-INF/,\
4 .,\
5 plugin.xml,\
6 templates/,\
7 OSGI-INF/
8src.includes = templates/,\
9 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<?eclipse version="3.4"?>
3<plugin>
4 <extension
5 point="org.eclipse.ui.preferencePages">
6 <page
7 class="org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage"
8 id="org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage"
9 name="%page.name.0">
10 </page>
11 </extension>
12 <extension
13 point="org.eclipse.core.runtime.preferences">
14 <initializer
15 class="org.yocto.sdk.ide.preferences.PreferenceInitializer">
16 </initializer>
17 </extension>
18 <extension
19 id="YoctoSDKNature"
20 name="%extension.name.0"
21 point="org.eclipse.core.resources.natures">
22 <runtime>
23 <run
24 class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature">
25 </run>
26 </runtime>
27 </extension>
28 <extension
29 id="YoctoSDKAutotoolsNature"
30 name="%extension.name.1"
31 point="org.eclipse.core.resources.natures">
32 <requires-nature
33 id="org.yocto.sdk.ide.YoctoSDKNature">
34 </requires-nature>
35 <requires-nature
36 id="org.eclipse.cdt.autotools.core.autotoolsNatureV2">
37 </requires-nature>
38 <runtime>
39 <run
40 class="org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature">
41 </run>
42 </runtime>
43 <one-of-nature
44 id="org.yocto.sdk.ide.buildsystemNaturesSet">
45 </one-of-nature>
46 <builder
47 id="org.eclipse.cdt.autotools.core.genmakebuilderV2">
48 </builder>
49 </extension>
50 <extension
51 id="YoctoSDKCMakeNature"
52 name="%extension.name.2"
53 point="org.eclipse.core.resources.natures">
54 <requires-nature
55 id="org.yocto.sdk.ide.YoctoSDKNature">
56 </requires-nature>
57 <runtime>
58 <run
59 class="org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature">
60 </run>
61 </runtime>
62 <one-of-nature
63 id="org.yocto.sdk.ide.buildsystemNaturesSet">
64 </one-of-nature>
65 </extension>
66 <extension
67 id="YoctoSDKEmptyNature"
68 point="org.eclipse.core.resources.natures">
69 <requires-nature
70 id="org.yocto.sdk.ide.YoctoSDKNature">
71 </requires-nature>
72 <runtime>
73 <run
74 class="org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature">
75 </run>
76 </runtime>
77 </extension>
78 <extension
79 point="org.eclipse.ui.commands">
80 <command
81 id="org.yocto.sdk.ide.command.reconfigYocto"
82 name="%command.name">
83 </command>
84 <command
85 id="org.yocto.sdk.ide.command.disabled"
86 name="DisabledCommand">
87 </command>
88 </extension>
89 <extension
90 point="org.eclipse.ui.handlers">
91 <handler
92 class="org.yocto.sdk.ide.actions.ReconfigYoctoHandler"
93 commandId="org.yocto.sdk.ide.command.reconfigYocto">
94 </handler>
95 </extension>
96 <extension
97 point="org.eclipse.ui.menus">
98 <menuContribution
99 locationURI="menu:project">
100 <command
101 commandId="org.yocto.sdk.ide.command.reconfigYocto"
102 id="reconfigure"
103 label="%command.label.0"
104 mnemonic="%command.mnemonic"
105 style="push">
106 <visibleWhen
107 checkEnabled="false">
108 <and>
109 <count
110 value="1">
111 </count>
112 <iterate>
113 <adapt
114 type="org.eclipse.core.resources.IResource">
115 <test
116 property="org.eclipse.core.resources.projectNature"
117 value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature">
118 </test>
119 </adapt>
120 </iterate>
121 </and>
122 </visibleWhen>
123 </command>
124 </menuContribution>
125 </extension>
126 <extension
127 point="org.eclipse.cdt.core.templates">
128 <template
129 filterPattern=".*gcc"
130 id="org.yocto.sdk.ide.template.emptyCProject"
131 location="templates/projecttemplates/EmptyCAutotoolsProject/template.xml"
132 projectType="org.yocto.sdk.ide.projectType">
133 </template>
134 <template
135 filterPattern=".*g\+\+"
136 id="org.yocto.sdk.ide.template.emptyCPPProject"
137 location="templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml"
138 projectType="org.yocto.sdk.ide.projectType">
139 </template>
140 <template
141 filterPattern=".*gcc"
142 id="org.yocto.sdk.ide.template.helloWorldCProject"
143 location="templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml"
144 projectType="org.yocto.sdk.ide.projectType">
145 </template>
146 <template
147 filterPattern=".*g\+\+"
148 id="org.yocto.sdk.ide.template.helloWorldCPPProject"
149 location="templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml"
150 projectType="org.yocto.sdk.ide.projectType">
151 </template>
152 <template
153 filterPattern=".*gcc"
154 id="org.yocto.sdk.ide.template.helloWorldCGTKProject"
155 location="templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml"
156 projectType="org.yocto.sdk.ide.projectType">
157 </template>
158 </extension>
159 <extension
160 point="org.eclipse.cdt.core.templateProcessTypes">
161 <processType
162 name="NewYoctoProject"
163 processRunner="org.yocto.sdk.ide.wizard.NewYoctoProjectTemplateProcess">
164 <simple
165 name="name">
166 </simple>
167 <simple
168 external="true"
169 name="location"
170 nullable="true">
171 </simple>
172 <simple
173 external="true"
174 name="artifactExtension">
175 </simple>
176 <simple
177 external="true"
178 name="isCProject">
179 </simple>
180 <simple
181 external="true"
182 name="isEmptyProject">
183 </simple>
184 <simple
185 external="true"
186 name="isAutotoolsProject">
187 </simple>
188 <simple
189 external="true"
190 name="isCMakeProject">
191 </simple>
192 </processType>
193 <processType
194 name="NewYoctoAutotoolsProjectPostProcess"
195 processRunner="org.yocto.sdk.ide.wizard.NewYoctoAutotoolsProjectPostProcess">
196 <simple
197 name="projectName">
198 </simple>
199 </processType>
200 </extension>
201 <extension
202 point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
203 <projectType
204 id="org.yocto.sdk.ide.projectType"
205 isAbstract="true"
206 name="%projectType.name.0"
207 superClass="org.eclipse.linuxtools.cdt.autotools.core.projectType">
208 </projectType>
209 </extension>
210 <extension
211 id="org.yocto.sdk.ide.actions.YoctoConsole"
212 point="org.eclipse.cdt.core.CBuildConsole">
213 <CBuildConsole
214 class="org.yocto.sdk.ide.actions.YoctoConsole"
215 id="org.yocto.sdk.ide.YoctoConsole">
216 </CBuildConsole>
217 </extension>
218 <extension
219 point="org.eclipse.ui.propertyPages">
220 <page
221 adaptable="true"
222 class="org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage"
223 id="org.yocto.sdk.ide.page"
224 name="%projectProperties.label.0"
225 objectClass="org.eclipse.core.resources.IProject">
226 <filter
227 name="projectNature"
228 value="org.yocto.sdk.ide.YoctoSDKNature">
229 </filter>
230 </page>
231 </extension>
232 <extension
233 point="org.eclipse.ui.commands">
234 <command
235 defaultHandler="org.yocto.sdk.ide.actions.ProfileSwitchHandler"
236 description="%command.targetProfileSwitch.description"
237 id="org.yocto.sdk.ide.targetProfile.switch"
238 name="%command.targetProfileSwitch.name">
239 <commandParameter
240 id="org.eclipse.ui.commands.radioStateParameter"
241 name="%command.targetProfileSwitch.parameter.name"
242 optional="false">
243 </commandParameter>
244 <state
245 class="org.eclipse.ui.handlers.RadioState:project-specific"
246 id="org.eclipse.ui.commands.radioState">
247 </state>
248 </command>
249 </extension>
250 <extension
251 point="org.eclipse.ui.menus">
252 <menuContribution
253 allPopups="true"
254 locationURI="menu:project">
255 <menu
256 id="org.yocto.sdk.ide.profiles.menu"
257 label="%command.targetProfileSwitch.label"
258 tooltip="%command.targetProfileSwitch.description">
259 </menu>
260 </menuContribution>
261 <menuContribution
262 allPopups="true"
263 locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
264 <toolbar
265 id="org.yocto.sdk.ide.profiles.toolbar">
266 <command
267 commandId="org.yocto.sdk.ide.command.reconfigYocto"
268 id="org.yocto.sdk.ide.profiles.toolbar.dropdown"
269 label="%command.targetProfileSwitch.label"
270 mode="FORCE_TEXT"
271 style="pulldown"
272 tooltip="%command.targetProfileSwitch.description">
273 <visibleWhen
274 checkEnabled="false">
275 <and>
276 <count
277 value="1">
278 </count>
279 <iterate
280 operator="and">
281 <adapt
282 type="org.eclipse.core.resources.IResource">
283 <test
284 property="org.eclipse.core.resources.projectNature"
285 value="org.yocto.sdk.ide.YoctoSDKNature">
286 </test>
287 </adapt>
288 </iterate>
289 </and>
290 </visibleWhen>
291 </command>
292 </toolbar>
293 </menuContribution>
294 <menuContribution
295 allPopups="false"
296 locationURI="menu:org.yocto.sdk.ide.profiles.menu">
297 <dynamic
298 class="org.yocto.sdk.ide.ProjectSpecificContributionItem"
299 id="org.yocto.sdk.ide.dynamic.projectSpecific.targetProfile">
300 </dynamic>
301 <separator
302 name="org.yocto.sdk.ide.profiles.separator"
303 visible="true">
304 </separator>
305 <dynamic
306 class="org.yocto.sdk.ide.TargetProfileContributionItem"
307 id="org.yocto.sdk.ide.dynamic.targetProfile">
308 </dynamic>
309 </menuContribution>
310 <menuContribution
311 allPopups="false"
312 locationURI="menu:org.yocto.sdk.ide.profiles.toolbar.dropdown">
313 <dynamic
314 class="org.yocto.sdk.ide.ProjectSpecificContributionItem"
315 id="org.yocto.sdk.ide.dynamic.projectSpecific.targetProfile">
316 </dynamic>
317 <separator
318 name="org.yocto.sdk.ide.profiles.separator"
319 visible="true">
320 </separator>
321 <dynamic
322 class="org.yocto.sdk.ide.TargetProfileContributionItem"
323 id="org.yocto.sdk.ide.dynamic.targetProfile">
324 </dynamic>
325 </menuContribution>
326 </extension>
327</plugin>
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial implementation
10 *******************************************************************************/
11
12package org.yocto.sdk.ide;
13
14import java.util.ArrayList;
15
16import org.eclipse.core.resources.IProject;
17import org.eclipse.jface.action.IContributionItem;
18import org.eclipse.ui.menus.CommandContributionItem;
19import org.eclipse.ui.menus.CommandContributionItemParameter;
20import org.eclipse.ui.services.IServiceLocator;
21import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
22import org.yocto.sdk.ide.actions.ProfileSwitchHandler;
23import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
24
25public class ProjectSpecificContributionItem extends TargetProfileContributionItem {
26 private static final String PROJECT_SPECIFIC_PROFILE =
27 "Preferences.Profile.ProjectSpecific.Profile.Label"; //$NON-NLS-N$
28 private static final String DISABLED_COMMAND_ID = "org.yocto.sdk.ide.command.disabled"; //$NON-NLS-N$
29
30 private IServiceLocator serviceLocator;
31
32 public ProjectSpecificContributionItem() {}
33
34 public ProjectSpecificContributionItem(String id) {
35 super(id);
36 }
37
38 @Override
39 protected IContributionItem[] getContributionItems() {
40 ArrayList<IContributionItem> items = new ArrayList<IContributionItem>();
41
42 IProject project = getSelectedProject(serviceLocator);
43 YoctoUIElement yoctoUIElement = ProjectPreferenceUtils.getElem(project);
44 SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(yoctoUIElement);
45
46 if ((result != SDKCheckResults.SDK_PASS)) {
47 CommandContributionItemParameter parameter = new CommandContributionItemParameter(serviceLocator,
48 null,
49 DISABLED_COMMAND_ID,
50 CommandContributionItem.STYLE_PUSH);
51
52 parameter.label = YoctoSDKMessages.getString(PROJECT_SPECIFIC_PROFILE);
53
54 items.add(new CommandContributionItem(parameter));
55 } else {
56 items.add(super.createProfileItem(serviceLocator, ProfileSwitchHandler.PROJECT_SPECIFIC_PARAMETER,
57 YoctoSDKMessages.getString(PROJECT_SPECIFIC_PROFILE)));
58 }
59
60 updateSelection(serviceLocator);
61
62 return items.toArray(new IContributionItem[items.size()]);
63 }
64
65 @Override
66 public void initialize(IServiceLocator serviceLocator) {
67 this.serviceLocator = serviceLocator;
68 }
69}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13import java.util.ArrayList;
14import java.util.HashMap;
15import java.util.TreeSet;
16
17import org.eclipse.cdt.core.model.ICElement;
18import org.eclipse.cdt.core.model.ICProject;
19import org.eclipse.core.commands.Command;
20import org.eclipse.core.commands.ExecutionException;
21import org.eclipse.core.resources.IProject;
22import org.eclipse.core.resources.IResource;
23import org.eclipse.core.runtime.IAdaptable;
24import org.eclipse.jface.action.IContributionItem;
25import org.eclipse.jface.viewers.ISelection;
26import org.eclipse.jface.viewers.ITreeSelection;
27import org.eclipse.ui.ISelectionService;
28import org.eclipse.ui.actions.CompoundContributionItem;
29import org.eclipse.ui.commands.ICommandService;
30import org.eclipse.ui.handlers.HandlerUtil;
31import org.eclipse.ui.handlers.RadioState;
32import org.eclipse.ui.menus.CommandContributionItem;
33import org.eclipse.ui.menus.CommandContributionItemParameter;
34import org.eclipse.ui.menus.IWorkbenchContribution;
35import org.eclipse.ui.services.IServiceLocator;
36import org.yocto.sdk.ide.actions.ProfileSwitchHandler;
37import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
38import org.yocto.sdk.ide.utils.YoctoSDKUtils;
39
40public class TargetProfileContributionItem extends CompoundContributionItem implements IWorkbenchContribution {
41 private IServiceLocator serviceLocator;
42
43 public TargetProfileContributionItem() {}
44
45 public TargetProfileContributionItem(String id) {
46 super(id);
47 }
48
49 protected CommandContributionItem createProfileItem(IServiceLocator serviceLocator,
50 String parameter, String label) {
51 CommandContributionItemParameter itemParameter;
52 itemParameter = new CommandContributionItemParameter(serviceLocator,
53 null,
54 ProfileSwitchHandler.PROFILE_SWITCH_COMMAND,
55 CommandContributionItem.STYLE_RADIO);
56
57 HashMap<String, String> params = new HashMap<String, String>();
58 params.put(RadioState.PARAMETER_ID, parameter);
59
60 itemParameter.label = label;
61 itemParameter.parameters = params;
62
63 return new CommandContributionItem(itemParameter);
64 }
65
66 @Override
67 protected IContributionItem[] getContributionItems() {
68 TreeSet<String> profiles = YoctoSDKUtils.getProfilesFromDefaultStore().getProfiles();
69 ArrayList<IContributionItem> items = new ArrayList<IContributionItem>();
70
71 for (String profile : profiles) {
72 items.add(createProfileItem(serviceLocator, profile, profile));
73 }
74
75 updateSelection(serviceLocator);
76
77 return items.toArray(new IContributionItem[profiles.size()]);
78 }
79
80 public IProject getSelectedProject(IServiceLocator serviceLocator) {
81 ISelectionService selectionService = (ISelectionService) serviceLocator.getService(ISelectionService.class);
82 ISelection selection = selectionService.getSelection();
83
84 if (selection instanceof ITreeSelection) {
85 Object selectedItem = ((ITreeSelection) selection).getFirstElement();
86 if (selectedItem instanceof IResource) {
87 return ((IResource) selectedItem).getProject();
88 } else if (selectedItem instanceof ICElement) {
89 ICProject cProject = ((ICElement) selectedItem).getCProject();
90 if (cProject != null) {
91 return cProject.getProject();
92 }
93 } else if (selectedItem instanceof IAdaptable) {
94 Object projectObject = ((IAdaptable) selectedItem).getAdapter(IProject.class);
95 if (projectObject != null && projectObject instanceof IProject) {
96 return ((IProject) projectObject);
97 }
98 }
99 }
100
101 return null;
102 }
103
104 @Override
105 public void initialize(IServiceLocator serviceLocator) {
106 this.serviceLocator = serviceLocator;
107 }
108
109 protected void updateSelection(IServiceLocator serviceLocator) {
110 ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class);
111 Command command = commandService.getCommand(ProfileSwitchHandler.PROFILE_SWITCH_COMMAND);
112 IProject project = getSelectedProject(serviceLocator);
113
114 try {
115 if (ProjectPreferenceUtils.getUseProjectSpecificOption(project)) {
116 HandlerUtil.updateRadioState(command, ProfileSwitchHandler.PROJECT_SPECIFIC_PARAMETER);
117 return;
118 }
119
120 String selectedProfile = ProjectPreferenceUtils.getProfiles(project).getSelectedProfile();
121 HandlerUtil.updateRadioState(command, selectedProfile);
122 } catch (ExecutionException e) {
123 // ignore
124 }
125 }
126}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13/* All specific exceptions raised from yocto project should use
14 * this specific exception class.
15 * Currently we only use it for message printing
16 */
17
18public class YoctoGeneralException extends Exception {
19
20 /**
21 *
22 */
23 private static final long serialVersionUID = 6600798490815526253L;
24 /**
25 *
26 */
27
28 public YoctoGeneralException(String message)
29 {
30 super(message);
31 }
32}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13import java.util.Comparator;
14import java.util.StringTokenizer;
15import java.util.TreeSet;
16
17import org.yocto.sdk.ide.preferences.PreferenceConstants;
18
19public class YoctoProfileElement {
20 private TreeSet<String> profiles = new TreeSet<String>(new Comparator<String>() {
21
22 @Override
23 public int compare(String o1, String o2) {
24 int strcompare = o1.compareTo(o2);
25
26 if (strcompare == 0) {
27 return strcompare;
28 }
29
30 // Standard profile always less than anything else
31 if (o1.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) {
32 return -1;
33 }
34
35 if (o2.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) {
36 return 1;
37 }
38
39 return strcompare;
40 }
41 });
42
43 private String selectedProfile;
44
45 public YoctoProfileElement(String profilesString, String selectedProfile) {
46 setProfilesFromString(profilesString);
47 this.selectedProfile = selectedProfile;
48 }
49
50 public void addProfile(String profile) {
51 this.profiles.add(profile);
52 }
53
54 public boolean contains(String newText) {
55 return profiles.contains(newText);
56 }
57
58 public TreeSet<String> getProfiles() {
59 return profiles;
60 }
61
62 public String getProfilesAsString() {
63 String profileString = "";
64
65 for (String profile : profiles) {
66 profileString += "\"" + profile + "\",";
67 }
68 return profileString.substring(0, profileString.length() - 1);
69 }
70
71 public String getSelectedProfile() {
72 return selectedProfile;
73 }
74
75 public void remove(String profile) {
76 this.profiles.remove(profile);
77 }
78
79 public void rename(String oldProfileName, String newProfileName) {
80 this.remove(oldProfileName);
81 this.addProfile(newProfileName);
82
83 if (selectedProfile.equals(oldProfileName)) {
84 selectedProfile = newProfileName;
85 }
86 }
87
88 public void setProfiles(TreeSet<String> profiles) {
89 this.profiles = profiles;
90 }
91
92 public void setProfilesFromString(String profilesString) {
93 StringTokenizer tokenizer = new StringTokenizer(profilesString, ",");
94
95 while (tokenizer.hasMoreElements()) {
96 String config = (String) tokenizer.nextElement();
97 profiles.add(config.replace("\"", ""));
98 }
99 }
100
101 public void setSelectedProfile(String selectedProfile) {
102 this.selectedProfile = selectedProfile;
103 }
104}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13import org.eclipse.jface.dialogs.IDialogConstants;
14import org.eclipse.jface.dialogs.InputDialog;
15import org.eclipse.jface.dialogs.MessageDialog;
16import org.eclipse.jface.preference.PreferencePage;
17import org.eclipse.swt.SWT;
18import org.eclipse.swt.events.MouseAdapter;
19import org.eclipse.swt.events.MouseEvent;
20import org.eclipse.swt.layout.GridData;
21import org.eclipse.swt.layout.GridLayout;
22import org.eclipse.swt.widgets.Button;
23import org.eclipse.swt.widgets.Combo;
24import org.eclipse.swt.widgets.Composite;
25import org.eclipse.swt.widgets.Event;
26import org.eclipse.swt.widgets.Group;
27import org.eclipse.swt.widgets.Listener;
28import org.yocto.sdk.ide.preferences.PreferenceConstants;
29import org.yocto.sdk.ide.preferences.ProfileNameInputValidator;
30import org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage;
31import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage;
32
33public class YoctoProfileSetting {
34 private static final String PROFILES_TITLE = "Preferences.Profiles.Title";
35 private static final String NEW_PROFILE_TITLE = "Preferences.Profile.New.Title";
36 private static final String RENAME_PROFILE_TITLE = "Preferences.Profile.Rename.Title";
37 private static final String RENAME_DIALOG_TITLE = "Preferences.Profile.Rename.Dialog.Title";
38 private static final String RENAME_DIALOG_MESSAGE = "Preferences.Profile.Rename.Dialog.Message";
39 private static final String REMOVE_PROFILE_TITLE = "Preferences.Profile.Remove.Title";
40 private static final String REMOVE_DIALOG_TITLE = "Preferences.Profile.Remove.Dialog.Title";
41 private static final String REMOVE_DIALOG_MESSAGE = "Preferences.Profile.Remove.Dialog.Message";
42 private static final String MODIFY_STANDARD_TITLE = "Preferences.Profile.Standard.Modification.Title";
43 private static final String MODIFY_STANDARD_MESSAGE = "Preferences.Profile.Standard.Modification.Message";
44
45 private Combo sdkConfigsCombo;
46 private Button btnConfigRename;
47 private Button btnConfigRemove;
48 private Button btnConfigSaveAs;
49
50 private YoctoProfileElement profileElement;
51 private PreferencePage preferencePage;
52 private final boolean editable;
53
54 public YoctoProfileSetting(YoctoProfileElement profileElement, PreferencePage preferencePage, final boolean editable) {
55 this.profileElement = profileElement;
56 this.preferencePage = preferencePage;
57 this.editable = editable;
58 }
59
60 public void createComposite(Composite composite) {
61 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
62 GridLayout layout = new GridLayout(2, false);
63
64 Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE);
65 layout = new GridLayout(1, false);
66 if (isEditable()) {
67 layout.numColumns = 3;
68 }
69
70 storeYoctoConfigurationsGroup.setLayout(layout);
71 gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
72 gd.horizontalSpan = 2;
73 storeYoctoConfigurationsGroup.setLayoutData(gd);
74 storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROFILES_TITLE));
75
76 sdkConfigsCombo = new Combo(storeYoctoConfigurationsGroup, SWT.READ_ONLY);
77 addConfigs(sdkConfigsCombo);
78 sdkConfigsCombo.select(sdkConfigsCombo.indexOf(profileElement.getSelectedProfile()));
79 sdkConfigsCombo.setLayout(new GridLayout(2, false));
80 sdkConfigsCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
81
82 Listener selectionListener = new Listener() {
83 @Override
84 public void handleEvent(Event event) {
85 Object source = event.widget;
86 if (!(source instanceof Combo)) {
87 return;
88 }
89
90 Combo sdkCombo = (Combo) source;
91 if (sdkCombo.getSelectionIndex() < 0) {
92 return;
93 }
94
95 String selectedItem = sdkCombo.getItem(sdkCombo.getSelectionIndex());
96 profileElement.setSelectedProfile(selectedItem);
97
98 if (preferencePage instanceof YoctoSDKPreferencePage) {
99 ((YoctoSDKPreferencePage) preferencePage).switchProfile(selectedItem);
100 } else if (preferencePage instanceof YoctoSDKProjectPropertyPage) {
101 ((YoctoSDKProjectPropertyPage) preferencePage).switchProfile(selectedItem);
102 }
103 }
104 };
105
106 sdkConfigsCombo.addListener(SWT.Selection, selectionListener);
107 sdkConfigsCombo.addListener(SWT.Modify, selectionListener);
108
109 if (isEditable()) {
110 createSaveAsProfileButton(storeYoctoConfigurationsGroup);
111 createRenameButton(storeYoctoConfigurationsGroup);
112 createRemoveButton(storeYoctoConfigurationsGroup);
113 }
114 }
115
116 private void createSaveAsProfileButton(Group storeYoctoConfigurationsGroup) {
117 btnConfigSaveAs = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD);
118 btnConfigSaveAs.setText(YoctoSDKMessages.getString(NEW_PROFILE_TITLE));
119 btnConfigSaveAs.addMouseListener(new MouseAdapter() {
120 @Override
121 public void mouseDown(MouseEvent e) {
122 if (preferencePage instanceof YoctoSDKPreferencePage) {
123 ((YoctoSDKPreferencePage) preferencePage).performSaveAs();
124 }
125 }
126 });
127 }
128
129 private void createRemoveButton(Group storeYoctoConfigurationsGroup) {
130 btnConfigRemove = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD);
131 btnConfigRemove.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false, 3, 1));
132 btnConfigRemove.setText(YoctoSDKMessages.getString(REMOVE_PROFILE_TITLE));
133 btnConfigRemove.addMouseListener(new MouseAdapter() {
134 @Override
135 public void mouseDown(MouseEvent e) {
136 saveChangesOnCurrentProfile();
137 int selectionIndex = sdkConfigsCombo.getSelectionIndex();
138 String selectedItem = sdkConfigsCombo.getItem(selectionIndex);
139
140 if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) {
141 MessageDialog.openInformation(null,
142 YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE),
143 YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE));
144 return;
145 }
146
147 boolean deleteConfirmed =
148 MessageDialog.openConfirm(null,
149 YoctoSDKMessages.getString(REMOVE_DIALOG_TITLE),
150 YoctoSDKMessages.getFormattedString(REMOVE_DIALOG_MESSAGE, selectedItem));
151
152 if (!deleteConfirmed) {
153 return;
154 }
155
156 sdkConfigsCombo.select(0);
157 sdkConfigsCombo.remove(selectionIndex);
158 profileElement.remove(selectedItem);
159
160 if (preferencePage instanceof YoctoSDKPreferencePage) {
161 ((YoctoSDKPreferencePage) preferencePage).deleteProfile(selectedItem);
162 }
163 }
164 });
165 }
166
167 private void createRenameButton(Group storeYoctoConfigurationsGroup) {
168 btnConfigRename = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD);
169 btnConfigRename.setText(YoctoSDKMessages.getString(RENAME_PROFILE_TITLE));
170 btnConfigRename.addMouseListener(new MouseAdapter() {
171 @Override
172 public void mouseDown(MouseEvent e) {
173 saveChangesOnCurrentProfile();
174 int selectedIndex = sdkConfigsCombo.getSelectionIndex();
175 final String selectedItem = sdkConfigsCombo.getItem(selectedIndex);
176
177 if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) {
178 MessageDialog.openInformation(null,
179 YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE),
180 YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE));
181 return;
182 }
183
184 InputDialog profileNameDialog =
185 new InputDialog(null,
186 YoctoSDKMessages.getString(RENAME_DIALOG_TITLE),
187 YoctoSDKMessages.getString(RENAME_DIALOG_MESSAGE),
188 null,
189 new ProfileNameInputValidator(profileElement, selectedItem));
190
191 int returnCode = profileNameDialog.open();
192 if (returnCode == IDialogConstants.CANCEL_ID) {
193 return;
194 }
195
196 String newProfileName = profileNameDialog.getValue();
197 profileElement.rename(selectedItem, profileNameDialog.getValue());
198
199 if (preferencePage instanceof YoctoSDKPreferencePage) {
200 ((YoctoSDKPreferencePage) preferencePage).renameProfile(selectedItem, newProfileName);
201 }
202
203 sdkConfigsCombo.setItem(selectedIndex, newProfileName);
204 sdkConfigsCombo.select(selectedIndex);
205 }
206 });
207 }
208
209 private void saveChangesOnCurrentProfile() {
210 preferencePage.performOk();
211 }
212
213 private void addConfigs(Combo combo) {
214 for (String profile : profileElement.getProfiles()) {
215 combo.add(profile);
216 }
217 }
218
219 public void addProfile(String profileName) {
220 int index = sdkConfigsCombo.getItemCount();
221 sdkConfigsCombo.add(profileName, index);
222 sdkConfigsCombo.select(index);
223 }
224
225 public void setUIFormEnabledState(boolean isEnabled) {
226 setButtonsEnabledState(isEnabled);
227 sdkConfigsCombo.setEnabled(isEnabled);
228 }
229
230 public YoctoProfileElement getCurrentInput() {
231 return profileElement;
232 }
233
234 public void setButtonsEnabledState(boolean isEnabled) {
235 if (isEditable()) {
236 btnConfigRename.setEnabled(isEnabled);
237 btnConfigRemove.setEnabled(isEnabled);
238 btnConfigSaveAs.setEnabled(isEnabled);
239 }
240 }
241
242 private boolean isEditable() {
243 return editable;
244 }
245}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13import org.eclipse.jface.preference.PreferencePage;
14import org.eclipse.swt.SWT;
15import org.eclipse.swt.events.SelectionEvent;
16import org.eclipse.swt.events.SelectionListener;
17import org.eclipse.swt.layout.GridData;
18import org.eclipse.swt.layout.GridLayout;
19import org.eclipse.swt.widgets.Button;
20import org.eclipse.swt.widgets.Composite;
21import org.eclipse.swt.widgets.Group;
22import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage;
23
24public class YoctoProjectSpecificSetting {
25 private static final String PROJECT_SPECIFIC_TITLE = "Preferences.Profile.ProjectSpecific.Title";
26 private static final String PROJECT_SPECIFIC_GROUP_TITLE = "Preferences.Profile.ProjectSpecific.Group.Title";
27
28 private YoctoProfileSetting yoctoConfigurationsSetting;
29 private YoctoUISetting yoctoUISetting;
30
31 private Button btnUseProjectSpecificSettingsCheckbox;
32 private PreferencePage preferencePage;
33
34 public YoctoProjectSpecificSetting(YoctoProfileSetting yoctoConfigurationsSetting,
35 YoctoUISetting yoctoUISetting, PreferencePage preferencePage) {
36 this.yoctoConfigurationsSetting = yoctoConfigurationsSetting;
37 this.yoctoUISetting = yoctoUISetting;
38 this.preferencePage = preferencePage;
39 }
40
41 public void createComposite(Composite composite) {
42 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
43 GridLayout layout = new GridLayout(2, false);
44
45 Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE);
46 layout = new GridLayout(2, false);
47 storeYoctoConfigurationsGroup.setLayout(layout);
48 gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
49 gd.horizontalSpan = 2;
50 storeYoctoConfigurationsGroup.setLayoutData(gd);
51 storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_GROUP_TITLE));
52
53 btnUseProjectSpecificSettingsCheckbox = new Button(storeYoctoConfigurationsGroup, SWT.CHECK);
54 btnUseProjectSpecificSettingsCheckbox.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_TITLE));
55 btnUseProjectSpecificSettingsCheckbox.addSelectionListener(new SelectionListener() {
56 @Override
57 public void widgetSelected(SelectionEvent e) {
58 if (btnUseProjectSpecificSettingsCheckbox.getSelection()){
59 yoctoConfigurationsSetting.setUIFormEnabledState(false);
60 yoctoUISetting.setUIFormEnabledState(true);
61
62 if (preferencePage instanceof YoctoSDKProjectPropertyPage) {
63 ((YoctoSDKProjectPropertyPage) preferencePage).switchToProjectSpecificProfile();
64 }
65 } else {
66 yoctoConfigurationsSetting.setUIFormEnabledState(true);
67 yoctoConfigurationsSetting.setButtonsEnabledState(false);
68 yoctoUISetting.setUIFormEnabledState(false);
69
70 if (preferencePage instanceof YoctoSDKProjectPropertyPage) {
71 ((YoctoSDKProjectPropertyPage) preferencePage).switchToSelectedProfile();
72 }
73 }
74 }
75
76 @Override
77 public void widgetDefaultSelected(SelectionEvent e) {}
78 });
79 }
80
81 public void setUseProjectSpecificSettings(boolean isUsingProjectSpecificSettings) {
82 btnUseProjectSpecificSettingsCheckbox.setSelection(isUsingProjectSpecificSettings);
83 }
84
85 public boolean isUsingProjectSpecificSettings() {
86 return btnUseProjectSpecificSettingsCheckbox.getSelection();
87 }
88}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * Copyright (c) 2013 BMW Car IT GmbH.
4 *
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors:
11 * Intel - initial API and implementation
12 * BMW Car IT - include error and advice messages with check results
13 *******************************************************************************/
14package org.yocto.sdk.ide;
15
16import java.io.BufferedReader;
17import java.io.File;
18import java.io.FileReader;
19import java.io.FilenameFilter;
20import java.io.IOException;
21import java.io.InputStream;
22import java.io.InputStreamReader;
23
24import org.eclipse.jface.preference.IPreferenceStore;
25import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
26import org.yocto.sdk.ide.utils.YoctoSDKUtils;
27import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants;
28
29public class YoctoSDKChecker {
30 private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"};
31 private static final String SYSROOTS_DIR = "sysroots";
32 private static final String SDK_VERSION = "OECORE_SDK_VERSION";
33
34 public static enum SDKCheckResults {
35 SDK_PASS("", false),
36 TOOLCHAIN_LOCATION_EMPTY(
37 "Poky.SDK.Location.Empty", true),
38 TOOLCHAIN_LOCATION_NONEXIST(
39 "Poky.SDK.Location.Nonexist", true),
40 SDK_TARGET_EMPTY(
41 "Poky.SDK.Target.Empty", true),
42 SDK_NO_TARGET_SELECTED(
43 "Poky.SDK.No.Target.Selected", false),
44 SYSROOT_EMPTY(
45 "Poky.Sysroot.Empty", true),
46 SYSROOT_NONEXIST(
47 "Poky.Sysroot.Nonexist", true),
48 QEMU_KERNEL_EMPTY(
49 "Poky.Qemu.Kernel.Empty", true),
50 QEMU_KERNEL_NONEXIST(
51 "Poky.Qemu.Kernel.Nonexist", true),
52 WRONG_ADT_VERSION(
53 "Poky.ADT.Sysroot.Wrongversion", false),
54 ENV_SETUP_SCRIPT_NONEXIST(
55 "Poky.Env.Script.Nonexist", false),
56 TOOLCHAIN_NO_SYSROOT(
57 "Poky.Toolchain.No.Sysroot", false),
58 TOOLCHAIN_HOST_MISMATCH(
59 "Poky.Toolchain.Host.Mismatch", false);
60
61 private static final String DEFAULT_ADVICE = "Default.Advice";
62 private static final String ADVICE_SUFFIX = ".Advice";
63
64 private final String messageID;
65 private final boolean addDefaultAdvice;
66
67 private SDKCheckResults(final String messageID, final boolean addDefaultAdvice) {
68 this.messageID = messageID;
69 this.addDefaultAdvice = addDefaultAdvice;
70 }
71
72 public String getMessage() {
73 return YoctoSDKMessages.getString(messageID);
74 }
75
76 public String getAdvice() {
77 String advice = YoctoSDKMessages.getString(messageID + ADVICE_SUFFIX);
78
79 if (addDefaultAdvice) {
80 advice += YoctoSDKMessages.getString(DEFAULT_ADVICE);
81 }
82
83 return advice;
84 }
85 };
86
87 public static enum SDKCheckRequestFrom {
88 Wizard("Poky.SDK.Error.Origin.Wizard"),
89 Menu("Poky.SDK.Error.Origin.Menu"),
90 Preferences("Poky.SDK.Error.Origin.Preferences"),
91 Other("Poky.SDK.Error.Origin.Other");
92
93 private final String errorMessageID;
94
95 private SDKCheckRequestFrom(final String errorMessageID) {
96 this.errorMessageID = errorMessageID;
97 }
98
99 public String getErrorMessage() {
100 return YoctoSDKMessages.getString(errorMessageID);
101 }
102 };
103
104 public static void checkIfGloballySelectedYoctoProfileIsValid() throws YoctoGeneralException {
105 YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
106 IPreferenceStore selectedProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
107 YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selectedProfileStore);
108
109 SDKCheckResults result = checkYoctoSDK(elem);
110 if (result != SDKCheckResults.SDK_PASS){
111 String strErrorMsg = getErrorMessage(result, SDKCheckRequestFrom.Wizard);
112 throw new YoctoGeneralException(strErrorMsg);
113 }
114 }
115
116 public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) {
117 if (elem.getStrToolChainRoot().isEmpty())
118 return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY;
119 else {
120 File fToolChain = new File(elem.getStrToolChainRoot());
121 if (!fToolChain.exists())
122 return SDKCheckResults.TOOLCHAIN_LOCATION_NONEXIST;
123 }
124
125 if (elem.getStrSysrootLoc().isEmpty()) {
126 return SDKCheckResults.SYSROOT_EMPTY;
127 } else {
128 File fSysroot = new File(elem.getStrSysrootLoc());
129 if (!fSysroot.exists())
130 return SDKCheckResults.SYSROOT_NONEXIST;
131 }
132
133 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
134 //Check for SDK compatible with the host arch
135 String platform = getPlatformArch();
136 String sysroot_dir_str = elem.getStrToolChainRoot() + "/" + SYSROOTS_DIR;
137 File sysroot_dir = new File(sysroot_dir_str);
138 if (!sysroot_dir.exists())
139 return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
140
141 String toolchain_host_arch = null;
142
143 try {
144 toolchain_host_arch = findHostArch(sysroot_dir);
145 } catch(NullPointerException e) {
146 return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
147 }
148
149 if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
150 if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
151 return SDKCheckResults.TOOLCHAIN_HOST_MISMATCH;
152 }
153 }
154
155 if (elem.getStrTarget().isEmpty() && elem.getStrTargetsArray().length > 0) {
156 return SDKCheckResults.SDK_NO_TARGET_SELECTED;
157 }
158
159 if (elem.getIntTargetIndex() < 0 || elem.getStrTarget().isEmpty()) {
160 //if this is poky tree mode, prompt user whether bitbake meta-ide-support is executed?
161 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE)
162 return SDKCheckResults.ENV_SETUP_SCRIPT_NONEXIST;
163 else
164 return SDKCheckResults.SDK_TARGET_EMPTY;
165 } else {
166 String sFileName;
167
168 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
169 sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
170 } else {
171 //POKY TREE Mode
172 sFileName = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX +
173 YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
174 }
175
176 try {
177 File file = new File(sFileName);
178 boolean bVersion = false;
179
180 if (file.exists()) {
181 BufferedReader input = new BufferedReader(new FileReader(file));
182
183 try {
184 String line = null;
185
186 while ((line = input.readLine()) != null) {
187 if (line.startsWith("export "+ SDK_VERSION)) {
188 int beginIndex = 2;
189 String sVersion = "";
190 for (;;) {
191 char cValue = line.charAt(line.indexOf('=') + beginIndex++);
192
193 if ((cValue != '.') && (!Character.isDigit(cValue)) && (cValue != '+'))
194 break;
195 else
196 sVersion += String.valueOf(cValue);
197 }
198
199 for (int i = 0; i < saInvalidVer.length; i++) {
200 if (!sVersion.equals(saInvalidVer[i])) {
201 bVersion = true;
202 break;
203 }
204 }
205
206 break;
207 }
208 }
209 } finally {
210 input.close();
211 }
212
213 if (!bVersion)
214 return SDKCheckResults.WRONG_ADT_VERSION;
215 }
216 } catch (IOException e) {
217 e.printStackTrace();
218 }
219 }
220
221 if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
222 if (elem.getStrQemuKernelLoc().isEmpty()) {
223 return SDKCheckResults.QEMU_KERNEL_EMPTY;
224 } else {
225 File fQemuKernel = new File(elem.getStrQemuKernelLoc());
226 if (!fQemuKernel.exists())
227 return SDKCheckResults.QEMU_KERNEL_NONEXIST;
228 }
229 }
230
231 return SDKCheckResults.SDK_PASS;
232 }
233
234 public static String getErrorMessage(SDKCheckResults result, SDKCheckRequestFrom from) {
235 String strErrorMsg;
236 strErrorMsg = from.getErrorMessage();
237 strErrorMsg += "\n" + result.getMessage();
238 strErrorMsg += "\n" + result.getAdvice();
239
240 return strErrorMsg;
241 }
242
243 private static String getPlatformArch() {
244 String value = null;
245 try
246 {
247 Runtime rt = Runtime.getRuntime();
248 Process proc = rt.exec("uname -m");
249 InputStream stdin = proc.getInputStream();
250 InputStreamReader isr = new InputStreamReader(stdin);
251 BufferedReader br = new BufferedReader(isr);
252 String line = null;
253
254 while ( (line = br.readLine()) != null) {
255 value = line;
256 }
257 proc.waitFor();
258
259 } catch (Throwable t) {
260 t.printStackTrace();
261 }
262 return value;
263 }
264
265 private static String findHostArch(File sysroot_dir) {
266 FilenameFilter nativeFilter = new FilenameFilter() {
267 public boolean accept(File dir, String name) {
268 if (name.endsWith("sdk-linux")) {
269 return true;
270 } else {
271 return false;
272 }
273 }
274 };
275
276 File[] files = sysroot_dir.listFiles(nativeFilter);
277 String arch = null;
278
279 for (File file : files) {
280 if (file.isDirectory()) {
281 String path = file.getName();
282 String[] subPath = path.split("-");
283 arch = subPath[0];
284 } else {
285 continue;
286 }
287 }
288
289 return arch;
290 }
291}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13import java.text.MessageFormat;
14import java.util.MissingResourceException;
15import java.util.ResourceBundle;
16
17public class YoctoSDKMessages {
18 private static final String RESOURCE_BUNDLE= YoctoSDKMessages.class.getName();
19 private static ResourceBundle fgResourceBundle;
20 static {
21 try {
22 fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
23 } catch (MissingResourceException x) {
24 fgResourceBundle = null;
25 }
26 }
27
28 private YoctoSDKMessages() {
29 }
30
31 public static String getString(String key) {
32 try {
33 return fgResourceBundle.getString(key);
34 } catch (MissingResourceException e) {
35 return '!' + key + '!';
36 } catch (NullPointerException e) {
37 return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
38 }
39 }
40
41 /**
42 * Gets a string from the resource bundle and formats it with the argument
43 *
44 * @param key the string used to get the bundle value, must not be null
45 */
46 public static String getFormattedString(String key, Object arg) {
47 return MessageFormat.format(getString(key), new Object[] { arg });
48 }
49
50 /**
51 * Gets a string from the resource bundle and formats it with arguments
52 */
53 public static String getFormattedString(String key, Object[] args) {
54 return MessageFormat.format(getString(key), args);
55 }
56}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 * BMW Car IT - added keys for target profiles
11 *******************************************************************************/
12Wizard.SDK.Warning.Title = Invalid Yocto Project ADT Location
13Wizard.SDK.Error.ProjectName = Project name "{0}" is invalid! \nNone of these characters are accepted inside project names: whitespaces, {1}
14
15Poky.SDK.Location.Empty = Specified Toolchain Root Location is empty.
16Poky.SDK.Location.Empty.Advice = You need specify Toolchain Root Location before building any project.
17Poky.SDK.Location.Nonexist = Specified SDK toolchain directory does not exist.
18Poky.SDK.Location.Nonexist.Advice = Please specify a valid toolchain directory.
19Poky.SDK.Target.Empty = Specified location does not contain environment script file.
20Poky.SDK.Target.Empty.Advice = You need specify Target Architecture before building any project.
21Poky.SDK.No.Target.Selected = Target Architecture is not defined.
22Poky.SDK.No.Target.Selected.Advice = Please choose a Target Architecture.
23Poky.Sysroot.Empty = Specified Sysroot Location is empty.
24Poky.Sysroot.Empty.Advice = You need specify Sysroot Location before building any project.
25Poky.Sysroot.Nonexist = Specified Sysroot Location does not exist.
26Poky.Sysroot.Nonexist.Advice = You need specify a valid Sysroot Location before building any project.
27Poky.Qemu.Kernel.Empty = Specified QEMU kernel location is emtpy.
28Poky.Qemu.Kernel.Empty.Advice = You need specify QEMU kernel image file Location before building any project.
29Poky.Qemu.Kernel.Nonexist = Specified QEMU kernel image file does not exist.
30Poky.Qemu.Kernel.Empty.Advice = You need specify a valid QEMU kernel image file before building any project.
31Poky.ADT.Sysroot.Wrongversion = The ADT version you're using is too old.
32Poky.ADT.Sysroot.Wrongversion.Advice = OECORE related items are not found in environment setup files.\nPlease upgrade to our latest ADT Version!
33Poky.Env.Script.Nonexist = Specified toolchain directory does not contain a toolchain generated with "bitbake meta-ide-support".
34Poky.Env.Script.Nonexist.Advice = Please run "bitbake meta-ide-support" to build the toolchain.
35Poky.Toolchain.No.Sysroot = Specified Toolchain Root Location does not contain a sysroot directory.
36Poky.Toolchain.No.Sysroot.Advice = Please install a valid toolchain sysroot.
37Poky.Toolchain.Host.Mismatch = Toolchain and host arch mismatch.
38Poky.Toolchain.Host.Mismatch.Advice = Make sure you use 32bit toolchain for 32bit host and same for 64bit machines!
39
40Default.Advice = \nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings.
41Poky.SDK.Revalidation.Message = Please apply the changes to revalidate.
42
43Poky.SDK.Error.Origin.Wizard = Yocto Wizard Configuration Error:
44Poky.SDK.Error.Origin.Menu = Yocto Menu Configuration Error:
45Poky.SDK.Error.Origin.Preferences = Yocto Preferences Configuration Error:
46Poky.SDK.Error.Origin.Other = Yocto Configuration Error:
47
48Menu.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.
49Menu.SDK.Console.Deploy.Action.Message = \nDeploying {0} to {1} ...\n
50Menu.SDK.Console.Deploy.Extract.Message = \nExtracting {0} into {1} ...\n
51Menu.SDK.Console.Deploy.Success.Message = \nThe project {0} has been successfully deployed to {1}\n
52Menu.SDK.Console.Deploy.Fail.Message = \nDeploying the project {0} to {1} failed!\n
53Menu.SDK.Console.Undeploy.Success.Message = \nThe project {0} has been successfully undeployed from {1}\n
54Menu.SDK.Console.Undeploy.Fail.Message = \nUndeploying the project {0} from {1} failed!\n
55
56
57Menu.Deploy.Title = Deploy {0} to ...
58Menu.Deploy.Message = Please specify a directory:
59
60Menu.Undeploy.Title = Undeploy {0} from ...
61Menu.Undeploy.Message = Please specify a directory:
62
63
64Preferences.Yocto.Config.Name = Preferences:
65Preferences.SDK.Target.name = Target Preferences:
66Preferences.SDK.Informing.Title = Yocto Project ADT has been successfully set up.
67Preferences.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!
68
69Preferences.Profile.Validator.InvalidName.Comma = Warning: The profile name cannot contain a comma (,).
70Preferences.Profile.Validator.InvalidName.Quote = Warning: The profile name cannot contain a double quote (\").
71Preferences.Profile.Validator.InvalidName.Empty = Please provide a new profile name.
72Preferences.Profile.Validator.InvalidName.Exists = Warning: The profile already exists.
73
74Preferences.Profiles.Title = Cross development profiles:
75Preferences.Profile.New.Title = Save as ...
76Preferences.Profile.New.Dialog.Title = Save as new cross development profile
77Preferences.Profile.New.Dialog.Message = Please input a profile name.
78Preferences.Profile.Rename.Title = Rename
79Preferences.Profile.Rename.Dialog.Title = Rename cross development profile
80Preferences.Profile.Rename.Dialog.Message = Please input a new profile name.
81Preferences.Profile.Remove.Title = Remove
82Preferences.Profile.Remove.Dialog.Title = Remove cross development profile
83Preferences.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.
84Preferences.Profile.Update.Dialog.Title = Update cross development profile
85Preferences.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.
86Preferences.Profile.Standard.Modification.Title = Modify standard cross development profile
87Preferences.Profile.Standard.Modification.Message = Standard cross development profile cannot be removed or renamed.
88
89Preferences.Profile.ProjectSpecific.Title = Use project specific settings
90Preferences.Profile.ProjectSpecific.Group.Title = Project specific settings:
91Preferences.Profile.ProjectSpecific.Profile.Label = Project specific profile
92
93Preferences.Profile.ProjectSpecific.Error.Title = Could not change to project specific target profile
94Preferences.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.
95
96Console.SDK.Name = Yocto Project Console
97
98LaunchConfig.Type.Name = org.eclipse.ui.externaltools.ProgramLaunchConfigurationType
99LaunchConfig.LaunchGroup.Value = org.eclipse.ui.externaltools.launchGroup
100LaunchConfig.LaunchGroup.Attr = org.eclipse.debug.ui.favoriteGroups
101LaunchConfig.BuildScope.Attr = org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE
102LaunchConfig.BuildScope.Value = ${projects:}
103LaunchConfig.Location.Attr = org.eclipse.ui.externaltools.ATTR_LOCATION
104LaunchConfig.Arguments.Attr = org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS;
105
106AutotoolsProjectPostProcess.WrongProjectNature = {0} is not an Autotools project
107AutotoolsProjectPostProcess.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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13import java.lang.reflect.InvocationTargetException;
14
15import org.eclipse.core.resources.ResourcesPlugin;
16import org.eclipse.core.runtime.CoreException;
17import org.eclipse.core.runtime.IStatus;
18import org.eclipse.core.runtime.Status;
19import org.eclipse.core.runtime.preferences.InstanceScope;
20import org.eclipse.jface.preference.IPreferenceStore;
21import org.eclipse.swt.widgets.Shell;
22import org.eclipse.ui.IWorkbenchWindow;
23import org.eclipse.ui.plugin.AbstractUIPlugin;
24import org.eclipse.ui.preferences.ScopedPreferenceStore;
25import org.osgi.framework.BundleContext;
26
27/**
28 * The activator class controls the plug-in life cycle
29 */
30public class YoctoSDKPlugin extends AbstractUIPlugin {
31
32 // The plug-in ID
33 public static final String PLUGIN_ID = "org.yocto.sdk.ide";
34
35 // The shared instance
36 private static YoctoSDKPlugin plugin;
37
38 /**
39 * The constructor
40 */
41 public YoctoSDKPlugin() {
42 }
43
44 /*
45 * (non-Javadoc)
46 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
47 */
48 public void start(BundleContext context) throws Exception {
49 super.start(context);
50 plugin = this;
51 }
52
53 /*
54 * (non-Javadoc)
55 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
56 */
57 public void stop(BundleContext context) throws Exception {
58 plugin = null;
59 super.stop(context);
60 }
61
62 /**
63 * Returns the shared instance
64 *
65 * @return the shared instance
66 */
67 public static YoctoSDKPlugin getDefault() {
68 return plugin;
69 }
70
71 public static IPreferenceStore getProfilePreferenceStore(String profileName) {
72 int profileIdentifier = profileName.hashCode();
73
74 return new ScopedPreferenceStore(InstanceScope.INSTANCE,getUniqueIdentifier() + "." + profileIdentifier);
75 }
76
77 public static void log(IStatus status) {
78 ResourcesPlugin.getPlugin().getLog().log(status);
79 }
80
81 public static void log(Throwable e) {
82 if (e instanceof InvocationTargetException)
83 e = ((InvocationTargetException) e).getTargetException();
84 IStatus status = null;
85 if (e instanceof CoreException)
86 status = ((CoreException) e).getStatus();
87 else
88 status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e);
89 log(status);
90 }
91
92 public static void logErrorMessage(String message) {
93 log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
94 }
95
96 /**
97 * Returns active shell.
98 */
99 public static Shell getActiveWorkbenchShell() {
100 IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
101 if (window != null) {
102 return window.getShell();
103 }
104 return null;
105 }
106
107 public static String getUniqueIdentifier() {
108 if (getDefault() == null) {
109 // If the default instance is not yet initialized,
110 // return a static identifier. This identifier must
111 // match the plugin id defined in plugin.xml
112 return PLUGIN_ID;
113 }
114 return getDefault().getBundle().getSymbolicName();
115 }
116}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13public class YoctoUIElement {
14 public enum PokyMode
15 {
16 POKY_SDK_MODE,
17 POKY_TREE_MODE
18 };
19 public enum DeviceMode
20 {
21 QEMU_MODE,
22 DEVICE_MODE
23 };
24
25 private String strTarget;
26 private String[] strTargetsArray;
27 private DeviceMode enumDeviceMode;
28 private String strQemuKernelLoc;
29 private String strQemuOption;
30 private String strSysrootLoc;
31 private PokyMode enumPokyMode;
32 private String strToolChainRoot;
33 private int intTargetIndex;
34
35 public YoctoUIElement()
36 {
37 this.enumDeviceMode = DeviceMode.QEMU_MODE;
38 this.enumPokyMode = PokyMode.POKY_SDK_MODE;
39 this.strToolChainRoot = "";
40 this.strQemuKernelLoc = "";
41 this.strQemuOption = "";
42 this.strSysrootLoc = "";
43 this.intTargetIndex = -1;
44 this.strTarget = "";
45 }
46
47 public PokyMode getEnumPokyMode() {
48 return enumPokyMode;
49 }
50 public void setEnumPokyMode(PokyMode enumPokyMode) {
51 this.enumPokyMode = enumPokyMode;
52 }
53 public String getStrToolChainRoot() {
54 return strToolChainRoot;
55 }
56 public void setStrToolChainRoot(String strToolChainRoot) {
57 this.strToolChainRoot = strToolChainRoot;
58 }
59 public int getIntTargetIndex() {
60 if ((this.strTargetsArray != null) && (this.strTargetsArray.length == 1))
61 return 0;
62 return intTargetIndex;
63 }
64 public void setIntTargetIndex(int intTargetIndex) {
65 this.intTargetIndex = intTargetIndex;
66 }
67 public String getStrTarget() {
68 return strTarget;
69 }
70 public void setStrTarget(String strTarget) {
71 this.strTarget = strTarget;
72 }
73 public String[] getStrTargetsArray() {
74 return strTargetsArray;
75 }
76 public void setStrTargetsArray(String[] strTargetsArray) {
77 this.strTargetsArray = strTargetsArray;
78 }
79 public DeviceMode getEnumDeviceMode() {
80 return enumDeviceMode;
81 }
82 public void setEnumDeviceMode(DeviceMode enumDeviceMode) {
83 this.enumDeviceMode = enumDeviceMode;
84 }
85 public String getStrQemuKernelLoc() {
86 return strQemuKernelLoc;
87 }
88 public void setStrQemuKernelLoc(String strQemuKernelLoc) {
89 this.strQemuKernelLoc = strQemuKernelLoc;
90 }
91 public String getStrQemuOption() {
92 return strQemuOption;
93 }
94 public void setStrQemuOption(String strQemuOption) {
95 this.strQemuOption = strQemuOption;
96 }
97 public String getStrSysrootLoc() {
98 return strSysrootLoc;
99 }
100 public void setStrSysrootLoc(String strSysrootLoc) {
101 this.strSysrootLoc = strSysrootLoc;
102 }
103
104 @Override
105 public int hashCode() {
106 final int prime = 31;
107 int result = 1;
108 result = prime * result + ((enumDeviceMode == null) ? 0 : enumDeviceMode.hashCode());
109 result = prime * result + ((enumPokyMode == null) ? 0 : enumPokyMode.hashCode());
110 result = prime * result + intTargetIndex;
111 result = prime * result + ((strQemuKernelLoc == null) ? 0 : strQemuKernelLoc.hashCode());
112 result = prime * result + ((strQemuOption == null) ? 0 : strQemuOption.hashCode());
113 result = prime * result + ((strSysrootLoc == null) ? 0 : strSysrootLoc.hashCode());
114 result = prime * result + ((strTarget == null) ? 0 : strTarget.hashCode());
115 result = prime * result + ((strToolChainRoot == null) ? 0 : strToolChainRoot.hashCode());
116 return result;
117 }
118
119 @Override
120 public boolean equals(Object obj) {
121 if (this == obj)
122 return true;
123 if (obj == null)
124 return false;
125 if (getClass() != obj.getClass())
126 return false;
127 YoctoUIElement other = (YoctoUIElement) obj;
128 if (enumDeviceMode != other.enumDeviceMode)
129 return false;
130 if (enumPokyMode != other.enumPokyMode)
131 return false;
132 if (intTargetIndex != other.intTargetIndex)
133 return false;
134 if (strQemuKernelLoc == null) {
135 if (other.strQemuKernelLoc != null)
136 return false;
137 } else if (!strQemuKernelLoc.equals(other.strQemuKernelLoc))
138 return false;
139 if (strQemuOption == null) {
140 if (other.strQemuOption != null)
141 return false;
142 } else if (!strQemuOption.equals(other.strQemuOption))
143 return false;
144 if (strSysrootLoc == null) {
145 if (other.strSysrootLoc != null)
146 return false;
147 } else if (!strSysrootLoc.equals(other.strSysrootLoc))
148 return false;
149 if (strTarget == null) {
150 if (other.strTarget != null)
151 return false;
152 } else if (!strTarget.equals(other.strTarget))
153 return false;
154 if (strToolChainRoot == null) {
155 if (other.strToolChainRoot != null)
156 return false;
157 } else if (!strToolChainRoot.equals(other.strToolChainRoot))
158 return false;
159 return true;
160 }
161}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide;
12
13import java.io.File;
14import java.util.ArrayList;
15
16import org.eclipse.cdt.ui.templateengine.uitree.InputUIElement;
17import org.eclipse.core.runtime.Status;
18import org.eclipse.jface.dialogs.ErrorDialog;
19import org.eclipse.jface.preference.IPreferenceStore;
20import org.eclipse.swt.SWT;
21import org.eclipse.swt.events.ModifyEvent;
22import org.eclipse.swt.events.ModifyListener;
23import org.eclipse.swt.events.SelectionAdapter;
24import org.eclipse.swt.events.SelectionEvent;
25import org.eclipse.swt.events.SelectionListener;
26import org.eclipse.swt.layout.GridData;
27import org.eclipse.swt.layout.GridLayout;
28import org.eclipse.swt.widgets.Button;
29import org.eclipse.swt.widgets.Combo;
30import org.eclipse.swt.widgets.Composite;
31import org.eclipse.swt.widgets.Control;
32import org.eclipse.swt.widgets.DirectoryDialog;
33import org.eclipse.swt.widgets.Display;
34import org.eclipse.swt.widgets.Event;
35import org.eclipse.swt.widgets.FileDialog;
36import org.eclipse.swt.widgets.Group;
37import org.eclipse.swt.widgets.Label;
38import org.eclipse.swt.widgets.Text;
39import org.eclipse.swt.widgets.Widget;
40import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
41import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
42import org.yocto.sdk.ide.preferences.PreferenceConstants;
43
44public class YoctoUISetting {
45 private static final String ENV_SCRIPT_FILE_PREFIX = "environment-setup-";
46
47 private SelectionListener fSelectionListener;
48 private ModifyListener fModifyListener;
49 private YoctoUIElement yoctoUIElement;
50
51 private Group crossCompilerGroup;
52
53 private Button btnSDKRoot;
54 private Button btnQemu;
55 private Button btnPokyRoot;
56 private Button btnDevice;
57
58 private Button btnKernelLoc;
59 private Button btnSysrootLoc;
60 private Button btnToolChainLoc;
61
62 private Text textKernelLoc;
63 private Text textQemuOption;
64 private Text textSysrootLoc;
65 private Text textRootLoc;
66 private Combo targetArchCombo;
67
68 private Label root_label;
69 private Label sysroot_label;
70 private Label targetArchLabel;
71 private Label kernel_label;
72 private Label option_label;
73
74 public YoctoUISetting(YoctoUIElement elem)
75 {
76 yoctoUIElement = elem;
77 elem.setStrTargetsArray(getTargetArray(elem));
78
79 fSelectionListener= new SelectionListener() {
80 public void widgetDefaultSelected(SelectionEvent e) {}
81
82 public void widgetSelected(SelectionEvent e) {
83 controlChanged(e.widget);
84 relayEvent(e);
85 }
86
87 private void relayEvent(SelectionEvent e) {
88 Event event = new Event();
89 event.data = e.data;
90 event.detail = e.detail;
91 event.display = e.display;
92 event.doit = e.doit;
93 event.height = e.height;
94 event.item = e.item;
95 event.stateMask = e.stateMask;
96 event.text = e.text;
97 event.time = e.time;
98 event.widget = e.widget;
99 event.width = e.width;
100 event.x = e.x;
101 event.y = e.y;
102 crossCompilerGroup.getParent().notifyListeners(SWT.Selection, event);
103 }
104 };
105
106 fModifyListener= new ModifyListener() {
107 public void modifyText(ModifyEvent e) {
108 controlModified(e.widget);
109 relayEvent(e);
110 }
111
112 private void relayEvent(ModifyEvent e) {
113 Event event = new Event();
114 event.data = e.data;
115 event.display = e.display;
116 event.time = e.time;
117 event.widget = e.widget;
118 crossCompilerGroup.getParent().notifyListeners(SWT.Modify, event);
119 }
120 };
121 }
122
123 private Control addControls(Control fControl, final String sKey, String sValue)
124 {
125 fControl.setData(new String[]{sKey,sValue});
126 return fControl;
127 }
128
129 private Control addRadioButton(Composite parent, String label, String key, boolean bSelected) {
130 GridData gd= new GridData(SWT.FILL, SWT.CENTER, true, false);
131 String sValue;
132 Button button= new Button(parent, SWT.RADIO);
133
134 gd.horizontalSpan= 2;
135 button.setText(label);
136 button.setLayoutData(gd);
137 button.setSelection(bSelected);
138
139 if (bSelected)
140 sValue = IPreferenceStore.TRUE;
141 else
142 sValue = IPreferenceStore.FALSE;
143 return addControls((Control)button, key, sValue);
144
145 }
146
147 private Control addTextControl(final Composite parent, String key, String value) {
148 final Text text;
149
150 text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER);
151 text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
152 text.setText(value);
153 text.setSize(10, 150);
154
155 return addControls((Control)text, key, value);
156 }
157
158 private Button addFileSelectButton(final Composite parent, final Text text, final String key) {
159 Button button = new Button(parent, SWT.PUSH | SWT.LEAD);
160 button.setText(InputUIElement.BROWSELABEL);
161 button.addSelectionListener(new SelectionAdapter() {
162 @Override
163 public void widgetSelected(SelectionEvent event) {
164 String dirName;
165 if (key.equals(PreferenceConstants.TOOLCHAIN_ROOT)|| key.equals(PreferenceConstants.SYSROOT))
166 dirName = new DirectoryDialog(parent.getShell()).open();
167 else
168 dirName = new FileDialog(parent.getShell()).open();
169 if (dirName != null) {
170 text.setText(dirName);
171 }
172 }
173 });
174 return button;
175 }
176
177 private void createQemuSetup(final Group targetGroup)
178 {
179 //QEMU Setup
180 kernel_label= new Label(targetGroup, SWT.NONE);
181 kernel_label.setText("Kernel: ");
182 kernel_label.setAlignment(SWT.RIGHT);
183
184 Composite textContainer = new Composite(targetGroup, SWT.NONE);
185 textContainer.setLayout(new GridLayout(2, false));
186 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
187 textKernelLoc= (Text)addTextControl(textContainer, PreferenceConstants.QEMU_KERNEL, yoctoUIElement.getStrQemuKernelLoc());
188 btnKernelLoc = addFileSelectButton(textContainer, textKernelLoc, PreferenceConstants.QEMU_KERNEL);
189
190
191 option_label = new Label(targetGroup, SWT.NONE);
192 option_label.setText("Custom Option: ");
193 option_label.setAlignment(SWT.RIGHT);
194
195 textContainer = new Composite(targetGroup, SWT.NONE);
196 textContainer.setLayout(new GridLayout(2, false));
197 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
198 textQemuOption = (Text)addTextControl(textContainer, PreferenceConstants.QEMU_OPTION, yoctoUIElement.getStrQemuOption());
199
200/*
201 rootfs_label= new Label(targetGroup, SWT.NONE);
202 rootfs_label.setText("Root Filesystem: ");
203 rootfs_label.setAlignment(SWT.RIGHT);
204
205 textContainer = new Composite(targetGroup, SWT.NONE);
206 textContainer.setLayout(new GridLayout(2, false));
207 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
208 textRootFSLoc= (Text)addTextControl(textContainer, PreferenceConstants.QEMU_ROOTFS, yoctoUIElement.getStrQemuRootFSLoc());
209 btnRootFSLoc = addFileSelectButton(textContainer, textRootFSLoc, PreferenceConstants.QEMU_ROOTFS);
210 */
211
212 }
213 public void createComposite(Composite composite)
214 {
215 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
216 GridLayout layout = new GridLayout(2, false);
217
218 crossCompilerGroup = new Group(composite, SWT.NONE);
219 layout= new GridLayout(2, false);
220 crossCompilerGroup.setLayout(layout);
221 gd= new GridData(SWT.FILL, SWT.CENTER, true, false);
222 gd.horizontalSpan= 2;
223 crossCompilerGroup.setLayoutData(gd);
224 crossCompilerGroup.setText("Cross Compiler Options:");
225
226 if (yoctoUIElement.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
227
228 btnSDKRoot = (Button)addRadioButton(crossCompilerGroup, "Standalone pre-built toolchain", PreferenceConstants.SDK_MODE + "_1", true);
229 btnPokyRoot = (Button)addRadioButton(crossCompilerGroup, "Build system derived toolchain", PreferenceConstants.SDK_MODE + "_2", false);
230 }
231 else {
232 btnSDKRoot = (Button)addRadioButton(crossCompilerGroup, "Standalone pre-built toolchain", PreferenceConstants.SDK_MODE + "_1", false);
233 btnPokyRoot = (Button)addRadioButton(crossCompilerGroup, "Build system derived toolchain", PreferenceConstants.SDK_MODE + "_2", true);
234 }
235
236 root_label = new Label(crossCompilerGroup, SWT.NONE);
237 root_label.setText("Toolchain Root Location: ");
238 Composite textContainer = new Composite(crossCompilerGroup, SWT.NONE);
239 textContainer.setLayout(new GridLayout(2, false));
240 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
241 textRootLoc = (Text)addTextControl(textContainer,
242 PreferenceConstants.TOOLCHAIN_ROOT, yoctoUIElement.getStrToolChainRoot());
243 btnToolChainLoc = addFileSelectButton(textContainer, textRootLoc, PreferenceConstants.TOOLCHAIN_ROOT);
244
245 sysroot_label= new Label(crossCompilerGroup, SWT.NONE);
246 sysroot_label.setText("Sysroot Location: ");
247 sysroot_label.setAlignment(SWT.RIGHT);
248
249 textContainer = new Composite(crossCompilerGroup, SWT.NONE);
250 textContainer.setLayout(new GridLayout(2, false));
251 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
252 textSysrootLoc= (Text)addTextControl(textContainer, PreferenceConstants.SYSROOT, yoctoUIElement.getStrSysrootLoc());
253 btnSysrootLoc = addFileSelectButton(textContainer, textSysrootLoc, PreferenceConstants.SYSROOT);
254
255 updateSDKControlState();
256 targetArchLabel = new Label(crossCompilerGroup, SWT.NONE);
257 targetArchLabel.setText("Target Architecture: ");
258
259 targetArchCombo= new Combo(crossCompilerGroup, SWT.READ_ONLY);
260 if (yoctoUIElement.getStrTargetsArray() != null)
261 {
262 targetArchCombo.setItems(yoctoUIElement.getStrTargetsArray());
263 targetArchCombo.select(yoctoUIElement.getIntTargetIndex());
264 }
265 targetArchCombo.setLayout(new GridLayout(2, false));
266 targetArchCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
267 this.addControls((Control)targetArchCombo,
268 PreferenceConstants.TOOLCHAIN_TRIPLET, String.valueOf(yoctoUIElement.getIntTargetIndex()));
269
270
271 //Target Options
272 GridData gd2= new GridData(SWT.FILL, SWT.LEFT, true, false);
273 gd2.horizontalSpan= 2;
274 Group targetGroup= new Group(composite, SWT.NONE);
275 layout= new GridLayout();
276 layout.numColumns= 2;
277 targetGroup.setLayout(layout);
278 targetGroup.setLayoutData(gd2);
279 targetGroup.setText("Target Options:");
280
281 if (yoctoUIElement.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
282 btnQemu = (Button)addRadioButton(targetGroup, "QEMU", PreferenceConstants.TARGET_MODE + "_1", true);
283 createQemuSetup(targetGroup);
284
285 btnDevice = (Button)addRadioButton(targetGroup, "External HW", PreferenceConstants.TARGET_MODE + "_2", false);
286 }
287 else {
288 btnQemu = (Button)addRadioButton(targetGroup, "QEMU", PreferenceConstants.TARGET_MODE + "_1", false);
289 createQemuSetup(targetGroup);
290
291 btnDevice = (Button)addRadioButton(targetGroup, "External HW", PreferenceConstants.TARGET_MODE + "_2", true);
292 }
293
294 updateQemuControlState();
295
296 //we add the listener at the end for avoiding the useless event trigger when control
297 //changed or modified.
298 btnSDKRoot.addSelectionListener(fSelectionListener);
299 btnPokyRoot.addSelectionListener(fSelectionListener);
300 btnQemu.addSelectionListener(fSelectionListener);
301 btnDevice.addSelectionListener(fSelectionListener);
302 targetArchCombo.addSelectionListener(fSelectionListener);
303 textRootLoc.addModifyListener(fModifyListener);
304 textKernelLoc.addModifyListener(fModifyListener);
305 textQemuOption.addModifyListener(fModifyListener);
306 textSysrootLoc.addModifyListener(fModifyListener);
307 }
308
309 //Load all Control values into the YoctoUIElement
310 public YoctoUIElement getCurrentInput()
311 {
312 YoctoUIElement elem = new YoctoUIElement();
313 if (btnSDKRoot.getSelection())
314 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
315 else
316 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
317
318 if (btnQemu.getSelection())
319 {
320 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
321 }
322 else {
323 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
324 }
325 elem.setStrToolChainRoot(textRootLoc.getText());
326 elem.setIntTargetIndex(targetArchCombo.getSelectionIndex());
327 elem.setStrTargetsArray(targetArchCombo.getItems());
328 elem.setStrTarget(targetArchCombo.getText());
329 elem.setStrQemuKernelLoc(textKernelLoc.getText());
330 elem.setStrQemuOption(textQemuOption.getText());
331 elem.setStrSysrootLoc(textSysrootLoc.getText());
332 return elem;
333 }
334
335 public void setCurrentInput(YoctoUIElement elem){
336 elem.setStrTargetsArray(getTargetArray(elem));
337
338 btnSDKRoot.setSelection(false);
339 btnPokyRoot.setSelection(false);
340 if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_SDK_MODE)){
341 btnSDKRoot.setSelection(true);
342 }
343 else if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_TREE_MODE)){
344 btnPokyRoot.setSelection(true);
345 }
346
347 btnQemu.setSelection(false);
348 btnDevice.setSelection(false);
349 if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.QEMU_MODE)){
350 btnQemu.setSelection(true);
351 }
352 else if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.DEVICE_MODE)){
353 btnDevice.setSelection(true);
354 }
355
356 textRootLoc.setText(elem.getStrToolChainRoot());
357 targetArchCombo.select(elem.getIntTargetIndex());
358 if(elem.getStrTargetsArray() == null){
359 targetArchCombo.setItems(new String[]{});
360 }
361 else {
362 targetArchCombo.setItems(elem.getStrTargetsArray());
363 }
364 targetArchCombo.setText(elem.getStrTarget());
365 textKernelLoc.setText(elem.getStrQemuKernelLoc());
366 textQemuOption.setText(elem.getStrQemuOption());
367 textSysrootLoc.setText(elem.getStrSysrootLoc());
368 }
369
370 public SDKCheckResults validateInput(SDKCheckRequestFrom from, boolean showErrorDialog) {
371 SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(getCurrentInput());
372
373 //Show Error Message on the Label to help users.
374 if ((result != SDKCheckResults.SDK_PASS) && showErrorDialog) {
375 Display display = Display.getCurrent();
376 ErrorDialog.openError(display.getActiveShell(),
377 YoctoSDKChecker.SDKCheckRequestFrom.Other.getErrorMessage(),
378 YoctoSDKChecker.getErrorMessage(result, from),
379 new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage()));
380
381 }
382
383 return result;
384 }
385
386 public void setUIFormEnabledState(boolean isEnabled) {
387 btnSDKRoot.setEnabled(isEnabled);
388 btnPokyRoot.setEnabled(isEnabled);
389
390 root_label.setEnabled(isEnabled);
391 textRootLoc.setEnabled(isEnabled);
392 btnToolChainLoc.setEnabled(isEnabled);
393
394 sysroot_label.setEnabled(isEnabled);
395 textSysrootLoc.setEnabled(isEnabled);
396 btnSysrootLoc.setEnabled(isEnabled);
397
398 targetArchLabel.setEnabled(isEnabled);
399 targetArchCombo.setEnabled(isEnabled);
400
401 btnQemu.setEnabled(isEnabled);
402
403 if(isEnabled) {
404 /* enabling widgets regarding
405 * Kernel and Custom Options
406 * depends on the state of the QEMU button */
407 kernel_label.setEnabled(isEnabled);
408 option_label.setEnabled(isEnabled);
409
410 if(btnQemu.getSelection()) {
411 textKernelLoc.setEnabled(isEnabled);
412 btnKernelLoc.setEnabled(isEnabled);
413
414 textQemuOption.setEnabled(isEnabled);
415 }
416 } else {
417 /* disable all widgets regarding
418 * Kernel and Custom Options */
419 kernel_label.setEnabled(isEnabled);
420 textKernelLoc.setEnabled(isEnabled);
421 btnKernelLoc.setEnabled(isEnabled);
422
423 option_label.setEnabled(isEnabled);
424 textQemuOption.setEnabled(isEnabled);
425 }
426
427 btnDevice.setEnabled(isEnabled);
428 }
429
430 private void updateQemuControlState()
431 {
432 boolean bQemuMode = btnQemu.getSelection();
433
434 textKernelLoc.setEnabled(bQemuMode);
435 //textRootFSLoc.setEnabled(bQemuMode);
436 btnKernelLoc.setEnabled(bQemuMode);
437 //btnRootFSLoc.setEnabled(bQemuMode);
438 textQemuOption.setEnabled(bQemuMode);
439 }
440
441 private void updateSDKControlState()
442 {
443 if (btnSDKRoot.getSelection())
444 {
445 }
446 else {
447 if (!yoctoUIElement.getStrToolChainRoot().startsWith("/opt/poky"))
448 {
449 textRootLoc.setText(yoctoUIElement.getStrToolChainRoot());
450 }
451 textRootLoc.setEnabled(true);
452 btnToolChainLoc.setEnabled(true);
453 }
454 }
455
456 private void controlChanged(Widget widget) {
457
458 if (widget == btnSDKRoot || widget == btnPokyRoot)
459 {
460
461 setTargetCombo(targetArchCombo);
462 updateSDKControlState();
463 }
464
465 if (widget == btnDevice || widget == btnQemu)
466 updateQemuControlState();
467 }
468
469 private void controlModified(Widget widget) {
470 if (widget == textRootLoc)
471 {
472 setTargetCombo(targetArchCombo);
473 }
474 }
475
476 /* Search current supported Target triplet from the toolchain root
477 * by parsing ENV script file name
478 */
479 private static ArrayList<String> getTargetTripletList(String strFileName)
480 {
481 File fFile = new File(strFileName);
482 if (!fFile.exists())
483 return null;
484
485 ArrayList<String> arrTarget = new ArrayList<String>();
486 String[] strFileArray = fFile.list();
487 for (int i = 0; i < strFileArray.length; i++)
488 {
489 if (strFileArray[i].startsWith(ENV_SCRIPT_FILE_PREFIX)) {
490 arrTarget.add(strFileArray[i].substring(ENV_SCRIPT_FILE_PREFIX.length()));
491 }
492 }
493 return arrTarget;
494
495 }
496
497 private static String[] getTargetArray(YoctoUIElement elem)
498 {
499 ArrayList<String> arrTarget;
500 String sEnvFilePath = elem.getStrToolChainRoot();
501
502 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE)
503 {
504 arrTarget = getTargetTripletList(sEnvFilePath);
505 }
506 else
507 {
508 arrTarget = getTargetTripletList(sEnvFilePath + "/tmp");
509 }
510 if (arrTarget == null || arrTarget.size() <= 0)
511 return null;
512
513 String [] strTargetArray = new String[arrTarget.size()];
514 for (int i = 0; i < arrTarget.size(); i++)
515 strTargetArray[i] = arrTarget.get(i);
516
517 return strTargetArray;
518
519 }
520
521 private void setTargetCombo(Combo targetCombo)
522 {
523 YoctoUIElement elem = getCurrentInput();
524 //re-get Combo box items according to latest input!
525 elem.setStrTargetsArray(getTargetArray(elem));
526 targetCombo.removeAll();
527 if (elem.getStrTargetsArray() != null)
528 {
529 targetCombo.setItems(elem.getStrTargetsArray());
530 for (int i = 0; i < targetCombo.getItemCount(); i++)
531 {
532 if(elem.getStrTarget().equalsIgnoreCase(targetCombo.getItem(i)))
533 {
534 targetCombo.select(i);
535 return;
536 }
537 if (elem.getStrTargetsArray().length == 1)
538 targetCombo.select(0);
539 targetCombo.select(-1);
540 }
541 }
542 //prompt user,if he use tree mode, maybe he hasn't bitbake meta-ide-support yet.
543 else if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE)
544 {
545 if (elem.getStrToolChainRoot().isEmpty())
546 return;
547 else {
548 File fToolChain = new File(elem.getStrToolChainRoot());
549 if (!fToolChain.exists())
550 return;
551 }
552 }
553
554 }
555}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.actions;
12
13import java.io.IOException;
14import java.io.OutputStream;
15import java.util.ArrayList;
16
17import org.eclipse.cdt.core.CommandLauncher;
18import org.eclipse.cdt.core.ConsoleOutputStream;
19import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
20import org.eclipse.cdt.core.resources.IConsole;
21import org.eclipse.cdt.managedbuilder.core.IConfiguration;
22import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
23import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
24import org.eclipse.core.resources.IProject;
25import org.eclipse.core.runtime.CoreException;
26import org.eclipse.core.runtime.IPath;
27import org.eclipse.core.runtime.NullProgressMonitor;
28import org.eclipse.core.runtime.Path;
29import org.eclipse.cdt.internal.autotools.core.AutotoolsNewMakeGenerator;
30import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction;
31import org.eclipse.cdt.internal.autotools.ui.actions.InvokeMessages;
32
33import org.yocto.sdk.ide.YoctoSDKPlugin;
34
35@SuppressWarnings("restriction")
36public class InvokeSyncAction extends InvokeAction {
37 protected void executeLocalConsoleCommand(final IConsole console, final String actionName, final String command,
38 final String[] argumentList, final IPath execDir, final String password) throws CoreException, IOException {
39
40 String errMsg = null;
41 IProject project = getSelectedContainer().getProject();
42 // Get a build console for the project
43 ConsoleOutputStream consoleOutStream = console.getOutputStream();
44 // FIXME: we want to remove need for ManagedBuilderManager, but how do we
45 // get environment variables.
46 IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
47 IConfiguration cfg = info.getDefaultConfiguration();
48
49 StringBuffer buf = new StringBuffer();
50 String[] consoleHeader = new String[3];
51
52 consoleHeader[0] = actionName;
53 consoleHeader[1] = cfg.getName();
54 consoleHeader[2] = project.getName();
55 buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
56 String invokeMsg = InvokeMessages.getFormattedString("InvokeAction.console.message", //$NON-NLS-1$
57 new String[]{actionName, execDir.toString()}); //$NON-NLS-1$
58 buf.append(invokeMsg);
59 buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
60 buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
61 consoleOutStream.write(buf.toString().getBytes());
62 consoleOutStream.flush();
63
64 ArrayList<String> additionalEnvs = new ArrayList<String>();
65 String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs);
66 // Get a launcher for the config command
67 CommandLauncher launcher = new CommandLauncher();
68 // Set the environment
69 IEnvironmentVariable variables[] = ManagedBuildManager
70 .getEnvironmentVariableProvider().getVariables(cfg, true);
71 String[] env = null;
72 ArrayList<String> envList = new ArrayList<String>();
73 if (variables != null) {
74 for (int i = 0; i < variables.length; i++) {
75 envList.add(variables[i].getName()
76 + "=" + variables[i].getValue()); //$NON-NLS-1$
77 }
78 // add any additional environment variables specified ahead of script
79 if (additionalEnvs.size() > 0)
80 envList.addAll(additionalEnvs);
81 env = (String[]) envList.toArray(new String[envList.size()]);
82 }
83 OutputStream stdout = consoleOutStream;
84 OutputStream stderr = consoleOutStream;
85
86 launcher.showCommand(true);
87 // Run the shell script via shell command.
88 Process proc = launcher.execute(new Path(strippedCommand), argumentList, env,
89 execDir, new NullProgressMonitor());
90
91 if (proc != null) {
92 // Close the input of the process since we will never write to it
93 OutputStream out = proc.getOutputStream();
94 if (!password.isEmpty()) {
95 out.write(password.getBytes());
96 out.write("\n".getBytes());
97 }
98 out.close();
99
100 if (launcher.waitAndRead(stdout, stderr) != CommandLauncher.OK) {
101 errMsg = launcher.getErrorMessage();
102 }
103 } else {
104 errMsg = launcher.getErrorMessage();
105 }
106
107 if (errMsg != null)
108 YoctoSDKPlugin.logErrorMessage(errMsg);
109 }
110}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.actions;
12
13import java.util.Map;
14
15import org.eclipse.cdt.core.model.ICElement;
16import org.eclipse.cdt.core.model.ICProject;
17import org.eclipse.core.commands.AbstractHandler;
18import org.eclipse.core.commands.Command;
19import org.eclipse.core.commands.ExecutionEvent;
20import org.eclipse.core.commands.ExecutionException;
21import org.eclipse.core.commands.State;
22import org.eclipse.core.resources.IProject;
23import org.eclipse.core.resources.IResource;
24import org.eclipse.core.runtime.IAdaptable;
25import org.eclipse.core.runtime.Status;
26import org.eclipse.jface.dialogs.ErrorDialog;
27import org.eclipse.jface.preference.IPreferenceStore;
28import org.eclipse.jface.viewers.ISelection;
29import org.eclipse.jface.viewers.ITreeSelection;
30import org.eclipse.swt.widgets.Display;
31import org.eclipse.ui.commands.ICommandService;
32import org.eclipse.ui.commands.IElementUpdater;
33import org.eclipse.ui.handlers.HandlerUtil;
34import org.eclipse.ui.handlers.RadioState;
35import org.eclipse.ui.menus.UIElement;
36import org.yocto.sdk.ide.YoctoProfileElement;
37import org.yocto.sdk.ide.YoctoSDKChecker;
38import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
39import org.yocto.sdk.ide.YoctoSDKMessages;
40import org.yocto.sdk.ide.YoctoSDKPlugin;
41import org.yocto.sdk.ide.YoctoUIElement;
42import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
43import org.yocto.sdk.ide.utils.YoctoSDKUtils;
44
45public class ProfileSwitchHandler extends AbstractHandler implements IElementUpdater {
46 private static final String PROJECT_SPECIFIC_ERROR = "Preferences.Profile.ProjectSpecific.Error.Title";
47 private static final String PROJECT_SPECIFIC_ERROR_MESSAGE = "Preferences.Profile.ProjectSpecific.Error.Message";
48
49 public static final String PROFILE_SWITCH_COMMAND = "org.yocto.sdk.ide.targetProfile.switch"; //$NON-NLS-N$
50 public static final String PROJECT_SPECIFIC_PARAMETER = "##PROJECT_SPECIFIC_PROFILE##"; //$NON-NLS-N$
51
52 @Override
53 public Object execute(ExecutionEvent event) throws ExecutionException {
54 if(HandlerUtil.matchesRadioState(event)) {
55 return null;
56 }
57
58 String currentState = event.getParameter(RadioState.PARAMETER_ID);
59 HandlerUtil.updateRadioState(event.getCommand(), currentState);
60
61 switchProfile(getSelectedProject(event), currentState);
62
63 return null;
64 }
65
66 public IProject getSelectedProject(ExecutionEvent event) {
67 ISelection selection = HandlerUtil.getCurrentSelection(event);
68
69 if (selection instanceof ITreeSelection) {
70 Object selectedItem = ((ITreeSelection) selection).getFirstElement();
71 if (selectedItem instanceof IResource) {
72 return ((IResource) selectedItem).getProject();
73 } else if (selectedItem instanceof ICElement) {
74 ICProject cProject = ((ICElement) selectedItem).getCProject();
75 if (cProject != null) {
76 return cProject.getProject();
77 }
78 } else if (selectedItem instanceof IAdaptable) {
79 Object projectObject = ((IAdaptable) selectedItem).getAdapter(IProject.class);
80 if (projectObject != null && projectObject instanceof IProject) {
81 return ((IProject) projectObject);
82 }
83 }
84 }
85
86 return null;
87 }
88
89 private void switchProfile(IProject project, String selectedProfile) {
90 if (PROJECT_SPECIFIC_PARAMETER.equals(selectedProfile)) {
91 YoctoUIElement yoctoUIElement = ProjectPreferenceUtils.getElem(project);
92 SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(yoctoUIElement);
93
94 if ((result != SDKCheckResults.SDK_PASS)) {
95 Display display = Display.getCurrent();
96 ErrorDialog.openError(display.getActiveShell(),
97 YoctoSDKMessages.getString(PROJECT_SPECIFIC_ERROR),
98 YoctoSDKMessages.getFormattedString(PROJECT_SPECIFIC_ERROR_MESSAGE,
99 project.getName()),
100 new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage()));
101 return;
102 }
103
104 ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUIElement, project);
105 ProjectPreferenceUtils.saveUseProjectSpecificOption(project, true);
106 } else {
107 IPreferenceStore store = YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile);
108 YoctoUIElement yoctoUIElement = YoctoSDKUtils.getElemFromStore(store);
109 ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUIElement, project);
110 ProjectPreferenceUtils.saveUseProjectSpecificOption(project, false);
111
112 YoctoProfileElement profileSettings = ProjectPreferenceUtils.getProfiles(project);
113 profileSettings.setSelectedProfile(selectedProfile);
114 ProjectPreferenceUtils.saveProfiles(profileSettings, project);
115 }
116 }
117
118 /*
119 * Workaround for BUG 398647 to allow checking radio items
120 * in a dynamic contribution
121 *
122 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=398647
123 */
124 @Override
125 public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
126 ICommandService service = (ICommandService) element.getServiceLocator().getService(ICommandService.class);
127 String state = (String) parameters.get(RadioState.PARAMETER_ID);
128 Command command = service.getCommand(PROFILE_SWITCH_COMMAND);
129 State commandState = command.getState(RadioState.STATE_ID);
130 if (commandState.getValue().equals(state)) {
131 element.setChecked(true);
132 }
133 }
134}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.actions;
12
13import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction;
14import org.eclipse.core.resources.IContainer;
15import org.eclipse.core.resources.IProject;
16import org.eclipse.jface.action.IAction;
17import org.eclipse.jface.preference.PreferenceDialog;
18import org.eclipse.ui.dialogs.PreferencesUtil;
19import org.yocto.sdk.ide.YoctoSDKPlugin;
20
21
22@SuppressWarnings("restriction")
23public class ReconfigYoctoAction extends InvokeAction {
24
25 public void run(IAction action) {
26 IContainer container = getSelectedContainer();
27 if (container == null)
28 return;
29
30 IProject project = container.getProject();
31
32 PreferenceDialog dialog =
33 PreferencesUtil.createPropertyDialogOn(YoctoSDKPlugin.getActiveWorkbenchShell(),
34 project,
35 "org.yocto.sdk.ide.page",
36 null,
37 null);
38 dialog.open();
39 }
40
41 public void dispose() {
42
43 }
44}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.actions;
12
13import java.lang.reflect.Method;
14
15import org.eclipse.core.commands.ExecutionEvent;
16import org.eclipse.core.commands.ExecutionException;
17import org.eclipse.core.expressions.IEvaluationContext;
18import org.eclipse.core.resources.IContainer;
19import org.eclipse.core.runtime.IStatus;
20import org.eclipse.core.runtime.Status;
21import org.eclipse.jface.dialogs.ErrorDialog;
22import org.eclipse.cdt.internal.autotools.ui.actions.AbstractAutotoolsHandler;
23import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction;
24import org.eclipse.swt.widgets.Display;
25import org.yocto.sdk.ide.YoctoSDKPlugin;
26
27
28@SuppressWarnings("restriction")
29public class ReconfigYoctoHandler extends AbstractAutotoolsHandler {
30
31 public Object execute(ExecutionEvent event) throws ExecutionException {
32 ReconfigYoctoAction action = new ReconfigYoctoAction();
33 Method method = null;
34
35 try {
36 /*
37 * This is hack to workaround upstream eclipse bug #370288
38 */
39 Class [] params = {ExecutionEvent.class, InvokeAction.class};
40 method = AbstractAutotoolsHandler.class.getDeclaredMethod("execute",params );
41 } catch (NoSuchMethodException e) {
42 //no such method, old version of plugin org.eclipse.linuxtools.autotools.ui
43 method = null;
44 } catch (Exception e) {
45 throw new ExecutionException(e.getMessage(), e);
46 }
47
48 if (method != null) {
49 //new version
50 Object [] params = {event, action};
51 try {
52 return method.invoke(this, params);
53 }catch (Exception e) {
54 throw new ExecutionException(e.getMessage(), e);
55 }
56 } else {
57 //old version
58 //display a dialog to warn the user
59 Display.getDefault().syncExec(new Runnable() {
60 public void run() {
61 ErrorDialog.openError(null, "Change Yocto Project Settings", "Please update the plugin of \"Autotools support for CDT\"!",
62 new Status(IStatus.WARNING,YoctoSDKPlugin.PLUGIN_ID,"old version of plugin \"Autotools support for CDT\" detected."));
63 }
64 });
65 //try to display the dialog in the old way
66 Object o = event.getApplicationContext();
67 if (o instanceof IEvaluationContext) {
68 IContainer container = getContainer((IEvaluationContext)o);
69 if (container != null) {
70 action.setSelectedContainer(container);
71 action.run(null);
72 }
73 }
74 }
75
76 return null;
77 }
78}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.actions;
12
13import org.eclipse.cdt.internal.autotools.ui.Console;
14import org.yocto.sdk.ide.YoctoSDKMessages;
15
16@SuppressWarnings("restriction")
17public class YoctoConsole extends Console {
18 private static final String CONTEXT_MENU_ID = "YoctoConsole";
19 private static final String CONSOLE_NAME = YoctoSDKMessages.getString("Console.SDK.Name");
20
21 public YoctoConsole() {
22 super(CONSOLE_NAME, CONTEXT_MENU_ID);
23 }
24}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.natures;
12
13import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
14import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;
15import org.eclipse.cdt.managedbuilder.core.IConfiguration;
16import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
17import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
18import org.eclipse.core.resources.IProject;
19import org.yocto.sdk.ide.YoctoSDKPlugin;
20import org.yocto.sdk.ide.YoctoUIElement;
21import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
22import org.yocto.sdk.ide.utils.YoctoSDKUtils;
23
24public class YoctoSDKAutotoolsProjectNature extends YoctoSDKProjectNature {
25 public static final String YoctoSDK_AUTOTOOLS_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature";
26
27 private static final String DEFAULT_HOST_STR = "host";
28 private static final String DEFAULT_TARGET_STR = "target";
29 private static final String DEFAULT_BUILD_STR = "build";
30 private static final String DEFAULT_AUTOGEN_OPT_STR = "autogenOpts";
31
32 private static final String DEFAULT_CONFIGURE_STR = "configure";
33 private static final String DEFAULT_AUTOGEN_STR = "autogen";
34 private static final String DEFAULT_LIBTOOL_SYSROOT_PREFIX = " --with-libtool-sysroot=";
35
36 public static void configureAutotoolsOptions(IProject project) {
37 IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
38 IConfiguration icfg = info.getDefaultConfiguration();
39 YoctoUIElement elem = ProjectPreferenceUtils.getElemFromProjectEnv(project);
40 String sysroot_str = elem.getStrSysrootLoc();
41 String id = icfg.getId();
42 String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
43 String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
44 String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
45 String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS");
46
47 String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 "
48 + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\"";
49 String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
50 String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str;
51 IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id);
52 String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS");
53
54 cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting);
55 cfg.setOption(DEFAULT_BUILD_STR, splitString(strConfigure, "--build="));
56 cfg.setOption(DEFAULT_HOST_STR, splitString(strConfigure, "--host="));
57 cfg.setOption(DEFAULT_TARGET_STR, splitString(strConfigure, "--target="));
58 cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting);
59 cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure);
60
61 AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg);
62 AutotoolsConfigurationManager.getInstance().saveConfigs(project);
63 }
64
65 private static String splitString(String strValue, String strDelim) {
66 int iBeginIndex = strValue.indexOf(strDelim);
67
68 if (iBeginIndex < 0) {
69 return "";
70 }
71 int iEndIndex = strValue.indexOf(' ', iBeginIndex + 1);
72
73 if (iEndIndex < 0) {
74 return strValue.substring(iBeginIndex + strDelim.length());
75 } else {
76 return strValue.substring(iBeginIndex + strDelim.length(), iEndIndex);
77 }
78 }
79}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.natures;
12
13import org.eclipse.cdt.core.CCorePlugin;
14import org.eclipse.cdt.core.envvar.IContributedEnvironment;
15import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
16import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
17import org.eclipse.cdt.core.model.CoreModel;
18import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
19import org.eclipse.cdt.core.settings.model.ICProjectDescription;
20import org.eclipse.core.resources.IProject;
21import org.eclipse.core.runtime.CoreException;
22import org.yocto.sdk.ide.YoctoSDKPlugin;
23import org.yocto.sdk.ide.utils.YoctoSDKUtils;
24
25public class YoctoSDKCMakeProjectNature extends YoctoSDKProjectNature {
26 public static final String YoctoSDK_CMAKE_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKCMakeNature";
27
28 // Considered poky's cmake.bbclass for this method
29 public static void extendProjectEnvironmentForCMake(IProject project) {
30 ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
31 ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration();
32 IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager();
33 IContributedEnvironment env = manager.getContributedEnvironment();
34 String delimiter = manager.getDefaultDelimiter();
35
36 env.addVariable("CCACHE", "", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
37
38 env.addVariable("OECMAKE_SOURCEPATH", "..",
39 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
40
41 String oecmakeBuildPathString = "";
42 env.addVariable("OECMAKE_BUILDPATH", oecmakeBuildPathString,
43 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
44 env.addVariable("EXTRA_OEMAKE", "-C " + oecmakeBuildPathString,
45 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
46
47 String ccString = YoctoSDKUtils.getEnvValue(project, "CC");
48
49 if (!ccString.equals("") && !ccString.equals(" ")) {
50 ccString.trim();
51 ccString = ccString.split(" ")[0];
52 }
53
54 env.addVariable("OECMAKE_C_COMPILER", ccString,
55 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
56 String cxxString = YoctoSDKUtils.getEnvValue(project, "CXX");
57
58 if (!cxxString.equals("") && !cxxString.equals(" ")) {
59 cxxString.trim();
60 cxxString = cxxString.split(" ")[0];
61 }
62
63 env.addVariable("OECMAKE_CXX_COMPILER", cxxString,
64 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
65
66 String hostCCArchString = YoctoSDKUtils.getEnvValue(project, "HOST_CC_ARCH");
67 String toolchainOptionsString = YoctoSDKUtils.getEnvValue(project, "TOOLCHAIN_OPTIONS");
68 String cppFlagsString = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS");
69 String cxxFlagsString = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS");
70 String selectedOptimizationString = YoctoSDKUtils.getEnvValue(project, "SELECTED_OPTIMIZATION");
71 env.addVariable("OECMAKE_C_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cppFlagsString,
72 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
73 env.addVariable("OECMAKE_CXX_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cxxFlagsString
74 + " -fpermissive",
75 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
76 env.addVariable("OECMAKE_C_FLAGS_RELEASE", selectedOptimizationString + " " + cppFlagsString + " -DNDEBUG",
77 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
78 env.addVariable("OECMAKE_CXX_FLAGS_RELEASE", selectedOptimizationString + " " + cxxFlagsString + " -DNDEBUG",
79 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
80
81 env.addVariable("OECMAKE_RPATH", "",
82 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
83 env.addVariable("OECMAKE_PERLNATIVE_DIR", "",
84 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
85
86 try {
87 CoreModel.getDefault().setProjectDescription(project, cpdesc);
88 } catch (CoreException e) {
89 e.printStackTrace();
90 }
91 }
92}
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 @@
1package org.yocto.sdk.ide.natures;
2
3import org.yocto.sdk.ide.YoctoSDKPlugin;
4
5public class YoctoSDKEmptyProjectNature extends YoctoSDKProjectNature {
6
7 public static final String YoctoSDK_EMPTY_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKEmptyNature";
8}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 * BMW Car IT - extracted in an own class
11 *******************************************************************************/
12package org.yocto.sdk.ide.natures;
13
14import org.eclipse.core.resources.IProject;
15import org.eclipse.core.resources.IProjectDescription;
16import org.eclipse.core.runtime.CoreException;
17import org.eclipse.core.runtime.IProgressMonitor;
18
19public class YoctoSDKNatureUtils {
20
21 public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException
22 {
23 IProjectDescription description = project.getDescription();
24 String[] natures = description.getNatureIds();
25
26 for (int i = 0; i < natures.length; ++i) {
27 if (natureId.equals(natures[i]))
28 return;
29 }
30
31 String[] newNatures = new String[natures.length + 1];
32 System.arraycopy(natures, 0, newNatures, 0, natures.length);
33 newNatures[natures.length] = natureId;
34 description.setNatureIds(newNatures);
35 project.setDescription(description, monitor);
36
37 }
38
39}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.natures;
12
13import org.eclipse.core.resources.IProject;
14import org.eclipse.core.resources.IProjectNature;
15import org.eclipse.core.runtime.CoreException;
16import org.yocto.sdk.ide.YoctoSDKPlugin;
17
18public class YoctoSDKProjectNature implements IProjectNature {
19 public static final String YoctoSDK_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature";
20
21 private IProject proj;
22
23 public void configure() throws CoreException {
24 }
25
26 public void deconfigure() throws CoreException {
27 }
28
29 public IProject getProject() {
30 return proj;
31 }
32
33 public void setProject(IProject project) {
34 this.proj = project;
35 }
36}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.preferences;
12
13/**
14 * Constant definitions for plug-in preferences
15 */
16public class PreferenceConstants {
17
18 public static final String TOOLCHAIN_ROOT = "toolChainRoot";
19
20 public static final String TARGET_MODE = "TargetMode";
21
22 public static final String SDK_MODE = "SDKMode";
23
24 public static final String TARGET_ARCH_INDEX = "targeArchIndex";
25
26 public static final String TOOLCHAIN_TRIPLET = "toolchainTriplet";
27
28 public static final String QEMU_KERNEL = "QemuKernel";
29
30 public static final String QEMU_OPTION = "QemuOption";
31
32 public static final String SYSROOT = "Sysroot";
33
34 public static final String IP_ADDR = "IPAddr";
35
36 public static final String STANDARD_PROFILE_NAME = "Standard Profile";
37
38 public static final String PROFILES = "profiles";
39
40 public static final String SELECTED_PROFILE = "selectedProfile";
41
42 public static final String PROJECT_SPECIFIC_PROFILE = "##PROJECT_SPECIFIC_PROFILE##";
43}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.preferences;
12
13import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
14import org.eclipse.jface.preference.IPreferenceStore;
15
16import org.yocto.sdk.ide.YoctoSDKPlugin;
17
18import static org.yocto.sdk.ide.preferences.PreferenceConstants.*;
19
20/**
21 * Class used to initialize default preference values.
22 */
23public class PreferenceInitializer extends AbstractPreferenceInitializer {
24 /*
25 * (non-Javadoc)
26 *
27 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
28 */
29 public void initializeDefaultPreferences() {
30 IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore();
31 store.setDefault(TOOLCHAIN_ROOT, "");
32 store.setDefault(SDK_MODE, true);
33 store.setDefault(TARGET_MODE, false);
34 store.setDefault(TARGET_ARCH_INDEX, -1);
35 store.setDefault(IP_ADDR, "");
36 store.setDefault(QEMU_KERNEL, "");
37 store.setDefault(QEMU_OPTION, "");
38 store.setDefault(SYSROOT, "");
39 store.setDefault(TOOLCHAIN_TRIPLET, "");
40 store.setDefault(PROFILES, "\"" + STANDARD_PROFILE_NAME + "\"");
41 store.setDefault(SELECTED_PROFILE, STANDARD_PROFILE_NAME);
42 }
43
44}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.preferences;
12
13import org.eclipse.jface.dialogs.IInputValidator;
14import org.yocto.sdk.ide.YoctoProfileElement;
15import org.yocto.sdk.ide.YoctoSDKMessages;
16
17public class ProfileNameInputValidator implements IInputValidator {
18 private static final String WARNING_CONTAINS_COMMA = "Preferences.Profile.Validator.InvalidName.Comma";
19 private static final String WARNING_CONTAINS_DOUBLEQUOTE = "Preferences.Profile.Validator.InvalidName.Quote";
20 private static final String PROFILE_NAME_IS_EMPTY = "Preferences.Profile.Validator.InvalidName.Empty";
21 private static final String WARNING_ALREADY_EXISTS = "Preferences.Profile.Validator.InvalidName.Exists";
22
23 private final String selectedItem;
24 private final YoctoProfileElement profileSetting;
25
26 public ProfileNameInputValidator(YoctoProfileElement profileSetting) {
27 this(profileSetting, "");
28 }
29
30 public ProfileNameInputValidator(YoctoProfileElement profileSetting, String selectedItem) {
31 this.selectedItem = selectedItem;
32 this.profileSetting = profileSetting;
33 }
34
35 @Override
36 public String isValid(String newText) {
37 if (newText.contains(",")) {
38 return YoctoSDKMessages.getString(WARNING_CONTAINS_COMMA);
39 }
40
41 if (newText.contains("\"")) {
42 return YoctoSDKMessages.getString(WARNING_CONTAINS_DOUBLEQUOTE);
43 }
44
45 if (newText.isEmpty()) {
46 return YoctoSDKMessages.getString(PROFILE_NAME_IS_EMPTY);
47 }
48
49 if (selectedItemEquals(newText)) {
50 return null;
51 }
52
53 if (profileSetting.contains(newText)) {
54 return YoctoSDKMessages.getString(WARNING_ALREADY_EXISTS);
55 }
56
57 return null;
58 }
59
60 private boolean selectedItemEquals(String newText) {
61 return !selectedItem.isEmpty() && newText.equals(selectedItem);
62 }
63}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.preferences;
12
13import java.util.HashSet;
14
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.resources.ResourcesPlugin;
17import org.eclipse.core.runtime.CoreException;
18import org.eclipse.jface.dialogs.Dialog;
19import org.eclipse.jface.dialogs.IDialogConstants;
20import org.eclipse.jface.dialogs.InputDialog;
21import org.eclipse.jface.dialogs.MessageDialog;
22import org.eclipse.jface.preference.IPreferenceStore;
23import org.eclipse.jface.preference.PreferencePage;
24import org.eclipse.swt.SWT;
25import org.eclipse.swt.layout.GridLayout;
26import org.eclipse.swt.widgets.Composite;
27import org.eclipse.swt.widgets.Control;
28import org.eclipse.swt.widgets.Event;
29import org.eclipse.swt.widgets.Listener;
30import org.eclipse.ui.IWorkbench;
31import org.eclipse.ui.IWorkbenchPreferencePage;
32import org.yocto.sdk.ide.YoctoProfileElement;
33import org.yocto.sdk.ide.YoctoProfileSetting;
34import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
35import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
36import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
37import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
38import org.yocto.sdk.ide.utils.YoctoSDKUtils;
39import org.yocto.sdk.ide.YoctoSDKMessages;
40import org.yocto.sdk.ide.YoctoSDKPlugin;
41import org.yocto.sdk.ide.YoctoUIElement;
42import org.yocto.sdk.ide.YoctoUISetting;
43
44public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
45
46 private static final String NEW_DIALOG_TITLE = "Preferences.Profile.New.Dialog.Title";
47 private static final String NEW_DIALOG_MESSAGE = "Preferences.Profile.New.Dialog.Message";
48 private static final String UPDATE_DIALOG_TITLE = "Preferences.Profile.Update.Dialog.Title";
49 private static final String UPDATE_DIALOG_MESSAGE = "Preferences.Profile.Update.Dialog.Message";
50 private static final String REVALIDATION_MESSAGE = "Poky.SDK.Revalidation.Message";
51
52 private YoctoProfileSetting yoctoProfileSetting;
53 private YoctoUISetting yoctoUISetting;
54
55 private Listener changeListener;
56
57 public YoctoSDKPreferencePage() {
58 //super(GRID);
59 IPreferenceStore defaultStore = YoctoSDKPlugin.getDefault().getPreferenceStore();
60 String profiles = defaultStore.getString(PreferenceConstants.PROFILES);
61 String selectedProfile = defaultStore.getString(PreferenceConstants.SELECTED_PROFILE);
62
63 if (profiles.isEmpty()) {
64 profiles = defaultStore.getDefaultString(PreferenceConstants.PROFILES);
65 selectedProfile = defaultStore.getDefaultString(PreferenceConstants.SELECTED_PROFILE);
66 }
67
68 setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile));
69 //setDescription(YoctoSDKMessages.getString(PREFERENCES_Yocto_CONFIG));
70 YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(getPreferenceStore());
71 this.yoctoUISetting = new YoctoUISetting(elem);
72
73 YoctoProfileElement profileElement = new YoctoProfileElement(profiles, selectedProfile);
74 this.yoctoProfileSetting = new YoctoProfileSetting(profileElement, this, true);
75
76 changeListener = new Listener() {
77 @Override
78 public void handleEvent(Event event) {
79 setErrorMessage(null);
80 setMessage(YoctoSDKMessages.getString(REVALIDATION_MESSAGE), INFORMATION);
81 }
82 };
83 }
84
85 /*
86 * @see IWorkbenchPreferencePage#init(IWorkbench)
87 */
88 public void init(IWorkbench workbench) {
89 }
90
91 protected Control createContents(Composite parent) {
92 initializeDialogUnits(parent);
93 final Composite composite= new Composite(parent, SWT.NONE);
94 composite.setLayout(new GridLayout(2, false));
95
96 yoctoProfileSetting.createComposite(composite);
97 yoctoUISetting.createComposite(composite);
98
99 composite.addListener(SWT.Modify, changeListener);
100 composite.addListener(SWT.Selection, changeListener);
101
102 SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
103 if (result != SDKCheckResults.SDK_PASS) {
104 }
105
106 Dialog.applyDialogFont(composite);
107 return composite;
108 }
109
110 /*
111 * @see IPreferencePage#performOk()
112 */
113 public boolean performOk() {
114 clearMessages();
115
116 SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
117 if (result != SDKCheckResults.SDK_PASS) {
118 setErrorMessage(result.getMessage());
119 return false;
120 }
121
122 YoctoUIElement savedElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore());
123 YoctoUIElement modifiedElement = yoctoUISetting.getCurrentInput();
124
125 YoctoProfileElement savedProfileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
126 YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput();
127
128 if (savedElement.equals(modifiedElement) &&
129 profileElement.getSelectedProfile().equals(savedProfileElement.getSelectedProfile())) {
130 return true;
131 }
132
133 HashSet<IProject> yoctoProjects = getAffectedProjects(profileElement.getSelectedProfile());
134
135 if (!yoctoProjects.isEmpty()) {
136 boolean deleteConfirmed =
137 MessageDialog.openConfirm(null, YoctoSDKMessages.getString(UPDATE_DIALOG_TITLE),
138 YoctoSDKMessages.getFormattedString(UPDATE_DIALOG_MESSAGE, profileElement.getSelectedProfile()));
139
140 if (!deleteConfirmed) {
141 return false;
142 }
143 }
144
145 saveElemToStore(modifiedElement, getPreferenceStore());
146 YoctoSDKUtils.saveProfilesToDefaultStore(profileElement);
147
148 updateProjects(yoctoProjects, modifiedElement);
149
150 return super.performOk();
151 }
152
153 private void clearMessages() {
154 setErrorMessage(null);
155 setMessage(null);
156 setTitle(getTitle());
157 }
158
159 /*
160 * @see PreferencePage#performDefaults()
161 */
162 protected void performDefaults() {
163 YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore();
164 yoctoUISetting.setCurrentInput(defaultElement);
165 super.performDefaults();
166 }
167
168 public void performSaveAs() {
169 YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput();
170 YoctoUIElement uiElement = yoctoUISetting.getCurrentInput();
171
172 SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true);
173 if (result != SDKCheckResults.SDK_PASS) {
174 setErrorMessage(result.getMessage());
175 return;
176 }
177
178 InputDialog profileNameDialog =
179 new InputDialog(null,
180 YoctoSDKMessages.getString(NEW_DIALOG_TITLE),
181 YoctoSDKMessages.getString(NEW_DIALOG_MESSAGE),
182 null,
183 new ProfileNameInputValidator(profileElement));
184
185 int returnCode = profileNameDialog.open();
186 if (returnCode == IDialogConstants.CANCEL_ID) {
187 return;
188 }
189
190 profileElement.addProfile(profileNameDialog.getValue());
191 yoctoProfileSetting.addProfile(profileNameDialog.getValue());
192
193 yoctoUISetting.setCurrentInput(uiElement);
194 performOk();
195 }
196
197 public void switchProfile(String selectedProfile) {
198 setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile));
199 YoctoUIElement profileElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore());
200 yoctoUISetting.setCurrentInput(profileElement);
201 }
202
203 public void renameProfile(String oldProfileName, String newProfileName) {
204 YoctoUIElement oldProfileElement = YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(oldProfileName));
205 saveElemToStore(oldProfileElement, YoctoSDKPlugin.getProfilePreferenceStore(newProfileName));
206
207 renameProfileInAffectedProjects(oldProfileName, newProfileName);
208 }
209
210 public void deleteProfile(String selectedProfile)
211 {
212 resetProfileInAffectedProjects(selectedProfile);
213 }
214
215 /* Save IDE wide POKY Preference settings to a specific preference store */
216 private void saveElemToStore(YoctoUIElement elem, IPreferenceStore store) {
217 store.setValue(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex());
218
219 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
220 store.setValue(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE);
221 } else {
222 store.setValue(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE);
223 }
224 store.setValue(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc());
225 store.setValue(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption());
226 store.setValue(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc());
227 if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
228 store.setValue(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE);
229 } else {
230 store.setValue(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE);
231 }
232 store.setValue(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot());
233 store.setValue(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget());
234 }
235
236 private void resetProfileInAffectedProjects(String usedProfile)
237 {
238 HashSet<IProject> yoctoProjects = getAffectedProjects(usedProfile);
239 YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
240 profileElement.setSelectedProfile(PreferenceConstants.STANDARD_PROFILE_NAME);
241
242 for (IProject project : yoctoProjects)
243 {
244 ProjectPreferenceUtils.saveProfiles(profileElement, project);
245 YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(
246 YoctoSDKPlugin.getProfilePreferenceStore(PreferenceConstants.STANDARD_PROFILE_NAME));
247 ProjectPreferenceUtils.saveElemToProjectEnv(elem, project);
248 }
249 }
250
251 private void renameProfileInAffectedProjects(String oldProfileName, String newProfileName) {
252 HashSet<IProject> yoctoProjects = getAffectedProjects(oldProfileName);
253 YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
254 profileElement.setSelectedProfile(newProfileName);
255
256 for (IProject project : yoctoProjects)
257 {
258 ProjectPreferenceUtils.saveProfiles(profileElement, project);
259 }
260 }
261
262 private void updateProjects(HashSet<IProject> yoctoProjects, YoctoUIElement elem) {
263 for (IProject project : yoctoProjects)
264 {
265 ProjectPreferenceUtils.saveElemToProjectEnv(elem, project);
266 }
267 }
268
269 private HashSet<IProject> getAffectedProjects(String usedProfile)
270 {
271 HashSet<IProject> yoctoProjects = new HashSet<IProject>();
272
273 IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
274
275 for (IProject project : projects)
276 {
277 try
278 {
279 if (!project.hasNature(YoctoSDKProjectNature.YoctoSDK_NATURE_ID)) {
280 continue;
281 }
282 } catch (CoreException e)
283 {
284 // project is closed or does not exist so don't update
285 continue;
286 }
287
288 if (!projectUsesProfile(project, usedProfile)) {
289 continue;
290 }
291
292 yoctoProjects.add(project);
293 }
294 return yoctoProjects;
295 }
296
297 private boolean projectUsesProfile(IProject project, String profile)
298 {
299 YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project);
300
301 if (!profileElement.getSelectedProfile().equals(profile)) {
302 return false;
303 }
304
305 return true;
306 }
307}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 BMW Car IT GmbH.
3 * Copyright (c) 2010 Intel.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * BMW Car IT GmbH - initial implementation
11 * Intel - initial API implementation (copied from YoctoSDKPreferencePage)
12 *******************************************************************************/
13package org.yocto.sdk.ide.preferences;
14
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.runtime.IAdaptable;
17import org.eclipse.jface.dialogs.Dialog;
18import org.eclipse.swt.SWT;
19import org.eclipse.swt.layout.GridLayout;
20import org.eclipse.swt.widgets.Composite;
21import org.eclipse.swt.widgets.Control;
22import org.eclipse.swt.widgets.Event;
23import org.eclipse.swt.widgets.Listener;
24import org.eclipse.ui.IWorkbenchPropertyPage;
25import org.eclipse.ui.dialogs.PropertyPage;
26import org.yocto.sdk.ide.YoctoProfileElement;
27import org.yocto.sdk.ide.YoctoProfileSetting;
28import org.yocto.sdk.ide.YoctoProjectSpecificSetting;
29import org.yocto.sdk.ide.YoctoSDKChecker;
30import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
31import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
32import org.yocto.sdk.ide.YoctoSDKMessages;
33import org.yocto.sdk.ide.YoctoSDKPlugin;
34import org.yocto.sdk.ide.YoctoUIElement;
35import org.yocto.sdk.ide.YoctoUISetting;
36import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
37import org.yocto.sdk.ide.utils.YoctoSDKUtils;
38
39public class YoctoSDKProjectPropertyPage extends PropertyPage implements
40 IWorkbenchPropertyPage {
41
42 private static final String REVALIDATION_MESSAGE = "Poky.SDK.Revalidation.Message";
43
44 private YoctoProfileSetting yoctoProfileSetting;
45 private YoctoProjectSpecificSetting yoctoProjectSpecificSetting;
46 private YoctoUISetting yoctoUISetting;
47 private IProject project = null;
48
49 private Listener changeListener;
50
51 public YoctoSDKProjectPropertyPage() {
52 changeListener = new Listener() {
53 @Override
54 public void handleEvent(Event event) {
55 if (getErrorMessage() != null) {
56 setErrorMessage(null);
57 setMessage(YoctoSDKMessages.getString(REVALIDATION_MESSAGE), INFORMATION);
58 }
59 }
60 };
61 }
62
63 @Override
64 protected Control createContents(Composite parent) {
65 IProject project = getProject();
66
67 YoctoProfileElement globalProfileElement= YoctoSDKUtils.getProfilesFromDefaultStore();
68 YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project);
69
70 String selectedProfile = profileElement.getSelectedProfile();
71 if (!globalProfileElement.contains(selectedProfile)) {
72 selectedProfile = globalProfileElement.getSelectedProfile();
73 }
74
75 yoctoProfileSetting = new YoctoProfileSetting(
76 new YoctoProfileElement(globalProfileElement.getProfilesAsString(), selectedProfile), this, false);
77 boolean useProjectSpecificSetting = ProjectPreferenceUtils.getUseProjectSpecificOption(project);
78
79 if (useProjectSpecificSetting) {
80 yoctoUISetting = new YoctoUISetting(ProjectPreferenceUtils.getElem(project));
81 } else {
82 yoctoUISetting = new YoctoUISetting(YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)));
83 }
84
85 yoctoProjectSpecificSetting = new YoctoProjectSpecificSetting(yoctoProfileSetting, yoctoUISetting, this);
86
87 initializeDialogUnits(parent);
88 final Composite composite = new Composite(parent, SWT.NONE);
89 composite.setLayout(new GridLayout(2, false));
90
91 yoctoProfileSetting.createComposite(composite);
92 yoctoProjectSpecificSetting.createComposite(composite);
93 yoctoUISetting.createComposite(composite);
94
95 if (useProjectSpecificSetting) {
96 yoctoProfileSetting.setUIFormEnabledState(false);
97 yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true);
98 yoctoUISetting.setUIFormEnabledState(true);
99
100 SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
101 if (result != SDKCheckResults.SDK_PASS) {
102 setErrorMessage(result.getMessage());
103 }
104 } else {
105 yoctoProfileSetting.setUIFormEnabledState(true);
106 yoctoProjectSpecificSetting.setUseProjectSpecificSettings(false);
107 yoctoUISetting.setUIFormEnabledState(false);
108 }
109
110 composite.addListener(SWT.Modify, changeListener);
111 composite.addListener(SWT.Selection, changeListener);
112
113 Dialog.applyDialogFont(composite);
114 return composite;
115 }
116
117 private IProject getProject() {
118 if (project != null) {
119 return project;
120 }
121
122 IAdaptable adaptable = getElement();
123 if (adaptable == null) {
124 throw new IllegalStateException("Project can only be retrieved after properties page has been set up.");
125 }
126
127 project = (IProject) adaptable.getAdapter(IProject.class);
128 return project;
129 }
130
131 /*
132 * @see PreferencePage#performDefaults()
133 */
134 @Override
135 protected void performDefaults() {
136 YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore();
137 yoctoUISetting.setCurrentInput(defaultElement);
138 yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true);
139 super.performDefaults();
140 }
141
142 /*
143 * @see IPreferencePage#performOk()
144 */
145 @Override
146 public boolean performOk() {
147 clearMessages();
148
149 IProject project = getProject();
150
151 if (yoctoProjectSpecificSetting.isUsingProjectSpecificSettings()) {
152 SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
153 if (result != SDKCheckResults.SDK_PASS) {
154 setErrorMessage(result.getMessage());
155 return false;
156 }
157
158 ProjectPreferenceUtils.saveUseProjectSpecificOption(project, true);
159 ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project);
160 ProjectPreferenceUtils.saveElem(yoctoUISetting.getCurrentInput(), project);
161 } else {
162 ProjectPreferenceUtils.saveUseProjectSpecificOption(project, false);
163 ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project);
164 }
165
166 ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject());
167
168 return super.performOk();
169 }
170
171 private void clearMessages() {
172 setErrorMessage(null);
173 setMessage(null);
174 setTitle(getTitle());
175 }
176
177 public void switchProfile(String selectedProfile)
178 {
179 YoctoUIElement profileElement = YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile));
180 yoctoUISetting.setCurrentInput(profileElement);
181 }
182
183 public void switchToProjectSpecificProfile()
184 {
185 YoctoUIElement profileElement = ProjectPreferenceUtils.getElem(getProject());
186 SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(profileElement);
187
188 if ((result != SDKCheckResults.SDK_PASS)) {
189 /* Project specific profile has not yet been defined,
190 * leave settings from previously selected profile
191 */
192 return;
193 }
194
195 yoctoUISetting.setCurrentInput(profileElement);
196 }
197
198 public void switchToSelectedProfile()
199 {
200 switchProfile(yoctoProfileSetting.getCurrentInput().getSelectedProfile());
201 }
202}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * Copyright (c) 2010 Intel Corporation.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Intel - initial implementation
11 * BMW Car IT - initial implementation and refactoring
12 *******************************************************************************/
13package org.yocto.sdk.ide.utils;
14
15import java.io.IOException;
16
17import org.eclipse.cdt.core.CCorePlugin;
18import org.eclipse.cdt.core.ConsoleOutputStream;
19import org.eclipse.cdt.core.resources.IConsole;
20import org.eclipse.core.resources.IProject;
21import org.eclipse.core.resources.ProjectScope;
22import org.eclipse.core.runtime.CoreException;
23import org.eclipse.core.runtime.preferences.IEclipsePreferences;
24import org.eclipse.core.runtime.preferences.IScopeContext;
25import org.eclipse.jface.preference.IPreferenceStore;
26import org.osgi.service.prefs.BackingStoreException;
27import org.yocto.sdk.ide.YoctoGeneralException;
28import org.yocto.sdk.ide.YoctoProfileElement;
29import org.yocto.sdk.ide.YoctoSDKMessages;
30import org.yocto.sdk.ide.YoctoUIElement;
31import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
32import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature;
33import org.yocto.sdk.ide.preferences.PreferenceConstants;
34
35public class ProjectPreferenceUtils {
36 private static final String CONSOLE_MESSAGE = "Menu.SDK.Console.Configure.Message";
37
38 /* Get POKY Preference settings from project's preference store */
39 public static YoctoUIElement getElem(IProject project) {
40 IScopeContext projectScope = new ProjectScope(project);
41 IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
42 if (projectNode == null) {
43 return getElemFromProjectEnv(project);
44 }
45
46 YoctoUIElement elem = new YoctoUIElement();
47 elem.setStrToolChainRoot(projectNode.get(PreferenceConstants.TOOLCHAIN_ROOT,""));
48 elem.setStrTarget(projectNode.get(PreferenceConstants.TOOLCHAIN_TRIPLET,""));
49 elem.setStrQemuKernelLoc(projectNode.get(PreferenceConstants.QEMU_KERNEL,""));
50 elem.setStrSysrootLoc(projectNode.get(PreferenceConstants.SYSROOT,""));
51 elem.setStrQemuOption(projectNode.get(PreferenceConstants.QEMU_OPTION,""));
52 String sTemp = projectNode.get(PreferenceConstants.TARGET_ARCH_INDEX,"");
53 if (!sTemp.isEmpty()) {
54 elem.setIntTargetIndex(Integer.valueOf(sTemp).intValue());
55 }
56
57 if (projectNode.get(PreferenceConstants.SDK_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) {
58 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
59 } else {
60 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
61 }
62
63 if(projectNode.get(PreferenceConstants.TARGET_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) {
64 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
65 } else {
66 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
67 }
68 return elem;
69 }
70
71 /* Get POKY Preference settings from project's environment */
72 public static YoctoUIElement getElemFromProjectEnv(IProject project) {
73 YoctoUIElement elem = new YoctoUIElement();
74 elem.setStrToolChainRoot(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TOOLCHAIN_ROOT));
75 elem.setStrTarget(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TOOLCHAIN_TRIPLET));
76 elem.setStrQemuKernelLoc(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.QEMU_KERNEL));
77 elem.setStrSysrootLoc(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.SYSROOT));
78 elem.setStrQemuOption(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.QEMU_OPTION));
79 String sTemp = YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TARGET_ARCH_INDEX);
80
81 if (!sTemp.isEmpty()) {
82 elem.setIntTargetIndex(Integer.valueOf(sTemp).intValue());
83 }
84
85 if (YoctoSDKUtils.getEnvValue(project, PreferenceConstants.SDK_MODE).equalsIgnoreCase(IPreferenceStore.TRUE)) {
86 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
87 } else {
88 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
89 }
90
91 if(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TARGET_MODE).equalsIgnoreCase(IPreferenceStore.TRUE)) {
92 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
93 } else {
94 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
95 }
96
97 return elem;
98 }
99
100 /* Get profiles and selected profile from the project's preference store */
101 public static YoctoProfileElement getProfiles(IProject project) {
102 IScopeContext projectScope = new ProjectScope(project);
103 IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
104
105 if (projectNode == null) {
106 return YoctoSDKUtils.getProfilesFromDefaultStore();
107 }
108
109 String profiles = projectNode.get(PreferenceConstants.PROFILES, "");
110 String selectedProfile = projectNode.get(PreferenceConstants.SELECTED_PROFILE, "");
111
112 return new YoctoProfileElement(profiles, selectedProfile);
113 }
114
115 public static boolean getUseProjectSpecificOption(IProject project) {
116 IScopeContext projectScope = new ProjectScope(project);
117 IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
118 if (projectNode == null) {
119 return false;
120 }
121
122 String useProjectSpecificSettingString = projectNode.get(PreferenceConstants.PROJECT_SPECIFIC_PROFILE,
123 IPreferenceStore.FALSE);
124
125 if (useProjectSpecificSettingString.equals(IPreferenceStore.FALSE)) {
126 return false;
127 }
128
129 return true;
130 }
131
132 /* Save POKY Preference settings to project's preference store */
133 public static void saveElem(YoctoUIElement elem, IProject project) {
134 IScopeContext projectScope = new ProjectScope(project);
135 IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
136 if (projectNode == null) {
137 return;
138 }
139
140 projectNode.putInt(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex());
141 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
142 projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE);
143 } else {
144 projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE);
145 }
146 projectNode.put(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc());
147 projectNode.put(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption());
148 projectNode.put(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc());
149 if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
150 projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE);
151 } else {
152 projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE);
153 }
154 projectNode.put(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot());
155 projectNode.put(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget());
156
157 try {
158 projectNode.flush();
159 } catch (BackingStoreException e) {
160 e.printStackTrace();
161 }
162 }
163
164 /* Save POKY Preference settings to project's environment */
165 public static void saveElemToProjectEnv(YoctoUIElement elem, IProject project) {
166 ConsoleOutputStream consoleOutStream = null;
167
168 try {
169 YoctoSDKUtils.setEnvironmentVariables(project, elem);
170 YoctoSDKUtils.createRemoteDebugAndQemuLaunchers(project, elem);
171
172 if (project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) {
173 YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
174 } else if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) {
175 YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project);
176 }
177
178 IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole");
179 console.start(project);
180 consoleOutStream = console.getOutputStream();
181 String messages = YoctoSDKMessages.getString(CONSOLE_MESSAGE);
182 consoleOutStream.write(messages.getBytes());
183 } catch (CoreException e) {
184 System.out.println(e.getMessage());
185 } catch (IOException e) {
186 System.out.println(e.getMessage());
187 } catch (YoctoGeneralException e) {
188 System.out.println(e.getMessage());
189 } finally {
190 if (consoleOutStream != null) {
191 try {
192 consoleOutStream.flush();
193 consoleOutStream.close();
194 } catch (IOException e) {
195 // ignore
196 }
197 }
198 }
199 }
200
201 /* Save profiles and selected profile to the project's preference store */
202 public static void saveProfiles(YoctoProfileElement profileElement, IProject project) {
203 IScopeContext projectScope = new ProjectScope(project);
204 IEclipsePreferences projectPreferences = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
205
206 if (projectPreferences == null) {
207 return;
208 }
209
210 projectPreferences.put(PreferenceConstants.PROFILES, profileElement.getProfilesAsString());
211 projectPreferences.put(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile());
212
213 try {
214 projectPreferences.flush();
215 } catch (BackingStoreException e) {
216 // TODO Auto-generated catch block
217 e.printStackTrace();
218 }
219 }
220
221 public static void saveUseProjectSpecificOption(IProject project, boolean useProjectSpecificSetting) {
222 IScopeContext projectScope = new ProjectScope(project);
223 IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
224 if (projectNode == null) {
225 return;
226 }
227
228 if (useProjectSpecificSetting) {
229 projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.TRUE);
230 } else {
231 projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.FALSE);
232 }
233
234 try {
235 projectNode.flush();
236 } catch (BackingStoreException e) {
237 e.printStackTrace();
238 }
239 }
240}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 * BMW Car IT - add methods to use different preference stores
11 * Atanas Gegov (BMW Car IT) - add method to get the project environment
12 *******************************************************************************/
13package org.yocto.sdk.ide.utils;
14
15import java.io.BufferedReader;
16import java.io.File;
17import java.io.FileReader;
18import java.io.FileWriter;
19import java.io.IOException;
20import java.util.ArrayList;
21import java.util.HashMap;
22import java.util.HashSet;
23import java.util.Iterator;
24import java.util.Set;
25import java.util.StringTokenizer;
26
27import org.eclipse.cdt.core.CCorePlugin;
28import org.eclipse.cdt.core.envvar.IContributedEnvironment;
29import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
30import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
31import org.eclipse.cdt.core.model.CoreModel;
32import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
33import org.eclipse.cdt.core.settings.model.ICProjectDescription;
34import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
35import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
36import org.eclipse.core.resources.IProject;
37import org.eclipse.core.runtime.CoreException;
38import org.eclipse.debug.core.DebugPlugin;
39import org.eclipse.debug.core.ILaunchConfiguration;
40import org.eclipse.debug.core.ILaunchConfigurationType;
41import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
42import org.eclipse.debug.core.ILaunchManager;
43import org.eclipse.jface.preference.IPreferenceStore;
44import org.yocto.sdk.ide.YoctoGeneralException;
45import org.yocto.sdk.ide.YoctoProfileElement;
46import org.yocto.sdk.ide.YoctoSDKPlugin;
47import org.yocto.sdk.ide.YoctoUIElement;
48import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature;
49import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
50import org.yocto.sdk.ide.preferences.PreferenceConstants;
51
52public class YoctoSDKUtils {
53
54 private static final String DEFAULT_SYSROOT_PREFIX = "--sysroot=";
55 private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot=";
56
57 private static final String DEFAULT_USR_BIN = "/usr/bin/";
58 private static final String NATIVE_SYSROOT = "OECORE_NATIVE_SYSROOT";
59
60 public static String getEnvValue(IProject project, String strKey)
61 {
62 ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
63 ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration();
64 IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager();
65 IContributedEnvironment env = manager.getContributedEnvironment();
66 IEnvironmentVariable var = env.getVariable(strKey, ccdesc);
67
68 if (var == null)
69 {
70 System.out.printf("ENV key %s is NULL\n", strKey);
71 return "";
72 }
73
74 else
75 return var.getValue();
76 }
77
78 /* Save project wide settings into ENV VARs including POKY preference settings
79 * and Environment Script File export VARs
80 */
81 private static void setEnvVars(ICProjectDescription cpdesc,
82 YoctoUIElement elem, HashMap<String, String> envMap) {
83 ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration();
84 IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager();
85 IContributedEnvironment env = manager.getContributedEnvironment();
86 String delimiter = manager.getDefaultDelimiter();
87
88 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE)
89 env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE,
90 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
91 else
92 env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE,
93 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
94
95 env.addVariable(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot(),
96 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
97 env.addVariable(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget(),
98 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
99 env.addVariable(PreferenceConstants.TARGET_ARCH_INDEX, String.valueOf(elem.getIntTargetIndex()),
100 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
101
102 if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE)
103 env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE,
104 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
105 else
106 env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE,
107 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
108
109 env.addVariable(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc(),
110 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
111 env.addVariable(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption(),
112 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
113 env.addVariable(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc(),
114 IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
115
116 if (envMap == null)
117 {
118 System.out.println("ENV var hasmap is NULL, Please check ENV script File!");
119 return;
120 }
121 Iterator<String> iter = envMap.keySet().iterator();
122 while (iter.hasNext())
123 {
124 String sKey = (String)iter.next();
125 String sValue = (String)envMap.get(sKey);
126 String targetFilePath;
127 File targetFile;
128 //replace --sysroot
129 if (sKey.matches("CFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("LDFLAGS") ||
130 sKey.matches("CPPFLAGS")) {
131
132 int SYSROOT_idx = sValue.lastIndexOf(DEFAULT_SYSROOT_PREFIX);
133 if (SYSROOT_idx >=0 )
134 sValue = sValue.substring(0, SYSROOT_idx) + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc();
135 else
136 sValue = " " + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc();
137 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
138 targetFile = new File(targetFilePath);
139 if (targetFile.exists())
140 sValue = sValue + "/" + elem.getStrTarget();
141 } else if (sKey.matches("CONFIGURE_FLAGS")) {
142 int LIBTOOL_idx = sValue.lastIndexOf(LIBTOOL_SYSROOT_PREFIX);
143 if (LIBTOOL_idx >= 0)
144 sValue = sValue.substring(0, LIBTOOL_idx) + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc();
145 else
146 sValue = " " + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc();
147 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
148 targetFile = new File(targetFilePath);
149 if (targetFile.exists())
150 sValue = sValue + "/" + elem.getStrTarget();
151 } else if(sKey.matches("PKG_CONFIG_SYSROOT_DIR") || sKey.matches("OECORE_TARGET_SYSROOT")) {
152 sValue = elem.getStrSysrootLoc();
153 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
154 targetFile = new File(targetFilePath);
155 if (targetFile.exists())
156 sValue = sValue + "/" + elem.getStrTarget();
157 } else if (sKey.matches("PKG_CONFIG_PATH")) {
158 sValue = elem.getStrSysrootLoc();
159 targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
160 targetFile = new File(targetFilePath);
161 if (targetFile.exists())
162 sValue = sValue + "/" + elem.getStrTarget();
163 sValue = sValue + "/usr/lib/pkgconfig";
164 }
165 // env.addVariable(sKey, elem.getStrSysrootLoc(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
166 /*
167 else if (sKey.matches("PKG_CONFIG_PATH"))
168 env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget()+"/usr/lib/pkgconfig", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
169 //env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
170 else if (sKey.matches("PKG_CONFIG_SYSROOT_DIR"))
171 env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
172 */
173 env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc);
174 }
175 //add ACLOCAL OPTS for libtool 2.4 support
176 env.addVariable("OECORE_ACLOCAL_OPTS",
177 "-I " + env.getVariable(NATIVE_SYSROOT, ccdesc).getValue() + "/usr/share/aclocal",
178 IEnvironmentVariable.ENVVAR_REPLACE,
179 delimiter,
180 ccdesc);
181 return;
182
183 }
184
185 private static String getEnvironmentSetupFileFullPath(YoctoUIElement elem) {
186 String envSetupFile = "";
187
188 if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
189 envSetupFile = elem.getStrToolChainRoot() + "/";
190 } else {
191 //POKY TREE Mode
192 envSetupFile = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX;
193 }
194 envSetupFile += YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget();
195 return envSetupFile;
196 }
197
198 private static HashMap<String, String> parseEnvScript(String sFileName) {
199 try {
200 HashMap<String, String> envMap = new HashMap<String, String>();
201 File file = new File(sFileName);
202
203 if (file.exists()) {
204 BufferedReader input = new BufferedReader(new FileReader(file));
205
206 try {
207 String line = null;
208
209 while ((line = input.readLine()) != null) {
210 if (!line.startsWith("export")) {
211 continue;
212 }
213 String sKey = line.substring("export".length() + 1, line.indexOf('='));
214 String sValue = line.substring(line.indexOf('=') + 1);
215 if (sValue.startsWith("\"") && sValue.endsWith("\""))
216 sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"'));
217 /* If PATH ending with $PATH, we need to join with current system path */
218 if (sKey.equalsIgnoreCase("PATH")) {
219 if (sValue.lastIndexOf("$PATH") >= 0)
220 sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH");
221 }
222 envMap.put(sKey, sValue);
223 System.out.printf("get env key %s value %s\n", sKey, sValue);
224 }
225 } finally {
226 input.close();
227 }
228 }
229
230 return envMap;
231
232 } catch (IOException e) {
233 e.printStackTrace();
234 return null;
235 }
236 }
237
238 public static void setEnvironmentVariables(IProject project, YoctoUIElement elem) {
239 ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true);
240
241 String sFileName = getEnvironmentSetupFileFullPath(elem);
242 HashMap<String, String> envMap = parseEnvScript(sFileName);
243
244 setEnvVars(cpdesc, elem, envMap);
245 try {
246 CoreModel.getDefault().setProjectDescription(project,cpdesc);
247 } catch (CoreException e) {
248 e.printStackTrace();
249 }
250 }
251
252 public static void createRemoteDebugAndQemuLaunchers(IProject project, YoctoUIElement elem) throws YoctoGeneralException {
253 ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager();
254 ILaunchConfigurationType configType =
255 lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
256 ILaunchConfigurationType debug_configType =
257 lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType");
258
259 String sPath = getEnvValue(project, "PATH");
260 String sDebugName = getEnvValue(project, "GDB");
261 String sysroot_str = elem.getStrSysrootLoc();
262
263 if (configType == null || debug_configType == null) {
264 throw new YoctoGeneralException("Failed to get program or remote debug launcher!");
265 }
266 createRemoteDebugLauncher(project, lManager, debug_configType, elem.getStrTarget(), sPath, sDebugName, sysroot_str);
267
268 ArrayList<String> listValue = new ArrayList<String>();
269 listValue.add(new String("org.eclipse.ui.externaltools.launchGroup"));
270
271 if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
272 String sFileName = getEnvironmentSetupFileFullPath(elem);
273 createQemuLauncher(project, configType, listValue, sFileName, elem);
274 }
275 }
276
277 protected static void createRemoteDebugLauncher(IProject project,
278 ILaunchManager lManager, ILaunchConfigurationType configType,
279 String sTargetTriplet, String strPath, String sDebugName, String sSysroot) {
280 try {
281
282 String sDebugSubDir = DEFAULT_USR_BIN + sTargetTriplet;
283 StringTokenizer token = new StringTokenizer(strPath, ":");
284 String strDebugger = "";
285 while (token.hasMoreTokens())
286 {
287 String sTemp = token.nextToken();
288 if (sTemp.endsWith(sDebugSubDir)) {
289 strDebugger = sTemp + "/" + sDebugName;
290 break;
291 }
292 }
293 if (strDebugger.isEmpty())
294 return;
295 //If get default Debugger successfully, go ahead!
296
297 //create the gdbinit file
298 String sDebugInitFile = project.getLocation().toString() + "/.gdbinit";
299 FileWriter out = new FileWriter(new File(sDebugInitFile));
300 out.write("set sysroot " + sSysroot);
301 out.flush();
302 out.close();
303
304 //set the launch configuration
305 String projectName = project.getName();
306 String configName = projectName+"_gdb_"+sTargetTriplet;
307 int i;
308 ILaunchConfiguration[] configs=lManager.getLaunchConfigurations(configType);
309 for(i=0; i<configs.length; i++)
310 { //delete the old configuration
311 ILaunchConfiguration config=configs[i];
312 if(config.getName().equals(configName)) {
313 config.delete();
314 break;
315 }
316 }
317 ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(project, configName);
318 Set<String> modes=new HashSet<String>();
319 modes.add("debug");
320 w_copy.setPreferredLaunchDelegate(modes, "org.eclipse.rse.remotecdt.launch");
321 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile);
322 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
323 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger);
324 w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi");
325 //TWEAK avoid loading default values in org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab
326 w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true);
327 w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
328 if (!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID)) {
329 String pathToCompiledBinary = "";
330 if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) {
331 pathToCompiledBinary = "Debug/";
332 } else {
333 pathToCompiledBinary = "src/";
334 }
335 pathToCompiledBinary += projectName;
336 w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, pathToCompiledBinary);
337 }
338
339 w_copy.doSave();
340 }
341 catch (CoreException e)
342 {
343 System.out.println(e.getMessage());
344 }
345 catch (IOException e)
346 {
347 System.out.println("Failed to generate debug init file!");
348 System.out.println(e.getMessage());
349 }
350 }
351
352 protected static void createQemuLauncher(IProject project,
353 ILaunchConfigurationType configType,
354 ArrayList<String> listValue, String sScriptFile,
355 YoctoUIElement elem) {
356 try {
357
358 ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "qemu_"+elem.getStrTarget());
359
360 w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue);
361 w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm");
362
363 String argument = "-e \"source " + sScriptFile + ";runqemu " + qemuTargetTranslate(elem.getStrTarget()) + " " +
364 elem.getStrQemuKernelLoc() + " " + elem.getStrSysrootLoc() + " " + elem.getStrQemuOption() + ";bash\"";
365
366 w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument);
367 w_copy.doSave();
368 } catch (CoreException e) {
369 }
370
371 }
372
373 private static String qemuTargetTranslate(String strTargetArch) {
374 String qemu_target = "";
375 if (strTargetArch.indexOf("i586") != -1) {
376 qemu_target = "qemux86";
377 } else if (strTargetArch.indexOf("x86_64") != -1) {
378 qemu_target = "qemux86-64";
379 } else if (strTargetArch.indexOf("arm") != -1) {
380 qemu_target = "qemuarm";
381 } else if (strTargetArch.indexOf("mips") != -1) {
382 qemu_target = "qemumips";
383 } else if (strTargetArch.indexOf("ppc") != -1) {
384 qemu_target = "qemuppc";
385 }
386 return qemu_target;
387 }
388
389 /* Get IDE wide POKY Preference settings from a specific preference store */
390 public static YoctoUIElement getElemFromStore(IPreferenceStore store) {
391 YoctoUIElement elem = new YoctoUIElement();
392 if (store.getString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE))
393 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
394 else
395 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
396
397 elem.setStrToolChainRoot(store.getString(PreferenceConstants.TOOLCHAIN_ROOT));
398 elem.setStrTarget(store.getString(PreferenceConstants.TOOLCHAIN_TRIPLET));
399 elem.setIntTargetIndex(store.getInt(PreferenceConstants.TARGET_ARCH_INDEX));
400 elem.setStrQemuKernelLoc(store.getString(PreferenceConstants.QEMU_KERNEL));
401 elem.setStrQemuOption(store.getString(PreferenceConstants.QEMU_OPTION));
402 elem.setStrSysrootLoc(store.getString(PreferenceConstants.SYSROOT));
403
404 if (store.getString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE))
405 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
406 else
407 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
408
409 return elem;
410 }
411
412 /* Get default POKY Preference settings from the default preference store */
413 public static YoctoUIElement getDefaultElemFromDefaultStore()
414 {
415 IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore();
416 YoctoUIElement elem = new YoctoUIElement();
417 if (store.getDefaultString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE))
418 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
419 else
420 elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
421
422 elem.setStrToolChainRoot(store.getDefaultString(PreferenceConstants.TOOLCHAIN_ROOT));
423 elem.setStrTarget(store.getDefaultString(PreferenceConstants.TOOLCHAIN_TRIPLET));
424 elem.setIntTargetIndex(store.getDefaultInt(PreferenceConstants.TARGET_ARCH_INDEX));
425 elem.setStrQemuKernelLoc(store.getDefaultString(PreferenceConstants.QEMU_KERNEL));
426 elem.setStrQemuOption(store.getDefaultString(PreferenceConstants.QEMU_OPTION));
427 elem.setStrSysrootLoc(store.getDefaultString(PreferenceConstants.SYSROOT));
428
429 if (store.getDefaultString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE))
430 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
431 else
432 elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
433
434 return elem;
435 }
436
437 /* Save profiles and selected profile to the default preference store */
438 public static void saveProfilesToDefaultStore(YoctoProfileElement profileElement) {
439 saveProfilesToStore(profileElement, YoctoSDKPlugin.getDefault().getPreferenceStore());
440 }
441
442 /* Save profiles and selected profile to a specific preference store */
443 private static void saveProfilesToStore(YoctoProfileElement profileElement, IPreferenceStore store) {
444 store.setValue(PreferenceConstants.PROFILES, profileElement.getProfilesAsString());
445 store.setValue(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile());
446 }
447
448 /* Get profiles and selected profile from the default preference store */
449 public static YoctoProfileElement getProfilesFromDefaultStore()
450 {
451 return getProfilesFromStore(YoctoSDKPlugin.getDefault().getPreferenceStore());
452 }
453
454 /* Get profiles and selected profile from a specific preference store */
455 private static YoctoProfileElement getProfilesFromStore(IPreferenceStore store) {
456 String profiles = store.getString(PreferenceConstants.PROFILES);
457 String selectedProfile = store.getString(PreferenceConstants.SELECTED_PROFILE);
458
459 return new YoctoProfileElement(profiles, selectedProfile);
460 }
461}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 BMW Car IT GmbH.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * BMW Car IT - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.utils;
12
13public class YoctoSDKUtilsConstants {
14
15 public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-";
16 public static final String DEFAULT_TMP_PREFIX = "/tmp/";
17 public static final String PROJECT_SCOPE = "org.yocto.sdk.ide";
18}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.wizard;
12
13import java.io.BufferedReader;
14import java.io.File;
15import java.io.InputStream;
16import java.io.InputStreamReader;
17
18import org.eclipse.cdt.core.templateengine.TemplateCore;
19import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
20import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
21import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
22import org.eclipse.cdt.core.templateengine.process.processes.Messages;
23import org.eclipse.core.resources.IProject;
24import org.eclipse.core.resources.ResourcesPlugin;
25import org.eclipse.core.runtime.IPath;
26import org.eclipse.core.runtime.IProgressMonitor;
27import org.yocto.sdk.ide.YoctoSDKMessages;
28import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
29
30public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner {
31
32 public static final String CHMOD_COMMAND = "chmod +x "; //$NON-NLS-1$
33 public static final String AUTOGEN_SCRIPT_NAME = "autogen.sh"; //$NON-NLS-1$
34
35 public NewYoctoAutotoolsProjectPostProcess() {}
36
37 public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
38
39 String projectName = args[0].getSimpleValue();
40
41 IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
42 try {
43 if (!project.exists()) {
44 throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$
45 } else if (!project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) {
46 throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + //$NON-NLS-1$
47 YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.WrongProjectNature", //$NON-NLS-1$
48 projectName));
49 } else {
50 IPath path = project.getLocation();
51 String path_str = path.toString();
52 String autogen_cmd = CHMOD_COMMAND + path_str + File.separator + AUTOGEN_SCRIPT_NAME;
53 try {
54 Runtime rt = Runtime.getRuntime();
55 Process proc = rt.exec(autogen_cmd);
56 InputStream stdin = proc.getInputStream();
57 InputStreamReader isr = new InputStreamReader(stdin);
58 BufferedReader br = new BufferedReader(isr);
59 String line = null;
60 String error_message = ""; //$NON-NLS-1$
61
62 while ( (line = br.readLine()) != null) {
63 error_message = error_message + line;
64 }
65
66 int exitVal = proc.waitFor();
67 if (exitVal != 0) {
68 throw new ProcessFailureException(
69 YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.ChmodFailure", //$NON-NLS-1$
70 projectName));
71 }
72 } catch (Throwable t) {
73 t.printStackTrace();
74
75 }
76 }
77 } catch (Exception e) {
78 throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$
79 }
80 }
81}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.ide.wizard;
12
13import java.util.Arrays;
14import java.util.LinkedHashMap;
15import java.util.List;
16import java.util.regex.Matcher;
17import java.util.regex.Pattern;
18
19import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
20import org.eclipse.cdt.core.CCorePlugin;
21import org.eclipse.cdt.core.templateengine.TemplateCore;
22import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
23import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
24import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
25import org.eclipse.cdt.core.templateengine.process.processes.Messages;
26import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
27import org.eclipse.cdt.make.core.MakeCorePlugin;
28import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
29import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
30import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
31import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
32import org.eclipse.cdt.managedbuilder.core.BuildException;
33import org.eclipse.cdt.managedbuilder.core.IConfiguration;
34import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
35import org.eclipse.cdt.managedbuilder.core.IOption;
36import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
37import org.eclipse.cdt.managedbuilder.templateengine.ProjectCreatedActions;
38import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
39import org.eclipse.jface.wizard.IWizardPage;
40import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
41import org.eclipse.cdt.internal.ui.wizards.ICDTCommonProjectWizard;
42import org.eclipse.core.resources.IProject;
43import org.eclipse.core.resources.IWorkspace;
44import org.eclipse.core.resources.IWorkspaceDescription;
45import org.eclipse.core.resources.ResourcesPlugin;
46import org.eclipse.core.runtime.CoreException;
47import org.eclipse.core.runtime.IPath;
48import org.eclipse.core.runtime.IProgressMonitor;
49import org.eclipse.core.runtime.OperationCanceledException;
50import org.eclipse.core.runtime.Path;
51import org.eclipse.jface.preference.IPreferenceStore;
52import org.yocto.sdk.ide.YoctoGeneralException;
53import org.yocto.sdk.ide.YoctoProfileElement;
54import org.yocto.sdk.ide.YoctoSDKChecker;
55import org.yocto.sdk.ide.YoctoSDKMessages;
56import org.yocto.sdk.ide.YoctoSDKPlugin;
57import org.yocto.sdk.ide.YoctoUIElement;
58import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature;
59import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature;
60import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
61import org.yocto.sdk.ide.natures.YoctoSDKNatureUtils;
62import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
63import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
64import org.yocto.sdk.ide.utils.YoctoSDKUtils;
65
66@SuppressWarnings("restriction")
67public class NewYoctoProjectTemplateProcess extends ProcessRunner {
68 protected boolean savedAutoBuildingValue;
69 protected ProjectCreatedActions pca;
70 protected IManagedBuildInfo info;
71 protected List<Character> illegalChars = Arrays.asList('$', '"','#','%','&','\'','(',')','*', '+', ',','.','/',':',';','<','=','>','?','@','[','\\',']','^','`','{','|','}','~');
72 private static final String PROJECT_NAME_ERROR = "Wizard.SDK.Error.ProjectName";
73
74 private boolean isCProject;
75 private boolean isEmptyProject;
76 private boolean isAutotoolsProject;
77 private boolean isCMakeProject;
78
79 public NewYoctoProjectTemplateProcess() {
80 pca = new ProjectCreatedActions();
81
82 isCProject = false;
83 isEmptyProject = false;
84 isAutotoolsProject = false;
85 isCMakeProject = false;
86 }
87
88 private String printIllegalChars(){
89 String print = "";
90 for (Character ch : illegalChars)
91 print += ch + ", ";
92 print = print.substring(0, print.length() - 2);
93 return print;
94 }
95
96 public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
97
98 String projectName = args[0].getSimpleValue();
99 String location = args[1].getSimpleValue();
100 String artifactExtension = args[2].getSimpleValue();
101 String isCProjectValue = args[3].getSimpleValue();
102 String isEmptyProjetValue = args[4].getSimpleValue();
103 String isAutotoolsProjectValue = args[5].getSimpleValue();
104 String isCMakeProjectValue = args[6].getSimpleValue();
105
106 isCProject = Boolean.valueOf(isCProjectValue).booleanValue();
107 isEmptyProject = Boolean.valueOf(isEmptyProjetValue).booleanValue();
108 isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue();
109 isCMakeProject = Boolean.valueOf(isCMakeProjectValue).booleanValue();
110
111 IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
112 try {
113 if (!isValidProjectName(projectName)) {
114
115 IWizardPage[] pages = MBSCustomPageManager.getPages();
116 if(pages != null && pages.length > 0) {
117 CDTMainWizardPage cdtMainPage = (CDTMainWizardPage)pages[0];
118 cdtMainPage.setPageComplete(false);
119 ICDTCommonProjectWizard wizard = (ICDTCommonProjectWizard) pages[0].getWizard();
120 wizard.performCancel();
121
122 project.delete(true, null);
123 }
124 throw new ProcessFailureException(YoctoSDKMessages.getFormattedString(PROJECT_NAME_ERROR, new Object[]{projectName, printIllegalChars()}));
125 }
126
127 if (!project.exists()) {
128 IWorkspace workspace = ResourcesPlugin.getWorkspace();
129 turnOffAutoBuild(workspace);
130
131 IPath locationPath = null;
132 if (location != null && !location.trim().equals("")) { //$NON-NLS-1$
133 locationPath = Path.fromPortableString(location);
134 }
135
136 List<?> configs = template.getTemplateInfo().getConfigurations();
137
138 if (configs == null || configs.size() == 0) {
139 throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$
140 }
141
142 pca.setProject(project);
143 pca.setProjectLocation(locationPath);
144 pca.setConfigs((IConfiguration[]) configs.toArray(new IConfiguration[configs.size()]));
145 pca.setArtifactExtension(artifactExtension);
146 info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject);
147
148 addNatures(project, false, monitor);
149
150 info.setValid(true);
151 ManagedBuildManager.saveBuildInfo(project, true);
152
153 restoreAutoBuild(workspace);
154 } else {
155
156 IWorkspace workspace = ResourcesPlugin.getWorkspace();
157 turnOffAutoBuild(workspace);
158
159 YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
160
161 addNatures(project, true, monitor);
162
163 //restoreAutoBuild(workspace);
164 IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager();
165 IDiscoveredPathInfo pathInfo = manager.getDiscoveredInfo(project);
166
167 if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
168 IPerProjectDiscoveredPathInfo projectPathInfo =
169 (IPerProjectDiscoveredPathInfo) pathInfo;
170 projectPathInfo.setIncludeMap(new LinkedHashMap<String, Boolean>());
171 projectPathInfo.setSymbolMap(new LinkedHashMap<String, SymbolEntry>());
172 manager.removeDiscoveredInfo(project);
173 }
174 }
175 }
176 catch (CoreException e)
177 {
178 throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$
179 }
180 catch (BuildException e)
181 {
182 throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$
183 }
184 catch (YoctoGeneralException e)
185 {
186 try {
187 project.delete(true, monitor);
188 } catch (CoreException err) {
189 throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage() //$NON-NLS-1$
190 + " " + err.getMessage()); //$NON-NLS-1$
191 }
192 throw new OperationCanceledException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$
193 }
194 }
195
196 private boolean isValidProjectName(String projectName) {
197 Pattern pattern = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_\\-]*$"); //$NON-NLS-1$
198 Matcher matcher = pattern.matcher(projectName);
199 return matcher.find();
200 }
201
202 private void addNatures(IProject project, boolean projectExists, IProgressMonitor monitor)
203 throws CoreException, YoctoGeneralException {
204 YoctoSDKNatureUtils.addNature(project, YoctoSDKProjectNature.YoctoSDK_NATURE_ID, monitor);
205
206 YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
207
208 YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
209 ProjectPreferenceUtils.saveProfiles(profileElement, project);
210
211 IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
212 YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
213 YoctoSDKUtils.setEnvironmentVariables(project, elem);
214
215 if (isEmptyProject) {
216 YoctoSDKNatureUtils.addNature(project, YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID, monitor);
217 }
218
219 if (isAutotoolsProject) {
220 AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
221
222 if (!projectExists) {
223 // For each IConfiguration, create a corresponding Autotools Configuration
224 for (IConfiguration cfg : pca.getConfigs()) {
225 AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true);
226 }
227 AutotoolsConfigurationManager.getInstance().saveConfigs(project);
228 }
229
230 YoctoSDKNatureUtils.addNature(project, YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID, monitor);
231 YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project);
232 } else if (isCMakeProject) {
233 YoctoSDKNatureUtils.addNature(project, YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID, monitor);
234 YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project);
235 }
236
237 YoctoSDKUtils.createRemoteDebugAndQemuLaunchers(project, elem);
238 }
239
240 protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException {
241 IWorkspaceDescription workspaceDesc = workspace.getDescription();
242 savedAutoBuildingValue = workspaceDesc.isAutoBuilding();
243 workspaceDesc.setAutoBuilding(false);
244 workspace.setDescription(workspaceDesc);
245 }
246
247 protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException {
248 IWorkspaceDescription workspaceDesc = workspace.getDescription();
249 workspaceDesc.setAutoBuilding(savedAutoBuildingValue);
250 workspace.setDescription(workspaceDesc);
251 }
252
253 /**
254 * setOptionValue
255 * @param config
256 * @param option
257 * @param val
258 * @throws BuildException
259 */
260 protected void setOptionValue(IConfiguration config, IOption option, String val) throws BuildException {
261 if (val != null) {
262 if (!option.isExtensionElement()) {
263 option.setValue(val);
264 } else {
265 IOption newOption = config.getToolChain().createOption(option, option.getId() + "." + ManagedBuildManager.getRandomNumber(), option.getName(), false); //$NON-NLS-1$
266 newOption.setValue(val);
267 }
268 }
269 }
270}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - Initial implementation
10 *******************************************************************************/
11
12#Template Default Values
13EmptyProject.template.label=Empty C Autotools Project
14EmptyProject.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 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
3 copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
4
5 id="YoctoEmptyCAutotoolsProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description"
6 help="help.html">
7
8 <process type="org.yocto.sdk.ide.NewYoctoProject">
9 <simple name="name" value="$(projectName)" />
10 <simple name="artifactExtension" value="exe" />
11 <simple name="isCProject" value="true" />
12 <simple name="isEmptyProject" value="true" />
13 <simple name="isAutotoolsProject" value="true" />
14 <simple name="isCMakeProject" value="false" />
15 </process>
16
17</template>
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - Initial implementation
10 *******************************************************************************/
11
12#Template Default Values
13EmptyProject.template.label=Empty C++ Autotools Project
14EmptyProject.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 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
3 copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
4 id="YoctoEmptyCppAutotoolsProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description"
5 help="help.html">
6
7 <process type="org.yocto.sdk.ide.NewYoctoProject">
8 <simple name="name" value="$(projectName)" />
9 <simple name="artifactExtension" value="exe" />
10 <simple name="isCProject" value="false" />
11 <simple name="isEmptyProject" value="true" />
12 <simple name="isAutotoolsProject" value="true" />
13 <simple name="isCMakeProject" value="false" />
14 </process>
15
16</template>
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 @@
1
2
3#include <stdlib.h>
4#include <stdio.h>
5
6int main(void) {
7 puts("Hello World"); /* prints Hello World */
8 return 0;
9}
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 @@
1[Desktop Entry]
2Version=@VERSION@
3Encoding=UTF-8
4Name=$(projectName)
5Comment=A "$(message)"
6Type=Application
7Categories=Application
8Exec=$(projectName)
9Name[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
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog
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 @@
1Building:
2 $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr]
3 $ make
4
5Installing:
6 $ sudo make install
7
8Running:
9 $ $(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 @@
1
2bin_PROGRAMS = $(projectName)
3$(projectName)_SOURCES = $(projectName).c
4
5AM_CFLAGS = @$(projectName)_CFLAGS@
6AM_LDFLAGS = @$(projectName)_LIBS@
7
8CLEANFILES = *~
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 @@
1SUBDIRS = $(sourceDir)
2
3MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \
4 config.sub configure depcomp install-sh \
5 ltmain.sh Makefile.in missing
6
7
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
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS
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 @@
1$(projectName)
2Copyright (C) $(copyright).
3
4Brief description of project....
5
6-----------------------------------------------------------------------------
7 Build
8-----------------------------------------------------------------------------
9$ ./autogen.sh $CONFIGURE_FLAGS
10$ make
11
12-----------------------------------------------------------------------------
13 Build with documentation generated (usually for libraries)
14-----------------------------------------------------------------------------
15$ ./autogen.sh --enable-gtk-doc
16$ make
17
18( If built with the --enable-gtk-doc flag above you can view the index.html
19 file in your web browser. )
20$ firefox ./docs/reference/index.html
21
22-----------------------------------------------------------------------------
23 Install
24-----------------------------------------------------------------------------
25$ 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 @@
1#! /bin/sh
2[ -e config.cache ] && rm -f config.cache
3
4libtoolize --automake
5aclocal ${OECORE_ACLOCAL_OPTS}
6autoconf
7autoheader
8automake -a
9./configure $@
10exit
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 @@
1AC_PREREQ(2.61)
2
3# package version number (not shared library version)
4# odd micro numbers indicate in-progress development
5# even micro numbers indicate released versions
6m4_define($(projectName)_version_major, 0)
7m4_define($(projectName)_version_minor, 1)
8m4_define($(projectName)_version_micro, 0)
9
10m4_define([$(projectName)_version],
11 [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro])
12m4_define([$(projectName)_api_version],
13 [$(projectName)_version_major.$(projectName)_version_minor])
14
15AC_INIT($(projectName), $(projectName)_version)
16AM_INIT_AUTOMAKE($(projectName), $(projectName)_version)
17AC_CONFIG_HEADERS(config.h)
18
19# Checks for programs.
20AC_PROG_LIBTOOL
21AM_PROG_CC_C_O
22AC_PROG_INSTALL
23
24AC_SUBST($(projectName)_CFLAGS)
25AC_SUBST($(projectName)_LIBS)
26
27AC_OUTPUT([
28Makefile
29$(sourceDir)/Makefile
30])
31
32echo ""
33echo " $(projectName) $VERSION"
34echo " ====================="
35echo ""
36echo " To build the project, run \"make\""
37echo ""
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 @@
1###############################################################################
2# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Bala Torati (Symbian) - initial API and implementation
10# Red Hat Inc - modification to use with Autotools project
11###############################################################################
12
13#Template Default Values
14HelloWorld.CAnsitemplate.label=Hello World ANSI C Autotools Project
15HelloWorld.CAnsitemplate.description=A skeletal C Hello World project. Creates a folder for sources and autogen artifacts.
16HelloWorld.basics.label=Basic Settings
17HelloWorld.basics.description=Basic properties of a project
18HelloWorld.author.label=Author
19HelloWorld.author.description=Name of the author
20HelloWorld.copyright.label=Copyright notice
21HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation)
22HelloWorld.copyright.default=Your copyright
23HelloWorld.message.default=Hello World
24HelloWorld.message.description=Your hello world greeting message
25HelloWorld.message.label=Hello world greeting
26HelloWorld.sourceDir.label=Source
27HelloWorld.sourceDir.description=Directory for hello world project source files
28HelloWorld.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 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
3 copyright="Copyright (c) 2007,2009 Symbian Software Limited 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 athttp://www.eclipse.org/legal/epl-v10.html"
4 id="YoctoHelloWorldCAutotoolsProject" label="%HelloWorld.CAnsitemplate.label" description="%HelloWorld.CAnsitemplate.description"
5 help="help.html">
6
7 <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
8 <property id="author"
9 label="%HelloWorld.author.label"
10 description="%HelloWorld.author.description"
11 type="input"
12 pattern=".+"
13 default=""
14 hidden="false"
15 mandatory="true"
16 persist="true"/>
17 <property id="copyright"
18 label="%HelloWorld.copyright.label"
19 description="%HelloWorld.copyright.description"
20 type="input"
21 pattern=".+"
22 default="%HelloWorld.copyright.default"
23 hidden="false"
24 mandatory="true"
25 persist="true"/>
26 <property id="message"
27 label="%HelloWorld.message.label"
28 description="%HelloWorld.message.description"
29 type="input"
30 pattern=".+"
31 default="%HelloWorld.message.default"
32 hidden="false"
33 mandatory="true"
34 persist="true"/>
35 <property id="sourceDir"
36 label="%HelloWorld.sourceDir.label"
37 description="%HelloWorld.sourceDir.description"
38 type="input"
39 default="%HelloWorld.sourceDir.default"
40 pattern="[a-zA-Z0-9]+"
41 mandatory="true"
42 persist="true"/>
43 <property id="license" label="License" description="License" type="select" default="BSD" mandatory="false" persist="true">
44 <item label="BSD License" name="BSD"/>
45 <item label="MIT License" name="MIT"/>
46 <item label="GNU General Public License v2.0" name="GPLv2"/>
47 <item label="GNU General Public License v2.0_or_later" name="GPLv2_or_later"/>
48 <item label="GNU General Public License v3.0" name="GPLv3"/>
49 <item label="Other" name="Other"/>
50 </property>
51 </property-group>
52
53 <process type="org.yocto.sdk.ide.NewYoctoProject">
54 <simple name="name" value="$(projectName)" />
55 <simple name="artifactExtension" value="exe" />
56 <simple name="isCProject" value="true" />
57 <simple name="isEmptyProject" value="false" />
58 <simple name="isAutotoolsProject" value="true" />
59 <simple name="isCMakeProject" value="false" />
60 </process>
61
62 <process type="org.eclipse.cdt.core.CreateSourceFolder">
63 <simple name="projectName" value="$(projectName)"/>
64 <simple name="path" value="$(sourceDir)"/>
65 </process>
66
67 <process type="org.eclipse.cdt.core.AddFiles">
68 <simple name="projectName" value="$(projectName)"/>
69 <complex-array name="files">
70 <element>
71 <simple name="source" value="../Licenses/AUTHORS"/>
72 <simple name="target" value="AUTHORS"/>
73 <simple name="replaceable" value="true"/>
74 </element>
75 <element>
76 <simple name="source" value="../Licenses/COPYING_$(license)"/>
77 <simple name="target" value="COPYING"/>
78 <simple name="replaceable" value="true"/>
79 </element>
80 <element>
81 <simple name="source" value="../Licenses/Header_$(license)"/>
82 <simple name="target" value="$(sourceDir)/$(projectName).c"/>
83 <simple name="replaceable" value="true"/>
84 </element>
85 <element>
86 <simple name="source" value="src/autogen.sh"/>
87 <simple name="target" value="autogen.sh"/>
88 <simple name="replaceable" value="true"/>
89 </element>
90 <element>
91 <simple name="source" value="src/ChangeLog"/>
92 <simple name="target" value="ChangeLog"/>
93 <simple name="replaceable" value="true"/>
94 </element>
95 <element>
96 <simple name="source" value="src/configure.ac.top"/>
97 <simple name="target" value="configure.ac"/>
98 <simple name="replaceable" value="true"/>
99 </element>
100 <element>
101 <simple name="source" value="src/INSTALL"/>
102 <simple name="target" value="INSTALL"/>
103 <simple name="replaceable" value="true"/>
104 </element>
105 <element>
106 <simple name="source" value="src/Makefile.am.src"/>
107 <simple name="target" value="$(sourceDir)/Makefile.am"/>
108 <simple name="replaceable" value="true"/>
109 </element>
110 <element>
111 <simple name="source" value="src/Makefile.am.top"/>
112 <simple name="target" value="Makefile.am"/>
113 <simple name="replaceable" value="true"/>
114 </element>
115 <element>
116 <simple name="source" value="src/NEWS"/>
117 <simple name="target" value="NEWS"/>
118 <simple name="replaceable" value="true"/>
119 </element>
120 <element>
121 <simple name="source" value="src/README"/>
122 <simple name="target" value="README"/>
123 <simple name="replaceable" value="true"/>
124 </element>
125 </complex-array>
126 </process>
127
128 <process type="org.eclipse.cdt.core.AppendCreate">
129 <simple name="projectName" value="$(projectName)"/>
130 <complex-array name="files">
131 <element>
132 <simple name="source" value="src/Basename.c"/>
133 <simple name="target" value="$(sourceDir)/$(projectName).c"/>
134 <simple name="replaceable" value="true"/>
135 </element>
136 </complex-array>
137 </process>
138
139 <process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
140 <simple name="projectName" value="$(projectName)" />
141 </process>
142
143</template>
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 @@
1#include <gtk/gtk.h>
2
3static void
4hello (GtkWidget * widget, gpointer data)
5{
6 g_print ("Hello World!\n");
7}
8
9static gboolean
10delete_event (GtkWidget * widget, GdkEvent * event, gpointer data)
11{
12 g_print ("delete event occurred\n");
13 return TRUE;
14}
15
16static void
17destroy (GtkWidget * widget, gpointer data)
18{
19 gtk_main_quit ();
20}
21
22int
23main (int argc, char *argv[])
24{
25 GtkWidget *window;
26 GtkWidget *button;
27
28 gtk_init (&argc, &argv);
29 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
30
31 g_signal_connect (G_OBJECT (window), "delete_event",
32 G_CALLBACK (delete_event), NULL);
33 g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);
34
35 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
36 button = gtk_button_new_with_label ("Hello World!");
37
38 g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (hello), NULL);
39 g_signal_connect_swapped (G_OBJECT (button), "clicked",
40 G_CALLBACK (gtk_widget_destroy),
41 G_OBJECT (window));
42
43 gtk_container_add (GTK_CONTAINER (window), button);
44 gtk_widget_show (button);
45 gtk_widget_show (window);
46
47 gtk_main ();
48
49 return 0;
50}
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 @@
1[Desktop Entry]
2Version=@VERSION@
3Encoding=UTF-8
4Name=$(projectName)
5Comment=A "$(message)"
6Type=Application
7Categories=Application
8Exec=$(projectName)
9Name[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
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog
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 @@
1Building:
2 $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr]
3 $ make
4
5Installing:
6 $ sudo make install
7
8Running:
9 $ $(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 @@
1
2bin_PROGRAMS = $(projectName)
3$(projectName)_SOURCES = $(projectName).c
4
5AM_CFLAGS = @$(projectName)_CFLAGS@
6AM_LDFLAGS = @$(projectName)_LIBS@
7
8CLEANFILES = *~
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 @@
1SUBDIRS = $(sourceDir)
2
3MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \
4 config.sub configure depcomp install-sh \
5 ltmain.sh Makefile.in missing
6
7
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
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS
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 @@
1$(projectName)
2Copyright (C) $(copyright).
3
4Brief description of project....
5
6-----------------------------------------------------------------------------
7 Build
8-----------------------------------------------------------------------------
9$ ./autogen.sh $CONFIGURE_FLAGS
10$ make
11
12-----------------------------------------------------------------------------
13 Build with documentation generated (usually for libraries)
14-----------------------------------------------------------------------------
15$ ./autogen.sh --enable-gtk-doc
16$ make
17
18( If built with the --enable-gtk-doc flag above you can view the index.html
19 file in your web browser. )
20$ firefox ./docs/reference/index.html
21
22-----------------------------------------------------------------------------
23 Install
24-----------------------------------------------------------------------------
25$ 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 @@
1#! /bin/sh
2[ -e config.cache ] && rm -f config.cache
3
4libtoolize --automake
5aclocal ${OECORE_ACLOCAL_OPTS}
6autoconf
7autoheader
8automake -a
9./configure $@
10exit
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 @@
1AC_PREREQ(2.61)
2
3# package version number (not shared library version)
4# odd micro numbers indicate in-progress development
5# even micro numbers indicate released versions
6m4_define($(projectName)_version_major, 0)
7m4_define($(projectName)_version_minor, 1)
8m4_define($(projectName)_version_micro, 0)
9
10m4_define([$(projectName)_version],
11 [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro])
12m4_define([$(projectName)_api_version],
13 [$(projectName)_version_major.$(projectName)_version_minor])
14
15AC_INIT($(projectName), $(projectName)_version)
16AM_INIT_AUTOMAKE($(projectName), $(projectName)_version)
17AC_CONFIG_HEADERS(config.h)
18
19# Checks for programs.
20AC_PROG_LIBTOOL
21AM_PROG_CC_C_O
22AC_PROG_INSTALL
23
24#enable pkg-config
25PKG_PROG_PKG_CONFIG
26
27#GTK_REQUIRED_VERSION=2.0.0
28#GLIB_REQUIRED_VERSION=$GTK_REQUIRED_VERSION
29
30#AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION,,
31# [AC_MSG_ERROR(Test for GLib failed.)], gobject)
32#AM_PATH_GTK_2_0($GTK_REQUIRED_VERSION,,
33# [AC_MSG_ERROR(Test for GTK failed.)])
34PKG_CHECK_MODULES($(projectName), glib-2.0 gtk+-2.0)
35
36AC_SUBST($(projectName)_CFLAGS)
37AC_SUBST($(projectName)_LIBS)
38
39AC_OUTPUT([
40Makefile
41$(sourceDir)/Makefile
42])
43
44echo ""
45echo " $(projectName) $VERSION"
46echo " ====================="
47echo ""
48echo " To build the project, run \"make\""
49echo ""
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 @@
1AC_PREREQ(2.61)
2
3# package version number (not shared library version)
4# odd micro numbers indicate in-progress development
5# even micro numbers indicate released versions
6m4_define($(projectName)_version_major, 0)
7m4_define($(projectName)_version_minor, 1)
8m4_define($(projectName)_version_micro, 0)
9
10m4_define([$(projectName)_version],
11 [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro])
12m4_define([$(projectName)_api_version],
13 [$(projectName)_version_major.$(projectName)_version_minor])
14
15AC_INIT($(projectName), $(projectName)_version)
16AM_INIT_AUTOMAKE($(projectName), $(projectName)_version)
17AC_CONFIG_HEADERS(config.h)
18
19# Checks for programs.
20AC_PROG_LIBTOOL
21AM_PROG_CC_C_O
22AC_PROG_INSTALL
23
24AC_SUBST($(projectName)_CFLAGS)
25AC_SUBST($(projectName)_LIBS)
26
27AC_OUTPUT([
28Makefile
29$(sourceDir)/Makefile
30])
31
32echo ""
33echo " $(projectName) $VERSION"
34echo " ====================="
35echo ""
36echo " To build the project, run \"make\""
37echo ""
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 @@
1###############################################################################
2# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Bala Torati (Symbian) - initial API and implementation
10# Red Hat Inc - modification to use with Autotools project
11###############################################################################
12
13#Template Default Values
14HelloWorld.CAnsitemplate.label=Hello World GTK C Autotools Project
15HelloWorld.CAnsitemplate.description=A skeletal C GTK Hello World project. Creates a folder for sources and autogen artifacts.
16HelloWorld.basics.label=Basic Settings
17HelloWorld.basics.description=Basic properties of a project
18HelloWorld.author.label=Author
19HelloWorld.author.description=Name of the author
20HelloWorld.copyright.label=Copyright notice
21HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation)
22HelloWorld.copyright.default=Your copyright
23HelloWorld.message.default=Hello World
24HelloWorld.message.description=Your hello world greeting message
25HelloWorld.message.label=Hello world greeting
26HelloWorld.sourceDir.label=Source
27HelloWorld.sourceDir.description=Directory for hello world project source files
28HelloWorld.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 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
3 copyright="Copyright (c) 2007,2009 Symbian Software Limited 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 athttp://www.eclipse.org/legal/epl-v10.html"
4 id="YoctoHelloWorldCGTKAutotoolsProject" label="%HelloWorld.CAnsitemplate.label" description="%HelloWorld.CAnsitemplate.description"
5 help="help.html">
6
7 <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
8 <property id="author"
9 label="%HelloWorld.author.label"
10 description="%HelloWorld.author.description"
11 type="input"
12 pattern=".+"
13 default=""
14 hidden="false"
15 mandatory="true"
16 persist="true"/>
17 <property id="copyright"
18 label="%HelloWorld.copyright.label"
19 description="%HelloWorld.copyright.description"
20 type="input"
21 pattern=".+"
22 default="%HelloWorld.copyright.default"
23 hidden="false"
24 mandatory="true"
25 persist="true"/>
26 <property id="message"
27 label="%HelloWorld.message.label"
28 description="%HelloWorld.message.description"
29 type="input"
30 pattern=".+"
31 default="%HelloWorld.message.default"
32 hidden="false"
33 mandatory="true"
34 persist="true"/>
35 <property id="sourceDir"
36 label="%HelloWorld.sourceDir.label"
37 description="%HelloWorld.sourceDir.description"
38 type="input"
39 default="%HelloWorld.sourceDir.default"
40 pattern="[a-zA-Z0-9]+"
41 mandatory="true"
42 persist="true"/>
43 <property id="license" label="License" description="License" type="select" default="BSD" mandatory="false" persist="true">
44 <item label="BSD License" name="BSD"/>
45 <item label="MIT License" name="MIT"/>
46 <item label="GNU General Public License v2.0" name="GPLv2"/>
47 <item label="GNU General Public License v2.0_or_later" name="GPLv2_or_later"/>
48 <item label="GNU General Public License v3.0" name="GPLv3"/>
49 <item label="Other" name="Other"/>
50 </property>
51 </property-group>
52
53 <process type="org.yocto.sdk.ide.NewYoctoProject">
54 <simple name="name" value="$(projectName)" />
55 <simple name="artifactExtension" value="exe" />
56 <simple name="isCProject" value="true" />
57 <simple name="isEmptyProject" value="false" />
58 <simple name="isAutotoolsProject" value="true" />
59 <simple name="isCMakeProject" value="false" />
60 </process>
61
62 <process type="org.eclipse.cdt.core.CreateSourceFolder">
63 <simple name="projectName" value="$(projectName)"/>
64 <simple name="path" value="$(sourceDir)"/>
65 </process>
66
67 <process type="org.eclipse.cdt.core.AddFiles">
68 <simple name="projectName" value="$(projectName)"/>
69 <complex-array name="files">
70 <element>
71 <simple name="source" value="../Licenses/AUTHORS"/>
72 <simple name="target" value="AUTHORS"/>
73 <simple name="replaceable" value="true"/>
74 </element>
75 <element>
76 <simple name="source" value="../Licenses/COPYING_$(license)"/>
77 <simple name="target" value="COPYING"/>
78 <simple name="replaceable" value="true"/>
79 </element>
80 <element>
81 <simple name="source" value="../Licenses/Header_$(license)"/>
82 <simple name="target" value="$(sourceDir)/$(projectName).c"/>
83 <simple name="replaceable" value="true"/>
84 </element>
85 <element>
86 <simple name="source" value="src/autogen.sh"/>
87 <simple name="target" value="autogen.sh"/>
88 <simple name="replaceable" value="true"/>
89 </element>
90 <element>
91 <simple name="source" value="src/ChangeLog"/>
92 <simple name="target" value="ChangeLog"/>
93 <simple name="replaceable" value="true"/>
94 </element>
95 <element>
96 <simple name="source" value="src/configure.ac.top"/>
97 <simple name="target" value="configure.ac"/>
98 <simple name="replaceable" value="true"/>
99 </element>
100 <element>
101 <simple name="source" value="src/INSTALL"/>
102 <simple name="target" value="INSTALL"/>
103 <simple name="replaceable" value="true"/>
104 </element>
105 <element>
106 <simple name="source" value="src/Makefile.am.src"/>
107 <simple name="target" value="$(sourceDir)/Makefile.am"/>
108 <simple name="replaceable" value="true"/>
109 </element>
110 <element>
111 <simple name="source" value="src/Makefile.am.top"/>
112 <simple name="target" value="Makefile.am"/>
113 <simple name="replaceable" value="true"/>
114 </element>
115 <element>
116 <simple name="source" value="src/NEWS"/>
117 <simple name="target" value="NEWS"/>
118 <simple name="replaceable" value="true"/>
119 </element>
120 <element>
121 <simple name="source" value="src/README"/>
122 <simple name="target" value="README"/>
123 <simple name="replaceable" value="true"/>
124 </element>
125 </complex-array>
126 </process>
127
128 <process type="org.eclipse.cdt.core.AppendCreate">
129 <simple name="projectName" value="$(projectName)"/>
130 <complex-array name="files">
131 <element>
132 <simple name="source" value="src/Basename.c"/>
133 <simple name="target" value="$(sourceDir)/$(projectName).c"/>
134 <simple name="replaceable" value="true"/>
135 </element>
136 </complex-array>
137 </process>
138
139 <process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
140 <simple name="projectName" value="$(projectName)" />
141 </process>
142</template>
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 @@
1
2
3#include <iostream>
4
5using namespace std;
6
7int main(void) {
8 cout << "Hello World" << endl; /* prints Hello World */
9 return 0;
10}
11
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
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog
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 @@
1Building:
2 $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr]
3 $ make
4
5Installing:
6 $ sudo make install
7
8Running:
9 $ $(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 @@
1
2bin_PROGRAMS = $(projectName)
3$(projectName)_SOURCES = $(projectName).cpp
4
5AM_CXXFLAGS = @$(projectName)_CFLAGS@
6AM_LDFLAGS = @$(projectName)_LIBS@
7
8CLEANFILES = *~
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 @@
1EXTRA_DIST = autogen.sh
2SUBDIRS = $(sourceDir)
3
4DISTCHECK_CONFIGURE_FLAGS=
5
6CLEANFILES = *~ \ 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
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS
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 @@
1$(projectName)
2Copyright (C) $(copyright).
3
4Brief description of project....
5
6-----------------------------------------------------------------------------
7 Build
8-----------------------------------------------------------------------------
9$ ./autogen.sh $CONFIGURE_FLAGS
10$ make
11
12-----------------------------------------------------------------------------
13 Build with documentation generated (usually for libraries)
14-----------------------------------------------------------------------------
15$ ./autogen.sh --enable-gtk-doc
16$ make
17
18( If built with the --enable-gtk-doc flag above you can view the index.html
19 file in your web browser. )
20$ firefox ./docs/reference/index.html
21
22-----------------------------------------------------------------------------
23 Install
24-----------------------------------------------------------------------------
25$ 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 @@
1#! /bin/sh
2[ -e config.cache ] && rm -f config.cache
3
4libtoolize --automake
5aclocal ${OECORE_ACLOCAL_OPTS}
6autoconf
7autoheader
8automake -a
9./configure $@
10exit
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 @@
1AC_PREREQ(2.61)
2
3# package version number (not shared library version)
4# odd micro numbers indicate in-progress development
5# even micro numbers indicate released versions
6m4_define($(projectName)_version_major, 0)
7m4_define($(projectName)_version_minor, 1)
8m4_define($(projectName)_version_micro, 0)
9
10m4_define([$(projectName)_version],
11 [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro])
12m4_define([$(projectName)_api_version],
13 [$(projectName)_version_major.$(projectName)_version_minor])
14
15AC_INIT($(projectName), $(projectName)_version)
16AM_INIT_AUTOMAKE($(projectName), $(projectName)_version)
17AC_CONFIG_HEADERS(config.h)
18
19# Checks for programs.
20AC_PROG_LIBTOOL
21AC_PROG_CXX
22AC_PROG_INSTALL
23
24# enable pkg-config
25PKG_PROG_PKG_CONFIG
26
27# Checks for library functions.
28#AC_CHECK_FUNCS([memset])
29
30AC_SUBST($(projectName)_CFLAGS)
31AC_SUBST($(projectName)_LIBS)
32
33
34#icondir=${datadir}/icons/hicolor/32x32/apps
35#AC_SUBST(icondir)
36
37AC_OUTPUT([
38Makefile
39$(sourceDir)/Makefile
40])
41
42echo ""
43echo " $(projectName) $VERSION"
44echo " ====================="
45echo ""
46echo " To build the project, run \"make\""
47echo ""
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 @@
1###############################################################################
2# Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Bala Torati (Symbian) - initial API and implementation
10# Red Hat Inc - modification to use with Autotools project
11###############################################################################
12
13#Template Default Values
14HelloWorld.CCtemplate.label= Hello World C++ Autotools Project
15HelloWorld.CCtemplate.description=A skeletal C++ Hello World project. Creates a folder for sources and autogen artifacts.
16HelloWorld.basics.label=Basic Settings
17HelloWorld.basics.description=Basic properties of a project
18HelloWorld.author.label=Author
19HelloWorld.author.description=Name of the author
20HelloWorld.copyright.label=Copyright notice
21HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation)
22HelloWorld.copyright.default=Your copyright notice
23HelloWorld.message.default=Hello World
24HelloWorld.message.description=Your hello world greeting message
25HelloWorld.message.label=Hello world greeting
26HelloWorld.sourceDir.label=Source
27HelloWorld.sourceDir.description=Directory for hello world project source files
28HelloWorld.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 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
3 copyright="Copyright (c) 2007,2009 Symbian Software Limited 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 athttp://www.eclipse.org/legal/epl-v10.html"
4 id="YoctoHelloWorldCPPAutotoolsProject" label="%HelloWorld.CCtemplate.label" description="%HelloWorld.CCtemplate.description"
5 help="help.html">
6
7 <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
8 <property id="author"
9 label="%HelloWorld.author.label"
10 description="%HelloWorld.author.description"
11 type="input"
12 pattern=".+"
13 default=""
14 hidden="false"
15 mandatory="true"
16 persist="true"/>
17 <property id="copyright"
18 label="%HelloWorld.copyright.label"
19 description="%HelloWorld.copyright.description"
20 type="input"
21 pattern=".+"
22 default="%HelloWorld.copyright.default"
23 hidden="false"
24 mandatory="true"
25 persist="true"/>
26 <property id="message"
27 label="%HelloWorld.message.label"
28 description="%HelloWorld.message.description"
29 type="input"
30 pattern=".+"
31 default="%HelloWorld.message.default"
32 hidden="false"
33 mandatory="true"
34 persist="true"/>
35 <property id="sourceDir"
36 label="%HelloWorld.sourceDir.label"
37 description="%HelloWorld.sourceDir.description"
38 type="input"
39 default="%HelloWorld.sourceDir.default"
40 pattern="[a-zA-Z0-9]+"
41 mandatory="true"
42 persist="true"/>
43 <property id="license" label="License" description="License" type="select" default="BSD" mandatory="false" persist="true">
44 <item label="BSD License" name="BSD"/>
45 <item label="MIT License" name="MIT"/>
46 <item label="GNU General Public License v2.0" name="GPLv2"/>
47 <item label="GNU General Public License v2.0_or_later" name="GPLv2_or_later"/>
48 <item label="GNU General Public License v3.0" name="GPLv3"/>
49 <item label="Other" name="Other"/>
50 </property>
51 </property-group>
52
53 <process type="org.yocto.sdk.ide.NewYoctoProject">
54 <simple name="name" value="$(projectName)" />
55 <simple name="artifactExtension" value="exe" />
56 <simple name="isCProject" value="false" />
57 <simple name="isEmptyProject" value="false" />
58 <simple name="isAutotoolsProject" value="true" />
59 <simple name="isCMakeProject" value="false" />
60 </process>
61
62 <process type="org.eclipse.cdt.core.CreateSourceFolder">
63 <simple name="projectName" value="$(projectName)"/>
64 <simple name="path" value="$(sourceDir)"/>
65 </process>
66
67 <process type="org.eclipse.cdt.core.AddFiles">
68 <simple name="projectName" value="$(projectName)"/>
69 <complex-array name="files">
70 <element>
71 <simple name="source" value="../Licenses/AUTHORS"/>
72 <simple name="target" value="AUTHORS"/>
73 <simple name="replaceable" value="true"/>
74 </element>
75 <element>
76 <simple name="source" value="../Licenses/COPYING_$(license)"/>
77 <simple name="target" value="COPYING"/>
78 <simple name="replaceable" value="true"/>
79 </element>
80 <element>
81 <simple name="source" value="../Licenses/Header_$(license)"/>
82 <simple name="target" value="$(sourceDir)/$(projectName).cpp"/>
83 <simple name="replaceable" value="true"/>
84 </element>
85 <element>
86 <simple name="source" value="src/autogen.sh"/>
87 <simple name="target" value="autogen.sh"/>
88 <simple name="replaceable" value="true"/>
89 </element>
90 <element>
91 <simple name="source" value="src/ChangeLog"/>
92 <simple name="target" value="ChangeLog"/>
93 <simple name="replaceable" value="true"/>
94 </element>
95 <element>
96 <simple name="source" value="src/configure.ac.top"/>
97 <simple name="target" value="configure.ac"/>
98 <simple name="replaceable" value="true"/>
99 </element>
100 <element>
101 <simple name="source" value="src/INSTALL"/>
102 <simple name="target" value="INSTALL"/>
103 <simple name="replaceable" value="true"/>
104 </element>
105 <element>
106 <simple name="source" value="src/Makefile.am.src"/>
107 <simple name="target" value="$(sourceDir)/Makefile.am"/>
108 <simple name="replaceable" value="true"/>
109 </element>
110 <element>
111 <simple name="source" value="src/Makefile.am.top"/>
112 <simple name="target" value="Makefile.am"/>
113 <simple name="replaceable" value="true"/>
114 </element>
115 <element>
116 <simple name="source" value="src/NEWS"/>
117 <simple name="target" value="NEWS"/>
118 <simple name="replaceable" value="true"/>
119 </element>
120 <element>
121 <simple name="source" value="src/README"/>
122 <simple name="target" value="README"/>
123 <simple name="replaceable" value="true"/>
124 </element>
125 </complex-array>
126 </process>
127
128 <process type="org.eclipse.cdt.core.AppendCreate">
129 <simple name="projectName" value="$(projectName)"/>
130 <complex-array name="files">
131 <element>
132 <simple name="source" value="src/Basename.cpp"/>
133 <simple name="target" value="$(sourceDir)/$(projectName).cpp"/>
134 <simple name="replaceable" value="true"/>
135 </element>
136 </complex-array>
137 </process>
138
139 <process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess">
140 <simple name="projectName" value="$(projectName)" />
141 </process>
142</template>
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 @@
1All rights reserved.
2
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8 * Redistributions in binary form must reproduce the above copyright
9 notice, this list of conditions and the following disclaimer in the
10 documentation and/or other materials provided with the distribution.
11 * Neither the name of PG_ORGANIZATION nor the
12 names of its contributors may be used to endorse or promote products
13 derived from this software without specific prior written permission.
14
15THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24SOFTWARE, 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 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123
124Thus, it is not the intent of this section to claim rights or contest
125your rights to work written entirely by you; rather, the intent is to
126exercise the right to control the distribution of derivative or
127collective works based on the Program.
128
129In addition, mere aggregation of another work not based on the Program
130with the Program (or with a work based on the Program) on a volume of
131a storage or distribution medium does not bring the other work under
132the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135under Section 2) in object code or executable form under the terms of
136Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155The source code for a work means the preferred form of the work for
156making modifications to it. For an executable work, complete source
157code means all the source code for all modules it contains, plus any
158associated interface definition files, plus the scripts used to
159control compilation and installation of the executable. However, as a
160special exception, the source code distributed need not include
161anything that is normally distributed (in either source or binary
162form) with the major components (compiler, kernel, and so on) of the
163operating system on which the executable runs, unless that component
164itself accompanies the executable.
165
166If distribution of executable or object code is made by offering
167access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is
175void, and will automatically terminate your rights under this License.
176However, parties who have received copies, or rights, from you under
177this License will not have their licenses terminated so long as such
178parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181signed it. However, nothing else grants you permission to modify or
182distribute the Program or its derivative works. These actions are
183prohibited by law if you do not accept this License. Therefore, by
184modifying or distributing the Program (or any work based on the
185Program), you indicate your acceptance of this License to do so, and
186all its terms and conditions for copying, distributing or modifying
187the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190Program), the recipient automatically receives a license from the
191original licensor to copy, distribute or modify the Program subject to
192these terms and conditions. You may not impose any further
193restrictions on the recipients' exercise of the rights granted herein.
194You are not responsible for enforcing compliance by third parties to
195this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198infringement or for any other reason (not limited to patent issues),
199conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot
202distribute so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you
204may not distribute the Program at all. For example, if a patent
205license would not permit royalty-free redistribution of the Program by
206all those who receive copies directly or indirectly through you, then
207the only way you could satisfy both it and this License would be to
208refrain entirely from distribution of the Program.
209
210If any portion of this section is held invalid or unenforceable under
211any particular circumstance, the balance of the section is intended to
212apply and the section as a whole is intended to apply in other
213circumstances.
214
215It is not the purpose of this section to induce you to infringe any
216patents or other property right claims or to contest validity of any
217such claims; this section has the sole purpose of protecting the
218integrity of the free software distribution system, which is
219implemented by public license practices. Many people have made
220generous contributions to the wide range of software distributed
221through that system in reliance on consistent application of that
222system; it is up to the author/donor to decide if he or she is willing
223to distribute software through any other system and a licensee cannot
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.
241
242Each version is given a distinguishing version number. If the Program
243specifies a version number of this License which applies to it and "any
244later version", you have the option of following the terms and conditions
245either of that version or of any later version published by the Free
246Software Foundation. If the Program does not specify a version number of
247this License, you may choose any version ever published by the Free Software
248Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251programs whose distribution conditions are different, write to the author
252to ask for permission. For software which is copyrighted by the Free
253Software Foundation, write to the Free Software Foundation; we sometimes
254make exceptions for this. Our decision will be guided by the two goals
255of preserving the free status of all derivatives of our free software and
256of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
281
282 How to Apply These Terms to Your New Programs
283
284 If you develop a new program, and you want it to be of the greatest
285possible use to the public, the best way to achieve this is to make it
286free software which everyone can redistribute and change under these terms.
287
288 To do so, attach the following notices to the program. It is safest
289to attach them to the start of each source file to most effectively
290convey the exclusion of warranty; and each file should have at least
291the "copyright" line and a pointer to where the full notice is found.
292
293 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) <year> <name of author>
295
296 This program is free software; you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; version 2 of the License.
299
300 This program is distributed in the hope that it will be useful,
301 but WITHOUT ANY WARRANTY; without even the implied warranty of
302 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
303 GNU General Public License for more details.
304
305 You should have received a copy of the GNU General Public License
306 along with this program; if not, write to the Free Software
307 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
308
309
310Also add information on how to contact you by electronic and paper mail.
311
312If the program is interactive, make it output a short notice like this
313when it starts in an interactive mode:
314
315 Gnomovision version 69, Copyright (C) year name of author
316 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 This is free software, and you are welcome to redistribute it
318 under certain conditions; type `show c' for details.
319
320The hypothetical commands `show w' and `show c' should show the appropriate
321parts of the General Public License. Of course, the commands you use may
322be called something other than `show w' and `show c'; they could even be
323mouse-clicks or menu items--whatever suits your program.
324
325You should also get your employer (if you work as a programmer) or your
326school, if any, to sign a "copyright disclaimer" for the program, if
327necessary. Here is a sample; alter the names:
328
329 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
332 <signature of Ty Coon>, 1 April 1989
333 Ty Coon, President of Vice
334
335This General Public License does not permit incorporating your program into
336proprietary programs. If your program is a subroutine library, you may
337consider it more useful to permit linking proprietary applications with the
338library. If this is what you want to do, use the GNU Library General
339Public 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 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123
124Thus, it is not the intent of this section to claim rights or contest
125your rights to work written entirely by you; rather, the intent is to
126exercise the right to control the distribution of derivative or
127collective works based on the Program.
128
129In addition, mere aggregation of another work not based on the Program
130with the Program (or with a work based on the Program) on a volume of
131a storage or distribution medium does not bring the other work under
132the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135under Section 2) in object code or executable form under the terms of
136Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155The source code for a work means the preferred form of the work for
156making modifications to it. For an executable work, complete source
157code means all the source code for all modules it contains, plus any
158associated interface definition files, plus the scripts used to
159control compilation and installation of the executable. However, as a
160special exception, the source code distributed need not include
161anything that is normally distributed (in either source or binary
162form) with the major components (compiler, kernel, and so on) of the
163operating system on which the executable runs, unless that component
164itself accompanies the executable.
165
166If distribution of executable or object code is made by offering
167access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is
175void, and will automatically terminate your rights under this License.
176However, parties who have received copies, or rights, from you under
177this License will not have their licenses terminated so long as such
178parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181signed it. However, nothing else grants you permission to modify or
182distribute the Program or its derivative works. These actions are
183prohibited by law if you do not accept this License. Therefore, by
184modifying or distributing the Program (or any work based on the
185Program), you indicate your acceptance of this License to do so, and
186all its terms and conditions for copying, distributing or modifying
187the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190Program), the recipient automatically receives a license from the
191original licensor to copy, distribute or modify the Program subject to
192these terms and conditions. You may not impose any further
193restrictions on the recipients' exercise of the rights granted herein.
194You are not responsible for enforcing compliance by third parties to
195this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198infringement or for any other reason (not limited to patent issues),
199conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot
202distribute so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you
204may not distribute the Program at all. For example, if a patent
205license would not permit royalty-free redistribution of the Program by
206all those who receive copies directly or indirectly through you, then
207the only way you could satisfy both it and this License would be to
208refrain entirely from distribution of the Program.
209
210If any portion of this section is held invalid or unenforceable under
211any particular circumstance, the balance of the section is intended to
212apply and the section as a whole is intended to apply in other
213circumstances.
214
215It is not the purpose of this section to induce you to infringe any
216patents or other property right claims or to contest validity of any
217such claims; this section has the sole purpose of protecting the
218integrity of the free software distribution system, which is
219implemented by public license practices. Many people have made
220generous contributions to the wide range of software distributed
221through that system in reliance on consistent application of that
222system; it is up to the author/donor to decide if he or she is willing
223to distribute software through any other system and a licensee cannot
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.
241
242Each version is given a distinguishing version number. If the Program
243specifies a version number of this License which applies to it and "any
244later version", you have the option of following the terms and conditions
245either of that version or of any later version published by the Free
246Software Foundation. If the Program does not specify a version number of
247this License, you may choose any version ever published by the Free Software
248Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251programs whose distribution conditions are different, write to the author
252to ask for permission. For software which is copyrighted by the Free
253Software Foundation, write to the Free Software Foundation; we sometimes
254make exceptions for this. Our decision will be guided by the two goals
255of preserving the free status of all derivatives of our free software and
256of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
281
282 How to Apply These Terms to Your New Programs
283
284 If you develop a new program, and you want it to be of the greatest
285possible use to the public, the best way to achieve this is to make it
286free software which everyone can redistribute and change under these terms.
287
288 To do so, attach the following notices to the program. It is safest
289to attach them to the start of each source file to most effectively
290convey the exclusion of warranty; and each file should have at least
291the "copyright" line and a pointer to where the full notice is found.
292
293 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) <year> <name of author>
295
296 This program is free software; you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; either version 2 of the License, or
299 (at your option) any later version.
300
301 This program is distributed in the hope that it will be useful,
302 but WITHOUT ANY WARRANTY; without even the implied warranty of
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details.
305
306 You should have received a copy of the GNU General Public License
307 along with this program; if not, write to the Free Software
308 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
309
310
311Also add information on how to contact you by electronic and paper mail.
312
313If the program is interactive, make it output a short notice like this
314when it starts in an interactive mode:
315
316 Gnomovision version 69, Copyright (C) year name of author
317 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318 This is free software, and you are welcome to redistribute it
319 under certain conditions; type `show c' for details.
320
321The hypothetical commands `show w' and `show c' should show the appropriate
322parts of the General Public License. Of course, the commands you use may
323be called something other than `show w' and `show c'; they could even be
324mouse-clicks or menu items--whatever suits your program.
325
326You should also get your employer (if you work as a programmer) or your
327school, if any, to sign a "copyright disclaimer" for the program, if
328necessary. Here is a sample; alter the names:
329
330 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331 `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
333 <signature of Ty Coon>, 1 April 1989
334 Ty Coon, President of Vice
335
336This General Public License does not permit incorporating your program into
337proprietary programs. If your program is a subroutine library, you may
338consider it more useful to permit linking proprietary applications with the
339library. If this is what you want to do, use the GNU Library General
340Public 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 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 3, 29 June 2007
3
4 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 Preamble
9
10 The GNU General Public License is a free, copyleft license for
11software and other kinds of works.
12
13 The licenses for most software and other practical works are designed
14to take away your freedom to share and change the works. By contrast,
15the GNU General Public License is intended to guarantee your freedom to
16share and change all versions of a program--to make sure it remains free
17software for all its users. We, the Free Software Foundation, use the
18GNU General Public License for most of our software; it applies also to
19any other work released this way by its authors. You can apply it to
20your programs, too.
21
22 When we speak of free software, we are referring to freedom, not
23price. Our General Public Licenses are designed to make sure that you
24have the freedom to distribute copies of free software (and charge for
25them if you wish), that you receive source code or can get it if you
26want it, that you can change the software or use pieces of it in new
27free programs, and that you know you can do these things.
28
29 To protect your rights, we need to prevent others from denying you
30these rights or asking you to surrender the rights. Therefore, you have
31certain responsibilities if you distribute copies of the software, or if
32you modify it: responsibilities to respect the freedom of others.
33
34 For example, if you distribute copies of such a program, whether
35gratis or for a fee, you must pass on to the recipients the same
36freedoms that you received. You must make sure that they, too, receive
37or can get the source code. And you must show them these terms so they
38know their rights.
39
40 Developers that use the GNU GPL protect your rights with two steps:
41(1) assert copyright on the software, and (2) offer you this License
42giving you legal permission to copy, distribute and/or modify it.
43
44 For the developers' and authors' protection, the GPL clearly explains
45that there is no warranty for this free software. For both users' and
46authors' sake, the GPL requires that modified versions be marked as
47changed, so that their problems will not be attributed erroneously to
48authors of previous versions.
49
50 Some devices are designed to deny users access to install or run
51modified versions of the software inside them, although the manufacturer
52can do so. This is fundamentally incompatible with the aim of
53protecting users' freedom to change the software. The systematic
54pattern of such abuse occurs in the area of products for individuals to
55use, which is precisely where it is most unacceptable. Therefore, we
56have designed this version of the GPL to prohibit the practice for those
57products. If such problems arise substantially in other domains, we
58stand ready to extend this provision to those domains in future versions
59of the GPL, as needed to protect the freedom of users.
60
61 Finally, every program is threatened constantly by software patents.
62States should not allow patents to restrict development and use of
63software on general-purpose computers, but in those that do, we wish to
64avoid the special danger that patents applied to a free program could
65make it effectively proprietary. To prevent this, the GPL assures that
66patents cannot be used to render the program non-free.
67
68 The precise terms and conditions for copying, distribution and
69modification follow.
70
71 TERMS AND CONDITIONS
72
73 0. Definitions.
74
75 "This License" refers to version 3 of the GNU General Public License.
76
77 "Copyright" also means copyright-like laws that apply to other kinds of
78works, such as semiconductor masks.
79
80 "The Program" refers to any copyrightable work licensed under this
81License. Each licensee is addressed as "you". "Licensees" and
82"recipients" may be individuals or organizations.
83
84 To "modify" a work means to copy from or adapt all or part of the work
85in a fashion requiring copyright permission, other than the making of an
86exact copy. The resulting work is called a "modified version" of the
87earlier work or a work "based on" the earlier work.
88
89 A "covered work" means either the unmodified Program or a work based
90on the Program.
91
92 To "propagate" a work means to do anything with it that, without
93permission, would make you directly or secondarily liable for
94infringement under applicable copyright law, except executing it on a
95computer or modifying a private copy. Propagation includes copying,
96distribution (with or without modification), making available to the
97public, and in some countries other activities as well.
98
99 To "convey" a work means any kind of propagation that enables other
100parties to make or receive copies. Mere interaction with a user through
101a computer network, with no transfer of a copy, is not conveying.
102
103 An interactive user interface displays "Appropriate Legal Notices"
104to the extent that it includes a convenient and prominently visible
105feature that (1) displays an appropriate copyright notice, and (2)
106tells the user that there is no warranty for the work (except to the
107extent that warranties are provided), that licensees may convey the
108work under this License, and how to view a copy of this License. If
109the interface presents a list of user commands or options, such as a
110menu, a prominent item in the list meets this criterion.
111
112 1. Source Code.
113
114 The "source code" for a work means the preferred form of the work
115for making modifications to it. "Object code" means any non-source
116form of a work.
117
118 A "Standard Interface" means an interface that either is an official
119standard defined by a recognized standards body, or, in the case of
120interfaces specified for a particular programming language, one that
121is widely used among developers working in that language.
122
123 The "System Libraries" of an executable work include anything, other
124than the work as a whole, that (a) is included in the normal form of
125packaging a Major Component, but which is not part of that Major
126Component, and (b) serves only to enable use of the work with that
127Major Component, or to implement a Standard Interface for which an
128implementation is available to the public in source code form. A
129"Major Component", in this context, means a major essential component
130(kernel, window system, and so on) of the specific operating system
131(if any) on which the executable work runs, or a compiler used to
132produce the work, or an object code interpreter used to run it.
133
134 The "Corresponding Source" for a work in object code form means all
135the source code needed to generate, install, and (for an executable
136work) run the object code and to modify the work, including scripts to
137control those activities. However, it does not include the work's
138System Libraries, or general-purpose tools or generally available free
139programs which are used unmodified in performing those activities but
140which are not part of the work. For example, Corresponding Source
141includes interface definition files associated with source files for
142the work, and the source code for shared libraries and dynamically
143linked subprograms that the work is specifically designed to require,
144such as by intimate data communication or control flow between those
145subprograms and other parts of the work.
146
147 The Corresponding Source need not include anything that users
148can regenerate automatically from other parts of the Corresponding
149Source.
150
151 The Corresponding Source for a work in source code form is that
152same work.
153
154 2. Basic Permissions.
155
156 All rights granted under this License are granted for the term of
157copyright on the Program, and are irrevocable provided the stated
158conditions are met. This License explicitly affirms your unlimited
159permission to run the unmodified Program. The output from running a
160covered work is covered by this License only if the output, given its
161content, constitutes a covered work. This License acknowledges your
162rights of fair use or other equivalent, as provided by copyright law.
163
164 You may make, run and propagate covered works that you do not
165convey, without conditions so long as your license otherwise remains
166in force. You may convey covered works to others for the sole purpose
167of having them make modifications exclusively for you, or provide you
168with facilities for running those works, provided that you comply with
169the terms of this License in conveying all material for which you do
170not control copyright. Those thus making or running the covered works
171for you must do so exclusively on your behalf, under your direction
172and control, on terms that prohibit them from making any copies of
173your copyrighted material outside their relationship with you.
174
175 Conveying under any other circumstances is permitted solely under
176the conditions stated below. Sublicensing is not allowed; section 10
177makes it unnecessary.
178
179 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
181 No covered work shall be deemed part of an effective technological
182measure under any applicable law fulfilling obligations under article
18311 of the WIPO copyright treaty adopted on 20 December 1996, or
184similar laws prohibiting or restricting circumvention of such
185measures.
186
187 When you convey a covered work, you waive any legal power to forbid
188circumvention of technological measures to the extent such circumvention
189is effected by exercising rights under this License with respect to
190the covered work, and you disclaim any intention to limit operation or
191modification of the work as a means of enforcing, against the work's
192users, your or third parties' legal rights to forbid circumvention of
193technological measures.
194
195 4. Conveying Verbatim Copies.
196
197 You may convey verbatim copies of the Program's source code as you
198receive it, in any medium, provided that you conspicuously and
199appropriately publish on each copy an appropriate copyright notice;
200keep intact all notices stating that this License and any
201non-permissive terms added in accord with section 7 apply to the code;
202keep intact all notices of the absence of any warranty; and give all
203recipients a copy of this License along with the Program.
204
205 You may charge any price or no price for each copy that you convey,
206and you may offer support or warranty protection for a fee.
207
208 5. Conveying Modified Source Versions.
209
210 You may convey a work based on the Program, or the modifications to
211produce it from the Program, in the form of source code under the
212terms of section 4, provided that you also meet all of these conditions:
213
214 a) The work must carry prominent notices stating that you modified
215 it, and giving a relevant date.
216
217 b) The work must carry prominent notices stating that it is
218 released under this License and any conditions added under section
219 7. This requirement modifies the requirement in section 4 to
220 "keep intact all notices".
221
222 c) You must license the entire work, as a whole, under this
223 License to anyone who comes into possession of a copy. This
224 License will therefore apply, along with any applicable section 7
225 additional terms, to the whole of the work, and all its parts,
226 regardless of how they are packaged. This License gives no
227 permission to license the work in any other way, but it does not
228 invalidate such permission if you have separately received it.
229
230 d) If the work has interactive user interfaces, each must display
231 Appropriate Legal Notices; however, if the Program has interactive
232 interfaces that do not display Appropriate Legal Notices, your
233 work need not make them do so.
234
235 A compilation of a covered work with other separate and independent
236works, which are not by their nature extensions of the covered work,
237and which are not combined with it such as to form a larger program,
238in or on a volume of a storage or distribution medium, is called an
239"aggregate" if the compilation and its resulting copyright are not
240used to limit the access or legal rights of the compilation's users
241beyond what the individual works permit. Inclusion of a covered work
242in an aggregate does not cause this License to apply to the other
243parts of the aggregate.
244
245 6. Conveying Non-Source Forms.
246
247 You may convey a covered work in object code form under the terms
248of sections 4 and 5, provided that you also convey the
249machine-readable Corresponding Source under the terms of this License,
250in one of these ways:
251
252 a) Convey the object code in, or embodied in, a physical product
253 (including a physical distribution medium), accompanied by the
254 Corresponding Source fixed on a durable physical medium
255 customarily used for software interchange.
256
257 b) Convey the object code in, or embodied in, a physical product
258 (including a physical distribution medium), accompanied by a
259 written offer, valid for at least three years and valid for as
260 long as you offer spare parts or customer support for that product
261 model, to give anyone who possesses the object code either (1) a
262 copy of the Corresponding Source for all the software in the
263 product that is covered by this License, on a durable physical
264 medium customarily used for software interchange, for a price no
265 more than your reasonable cost of physically performing this
266 conveying of source, or (2) access to copy the
267 Corresponding Source from a network server at no charge.
268
269 c) Convey individual copies of the object code with a copy of the
270 written offer to provide the Corresponding Source. This
271 alternative is allowed only occasionally and noncommercially, and
272 only if you received the object code with such an offer, in accord
273 with subsection 6b.
274
275 d) Convey the object code by offering access from a designated
276 place (gratis or for a charge), and offer equivalent access to the
277 Corresponding Source in the same way through the same place at no
278 further charge. You need not require recipients to copy the
279 Corresponding Source along with the object code. If the place to
280 copy the object code is a network server, the Corresponding Source
281 may be on a different server (operated by you or a third party)
282 that supports equivalent copying facilities, provided you maintain
283 clear directions next to the object code saying where to find the
284 Corresponding Source. Regardless of what server hosts the
285 Corresponding Source, you remain obligated to ensure that it is
286 available for as long as needed to satisfy these requirements.
287
288 e) Convey the object code using peer-to-peer transmission, provided
289 you inform other peers where the object code and Corresponding
290 Source of the work are being offered to the general public at no
291 charge under subsection 6d.
292
293 A separable portion of the object code, whose source code is excluded
294from the Corresponding Source as a System Library, need not be
295included in conveying the object code work.
296
297 A "User Product" is either (1) a "consumer product", which means any
298tangible personal property which is normally used for personal, family,
299or household purposes, or (2) anything designed or sold for incorporation
300into a dwelling. In determining whether a product is a consumer product,
301doubtful cases shall be resolved in favor of coverage. For a particular
302product received by a particular user, "normally used" refers to a
303typical or common use of that class of product, regardless of the status
304of the particular user or of the way in which the particular user
305actually uses, or expects or is expected to use, the product. A product
306is a consumer product regardless of whether the product has substantial
307commercial, industrial or non-consumer uses, unless such uses represent
308the only significant mode of use of the product.
309
310 "Installation Information" for a User Product means any methods,
311procedures, authorization keys, or other information required to install
312and execute modified versions of a covered work in that User Product from
313a modified version of its Corresponding Source. The information must
314suffice to ensure that the continued functioning of the modified object
315code is in no case prevented or interfered with solely because
316modification has been made.
317
318 If you convey an object code work under this section in, or with, or
319specifically for use in, a User Product, and the conveying occurs as
320part of a transaction in which the right of possession and use of the
321User Product is transferred to the recipient in perpetuity or for a
322fixed term (regardless of how the transaction is characterized), the
323Corresponding Source conveyed under this section must be accompanied
324by the Installation Information. But this requirement does not apply
325if neither you nor any third party retains the ability to install
326modified object code on the User Product (for example, the work has
327been installed in ROM).
328
329 The requirement to provide Installation Information does not include a
330requirement to continue to provide support service, warranty, or updates
331for a work that has been modified or installed by the recipient, or for
332the User Product in which it has been modified or installed. Access to a
333network may be denied when the modification itself materially and
334adversely affects the operation of the network or violates the rules and
335protocols for communication across the network.
336
337 Corresponding Source conveyed, and Installation Information provided,
338in accord with this section must be in a format that is publicly
339documented (and with an implementation available to the public in
340source code form), and must require no special password or key for
341unpacking, reading or copying.
342
343 7. Additional Terms.
344
345 "Additional permissions" are terms that supplement the terms of this
346License by making exceptions from one or more of its conditions.
347Additional permissions that are applicable to the entire Program shall
348be treated as though they were included in this License, to the extent
349that they are valid under applicable law. If additional permissions
350apply only to part of the Program, that part may be used separately
351under those permissions, but the entire Program remains governed by
352this License without regard to the additional permissions.
353
354 When you convey a copy of a covered work, you may at your option
355remove any additional permissions from that copy, or from any part of
356it. (Additional permissions may be written to require their own
357removal in certain cases when you modify the work.) You may place
358additional permissions on material, added by you to a covered work,
359for which you have or can give appropriate copyright permission.
360
361 Notwithstanding any other provision of this License, for material you
362add to a covered work, you may (if authorized by the copyright holders of
363that material) supplement the terms of this License with terms:
364
365 a) Disclaiming warranty or limiting liability differently from the
366 terms of sections 15 and 16 of this License; or
367
368 b) Requiring preservation of specified reasonable legal notices or
369 author attributions in that material or in the Appropriate Legal
370 Notices displayed by works containing it; or
371
372 c) Prohibiting misrepresentation of the origin of that material, or
373 requiring that modified versions of such material be marked in
374 reasonable ways as different from the original version; or
375
376 d) Limiting the use for publicity purposes of names of licensors or
377 authors of the material; or
378
379 e) Declining to grant rights under trademark law for use of some
380 trade names, trademarks, or service marks; or
381
382 f) Requiring indemnification of licensors and authors of that
383 material by anyone who conveys the material (or modified versions of
384 it) with contractual assumptions of liability to the recipient, for
385 any liability that these contractual assumptions directly impose on
386 those licensors and authors.
387
388 All other non-permissive additional terms are considered "further
389restrictions" within the meaning of section 10. If the Program as you
390received it, or any part of it, contains a notice stating that it is
391governed by this License along with a term that is a further
392restriction, you may remove that term. If a license document contains
393a further restriction but permits relicensing or conveying under this
394License, you may add to a covered work material governed by the terms
395of that license document, provided that the further restriction does
396not survive such relicensing or conveying.
397
398 If you add terms to a covered work in accord with this section, you
399must place, in the relevant source files, a statement of the
400additional terms that apply to those files, or a notice indicating
401where to find the applicable terms.
402
403 Additional terms, permissive or non-permissive, may be stated in the
404form of a separately written license, or stated as exceptions;
405the above requirements apply either way.
406
407 8. Termination.
408
409 You may not propagate or modify a covered work except as expressly
410provided under this License. Any attempt otherwise to propagate or
411modify it is void, and will automatically terminate your rights under
412this License (including any patent licenses granted under the third
413paragraph of section 11).
414
415 However, if you cease all violation of this License, then your
416license from a particular copyright holder is reinstated (a)
417provisionally, unless and until the copyright holder explicitly and
418finally terminates your license, and (b) permanently, if the copyright
419holder fails to notify you of the violation by some reasonable means
420prior to 60 days after the cessation.
421
422 Moreover, your license from a particular copyright holder is
423reinstated permanently if the copyright holder notifies you of the
424violation by some reasonable means, this is the first time you have
425received notice of violation of this License (for any work) from that
426copyright holder, and you cure the violation prior to 30 days after
427your receipt of the notice.
428
429 Termination of your rights under this section does not terminate the
430licenses of parties who have received copies or rights from you under
431this License. If your rights have been terminated and not permanently
432reinstated, you do not qualify to receive new licenses for the same
433material under section 10.
434
435 9. Acceptance Not Required for Having Copies.
436
437 You are not required to accept this License in order to receive or
438run a copy of the Program. Ancillary propagation of a covered work
439occurring solely as a consequence of using peer-to-peer transmission
440to receive a copy likewise does not require acceptance. However,
441nothing other than this License grants you permission to propagate or
442modify any covered work. These actions infringe copyright if you do
443not accept this License. Therefore, by modifying or propagating a
444covered work, you indicate your acceptance of this License to do so.
445
446 10. Automatic Licensing of Downstream Recipients.
447
448 Each time you convey a covered work, the recipient automatically
449receives a license from the original licensors, to run, modify and
450propagate that work, subject to this License. You are not responsible
451for enforcing compliance by third parties with this License.
452
453 An "entity transaction" is a transaction transferring control of an
454organization, or substantially all assets of one, or subdividing an
455organization, or merging organizations. If propagation of a covered
456work results from an entity transaction, each party to that
457transaction who receives a copy of the work also receives whatever
458licenses to the work the party's predecessor in interest had or could
459give under the previous paragraph, plus a right to possession of the
460Corresponding Source of the work from the predecessor in interest, if
461the predecessor has it or can get it with reasonable efforts.
462
463 You may not impose any further restrictions on the exercise of the
464rights granted or affirmed under this License. For example, you may
465not impose a license fee, royalty, or other charge for exercise of
466rights granted under this License, and you may not initiate litigation
467(including a cross-claim or counterclaim in a lawsuit) alleging that
468any patent claim is infringed by making, using, selling, offering for
469sale, or importing the Program or any portion of it.
470
471 11. Patents.
472
473 A "contributor" is a copyright holder who authorizes use under this
474License of the Program or a work on which the Program is based. The
475work thus licensed is called the contributor's "contributor version".
476
477 A contributor's "essential patent claims" are all patent claims
478owned or controlled by the contributor, whether already acquired or
479hereafter acquired, that would be infringed by some manner, permitted
480by this License, of making, using, or selling its contributor version,
481but do not include claims that would be infringed only as a
482consequence of further modification of the contributor version. For
483purposes of this definition, "control" includes the right to grant
484patent sublicenses in a manner consistent with the requirements of
485this License.
486
487 Each contributor grants you a non-exclusive, worldwide, royalty-free
488patent license under the contributor's essential patent claims, to
489make, use, sell, offer for sale, import and otherwise run, modify and
490propagate the contents of its contributor version.
491
492 In the following three paragraphs, a "patent license" is any express
493agreement or commitment, however denominated, not to enforce a patent
494(such as an express permission to practice a patent or covenant not to
495sue for patent infringement). To "grant" such a patent license to a
496party means to make such an agreement or commitment not to enforce a
497patent against the party.
498
499 If you convey a covered work, knowingly relying on a patent license,
500and the Corresponding Source of the work is not available for anyone
501to copy, free of charge and under the terms of this License, through a
502publicly available network server or other readily accessible means,
503then you must either (1) cause the Corresponding Source to be so
504available, or (2) arrange to deprive yourself of the benefit of the
505patent license for this particular work, or (3) arrange, in a manner
506consistent with the requirements of this License, to extend the patent
507license to downstream recipients. "Knowingly relying" means you have
508actual knowledge that, but for the patent license, your conveying the
509covered work in a country, or your recipient's use of the covered work
510in a country, would infringe one or more identifiable patents in that
511country that you have reason to believe are valid.
512
513 If, pursuant to or in connection with a single transaction or
514arrangement, you convey, or propagate by procuring conveyance of, a
515covered work, and grant a patent license to some of the parties
516receiving the covered work authorizing them to use, propagate, modify
517or convey a specific copy of the covered work, then the patent license
518you grant is automatically extended to all recipients of the covered
519work and works based on it.
520
521 A patent license is "discriminatory" if it does not include within
522the scope of its coverage, prohibits the exercise of, or is
523conditioned on the non-exercise of one or more of the rights that are
524specifically granted under this License. You may not convey a covered
525work if you are a party to an arrangement with a third party that is
526in the business of distributing software, under which you make payment
527to the third party based on the extent of your activity of conveying
528the work, and under which the third party grants, to any of the
529parties who would receive the covered work from you, a discriminatory
530patent license (a) in connection with copies of the covered work
531conveyed by you (or copies made from those copies), or (b) primarily
532for and in connection with specific products or compilations that
533contain the covered work, unless you entered into that arrangement,
534or that patent license was granted, prior to 28 March 2007.
535
536 Nothing in this License shall be construed as excluding or limiting
537any implied license or other defenses to infringement that may
538otherwise be available to you under applicable patent law.
539
540 12. No Surrender of Others' Freedom.
541
542 If conditions are imposed on you (whether by court order, agreement or
543otherwise) that contradict the conditions of this License, they do not
544excuse you from the conditions of this License. If you cannot convey a
545covered work so as to satisfy simultaneously your obligations under this
546License and any other pertinent obligations, then as a consequence you may
547not convey it at all. For example, if you agree to terms that obligate you
548to collect a royalty for further conveying from those to whom you convey
549the Program, the only way you could satisfy both those terms and this
550License would be to refrain entirely from conveying the Program.
551
552 13. Use with the GNU Affero General Public License.
553
554 Notwithstanding any other provision of this License, you have
555permission to link or combine any covered work with a work licensed
556under version 3 of the GNU Affero General Public License into a single
557combined work, and to convey the resulting work. The terms of this
558License will continue to apply to the part which is the covered work,
559but the special requirements of the GNU Affero General Public License,
560section 13, concerning interaction through a network will apply to the
561combination as such.
562
563 14. Revised Versions of this License.
564
565 The Free Software Foundation may publish revised and/or new versions of
566the GNU General Public License from time to time. Such new versions will
567be similar in spirit to the present version, but may differ in detail to
568address new problems or concerns.
569
570 Each version is given a distinguishing version number. If the
571Program specifies that a certain numbered version of the GNU General
572Public License "or any later version" applies to it, you have the
573option of following the terms and conditions either of that numbered
574version or of any later version published by the Free Software
575Foundation. If the Program does not specify a version number of the
576GNU General Public License, you may choose any version ever published
577by the Free Software Foundation.
578
579 If the Program specifies that a proxy can decide which future
580versions of the GNU General Public License can be used, that proxy's
581public statement of acceptance of a version permanently authorizes you
582to choose that version for the Program.
583
584 Later license versions may give you additional or different
585permissions. However, no additional obligations are imposed on any
586author or copyright holder as a result of your choosing to follow a
587later version.
588
589 15. Disclaimer of Warranty.
590
591 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
600 16. Limitation of Liability.
601
602 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610SUCH DAMAGES.
611
612 17. Interpretation of Sections 15 and 16.
613
614 If the disclaimer of warranty and limitation of liability provided
615above cannot be given local legal effect according to their terms,
616reviewing courts shall apply local law that most closely approximates
617an absolute waiver of all civil liability in connection with the
618Program, unless a warranty or assumption of liability accompanies a
619copy of the Program in return for a fee.
620
621 END OF TERMS AND CONDITIONS
622
623 How to Apply These Terms to Your New Programs
624
625 If you develop a new program, and you want it to be of the greatest
626possible use to the public, the best way to achieve this is to make it
627free software which everyone can redistribute and change under these terms.
628
629 To do so, attach the following notices to the program. It is safest
630to attach them to the start of each source file to most effectively
631state the exclusion of warranty; and each file should have at least
632the "copyright" line and a pointer to where the full notice is found.
633
634 <one line to give the program's name and a brief idea of what it does.>
635 Copyright (C) <year> <name of author>
636
637 This program is free software: you can redistribute it and/or modify
638 it under the terms of the GNU General Public License as published by
639 the Free Software Foundation, either version 3 of the License, or
640 (at your option) any later version.
641
642 This program is distributed in the hope that it will be useful,
643 but WITHOUT ANY WARRANTY; without even the implied warranty of
644 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 GNU General Public License for more details.
646
647 You should have received a copy of the GNU General Public License
648 along with this program. If not, see <http://www.gnu.org/licenses/>.
649
650Also add information on how to contact you by electronic and paper mail.
651
652 If the program does terminal interaction, make it output a short
653notice like this when it starts in an interactive mode:
654
655 <program> Copyright (C) <year> <name of author>
656 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 This is free software, and you are welcome to redistribute it
658 under certain conditions; type `show c' for details.
659
660The hypothetical commands `show w' and `show c' should show the appropriate
661parts of the General Public License. Of course, your program's commands
662might be different; for a GUI interface, you would use an "about box".
663
664 You should also get your employer (if you work as a programmer) or school,
665if any, to sign a "copyright disclaimer" for the program, if necessary.
666For more information on this, and how to apply and follow the GNU GPL, see
667<http://www.gnu.org/licenses/>.
668
669 The GNU General Public License does not permit incorporating your program
670into proprietary programs. If your program is a subroutine library, you
671may consider it more useful to permit linking proprietary applications with
672the library. If this is what you want to do, use the GNU Lesser General
673Public License instead of this License. But first, please read
674<http://www.gnu.org/philosophy/why-not-lgpl.html>. \ 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 @@
1 GNU LESSER GENERAL PUBLIC LICENSE
2 Version 2.1, February 1999
3
4 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9[This is the first released version of the Lesser GPL. It also counts
10 as the successor of the GNU Library Public License, version 2, hence
11 the version number 2.1.]
12
13 Preamble
14
15 The licenses for most software are designed to take away your
16freedom to share and change it. By contrast, the GNU General Public
17Licenses are intended to guarantee your freedom to share and change
18free software--to make sure the software is free for all its users.
19
20 This license, the Lesser General Public License, applies to some
21specially designated software packages--typically libraries--of the
22Free Software Foundation and other authors who decide to use it. You
23can use it too, but we suggest you first think carefully about whether
24this license or the ordinary General Public License is the better
25strategy to use in any particular case, based on the explanations below.
26
27 When we speak of free software, we are referring to freedom of use,
28not price. Our General Public Licenses are designed to make sure that
29you have the freedom to distribute copies of free software (and charge
30for this service if you wish); that you receive source code or can get
31it if you want it; that you can change the software and use pieces of
32it in new free programs; and that you are informed that you can do
33these things.
34
35 To protect your rights, we need to make restrictions that forbid
36distributors to deny you these rights or to ask you to surrender these
37rights. These restrictions translate to certain responsibilities for
38you if you distribute copies of the library or if you modify it.
39
40 For example, if you distribute copies of the library, whether gratis
41or for a fee, you must give the recipients all the rights that we gave
42you. You must make sure that they, too, receive or can get the source
43code. If you link other code with the library, you must provide
44complete object files to the recipients, so that they can relink them
45with the library after making changes to the library and recompiling
46it. And you must show them these terms so they know their rights.
47
48 We protect your rights with a two-step method: (1) we copyright the
49library, and (2) we offer you this license, which gives you legal
50permission to copy, distribute and/or modify the library.
51
52 To protect each distributor, we want to make it very clear that
53there is no warranty for the free library. Also, if the library is
54modified by someone else and passed on, the recipients should know
55that what they have is not the original version, so that the original
56author's reputation will not be affected by problems that might be
57introduced by others.
58
59 Finally, software patents pose a constant threat to the existence of
60any free program. We wish to make sure that a company cannot
61effectively restrict the users of a free program by obtaining a
62restrictive license from a patent holder. Therefore, we insist that
63any patent license obtained for a version of the library must be
64consistent with the full freedom of use specified in this license.
65
66 Most GNU software, including some libraries, is covered by the
67ordinary GNU General Public License. This license, the GNU Lesser
68General Public License, applies to certain designated libraries, and
69is quite different from the ordinary General Public License. We use
70this license for certain libraries in order to permit linking those
71libraries into non-free programs.
72
73 When a program is linked with a library, whether statically or using
74a shared library, the combination of the two is legally speaking a
75combined work, a derivative of the original library. The ordinary
76General Public License therefore permits such linking only if the
77entire combination fits its criteria of freedom. The Lesser General
78Public License permits more lax criteria for linking other code with
79the library.
80
81 We call this license the "Lesser" General Public License because it
82does Less to protect the user's freedom than the ordinary General
83Public License. It also provides other free software developers Less
84of an advantage over competing non-free programs. These disadvantages
85are the reason we use the ordinary General Public License for many
86libraries. However, the Lesser license provides advantages in certain
87special circumstances.
88
89 For example, on rare occasions, there may be a special need to
90encourage the widest possible use of a certain library, so that it becomes
91a de-facto standard. To achieve this, non-free programs must be
92allowed to use the library. A more frequent case is that a free
93library does the same job as widely used non-free libraries. In this
94case, there is little to gain by limiting the free library to free
95software only, so we use the Lesser General Public License.
96
97 In other cases, permission to use a particular library in non-free
98programs enables a greater number of people to use a large body of
99free software. For example, permission to use the GNU C Library in
100non-free programs enables many more people to use the whole GNU
101operating system, as well as its variant, the GNU/Linux operating
102system.
103
104 Although the Lesser General Public License is Less protective of the
105users' freedom, it does ensure that the user of a program that is
106linked with the Library has the freedom and the wherewithal to run
107that program using a modified version of the Library.
108
109 The precise terms and conditions for copying, distribution and
110modification follow. Pay close attention to the difference between a
111"work based on the library" and a "work that uses the library". The
112former contains code derived from the library, whereas the latter must
113be combined with the library in order to run.
114
115 GNU LESSER GENERAL PUBLIC LICENSE
116 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
118 0. This License Agreement applies to any software library or other
119program which contains a notice placed by the copyright holder or
120other authorized party saying it may be distributed under the terms of
121this Lesser General Public License (also called "this License").
122Each licensee is addressed as "you".
123
124 A "library" means a collection of software functions and/or data
125prepared so as to be conveniently linked with application programs
126(which use some of those functions and data) to form executables.
127
128 The "Library", below, refers to any such software library or work
129which has been distributed under these terms. A "work based on the
130Library" means either the Library or any derivative work under
131copyright law: that is to say, a work containing the Library or a
132portion of it, either verbatim or with modifications and/or translated
133straightforwardly into another language. (Hereinafter, translation is
134included without limitation in the term "modification".)
135
136 "Source code" for a work means the preferred form of the work for
137making modifications to it. For a library, complete source code means
138all the source code for all modules it contains, plus any associated
139interface definition files, plus the scripts used to control compilation
140and installation of the library.
141
142 Activities other than copying, distribution and modification are not
143covered by this License; they are outside its scope. The act of
144running a program using the Library is not restricted, and output from
145such a program is covered only if its contents constitute a work based
146on the Library (independent of the use of the Library in a tool for
147writing it). Whether that is true depends on what the Library does
148and what the program that uses the Library does.
149
150 1. You may copy and distribute verbatim copies of the Library's
151complete source code as you receive it, in any medium, provided that
152you conspicuously and appropriately publish on each copy an
153appropriate copyright notice and disclaimer of warranty; keep intact
154all the notices that refer to this License and to the absence of any
155warranty; and distribute a copy of this License along with the
156Library.
157
158 You may charge a fee for the physical act of transferring a copy,
159and you may at your option offer warranty protection in exchange for a
160fee.
161
162 2. You may modify your copy or copies of the Library or any portion
163of it, thus forming a work based on the Library, and copy and
164distribute such modifications or work under the terms of Section 1
165above, provided that you also meet all of these conditions:
166
167 a) The modified work must itself be a software library.
168
169 b) You must cause the files modified to carry prominent notices
170 stating that you changed the files and the date of any change.
171
172 c) You must cause the whole of the work to be licensed at no
173 charge to all third parties under the terms of this License.
174
175 d) If a facility in the modified Library refers to a function or a
176 table of data to be supplied by an application program that uses
177 the facility, other than as an argument passed when the facility
178 is invoked, then you must make a good faith effort to ensure that,
179 in the event an application does not supply such function or
180 table, the facility still operates, and performs whatever part of
181 its purpose remains meaningful.
182
183 (For example, a function in a library to compute square roots has
184 a purpose that is entirely well-defined independent of the
185 application. Therefore, Subsection 2d requires that any
186 application-supplied function or table used by this function must
187 be optional: if the application does not supply it, the square
188 root function must still compute square roots.)
189
190These requirements apply to the modified work as a whole. If
191identifiable sections of that work are not derived from the Library,
192and can be reasonably considered independent and separate works in
193themselves, then this License, and its terms, do not apply to those
194sections when you distribute them as separate works. But when you
195distribute the same sections as part of a whole which is a work based
196on the Library, the distribution of the whole must be on the terms of
197this License, whose permissions for other licensees extend to the
198entire whole, and thus to each and every part regardless of who wrote
199it.
200
201Thus, it is not the intent of this section to claim rights or contest
202your rights to work written entirely by you; rather, the intent is to
203exercise the right to control the distribution of derivative or
204collective works based on the Library.
205
206In addition, mere aggregation of another work not based on the Library
207with the Library (or with a work based on the Library) on a volume of
208a storage or distribution medium does not bring the other work under
209the scope of this License.
210
211 3. You may opt to apply the terms of the ordinary GNU General Public
212License instead of this License to a given copy of the Library. To do
213this, you must alter all the notices that refer to this License, so
214that they refer to the ordinary GNU General Public License, version 2,
215instead of to this License. (If a newer version than version 2 of the
216ordinary GNU General Public License has appeared, then you can specify
217that version instead if you wish.) Do not make any other change in
218these notices.
219
220 Once this change is made in a given copy, it is irreversible for
221that copy, so the ordinary GNU General Public License applies to all
222subsequent copies and derivative works made from that copy.
223
224 This option is useful when you wish to copy part of the code of
225the Library into a program that is not a library.
226
227 4. You may copy and distribute the Library (or a portion or
228derivative of it, under Section 2) in object code or executable form
229under the terms of Sections 1 and 2 above provided that you accompany
230it with the complete corresponding machine-readable source code, which
231must be distributed under the terms of Sections 1 and 2 above on a
232medium customarily used for software interchange.
233
234 If distribution of object code is made by offering access to copy
235from a designated place, then offering equivalent access to copy the
236source code from the same place satisfies the requirement to
237distribute the source code, even though third parties are not
238compelled to copy the source along with the object code.
239
240 5. A program that contains no derivative of any portion of the
241Library, but is designed to work with the Library by being compiled or
242linked with it, is called a "work that uses the Library". Such a
243work, in isolation, is not a derivative work of the Library, and
244therefore falls outside the scope of this License.
245
246 However, linking a "work that uses the Library" with the Library
247creates an executable that is a derivative of the Library (because it
248contains portions of the Library), rather than a "work that uses the
249library". The executable is therefore covered by this License.
250Section 6 states terms for distribution of such executables.
251
252 When a "work that uses the Library" uses material from a header file
253that is part of the Library, the object code for the work may be a
254derivative work of the Library even though the source code is not.
255Whether this is true is especially significant if the work can be
256linked without the Library, or if the work is itself a library. The
257threshold for this to be true is not precisely defined by law.
258
259 If such an object file uses only numerical parameters, data
260structure layouts and accessors, and small macros and small inline
261functions (ten lines or less in length), then the use of the object
262file is unrestricted, regardless of whether it is legally a derivative
263work. (Executables containing this object code plus portions of the
264Library will still fall under Section 6.)
265
266 Otherwise, if the work is a derivative of the Library, you may
267distribute the object code for the work under the terms of Section 6.
268Any executables containing that work also fall under Section 6,
269whether or not they are linked directly with the Library itself.
270
271 6. As an exception to the Sections above, you may also combine or
272link a "work that uses the Library" with the Library to produce a
273work containing portions of the Library, and distribute that work
274under terms of your choice, provided that the terms permit
275modification of the work for the customer's own use and reverse
276engineering for debugging such modifications.
277
278 You must give prominent notice with each copy of the work that the
279Library is used in it and that the Library and its use are covered by
280this License. You must supply a copy of this License. If the work
281during execution displays copyright notices, you must include the
282copyright notice for the Library among them, as well as a reference
283directing the user to the copy of this License. Also, you must do one
284of these things:
285
286 a) Accompany the work with the complete corresponding
287 machine-readable source code for the Library including whatever
288 changes were used in the work (which must be distributed under
289 Sections 1 and 2 above); and, if the work is an executable linked
290 with the Library, with the complete machine-readable "work that
291 uses the Library", as object code and/or source code, so that the
292 user can modify the Library and then relink to produce a modified
293 executable containing the modified Library. (It is understood
294 that the user who changes the contents of definitions files in the
295 Library will not necessarily be able to recompile the application
296 to use the modified definitions.)
297
298 b) Use a suitable shared library mechanism for linking with the
299 Library. A suitable mechanism is one that (1) uses at run time a
300 copy of the library already present on the user's computer system,
301 rather than copying library functions into the executable, and (2)
302 will operate properly with a modified version of the library, if
303 the user installs one, as long as the modified version is
304 interface-compatible with the version that the work was made with.
305
306 c) Accompany the work with a written offer, valid for at
307 least three years, to give the same user the materials
308 specified in Subsection 6a, above, for a charge no more
309 than the cost of performing this distribution.
310
311 d) If distribution of the work is made by offering access to copy
312 from a designated place, offer equivalent access to copy the above
313 specified materials from the same place.
314
315 e) Verify that the user has already received a copy of these
316 materials or that you have already sent this user a copy.
317
318 For an executable, the required form of the "work that uses the
319Library" must include any data and utility programs needed for
320reproducing the executable from it. However, as a special exception,
321the materials to be distributed need not include anything that is
322normally distributed (in either source or binary form) with the major
323components (compiler, kernel, and so on) of the operating system on
324which the executable runs, unless that component itself accompanies
325the executable.
326
327 It may happen that this requirement contradicts the license
328restrictions of other proprietary libraries that do not normally
329accompany the operating system. Such a contradiction means you cannot
330use both them and the Library together in an executable that you
331distribute.
332
333 7. You may place library facilities that are a work based on the
334Library side-by-side in a single library together with other library
335facilities not covered by this License, and distribute such a combined
336library, provided that the separate distribution of the work based on
337the Library and of the other library facilities is otherwise
338permitted, and provided that you do these two things:
339
340 a) Accompany the combined library with a copy of the same work
341 based on the Library, uncombined with any other library
342 facilities. This must be distributed under the terms of the
343 Sections above.
344
345 b) Give prominent notice with the combined library of the fact
346 that part of it is a work based on the Library, and explaining
347 where to find the accompanying uncombined form of the same work.
348
349 8. You may not copy, modify, sublicense, link with, or distribute
350the Library except as expressly provided under this License. Any
351attempt otherwise to copy, modify, sublicense, link with, or
352distribute the Library is void, and will automatically terminate your
353rights under this License. However, parties who have received copies,
354or rights, from you under this License will not have their licenses
355terminated so long as such parties remain in full compliance.
356
357 9. You are not required to accept this License, since you have not
358signed it. However, nothing else grants you permission to modify or
359distribute the Library or its derivative works. These actions are
360prohibited by law if you do not accept this License. Therefore, by
361modifying or distributing the Library (or any work based on the
362Library), you indicate your acceptance of this License to do so, and
363all its terms and conditions for copying, distributing or modifying
364the Library or works based on it.
365
366 10. Each time you redistribute the Library (or any work based on the
367Library), the recipient automatically receives a license from the
368original licensor to copy, distribute, link with or modify the Library
369subject to these terms and conditions. You may not impose any further
370restrictions on the recipients' exercise of the rights granted herein.
371You are not responsible for enforcing compliance by third parties with
372this License.
373
374 11. If, as a consequence of a court judgment or allegation of patent
375infringement or for any other reason (not limited to patent issues),
376conditions are imposed on you (whether by court order, agreement or
377otherwise) that contradict the conditions of this License, they do not
378excuse you from the conditions of this License. If you cannot
379distribute so as to satisfy simultaneously your obligations under this
380License and any other pertinent obligations, then as a consequence you
381may not distribute the Library at all. For example, if a patent
382license would not permit royalty-free redistribution of the Library by
383all those who receive copies directly or indirectly through you, then
384the only way you could satisfy both it and this License would be to
385refrain entirely from distribution of the Library.
386
387If any portion of this section is held invalid or unenforceable under any
388particular circumstance, the balance of the section is intended to apply,
389and the section as a whole is intended to apply in other circumstances.
390
391It is not the purpose of this section to induce you to infringe any
392patents or other property right claims or to contest validity of any
393such claims; this section has the sole purpose of protecting the
394integrity of the free software distribution system which is
395implemented by public license practices. Many people have made
396generous contributions to the wide range of software distributed
397through that system in reliance on consistent application of that
398system; it is up to the author/donor to decide if he or she is willing
399to distribute software through any other system and a licensee cannot
400impose that choice.
401
402This section is intended to make thoroughly clear what is believed to
403be a consequence of the rest of this License.
404
405 12. If the distribution and/or use of the Library is restricted in
406certain countries either by patents or by copyrighted interfaces, the
407original copyright holder who places the Library under this License may add
408an explicit geographical distribution limitation excluding those countries,
409so that distribution is permitted only in or among countries not thus
410excluded. In such case, this License incorporates the limitation as if
411written in the body of this License.
412
413 13. The Free Software Foundation may publish revised and/or new
414versions of the Lesser General Public License from time to time.
415Such new versions will be similar in spirit to the present version,
416but may differ in detail to address new problems or concerns.
417
418Each version is given a distinguishing version number. If the Library
419specifies a version number of this License which applies to it and
420"any later version", you have the option of following the terms and
421conditions either of that version or of any later version published by
422the Free Software Foundation. If the Library does not specify a
423license version number, you may choose any version ever published by
424the Free Software Foundation.
425
426 14. If you wish to incorporate parts of the Library into other free
427programs whose distribution conditions are incompatible with these,
428write to the author to ask for permission. For software which is
429copyrighted by the Free Software Foundation, write to the Free
430Software Foundation; we sometimes make exceptions for this. Our
431decision will be guided by the two goals of preserving the free status
432of all derivatives of our free software and of promoting the sharing
433and reuse of software generally.
434
435 NO WARRANTY
436
437 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
447 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456DAMAGES.
457
458 END OF TERMS AND CONDITIONS
459
460 How to Apply These Terms to Your New Libraries
461
462 If you develop a new library, and you want it to be of the greatest
463possible use to the public, we recommend making it free software that
464everyone can redistribute and change. You can do so by permitting
465redistribution under these terms (or, alternatively, under the terms of the
466ordinary General Public License).
467
468 To apply these terms, attach the following notices to the library. It is
469safest to attach them to the start of each source file to most effectively
470convey the exclusion of warranty; and each file should have at least the
471"copyright" line and a pointer to where the full notice is found.
472
473 <one line to give the library's name and a brief idea of what it does.>
474 Copyright (C) <year> <name of author>
475
476 This library is free software; you can redistribute it and/or
477 modify it under the terms of the GNU Lesser General Public
478 License as published by the Free Software Foundation; either
479 version 2.1 of the License, or (at your option) any later version.
480
481 This library is distributed in the hope that it will be useful,
482 but WITHOUT ANY WARRANTY; without even the implied warranty of
483 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484 Lesser General Public License for more details.
485
486 You should have received a copy of the GNU Lesser General Public
487 License along with this library; if not, write to the Free Software
488 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
489
490Also add information on how to contact you by electronic and paper mail.
491
492You should also get your employer (if you work as a programmer) or your
493school, if any, to sign a "copyright disclaimer" for the library, if
494necessary. Here is a sample; alter the names:
495
496 Yoyodyne, Inc., hereby disclaims all copyright interest in the
497 library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498
499 <signature of Ty Coon>, 1 April 1990
500 Ty Coon, President of Vice
501
502That'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 @@
1 GNU LESSER GENERAL PUBLIC LICENSE
2 Version 3, 29 June 2007
3
4 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8
9 This version of the GNU Lesser General Public License incorporates
10the terms and conditions of version 3 of the GNU General Public
11License, supplemented by the additional permissions listed below.
12
13 0. Additional Definitions.
14
15 As used herein, "this License" refers to version 3 of the GNU Lesser
16General Public License, and the "GNU GPL" refers to version 3 of the GNU
17General Public License.
18
19 "The Library" refers to a covered work governed by this License,
20other than an Application or a Combined Work as defined below.
21
22 An "Application" is any work that makes use of an interface provided
23by the Library, but which is not otherwise based on the Library.
24Defining a subclass of a class defined by the Library is deemed a mode
25of using an interface provided by the Library.
26
27 A "Combined Work" is a work produced by combining or linking an
28Application with the Library. The particular version of the Library
29with which the Combined Work was made is also called the "Linked
30Version".
31
32 The "Minimal Corresponding Source" for a Combined Work means the
33Corresponding Source for the Combined Work, excluding any source code
34for portions of the Combined Work that, considered in isolation, are
35based on the Application, and not on the Linked Version.
36
37 The "Corresponding Application Code" for a Combined Work means the
38object code and/or source code for the Application, including any data
39and utility programs needed for reproducing the Combined Work from the
40Application, but excluding the System Libraries of the Combined Work.
41
42 1. Exception to Section 3 of the GNU GPL.
43
44 You may convey a covered work under sections 3 and 4 of this License
45without being bound by section 3 of the GNU GPL.
46
47 2. Conveying Modified Versions.
48
49 If you modify a copy of the Library, and, in your modifications, a
50facility refers to a function or data to be supplied by an Application
51that uses the facility (other than as an argument passed when the
52facility is invoked), then you may convey a copy of the modified
53version:
54
55 a) under this License, provided that you make a good faith effort to
56 ensure that, in the event an Application does not supply the
57 function or data, the facility still operates, and performs
58 whatever part of its purpose remains meaningful, or
59
60 b) under the GNU GPL, with none of the additional permissions of
61 this License applicable to that copy.
62
63 3. Object Code Incorporating Material from Library Header Files.
64
65 The object code form of an Application may incorporate material from
66a header file that is part of the Library. You may convey such object
67code under terms of your choice, provided that, if the incorporated
68material is not limited to numerical parameters, data structure
69layouts and accessors, or small macros, inline functions and templates
70(ten or fewer lines in length), you do both of the following:
71
72 a) Give prominent notice with each copy of the object code that the
73 Library is used in it and that the Library and its use are
74 covered by this License.
75
76 b) Accompany the object code with a copy of the GNU GPL and this license
77 document.
78
79 4. Combined Works.
80
81 You may convey a Combined Work under terms of your choice that,
82taken together, effectively do not restrict modification of the
83portions of the Library contained in the Combined Work and reverse
84engineering for debugging such modifications, if you also do each of
85the following:
86
87 a) Give prominent notice with each copy of the Combined Work that
88 the Library is used in it and that the Library and its use are
89 covered by this License.
90
91 b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 document.
93
94 c) For a Combined Work that displays copyright notices during
95 execution, include the copyright notice for the Library among
96 these notices, as well as a reference directing the user to the
97 copies of the GNU GPL and this license document.
98
99 d) Do one of the following:
100
101 0) Convey the Minimal Corresponding Source under the terms of this
102 License, and the Corresponding Application Code in a form
103 suitable for, and under terms that permit, the user to
104 recombine or relink the Application with a modified version of
105 the Linked Version to produce a modified Combined Work, in the
106 manner specified by section 6 of the GNU GPL for conveying
107 Corresponding Source.
108
109 1) Use a suitable shared library mechanism for linking with the
110 Library. A suitable mechanism is one that (a) uses at run time
111 a copy of the Library already present on the user's computer
112 system, and (b) will operate properly with a modified version
113 of the Library that is interface-compatible with the Linked
114 Version.
115
116 e) Provide Installation Information, but only if you would otherwise
117 be required to provide such information under section 6 of the
118 GNU GPL, and only to the extent that such information is
119 necessary to install and execute a modified version of the
120 Combined Work produced by recombining or relinking the
121 Application with a modified version of the Linked Version. (If
122 you use option 4d0, the Installation Information must accompany
123 the Minimal Corresponding Source and Corresponding Application
124 Code. If you use option 4d1, you must provide the Installation
125 Information in the manner specified by section 6 of the GNU GPL
126 for conveying Corresponding Source.)
127
128 5. Combined Libraries.
129
130 You may place library facilities that are a work based on the
131Library side by side in a single library together with other library
132facilities that are not Applications and are not covered by this
133License, and convey such a combined library under terms of your
134choice, if you do both of the following:
135
136 a) Accompany the combined library with a copy of the same work based
137 on the Library, uncombined with any other library facilities,
138 conveyed under the terms of this License.
139
140 b) Give prominent notice with the combined library that part of it
141 is a work based on the Library, and explaining where to find the
142 accompanying uncombined form of the same work.
143
144 6. Revised Versions of the GNU Lesser General Public License.
145
146 The Free Software Foundation may publish revised and/or new versions
147of the GNU Lesser General Public License from time to time. Such new
148versions will be similar in spirit to the present version, but may
149differ in detail to address new problems or concerns.
150
151 Each version is given a distinguishing version number. If the
152Library as you received it specifies that a certain numbered version
153of the GNU Lesser General Public License "or any later version"
154applies to it, you have the option of following the terms and
155conditions either of that published version or of any later version
156published by the Free Software Foundation. If the Library as you
157received it does not specify a version number of the GNU Lesser
158General Public License, you may choose any version of the GNU Lesser
159General Public License ever published by the Free Software Foundation.
160
161 If the Library as you received it specifies that a proxy can decide
162whether future versions of the GNU Lesser General Public License shall
163apply, that proxy's public statement of acceptance of any version is
164permanent authorization for you to choose that version for the
165Library. \ 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 @@
1All rights reserved.
2
3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to deal
5in the Software without restriction, including without limitation the rights
6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7copies of the Software, and to permit persons to whom the Software is
8furnished to do so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in
11all copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19THE 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 @@
<Place your desired license here.> \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the PG_ORGANIZATION nor the
15 * names of its contributors may be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS-IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */ \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc., 59
18 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */ \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */ \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 */ \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 3 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 */ \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */ \ 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 @@
1/*
2 * Copyright (C) $(copyright).
3 *
4 * Author: $(author)
5 *
6 *
7 * Your desired license
8 *
9 */ \ 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/>
4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
5 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
6 <classpathentry kind="src" path="src"/>
7 <classpathentry kind="output" path="bin"/>
8</classpath>
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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>org.yocto.sdk.remotetools</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.jdt.core.javabuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.pde.ManifestBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.pde.SchemaBuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 </buildSpec>
24 <natures>
25 <nature>org.eclipse.pde.PluginNature</nature>
26 <nature>org.eclipse.jdt.core.javanature</nature>
27 </natures>
28</projectDescription>
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 @@
1#Wed Aug 11 12:07:02 CST 2010
2eclipse.preferences.version=1
3org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5org.eclipse.jdt.core.compiler.compliance=1.6
6org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8org.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 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: %Bundle-Name
4Bundle-SymbolicName: org.yocto.sdk.remotetools; singleton:=true
5Bundle-Version: 1.4.0.qualifier
6Bundle-Activator: org.yocto.sdk.remotetools.Activator
7Require-Bundle: org.eclipse.ui,
8 org.eclipse.core.runtime,
9 org.eclipse.rse.core;bundle-version="3.0.0",
10 org.yocto.sdk.ide,
11 org.eclipse.rse.terminals.ui;bundle-version="1.0.100",
12 org.eclipse.cdt;bundle-version="7.0.0",
13 org.eclipse.linuxtools.tmf.core;bundle-version="0.4.0",
14 org.eclipse.ui.ide;bundle-version="3.8.0",
15 org.eclipse.ui.console;bundle-version="3.5.100"
16Bundle-ActivationPolicy: lazy
17Bundle-RequiredExecutionEnvironment: JavaSE-1.6
18Import-Package: org.eclipse.core.resources,
19 org.eclipse.debug.internal.ui,
20 org.eclipse.rse.shells.ui,
21 org.eclipse.rse.ui.actions,
22 org.eclipse.tm.internal.terminal.control,
23 org.eclipse.tm.internal.terminal.control.actions,
24 org.eclipse.tm.internal.terminal.provisional.api,
25 org.eclipse.ui.forms.widgets,
26 org.yocto.remote.utils
27Bundle-Vendor: %Bundle-Vendor
28Bundle-ClassPath: lib/json-simple-1.1.1.jar,
29 .
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 @@
1#Generated by org.apache.felix.bundleplugin
2#Sun Feb 19 14:30:57 CST 2012
3version=1.1.1
4groupId=com.googlecode.json-simple
5artifactId=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 @@
1<project>
2 <modelVersion>4.0.0</modelVersion>
3 <groupId>com.googlecode.json-simple</groupId>
4 <artifactId>json-simple</artifactId>
5 <packaging>bundle</packaging>
6 <name>JSON.simple</name>
7 <version>1.1.1</version>
8 <description>A simple Java toolkit for JSON</description>
9 <url>http://code.google.com/p/json-simple/</url>
10 <licenses>
11 <license>
12 <name>The Apache Software License, Version 2.0</name>
13 <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
14 </license>
15 </licenses>
16 <developers>
17 <developer>
18 <id>Yidong</id>
19 <name>Yidong Fang</name>
20 <roles>
21 <role>architect</role>
22 <role>developer</role>
23 </roles>
24 <timezone>+8</timezone>
25 </developer>
26 </developers>
27 <scm>
28 <connection>scm:svn:http://json-simple.googlecode.com/svn/trunk/</connection>
29 <developerConnection>scm:svn:http://json-simple.googlecode.com/svn/trunk/</developerConnection>
30 <url>http://json-simple.googlecode.com/svn/trunk/</url>
31 </scm>
32
33 <properties>
34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 </properties>
36
37 <dependencies>
38 <dependency>
39 <groupId>junit</groupId>
40 <artifactId>junit</artifactId>
41 <version>4.10</version>
42 </dependency>
43 </dependencies>
44
45 <build>
46 <plugins>
47 <plugin>
48 <groupId>org.apache.felix</groupId>
49 <artifactId>maven-bundle-plugin</artifactId>
50 <version>2.3.6</version>
51 <extensions>true</extensions>
52 </plugin>
53 <plugin>
54 <groupId>org.apache.maven.plugins</groupId>
55 <artifactId>maven-compiler-plugin</artifactId>
56 <version>2.3.2</version>
57 <configuration>
58 <source>1.2</source>
59 <target>1.2</target>
60 </configuration>
61 </plugin>
62 </plugins>
63 </build>
64</project>
65
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 @@
1#Properties file for org.yocto.sdk.remotetools
2category.name = Yocto Project Remote Tools
3commands.category.name = Yoctol Project Tools
4command.name.oprofile = oprofile
5command.name.powertop = powertop
6command.name.latencytop = latencytop
7command.name.ust.20 = lttng2.0 trace import
8command.name.perf = perf
9command.name.systemtap = systemtap
10command.name.yoctobsp = yocto-bsp
11Bundle-Vendor = yoctoproject.org
12Bundle-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 @@
1source.. = src/
2output.. = bin/
3bin.includes = plugin.xml,\
4 META-INF/,\
5 .,\
6 icons/,\
7 OSGI-INF/l10n/bundle.properties,\
8 lib/,\
9 lib/json-simple-1.1.1.jar
10src.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
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/icons/sample.gif
Binary files 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
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar
Binary files 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 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<?eclipse version="3.4"?>
3<plugin>
4
5 <extension
6 point="org.eclipse.ui.views">
7 <category
8 name="%category.name"
9 id="org.yocto.sdk.remotetools">
10 </category>
11 <view
12 name="PowerTop"
13 category="org.yocto.sdk.remotetools"
14 class="org.yocto.sdk.remotetools.views.BaseFileView"
15 id="org.yocto.sdk.remotetools.views.PowerTopView">
16 </view>
17 <view
18 category="org.yocto.sdk.remotetools"
19 class="org.yocto.sdk.remotetools.views.TerminalViewer"
20 id="org.yocto.sdk.remotetools.views.TerminalView"
21 name="TerminalView">
22 </view>
23 </extension>
24 <extension
25 point="org.eclipse.ui.perspectiveExtensions">
26 <perspectiveExtension
27 targetID="org.eclipse.jdt.ui.JavaPerspective">
28 <view
29 ratio="0.5"
30 relative="org.eclipse.ui.views.TaskList"
31 relationship="right"
32 id="org.yocto.sdk.remotetools.views.PowerTopView">
33 </view>
34 </perspectiveExtension>
35 </extension>
36 <extension
37 point="org.eclipse.ui.commands">
38 <category
39 id="org.yocto.sdk.remotetools.commands.category"
40 name="%commands.category.name">
41 </category>
42 <command
43 categoryId="org.yocto.sdk.remotetools.commands.category"
44 id="org.yocto.sdk.remotetools.command.powertop"
45 name="%command.name.powertop">
46 </command>
47 <command
48 categoryId="org.yocto.sdk.remotetools.commands.category"
49 id="org.yocto.sdk.remotetools.command.latencytop"
50 name="%command.name.latencytop">
51 </command>
52 <command
53 categoryId="org.yocto.sdk.remotetools.commands.category"
54 id="org.yocto.sdk.remotetools.command.perf"
55 name="%command.name.perf">
56 </command>
57 <command
58 categoryId="org.yocto.sdk.remotetools.commands.category"
59 id="org.yocto.sdk.remotetools.command.systemtap"
60 name="%command.name.systemtap">
61 </command>
62 <command
63 categoryId="org.yocto.sdk.remotetools.commands.category"
64 id="org.yocto.sdk.remotetools.command.yoctobsp"
65 name="%command.name.yoctobsp">
66 </command>
67 </extension>
68 <extension
69 point="org.eclipse.ui.menus">
70 <menuContribution
71 locationURI="menu:org.eclipse.ui.main.menu?after=additions">
72 <menu
73 id="runYoctoTools"
74 label="&amp;YoctoProjectTools">
75 </menu>
76 </menuContribution>
77 <menuContribution
78 locationURI="menu:runYoctoTools">
79 <command
80 commandId="org.yocto.sdk.remotetools.command.perf"
81 label="%command.name.perf"
82 style="push">
83 </command>
84 <command
85 commandId="org.yocto.sdk.remotetools.command.powertop"
86 label="%command.name.powertop"
87 style="push">
88 </command>
89 <command
90 commandId="org.yocto.sdk.remotetools.command.latencytop"
91 label="%command.name.latencytop"
92 style="push">
93 </command>
94 <command
95 commandId="org.yocto.sdk.remotetools.command.systemtap"
96 label="%command.name.systemtap"
97 style="push">
98 </command>
99 <separator
100 name="org.yocto.sdk.remotetools.separator2"
101 visible="true">
102 </separator>
103 <command
104 commandId="org.yocto.sdk.remotetools.command.yoctobsp"
105 label="%command.name.yoctobsp"
106 style="push">
107 </command>
108 </menuContribution>
109 </extension>
110 <extension
111 point="org.eclipse.ui.handlers">
112 <handler
113 class="org.yocto.sdk.remotetools.actions.OprofileHandler"
114 commandId="org.yocto.sdk.remotetools.command.oprofile">
115 </handler>
116 <handler
117 class="org.yocto.sdk.remotetools.actions.PerfHandler"
118 commandId="org.yocto.sdk.remotetools.command.perf">
119 </handler>
120 <handler
121 class="org.yocto.sdk.remotetools.actions.SystemtapHandler"
122 commandId="org.yocto.sdk.remotetools.command.systemtap">
123 </handler>
124 <handler
125 class="org.yocto.sdk.remotetools.actions.PowertopHandler"
126 commandId="org.yocto.sdk.remotetools.command.powertop">
127 </handler>
128 <handler
129 class="org.yocto.sdk.remotetools.actions.LatencytopHandler"
130 commandId="org.yocto.sdk.remotetools.command.latencytop">
131 </handler>
132 <handler
133 class="org.yocto.sdk.remotetools.actions.Ust2Handler"
134 commandId="org.yocto.sdk.remotetools.command.ust2">
135 </handler>
136 <handler
137 class="org.yocto.sdk.remotetools.actions.YoctoBspHandler"
138 commandId="org.yocto.sdk.remotetools.command.yoctobsp">
139 </handler>
140 </extension>
141
142</plugin>
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools;
12
13import org.eclipse.core.runtime.jobs.IJobManager;
14import org.eclipse.core.runtime.jobs.Job;
15import org.eclipse.jface.resource.ImageDescriptor;
16import org.eclipse.ui.plugin.AbstractUIPlugin;
17import org.osgi.framework.BundleContext;
18
19/**
20 * The activator class controls the plug-in life cycle
21 */
22public class Activator extends AbstractUIPlugin {
23
24 // The plug-in ID
25 public static final String PLUGIN_ID = "org.yocto.sdk.remotetools"; //$NON-NLS-1$
26
27 // The shared instance
28 private static Activator plugin;
29
30 /**
31 * The constructor
32 */
33 public Activator() {
34 }
35
36 /*
37 * (non-Javadoc)
38 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
39 */
40 public void start(BundleContext context) throws Exception {
41 super.start(context);
42 plugin = this;
43 }
44
45 /*
46 * (non-Javadoc)
47 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
48 */
49 public void stop(BundleContext context) throws Exception {
50
51 //cancel all jobs before plugin stop
52 IJobManager jobMan = Job.getJobManager();
53 jobMan.cancel(LocalJob.LOCAL_JOB_FAMILY);
54 jobMan.join(LocalJob.LOCAL_JOB_FAMILY, null);
55
56 plugin = null;
57 super.stop(context);
58 }
59
60 /**
61 * Returns the shared instance
62 *
63 * @return the shared instance
64 */
65 public static Activator getDefault() {
66 return plugin;
67 }
68
69 /**
70 * Returns an image descriptor for the image file at the given
71 * plug-in relative path
72 *
73 * @param path the path
74 * @return the image descriptor
75 */
76 public static ImageDescriptor getImageDescriptor(String path) {
77 return imageDescriptorFromPlugin(PLUGIN_ID, path);
78 }
79}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11
12package org.yocto.sdk.remotetools;
13
14import java.io.File;
15import java.io.IOException;
16
17import org.eclipse.core.runtime.IProgressMonitor;
18import org.eclipse.core.runtime.IStatus;
19import org.eclipse.core.runtime.Status;
20import org.eclipse.core.runtime.jobs.Job;
21import org.eclipse.ui.IWorkbenchWindow;
22import org.eclipse.jface.dialogs.MessageDialog;
23import org.eclipse.swt.SWTException;
24
25public class LocalJob extends Job {
26
27 public static final String LOCAL_JOB_FAMILY = "localJobFamily";
28 private String[] cmdarray;
29 private String[] envp;
30 private File dir;
31 private int exitValue;
32 private Exception exception;
33 private IWorkbenchWindow window;
34
35 public LocalJob(String name, String[] cmdarray, String[] envp, File dir, IWorkbenchWindow window) {
36 super(name);
37 this.cmdarray=cmdarray;
38 this.envp=envp;
39 this.dir=dir;
40 this.window=window;
41 this.exitValue=0;
42 this.exception=null;
43 }
44
45 @Override
46 protected IStatus run(IProgressMonitor monitor) {
47 Process p=null;
48 boolean cancel=false;
49
50 try {
51 //start process
52 p=Runtime.getRuntime().exec(cmdarray,envp,dir);
53
54 //wait for completion
55 while (!cancel) {
56
57 if(monitor.isCanceled())
58 cancel=true;
59
60 try {
61 exitValue=p.exitValue();
62 break;
63 }catch (IllegalThreadStateException e) {
64 }
65
66 Thread.sleep(500);
67 }
68
69 }catch (IOException e) {
70 exception=e;
71 }catch (InterruptedException e){
72 cancel=true;
73 }finally {
74 if(p!=null)
75 p.destroy();
76 }
77 try {
78 if(exitValue!=0 || exception!=null) {
79 window.getWorkbench().getDisplay().syncExec(new Runnable() {
80 public void run() {
81 MessageDialog.openError(window.getShell(),
82 Messages.LocalJob_Title,
83 Messages.ErrorLocalJob + ": " + getName() +
84 (exitValue!=0 ? "\n\tExit value: " + new Integer(exitValue).toString() : new String("")) +
85 (exception!=null ? "\n\t" + exception.getMessage() : new String (""))
86 );
87 }
88 });
89 }
90 }catch (SWTException e) {
91 e.printStackTrace();
92 }catch (Exception e) {
93 e.printStackTrace();
94 }
95 return (cancel!=true) ? Status.OK_STATUS : Status.CANCEL_STATUS;
96 }
97
98 public boolean belongsTo(Object family) {
99 return family == LOCAL_JOB_FAMILY;
100 }
101}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools;
12
13import org.eclipse.osgi.util.NLS;
14
15public class Messages extends NLS {
16
17 private static final String BUNDLE_NAME = "org.yocto.sdk.remotetools.messages"; //$NON-NLS-1$
18
19 public static String ErrorNoSubsystem;
20 public static String ErrorConnectSubsystem;
21 public static String ErrorNoHost;
22 public static String ErrorNoRemoteService;
23
24 public static String ErrorOprofileViewer;
25 public static String ErrorOprofile;
26 public static String ErrorLttvGui;
27 public static String ErrorUstProject;
28
29 public static String InfoDownload;
30 public static String InfoUpload;
31
32 public static String BaseSettingDialog_Connection;
33 public static String BaseSettingDialog_New;
34 public static String BaseSettingDialog_Properties;
35 public static String Usttrace_Argument_Text;
36 public static String Usttrace_Application_Text;
37 public static String Usttrace_Trace_Loc_Text;
38 public static String Powertop_Time_Text;
39 public static String Powertop_ShowPid_Text;
40 public static String TerminalViewer_text;
41 //public static String Systemtap_KO_Text;
42 public static String Metadata_Location;
43 public static String Builddir_Location;
44 public static String User_ID;
45 public static String Remote_Host;
46 public static String Systemtap_Script;
47 public static String Systemtap_Args;
48 public static String Import_to_Project;
49
50 public static String LocalJob_Title;
51 public static String ErrorLocalJob;
52 public static String RemoteShellExec_1;
53 public static String RemoteShellExec_2;
54
55 static {
56 // initialize resource bundle
57 NLS.initializeMessages(BUNDLE_NAME, Messages.class);
58 }
59
60 private Messages() {
61 }
62}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2000, 2010 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools;
12
13import org.eclipse.core.runtime.Assert;
14import org.eclipse.jface.dialogs.IDialogConstants;
15import org.eclipse.jface.layout.PixelConverter;
16import org.eclipse.jface.resource.JFaceResources;
17import org.eclipse.swt.SWT;
18import org.eclipse.swt.custom.CLabel;
19import org.eclipse.swt.custom.ViewForm;
20import org.eclipse.swt.graphics.Font;
21import org.eclipse.swt.graphics.Image;
22import org.eclipse.swt.layout.GridData;
23import org.eclipse.swt.layout.GridLayout;
24import org.eclipse.swt.widgets.Button;
25import org.eclipse.swt.widgets.Combo;
26import org.eclipse.swt.widgets.Composite;
27import org.eclipse.swt.widgets.Group;
28import org.eclipse.swt.widgets.Label;
29import org.eclipse.swt.widgets.Layout;
30import org.eclipse.swt.widgets.Text;
31import org.eclipse.ui.forms.widgets.ExpandableComposite;
32
33/**
34 * Factory class to create some SWT resources.
35 */
36public class SWTFactory {
37
38 /**
39 * Returns a width hint for a button control.
40 */
41 public static int getButtonWidthHint(Button button) {
42 /*button.setFont(JFaceResources.getDialogFont());*/
43 PixelConverter converter= new PixelConverter(button);
44 int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
45 return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
46 }
47
48 /**
49 * Sets width and height hint for the button control.
50 * <b>Note:</b> This is a NOP if the button's layout data is not
51 * an instance of <code>GridData</code>.
52 *
53 * @param the button for which to set the dimension hint
54 */
55 public static void setButtonDimensionHint(Button button) {
56 Assert.isNotNull(button);
57 Object gd= button.getLayoutData();
58 if (gd instanceof GridData) {
59 ((GridData)gd).widthHint= getButtonWidthHint(button);
60 ((GridData)gd).horizontalAlignment = GridData.FILL;
61 }
62 }
63
64 /**
65 * Creates a check box button using the parents' font
66 * @param parent the parent to add the button to
67 * @param label the label for the button
68 * @param image the image for the button
69 * @param checked the initial checked state of the button
70 * @param hspan the horizontal span to take up in the parent composite
71 * @return a new checked button set to the initial checked state
72 * @since 3.3
73 */
74 public static Button createCheckButton(Composite parent, String label, Image image, boolean checked, int hspan) {
75 Button button = new Button(parent, SWT.CHECK);
76 button.setFont(parent.getFont());
77 button.setSelection(checked);
78 if(image != null) {
79 button.setImage(image);
80 }
81 if(label != null) {
82 button.setText(label);
83 }
84 GridData gd = new GridData();
85 gd.horizontalSpan = hspan;
86 button.setLayoutData(gd);
87 setButtonDimensionHint(button);
88 return button;
89 }
90
91 /**
92 * Creates and returns a new push button with the given
93 * label and/or image.
94 *
95 * @param parent parent control
96 * @param label button label or <code>null</code>
97 * @param image image of <code>null</code>
98 *
99 * @return a new push button
100 */
101 public static Button createPushButton(Composite parent, String label, Image image) {
102 Button button = new Button(parent, SWT.PUSH);
103 button.setFont(parent.getFont());
104 if (image != null) {
105 button.setImage(image);
106 }
107 if (label != null) {
108 button.setText(label);
109 }
110 GridData gd = new GridData();
111 button.setLayoutData(gd);
112 setButtonDimensionHint(button);
113 return button;
114 }
115
116 /**
117 * Creates and returns a new push button with the given
118 * label and/or image.
119 *
120 * @param parent parent control
121 * @param label button label or <code>null</code>
122 * @param image image of <code>null</code>
123 * @param fill the alignment for the new button
124 *
125 * @return a new push button
126 * @since 3.4
127 */
128 public static Button createPushButton(Composite parent, String label, Image image, int fill) {
129 Button button = new Button(parent, SWT.PUSH);
130 button.setFont(parent.getFont());
131 if (image != null) {
132 button.setImage(image);
133 }
134 if (label != null) {
135 button.setText(label);
136 }
137 GridData gd = new GridData(fill);
138 button.setLayoutData(gd);
139 setButtonDimensionHint(button);
140 return button;
141 }
142
143 /**
144 * Creates and returns a new push button with the given
145 * label, tooltip and/or image.
146 *
147 * @param parent parent control
148 * @param label button label or <code>null</code>
149 * @param tooltip the tooltip text for the button or <code>null</code>
150 * @param image image of <code>null</code>
151 *
152 * @return a new push button
153 * @since 3.6
154 */
155 public static Button createPushButton(Composite parent, String label, String tooltip, Image image) {
156 Button button = createPushButton(parent, label, image);
157 button.setToolTipText(tooltip);
158 return button;
159 }
160
161 /**
162 * Creates and returns a new radio button with the given
163 * label.
164 *
165 * @param parent parent control
166 * @param label button label or <code>null</code>
167 *
168 * @return a new radio button
169 */
170 public static Button createRadioButton(Composite parent, String label) {
171 Button button = new Button(parent, SWT.RADIO);
172 button.setFont(parent.getFont());
173 if (label != null) {
174 button.setText(label);
175 }
176 GridData gd = new GridData();
177 button.setLayoutData(gd);
178 setButtonDimensionHint(button);
179 return button;
180 }
181
182 /**
183 * Creates and returns a new radio button with the given
184 * label.
185 *
186 * @param parent parent control
187 * @param label button label or <code>null</code>
188 * @param hspan the number of columns to span in the parent composite
189 *
190 * @return a new radio button
191 * @since 3.6
192 */
193 public static Button createRadioButton(Composite parent, String label, int hspan) {
194 Button button = new Button(parent, SWT.RADIO);
195 button.setFont(parent.getFont());
196 if (label != null) {
197 button.setText(label);
198 }
199 GridData gd = new GridData(GridData.BEGINNING);
200 gd.horizontalSpan = hspan;
201 button.setLayoutData(gd);
202 setButtonDimensionHint(button);
203 return button;
204 }
205
206 /**
207 * Creates a new label widget
208 * @param parent the parent composite to add this label widget to
209 * @param text the text for the label
210 * @param hspan the horizontal span to take up in the parent composite
211 * @return the new label
212 * @since 3.2
213 *
214 */
215 public static Label createLabel(Composite parent, String text, int hspan) {
216 Label l = new Label(parent, SWT.NONE);
217 l.setFont(parent.getFont());
218 l.setText(text);
219 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
220 gd.horizontalSpan = hspan;
221 gd.grabExcessHorizontalSpace = false;
222 l.setLayoutData(gd);
223 return l;
224 }
225
226 /**
227 * Creates a new label widget
228 * @param parent the parent composite to add this label widget to
229 * @param text the text for the label
230 * @param font the font for the label
231 * @param hspan the horizontal span to take up in the parent composite
232 * @return the new label
233 * @since 3.3
234 */
235 public static Label createLabel(Composite parent, String text, Font font, int hspan) {
236 Label l = new Label(parent, SWT.NONE);
237 l.setFont(font);
238 l.setText(text);
239 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
240 gd.horizontalSpan = hspan;
241 l.setLayoutData(gd);
242 return l;
243 }
244
245 /**
246 * Creates a wrapping label
247 * @param parent the parent composite to add this label to
248 * @param text the text to be displayed in the label
249 * @param hspan the horizontal span that label should take up in the parent composite
250 * @param wrapwidth the width hint that the label should wrap at
251 * @return a new label that wraps at a specified width
252 * @since 3.3
253 */
254 public static Label createWrapLabel(Composite parent, String text, int hspan, int wrapwidth) {
255 Label l = new Label(parent, SWT.NONE | SWT.WRAP);
256 l.setFont(parent.getFont());
257 l.setText(text);
258 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
259 gd.horizontalSpan = hspan;
260 gd.widthHint = wrapwidth;
261 l.setLayoutData(gd);
262 return l;
263 }
264
265 /**
266 * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified image
267 * @param parent the parent to add this label to
268 * @param text the text for the label
269 * @param image the image for the label
270 * @param hspan the h span to take up in the parent
271 * @param wrapwidth the with to wrap at
272 * @return a new <code>CLabel</code>
273 * @since 3.3
274 */
275 public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) {
276 CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP);
277 label.setFont(parent.getFont());
278 if(text != null) {
279 label.setText(text);
280 }
281 if(image != null) {
282 label.setImage(image);
283 }
284 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
285 gd.horizontalSpan = hspan;
286 gd.widthHint = wrapwidth;
287 label.setLayoutData(gd);
288 return label;
289 }
290
291 /**
292 * Creates a wrapping label
293 * @param parent the parent composite to add this label to
294 * @param text the text to be displayed in the label
295 * @param hspan the horizontal span that label should take up in the parent composite
296 * @return a new label that wraps at a specified width
297 * @since 3.3
298 */
299 public static Label createWrapLabel(Composite parent, String text, int hspan) {
300 Label l = new Label(parent, SWT.NONE | SWT.WRAP);
301 l.setFont(parent.getFont());
302 l.setText(text);
303 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
304 gd.horizontalSpan = hspan;
305 l.setLayoutData(gd);
306 return l;
307 }
308
309 /**
310 * Creates a new text widget
311 * @param parent the parent composite to add this text widget to
312 * @param hspan the horizontal span to take up on the parent composite
313 * @return the new text widget
314 * @since 3.2
315 *
316 */
317 public static Text createSingleText(Composite parent, int hspan) {
318 Text t = new Text(parent, SWT.SINGLE | SWT.BORDER);
319 t.setFont(parent.getFont());
320 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
321 gd.horizontalSpan = hspan;
322 t.setLayoutData(gd);
323 return t;
324 }
325
326 /**
327 * Creates a new text widget
328 * @param parent the parent composite to add this text widget to
329 * @param style the style bits for the text widget
330 * @param hspan the horizontal span to take up on the parent composite
331 * @param fill the fill for the grid layout
332 * @return the new text widget
333 * @since 3.3
334 */
335 public static Text createText(Composite parent, int style, int hspan, int fill) {
336 Text t = new Text(parent, style);
337 t.setFont(parent.getFont());
338 GridData gd = new GridData(fill);
339 gd.horizontalSpan = hspan;
340 t.setLayoutData(gd);
341 return t;
342 }
343
344 /**
345 * Creates a new text widget
346 * @param parent the parent composite to add this text widget to
347 * @param style the style bits for the text widget
348 * @param hspan the horizontal span to take up on the parent composite
349 * @return the new text widget
350 * @since 3.3
351 */
352 public static Text createText(Composite parent, int style, int hspan) {
353 Text t = new Text(parent, style);
354 t.setFont(parent.getFont());
355 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
356 gd.horizontalSpan = hspan;
357 t.setLayoutData(gd);
358 return t;
359 }
360
361 /**
362 * Creates a new text widget
363 * @param parent the parent composite to add this text widget to
364 * @param style the style bits for the text widget
365 * @param hspan the horizontal span to take up on the parent composite
366 * @param width the desired width of the text widget
367 * @param height the desired height of the text widget
368 * @param fill the fill style for the widget
369 * @return the new text widget
370 * @since 3.3
371 */
372 public static Text createText(Composite parent, int style, int hspan, int width, int height, int fill) {
373 Text t = new Text(parent, style);
374 t.setFont(parent.getFont());
375 GridData gd = new GridData(fill);
376 gd.horizontalSpan = hspan;
377 gd.widthHint = width;
378 gd.heightHint = height;
379 t.setLayoutData(gd);
380 return t;
381 }
382
383 /**
384 * Creates a new text widget
385 * @param parent the parent composite to add this text widget to
386 * @param style the style bits for the text widget
387 * @param hspan the horizontal span to take up on the parent composite
388 * @param text the initial text, not <code>null</code>
389 * @return the new text widget
390 * @since 3.6
391 */
392 public static Text createText(Composite parent, int style, int hspan, String text) {
393 Text t = new Text(parent, style);
394 t.setFont(parent.getFont());
395 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
396 gd.horizontalSpan = hspan;
397 t.setLayoutData(gd);
398 t.setText(text);
399 return t;
400 }
401
402 /**
403 * Creates a Group widget
404 * @param parent the parent composite to add this group to
405 * @param text the text for the heading of the group
406 * @param columns the number of columns within the group
407 * @param hspan the horizontal span the group should take up on the parent
408 * @param fill the style for how this composite should fill into its parent
409 * @return the new group
410 * @since 3.2
411 *
412 */
413 public static Group createGroup(Composite parent, String text, int columns, int hspan, int fill) {
414 Group g = new Group(parent, SWT.NONE);
415 g.setLayout(new GridLayout(columns, false));
416 g.setText(text);
417 g.setFont(parent.getFont());
418 GridData gd = new GridData(fill);
419 gd.horizontalSpan = hspan;
420 g.setLayoutData(gd);
421 return g;
422 }
423
424 /**
425 * Creates a Composite widget
426 * @param parent the parent composite to add this composite to
427 * @param font the font to set on the control
428 * @param columns the number of columns within the composite
429 * @param hspan the horizontal span the composite should take up on the parent
430 * @param fill the style for how this composite should fill into its parent
431 * @return the new group
432 * @since 3.3
433 */
434 public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill) {
435 Composite g = new Composite(parent, SWT.NONE);
436 g.setLayout(new GridLayout(columns, false));
437 g.setFont(font);
438 GridData gd = new GridData(fill);
439 gd.horizontalSpan = hspan;
440 g.setLayoutData(gd);
441 return g;
442 }
443
444 /**
445 * Creates an ExpandibleComposite widget
446 * @param parent the parent to add this widget to
447 * @param style the style for ExpandibleComposite expanding handle, and layout
448 * @param label the label for the widget
449 * @param hspan how many columns to span in the parent
450 * @param fill the fill style for the widget
451 * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code>
452 * @return a new ExpandibleComposite widget
453 * @since 3.6
454 */
455 public static ExpandableComposite createExpandibleComposite(Composite parent, int style, String label, int hspan, int fill) {
456 ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, style);
457 ex.setText(label);
458 ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
459 GridData gd = new GridData(fill);
460 gd.horizontalSpan = hspan;
461 ex.setLayoutData(gd);
462 return ex;
463 }
464
465 /**
466 * Creates a composite that uses the parent's font and has a grid layout
467 * @param parent the parent to add the composite to
468 * @param columns the number of columns the composite should have
469 * @param hspan the horizontal span the new composite should take up in the parent
470 * @param fill the fill style of the composite {@link GridData}
471 * @return a new composite with a grid layout
472 *
473 * @since 3.3
474 */
475 public static Composite createComposite(Composite parent, int columns, int hspan, int fill) {
476 Composite g = new Composite(parent, SWT.NONE);
477 g.setLayout(new GridLayout(columns, false));
478 g.setFont(parent.getFont());
479 GridData gd = new GridData(fill);
480 gd.horizontalSpan = hspan;
481 g.setLayoutData(gd);
482 return g;
483 }
484
485 /**
486 * Creates a vertical spacer for separating components. If applied to a
487 * <code>GridLayout</code>, this method will automatically span all of the columns of the parent
488 * to make vertical space
489 *
490 * @param parent the parent composite to add this spacer to
491 * @param numlines the number of vertical lines to make as space
492 * @since 3.3
493 */
494 public static void createVerticalSpacer(Composite parent, int numlines) {
495 Label lbl = new Label(parent, SWT.NONE);
496 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
497 Layout layout = parent.getLayout();
498 if(layout instanceof GridLayout) {
499 gd.horizontalSpan = ((GridLayout)parent.getLayout()).numColumns;
500 }
501 gd.heightHint = numlines;
502 lbl.setLayoutData(gd);
503 }
504
505 /**
506 * creates a horizontal spacer for separating components
507 * @param comp
508 * @param numlines
509 * @since 3.3
510 */
511 public static void createHorizontalSpacer(Composite comp, int numlines) {
512 Label lbl = new Label(comp, SWT.NONE);
513 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
514 gd.horizontalSpan = numlines;
515 lbl.setLayoutData(gd);
516 }
517
518 /**
519 * Creates a Composite widget
520 * @param parent the parent composite to add this composite to
521 * @param font the font to set on the control
522 * @param columns the number of columns within the composite
523 * @param hspan the horizontal span the composite should take up on the parent
524 * @param fill the style for how this composite should fill into its parent
525 * @param marginwidth the width of the margin to place on the sides of the composite (default is 5, specified by GridLayout)
526 * @param marginheight the height of the margin to place o the top and bottom of the composite
527 * @return the new composite
528 * @since 3.3
529 */
530 public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill, int marginwidth, int marginheight) {
531 Composite g = new Composite(parent, SWT.NONE);
532 GridLayout layout = new GridLayout(columns, false);
533 layout.marginWidth = marginwidth;
534 layout.marginHeight = marginheight;
535 g.setLayout(layout);
536 g.setFont(font);
537 GridData gd = new GridData(fill);
538 gd.horizontalSpan = hspan;
539 g.setLayoutData(gd);
540 return g;
541 }
542
543 /**
544 * Creates a {@link ViewForm}
545 * @param parent
546 * @param style
547 * @param cols
548 * @param span
549 * @param fill
550 * @param marginwidth
551 * @param marginheight
552 * @return a new {@link ViewForm}
553 * @since 3.6
554 */
555 public static ViewForm createViewform(Composite parent, int style, int cols, int span, int fill, int marginwidth, int marginheight) {
556 ViewForm form = new ViewForm(parent, style);
557 form.setFont(parent.getFont());
558 GridLayout layout = new GridLayout(cols, false);
559 layout.marginWidth = marginwidth;
560 layout.marginHeight = marginheight;
561 form.setLayout(layout);
562 GridData gd = new GridData(fill);
563 gd.horizontalSpan = span;
564 form.setLayoutData(gd);
565 return form;
566 }
567
568 /**
569 * Creates a Composite widget
570 * @param parent the parent composite to add this composite to
571 * @param font the font to set on the control
572 * @param columns the number of columns within the composite
573 * @param hspan the horizontal span the composite should take up on the parent
574 * @param fill the style for how this composite should fill into its parent
575 * @param marginwidth the width of the margin to place on the sides of the composite (default is 5, specified by GridLayout)
576 * @param marginheight the height of the margin to place o the top and bottom of the composite
577 * @return the new composite
578 * @since 3.6
579 */
580 public static Composite createComposite(Composite parent, Font font, int style, int columns, int hspan, int fill, int marginwidth, int marginheight) {
581 Composite g = new Composite(parent, style);
582 GridLayout layout = new GridLayout(columns, false);
583 layout.marginWidth = marginwidth;
584 layout.marginHeight = marginheight;
585 g.setLayout(layout);
586 g.setFont(font);
587 GridData gd = new GridData(fill);
588 gd.horizontalSpan = hspan;
589 g.setLayoutData(gd);
590 return g;
591 }
592
593 /**
594 * This method is used to make a combo box
595 * @param parent the parent composite to add the new combo to
596 * @param style the style for the Combo
597 * @param hspan the horizontal span to take up on the parent composite
598 * @param fill how the combo will fill into the composite
599 * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code>
600 * @param items the item to put into the combo
601 * @return a new Combo instance
602 * @since 3.3
603 */
604 public static Combo createCombo(Composite parent, int style, int hspan, int fill, String[] items) {
605 Combo c = new Combo(parent, style);
606 c.setFont(parent.getFont());
607 GridData gd = new GridData(fill);
608 gd.horizontalSpan = hspan;
609 c.setLayoutData(gd);
610 if (items != null){
611 c.setItems(items);
612 }
613 // Some platforms open up combos in bad sizes without this, see bug 245569
614 c.setVisibleItemCount(30);
615 c.select(0);
616 return c;
617 }
618
619 /**
620 * This method is used to make a combo box with a default fill style of GridData.FILL_HORIZONTAL
621 * @param parent the parent composite to add the new combo to
622 * @param style the style for the Combo
623 * @param hspan the horizontal span to take up on the parent composite
624 * @param items the item to put into the combo
625 * @return a new Combo instance
626 * @since 3.3
627 */
628 public static Combo createCombo(Composite parent, int style, int hspan, String[] items) {
629 Combo c = new Combo(parent, style);
630 c.setFont(parent.getFont());
631 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
632 gd.horizontalSpan = hspan;
633 c.setLayoutData(gd);
634 if (items != null){
635 c.setItems(items);
636 }
637 // Some platforms open up combos in bad sizes without this, see bug 245569
638 c.setVisibleItemCount(30);
639 c.select(0);
640 return c;
641 }
642}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools;
12
13public class YoctoBspElement {
14 private String metadataLoc;
15 private String buildLoc;
16 private String bspName;
17 private String bspOutLoc;
18 private String karch;
19 private String qarch;
20 private boolean validPropertiesFile;
21
22 public YoctoBspElement()
23 {
24 this.metadataLoc = "";
25 this.buildLoc = "";
26 this.bspName = "";
27 this.bspOutLoc = "";
28 this.karch = "";
29 this.qarch = "";
30 this.validPropertiesFile = false;
31 }
32
33 public String getMetadataLoc() {
34 return metadataLoc;
35 }
36
37 public void setMetadataLoc(String value) {
38 metadataLoc = value;
39 }
40
41 public String getBuildLoc() {
42 return buildLoc;
43 }
44
45 public void setBuildLoc(String value) {
46 buildLoc = value;
47 }
48
49 public String getBspName() {
50 return bspName;
51 }
52
53 public void setBspName(String value) {
54 this.bspName = value;
55 }
56
57 public String getBspOutLoc() {
58 return bspOutLoc;
59 }
60
61 public void setBspOutLoc(String value) {
62 this.bspOutLoc = value;
63 }
64
65 public String getKarch() {
66 return karch;
67 }
68
69 public void setKarch(String value) {
70 this.karch = value;
71 }
72
73 public String getQarch() {
74 return qarch;
75 }
76
77 public void setQarch(String value) {
78 this.qarch = value;
79 }
80
81 public boolean getValidPropertiesFile() {
82 return validPropertiesFile;
83 }
84
85 public void setValidPropertiesFile(boolean value) {
86 this.validPropertiesFile = value;
87 }
88}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools;
12
13public class YoctoBspPropertyElement implements Comparable<YoctoBspPropertyElement>{
14 private String name;
15 private String type;
16 private String value;
17 private String defaultValue;
18
19 public YoctoBspPropertyElement()
20 {
21 this.name = "";
22 this.type = "";
23 this.value = "";
24 this.defaultValue = "";
25 }
26
27 public String getName() {
28 return name;
29 }
30
31 public void setName(String value) {
32 name = value;
33 }
34
35 public String getType() {
36 return type;
37 }
38
39 public void setType(String value) {
40 type = value;
41 }
42
43 public String getDefaultValue() {
44 return defaultValue;
45 }
46
47 public void setDefaultValue(String value) {
48 this.defaultValue = value;
49 }
50
51 public String getValue() {
52 return value;
53 }
54
55 public void setValue(String value) {
56 this.value = value;
57 }
58
59 @Override
60 public int compareTo(YoctoBspPropertyElement o) {
61 return type.compareTo(o.type);
62 }
63
64
65}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools;
12
13import java.io.IOException;
14import java.io.FileWriter;
15import java.util.Iterator;
16import java.util.Set;
17import java.util.HashSet;
18import java.io.FileReader;
19
20import org.json.simple.JSONObject;
21import org.json.simple.JSONValue;
22
23public class YoctoJSONHelper {
24 private static final String PROPERTIES_FILE = "/tmp/properties.json";
25 private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json";
26
27 private static HashSet<YoctoBspPropertyElement> properties;
28
29 public static HashSet<YoctoBspPropertyElement> getProperties() throws Exception {
30
31 properties = new HashSet<YoctoBspPropertyElement>();
32 try {
33
34 JSONObject obj = (JSONObject)JSONValue.parse(new FileReader(PROPERTIES_FILE));
35 Set<String> keys = obj.keySet();
36 if (!keys.isEmpty()) {
37 Iterator<String> iter = keys.iterator();
38 while (iter.hasNext()) {
39 String key = (String)iter.next();
40 if (validKey(key)) {
41 JSONObject value_obj = (JSONObject)obj.get(key);
42 YoctoBspPropertyElement elem = new YoctoBspPropertyElement();
43 elem.setName(key);
44 String type = (String)value_obj.get("type");
45 elem.setType(type);
46 if (type.contentEquals("boolean")) {
47 elem.setDefaultValue((String)value_obj.get("default"));
48 }
49 properties.add(elem);
50 }
51 }
52 }
53
54 } catch (Exception e) {
55 throw e;
56 }
57 return properties;
58 }
59
60 public static void createBspJSONFile(HashSet<YoctoBspPropertyElement> properties) {
61 try {
62 JSONObject obj = new JSONObject();
63 if (!properties.isEmpty()) {
64 Iterator<YoctoBspPropertyElement> it = properties.iterator();
65 while (it.hasNext()) {
66 // Get property
67 YoctoBspPropertyElement propElem = (YoctoBspPropertyElement)it.next();
68 obj.put(propElem.getName(), propElem.getValue());
69 }
70 }
71
72 FileWriter file = new FileWriter(PROPERTY_VALUE_FILE);
73 file.write(obj.toJSONString());
74 file.flush();
75 file.close();
76
77 } catch (IOException e) {
78 e.printStackTrace();
79 }
80 }
81
82 private static boolean validKey(String key) {
83 if (key.contains("kernel"))
84 return false;
85 if (key.contentEquals("qemuarch"))
86 return false;
87 return true;
88 }
89}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import java.io.IOException;
14import java.io.InputStream;
15import java.lang.reflect.InvocationTargetException;
16
17import org.eclipse.core.runtime.IProgressMonitor;
18import org.eclipse.core.runtime.SubProgressMonitor;
19import org.eclipse.jface.operation.IRunnableWithProgress;
20import org.eclipse.rse.core.model.IHost;
21import org.yocto.remote.utils.RSEHelper;
22import org.yocto.remote.utils.RemoteShellExec;
23
24abstract public class BaseModel implements IRunnableWithProgress {
25 protected IHost host;
26 protected String taskName;
27 protected String localScript;
28 protected String remoteExec;
29 protected String localFile;
30 protected String remoteFile;
31
32 private static final int WORKLOAD = 100;
33
34 private static final int INIT_PERCENT = 5;
35 private static final int PRE_PROCESS_PERCENT = 30;
36 private static final int PROCESS_PERCENT = 30;
37 private static final int POST_PROCESS_PERCENT = 30;
38 private static final int CLEAN_PERCENT = 5;
39
40 private static final String RUN_MSG = "Running task: ";
41 private static final String INIT_MSG = "Initializing ";
42 private static final String PRE_PROCESS_MSG = "Preparing ";
43 private static final String PROCESS_MSG = "Processing ";
44 private static final String POST_PROCESS_MSG = "Finishing ";
45 private static final String CLEAN_MSG = "Cleaning ";
46 private static final String DOTS = "...";
47 private static final String FAILED_ERR_MSG = " failed with exit code ";
48
49 public void preProcess(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException{
50 //upload script to remote
51 try {
52 RSEHelper.putRemoteFileInPlugin(host, localScript, remoteExec, monitor);
53 }catch (InterruptedException e){
54 throw e;
55 }catch (InvocationTargetException e) {
56 throw e;
57 }catch (Exception e) {
58 throw new InvocationTargetException(e, e.getMessage());
59 }
60 }
61 public void postProcess(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException{}
62
63 abstract public void process(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException;
64
65 public BaseModel(IHost host, String taskName, String localScript, String remoteExec) {
66 this.host = host;
67 this.taskName = taskName;
68 this.localScript = localScript;
69 this.remoteExec = remoteExec;
70 }
71 protected void init(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
72 }
73
74 protected void clean(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
75 }
76
77 public void run(IProgressMonitor monitor) throws InvocationTargetException,
78 InterruptedException {
79
80 try {
81 monitor.beginTask(RUN_MSG + taskName, WORKLOAD);
82
83 monitor.subTask(INIT_MSG + taskName + DOTS);
84 init(new SubProgressMonitor(monitor, INIT_PERCENT));
85
86 monitor.subTask(PRE_PROCESS_MSG + taskName + DOTS);
87 preProcess(new SubProgressMonitor(monitor, PRE_PROCESS_PERCENT));
88
89 monitor.subTask(PROCESS_MSG + taskName + DOTS);
90 process(new SubProgressMonitor(monitor, PROCESS_PERCENT));
91
92 monitor.subTask(POST_PROCESS_MSG + taskName + DOTS);
93 postProcess(new SubProgressMonitor(monitor, POST_PROCESS_PERCENT));
94 } catch (InterruptedException e){
95 throw new InterruptedException("User cancelled!");
96 } catch (InvocationTargetException e) {
97 throw e;
98 } finally {
99 monitor.subTask(CLEAN_MSG + taskName + DOTS);
100 clean(new SubProgressMonitor(monitor, CLEAN_PERCENT));
101 monitor.done();
102 }
103 }
104
105 protected void getDataFile(IProgressMonitor monitor) throws Exception {
106 RSEHelper.getRemoteFile( host, localFile, remoteFile, monitor);
107 }
108 protected void runRemoteShellExec(IProgressMonitor monitor, String args, boolean cancelable) throws Exception {
109 try {
110 RemoteShellExec exec = new RemoteShellExec(host, remoteExec);
111 exec.start(null, args, monitor);
112 monitor.worked(1);
113 checkTerminate(exec.getInputStream());
114 int exit_code = exec.waitFor(cancelable ? monitor : null);
115 exec.terminate();
116 if(exit_code != 0)
117 throw new Exception(taskName + FAILED_ERR_MSG + new Integer(exit_code).toString());
118 } finally {
119 monitor.done();
120 }
121 }
122 protected void checkTerminate(InputStream inputStream) throws IOException {}
123}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2006, 2010 PalmSource, Inc. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ewa Matejska (PalmSource) - initial API and implementation
10 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
11 * Martin Oberhuber (Wind River) - [196934] hide disabled system types in remotecdt combo
12 * Yu-Fen Kuo (MontaVista) - [190613] Fix NPE in Remotecdt when RSEUIPlugin has not been loaded
13 * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
14 * Johann Draschwandtner (Wind River) - [231827][remotecdt]Auto-compute default for Remote path
15 * Johann Draschwandtner (Wind River) - [233057][remotecdt]Fix button enablement
16 * Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch
17 * Anna Dushistova (MontaVista) - [223728] [remotecdt] connection combo is not populated until RSE is activated
18 * Anna Dushistova (MontaVista) - [267951] [remotecdt] Support systemTypes without files subsystem
19 * Lianhao Lu (Intel) - Modified for internal use
20 *******************************************************************************/
21
22package org.yocto.sdk.remotetools.actions;
23
24import org.yocto.remote.utils.RSEHelper;
25import org.yocto.sdk.remotetools.Messages;
26import org.yocto.sdk.remotetools.SWTFactory;
27import org.eclipse.jface.dialogs.Dialog;
28import org.eclipse.jface.dialogs.IDialogConstants;
29import org.eclipse.rse.core.model.IHost;
30import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
31import org.eclipse.swt.SWT;
32import org.eclipse.swt.events.ModifyEvent;
33import org.eclipse.swt.events.ModifyListener;
34import org.eclipse.swt.events.SelectionAdapter;
35import org.eclipse.swt.events.SelectionEvent;
36import org.eclipse.swt.layout.GridData;
37import org.eclipse.swt.layout.GridLayout;
38import org.eclipse.swt.widgets.Button;
39import org.eclipse.swt.widgets.Combo;
40import org.eclipse.swt.widgets.Composite;
41import org.eclipse.swt.widgets.Control;
42import org.eclipse.swt.widgets.Label;
43import org.eclipse.swt.widgets.Shell;
44
45public class BaseSettingDialog extends Dialog {
46
47 protected String title;
48 protected String curConn; //current rse connection name
49 protected IHost conn;//rse IHost
50
51 protected Button newRemoteConnectionButton;
52 protected Label connectionLabel;
53 protected Combo connectionCombo;
54 protected SystemNewConnectionAction action = null;
55
56
57 protected BaseSettingDialog(Shell parentShell,String title, String connection) {
58 super(parentShell);
59 this.title=title;
60 this.curConn=connection;
61 }
62
63 @Override
64 protected void configureShell(Shell newShell) {
65 super.configureShell(newShell);
66 newShell.setText(title);
67 }
68
69 @Override
70 protected Control createDialogArea(Composite parent) {
71 Composite comp = (Composite)super.createDialogArea(parent);
72 GridLayout topLayout = new GridLayout();
73 comp.setLayout(topLayout);
74
75 /* The RSE Connection dropdown with New button. */
76 SWTFactory.createVerticalSpacer(comp, 1);
77 createRemoteConnectionGroup(comp);
78
79 return comp;
80 }
81
82
83 @Override
84 protected void createButtonsForButtonBar(Composite parent) {
85 super.createButtonsForButtonBar(parent);
86 updateCurConn();
87 }
88
89 protected void createRemoteConnectionGroup(Composite parent) {
90 Composite projComp = new Composite(parent, SWT.NONE);
91 GridLayout projLayout = new GridLayout();
92 projLayout.numColumns = 6;
93 projLayout.marginHeight = 0;
94 projLayout.marginWidth = 0;
95 projComp.setLayout(projLayout);
96 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
97 projComp.setLayoutData(gd);
98
99 connectionLabel = new Label(projComp, SWT.NONE);
100 connectionLabel.setText(Messages.BaseSettingDialog_Connection);
101 gd = new GridData();
102 gd.horizontalSpan = 1;
103 connectionLabel.setLayoutData(gd);
104
105 connectionCombo = new Combo(projComp, SWT.DROP_DOWN | SWT.READ_ONLY);
106 gd = new GridData(GridData.FILL_HORIZONTAL);
107 gd.horizontalSpan = 4;
108 connectionCombo.setLayoutData(gd);
109 connectionCombo.addModifyListener(new ModifyListener() {
110
111 public void modifyText(ModifyEvent e) {
112 //setDirty(true);
113 //updateLaunchConfigurationDialog();
114 //useDefaultsFromConnection();
115 updateCurConn();
116 }
117 });
118
119 newRemoteConnectionButton = SWTFactory.createPushButton(projComp,
120 Messages.BaseSettingDialog_New, null);
121 newRemoteConnectionButton.addSelectionListener(new SelectionAdapter() {
122
123 public void widgetSelected(SelectionEvent evt) {
124 handleNewRemoteConnectionSelected();
125 //updateLaunchConfigurationDialog();
126 updateConnectionPulldown();
127 }
128 });
129 gd = new GridData();
130 gd.horizontalSpan = 1;
131 newRemoteConnectionButton.setLayoutData(gd);
132
133 updateConnectionPulldown();
134 }
135
136 protected boolean updateOkButton() {
137 boolean ret=false;
138 Button button=getButton(IDialogConstants.OK_ID);
139 if(button!=null)
140 button.setEnabled(false);
141 IHost currentConnectionSelected = getCurrentConnection();
142 if (currentConnectionSelected != null) {
143 if (RSEHelper.isHostViable(currentConnectionSelected) && button != null){
144 button.setEnabled(true);
145 ret=true;
146 }
147 }
148 return ret;
149 }
150
151 protected void updateCurConn() {
152 IHost currentConnectionSelected = getCurrentConnection();
153 if (currentConnectionSelected != null) {
154 if (RSEHelper.isHostViable(currentConnectionSelected))
155 curConn=currentConnectionSelected.getAliasName();
156 }
157 updateOkButton();
158 }
159
160 protected IHost getCurrentConnection() {
161 int currentSelection = connectionCombo.getSelectionIndex();
162 String remoteConnection = currentSelection >= 0 ? connectionCombo
163 .getItem(currentSelection) : null;
164 return RSEHelper.getRemoteConnectionByName(remoteConnection);
165 }
166
167 protected void handleNewRemoteConnectionSelected() {
168 if (action == null) {
169 action = new SystemNewConnectionAction(getShell(),
170 false, false, null);
171 }
172
173 try {
174 action.run();
175 } catch (Exception e) {
176 // Ignore
177 }
178 }
179
180 protected void updateConnectionPulldown() {
181 int index=-1;
182 RSEHelper.waitForRSEInitCompletition();
183 // already initialized
184 connectionCombo.removeAll();
185 IHost[] connections = RSEHelper.getSuitableConnections();
186 for (int i = 0; i < connections.length; i++) {
187 connectionCombo.add(connections[i].getAliasName());
188 if(connections[i].getAliasName().equals(curConn))
189 index=i;
190 }
191
192 if(index>=0) {
193 connectionCombo.select(index);
194 }else if (connections.length > 0) {
195 connectionCombo.select(connections.length - 1);
196 }
197
198 //TODO
199 //connectionCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT,true);
200 connectionCombo.pack(true);
201 connectionCombo.layout();
202 connectionCombo.getParent().layout();
203
204 updateCurConn();
205 }
206
207 @Override
208 protected void okPressed() {
209 conn=getCurrentConnection();
210 super.okPressed();
211 }
212
213 public IHost getHost() {
214 return conn;
215 }
216}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.eclipse.core.commands.ExecutionEvent;
14import org.eclipse.core.commands.ExecutionException;
15import org.eclipse.rse.core.model.IHost;
16import org.eclipse.ui.IWorkbenchWindow;
17import org.eclipse.ui.handlers.HandlerUtil;
18import org.yocto.remote.utils.TerminalHandler;
19
20abstract public class DialogHandler extends TerminalHandler {
21
22 protected BaseSettingDialog setting;
23
24 abstract protected String getDialogTitle();
25
26 protected void initialize(ExecutionEvent event) throws ExecutionException{
27 IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
28 shell = window.getShell();
29 setting = new SimpleSettingDialog(shell, getDialogTitle(), getConnnectionName());
30 }
31
32 @Override
33 public Object execute(ExecutionEvent event) throws ExecutionException {
34 initialize(event);
35
36 if(setting.open() == BaseSettingDialog.OK) {
37 IHost currentHost = setting.getHost();
38 execute(currentHost);
39 }
40 return null;
41 }
42}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13public interface IBaseConstants {
14 public static final String TCF_TYPE_ID="org.eclipse.tcf.rse.systemType";//$NON-NLS-1$
15
16 public static final String QUALIFIER="org.yocto.sdk.remotetools";//$NON-NLS-1$
17
18 public static final String CONNECTION_NAME_OPROFILE = QUALIFIER + "connection.oprofile"; //$NON-NLS-1$
19 public static final String CONNECTION_NAME_UST = QUALIFIER + "connection.ust"; //$NON-NLS-1$
20 public static final String CONNECTION_NAME_POWERTOP = QUALIFIER + "connection.powertop"; //$NON-NLS-1$
21 public static final String CONNECTION_NAME_LATENCYTOP = QUALIFIER + "connection.latencytop"; //$NON-NLS-1$
22 public static final String CONNECTION_NAME_PERF = QUALIFIER + "connection.perf"; //$NON-NLS-1$
23 public static final String CONNECTION_NAME_SYSTEMTAP = QUALIFIER + "connection.systemtap"; //$NON-NLS-1$
24
25 public static final String DIALOG_TITLE_LATENCYTOP = "Latencytop"; //$NON-NLS-1$
26 public static final String DIALOG_TITLE_PERF = "Perf"; //$NON-NLS-1$
27}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13
14public class LatencytopHandler extends DialogHandler {
15
16 protected String changeTerm = "export TERM=xterm;";
17 private static String initCmd="export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin; cd; sudo latencytop\r";
18
19 @Override
20 protected String getInitCmd() {
21 return initCmd;
22 }
23 @Override
24 protected String changeTerm() {
25 return changeTerm;
26 }
27 @Override
28 protected String getConnnectionName() {
29 return IBaseConstants.CONNECTION_NAME_LATENCYTOP;
30 }
31 @Override
32 protected String getDialogTitle() {
33 return IBaseConstants.DIALOG_TITLE_LATENCYTOP;
34 }
35}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.eclipse.core.commands.AbstractHandler;
14import org.eclipse.core.commands.ExecutionEvent;
15import org.eclipse.core.commands.ExecutionException;
16import org.eclipse.jface.dialogs.MessageDialog;
17import org.eclipse.ui.IWorkbenchWindow;
18import org.eclipse.ui.PlatformUI;
19import org.eclipse.ui.handlers.HandlerUtil;
20import org.eclipse.ui.progress.IProgressService;
21
22public class OprofileHandler extends AbstractHandler {
23
24 public Object execute(ExecutionEvent event) throws ExecutionException {
25
26 if(OprofileModel.checkAvail()!=true) {
27 return null;
28 }
29
30 IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
31
32 SimpleSettingDialog setting=new SimpleSettingDialog(
33 window.getShell(),
34 "Oprofile",
35 IBaseConstants.CONNECTION_NAME_OPROFILE
36 );
37
38 if(setting.open()==BaseSettingDialog.OK) {
39 IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
40 OprofileModel op=new OprofileModel(setting.getHost(),window);
41 try {
42 progressService.busyCursorWhile(op);
43 }catch (InterruptedException e) {
44 //user cancelled
45 }catch (Exception e) {
46 e.printStackTrace();
47 MessageDialog.openError(window.getShell(),
48 "Oprofile",
49 (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage());
50 }
51 }
52 return null;
53 }
54
55}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import java.io.BufferedReader;
14import java.io.File;
15import java.io.FileReader;
16import java.io.IOException;
17import java.lang.reflect.InvocationTargetException;
18
19import org.eclipse.core.runtime.IProgressMonitor;
20import org.eclipse.core.runtime.SubProgressMonitor;
21import org.eclipse.jface.preference.IPreferenceStore;
22import org.eclipse.rse.core.model.IHost;
23import org.eclipse.ui.IWorkbenchWindow;
24import org.yocto.remote.utils.CommonHelper;
25import org.yocto.sdk.ide.YoctoSDKPlugin;
26import org.yocto.sdk.ide.preferences.PreferenceConstants;
27import org.yocto.sdk.remotetools.LocalJob;
28import org.yocto.sdk.remotetools.Messages;
29
30public class OprofileModel extends BaseModel {
31
32 private static final String REMOTE_EXEC = "/tmp/yocto_tool.sh";
33 private static final String LOCAL_SCRIPT = "resources/yocto_tool.sh";
34
35 private static final String LOCAL_EXEC = "oprofile-viewer";
36
37 private static final String TASK_NAME = "oprofile command";
38
39 private IWorkbenchWindow window;
40 public OprofileModel(IHost host, IWorkbenchWindow window) {
41 super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC);
42 this.window = window;
43 }
44
45 private void startServer(IProgressMonitor monitor) throws Exception {
46 String args="start -d oprofile-server";
47 runRemoteShellExec(monitor, args, true);
48 }
49
50 private void stopServer(IProgressMonitor monitor) throws Exception {
51 String args = "stop -d oprofile-server";
52 runRemoteShellExec(monitor, args, false);
53 }
54
55 private String getSearchPath()
56 {
57 try
58 {
59 String search=null;
60 IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore();
61 String env_script=store.getString(PreferenceConstants.TOOLCHAIN_ROOT) +
62 "/" +
63 "environment-setup-" +
64 store.getString(PreferenceConstants.TOOLCHAIN_TRIPLET);
65 File file = new File(env_script);
66
67 if (file.exists()) {
68 BufferedReader input = new BufferedReader(new FileReader(file));
69
70 try
71 {
72 String line = null;
73
74 while ((line = input.readLine()) != null)
75 {
76 if (!line.startsWith("export"))
77 continue;
78 String sKey = line.substring("export".length() + 1, line.indexOf('='));
79 if(!sKey.equals("PATH"))
80 continue;
81 String sValue = line.substring(line.indexOf('=') + 1);
82 if (sValue.startsWith("\"") && sValue.endsWith("\""))
83 sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"'));
84 /* If PATH ending with $PATH, we need to join with current system path */
85 if (sKey.equalsIgnoreCase("PATH")) {
86 if (sValue.lastIndexOf("$PATH") >= 0)
87 sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH");
88 }
89 search=sValue;
90 //System.out.printf("get env key %s value %s\n", sKey, sValue);
91 }
92
93 }
94 finally {
95 input.close();
96 }
97 }
98
99 return search;
100
101 }
102 catch (IOException e)
103 {
104 e.printStackTrace();
105 return null;
106 }
107
108 }
109
110 @Override
111 public void process(IProgressMonitor monitor)
112 throws InvocationTargetException, InterruptedException {
113
114 boolean stopServer=true;
115
116 try {
117 try {
118 monitor.beginTask("Starting oprofile", 100);
119 //start oprofile-server
120 monitor.subTask("Starting oprofile-server");
121 startServer(new SubProgressMonitor(monitor,80));
122
123 //start local oprofile-viewer
124 monitor.subTask("oprofile-viewer is running locally");
125 String searchPath=getSearchPath();
126
127 new LocalJob("oprofile-viewer",
128 (searchPath!=null) ?
129 new String[] {LOCAL_EXEC,"-h",host.getHostName(),"-s",searchPath} :
130 new String[] {LOCAL_EXEC,"-h",host.getHostName()},
131 null,
132 null,
133 window).schedule();
134 //we can't stop server because the oprofile-viewer is running asynchronously
135 stopServer=false;
136
137 }catch (InterruptedException e) {
138 throw e;
139 }finally {
140 //stop oprofile-server
141 if(stopServer) {
142 monitor.subTask("Stopping oprofile-viewer");
143 stopServer(new SubProgressMonitor(monitor,30));
144 }
145 }
146 }catch (InterruptedException e){
147 throw e;
148 }catch (InvocationTargetException e) {
149 throw e;
150 }catch (Exception e){
151 throw new InvocationTargetException(e, e.getMessage());
152 }finally {
153 monitor.done();
154 }
155 }
156
157 static public boolean checkAvail() {
158 boolean ret=CommonHelper.isExecAvail(LOCAL_EXEC);
159
160 if(ret==false) {
161 CommonHelper.showErrorDialog("Oprofile", null,Messages.ErrorOprofileViewer);
162 }else {
163 ret=CommonHelper.isExecAvail("opreport");
164 if(ret==false) {
165 CommonHelper.showErrorDialog("Oprofile", null,Messages.ErrorOprofile);
166 }
167 }
168 return ret;
169 }
170
171}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13
14public class PerfHandler extends DialogHandler {
15
16 private static String initCmd="cd; perf\r";
17
18 @Override
19 protected String getInitCmd() {
20 return initCmd;
21 }
22 @Override
23 protected String getConnnectionName() {
24 return IBaseConstants.CONNECTION_NAME_PERF;
25 }
26 @Override
27 protected String getDialogTitle() {
28 return IBaseConstants.DIALOG_TITLE_PERF;
29 }
30}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.eclipse.core.commands.AbstractHandler;
14import org.eclipse.core.commands.ExecutionEvent;
15import org.eclipse.core.commands.ExecutionException;
16import org.eclipse.jface.dialogs.MessageDialog;
17import org.eclipse.ui.IWorkbenchWindow;
18import org.eclipse.ui.PlatformUI;
19import org.eclipse.ui.handlers.HandlerUtil;
20import org.eclipse.ui.progress.IProgressService;
21
22public class PowertopHandler extends AbstractHandler {
23
24 public Object execute(ExecutionEvent event) throws ExecutionException {
25 IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
26
27 PowertopSettingDialog setting=new PowertopSettingDialog(
28 window.getShell()
29 );
30
31 if(setting.open()==BaseSettingDialog.OK) {
32 IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
33 PowertopModel op=new PowertopModel(setting.getHost(),setting.getTime(),setting.getShowPid(),window.getShell().getDisplay());
34 try {
35 progressService.busyCursorWhile(op);
36 }catch (InterruptedException e) {
37 //user cancelled
38 }catch (Exception e) {
39 e.printStackTrace();
40 MessageDialog.openError(window.getShell(),
41 "Powertop",
42 (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage());
43 }
44 }
45 return null;
46 }
47
48}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import java.io.File;
14import java.lang.reflect.InvocationTargetException;
15import java.text.SimpleDateFormat;
16import java.util.Calendar;
17
18import org.eclipse.core.runtime.IProgressMonitor;
19import org.eclipse.core.runtime.SubProgressMonitor;
20import org.eclipse.rse.core.model.IHost;
21import org.eclipse.swt.widgets.Display;
22import org.eclipse.ui.IWorkbenchPage;
23import org.eclipse.ui.PartInitException;
24import org.eclipse.ui.PlatformUI;
25import org.yocto.sdk.remotetools.views.BaseFileView;
26
27public class PowertopModel extends BaseModel {
28
29 private static final String REMOTE_EXEC = "/tmp/yocto_tool.sh";
30 private static final String LOCAL_SCRIPT = "resources/yocto_tool.sh";
31
32 private static final String REMOTE_FILE_PREFIX = "/tmp/yocto-powertop-";
33 private static final String LOCAL_FILE_SUFFIX = ".local";
34
35 private static final String TASK_NAME = "powertop command";
36
37 private Float time;
38 private boolean showpid;
39 Display display;
40
41 public PowertopModel(IHost host, Float time,boolean showpid,Display display) {
42 super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC);
43 this.time=time;
44 this.showpid=showpid;
45 this.display=display;
46 }
47
48 @Override
49 public void postProcess(IProgressMonitor monitor)
50 throws InvocationTargetException, InterruptedException {
51 try {
52 new File(localFile).delete();
53 }catch (Exception e) {
54
55 }
56 }
57
58 private void generateData(IProgressMonitor monitor) throws Exception {
59 String currentDate = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(Calendar.getInstance().getTime()).toString();
60 remoteFile = new String(REMOTE_FILE_PREFIX + currentDate);
61 localFile = new String(remoteFile + LOCAL_FILE_SUFFIX);
62
63 String args = "start -l " + remoteFile + " powertop --debug --time " + time.toString();
64 if(showpid)
65 args += " -p";
66 runRemoteShellExec(monitor, args, true);
67 }
68
69 @Override
70 public void process(IProgressMonitor monitor)
71 throws InvocationTargetException, InterruptedException {
72
73 monitor.beginTask("Running powertop", 100);
74 try {
75 //running powertop
76 monitor.subTask("Generating powertop data file remotely");
77 generateData(new SubProgressMonitor(monitor,30));
78 //download datafile
79 monitor.subTask("Downloading powertop data file");
80 getDataFile(new SubProgressMonitor(monitor,30));
81 //show it in the powertop view
82 display.syncExec(new Runnable() {
83 public void run() {
84 BaseFileView view;
85 IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
86 try {
87 view=(BaseFileView) page.showView("org.yocto.sdk.remotetools.views.PowerTopView");
88 }catch (PartInitException e) {
89 e.printStackTrace();
90 return;
91 }
92 view.setInput(localFile);
93 page.bringToTop(view);
94 }
95 });
96
97 }catch (InterruptedException e){
98 throw e;
99 }catch (InvocationTargetException e) {
100 throw e;
101 }catch (Exception e){
102 throw new InvocationTargetException(e, e.getMessage());
103 }finally {
104 monitor.done();
105 }
106
107 }
108
109}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.eclipse.jface.dialogs.IDialogConstants;
14import org.eclipse.jface.dialogs.IDialogSettings;
15import org.eclipse.swt.SWT;
16import org.eclipse.swt.events.ModifyEvent;
17import org.eclipse.swt.events.ModifyListener;
18import org.eclipse.swt.layout.GridData;
19import org.eclipse.swt.layout.GridLayout;
20import org.eclipse.swt.widgets.Button;
21import org.eclipse.swt.widgets.Composite;
22import org.eclipse.swt.widgets.Control;
23import org.eclipse.swt.widgets.Label;
24import org.eclipse.swt.widgets.Shell;
25import org.eclipse.swt.widgets.Text;
26import org.yocto.sdk.remotetools.Activator;
27import org.yocto.sdk.remotetools.Messages;
28import org.yocto.sdk.remotetools.SWTFactory;
29
30public class PowertopSettingDialog extends BaseSettingDialog {
31
32 static protected String TITLE="Powertop";
33
34 protected boolean showPid=false;
35 protected Float time;
36 protected Button showPidButton;
37 protected Text timeText;
38
39 protected PowertopSettingDialog(Shell parentShell, String title, String conn) {
40 super(parentShell,title,conn);
41 }
42
43 public PowertopSettingDialog(Shell parentShell) {
44 this(parentShell,
45 TITLE,
46 Activator.getDefault().getDialogSettings().get(IBaseConstants.CONNECTION_NAME_POWERTOP)
47 );
48 }
49
50 public boolean getShowPid() {
51 return showPid;
52 }
53
54 public Float getTime() {
55 return time;
56 }
57
58 @Override
59 protected Control createDialogArea(Composite parent) {
60 Composite comp=(Composite)super.createDialogArea(parent);
61 GridLayout topLayout = new GridLayout();
62 comp.setLayout(topLayout);
63
64 /*argument*/
65 SWTFactory.createVerticalSpacer(comp, 1);
66 createInternal(comp);
67
68 updateOkButton();
69 return comp;
70 }
71
72 protected void createInternal(Composite parent)
73 {
74 Composite projComp = new Composite(parent, SWT.NONE);
75 GridLayout projLayout = new GridLayout();
76 projLayout.numColumns = 4;
77 projLayout.marginHeight = 0;
78 projLayout.marginWidth = 0;
79 projComp.setLayout(projLayout);
80 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
81 projComp.setLayoutData(gd);
82
83 Label label = new Label(projComp, SWT.NONE);
84 label.setText(Messages.Powertop_Time_Text);
85 gd = new GridData();
86 gd.horizontalSpan = 1;
87 label.setLayoutData(gd);
88
89 timeText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
90 timeText.setText("5");
91 timeText.addModifyListener(new ModifyListener() {
92 public void modifyText(ModifyEvent e) {
93 updateOkButton();
94 }
95 });
96 gd = new GridData(GridData.FILL_HORIZONTAL);
97 gd.horizontalSpan = 3;
98 timeText.setLayoutData(gd);
99 }
100
101 @Override
102 protected boolean updateOkButton() {
103 boolean ret=super.updateOkButton();
104 if(ret==true) {
105 try {
106 Float.valueOf(timeText.getText());
107 }catch (Exception e) {
108 Button button=getButton(IDialogConstants.OK_ID);
109 if(button!=null)
110 button.setEnabled(false);
111 ret=false;
112 }
113 }
114 return ret;
115 }
116
117 @Override
118 protected void okPressed() {
119 IDialogSettings settings = Activator.getDefault().getDialogSettings();
120 // store the value of the generate sections checkbox
121 if(getCurrentConnection()==null) {
122 settings.put(IBaseConstants.CONNECTION_NAME_POWERTOP,
123 (String)null);
124 }else {
125 settings.put(IBaseConstants.CONNECTION_NAME_POWERTOP,
126 getCurrentConnection().getAliasName());
127 }
128 time=new Float(timeText.getText());
129 super.okPressed();
130 }
131}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.yocto.sdk.remotetools.Activator;
14import org.eclipse.jface.dialogs.IDialogSettings;
15import org.eclipse.swt.widgets.Composite;
16import org.eclipse.swt.widgets.Control;
17import org.eclipse.swt.widgets.Shell;
18
19public class SimpleSettingDialog extends BaseSettingDialog {
20
21 private final String connPropName;
22 /*
23 protected SimpleSettingDialog(Shell parentShell, String title, String conn) {
24 super(parentShell,title,conn);
25 }
26 */
27
28 public SimpleSettingDialog(Shell parentShell, String title, String connPropertyName) {
29 super(parentShell,
30 title,
31 Activator.getDefault().getDialogSettings().get(connPropertyName)
32 );
33 connPropName=connPropertyName;
34 }
35
36 @Override
37 protected Control createDialogArea(Composite parent) {
38 return super.createDialogArea(parent);
39 }
40
41 @Override
42 protected void okPressed() {
43 IDialogSettings settings = Activator.getDefault().getDialogSettings();
44 // store the value of the generate sections checkbox
45 if(getCurrentConnection()==null) {
46 settings.put(connPropName,
47 (String)null);
48 }else {
49 settings.put(connPropName,
50 getCurrentConnection().getAliasName());
51 }
52 super.okPressed();
53 }
54}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2011 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12import org.eclipse.core.commands.AbstractHandler;
13import org.eclipse.core.commands.ExecutionEvent;
14import org.eclipse.core.commands.ExecutionException;
15import org.eclipse.jface.dialogs.MessageDialog;
16import org.eclipse.swt.widgets.Shell;
17import org.eclipse.ui.IWorkbenchWindow;
18import org.eclipse.ui.PlatformUI;
19import org.eclipse.ui.handlers.HandlerUtil;
20import org.eclipse.ui.progress.IProgressService;
21
22public class SystemtapHandler extends AbstractHandler {
23 protected SystemtapSettingDialog setting;
24 protected String changeTerm="export TERM=vt100;";
25 protected IWorkbenchWindow window;
26 protected Shell shell;
27
28 public Object execute(ExecutionEvent event) throws ExecutionException {
29
30 this.window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
31 shell = window.getShell();
32 setting=new SystemtapSettingDialog(
33 shell, "Systemtap"
34 );
35
36
37 if(setting.open() == BaseSettingDialog.OK) {
38
39 String metadata_location = ((SystemtapSettingDialog)setting).getMetadataLocation();
40 String builddir_location = ((SystemtapSettingDialog)setting).getBuilddirLocation();
41 String remote_host = ((SystemtapSettingDialog)setting).getRemoteHost();
42 String user_id = ((SystemtapSettingDialog)setting).getUserID();
43 String systemtap_script = ((SystemtapSettingDialog)setting).getSystemtapScript();
44 String systemtap_args = ((SystemtapSettingDialog)setting).getSystemtapArgs();
45 IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
46 SystemtapModel op = new SystemtapModel(metadata_location, builddir_location, remote_host, user_id, systemtap_script,
47 systemtap_args,window.getShell().getDisplay());
48 try {
49 progressService.busyCursorWhile(op);
50 }catch (InterruptedException e) {
51 //user cancelled
52 }catch (Exception e) {
53 e.printStackTrace();
54 MessageDialog.openError(window.getShell(),
55 "Systemtap",
56 e.getMessage());
57 }
58 }
59 return false;
60 }
61
62 protected void initialize(ExecutionEvent event) throws ExecutionException {
63 this.window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
64 shell = window.getShell();
65 setting=new SystemtapSettingDialog(
66 shell, "Systemtap"
67 );
68 }
69
70}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import java.io.File;
14import java.lang.reflect.InvocationTargetException;
15
16import org.eclipse.core.runtime.IProgressMonitor;
17import org.eclipse.swt.widgets.Display;
18import org.eclipse.ui.console.ConsolePlugin;
19import org.eclipse.ui.console.IConsole;
20import org.eclipse.ui.console.IConsoleManager;
21import org.eclipse.ui.console.MessageConsole;
22import org.yocto.remote.utils.ShellSession;
23
24public class SystemtapModel extends BaseModel {
25 protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
26 protected static final String SYSTEMTAP_CONSOLE = "Systemtap Console";
27
28 private static final String TASK_NAME = "systemtap command";
29
30 protected MessageConsole sessionConsole;
31 private String metadata_location;
32 private String builddir_location;
33 private String remote_host;
34 private String user_id;
35 private String systemtap_script;
36 private String systemtap_args;
37
38 Display display;
39
40 public SystemtapModel(String metadata_location, String builddir_location, String remote_host, String user_id, String systemtap_script, String systemtap_args, Display display) {
41 super(null, TASK_NAME, "", "");
42 this.metadata_location = metadata_location;
43 this.builddir_location = builddir_location;
44 this.remote_host = remote_host;
45 this.user_id = user_id;
46 this.systemtap_script = systemtap_script;
47 this.systemtap_args = systemtap_args;
48 this.display = display;
49 if (sessionConsole == null) {
50 IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager();
51 IConsole[] existing = conMan.getConsoles();
52 for (int i = 0; i < existing.length; i++)
53 if (SYSTEMTAP_CONSOLE.equals(existing[i].getName())) {
54 sessionConsole = (MessageConsole) existing[i];
55 break;
56 }
57 if (sessionConsole == null) {
58 sessionConsole = new MessageConsole(SYSTEMTAP_CONSOLE, null);
59 conMan.addConsoles(new IConsole[] { sessionConsole });
60 }
61 }
62
63 ConsolePlugin.getDefault().getConsoleManager().showConsoleView(sessionConsole);
64 }
65
66 @Override
67 public void preProcess(IProgressMonitor monitor)
68 throws InvocationTargetException, InterruptedException {}
69
70 @Override
71 public void process(IProgressMonitor monitor)
72 throws InvocationTargetException, InterruptedException {
73 try {
74 ShellSession shell = new ShellSession(ShellSession.SHELL_TYPE_BASH,
75 new File(this.metadata_location), new File(this.builddir_location),
76 DEFAULT_INIT_SCRIPT, sessionConsole.newOutputStream());
77 boolean acceptedKey = shell.ensureKnownHostKey(user_id, remote_host);
78 if (acceptedKey) {
79 String crosstapCmd = "crosstap " + user_id + "@" + remote_host + " " + systemtap_script;
80 if (systemtap_args != null)
81 crosstapCmd = crosstapCmd + " " + systemtap_args;
82 shell.execute(crosstapCmd);
83 }
84 } catch (Exception e) {
85 throw new InvocationTargetException(e,e.getMessage());
86 }
87 }
88}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import java.io.File;
14
15import org.eclipse.jface.dialogs.Dialog;
16import org.eclipse.jface.dialogs.IDialogSettings;
17import org.eclipse.swt.SWT;
18import org.eclipse.swt.events.SelectionAdapter;
19import org.eclipse.swt.events.SelectionEvent;
20import org.eclipse.swt.layout.GridData;
21import org.eclipse.swt.layout.GridLayout;
22import org.eclipse.swt.widgets.Button;
23import org.eclipse.swt.widgets.Composite;
24import org.eclipse.swt.widgets.Control;
25import org.eclipse.swt.widgets.DirectoryDialog;
26import org.eclipse.swt.widgets.FileDialog;
27import org.eclipse.swt.widgets.Label;
28import org.eclipse.swt.widgets.Shell;
29import org.eclipse.swt.widgets.Text;
30import org.yocto.remote.utils.CommonHelper;
31import org.yocto.sdk.remotetools.Activator;
32import org.yocto.sdk.remotetools.Messages;
33import org.yocto.sdk.remotetools.SWTFactory;
34
35public class SystemtapSettingDialog extends Dialog {
36
37 static protected String TITLE="Systemtap Crosstap";
38 protected String title;
39 protected String metadata_location;
40 protected String builddir_location;
41 protected String systemtap_script;
42 protected String user_id;
43 protected String remote_host;
44 protected String systemtap_args;
45 protected boolean okPressed;
46 protected Button metadataLocationBtn;
47 protected Button builddirLocationBtn;
48 protected Button systemtapScriptBtn;
49 protected Text userIDText;
50 protected Text remoteHostText;
51 protected Text systemtapArgsText;
52 protected Text systemtapScriptText;
53 protected Text metadataLocationText;
54 protected Text builddirLocationText;
55
56 protected SystemtapSettingDialog(Shell parentShell, String title) {
57 super(parentShell);
58 this.title = title;
59 this.okPressed = false;
60 setShellStyle(getShellStyle() | SWT.RESIZE);
61 }
62
63 @Override
64 protected void configureShell(Shell newShell) {
65 super.configureShell(newShell);
66 newShell.setText(title);
67 }
68
69 public boolean isOKPressed() {
70 return okPressed;
71 }
72
73 public String getSystemtapScript() {
74 return systemtap_script;
75 }
76
77 public String getMetadataLocation() {
78 return metadata_location;
79 }
80
81 public String getBuilddirLocation() {
82 return builddir_location;
83 }
84
85 public String getRemoteHost() {
86 return remote_host;
87 }
88
89 public String getUserID() {
90 return user_id;
91 }
92
93 public String getSystemtapArgs() {
94 return systemtap_args;
95 }
96 @Override
97 protected Control createDialogArea(Composite parent) {
98 Composite comp=(Composite)super.createDialogArea(parent);
99 GridLayout topLayout = new GridLayout();
100 comp.setLayout(topLayout);
101
102 /*argument*/
103 SWTFactory.createVerticalSpacer(comp, 1);
104 createInternal(comp);
105
106 return comp;
107 }
108
109 protected void createInternal(Composite parent)
110 {
111 Composite projComp = new Composite(parent, SWT.NONE);
112 GridLayout projLayout = new GridLayout();
113 projLayout.numColumns = 2;
114 projLayout.marginHeight = 0;
115 projLayout.marginWidth = 0;
116 projComp.setLayout(projLayout);
117 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
118 projComp.setLayoutData(gd);
119
120 Label label = new Label(projComp, SWT.NONE);
121 label.setText(Messages.Metadata_Location);
122 Composite textContainer = new Composite(projComp, SWT.NONE);
123 textContainer.setLayout(new GridLayout(2, false));
124 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
125 metadataLocationText = (Text)addTextControl(textContainer, metadata_location);
126 metadataLocationBtn = addDirSelectButton(textContainer, metadataLocationText);
127
128 label = new Label(projComp, SWT.NONE);
129 label.setText(Messages.Builddir_Location);
130 textContainer = new Composite(projComp, SWT.NONE);
131 textContainer.setLayout(new GridLayout(2, false));
132 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
133 builddirLocationText = (Text)addTextControl(textContainer, builddir_location);
134 builddirLocationBtn = addDirSelectButton(textContainer, builddirLocationText);
135
136 label = new Label(projComp, SWT.NONE);
137 label.setText(Messages.User_ID);
138 userIDText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
139
140 if(user_id!=null)
141 userIDText.setText(user_id);
142 gd = new GridData(GridData.FILL_HORIZONTAL);
143 gd.horizontalSpan = 1;
144 userIDText.setLayoutData(gd);
145
146 label = new Label(projComp, SWT.NONE);
147 label.setText(Messages.Remote_Host);
148
149 remoteHostText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
150 if(remote_host != null)
151 remoteHostText.setText(remote_host);
152 gd = new GridData(GridData.FILL_HORIZONTAL);
153 gd.horizontalSpan = 1;
154 remoteHostText.setLayoutData(gd);
155
156 label = new Label(projComp, SWT.NONE);
157 label.setText(Messages.Systemtap_Script);
158 textContainer = new Composite(projComp, SWT.NONE);
159 textContainer.setLayout(new GridLayout(2, false));
160 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
161 systemtapScriptText = (Text)addTextControl(textContainer, systemtap_script);
162 systemtapScriptBtn = addFileSelectButton(textContainer, systemtapScriptText);
163
164 label = new Label(projComp, SWT.NONE);
165 label.setText(Messages.Systemtap_Args);
166
167 systemtapArgsText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
168 if(systemtap_args != null)
169 systemtapArgsText.setText(systemtap_args);
170 gd = new GridData(GridData.FILL_HORIZONTAL);
171 gd.horizontalSpan = 1;
172 systemtapArgsText.setLayoutData(gd);
173 }
174
175 private Control addTextControl(final Composite parent, String value) {
176 final Text text;
177
178 text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER);
179 text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
180 if (value != null)
181 text.setText(value);
182 text.setSize(10, 150);
183 return (Control)text;
184 }
185
186 private Button addDirSelectButton(final Composite parent, final Text text) {
187 Button button = new Button(parent, SWT.PUSH | SWT.LEAD);
188 button.setText("Browse");
189 button.addSelectionListener(new SelectionAdapter() {
190 @Override
191 public void widgetSelected(SelectionEvent event) {
192 String dirName;
193
194 dirName = new DirectoryDialog(parent.getShell()).open();
195 if (dirName != null) {
196 text.setText(dirName);
197 }
198 }
199 });
200 return button;
201 }
202
203 private Button addFileSelectButton(final Composite parent, final Text text) {
204 Button button = new Button(parent, SWT.PUSH | SWT.LEAD);
205 button.setText("Browse");
206 button.addSelectionListener(new SelectionAdapter() {
207 @Override
208 public void widgetSelected(SelectionEvent event) {
209 String fileName;
210
211 fileName = new FileDialog(parent.getShell()).open();
212 if (fileName != null) {
213 text.setText(fileName);
214 }
215 }
216 });
217 return button;
218 }
219
220 @Override
221 protected void okPressed() {
222 IDialogSettings settings = Activator.getDefault().getDialogSettings();
223 metadata_location = metadataLocationText.getText();
224 if ( (metadata_location == null) || metadata_location.isEmpty()) {
225 CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your metadata location!");
226 return;
227 }
228 File metadata_dir = new File(metadata_location);
229 if (!metadata_dir.exists()) {
230 CommonHelper.showErrorDialog("SystemTap Error", null, "The specified metadata location does not exist!");
231 return;
232 }
233 if (!metadata_dir.isDirectory()) {
234 CommonHelper.showErrorDialog("SystemTap Error", null, "The specified metadata location is not a directory!");
235 return;
236 }
237 builddir_location = builddirLocationText.getText();
238 if ( (builddir_location == null) || builddir_location.isEmpty()) {
239 CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your builddir location!");
240 return;
241 }
242 File builddir_dir = new File(builddir_location);
243 if (!builddir_dir.exists()) {
244 CommonHelper.showErrorDialog("SystemTap Error", null, "The specified builddir location does not exist!");
245 }
246 if (!metadata_dir.isDirectory()) {
247 CommonHelper.showErrorDialog("SystemTap Error", null, "The specified builddir location is not a directory!");
248 return;
249 }
250 user_id = userIDText.getText();
251 if ( (user_id == null) || user_id.isEmpty()) {
252 CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify remote user id!");
253 return;
254 }
255
256 remote_host = remoteHostText.getText();
257 if ( (remote_host == null) || remote_host.isEmpty()) {
258 CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify remote host IP!");
259 return;
260 }
261
262 systemtap_script = systemtapScriptText.getText();
263 if ( (systemtap_script == null) || systemtap_script.isEmpty()) {
264 CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your systemtap script");
265 return;
266 }
267 File script_file = new File(systemtap_script);
268 if (!script_file.exists()) {
269 CommonHelper.showErrorDialog("SystemTap Error", null, "The specified systemtap script does not exist!");
270 return;
271 }
272 if (!script_file.isFile()) {
273 CommonHelper.showErrorDialog("SystemTap Error", null, "The specified systemtap script is not a file!");
274 return;
275 }
276 systemtap_args = systemtapArgsText.getText();
277 okPressed = true;
278 super.okPressed();
279 }
280}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.eclipse.core.commands.AbstractHandler;
14import org.eclipse.core.commands.ExecutionEvent;
15import org.eclipse.core.commands.ExecutionException;
16import org.eclipse.jface.dialogs.MessageDialog;
17import org.eclipse.ui.IWorkbenchWindow;
18import org.eclipse.ui.PlatformUI;
19import org.eclipse.ui.handlers.HandlerUtil;
20import org.eclipse.ui.progress.IProgressService;
21
22import org.yocto.sdk.remotetools.Messages;
23
24public class Ust2Handler extends AbstractHandler {
25
26 public Object execute(ExecutionEvent event) throws ExecutionException {
27
28 //if(UstModel.checkAvail()!=true) {
29 // return null;
30 //}
31
32 IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
33
34 Ust2SettingDialog setting=new Ust2SettingDialog(
35 window.getShell()
36 );
37
38 if(setting.open()==BaseSettingDialog.OK) {
39 IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
40 String project = setting.getProject();
41 if (project == null) {
42 MessageDialog.openError(window.getShell(), "Lttng-ust", Messages.ErrorUstProject);
43 return null;
44 }
45 Ust2Model op=new Ust2Model(setting.getHost(),setting.getTrace(), project, window);
46 try {
47 progressService.busyCursorWhile(op);
48 }catch (InterruptedException e) {
49 //user cancelled
50 }catch (Exception e) {
51 e.printStackTrace();
52 MessageDialog.openError(window.getShell(),
53 "Ust",
54 (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage());
55 }
56 }
57 return null;
58 }
59}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import java.io.BufferedReader;
14import java.io.File;
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.InputStreamReader;
18import java.lang.reflect.InvocationTargetException;
19
20import org.eclipse.core.resources.IFolder;
21import org.eclipse.core.resources.IProject;
22import org.eclipse.core.resources.IResource;
23import org.eclipse.core.resources.IWorkspaceRoot;
24import org.eclipse.core.resources.ResourcesPlugin;
25import org.eclipse.core.runtime.IPath;
26import org.eclipse.core.runtime.IProgressMonitor;
27import org.eclipse.core.runtime.Path;
28import org.eclipse.core.runtime.SubProgressMonitor;
29import org.eclipse.rse.core.model.IHost;
30import org.eclipse.ui.IWorkbenchWindow;
31
32public class Ust2Model extends BaseModel {
33
34 private static final String REMOTE_EXEC = "/tmp/ust_tar.sh";
35 private static final String LOCAL_SCRIPT = "resources/ust_tar.sh";
36
37 private static final String LOCAL_FILE_SUFFIX = ".local.tar";
38 private static final String REMOTE_FILE_SUFFIX = ".tar";
39 private static final String LOCAL_EXEC = "lttv-gui";
40 private static final String TRACE_FOLDER_NAME = "Traces";
41 private static final String DATAFILE_PREFIX = "ustfile:";
42
43 private static final String TASK_NAME = "ust2trace command";
44
45 private String trace_loc;
46
47 private String prj_name;
48
49 private IWorkbenchWindow window;
50
51 public Ust2Model(IHost host, String trace, String project, IWorkbenchWindow window) {
52 super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC);
53 trace_loc = trace;
54
55 prj_name = project;
56 this.window = window;
57 }
58
59 @Override
60 protected void checkTerminate(InputStream is) throws IOException {
61 String temp;
62 BufferedReader in = new BufferedReader(new InputStreamReader(is));
63 while((temp = in.readLine())!=null) {
64 int idx = temp.indexOf(DATAFILE_PREFIX);
65 if(idx != -1) {
66 remoteFile = temp.substring(idx + DATAFILE_PREFIX.length());
67 break;
68 }
69 }
70 }
71
72 private void generateData(IProgressMonitor monitor) throws Exception {
73 runRemoteShellExec(monitor, trace_loc, true);
74 if(remoteFile == null)
75 throw new Exception("Ust: null remote data file");
76 if(remoteFile.endsWith(REMOTE_FILE_SUFFIX)==false)
77 throw new Exception("Wrong ust data file " + remoteFile);
78
79 localFile = new String(remoteFile.substring(0, remoteFile.length()-4) + LOCAL_FILE_SUFFIX);
80 }
81
82 private void importToProject(IProgressMonitor monitor) throws Exception {
83 ProcessBuilder pb = new ProcessBuilder("tar", "fx", localFile);
84 pb.directory(new File("/tmp"));
85 Process p=pb.start();
86 if(p.waitFor()!=0)
87 throw new Exception("extract ust data files failed");
88
89 String traceName = localFile.substring(0,localFile.length()-LOCAL_FILE_SUFFIX.length());
90
91 IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
92 IPath full_path = wsroot.getFullPath();
93 IProject project = wsroot.getProject(prj_name);
94 IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME);
95 if (!traceFolder.exists()) {
96 throw new Exception("Can't find file trace folder in selected project.");
97 }
98
99 String trace_str = traceName.substring(0, traceName.indexOf('-'));
100 traceFolder.createLink(new Path(trace_str), IResource.REPLACE, monitor);
101 for (IResource resource:traceFolder.members()) {
102 String extension = resource.getFileExtension();
103 if (extension != null)
104 continue;
105 else {
106 //traceFolder.setPersistentProperty(TmfCommonConstants.TRACETYPE, "org.eclipse.linuxtools.tmf.ui.type.ctf");
107 //resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, "org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace");
108 //traceFolder.setPersistentProperty(TmfCommonConstants.TRACEICON, "icons/obj16/garland16.png");
109 //traceFolder.touch(null);
110 }
111 }
112 }
113
114 private String[] generateViewerParam() throws Exception {
115 String viewerParam=new String(LOCAL_EXEC);
116 int i;
117
118 ProcessBuilder pb = new ProcessBuilder("tar", "fx", localFile);
119 pb.directory(new File("/tmp"));
120 Process p=pb.start();
121 if(p.waitFor()!=0)
122 throw new Exception("extract ust data files failed");
123 File f=new File(localFile.substring(0,localFile.length()-LOCAL_FILE_SUFFIX.length()));
124 File []subdir=f.listFiles();
125
126 for (i=0;i<subdir.length;i++) {
127 if(subdir[i].isDirectory()) {
128 viewerParam=viewerParam.concat(" -t " + subdir[i].getAbsolutePath());
129 }
130 }
131
132 return viewerParam.split(" ");
133 }
134
135 @Override
136 public void process(IProgressMonitor monitor)
137 throws InvocationTargetException, InterruptedException {
138 // TODO Auto-generated method stub
139
140 String datafile;
141
142 monitor.beginTask("Running ust", 100);
143 try {
144 //preparing remote trace
145
146 monitor.subTask("Preparing user space lttng data file remotely");
147 generateData(new SubProgressMonitor(monitor,30));
148
149 //download datafile to local
150 monitor.subTask("Downloading user space lttng data file");
151 getDataFile(new SubProgressMonitor(monitor,30));
152
153 //extract datafile and import to lttng project
154 importToProject(new SubProgressMonitor(monitor,30));
155
156 }catch (InterruptedException e){
157 throw e;
158 }catch (InvocationTargetException e) {
159 throw e;
160 }catch (Exception e){
161 throw new InvocationTargetException(e, e.getMessage());
162 }finally {
163 monitor.done();
164 }
165 }
166}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java
new file mode 100644
index 0000000..9fd7876
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java
@@ -0,0 +1,104 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.yocto.sdk.remotetools.Activator;
14import org.yocto.sdk.remotetools.Messages;
15import org.eclipse.jface.dialogs.IDialogConstants;
16import org.eclipse.swt.SWT;
17import org.eclipse.swt.events.ModifyEvent;
18import org.eclipse.swt.events.ModifyListener;
19
20import org.eclipse.swt.layout.GridData;
21import org.eclipse.swt.layout.GridLayout;
22import org.eclipse.swt.widgets.Button;
23
24import org.eclipse.swt.widgets.Composite;
25
26import org.eclipse.swt.widgets.Label;
27import org.eclipse.swt.widgets.Shell;
28import org.eclipse.swt.widgets.Text;
29
30
31public class Ust2SettingDialog extends UstSettingDialogBase {
32
33 static protected String TITLE="Lttng2.0 User Tracing Import";
34
35 protected String trace;
36 protected Text traceText;
37
38 protected Ust2SettingDialog(Shell parentShell, String title, String conn) {
39 super(parentShell,title,conn);
40 }
41
42 public Ust2SettingDialog(Shell parentShell) {
43 this(parentShell,
44 TITLE,
45 Activator.getDefault().getDialogSettings().get(IBaseConstants.CONNECTION_NAME_UST)
46 );
47 }
48
49 public String getTrace() {
50 return trace;
51 }
52
53 @Override
54 protected void okPressed() {
55
56 trace=traceText.getText();
57
58 super.okPressed();
59 }
60
61 protected void createArgument(Composite parent)
62 {
63 Composite projComp = new Composite(parent, SWT.NONE);
64 GridLayout projLayout = new GridLayout();
65 projLayout.numColumns = 4;
66 projLayout.marginHeight = 0;
67 projLayout.marginWidth = 0;
68 projComp.setLayout(projLayout);
69 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
70 projComp.setLayoutData(gd);
71
72 Label label = new Label(projComp, SWT.NONE);
73 label.setText(Messages.Usttrace_Trace_Loc_Text);
74 gd = new GridData();
75 gd.horizontalSpan = 4;
76 label.setLayoutData(gd);
77
78 traceText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
79 traceText.addModifyListener(new ModifyListener() {
80 public void modifyText(ModifyEvent e) {
81 updateOkButton();
82 }
83 });
84 if(trace!=null)
85 traceText.setText(trace);
86 gd = new GridData(GridData.FILL_HORIZONTAL);
87 gd.horizontalSpan = 1;
88 traceText.setLayoutData(gd);
89 }
90
91 @Override
92 protected boolean updateOkButton() {
93 boolean ret=super.updateOkButton();
94 if(ret==true) {
95 if(traceText.getText().isEmpty() || !traceText.getText().endsWith("/ust")) {
96 Button button=getButton(IDialogConstants.OK_ID);
97 if(button!=null)
98 button.setEnabled(false);
99 ret=false;
100 }
101 }
102 return ret;
103 }
104}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java
new file mode 100644
index 0000000..70b0816
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java
@@ -0,0 +1,170 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.yocto.sdk.remotetools.Activator;
14import org.yocto.sdk.remotetools.Messages;
15import org.yocto.sdk.remotetools.SWTFactory;
16import org.eclipse.jface.dialogs.IDialogSettings;
17import org.eclipse.swt.SWT;
18import org.eclipse.swt.events.ModifyEvent;
19import org.eclipse.swt.events.ModifyListener;
20import org.eclipse.swt.layout.GridData;
21import org.eclipse.swt.layout.GridLayout;
22import org.eclipse.swt.widgets.Combo;
23import org.eclipse.swt.widgets.Composite;
24import org.eclipse.swt.widgets.Control;
25import org.eclipse.swt.widgets.Label;
26import org.eclipse.swt.widgets.Shell;
27import org.eclipse.linuxtools.tmf.core.TmfProjectNature;
28import org.eclipse.core.resources.IWorkspaceRoot;
29import org.eclipse.core.resources.ResourcesPlugin;
30import org.eclipse.core.resources.IProject;
31
32
33public class UstSettingDialogBase extends BaseSettingDialog {
34 protected Label projectLabel;
35 protected Combo projectCombo;
36 protected String curProject = null;
37
38 protected UstSettingDialogBase(Shell parentShell, String title, String conn) {
39 super(parentShell,title,conn);
40 }
41
42 public String getProject() {
43 return curProject;
44 }
45
46 @Override
47 protected void okPressed() {
48 IDialogSettings settings = Activator.getDefault().getDialogSettings();
49 // store the value of the generate sections checkbox
50 if(getCurrentConnection()==null) {
51 settings.put(IBaseConstants.CONNECTION_NAME_UST,
52 (String)null);
53 }else {
54 settings.put(IBaseConstants.CONNECTION_NAME_UST,
55 getCurrentConnection().getAliasName());
56 }
57 super.okPressed();
58 }
59
60 @Override
61 protected Control createDialogArea(Composite parent) {
62 Composite comp=(Composite)super.createDialogArea(parent);
63 GridLayout topLayout = new GridLayout();
64 comp.setLayout(topLayout);
65
66 /*argument*/
67 SWTFactory.createVerticalSpacer(comp, 1);
68 createImportProjectGroup(comp);
69 createArgument(comp);
70
71 updateOkButton();
72 return comp;
73 }
74
75 protected void createImportProjectGroup(Composite parent) {
76 Composite projComp = new Composite(parent, SWT.NONE);
77 GridLayout projLayout = new GridLayout();
78 projLayout.numColumns = 6;
79 projLayout.marginHeight = 0;
80 projLayout.marginWidth = 0;
81 projComp.setLayout(projLayout);
82 GridData gd = new GridData(GridData.FILL_HORIZONTAL);
83 projComp.setLayoutData(gd);
84
85 projectLabel = new Label(projComp, SWT.NONE);
86 projectLabel.setText(Messages.Import_to_Project);
87 gd = new GridData();
88 gd.horizontalSpan = 1;
89 projectLabel.setLayoutData(gd);
90
91 projectCombo = new Combo(projComp, SWT.DROP_DOWN | SWT.READ_ONLY);
92 gd = new GridData(GridData.FILL_HORIZONTAL);
93 gd.horizontalSpan = 4;
94 projectCombo.setLayoutData(gd);
95 projectCombo.addModifyListener(new ModifyListener() {
96
97 public void modifyText(ModifyEvent e) {
98 updateCurProject();
99 }
100 });
101
102 updateProjectPulldown();
103 }
104
105 protected void updateCurProject() {
106 IProject currentProjectSelected = getCurrentProject();
107
108 if (currentProjectSelected != null)
109 curProject = currentProjectSelected.getName();
110
111 updateOkButton();
112 }
113
114 protected IProject getCurrentProject() {
115 if (projectCombo.getItemCount() == 0)
116 return null;
117 int currentSelection = projectCombo.getSelectionIndex();
118 String importProject = currentSelection >= 0 ? projectCombo
119 .getItem(currentSelection) : null;
120 IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
121 IProject project = wsroot.getProject(importProject);
122 return project;
123 }
124
125 protected void updateProjectPulldown() {
126 int index=-1;
127
128 projectCombo.removeAll();
129 IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
130 IProject[] projects = wsroot.getProjects();
131
132 for (int i = 0; i < projects.length; ++i) {
133 try {
134 if (projects[i].isOpen() && projects[i].hasNature(TmfProjectNature.ID)) {
135 String projName = projects[i].getName();
136 projectCombo.add(projName);
137 if (curProject != null)
138 if (projName.matches(curProject))
139 index = i;
140 }
141 } catch (Exception e) {
142 // TODO Auto-generated catch block
143 e.printStackTrace();
144 }
145 }
146
147 if(index>=0) {
148 projectCombo.select(index);
149 }else if (projectCombo.getItemCount()> 0) {
150 projectCombo.select(projectCombo.getItemCount() - 1);
151 }
152
153 //TODO
154 //connectionCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT,true);
155 projectCombo.pack(true);
156 projectCombo.layout();
157 projectCombo.getParent().layout();
158
159 updateCurProject();
160 }
161 protected void createArgument(Composite parent)
162 {
163 }
164
165 @Override
166 protected boolean updateOkButton() {
167 boolean ret=super.updateOkButton();
168 return ret;
169 }
170}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.actions;
12
13import org.eclipse.core.commands.AbstractHandler;
14import org.eclipse.core.commands.ExecutionEvent;
15import org.eclipse.core.commands.ExecutionException;
16import org.eclipse.jface.wizard.WizardDialog;
17import org.eclipse.ui.IWorkbenchWindow;
18import org.eclipse.ui.handlers.HandlerUtil;
19
20import org.yocto.sdk.remotetools.wizards.bsp.YoctoBSPWizard;
21
22public class YoctoBspHandler extends AbstractHandler {
23
24 public Object execute(ExecutionEvent event) throws ExecutionException {
25
26 IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
27 // Instantiates and initializes the wizard
28 YoctoBSPWizard bspWizard = new YoctoBSPWizard();
29 //bspWizard.init(window.getWorkbench(), (IStructuredSelection)selection);
30 // Instantiates the wizard container with the wizard and opens it
31 WizardDialog dialog = new WizardDialog(window.getShell(), bspWizard);
32 //dialog.create();
33 dialog.open();
34 //YoctoBspDialog setting=new YoctoBspDialog(window.getShell());
35 //setting.open();
36 return null;
37 }
38}
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 @@
1################################################################################
2# Copyright (c) 2010 Intel Corporation.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Intel - initial API and implementation
10################################################################################
11
12# NLS_MESSAGEFORMAT_VAR
13# NLS_ENCODING=UTF-8
14
15ErrorNoSubsystem=No subsystem found.
16ErrorConnectSubsystem=Could not connect to the remote system.
17ErrorNoHost=No remote host found.
18ErrorNoRemoteService=No remote TCF service found.
19ErrorOprofileViewer=Local application "oprofile-viewer" is NOT installed.\nPlease goto http://git.yoctoproject.org/cgit/cgit.cgi/oprofileui to install OprofileUI.
20ErrorOprofile=Oprofile is NOT installed on the local host.\n Please goto http://oprofile.sourceforge.net to install Oprofile.
21ErrorLttvGui=Local application "lttv-gui" is NOT installed.\nPlease goto http://lttng.org to install LTTng Viewer.
22ErrorUstProject=No Lttng Project selected. If the list is empty, please create a Lttng project under File->New!
23
24InfoDownload=Downloading
25InfoUpload=Uploading
26
27BaseSettingDialog_Connection=Connection
28BaseSettingDialog_New=New
29BaseSettingDialog_Properties=Properties
30Usttrace_Argument_Text=Argument
31Usttrace_Application_Text=Application
32Usttrace_Trace_Loc_Text=Ust directory path
33Powertop_Time_Text=Time to gather data(sec)
34Powertop_ShowPid_Text=show pids in wakeups list
35TerminalViewer_text=This view is dedicated to Yocto Remote tools. Please use the "Yocto Remote Tools" menu to open the view.
36//Systemtap_KO_Text=Kernel Module:
37Metadata_Location=Metadata Location:
38Builddir_Location=Build dir Location:
39User_ID=User ID:
40Remote_Host=Remote Host:
41Systemtap_Script=Systemtap Script:
42Systemtap_Args=Systemtap Args:
43Import_to_Project=Import to project:
44
45LocalJob_Title=Launching local application
46ErrorLocalJob=Failed in launching local application
47
48RemoteShellExec_1=Executing {0} {1}
49RemoteShellExec_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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.views;
12
13
14import java.io.BufferedReader;
15import java.io.FileReader;
16import java.util.ArrayList;
17
18import org.eclipse.swt.widgets.Composite;
19import org.eclipse.ui.part.*;
20import org.eclipse.jface.viewers.*;
21import org.eclipse.swt.graphics.Image;
22import org.eclipse.ui.*;
23import org.eclipse.swt.SWT;
24
25
26/**
27 * This sample class demonstrates how to plug-in a new
28 * workbench view. The view shows data obtained from the
29 * model. The sample creates a dummy model on the fly,
30 * but a real implementation would connect to the model
31 * available either in this or another plug-in (e.g. the workspace).
32 * The view is connected to the model using a content provider.
33 * <p>
34 * The view uses a label provider to define how model
35 * objects should be presented in the view. Each
36 * view can present the same model objects using
37 * different labels and icons, if needed. Alternatively,
38 * a single label provider can be shared between views
39 * in order to ensure that objects of the same type are
40 * presented in the same way everywhere.
41 * <p>
42 */
43
44public class BaseFileView extends ViewPart {
45
46 /**
47 * The ID of the view as specified by the extension.
48 */
49 public static final String ID = "org.yocto.sdk.remotetools.views.BaseFileView";
50
51 private TableViewer viewer;
52
53 private String filename;
54
55 /*
56 * The content provider class is responsible for
57 * providing objects to the view. It can wrap
58 * existing objects in adapters or simply return
59 * objects as-is. These objects may be sensitive
60 * to the current input of the view, or ignore
61 * it and always show the same content
62 * (like Task List, for example).
63 */
64
65 class ViewContentProvider implements IStructuredContentProvider {
66 public void inputChanged(Viewer v, Object oldInput, Object newInput) {
67 if(newInput instanceof String)
68 filename=(String)newInput;
69 }
70 public void dispose() {
71 }
72 public Object[] getElements(Object parent) {
73 ArrayList <String> elements=new ArrayList <String>();
74 BufferedReader in;
75 String line;
76 try {
77 in=new BufferedReader(new FileReader(filename));
78 }catch (Exception e) {
79 return new String [] {"Invalid file " + filename};
80 }
81
82 try {
83 do {
84 line=in.readLine();
85 if(line!=null)
86 elements.add(line);
87 }while(line!=null);
88 }catch (Exception e) {
89 e.printStackTrace();
90 }
91 return (String[]) elements.toArray(new String[elements.size()]);
92 }
93 }
94 class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
95 public String getColumnText(Object obj, int index) {
96 return getText(obj);
97 }
98 public Image getColumnImage(Object obj, int index) {
99 //return getImage(obj);
100 return null;
101 }
102 public Image getImage(Object obj) {
103 return PlatformUI.getWorkbench().
104 getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
105 }
106 }
107
108 /**
109 * The constructor.
110 */
111 public BaseFileView() {
112 }
113
114 public BaseFileView(String file) {
115 this();
116 this.filename=file;
117 }
118
119 /**
120 * This is a callback that will allow us
121 * to create the viewer and initialize it.
122 */
123 public void createPartControl(Composite parent) {
124 viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
125 viewer.setContentProvider(new ViewContentProvider());
126 viewer.setLabelProvider(new ViewLabelProvider());
127 viewer.setInput(filename);
128 }
129
130 public void setInput(String filename) {
131 viewer.setInput(filename);
132 }
133
134 /**
135 * Passing the focus request to the viewer's control.
136 */
137 public void setFocus() {
138 viewer.getControl().setFocus();
139 }
140} \ 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 @@
1/*******************************************************************************
2 * Copyright (c) 2002, 2009 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Initial Contributors:
9 * The following IBM employees contributed to the Remote System Explorer
10 * component that contains this file: David McKnight, Kushal Munir,
11 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
12 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13 *
14 * Contributors:
15 * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
16 * Yu-Fen Kuo (MontaVista) - Adapted from CommandsViewWorkbook
17 * Anna Dushistova (MontaVista) - Adapted from CommandsViewWorkbook
18 * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits
19 * Martin Oberhuber (Wind River) - [227571] RSE Terminal should honor Encoding set on the IHost
20 * Michael Scharf (Wind River) - [236203] [rseterminal] Potentially UI blocking code in TerminalViewTab.createTabItem
21 * Anna Dushistova (MontaVista) - [244437] [rseterminal] Possible race condition when multiple Terminals are launched after each other
22 * Martin Oberhuber (Wind River) - [247700] Terminal uses ugly fonts in JEE package
23 * Anna Dushistova (MontaVista) - [267609] [rseterminal] The first "Launch Terminal" command creates no terminal tab
24 ********************************************************************************/
25package org.yocto.sdk.remotetools.views;
26
27import java.io.UnsupportedEncodingException;
28
29import org.eclipse.core.runtime.IAdaptable;
30import org.eclipse.jface.action.IMenuListener;
31import org.eclipse.jface.action.IMenuManager;
32import org.eclipse.jface.action.MenuManager;
33import org.eclipse.jface.action.Separator;
34import org.eclipse.jface.resource.FontRegistry;
35import org.eclipse.jface.util.IPropertyChangeListener;
36import org.eclipse.jface.util.PropertyChangeEvent;
37import org.eclipse.rse.core.model.IHost;
38import org.eclipse.swt.SWT;
39import org.eclipse.swt.custom.CTabFolder;
40import org.eclipse.swt.custom.CTabItem;
41import org.eclipse.swt.events.DisposeEvent;
42import org.eclipse.swt.events.DisposeListener;
43import org.eclipse.swt.events.MenuEvent;
44import org.eclipse.swt.events.MenuListener;
45import org.eclipse.swt.graphics.Font;
46import org.eclipse.swt.layout.FillLayout;
47import org.eclipse.swt.layout.GridData;
48import org.eclipse.swt.widgets.Composite;
49import org.eclipse.swt.widgets.Control;
50import org.eclipse.swt.widgets.Display;
51import org.eclipse.swt.widgets.Menu;
52import org.eclipse.tm.internal.terminal.control.ITerminalListener;
53import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
54import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
55import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll;
56import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy;
57import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCut;
58import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
59import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll;
60import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
61import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
62import org.eclipse.ui.PlatformUI;
63import org.eclipse.ui.themes.IThemeManager;
64
65/**
66 * This is the desktop view wrapper of the System View viewer.
67 */
68public class TerminalViewTab extends Composite {
69
70 public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$
71
72 private final CTabFolder tabFolder;
73
74 private IPropertyChangeListener propertyChangeListener;
75
76 private Menu menu;
77
78 private boolean fMenuAboutToShow;
79
80 private TerminalActionCopy fActionEditCopy;
81
82 private TerminalActionCut fActionEditCut;
83
84 private TerminalActionPaste fActionEditPaste;
85
86 private TerminalActionClearAll fActionEditClearAll;
87
88 private TerminalActionSelectAll fActionEditSelectAll;
89
90 protected class TerminalContextMenuHandler implements MenuListener,
91 IMenuListener {
92 public void menuHidden(MenuEvent event) {
93 fMenuAboutToShow = false;
94 fActionEditCopy.updateAction(fMenuAboutToShow);
95 }
96
97 public void menuShown(MenuEvent e) {
98
99 }
100
101 public void menuAboutToShow(IMenuManager menuMgr) {
102 fMenuAboutToShow = true;
103 fActionEditCopy.updateAction(fMenuAboutToShow);
104 fActionEditCut.updateAction(fMenuAboutToShow);
105 fActionEditSelectAll.updateAction(fMenuAboutToShow);
106 fActionEditPaste.updateAction(fMenuAboutToShow);
107 fActionEditClearAll.updateAction(fMenuAboutToShow);
108 }
109 }
110
111 public TerminalViewTab(final Composite parent, TerminalViewer viewer) {
112 super(parent, SWT.NONE);
113 tabFolder = new CTabFolder(this, SWT.NONE);
114 tabFolder.setLayout(new FillLayout());
115 tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
116 setLayout(new FillLayout());
117 tabFolder.setBackground(parent.getBackground());
118 tabFolder.setSimple(false);
119 tabFolder.setUnselectedImageVisible(false);
120 tabFolder.setUnselectedCloseVisible(false);
121
122 tabFolder.setMinimizeVisible(false);
123 tabFolder.setMaximizeVisible(false);
124//TODO setupActions();
125 }
126
127 public void dispose() {
128 if (propertyChangeListener != null) {
129 IThemeManager mgr = PlatformUI.getWorkbench().getThemeManager();
130 mgr.removePropertyChangeListener(propertyChangeListener);
131 propertyChangeListener = null;
132 }
133 if (!tabFolder.isDisposed()) {
134 tabFolder.dispose();
135 }
136 super.dispose();
137 }
138
139 public CTabFolder getFolder() {
140 return tabFolder;
141 }
142
143 public void remove(Object root) {
144
145 }
146
147 public int getItemCount(){
148 return tabFolder.getItemCount();
149 }
150
151 public CTabItem getSelectedTab() {
152 if (tabFolder.getItemCount() > 0) {
153 int index = tabFolder.getSelectionIndex();
154 CTabItem item = tabFolder.getItem(index);
155 return item;
156 }
157
158 return null;
159 }
160
161 public void showCurrentPage() {
162 tabFolder.setFocus();
163 }
164
165 public void showPageFor(Object root) {
166 for (int i = 0; i < tabFolder.getItemCount(); i++) {
167 CTabItem item = tabFolder.getItem(i);
168 if (item.getData() == root) {
169 tabFolder.setSelection(item);
170 }
171
172 }
173 }
174
175 public void showPageFor(String tabName) {
176 for (int i = 0; i < tabFolder.getItemCount(); i++) {
177 CTabItem item = tabFolder.getItem(i);
178 if (item.getText().equals(tabName)) {
179 tabFolder.setSelection(item);
180 return;
181 }
182
183 }
184 }
185
186 public void disposePageFor(String tabName) {
187 for (int i = 0; i < tabFolder.getItemCount(); i++) {
188 CTabItem item = tabFolder.getItem(i);
189 if (item.getText().equals(tabName)) {
190 item.dispose();
191 return;
192 }
193
194 }
195 }
196
197 public void propertyChange(PropertyChangeEvent e) {
198 // for now always update
199 if (tabFolder!=null) {
200 CTabItem[] items = tabFolder.getItems();
201 for (int i=0; i<items.length; i++) {
202 Object control = items[i].getData(DATA_KEY_CONTROL);
203 if (control instanceof ITerminalViewControl) {
204 updateTheme((ITerminalViewControl) control);
205 }
206 }
207 }
208 }
209
210 public void updateTheme(final ITerminalViewControl control) {
211 if (control != null) {
212 IThemeManager mgr = PlatformUI.getWorkbench().getThemeManager();
213 Font font;
214 FontRegistry fr = mgr.getCurrentTheme().getFontRegistry();
215 if (fr.hasValueFor("terminal.views.view.font.definition")) { //$NON-NLS-1$
216 //Terminal View font if available
217 font = fr.get("terminal.views.view.font.definition"); //$NON-NLS-1$
218 } else if (fr.hasValueFor("REMOTE_COMMANDS_VIEW_FONT")) { //$NON-NLS-1$
219 //fallback: "Remote Shell Font"
220 font = fr.get("REMOTE_COMMANDS_VIEW_FONT"); //$NON-NLS-1$
221 } else {
222 //fallback: "Basic Text Font"
223 font = fr.get("org.eclipse.jface.textfont"); //$NON-NLS-1$
224 }
225 control.setFont(font);
226 if (propertyChangeListener == null) {
227 final TerminalViewTab myself = this;
228 propertyChangeListener = new IPropertyChangeListener() {
229 public void propertyChange(PropertyChangeEvent event) {
230 myself.propertyChange(event);
231 }
232 };
233 mgr.addPropertyChangeListener(propertyChangeListener);
234 }
235 }
236 }
237/* TODO
238 public CTabItem createTabItem(IAdaptable root,
239 final String initialWorkingDirCmd,final String initialCmd) {
240 final CTabItem item = new CTabItem(tabFolder, SWT.CLOSE);
241 setTabTitle(root, item);
242
243 item.setData(root);
244 Composite c = new Composite(tabFolder, SWT.NONE);
245 c.setLayout(new FillLayout());
246
247 tabFolder.getParent().layout(true);
248 if (root instanceof IHost) {
249 final IHost host = (IHost) root;
250
251 ITerminalConnector connector = new TCFTerminalConnector(host);
252 ITerminalViewControl terminalControl = TerminalViewControlFactory
253 .makeControl(new ITerminalListener()
254 {
255
256 public void setState(final TerminalState state) {
257 if (state == TerminalState.CLOSED
258 || state == TerminalState.CONNECTED) {
259 Display.getDefault().asyncExec(new Runnable() {
260 public void run() {
261 if (!item.isDisposed()) {
262 final ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper
263 .getTerminalSubSystem(host);
264
265 if (state == TerminalState.CONNECTED)
266 TerminalServiceHelper
267 .updateTerminalShellForTerminalElement(item);
268
269 setTabImage(host, item);
270 ISystemRegistry registry = RSECorePlugin
271 .getTheSystemRegistry();
272 registry
273 .fireEvent(new SystemResourceChangeEvent(
274 terminalServiceSubSystem,
275 ISystemResourceChangeEvents.EVENT_REFRESH,
276 terminalServiceSubSystem));
277 }
278 if (state == TerminalState.CONNECTED) {
279
280 if (initialWorkingDirCmd != null) {
281 Object data = item
282 .getData(DATA_KEY_CONTROL);
283 if (data instanceof ITerminalViewControl)
284 ((ITerminalViewControl) data)
285 .pasteString(initialWorkingDirCmd);
286 }
287 }
288 }
289 });
290 }
291
292 }
293
294 public void setTerminalTitle(String title) {
295
296 }
297 },
298 c, new ITerminalConnector[] { connector });
299 // Specify Encoding for Terminal
300 try {
301 terminalControl.setEncoding(host.getDefaultEncoding(true));
302 } catch (UnsupportedEncodingException e) {
303 // ignore and allow fallback to default encoding
304 }
305 terminalControl.setConnector(connector);
306 item.setData(DATA_KEY_CONTROL, terminalControl);
307 updateTheme(terminalControl);
308 terminalControl.connectTerminal();
309 }
310 item.setControl(c);
311 tabFolder.setSelection(item);
312 item.addDisposeListener(new DisposeListener() {
313
314 public void widgetDisposed(DisposeEvent e) {
315 Object source = e.getSource();
316 if (source instanceof CTabItem) {
317 CTabItem currentItem = (CTabItem) source;
318 Object data = currentItem.getData(DATA_KEY_CONTROL);
319 if (data instanceof ITerminalViewControl) {
320 ((ITerminalViewControl) data).disposeTerminal();
321 }
322 data = currentItem.getData();
323 if (data instanceof IHost) {
324 TerminalServiceHelper.removeTerminalElementFromHost(
325 currentItem, (IHost) data);
326 }
327 }
328
329 }
330
331 });
332
333 setupContextMenus();
334 return item;
335
336 }
337
338 protected void setupActions() {
339 fActionEditCopy = new TerminalActionCopy() {
340 protected ITerminalViewControl getTarget() {
341 return getCurrentTerminalViewControl();
342 }
343 };
344 fActionEditCut = new TerminalActionCut() {
345 protected ITerminalViewControl getTarget() {
346 return getCurrentTerminalViewControl();
347 }
348 };
349 fActionEditPaste = new TerminalActionPaste() {
350 protected ITerminalViewControl getTarget() {
351 return getCurrentTerminalViewControl();
352 }
353 };
354 fActionEditClearAll = new TerminalActionClearAll() {
355 protected ITerminalViewControl getTarget() {
356 return getCurrentTerminalViewControl();
357 }
358 };
359 fActionEditSelectAll = new TerminalActionSelectAll() {
360 protected ITerminalViewControl getTarget() {
361 return getCurrentTerminalViewControl();
362 }
363 };
364 }
365
366 protected void setupContextMenus() {
367 ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl();
368 if (terminalViewControl == null)
369 return;
370
371 if (menu == null) {
372 MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
373 menu = menuMgr.createContextMenu(tabFolder);
374 loadContextMenus(menuMgr);
375 TerminalContextMenuHandler contextMenuHandler = new TerminalContextMenuHandler();
376 menuMgr.addMenuListener(contextMenuHandler);
377 menu.addMenuListener(contextMenuHandler);
378 }
379 Control ctlText = terminalViewControl.getControl();
380 ctlText.setMenu(menu);
381 }
382
383 protected void loadContextMenus(IMenuManager menuMgr) {
384 menuMgr.add(fActionEditCopy);
385 menuMgr.add(fActionEditPaste);
386 menuMgr.add(new Separator());
387 menuMgr.add(fActionEditClearAll);
388 menuMgr.add(fActionEditSelectAll);
389 menuMgr.add(new Separator());
390
391 // Other plug-ins can contribute there actions here
392 menuMgr.add(new Separator("Additions")); //$NON-NLS-1$
393 }
394
395 private void setTabTitle(IAdaptable root, CTabItem titem) {
396 ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
397 .getAdapter(ISystemViewElementAdapter.class);
398 if (va != null) {
399 updateWithUniqueTitle(va.getName(root), titem);
400 setTabImage(root, titem);
401 }
402 }
403
404 private void setTabImage(IAdaptable root, CTabItem titem) {
405 ISystemViewElementAdapter va = (ISystemViewElementAdapter) root
406 .getAdapter(ISystemViewElementAdapter.class);
407 if (va != null) {
408 if (root instanceof IHost) {
409 ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper
410 .getTerminalSubSystem((IHost) root);
411 TerminalElement element = terminalServiceSubSystem
412 .getChild(titem.getText());
413 if (element != null) {
414 va = (ISystemViewElementAdapter) element
415 .getAdapter(ISystemViewElementAdapter.class);
416 titem
417 .setImage(va.getImageDescriptor(element)
418 .createImage());
419 return;
420 }
421 }
422
423 titem.setImage(va.getImageDescriptor(root).createImage());
424 }
425 }
426
427 private void updateWithUniqueTitle(String title, CTabItem currentItem) {
428 CTabItem[] items = tabFolder.getItems();
429 int increment = 1;
430 String temp = title;
431 for (int i = 0; i < items.length; i++) {
432 if (items[i] != currentItem) {
433 String name = items[i].getText();
434 if (name != null) {
435 if (name.equals(temp)) {
436 temp = title + " " + increment++; //$NON-NLS-1$
437 }
438 }
439
440 }
441 }
442 currentItem.setText(temp);
443 }
444
445 private ITerminalViewControl getCurrentTerminalViewControl() {
446 if (tabFolder != null && !tabFolder.isDisposed()) {
447 CTabItem item = tabFolder.getSelection();
448 if (item != null && !item.isDisposed()) {
449 Object data = item.getData(DATA_KEY_CONTROL);
450 if (data instanceof ITerminalViewControl)
451 return ((ITerminalViewControl) data);
452 }
453 }
454 return null;
455 }
456*/
457}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java
new file mode 100644
index 0000000..65a562b
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java
@@ -0,0 +1,139 @@
1/********************************************************************************
2 * Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved.
3 * This program and the accompanying materials are made available under the terms
4 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
5 * available at http://www.eclipse.org/legal/epl-v10.html
6 *
7 * Initial Contributors:
8 * The following IBM employees contributed to the Remote System Explorer
9 * component that contains this file: David McKnight, Kushal Munir,
10 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
11 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12 *
13 * Contributors:
14 * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
15 * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
16 * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
17 * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
18 * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
19 * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
20 * Kevin Doyle (IBM) - [198534] Shell Menu Enablement Issue's
21 * Radoslav Gerganov(ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist
22 * Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsViewPart
23 * Anna Dushistova (MontaVista) - Adapted from SystemCommandsViewPart
24 * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits
25 * Anna Dushistova (MontaVista) - [228577] [rseterminal] Clean up RSE Terminal impl
26 * Anna Dushistova (MontaVista) - [238257] Request a help text when no tab is open in "Remote Shell", "Remote Monitor" and "Terminals" views
27 * Anna Dushistova (MontaVista) - [235097] [rseterminal] Cannot activate RSE Terminals View with the keyboard
28 * Anna Dushistova (MontaVista) - [267609] [rseterminal] The first "Launch Terminal" command creates no terminal tab
29 *********************************************************************************/
30package org.yocto.sdk.remotetools.views;
31
32import org.yocto.sdk.remotetools.Messages;
33
34import org.eclipse.jface.action.IMenuManager;
35import org.eclipse.jface.viewers.ISelection;
36import org.eclipse.jface.viewers.ISelectionChangedListener;
37import org.eclipse.jface.viewers.SelectionChangedEvent;
38import org.eclipse.swt.SWT;
39import org.eclipse.swt.events.SelectionEvent;
40import org.eclipse.swt.events.SelectionListener;
41import org.eclipse.swt.widgets.Composite;
42import org.eclipse.swt.widgets.Label;
43import org.eclipse.ui.ISelectionListener;
44import org.eclipse.ui.ISelectionService;
45import org.eclipse.ui.IWorkbenchPart;
46import org.eclipse.ui.part.PageBook;
47import org.eclipse.ui.part.ViewPart;
48
49public class TerminalViewer extends ViewPart implements ISelectionListener,
50 SelectionListener, ISelectionChangedListener/*,
51 ISystemResourceChangeListener,*/{
52
53 private TerminalViewTab tabFolder;
54
55 private PageBook pagebook;
56
57 private Label noTabShownLabel;
58
59 public static String VIEW_ID = "org.eclipse.rse.terminals.ui.view.TerminalView"; //$NON-NLS-1$
60
61 public void createPartControl(Composite parent) {
62 pagebook = new PageBook(parent, SWT.NONE);
63
64 tabFolder = new TerminalViewTab(pagebook, this);
65 tabFolder.getFolder().addSelectionListener(this);
66
67 // Page 2: Nothing selected
68 noTabShownLabel = new Label(pagebook, SWT.TOP + SWT.LEFT + SWT.WRAP);
69 noTabShownLabel.setText(Messages.TerminalViewer_text);
70 showEmptyPage();
71
72
73 ISelectionService selectionService = getSite().getWorkbenchWindow()
74 .getSelectionService();
75 selectionService.addSelectionListener(this);
76/*
77 ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
78
79 registry.addSystemResourceChangeListener(this);
80*/
81 }
82
83 public void setFocus() {
84 tabFolder.setFocus();
85 }
86
87 public void selectionChanged(IWorkbenchPart part, ISelection selection) {
88 // TODO Auto-generated method stub
89
90 }
91
92 public void widgetDefaultSelected(SelectionEvent e) {
93 // TODO Auto-generated method stub
94
95 }
96
97 public void widgetSelected(SelectionEvent e) {
98 // TODO Auto-generated method stub
99
100 }
101
102 public void selectionChanged(SelectionChangedEvent event) {
103 // TODO Auto-generated method stub
104
105 }
106/*
107 public void systemResourceChanged(ISystemResourceChangeEvent event) {
108 if (event.getType() == ISystemResourceChangeEvents.EVENT_COMMAND_SHELL_REMOVED) {
109 Object source = event.getSource();
110 if (source instanceof TerminalElement) {
111 tabFolder.disposePageFor(((TerminalElement) source).getName());
112 }
113 }else if(event.getType() == ISystemResourceChangeEvents.EVENT_REFRESH){
114 if(tabFolder.getItemCount() == 0)
115 showEmptyPage();
116 else
117 showTabsPage();
118 }
119 }
120*/
121
122 public void menuAboutToShow(IMenuManager manager) {
123 // TODO Auto-generated method stub
124
125 }
126
127 public TerminalViewTab getTabFolder() {
128 return tabFolder;
129 }
130
131 private void showEmptyPage() {
132 pagebook.showPage(noTabShownLabel);
133 }
134
135 private void showTabsPage(){
136 pagebook.showPage(tabFolder);
137 }
138
139} \ No newline at end of file
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java
new file mode 100644
index 0000000..171f181
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java
@@ -0,0 +1,32 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3/**
4 * Stores a list of items from the output of a background thread and the error message if something went wrong
5 * @author ioana.grigoropol
6 *
7 */
8public class BSPAction {
9 private String[] items;
10 private String message;
11
12 BSPAction(String[] items, String message){
13 this.setItems(items);
14 this.setMessage(message);
15 }
16
17 public String[] getItems() {
18 return items;
19 }
20
21 public void setItems(String[] items) {
22 this.items = items;
23 }
24
25 public String getMessage() {
26 return message;
27 }
28
29 public void setMessage(String message) {
30 this.message = message;
31 }
32} \ No newline at end of file
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java
new file mode 100644
index 0000000..8d5864c
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java
@@ -0,0 +1,47 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3import org.eclipse.core.runtime.IProgressMonitor;
4import org.eclipse.jface.dialogs.ProgressMonitorDialog;
5import org.eclipse.jface.operation.IRunnableWithProgress;
6import org.eclipse.swt.widgets.Shell;
7
8/**
9 * Creates a progress monitor dialog that will run in the background a BSPThread and display a custom message
10 * @author ioana.grigoropol
11 *
12 */
13public class BSPProgressDialog extends ProgressMonitorDialog{
14 String displayMessage;
15 BSPThread getterThread;
16 Shell shell;
17
18
19 public BSPProgressDialog(Shell parent, BSPThread getterThread, String displayMessage) {
20 super(parent);
21 this.shell = parent;
22 this.getterThread = getterThread;
23 this.displayMessage = displayMessage;
24 }
25
26 public void run(boolean showProgressDialog){
27 try {
28 if (showProgressDialog)
29 super.run(true, true, new IRunnableWithProgress(){
30 @Override
31 public void run(IProgressMonitor monitor) {
32 monitor.beginTask(displayMessage + " ...", 100);
33 getterThread.run();
34 monitor.done();
35 }
36 });
37 else
38 getterThread.run();
39 } catch (Exception e) {
40 getterThread.getBspAction().setMessage(e.getMessage());
41 }
42 }
43
44 public BSPAction getBspAction() {
45 return getterThread.getBspAction();
46 }
47}
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java
new file mode 100644
index 0000000..f6b19ac
--- /dev/null
+++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java
@@ -0,0 +1,92 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3import java.io.BufferedReader;
4import java.io.InputStreamReader;
5import java.util.ArrayList;
6
7/**
8 * Receives a command to be run on a separate thread in the background
9 * It contains an BSPAction object that will collect the output & error
10 * Output lines are processed and collected into the items of BSPAction
11 * @author ioana.grigoropol
12 *
13 */
14public abstract class BSPThread implements Runnable {
15 public static final String SUCCESS = "success";
16 public static final String ERROR = "error";
17
18 private BSPAction bspAction;
19 private String command;
20
21 /**
22 * Receives the command to be run in the background
23 * @param command
24 */
25 public BSPThread(String command) {
26 this.command = command;
27 this.bspAction = new BSPAction(null, null);
28 }
29
30 @Override
31 public void run() {
32 ArrayList<String> values = new ArrayList<String>();
33
34 try {
35 ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", command});
36 // redirect error stream to collect both output & error
37 builder.redirectErrorStream(true);
38 Process process = builder.start();
39 BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
40 String line = null;
41 String errorMessage = "";
42 while ( (line = br.readLine()) != null) {
43 String[] result = processLine(line);
44 String status = result[0];
45 String value = result[1];
46 if (status.equals(ERROR) && !value.isEmpty()) {
47 errorMessage += value;
48 continue;
49 }
50 if (!value.isEmpty())
51 values.add(value);
52 }
53 int exitVal = process.waitFor();
54
55 // if the background process did not exit with 0 code, we should set the status accordingly
56 if (exitVal != 0) {
57 bspAction.setMessage(errorMessage);
58 bspAction.setItems(null);
59 }
60 } catch (Exception e) {
61 bspAction.setMessage(e.getMessage());
62 bspAction.setItems(null);
63 }
64 if (!values.isEmpty()) {
65 bspAction.setMessage(null);
66 bspAction.setItems(values.toArray(new String[values.size()]));
67 }
68 }
69
70 /**
71 * Each command ran in the background will have a different output and a different way of processing it
72 * @param line
73 * @return
74 */
75 protected abstract String[] processLine(String line);
76
77 public BSPAction getBspAction() {
78 return bspAction;
79 }
80
81 public void setBspAction(BSPAction bspAction) {
82 this.bspAction = bspAction;
83 }
84
85 public String getCommand() {
86 return command;
87 }
88
89 public void setCommand(String command) {
90 this.command = command;
91 }
92}
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 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3/**
4 * BSPThread that ignores the output of the process and returns an error if the process exits with non zero code
5 * @author ioana.grigoropol
6 *
7 */
8public class ErrorCollectorThread extends BSPThread{
9
10 public ErrorCollectorThread(String command) {
11 super(command);
12 }
13
14 @Override
15 protected String[] processLine(String line) {
16 return null;
17 }
18
19}
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 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3/**
4 * BSPThread that processes the output of "yocto-bsp list karch"
5 * @author ioana.grigoropol
6 *
7 */
8public class KernelArchGetter extends BSPThread{
9
10 public KernelArchGetter(String command) {
11 super(command);
12 }
13
14 @Override
15 protected String[] processLine(String line) {
16 if (line.contains(":"))
17 return new String[]{SUCCESS, ""};
18 line = line.replaceAll("^\\s+", "");
19 line = line.replaceAll("\\s+$", "");
20 return new String[]{SUCCESS, line};
21 }
22
23}
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 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3/**
4 * BSPThread that processes the output lines from running command "yocto-bsp list" for the selected kernel
5 * @author ioana.grigoropol
6 *
7 */
8public class KernelBranchesGetter extends BSPThread {
9
10 public KernelBranchesGetter(String command) {
11 super(command);
12 }
13
14 @Override
15 protected String[] processLine(String line) {
16 // [TODO : Ioana]: find a better way to identify error lines
17 if (!line.startsWith("["))
18 return new String[]{ERROR, line + "\n"};
19
20 String[] items = line.split(",");
21
22 String value = items[0];
23 value = value.replace("[\"", "");
24 value = value.replaceAll("\"$", "");
25 return new String[]{SUCCESS, value};
26 }
27
28}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.wizards.bsp;
12
13import java.io.BufferedReader;
14import java.io.File;
15import java.io.InputStream;
16import java.io.InputStreamReader;
17
18import org.eclipse.core.runtime.IStatus;
19import org.eclipse.core.runtime.Status;
20import org.eclipse.jface.wizard.WizardPage;
21import org.eclipse.swt.SWT;
22import org.eclipse.swt.events.FocusEvent;
23import org.eclipse.swt.events.FocusListener;
24import org.eclipse.swt.events.ModifyEvent;
25import org.eclipse.swt.events.ModifyListener;
26import org.eclipse.swt.events.SelectionAdapter;
27import org.eclipse.swt.events.SelectionEvent;
28import org.eclipse.swt.layout.GridData;
29import org.eclipse.swt.layout.GridLayout;
30import org.eclipse.swt.widgets.Button;
31import org.eclipse.swt.widgets.Combo;
32import org.eclipse.swt.widgets.Composite;
33import org.eclipse.swt.widgets.Control;
34import org.eclipse.swt.widgets.DirectoryDialog;
35import org.eclipse.swt.widgets.Label;
36import org.eclipse.swt.widgets.Text;
37import org.eclipse.swt.widgets.Widget;
38import org.yocto.sdk.remotetools.YoctoBspElement;
39
40/**
41 *
42 * Setting up the parameters for creating the new Yocto BSP
43 *
44 * @author jzhang
45 */
46public class MainPage extends WizardPage {
47 public static final String PAGE_NAME = "Main";
48 private static final String KARCH_CMD = "yocto-bsp list karch";
49 private static final String QARCH_CMD = "yocto-bsp list qemu property qemuarch";
50 private static final String BSP_SCRIPT = "yocto-bsp";
51 private static final String PROPERTIES_CMD_PREFIX = "yocto-bsp list ";
52 private static final String PROPERTIES_CMD_SURFIX = " properties -o ";
53 private static final String PROPERTIES_FILE = "/tmp/properties.json";
54
55 private Button btnMetadataLoc;
56 private Text textMetadataLoc;
57 private Label labelMetadata;
58
59 private Button btnBspOutputLoc;
60 private Text textBspOutputLoc;
61 private Label labelBspOutput;
62
63 private Button btnBuildLoc;
64 private Text textBuildLoc;
65 private Label labelBuildLoc;
66
67 private boolean buildDirChecked;
68 private BuildLocationListener buildLocationListener;
69
70 private Text textBspName;
71 private Label labelBspName;
72
73 private Combo comboKArch;
74 private Label labelKArch;
75
76 private Combo comboQArch;
77 private Label labelQArch;
78
79 private YoctoBspElement bspElem;
80
81 public MainPage(YoctoBspElement element) {
82 super(PAGE_NAME, "yocto-bsp Main page", null);
83
84 setMessage("Enter the required fields(with *) to create new Yocto Project BSP!");
85 this.bspElem = element;
86 }
87
88 @Override
89 public void createControl(Composite parent) {
90 setErrorMessage(null);
91 Composite composite = new Composite(parent, SWT.NONE);
92 GridLayout layout = new GridLayout(2, false);
93 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
94 composite.setLayout(layout);
95 gd.horizontalSpan = 2;
96 composite.setLayoutData(gd);
97
98 labelMetadata = new Label(composite, SWT.NONE);
99 labelMetadata.setText("Metadata location*: ");
100 Composite textContainer = new Composite(composite, SWT.NONE);
101 textContainer.setLayout(new GridLayout(2, false));
102 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
103 textMetadataLoc = (Text)addTextControl(textContainer, "");
104 textMetadataLoc.setEnabled(false);
105 textMetadataLoc.addModifyListener(new ModifyListener() {
106 @Override
107 public void modifyText(ModifyEvent e) {
108 controlChanged(e.widget);
109 }
110 });
111 setBtnMetadataLoc(addFileSelectButton(textContainer, textMetadataLoc));
112
113 labelBuildLoc = new Label(composite, SWT.NONE);
114 labelBuildLoc.setText("Build location: ");
115
116 textContainer = new Composite(composite, SWT.NONE);
117 textContainer.setLayout(new GridLayout(2, false));
118 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
119
120 textBuildLoc = (Text)addTextControl(textContainer, "");
121 buildLocationListener = new BuildLocationListener("");
122 textBuildLoc.addFocusListener(buildLocationListener);
123
124 setBtnBuilddirLoc(addFileSelectButton(textContainer, textBuildLoc));
125
126 labelBspName = new Label(composite, SWT.NONE);
127 labelBspName.setText("BSP Name*: ");
128
129 textContainer = new Composite(composite, SWT.NONE);
130 textContainer.setLayout(new GridLayout(2, false));
131 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
132
133 textBspName = (Text)addTextControl(textContainer, "");
134 textBspName.addModifyListener(new ModifyListener() {
135 @Override
136 public void modifyText(ModifyEvent e) {
137 controlChanged(e.widget);
138 }
139 });
140
141 labelBspOutput = new Label(composite, SWT.NONE);
142 labelBspOutput.setText("BSP output location: ");
143
144 textContainer = new Composite(composite, SWT.NONE);
145 textContainer.setLayout(new GridLayout(2, false));
146 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
147
148 textBspOutputLoc = (Text)addTextControl(textContainer, "");
149 textBspOutputLoc.addModifyListener(new ModifyListener() {
150 @Override
151 public void modifyText(ModifyEvent e) {
152 controlChanged(e.widget);
153 }
154 });
155 setBtnBspOutLoc(addFileSelectButton(textContainer, textBspOutputLoc));
156
157 labelKArch = new Label(composite, SWT.NONE);
158 labelKArch.setText("Kernel Architecture*: ");
159
160 textContainer = new Composite(composite, SWT.NONE);
161 textContainer.setLayout(new GridLayout(2, false));
162 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
163
164 comboKArch = new Combo(textContainer, SWT.READ_ONLY);
165 comboKArch.setLayout(new GridLayout(2, false));
166 comboKArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
167 comboKArch.setEnabled(false);
168 comboKArch.addModifyListener(new ModifyListener() {
169 @Override
170 public void modifyText(ModifyEvent e) {
171 controlChanged(e.widget);
172 }
173 });
174
175 labelQArch = new Label(composite, SWT.NONE);
176 labelQArch.setText("Qemu Architecture(* for karch as qemu): ");
177 labelQArch.setEnabled(false);
178
179 textContainer = new Composite(composite, SWT.NONE);
180 textContainer.setLayout(new GridLayout(2, false));
181 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
182
183 comboQArch = new Combo(textContainer, SWT.READ_ONLY);
184 comboQArch.setLayout(new GridLayout(2, false));
185 comboQArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
186 comboQArch.setEnabled(false);
187 comboQArch.addModifyListener(new ModifyListener() {
188 @Override
189 public void modifyText(ModifyEvent e) {
190 controlChanged(e.widget);
191 }
192 });
193
194 setControl(composite);
195 validatePage();
196 }
197
198 private Control addTextControl(final Composite parent, String value) {
199 final Text text;
200
201 text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER);
202 text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
203 text.setText(value);
204 text.setSize(10, 150);
205
206 return text;
207 }
208
209 private Button addFileSelectButton(final Composite parent, final Text text) {
210 Button button = new Button(parent, SWT.PUSH | SWT.LEAD);
211 button.setText("Browse...");
212 button.addSelectionListener(new SelectionAdapter() {
213 @Override
214 public void widgetSelected(SelectionEvent event) {
215 String dirName = new DirectoryDialog(parent.getShell()).open();
216 if (dirName != null) {
217 text.setText(dirName);
218 }
219 }
220 });
221 return button;
222 }
223
224 private void controlChanged(Widget widget) {
225 Status status = new Status(IStatus.OK, "not_used", 0, "", null);
226 setErrorMessage(null);
227 String metadataLoc = textMetadataLoc.getText();
228
229 if (widget == textMetadataLoc) {
230 resetKarchCombo();
231 if (metadataLoc.length() == 0) {
232 status = new Status(IStatus.ERROR, "not_used", 0, "Meta data location can't be empty!", null);
233 } else {
234 File meta_data = new File(metadataLoc);
235 if (!meta_data.exists() || !meta_data.isDirectory()) {
236 status = new Status(IStatus.ERROR, "not_used", 0,
237 "Invalid meta data location: Make sure it exists and is a directory!", null);
238 } else {
239 File bspScript = new File(metadataLoc + "/scripts/" + BSP_SCRIPT);
240 if (!bspScript.exists() || !bspScript.canExecute())
241 status = new Status(IStatus.ERROR, "not_used", 0,
242 "Make sure yocto-bsp exists under \"" + metadataLoc + "/scripts\" and is executable!", null);
243 else {
244 kernelArchesHandler();
245 }
246 }
247 }
248 } else if (widget == comboKArch) {
249 String selection = comboKArch.getText();
250 if (!bspElem.getKarch().contentEquals(selection))
251 bspElem = new YoctoBspElement();
252 if (selection.matches("qemu")) {
253 labelQArch.setEnabled(true);
254 comboQArch.setEnabled(true);
255 } else {
256 labelQArch.setEnabled(false);
257 comboQArch.setEnabled(false);
258 }
259 }
260
261 String buildDir = textBuildLoc.getText();
262 String outputDir = textBspOutputLoc.getText();
263 String bspName = textBspName.getText();
264
265 if (bspName.contains(" ")) {
266 status = new Status(IStatus.ERROR, "not_used", 0,
267 "BSP name contains space which is not allowed!", null);
268 }
269
270 if (!outputDir.isEmpty()){
271 if (outputDir.matches(buildDir)) {
272 status = new Status(IStatus.ERROR, "not_used", 0,
273 "You've set BSP output directory the same as build directory, please leave output directory empty for this scenario!", null);
274 } else {
275 File outputDirectory = new File(outputDir);
276 if (outputDirectory.exists()){
277 status = new Status(IStatus.ERROR, "not_used", 0,
278 "Your BSP output directory points to an exiting directory!", null);
279 }
280 }
281 } else if (buildDir.startsWith(metadataLoc) && !bspName.isEmpty()) {
282 String bspDirStr = metadataLoc + "/meta-" + bspName;
283 File bspDir = new File(bspDirStr);
284 if (bspDir.exists()) {
285 status = new Status(IStatus.ERROR, "not_used", 0,
286 "Your BSP with name: " + bspName + " already exist under directory: " + bspDirStr + ", please change your bsp name!", null);
287 }
288 }
289
290 if (status.getSeverity() == IStatus.ERROR)
291 setErrorMessage(status.getMessage());
292
293 getWizard().getContainer().updateButtons();
294 canFlipToNextPage();
295 }
296
297 private Status checkBuildDir() {
298
299 String metadataLoc = textMetadataLoc.getText();
300 String buildLoc = textBuildLoc.getText();
301
302 if (buildLoc.isEmpty()) {
303 buildLoc = metadataLoc + "/build";
304 return createBuildDir(buildLoc);
305 } else {
306 File buildLocDir = new File(buildLoc);
307 if (!buildLocDir.exists()) {
308 return createBuildDir(buildLoc);
309 } else if (buildLocDir.isDirectory()) {
310 return createBuildDir(buildLoc);
311 } else {
312 return new Status(IStatus.ERROR, "not_used", 0, "Invalid build location: Make sure the build location is a directory!", null);
313 }
314 }
315 }
316
317 private Status createBuildDir(String buildLoc) {
318 String metadataDir = textMetadataLoc.getText();
319
320 // if we do not change the directory to metadata location the script will be looked into the directory indicated by user.dir system property
321 // system.property usually points to the location from where eclipse was started
322 String createBuildDirCmd = "cd " + metadataDir + ";source " + metadataDir + "/oe-init-build-env " + buildLoc;
323
324 try {
325 ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", createBuildDirCmd});
326 Process proc = builder.start();
327 InputStream errorStream = proc.getErrorStream();
328 InputStreamReader isr = new InputStreamReader(errorStream);
329 BufferedReader br = new BufferedReader(isr);
330 String line = null;
331 String status = "";
332 while ( (line = br.readLine()) != null) {
333 status += line;
334 }
335
336 if (proc.waitFor() != 0)
337 return new Status(IStatus.ERROR, "not_used", 0, status, null);;
338 return new Status(IStatus.OK, "not_used", 0, "", null);
339 } catch (Exception e) {
340 return new Status(IStatus.ERROR, "not_used", 0, e.getMessage(), null);
341 }
342 }
343
344 public YoctoBspElement getBSPElement() {
345 return this.bspElem;
346 }
347
348
349 private void resetKarchCombo() {
350 comboKArch.deselectAll();
351 comboQArch.deselectAll();
352 comboKArch.setEnabled(false);
353 labelQArch.setEnabled(false);
354 comboQArch.setEnabled(false);
355 }
356
357 private void kernelArchesHandler() {
358 BSPAction kArchesAction = getKArches();
359 if (kArchesAction.getMessage() == null && kArchesAction.getItems().length != 0) {
360 comboKArch.setItems(kArchesAction.getItems());
361 comboKArch.setEnabled(true);
362 } else if (kArchesAction.getMessage() != null){
363 setErrorMessage(kArchesAction.getMessage());
364 return;
365 }
366 BSPAction qArchesAction = getQArches();
367 if (qArchesAction.getMessage() == null && qArchesAction.getItems().length != 0) {
368 comboQArch.setItems(qArchesAction.getItems());
369 } else if (qArchesAction.getMessage() != null)
370 setErrorMessage(qArchesAction.getMessage());
371
372 }
373
374 @Override
375 public boolean canFlipToNextPage(){
376 String err = getErrorMessage();
377 if (err != null)
378 return false;
379 else if (!validatePage())
380 return false;
381 return true;
382 }
383
384
385 public boolean validatePage() {
386 String metadataLoc = textMetadataLoc.getText();
387 String bspname = textBspName.getText();
388 String karch = comboKArch.getText();
389 String qarch = comboQArch.getText();
390 if (metadataLoc.isEmpty() ||
391 bspname.isEmpty() ||
392 karch.isEmpty()) {
393 return false;
394 } else if (karch.matches("qemu") && qarch.isEmpty()) {
395 return false;
396 }
397
398 bspElem.setBspName(bspname);
399 if (!textBspOutputLoc.getText().isEmpty())
400 bspElem.setBspOutLoc(textBspOutputLoc.getText());
401 else
402 bspElem.setBspOutLoc("");
403 if (!textBuildLoc.getText().isEmpty()) {
404 checkBuildDir();
405 bspElem.setBuildLoc(textBuildLoc.getText());
406 } else {
407 bspElem.setBuildLoc(metadataLoc + "/build");
408 if (!buildDirChecked) {
409 checkBuildDir();
410 buildDirChecked = true;
411 }
412 }
413 bspElem.setMetadataLoc(metadataLoc);
414 bspElem.setKarch(karch);
415 bspElem.setQarch(qarch);
416
417
418 if (!bspElem.getValidPropertiesFile()) {
419 boolean validPropertiesFile = true;
420 BSPAction action = createPropertiesFile();
421 if (action.getMessage() != null) {
422 validPropertiesFile = false;
423 setErrorMessage(action.getMessage());
424 }
425 bspElem.setValidPropertiesFile(validPropertiesFile);
426 }
427 return true;
428 }
429
430 private BSPAction createPropertiesFile() {
431 String createPropertiesCmd = bspElem.getMetadataLoc() + "/scripts/" +
432 PROPERTIES_CMD_PREFIX + bspElem.getKarch() +
433 PROPERTIES_CMD_SURFIX + PROPERTIES_FILE;
434 BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new ErrorCollectorThread(createPropertiesCmd), "Creating properties file ");
435 progressDialog.run(false);
436 return progressDialog.getBspAction();
437 }
438
439 private BSPAction getKArches() {
440 String getKArchCmd = textMetadataLoc.getText() + "/scripts/" + KARCH_CMD;
441 BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelArchGetter(getKArchCmd), "Loading kernel architectures ");
442 progressDialog.run(false);
443 return progressDialog.getBspAction();
444 }
445
446 private BSPAction getQArches() {
447 String getQArchCmd = textMetadataLoc.getText() + "/scripts/" + QARCH_CMD;
448 BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new QemuArchGetter(getQArchCmd), "Loading Qemu architectures ");
449 progressDialog.run(false);
450 return progressDialog.getBspAction();
451 }
452
453 public Button getBtnMetadataLoc() {
454 return btnMetadataLoc;
455 }
456
457 public void setBtnMetadataLoc(Button btnMetadataLoc) {
458 this.btnMetadataLoc = btnMetadataLoc;
459 }
460
461 public Button getBtnBspOutLoc() {
462 return btnBspOutputLoc;
463 }
464
465 public void setBtnBspOutLoc(Button btnBspOutLoc) {
466 this.btnBspOutputLoc = btnBspOutLoc;
467 }
468
469 public Button getBtnBuilddirLoc() {
470 return btnBuildLoc;
471 }
472
473 public void setBtnBuilddirLoc(Button btnBuilddirLoc) {
474 this.btnBuildLoc = btnBuilddirLoc;
475 }
476
477 class BuildLocationListener implements FocusListener{
478 String value;
479 boolean changed;
480
481 BuildLocationListener(String value){
482 this.value = value;
483 }
484 @Override
485 public void focusGained(FocusEvent e) {
486 value = ((Text)e.getSource()).getText();
487 }
488
489 @Override
490 public void focusLost(FocusEvent e) {
491 if(!((Text)e.getSource()).getText().equals(value)) {
492 checkBuildDir();
493 buildDirChecked = true;
494 }
495 }
496
497 }
498}
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 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3/**
4 * BSPThread that returns all the output lines of the process execution
5 * @author ioana.grigoropol
6 *
7 */
8public class OutputCollectorThread extends BSPThread{
9
10 public OutputCollectorThread(String command) {
11 super(command);
12 }
13
14 @Override
15 protected String[] processLine(String line) {
16 return new String[]{SUCCESS, line};
17 }
18
19}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.wizards.bsp;
12
13import java.util.ArrayList;
14import java.util.Collections;
15import java.util.Enumeration;
16import java.util.HashSet;
17import java.util.Hashtable;
18import java.util.Iterator;
19
20import org.eclipse.jface.dialogs.MessageDialog;
21import org.eclipse.jface.wizard.WizardPage;
22import org.eclipse.swt.SWT;
23import org.eclipse.swt.custom.ScrolledComposite;
24import org.eclipse.swt.events.SelectionEvent;
25import org.eclipse.swt.events.SelectionListener;
26import org.eclipse.swt.layout.GridData;
27import org.eclipse.swt.layout.GridLayout;
28import org.eclipse.swt.widgets.Button;
29import org.eclipse.swt.widgets.Combo;
30import org.eclipse.swt.widgets.Composite;
31import org.eclipse.swt.widgets.Control;
32import org.eclipse.swt.widgets.Group;
33import org.eclipse.swt.widgets.Label;
34import org.eclipse.swt.widgets.Text;
35import org.eclipse.swt.widgets.Widget;
36import org.yocto.sdk.remotetools.YoctoBspElement;
37import org.yocto.sdk.remotetools.YoctoBspPropertyElement;
38import org.yocto.sdk.remotetools.YoctoJSONHelper;
39/**
40 *
41 * Setting up the parameters for creating the new Yocto BSP
42 *
43 * @author jzhang
44 */
45public class PropertiesPage extends WizardPage {
46 private static final String PAGE_NAME = "Properties";
47 private static final String VALUES_CMD_PREFIX = "yocto-bsp list ";
48 private static final String VALUES_CMD_SURFIX = " property ";
49 private static final String KERNEL_CHOICE = "kernel_choice";
50 private static final String DEFAULT_KERNEL = "use_default_kernel";
51 private static final String SMP_NAME = "smp";
52 private static final String EXISTING_KBRANCH_NAME = "existing_kbranch";
53 private static final String NEED_NEW_KBRANCH_NAME = "need_new_kbranch";
54 private static final String NEW_KBRANCH_NAME = "new_kbranch";
55 private static final String QARCH_NAME = "qemuarch";
56
57 private static final String KERNEL_CHOICES = "choices";
58 private static final String KERNEL_BRANCHES = "branches";
59
60 private Hashtable<YoctoBspPropertyElement, Control> propertyControlMap;
61 HashSet<YoctoBspPropertyElement> properties;
62
63 private ScrolledComposite composite;
64 private Composite controlContainer = null;
65
66 private YoctoBspElement bspElem = null;
67 private boolean kArchChanged = false;
68
69 private Combo kernelCombo;
70 private Combo branchesCombo;
71
72 private Button newBranchButton;
73 private Button existingBranchButton;
74
75 private Button smpButton;
76
77 private Group kGroup = null;
78 private Group kbGroup = null;
79// private Group otherSettingsGroup = null;
80 private Group propertyGroup = null;
81
82 public PropertiesPage(YoctoBspElement element) {
83 super(PAGE_NAME, "yocto-bsp Properties page", null);
84 this.bspElem = element;
85 }
86
87 public void onEnterPage(YoctoBspElement element) {
88 if (!element.getValidPropertiesFile()) {
89 setErrorMessage("There's no valid properties file created, please choose \"Back\" to reselect kernel architecture!");
90 return;
91 }
92
93 if (this.bspElem == null || this.bspElem.getKarch().isEmpty() || !this.bspElem.getKarch().contentEquals(element.getKarch())) {
94 kArchChanged = true;
95 } else
96 kArchChanged = false;
97
98 this.bspElem = element;
99 try {
100 if (kArchChanged) {
101 updateKernelValues(KERNEL_CHOICES, KERNEL_CHOICE);
102
103 if (propertyGroup != null) {
104 for (Control cntrl : propertyGroup.getChildren()) {
105 cntrl.dispose();
106 }
107 }
108
109 properties = YoctoJSONHelper.getProperties();
110
111 if (!properties.isEmpty()) {
112
113 if (!element.getQarch().isEmpty()) {
114 YoctoBspPropertyElement qarch_elem = new YoctoBspPropertyElement();
115 qarch_elem.setName(QARCH_NAME);
116 qarch_elem.setValue(element.getQarch());
117 properties.add(qarch_elem);
118 }
119
120 propertyControlMap = new Hashtable<YoctoBspPropertyElement, Control>();
121
122 ArrayList<YoctoBspPropertyElement> propertiesList = new ArrayList<YoctoBspPropertyElement>(properties);
123 Collections.sort(propertiesList, Collections.reverseOrder());
124
125 Iterator<YoctoBspPropertyElement> it = propertiesList.iterator();
126 Composite comp = new Composite(propertyGroup, SWT.FILL);
127 GridLayout layout = new GridLayout(2, false);
128 GridData data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1);
129 comp.setLayoutData(data);
130 comp.setLayout(layout);
131
132 while (it.hasNext()) {
133 // Get property
134 YoctoBspPropertyElement propElem = it.next();
135 String type = propElem.getType();
136 String name = propElem.getName();
137 if (type.contentEquals("edit")) {
138 new Label (propertyGroup, SWT.FILL).setText(name + ":");
139
140 Composite textContainer = new Composite(propertyGroup, SWT.NONE);
141 textContainer.setLayout(new GridLayout(1, false));
142 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
143 Text text = new Text(textContainer, SWT.BORDER | SWT.SINGLE);
144 text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
145 propertyControlMap.put(propElem, text);
146
147 } else if (type.contentEquals("boolean")) {
148 String default_value = propElem.getDefaultValue();
149 Composite labelContainer = new Composite(propertyGroup, SWT.NONE);
150 labelContainer.setLayout(new GridLayout(2, false));
151 labelContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, false, 2, 1));
152 Button button = new Button(propertyGroup, SWT.CHECK);
153 button.setText(name);
154 if (default_value.equalsIgnoreCase("y")) {
155 button.setSelection(true);
156 } else
157 button.setSelection(false);
158 propertyControlMap.put(propElem, button);
159 } else if (type.contentEquals("choicelist")) {
160 new Label (propertyGroup, SWT.NONE).setText(name + ":");
161
162 Composite textContainer = new Composite(propertyGroup, SWT.NONE);
163 textContainer.setLayout(new GridLayout(1, false));
164 textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
165 Combo combo = new Combo(textContainer, SWT.READ_ONLY);
166 combo.setLayout(new GridLayout(2, false));
167 combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
168 combo.setItems(getBSPComboProperties(name));
169 propertyControlMap.put(propElem, combo);
170 }
171 }
172 }
173 composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
174 composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
175 controlContainer.pack();
176 this.composite.layout(true, true);
177 }
178 } catch (Exception e) {
179 e.printStackTrace();
180 }
181
182
183 }
184
185
186 @Override
187 public void createControl(Composite parent) {
188 this.composite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
189 GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
190 GridLayout layout = new GridLayout(2, true);
191 this.composite.setLayout(layout);
192
193 gd= new GridData(SWT.FILL, SWT.FILL, true, false);
194 gd.horizontalSpan = 2;
195 this.composite.setLayoutData(gd);
196
197 setControl(this.composite);
198
199 controlContainer = new Composite(composite, SWT.NONE);
200 controlContainer.setLayout(new GridLayout(1, true));
201 controlContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
202
203 kGroup = new Group(controlContainer, SWT.FILL);
204 kGroup.setLayout(new GridLayout(2, false));
205 GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
206 kGroup.setLayoutData(data);
207 kGroup.setText("Kernel Settings:");
208
209 new Label (kGroup, SWT.NONE).setText("Kernel:");
210 Composite textContainer = new Composite(kGroup, SWT.NONE);
211 textContainer.setLayout(new GridLayout(1, false));
212 textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
213
214 kernelCombo = new Combo(textContainer, SWT.READ_ONLY);
215 kernelCombo.setLayout(new GridLayout(2, false));
216 kernelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
217
218 kernelCombo.addSelectionListener(new SelectionListener() {
219
220 @Override
221 public void widgetSelected(SelectionEvent e) {
222 controlChanged(e.widget);
223 }
224
225 @Override
226 public void widgetDefaultSelected(SelectionEvent e) {
227 }
228 });
229
230 kbGroup = new Group(kGroup, SWT.FILL);
231 kbGroup.setLayout(new GridLayout(2, true));
232 data = new GridData(SWT.FILL, SWT.FILL, true, false);
233 data.horizontalSpan = 2;
234 kbGroup.setLayoutData(data);
235 kbGroup.setText("Branch Settings:");
236
237 textContainer = new Composite(kbGroup, SWT.NONE);
238 textContainer.setLayout(new GridLayout(2, false));
239 textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
240
241 new Label(textContainer, SWT.NONE).setText("Kernel branch:");
242
243 branchesCombo = new Combo(textContainer, SWT.READ_ONLY);
244 branchesCombo.setLayout(new GridLayout(1, false));
245 branchesCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
246 branchesCombo.addSelectionListener(new SelectionListener() {
247
248 @Override
249 public void widgetSelected(SelectionEvent e) {
250 controlChanged(e.widget);
251 }
252
253 @Override
254 public void widgetDefaultSelected(SelectionEvent e) {
255 }
256 });
257 branchesCombo.setSize(200, 200);
258
259 newBranchButton = new Button(kbGroup, SWT.RADIO);
260 newBranchButton.setText("Create a new branch from an existing one");
261 newBranchButton.setSelection(true);
262 newBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
263 SelectionListener listener = new SelectionListener() {
264 @Override
265 public void widgetDefaultSelected(SelectionEvent e) {}
266
267 @Override
268 public void widgetSelected(SelectionEvent e) {
269 controlChanged(e.widget);
270 }
271 };
272
273 newBranchButton.addSelectionListener(listener);
274
275 existingBranchButton = new Button(kbGroup, SWT.RADIO);
276 existingBranchButton.setText("Use existing branch");
277 existingBranchButton.setSelection(false);
278 existingBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
279 existingBranchButton.addSelectionListener(listener);
280
281// otherSettingsGroup = new Group(controlContainer, SWT.FILL);
282// otherSettingsGroup.setLayout(new GridLayout(2, true));
283// data = new GridData(SWT.FILL, SWT.FILL, true, false);
284// data.horizontalSpan = 2;
285// otherSettingsGroup.setLayoutData(data);
286// otherSettingsGroup.setText("Other Settings:");
287
288 smpButton = new Button(kGroup, SWT.CHECK);
289 smpButton.setText("Enable SMP support");
290 smpButton.setSelection(true);
291
292 propertyGroup = new Group(controlContainer, SWT.NONE);
293 propertyGroup.setLayout(new GridLayout(2, false));
294 data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1);
295 propertyGroup.setLayoutData(data);
296 propertyGroup.setText("BSP specific settings:");
297
298 this.composite.layout(true, true);
299
300 composite.setContent(controlContainer);
301 composite.setExpandHorizontal(true);
302 composite.setExpandVertical(true);
303 composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
304 controlContainer.pack();
305 composite.pack();
306 }
307
308 @Override
309 public boolean canFlipToNextPage() {
310 return false;
311 }
312
313 public HashSet<YoctoBspPropertyElement> getProperties() {
314 String kcSelection = kernelCombo.getText();
315 String kbSelection = branchesCombo.getText();
316 YoctoBspPropertyElement kcElement = new YoctoBspPropertyElement();
317 kcElement.setName(KERNEL_CHOICE);
318 kcElement.setValue(kcSelection);
319 properties.add(kcElement);
320 YoctoBspPropertyElement defaultElement = new YoctoBspPropertyElement();
321 defaultElement.setName(DEFAULT_KERNEL);
322 defaultElement.setValue("n");
323 properties.add(defaultElement);
324
325 YoctoBspPropertyElement smpElement = new YoctoBspPropertyElement();
326 smpElement.setName(SMP_NAME);
327 if (smpButton.getSelection())
328 smpElement.setValue("y");
329 else
330 smpElement.setValue("n");
331 properties.add(smpElement);
332
333 YoctoBspPropertyElement newKbElement = new YoctoBspPropertyElement();
334 YoctoBspPropertyElement kbElement = new YoctoBspPropertyElement();
335
336 newKbElement.setName(NEED_NEW_KBRANCH_NAME);
337 if (newBranchButton.getSelection()) {
338 newKbElement.setValue("y");
339 properties.add(newKbElement);
340 kbElement.setName(NEW_KBRANCH_NAME);
341 kbElement.setValue(kbSelection);
342 properties.add(kbElement);
343 } else {
344 newKbElement.setValue("n");
345 properties.add(newKbElement);
346 kbElement.setName(EXISTING_KBRANCH_NAME);
347 kbElement.setValue(kbSelection);
348 properties.add(kbElement);
349 }
350
351 return properties;
352 }
353
354 public boolean validatePage() {
355 if (kernelCombo == null)
356 return false;
357
358 if ((kernelCombo != null) && (branchesCombo != null)) {
359 String kcSelection = kernelCombo.getText();
360 String kbSelection = branchesCombo.getText();
361 if ((kcSelection == null) || (kbSelection == null) || (kcSelection.isEmpty()) || (kbSelection.isEmpty())) {
362 setErrorMessage("Please choose a kernel and a specific branch!");
363 return false;
364 }
365 }
366 if ((propertyControlMap != null)) {
367 if (!propertyControlMap.isEmpty()) {
368 Enumeration<YoctoBspPropertyElement> keys = propertyControlMap.keys();
369 while (keys.hasMoreElements()) {
370 YoctoBspPropertyElement key = keys.nextElement();
371 Control control = propertyControlMap.get(key);
372 String type = key.getType();
373
374 if (type.contentEquals("edit")) {
375 String text_value = ((Text)control).getText();
376 if (text_value == null) {
377 setErrorMessage("Field "+ key.getName() +" is not set. All of the field on this screen must be set!");
378 return false;
379 } else {
380 key.setValue(text_value);
381 }
382 } else if (type.contentEquals("choicelist")) {
383 String choice_value = ((Combo)control).getText();
384 if (choice_value == null) {
385 setErrorMessage("Field "+ key.getName() +" is not set. All of the field on this screen must be set!");
386 return false;
387 } else {
388 key.setValue(choice_value);
389 }
390 } else {
391 boolean button_select = ((Button)control).getSelection();
392 if (button_select)
393 key.setValue("y");
394 else
395 key.setValue("n");
396 }
397 updateProperties(key);
398 }
399 }
400 }
401 return true;
402 }
403
404 private void updateProperties(YoctoBspPropertyElement element) {
405 Iterator<YoctoBspPropertyElement> it = properties.iterator();
406
407 while (it.hasNext()) {
408 YoctoBspPropertyElement propElem = it.next();
409 if (propElem.getName().contentEquals(element.getName())) {
410 properties.remove(propElem);
411 properties.add(element);
412 break;
413 } else
414 continue;
415 }
416 }
417 private void controlChanged(Widget widget) {
418 setErrorMessage(null);
419
420 String kernel_choice = kernelCombo.getText();
421 if ((kernel_choice == null) || (kernel_choice.isEmpty())) {
422 setErrorMessage("Please choose kernel !");
423 return;
424 }
425 if (widget == kernelCombo) {
426 updateKernelValues(KERNEL_BRANCHES, "\\\"" + kernel_choice + "\\\"." + NEW_KBRANCH_NAME);
427 } else if (widget == branchesCombo) {
428 setErrorMessage(null);
429 branchesCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
430 } else if (widget == newBranchButton || widget == existingBranchButton) {
431 if (newBranchButton.getSelection()) {
432 updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + NEW_KBRANCH_NAME);
433 } else {
434 updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + EXISTING_KBRANCH_NAME);
435 }
436 branchesCombo.deselectAll();
437 }
438 canFlipToNextPage();
439 getWizard().getContainer().updateButtons();
440 this.composite.layout(true, true);
441 composite.pack();
442 }
443
444 private void updateKernelValues(final String value, String property) {
445 String build_dir = "";
446 if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty())
447 build_dir = bspElem.getMetadataLoc()+"/build";
448 else
449 build_dir = bspElem.getBuildLoc();
450
451 String metadataLoc = bspElem.getMetadataLoc();
452 String valuesCmd = "source " + metadataLoc + "/oe-init-build-env;" + metadataLoc + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property;
453 BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelBranchesGetter(valuesCmd), "Loading Kernel " + value);
454 if (value.equals(KERNEL_CHOICES))
455 progressDialog.run(false);
456 else if (value.equals(KERNEL_BRANCHES))
457 progressDialog.run(true);
458
459 BSPAction action = progressDialog.getBspAction();
460 if (action.getItems() != null) {
461 if (value.equals(KERNEL_CHOICES)) {
462 kernelCombo.setItems(action.getItems());
463 kernelCombo.pack();
464 kernelCombo.deselectAll();
465 branchesCombo.setEnabled(false);
466 branchesCombo.deselectAll();
467 } else if (value.equals(KERNEL_BRANCHES)) {
468 branchesCombo.setItems(action.getItems());
469 branchesCombo.pack();
470 branchesCombo.setEnabled(true);
471 }
472 composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
473 } else if (action.getMessage() != null)
474 MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage());
475 composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
476 }
477
478 private String[] getBSPComboProperties(String property) {
479 String build_dir = "";
480 if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty())
481 build_dir = bspElem.getMetadataLoc()+"/build";
482 else
483 build_dir = bspElem.getBuildLoc();
484
485 String valuesCmd = "export BUILDDIR=" + build_dir + ";" + bspElem.getMetadataLoc() + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property;
486 BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelBranchesGetter(valuesCmd), "Loading property " + property + "values");
487 progressDialog.run(false);
488 BSPAction action = progressDialog.getBspAction();
489
490 if (action.getItems() != null) {
491 return action.getItems();
492 } else if (action.getMessage() != null) {
493 MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage());
494 return new String[]{};
495 }
496 return new String[]{};
497 }
498}
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 @@
1package org.yocto.sdk.remotetools.wizards.bsp;
2
3/**
4 * BSPThread that processes the output of running "yocto-bsp list qemu property qemuarch"
5 * @author ioana.grigoropol
6 *
7 */
8public class QemuArchGetter extends BSPThread {
9
10 public QemuArchGetter(String command) {
11 super(command);
12 }
13
14 @Override
15 protected String[] processLine(String line) {
16 if (!line.startsWith("["))
17 return new String[]{ERROR, line + "\n"};
18
19 String[] values = line.split(",");
20
21 String value = values[0];
22 value = value.replace("[\"", "");
23 value = value.replaceAll("\"$", "");
24 return new String[]{SUCCESS, value};
25 }
26
27}
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 @@
1/*******************************************************************************
2 * Copyright (c) 2010 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel - initial API and implementation
10 *******************************************************************************/
11package org.yocto.sdk.remotetools.wizards.bsp;
12
13import java.util.HashSet;
14
15import org.eclipse.jface.dialogs.MessageDialog;
16import org.eclipse.jface.wizard.IWizardPage;
17import org.eclipse.jface.wizard.Wizard;
18import org.yocto.sdk.remotetools.YoctoBspElement;
19import org.yocto.sdk.remotetools.YoctoBspPropertyElement;
20import org.yocto.sdk.remotetools.YoctoJSONHelper;
21
22/**
23 * A wizard for creating Yocto BSP.
24 *
25 * @author jzhang
26 *
27 */
28public class YoctoBSPWizard extends Wizard {
29 private static final String CREATE_CMD = "/scripts/yocto-bsp create ";
30 private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json";
31
32 private MainPage mainPage;
33 private PropertiesPage propertiesPage;
34 private final YoctoBspElement bspElem;
35
36 public YoctoBSPWizard() {
37 super();
38 bspElem = new YoctoBspElement();
39 }
40
41 @Override
42 public IWizardPage getNextPage(IWizardPage page) {
43 propertiesPage.onEnterPage(mainPage.getBSPElement());
44 return propertiesPage;
45 }
46
47 @Override
48 public void addPages() {
49 mainPage = new MainPage(bspElem);
50 addPage(mainPage);
51 propertiesPage = new PropertiesPage(bspElem);
52 addPage(propertiesPage);
53 }
54
55 private BSPAction createBSP(){
56 YoctoBspElement element = mainPage.getBSPElement();
57 String createBspCmd = element.getMetadataLoc() + CREATE_CMD +
58 element.getBspName() + " " + element.getKarch();
59
60 if (!element.getBspOutLoc().isEmpty())
61 createBspCmd = createBspCmd + " -o " + element.getBspOutLoc();
62 else
63 createBspCmd = createBspCmd + " -o " + element.getMetadataLoc() + "/meta-" + element.getBspName();
64 createBspCmd = createBspCmd + " -i " + PROPERTY_VALUE_FILE;
65
66 BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new OutputCollectorThread(createBspCmd), "Creating BSP ");
67 progressDialog.run(true);
68 return progressDialog.getBspAction();
69 }
70
71 @Override
72 public boolean performFinish() {
73 if (propertiesPage.validatePage()) {
74 HashSet<YoctoBspPropertyElement> properties = propertiesPage.getProperties();
75 YoctoJSONHelper.createBspJSONFile(properties);
76
77 BSPAction createBSPAction = createBSP();
78 if (createBSPAction.getMessage() != null && !createBSPAction.getMessage().isEmpty()) {
79 MessageDialog.openError(getShell(),"Yocto-BSP", createBSPAction.getMessage());
80 return false;
81 } else {
82 String message = "";
83 for (String item : createBSPAction.getItems())
84 message += item + "\n";
85 MessageDialog.openInformation(getShell(), "Yocto-BSP", message);
86 return true;
87 }
88 } else {
89 MessageDialog.openError(getShell(), "Yocto-BSP", "Property settings contains error!");
90 return false;
91 }
92
93 }
94
95 @Override
96 public boolean canFinish() {
97 return (mainPage.validatePage() && propertiesPage.validatePage());
98 }
99}
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 @@
1#!/bin/sh
2
3help ()
4{
5 echo "Build the Yocto Eclipse plugins"
6 echo "Usage: [GIT_URL=url_of_repo] [DOC_GIT=url_of_repo] $0 [OPTIONS] BRANCH_NAME RELEASE_NAME [TAG_NAME]";
7 echo ""
8 echo "Options:"
9 echo "-h - display this help and exit"
10 echo "-l - use local git repository"
11 echo "BRANCH_NAME - git branch name to build upon"
12 echo "RELEAES_NAME - release name in the final output name"
13 echo "TAG_NAME - git tag name to build upon. defaults to HEAD if not set"
14 echo "GIT_URL - use this repo for the plugins. Defaults to git://git.pokylinux.org/eclipse-poky-juno.git if not set"
15 echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set"
16 echo ""
17 echo "Example: $0 master r0 M1.1_rc1";
18 exit 1;
19}
20
21fail ()
22{
23 local retval=$1
24 shift $1
25 echo "[Fail $retval]: $*"
26 echo "BUILD_TOP=${BUILD_TOP}"
27 cd ${TOP}
28 exit ${retval}
29}
30
31find_eclipse_base ()
32{
33 [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=${ECLIPSE_HOME}
34}
35
36find_launcher ()
37{
38 local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`"
39 for launcher in $list; do
40 [ -f $launcher ] && LAUNCHER=${launcher}
41 done
42}
43
44find_buildfile ()
45{
46 local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.pde.build_*/scripts/build.xml`"
47 for buildfile in $list; do
48 [ -f $buildfile ] && BUILDFILE=${buildfile}
49 done
50}
51
52check_env ()
53{
54 find_eclipse_base
55 find_launcher
56 find_buildfile
57
58 local err=0
59 [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" -o "x${BUILDFILE}" = "x" ] && err=1
60 if [ $err -eq 0 ]; then
61 [ ! -d ${ECLIPSE_BASE} ] && err=1
62 [ ! -f ${LAUNCHER} ] && err=1
63 [ ! -f ${BUILDFILE} ] && err=1
64 fi
65
66 if [ $err -ne 0 ]; then
67 echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!"
68 exit 1
69 fi
70}
71
72USE_LOCAL_GIT_REPO=0
73while getopts ":lh" opt; do
74 case $opt in
75 h)
76 help
77 ;;
78 l)
79 USE_LOCAL_GIT_REPO=1
80 ;;
81 esac
82done
83shift $(($OPTIND - 1))
84
85
86if [ $# -ne 2 ] && [ $# -ne 3 ]; then
87 help
88fi
89
90#milestone
91BRANCH=$1
92RELEASE=$2
93
94if [ "x" = "x${3}" ]
95then
96 TAG="HEAD"
97else
98 TAG=$3
99fi
100
101TOP=`pwd`
102
103check_env
104
105#create tmp dir for build
106DATE=`date +%Y%m%d%H%M`
107BUILD_TOP=`echo ${BRANCH} | sed 's%/%-%'`
108BUILD_TOP=${TOP}/${BUILD_TOP}_build_${DATE}
109rm -rf ${BUILD_TOP}
110mkdir ${BUILD_TOP} || fail $? "Create temporary build directory ${BUILD_TOP}"
111BUILD_SRC=${BUILD_TOP}/src
112BUILD_DIR=${BUILD_TOP}/build
113mkdir ${BUILD_DIR} || fail $? "Create temporary build directory ${BUILD_DIR}"
114
115
116#git clone
117GIT_URL=${GIT_URL:-git://git.pokylinux.org/eclipse-poky-juno.git}
118if [ $USE_LOCAL_GIT_REPO -eq 1 ]; then
119 SCRIPT_DIR=`dirname $0`
120 GIT_DIR=`readlink -f ${SCRIPT_DIR}/..`
121 GIT_URL="file://${GIT_DIR}"
122fi
123
124GIT_DIR=${BUILD_SRC}
125#mkdir ${GIT_DIR}
126#cp -r features/ ${GIT_DIR}
127#cp -r plugins/ ${GIT_DIR}
128#cp -r tcf/ ${GIT_DIR}
129git clone ${GIT_URL} ${GIT_DIR} || fail $? "git clone ${GIT_URL}"
130cd ${GIT_DIR}
131git checkout origin/${BRANCH} || fail $? "git checkout origin/${BRANCH}"
132git checkout ${TAG} || fail $? "git checkout ${TAG}"
133cd ${TOP}
134
135# generate and add documentation
136if [ "${TAG}" = "HEAD" ]; then
137 ${GIT_DIR}/scripts/generate-doc.sh ${BRANCH} ${GIT_DIR}
138else
139 ${GIT_DIR}/scripts/generate-doc.sh -t ${TAG} ${GIT_DIR}
140fi
141
142#build
143java -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"
144java -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"
145java -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"
146
147if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ] &&
148 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ] &&
149 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ]; then
150 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ./org.yocto.bc-${RELEASE}-${DATE}.zip
151 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ./org.yocto.doc-${RELEASE}-${DATE}.zip
152 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ./org.yocto.sdk-${RELEASE}-${DATE}.zip
153 rm -rf ${BUILD_DIR}
154else
155 fail 1 "Not finding normal build output"
156fi
157
158#build archive for update site
159java -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"
160java -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"
161java -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"
162
163#clean up
164if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ] &&
165 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}-group.group.group.zip ] &&
166 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}-group.group.group.zip ]; then
167 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ./org.yocto.sdk-${RELEASE}-${DATE}-archive.zip
168 rm -rf ${BUILD_TOP}
169else
170 fail 1 "Not finding archive build output"
171fi
172
173exit 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 @@
1#!/bin/sh
2
3help ()
4{
5 echo "Find the installed plugin/feature version of a eclipse build environment"
6 echo "Usage: $0 [pluginId1/featureId1[,pluginId2/featureId2]...]";
7 echo ""
8 echo "Options:"
9 echo "pluginId/featureId - comma seperated plugin or feature ids, empty for all"
10 echo ""
11 echo "Example: $0 org.eclipse.tcf.feature.group";
12 exit 1;
13}
14
15fail ()
16{
17 local retval=$1
18 shift $1
19 echo "[Fail $retval]: $*"
20 echo "BUILD_TOP=${BUILD_TOP}"
21 cd ${TOP}
22 exit ${retval}
23}
24
25find_eclipse_base ()
26{
27 [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=`readlink -f ${ECLIPSE_HOME}`
28}
29
30find_launcher ()
31{
32 local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`"
33 for launcher in $list; do
34 [ -f $launcher ] && LAUNCHER=${launcher}
35 done
36}
37
38check_env ()
39{
40 find_eclipse_base
41 find_launcher
42
43 local err=0
44 [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" ] && err=1
45 if [ $err -eq 0 ]; then
46 [ ! -d ${ECLIPSE_BASE} ] && err=1
47 [ ! -f ${LAUNCHER} ] && err=1
48 fi
49
50 if [ $err -ne 0 ]; then
51 echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!"
52 exit 1
53 fi
54}
55
56if [ $# -ne 0 ] && [ $# -ne 1 ]; then
57 help
58fi
59
60check_env
61
62java -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 @@
1#!/bin/sh
2
3help()
4{
5 echo "Generate and add eclipse help from yocto's documentation"
6 echo "Usage: [DOC_GIT=url_of_repo] $0 BRANCH_NAME PLUGIN_FOLDER"
7 echo " [DOC_GIT=url_of_repo] $0 -t TAG_NAME PLUGIN_FOLDER"
8 echo ""
9 echo "Options:"
10 echo "-h - display this help and exit"
11 echo "-t TAG_NAME - tag to build the documentation upon"
12 echo "BRANCH_NAME - branch to build the documentation upon"
13 echo "PLUGIN_FOLDER - root folder of the eclipse-poky project"
14 echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set"
15 exit 1
16}
17
18fail ()
19{
20 local retval=$1
21 shift $1
22 echo "[Fail $retval]: $*"
23 echo "BUILD_TOP=${BUILD_TOP}"
24 cd ${TOP}
25 exit ${retval}
26}
27
28CHECKOUT_TAG=0
29while getopts ":ht" opt; do
30 case $opt in
31 h)
32 help
33 ;;
34 t)
35 CHECKOUT_TAG=1
36 ;;
37 esac
38done
39shift $(($OPTIND - 1))
40
41if [ $# -ne 2 ]; then
42 help
43fi
44
45if [ $CHECKOUT_TAG -eq 0 ]; then
46 REFERENCE=origin/$1
47else
48 REFERENCE=$1
49fi
50PLUGIN_FOLDER=`readlink -f $2`
51
52TOP=`pwd`
53
54DOC_DIR=${PLUGIN_FOLDER}/docs
55rm -rf ${DOC_DIR}
56DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user
57DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/
58
59# git clone
60DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git}
61
62git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}"
63cd ${DOC_DIR}
64git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}"
65COMMIT_ID=`git rev-parse HEAD`
66
67# build and copy
68DOCS="yocto-project-qs adt-manual kernel-dev \
69 bsp-guide ref-manual dev-manual profile-manual"
70
71cd documentation
72ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?`
73if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then
74 echo "WARNING:"
75 echo "This version does not support generating eclipse help"
76 echo "Documentation will not be available in eclipse"
77 exit 1
78fi
79
80for DOC in ${DOCS}; do
81 make DOC=${DOC} eclipse
82 cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR}
83 cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR}
84done
85
86sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html
87
88cd ${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 @@
1Note: PART I and PART II can be skipped if you have already done that.
2
3Part I: Base environment setup
4I-1. install JDK
5 sudo zypper install java-1_6_0-openjdk
6
7I-2. install X11 related packages for eclipse running
8 sudo zypper install xorg-x11-xauth
9
10I-3. using git through a SOCKS proxy(If you're behind some firewall)
11I-3.1 Create a wrapper script for netcat
12 cat > ~/bin/proxy-wrapper
13
14 #!/bin/sh
15 PROXY=proxy-jf.intel.com
16 PORT=1080
17 METHOD="-X 5 -x ${PROXY}:${PORT}"
18
19 nc $METHOD $*
20
21 Then Ctlr+D to save the file and "chmod +x ~/bin/proxy-wrapper"
22
23 Note: if netcat is not installed, please "sudo zypper install netcat-openbsd".
24
25I-3.2 set git proxy environment
26 add the following line to your ~/.bashrc and "source ~/.bashrc"
27
28 export GIT_PROXY_COMMAND="/somepath/bin/proxy-wrapper"
29
30 Please be noted that it should be absolute path, since "~" is not supported.
31
32I-4. using svn through a http_proxy(If you're behind some firewall)
33 Modify the ~/.subversion/servers
34
35 http-proxy-host = proxy.jf.intel.com
36 http-proxy-port = 911
37
38I-5. Get the scripts from eclipse-poky git
39 git clone git://git.pokylinux.org/eclipse-poky.git
40
41 The scripts used for auto builder is under the directory of "scripts".
42
43
44Part II: Setup the build environment
45II-1. Modify the scripts/setup.sh to set appropriate proxy settings.
46 Set PROXY to a http proxy URL and PORT to the port number. Comment out
47 these 2 variables if proxy is not required.
48
49II-2. Run scripts/setup.sh to set up the build environment.
50 This will install the eclipse and relevant plugins required to build
51 Yocto eclipse plug-in.
52
53Part III: Build & Install Yocto Eclipse plug-in
54
55To build the Yocto Eclipse plug-in, simply run
56"ECLIPSE_HOME=<eclipse path> scripts/build.sh <branch name> <release name>".
57
58The <eclipse install path> is the absolute path where you installed the
59eclipse in step II-2.
60
61The <branch name> is the git branch name you build based on.
62
63If successful, 2 files org.yocto.sdk-<release name>-<date>.zip and
64org.yocto.sdk.-<release name>-<date>-archive.zip will be genereated under the
65directory where you invoked the "build.sh" script.
66
67The file with the "-archive" in its name is the archive zip used for eclipse
68update manager. User should use eclipse update manager to install it.
69
70The file without the "-archive" in its name is the zip containing only the
71plugins/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 @@
1#!/bin/sh
2
3#setup eclipse building environment for Indigo.
4#comment out the following line if you want to using your own http proxy setting for eclipse update site
5#PROXY=http://proxy.jf.intel.com:911
6
7err_exit()
8{
9 echo "[FAILED $1]$2"
10 exit $1
11}
12
13curdir=`pwd`
14
15uname_s=`uname -s`
16uname_m=`uname -m`
17case ${uname_s}${uname_m} in
18 Linuxppc*) ep_arch=linux-gtk-ppc
19 cdt_arch=linux.ppc
20 ;;
21 Linuxx86_64*) ep_arch=linux-gtk-x86_64
22 cdt_arch=linux.x86_64
23 ;;
24 Linuxi*86) ep_arch=linux-gtk
25 cdt_arch=linux.x86
26 ;;
27 *)
28 echo "Unknown ${uname_s}${uname_m}"
29 exit 1
30 ;;
31esac
32
33#parsing proxy URLS
34url=${PROXY}
35if [ "x$url" != "x" ]; then
36 proto=`echo $url | grep :// | sed -e 's,^\(.*://\).*,\1,g'`
37 url=`echo $url | sed s,$proto,,g`
38 userpass=`echo $url | grep @ | cut -d@ -f1`
39 user=`echo $userpass | cut -d: -f1`
40 pass=`echo $userpass | grep : | cut -d: -f2`
41 url=`echo $url | sed s,$userpass@,,g`
42 host=`echo $url | cut -d: -f1`
43 port=`echo $url | cut -d: -f2 | sed -e 's,[^0-9],,g'`
44 [ "x$host" = "x" ] && err_exit 1 "Undefined proxy host"
45 PROXY_PARAM="-Dhttp.proxySet=true -Dhttp.proxyHost=$host"
46 [ "x$port" != "x" ] && PROXY_PARAM="${PROXY_PARAM} -Dhttp.proxyPort=$port"
47fi
48
49
50# prepare the base Eclipse installation in folder "eclipse"
51ep_rel="R-"
52ep_ver="4.2.2"
53ep_date="-201302041200"
54P2_disabled=false
55P2_no_dropins=false
56if [ ! -f eclipse/plugins/org.eclipse.swt_3.100.0.v4233d.jar ]; then
57 curdir2=`pwd`
58 if [ ! -d eclipse -o -h eclipse ]; then
59 if [ -d eclipse-${ep_ver}-${ep_arch} ]; then
60 rm -rf eclipse-${ep_ver}-${ep_arch}
61 fi
62 mkdir eclipse-${ep_ver}-${ep_arch}
63 cd eclipse-${ep_ver}-${ep_arch}
64 else
65 rm -rf eclipse
66 fi
67 # Eclipse SDK: Need the SDK so we can link into docs
68 echo "Getting Eclipse SDK..."
69
70 wget "http://download.eclipse.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz"
71 # The eclipse site has moments where it is overloaded. Maintaining our own mirror solves this.
72 #wget "http://downloads.yoctoproject.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz"
73 tar xfz eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz || err_exit $? "extracting Eclipse SDK failed"
74 rm eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz
75 cd "${curdir2}"
76 if [ ! -d eclipse -o -h eclipse ]; then
77 if [ -e eclipse ]; then
78 rm eclipse
79 fi
80 ln -s eclipse-${ep_ver}-${ep_arch}/eclipse eclipse
81 fi
82fi
83if [ ! -f eclipse/startup.jar ]; then
84 curdir2=`pwd`
85 cd eclipse/plugins
86 if [ -h ../startup.jar ]; then
87 rm ../startup.jar
88 fi
89 LAUNCHER="`ls org.eclipse.equinox.launcher_*.jar | sort | tail -1`"
90 if [ "x${LAUNCHER}" != "x" ]; then
91 echo "eclipse LAUNCHER=${LAUNCHER}"
92 ln -s plugins/${LAUNCHER} ../startup.jar
93 else
94 echo "Eclipse: NO startup.jar LAUNCHER FOUND!"
95 fi
96 cd ${curdir2}
97fi
98
99LAUNCHER="eclipse/startup.jar"
100
101get_version()
102{
103#$1: repository_url
104#$2: featureId
105#$3: 'all' or 'max' or 'min', 'max' if not specified
106 local remote_vers="`java ${PROXY_PARAM} \
107 -jar ${LAUNCHER} \
108 -application org.eclipse.equinox.p2.director \
109 -destination ${curdir}/eclipse \
110 -profile SDKProfile \
111 -repository $1 \
112 -list $2\
113 | awk 'BEGIN { FS="=" } { print $2 }'`"
114
115 #find larget remote vers
116 local remote_ver="`echo ${remote_vers} | cut -d ' ' -f1`"
117 case $3 in
118 all)
119 remote_ver=${remote_vers}
120 ;;
121 min)
122 for i in ${remote_vers}; do
123 [ "${remote_ver}" \> "$i" ] && remote_ver="$i"
124 done
125 ;;
126 *)
127 for i in ${remote_vers}; do
128 [ "${remote_ver}" \< "$i" ] && remote_ver="$i"
129 done
130 ;;
131 esac
132
133 echo ${remote_ver}
134}
135
136check_local_version()
137{
138# $1 unitId
139# $2 min version
140# $3 max version (optional)
141 version="`get_version file:///${curdir}/eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile $1`"
142 [ "$version" \< "$2" ] && return 1
143 if [ "x$3" != "x" ]; then
144 [ "$version" \> "$3" ] && return -1
145 fi
146 return 0
147}
148
149update_feature_remote()
150{
151# install a feature of with version requirement [min, max)
152#$1: reporsitory url
153#$2: featureId
154#$3: min version
155#$4: max version(optional)
156 [ $# -lt 3 ] && err_exit 1 "update_feature_remote: invalid parameters, $*"
157 check_local_version $2 $3 $4 && echo "skip installed feature $2" && return 0
158 local installIU=""
159 if [ "x$4" != "x" ]; then
160 #has max version requirement
161 for i in "`get_version $1 $2 'all'`"; do
162 if [ "$i" \> "$3" ] || [ "$i" = "$3" ] && [ "$i" \< "$4" ]; then
163 [ "$i" \> "$installIU" ] && installIU=$i
164 fi
165 done
166 else
167 #only has minimum version requirement
168 local max_remote_ver="`get_version $1 $2 'max'`"
169 [ "$max_remote_ver" \> "$3" ] || [ "$max_remote_ver" = "$3" ] && installIU=$max_remote_ver
170 fi
171
172 [ "x$installIU" = "x" ] && err_exit 1 "Can NOT find candidates of $2 version($3, $4) at $1!"
173 installIU="$2/$installIU"
174 echo "try to install $installIU ..."
175 java ${PROXY_PARAM} -jar ${LAUNCHER} \
176 -application org.eclipse.equinox.p2.director \
177 -destination ${curdir}/eclipse \
178 -profile SDKProfile \
179 -repository $1 \
180 -installIU ${installIU} || err_exit $? "installing ${installIU} failed"
181}
182
183#Eclipse Update Site
184MAIN_UPDATE_SITE="http://download.eclipse.org/releases/juno"
185# The main eclipse download site is unreliable at times. For now, we're going to
186# maintain a mirror of just what we need.
187#MAIN_UPDATE_SITE="http://downloads.yoctoproject.org/eclipse/juno/ftp.osuosl.org/pub/eclipse/releases/juno"
188
189UPDATE_SITE="${MAIN_UPDATE_SITE}"
190
191#CDT related
192CDTFEAT="8.1.0"
193echo "Installing CDT..."
194update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.sdk.feature.group ${CDTFEAT}
195CDTREMOTEVER="6.0.0"
196update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.launch.remote.feature.group ${CDTREMOTEVER}
197
198#RSE SDK
199RSEVER="3.4.0"
200TCFVER="1.0.0"
201TMVER="3.3.0"
202echo "Installing RSE/TCF/TM related component..."
203update_feature_remote ${UPDATE_SITE} org.eclipse.rse.feature.group ${RSEVER}
204update_feature_remote ${UPDATE_SITE} org.eclipse.tcf.rse.feature.feature.group ${TCFVER}
205update_feature_remote ${UPDATE_SITE} org.eclipse.tm.terminal.sdk.feature.group ${TMVER}
206
207#AUTOTOOL
208ATVER="3.0.1"
209echo "Install AutoTool..."
210update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.autotools.feature.group ${ATVER}
211
212#Lttng legacy
213TMFREL="1.0.0"
214echo "Install TMF..."
215update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.tmf.feature.group ${TMFREL}
216
217#LTTng Kernel Analysis
218LTTNGKAVER="1.0.0"
219update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.kernel.feature.group ${LTTNGKAVER}
220
221echo ""
222echo "Your build environment is successfully created."
223echo "Run ECLIPSE_HOME=${curdir}/eclipse `dirname $0`/build.sh <branch name> <release name> to build"
224echo ""
225
226exit 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 @@
1Index: plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF
2===================================================================
3--- plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF (revision 1190)
4+++ plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF (working copy)
5@@ -13,8 +13,16 @@
6 org.eclipse.ui.views,
7 org.eclipse.rse.subsystems.files.core,
8 org.eclipse.rse.subsystems.processes.core,
9- org.eclipse.rse.processes.ui
10+ org.eclipse.rse.processes.ui,
11+ org.eclipse.rse.subsystems.terminals.core,
12+ org.eclipse.tm.tcf;bundle-version="0.3.0",
13+ org.eclipse.rse.subsystems.shells.core;bundle-version="3.1.100",
14+ org.eclipse.core.resources;bundle-version="3.6.0",
15+ org.eclipse.tm.tcf.core;version="0.3.0"
16 Import-Package: org.eclipse.tm.tcf.core;version="0.3.0",
17+ org.eclipse.rse.core.filters,
18+ org.eclipse.tm.internal.tcf.terminals,
19+ org.eclipse.rse.core.model,
20 org.eclipse.tm.tcf.protocol;version="0.3.0",
21 org.eclipse.tm.tcf.services;version="0.3.0",
22 org.eclipse.tm.tcf.util;version="0.3.0"
23Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java
24===================================================================
25--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java (revision 1190)
26+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java (working copy)
27@@ -39,6 +39,11 @@
28
29 private final TCFFileAdapter file_adapter = new TCFFileAdapter();
30
31+ public TCFFileSubSystemConfiguration() {
32+ super();
33+ setIsUnixStyle(true);
34+ }
35+
36 @Override
37 public ISubSystem createSubSystemInternal(IHost host) {
38 TCFConnectorService connectorService = (TCFConnectorService)getConnectorService(host);
39@@ -78,13 +83,12 @@
40 @Override
41 public IConnectorService getConnectorService(IHost host) {
42 return TCFConnectorServiceManager.getInstance()
43- .getConnectorService(host, ITCFSubSystem.class);
44+ .getConnectorService(host, getServiceImplType());
45 }
46
47 @Override
48- @SuppressWarnings("unchecked")
49- public Class getServiceImplType() {
50- return TCFFileService.class;
51+ public Class<ITCFSubSystem> getServiceImplType() {
52+ return ITCFSubSystem.class;
53 }
54
55 @Override
56Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java
57===================================================================
58--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java (revision 1190)
59+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java (working copy)
60@@ -11,6 +11,7 @@
61 * Uwe Stieber (Wind River) - [271224] NPE in TCFFileService#download
62 * Uwe Stieber (Wind River) - [271227] Fix compiler warnings in org.eclipse.tm.tcf.rse
63 * Uwe Stieber (Wind River) - [274277] The TCF file service subsystem implementation is not updating the progress monitor
64+ * Intel Corporation - Make recursive copy/delete available (delete/copy a folder contains files)
65 *******************************************************************************/
66 package org.eclipse.tm.internal.tcf.rse.files;
67
68@@ -18,6 +19,7 @@
69 import java.io.BufferedOutputStream;
70 import java.io.File;
71 import java.io.FileInputStream;
72+import java.io.FileNotFoundException;
73 import java.io.FileOutputStream;
74 import java.io.IOException;
75 import java.io.InputStream;
76@@ -131,22 +133,125 @@
77 return s;
78 }
79
80+ /* Delete from UI action will call deleteBatch interface, yet
81+ * for copy from UI action, it will call copy! It's totally
82+ * inconsistency! For solving the problem, we have to modify
83+ * the copy itself and made it recursive. We can't modify it
84+ * in the same way as delete does!
85+ *
86+ */
87+
88+ public void internalCopy(String srcParent,
89+ String srcName, String tgtParent, String tgtName, IProgressMonitor monitor)
90+ throws SystemMessageException, InterruptedException {
91+ //Note the dest directory or file exist surely since UI operations have
92+ //done something, rename it to copy of XXX
93+ if (monitor != null)
94+ {
95+ if (monitor.isCanceled())
96+ {
97+ throw new InterruptedException("User cancelled the copy operation!");
98+ }
99+ }
100+
101+ try
102+ {
103+ //firstly create the target directory!
104+ this.createFolder(tgtParent, tgtName, monitor);
105+ //then copy the next level directory!
106+ final String new_srcpath = toRemotePath(srcParent, srcName);
107+ final String new_tgtpath = toRemotePath(tgtParent, tgtName);
108+ IHostFile[] arrFiles = internalFetch(new_srcpath, null,
109+ FILE_TYPE_FILES_AND_FOLDERS, monitor);
110+ if (arrFiles == null || arrFiles.length <=0 )
111+ return;
112+ else
113+ {
114+ for (int i = 0; i < arrFiles.length; i++)
115+ {
116+ String srcFile = toRemotePath(new_srcpath, arrFiles[i].getName());
117+ String tgtFile = toRemotePath(new_tgtpath, arrFiles[i].getName());
118+ if (arrFiles[i].isFile())
119+ {
120+ copy(srcFile, tgtFile, monitor);
121+ }
122+ else
123+ {
124+ //do recursive directory copy!
125+ internalCopy(new_srcpath, arrFiles[i].getName(), new_tgtpath,
126+ arrFiles[i].getName(), monitor);
127+ }
128+ }
129+ }
130+ }
131+ catch (SystemMessageException e)
132+ {
133+ e.printStackTrace();
134+ throw new SystemMessageException(e.getSystemMessage());
135+ }
136+ catch (InterruptedException e)
137+ {
138+ throw new InterruptedException("User cancelled the copy operation!");
139+ }
140+ }
141+
142 public void copy(String srcParent,
143 String srcName, String tgtParent, String tgtName, IProgressMonitor monitor)
144 throws SystemMessageException {
145- final String src = toRemotePath(srcParent, srcName);
146- final String tgt = toRemotePath(tgtParent, tgtName);
147+
148+ if (monitor != null)
149+ monitor.beginTask("Copying remote files!", 1);
150+
151+ try {
152+
153+ IHostFile curFile = getFile(srcParent, srcName, monitor);
154+ final String srcFile = toRemotePath(srcParent, srcName);
155+ final String tgtFile = toRemotePath(tgtParent, tgtName);
156+
157+ if (curFile.isFile())
158+ copy(srcFile, tgtFile, monitor);
159+ else if (curFile.isDirectory())
160+ {
161+ internalCopy(srcParent, srcName, tgtParent, tgtName, monitor);
162+ }
163+ else
164+ {
165+ FileNotFoundException e =
166+ new FileNotFoundException("Failed to find the to be " +
167+ "copied file or directory!");
168+ throw new SystemMessageException(getMessage(e));
169+ }
170+ }
171+ catch (Exception e) {
172+ // TODO Auto-generated catch block
173+ if (e instanceof SystemMessageException)
174+ throw (SystemMessageException)e;
175+ else if (e instanceof InterruptedException)
176+ {
177+ System.out.println("User cancelled the copy operation!");
178+ }
179+ throw new SystemOperationFailedException(Activator.PLUGIN_ID, e);
180+
181+ }
182+ finally {
183+ if (monitor != null)
184+ monitor.done();
185+ }
186+ }
187+
188+ public void copy(final String srcFile, final String tgtFile, IProgressMonitor monitor)
189+ throws SystemMessageException {
190 new TCFRSETask<Boolean>() {
191 public void run() {
192 IFileSystem fs = connector.getFileSystemService();
193- fs.copy(src, tgt, false, false, new IFileSystem.DoneCopy() {
194+ fs.copy(srcFile, tgtFile, false, false, new IFileSystem.DoneCopy() {
195 public void doneCopy(IToken token, FileSystemException error) {
196 if (error != null) error(error);
197 else done(Boolean.TRUE);
198 }
199 });
200 }
201- }.getS(monitor, "Copy: " + srcName); //$NON-NLS-1$
202+ }.getS(monitor, "Copy: " + srcFile); //$NON-NLS-1$
203 }
204
205 public void copyBatch(String[] srcParents,
206@@ -226,13 +331,81 @@
207 }.getS(monitor, "Delete"); //$NON-NLS-1$
208 }
209
210+ private void internalDelete(String parent, String name,
211+ IProgressMonitor monitor)
212+ throws SystemMessageException, InterruptedException
213+ {
214+ if (monitor != null)
215+ {
216+ if (monitor.isCanceled())
217+ {
218+ throw new InterruptedException("User cancelled the delete operation!");
219+ }
220+ }
221+
222+ try
223+ {
224+ final String new_path = toRemotePath(parent, name);
225+ IHostFile[] arrFiles = internalFetch(new_path, null,
226+ FILE_TYPE_FILES_AND_FOLDERS, monitor);
227+ if (arrFiles == null || arrFiles.length <= 0)
228+ {
229+ //This is an empty directory, directly delete!
230+ delete(parent, name, monitor);
231+ }
232+ else
233+ {
234+ for (int i = 0; i < arrFiles.length; i++)
235+ {
236+
237+ if (arrFiles[i].isFile())
238+ {
239+ delete(new_path, arrFiles[i].getName(), monitor);
240+ }
241+ else
242+ internalDelete(new_path, arrFiles[i].getName(), monitor);
243+ }
244+ //now the folder becomes empty, let us delete it!
245+ delete(parent, name, monitor);
246+ }
247+ }
248+ catch (SystemMessageException e) {
249+ // TODO Auto-generated catch block
250+ e.printStackTrace();
251+ throw new SystemMessageException(e.getSystemMessage());
252+ }
253+ catch (InterruptedException e) {
254+ throw new InterruptedException("User cancelled the delete operation!");
255+ }
256+ }
257+
258 @Override
259 public void deleteBatch(String[] remoteParents, String[] fileNames,
260 IProgressMonitor monitor)
261- throws SystemMessageException {
262- for (int i = 0; i < remoteParents.length; i++) {
263- delete(remoteParents[i], fileNames[i], monitor);
264+ throws SystemMessageException {
265+ if (monitor != null)
266+ monitor.beginTask("Deleting selected folders or files!", remoteParents.length);
267+ try
268+ {
269+ for (int i = 0; i < remoteParents.length; i++) {
270+ IHostFile curFile = getFile(remoteParents[i], fileNames[i], monitor);
271+ if (curFile.isFile())
272+ delete(remoteParents[i], fileNames[i], monitor);
273+ else if (curFile.isDirectory())
274+ internalDelete(remoteParents[i], fileNames[i], monitor);
275+ }
276 }
277+ catch (Exception x) {
278+ if (x instanceof SystemMessageException) throw (SystemMessageException)x;
279+ else if (x instanceof InterruptedException) {
280+ System.out.println("user cancelled the delete operation!");
281+ }
282+ throw new SystemOperationFailedException(Activator.PLUGIN_ID, x);
283+ }
284+ finally {
285+ if (monitor != null)
286+ monitor.done();
287+ }
288 }
289
290 public void download(final String parent,
291Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java
292===================================================================
293--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java (revision 0)
294+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java (revision 0)
295@@ -0,0 +1,28 @@
296+/*******************************************************************************
297+ * Copyright (c) 2010 Intel Corporation. and others.
298+ * All rights reserved. This program and the accompanying materials
299+ * are made available under the terms of the Eclipse Public License v1.0
300+ * which accompanies this distribution, and is available at
301+ * http://www.eclipse.org/legal/epl-v10.html
302+ *
303+ * Contributors:
304+ * Intel Corporation - initial API and implementation
305+ ******************************************************************************/
306+package org.eclipse.tm.internal.tcf.rse;
307+
308+import org.eclipse.osgi.util.NLS;
309+
310+public class TCFConnectorResources extends NLS {
311+ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.TCFConnectorResources";
312+ static {
313+ NLS.initializeMessages(BUNDLE_NAME, TCFConnectorResources.class);
314+ }
315+ private TCFConnectorResources() {
316+
317+ }
318+
319+ public static String TCFConnectorService_Name;
320+ public static String TCFConnectorService_Description;
321+ public static String PropertySet_Description;
322+
323+}
324Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java
325===================================================================
326--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java (revision 0)
327+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java (revision 0)
328@@ -0,0 +1,29 @@
329+/*******************************************************************************
330+ * Copyright (c) 2010 Intel Corporation. and others.
331+ * All rights reserved. This program and the accompanying materials
332+ * are made available under the terms of the Eclipse Public License v1.0
333+ * which accompanies this distribution, and is available at
334+ * http://www.eclipse.org/legal/epl-v10.html
335+ *
336+ * Contributors:
337+ * Intel Corporation - initial API and implementation
338+ ******************************************************************************/
339+
340+package org.eclipse.tm.internal.tcf.rse;
341+
342+import org.eclipse.rse.services.files.RemoteFileException;
343+import org.eclipse.tm.tcf.protocol.IChannel;
344+
345+public interface ITCFSessionProvider {
346+ public static final int ERROR_CODE = 100; // filed error code
347+ public static final int SUCCESS_CODE = 150; // login pass code
348+ public static final int CONNECT_CLOSED = 200; // code for end of login attempts
349+ public static final int TCP_CONNECT_TIMEOUT = 10; //seconds - TODO: Make configurable
350+
351+ public IChannel getChannel();
352+ public String getSessionUserId();
353+ public String getSessionPassword();
354+ public String getSessionHostName();
355+ public boolean isSubscribed();
356+ public void Subscribe() throws RemoteFileException;
357+}
358Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java
359===================================================================
360--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java (revision 1190)
361+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java (working copy)
362@@ -26,10 +26,8 @@
363
364 private final TCFProcessAdapter process_adapter = new TCFProcessAdapter();
365
366- @Override
367- @SuppressWarnings("unchecked")
368- public Class getServiceImplType() {
369- return TCFProcessService.class;
370+ public Class<ITCFSubSystem> getServiceImplType() {
371+ return ITCFSubSystem.class;
372 }
373
374 @Override
375@@ -50,7 +48,7 @@
376 @Override
377 public IConnectorService getConnectorService(IHost host) {
378 return TCFConnectorServiceManager.getInstance()
379- .getConnectorService(host, ITCFSubSystem.class);
380+ .getConnectorService(host, getServiceImplType());
381 }
382
383 @Override
384Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java
385===================================================================
386--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java (revision 1190)
387+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java (working copy)
388@@ -10,29 +10,49 @@
389 * Martin Oberhuber (Wind River) - [269682] Get port from RSE Property
390 * Uwe Stieber (Wind River) - [271227] Fix compiler warnings in org.eclipse.tm.tcf.rse
391 * Anna Dushistova (MontaVista) - [285373] TCFConnectorService should send CommunicationsEvent.BEFORE_CONNECT and CommunicationsEvent.BEFORE_DISCONNECT
392- *******************************************************************************/
393+ * Intel Corporation - Make TCF being authenticated connection and attached streaming subscription/unsubscription method
394+ ******************************************************************************/
395 package org.eclipse.tm.internal.tcf.rse;
396
397+import java.io.IOException;
398 import java.util.ArrayList;
399 import java.util.HashMap;
400 import java.util.List;
401 import java.util.Map;
402+import java.util.concurrent.ExecutionException;
403+import java.util.concurrent.TimeUnit;
404+import java.util.concurrent.TimeoutException;
405
406 import org.eclipse.core.runtime.IProgressMonitor;
407 import org.eclipse.rse.core.model.IHost;
408-import org.eclipse.rse.core.subsystems.BasicConnectorService;
409+import org.eclipse.rse.core.model.IPropertySet;
410+import org.eclipse.rse.core.model.PropertyType;
411+import org.eclipse.rse.core.model.SystemSignonInformation;
412 import org.eclipse.rse.core.subsystems.CommunicationsEvent;
413+import org.eclipse.rse.services.files.RemoteFileException;
414+import org.eclipse.rse.ui.subsystems.StandardConnectorService;
415+import org.eclipse.tm.internal.tcf.terminals.ITerminalsService;
416 import org.eclipse.tm.tcf.core.AbstractPeer;
417 import org.eclipse.tm.tcf.protocol.IChannel;
418 import org.eclipse.tm.tcf.protocol.IPeer;
419 import org.eclipse.tm.tcf.protocol.IService;
420+import org.eclipse.tm.tcf.protocol.IToken;
421 import org.eclipse.tm.tcf.protocol.Protocol;
422 import org.eclipse.tm.tcf.services.IFileSystem;
423 import org.eclipse.tm.tcf.services.ILocator;
424+import org.eclipse.tm.tcf.services.IStreams;
425 import org.eclipse.tm.tcf.services.ISysMonitor;
426+import org.eclipse.tm.tcf.util.TCFTask;
427
428+public class TCFConnectorService extends StandardConnectorService implements
429+ ITCFSessionProvider {
430
431-public class TCFConnectorService extends BasicConnectorService {
432+ public static final String PROPERTY_SET_NAME = "TCF Connection Settings";
433+ public static final String PROPERTY_LOGIN_REQUIRED = "Login.Required"; //$NON-NLS-1$
434+ public static final String PROPERTY_PWD_REQUIRED="Pwd.Required";
435+ public static final String PROPERTY_LOGIN_PROMPT = "Login.Prompt"; //$NON-NLS-1$
436+ public static final String PROPERTY_PASSWORD_PROMPT = "Password.Prompt"; //$NON-NLS-1$
437+ public static final String PROPERTY_COMMAND_PROMPT = "Command.Prompt"; //$NON-NLS-1$
438
439 private IChannel channel;
440 private Throwable channel_error;
441@@ -40,12 +60,62 @@
442
443 private boolean poll_timer_started;
444
445+ private boolean bSubscribed = false;
446+
447+ /* subscribe the stream service on this TCP connection */
448+ private IStreams.StreamsListener streamListener = new IStreams.StreamsListener() {
449+ public void created(String stream_type, String stream_id,
450+ String context_id) {
451+ System.out.printf("new stream id: %s , type: %s is created\n",
452+ stream_id, stream_type);
453+ }
454+
455+ /**
456+ * Called when a stream is disposed.
457+ *
458+ * @param stream_type
459+ * - source type of the stream.
460+ * @param stream_id
461+ * - ID of the stream.
462+ */
463+ public void disposed(String stream_type, String stream_id) {
464+ System.out.printf("stream id: %s type: %s is disposed\n",
465+ stream_id, stream_type);
466+ }
467+ };
468+
469 public TCFConnectorService(IHost host, int port) {
470- super("TCF", "Target Communication Framework", host, port); //$NON-NLS-1$ //$NON-NLS-2$
471+ super(TCFConnectorResources.TCFConnectorService_Name,
472+ TCFConnectorResources.TCFConnectorService_Description, host,
473+ port); //$NON-NLS-1$ //$NON-NLS-2$
474+ getTCFPropertySet();
475 }
476+
477+ public IPropertySet getTCFPropertySet() {
478+ IPropertySet tcfSet = getPropertySet(PROPERTY_SET_NAME);
479+ if (tcfSet == null) {
480+ tcfSet = createPropertySet(PROPERTY_SET_NAME, TCFConnectorResources.PropertySet_Description);
481+ //add default values if not set
482+ tcfSet.addProperty(PROPERTY_LOGIN_REQUIRED, "true", PropertyType.getEnumPropertyType(new String[] {"true", "false"}));
483+ tcfSet.addProperty(PROPERTY_PWD_REQUIRED, "false", PropertyType.getEnumPropertyType(new String[] {"true", "false"}));
484+ tcfSet.addProperty(PROPERTY_LOGIN_PROMPT, "ogin: ", PropertyType.getStringPropertyType());
485+ tcfSet.addProperty(PROPERTY_PASSWORD_PROMPT, "assword: ", PropertyType.getStringPropertyType());
486+ tcfSet.addProperty(PROPERTY_COMMAND_PROMPT, "#", PropertyType.getStringPropertyType());
487+ }
488+ return tcfSet;
489+ }
490
491+ /**
492+ * @return true if the associated connector service requires a password.
493+ */
494 @Override
495- protected void internalConnect(final IProgressMonitor monitor) throws Exception {
496+ public final boolean requiresPassword() {
497+ return false;
498+ }
499+
500+ @Override
501+ protected void internalConnect(final IProgressMonitor monitor)
502+ throws Exception {
503 assert !Protocol.isDispatchThread();
504 final Exception[] res = new Exception[1];
505 // Fire comm event to signal state about to change
506@@ -54,39 +124,55 @@
507 synchronized (res) {
508 Protocol.invokeLater(new Runnable() {
509 public void run() {
510- if (!connectTCFChannel(res, monitor)) add_to_wait_list(this);
511+ if (!connectTCFChannel(res, monitor))
512+ add_to_wait_list(this);
513 }
514 });
515 res.wait();
516 }
517+ if (res[0] != null) throw res[0];
518 monitor.done();
519- if (res[0] != null) throw res[0];
520 }
521
522 @Override
523- protected void internalDisconnect(final IProgressMonitor monitor) throws Exception {
524+ protected void internalDisconnect(final IProgressMonitor monitor)
525+ throws Exception {
526 assert !Protocol.isDispatchThread();
527 final Exception[] res = new Exception[1];
528 // Fire comm event to signal state about to change
529 fireCommunicationsEvent(CommunicationsEvent.BEFORE_DISCONNECT);
530 monitor.beginTask("Disconnecting " + getHostName(), 1); //$NON-NLS-1$
531- synchronized (res) {
532- Protocol.invokeLater(new Runnable() {
533- public void run() {
534- if (!disconnectTCFChannel(res, monitor)) add_to_wait_list(this);
535- }
536- });
537- res.wait();
538+ try {
539+ /* First UnSubscribe TCP channel */
540+ Unsubscribe();
541+ /* Disconnecting TCP channel */
542+ synchronized (res) {
543+ Protocol.invokeLater(new Runnable() {
544+ public void run() {
545+ if (!disconnectTCFChannel(res, monitor))
546+ add_to_wait_list(this);
547+ }
548+ });
549+ res.wait();
550+ }
551+ if (res[0] != null) throw res[0];
552+
553 }
554- monitor.done();
555- if (res[0] != null) throw res[0];
556+ catch (Exception e) {
557+ e.printStackTrace();
558+ throw new RemoteFileException("Error creating Terminal", e); //$NON-NLS-1$
559+ }
560+ finally {
561+ monitor.done();
562+ }
563 }
564
565 public boolean isConnected() {
566 final boolean res[] = new boolean[1];
567 Protocol.invokeAndWait(new Runnable() {
568 public void run() {
569- res[0] = channel != null && channel.getState() == IChannel.STATE_OPEN;
570+ res[0] = channel != null
571+ && channel.getState() == IChannel.STATE_OPEN;
572 }
573 });
574 return res[0];
575@@ -108,7 +194,8 @@
576 if (wait_list.isEmpty()) return;
577 Runnable[] r = wait_list.toArray(new Runnable[wait_list.size()]);
578 wait_list.clear();
579- for (int i = 0; i < r.length; i++) r[i].run();
580+ for (int i = 0; i < r.length; i++)
581+ r[i].run();
582 }
583
584 private boolean connectTCFChannel(Exception[] res, IProgressMonitor monitor) {
585@@ -117,9 +204,12 @@
586 case IChannel.STATE_OPEN:
587 case IChannel.STATE_CLOSED:
588 synchronized (res) {
589- if (channel_error instanceof Exception) res[0] = (Exception)channel_error;
590- else if (channel_error != null) res[0] = new Exception(channel_error);
591- else res[0] = null;
592+ if (channel_error instanceof Exception)
593+ res[0] = (Exception) channel_error;
594+ else if (channel_error != null)
595+ res[0] = new Exception(channel_error);
596+ else
597+ res[0] = null;
598 res.notify();
599 return true;
600 }
601@@ -137,7 +227,7 @@
602 String host = getHostName().toLowerCase();
603 int port = getConnectPort();
604 if (port <= 0) {
605- //Default fallback
606+ // Default fallback
607 port = TCFConnectorServiceManager.TCF_PORT;
608 }
609 IPeer peer = null;
610@@ -146,8 +236,8 @@
611 for (IPeer p : locator.getPeers().values()) {
612 Map<String, String> attrs = p.getAttributes();
613 if ("TCP".equals(attrs.get(IPeer.ATTR_TRANSPORT_NAME)) && //$NON-NLS-1$
614- host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST)) &&
615- port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) {
616+ host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST))
617+ && port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) {
618 peer = p;
619 break;
620 }
621@@ -171,17 +261,18 @@
622
623 public void congestionLevel(int level) {
624 }
625-
626 public void onChannelClosed(Throwable error) {
627 assert channel != null;
628 channel.removeChannelListener(this);
629 channel_error = error;
630+
631 if (wait_list.isEmpty()) {
632 fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR);
633 }
634 else {
635 run_wait_list();
636 }
637+ bSubscribed = false;
638 channel = null;
639 channel_error = null;
640 }
641@@ -192,7 +283,8 @@
642 return false;
643 }
644
645- private boolean disconnectTCFChannel(Exception[] res, IProgressMonitor monitor) {
646+ private boolean disconnectTCFChannel(Exception[] res,
647+ IProgressMonitor monitor) {
648 if (channel == null || channel.getState() == IChannel.STATE_CLOSED) {
649 synchronized (res) {
650 res[0] = null;
651@@ -212,9 +304,12 @@
652 }
653
654 public <V extends IService> V getService(Class<V> service_interface) {
655- if (channel == null || channel.getState() != IChannel.STATE_OPEN) throw new Error("Not connected"); //$NON-NLS-1$
656+ if (channel == null || channel.getState() != IChannel.STATE_OPEN)
657+ throw new Error("Not connected"); //$NON-NLS-1$
658 V m = channel.getRemoteService(service_interface);
659- if (m == null) throw new Error("Remote peer does not support " + service_interface.getName() + " service"); //$NON-NLS-1$ //$NON-NLS-2$
660+ if (m == null)
661+ throw new Error(
662+ "Remote peer does not support " + service_interface.getName() + " service"); //$NON-NLS-1$ //$NON-NLS-2$
663 return m;
664 }
665
666@@ -225,4 +320,111 @@
667 public IFileSystem getFileSystemService() {
668 return getService(IFileSystem.class);
669 }
670+
671+ public IChannel getChannel() {
672+ // TODO Auto-generated method stub
673+ return channel;
674+ }
675+
676+ public String getSessionHostName() {
677+ // TODO Auto-generated method stub
678+ String hostName = "";
679+ IHost host = getHost();
680+ if (host != null) hostName = host.getHostName();
681+ return hostName;
682+ }
683+
684+ public String getSessionUserId() {
685+ // TODO Auto-generated method stub
686+ return getUserId();
687+ }
688+
689+ public String getSessionPassword() {
690+ // TODO Auto-generated method stub
691+ String password = "";
692+ SystemSignonInformation ssi = getSignonInformation();
693+ if (ssi != null) {
694+ password = ssi.getPassword();
695+ }
696+ return password;
697+ }
698+
699+ public boolean isSubscribed() {
700+ // TODO Auto-generated method stub
701+ return bSubscribed;
702+ }
703+
704+ public void Unsubscribe() throws IOException {
705+ if (bSubscribed) {
706+ System.out
707+ .println("Unsubscribe streams before disconnecting TCP channel.");
708+ try {
709+ new TCFTask<Object>() {
710+ public void run() {
711+ IStreams streams = getService(IStreams.class);
712+ streams.unsubscribe(ITerminalsService.NAME, streamListener,
713+ new IStreams.DoneUnsubscribe() {
714+ public void doneUnsubscribe(IToken token,
715+ Exception error) {
716+ // TODO Auto-generated method stub
717+ System.out.printf(
718+ "stream type %s unsubscribed\n",
719+ ITerminalsService.NAME);
720+ done(this);
721+ }
722+ });
723+ }
724+ }.get(1, TimeUnit.SECONDS);
725+ }
726+ catch (InterruptedException e) {
727+ new IOException("Meet " + e.getMessage() + " when Unsubsribe streams");
728+ }
729+ catch (ExecutionException e) {
730+ new IOException("Meet " + e.getMessage() + " when Unsubsribe streams");
731+ }
732+ catch (TimeoutException e) {
733+ new IOException("Meet " + e.getMessage() + " when Unsubsribe streams");
734+ }
735+ bSubscribed = false;
736+ }
737+
738+ }
739+
740+ public void Subscribe() throws RemoteFileException {
741+ try {
742+ new TCFTask<Object>() {
743+ public void run() {
744+ if (bSubscribed) {
745+ done(this);
746+ }
747+ else {
748+ bSubscribed = true;
749+ IStreams streams = getService(IStreams.class);
750+ streams.subscribe(ITerminalsService.NAME, streamListener,
751+ new IStreams.DoneSubscribe() {
752+ public void doneSubscribe(IToken token,
753+ Exception error) {
754+ // TODO Auto-generated method stub
755+ System.out.println("Stream subscribed");
756+ if (error != null) {
757+ System.out.println("subscribe error");
758+ bSubscribed = false;
759+ error(error);
760+ }
761+ else
762+ done(this);
763+ }
764+
765+ });
766+ }}
767+ }.getIO();
768+
769+ }
770+ catch (Exception e) {
771+ e.printStackTrace();
772+ throw new RemoteFileException(
773+ "Error When Subscribe Terminal streams!", e); //$NON-NLS-1$
774+ }
775+
776+ }
777 }
778Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java
779===================================================================
780--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java (revision 0)
781+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java (revision 0)
782@@ -0,0 +1,35 @@
783+/*******************************************************************************
784+ * Copyright (c) 2010 Intel Corporation. and others.
785+ * All rights reserved. This program and the accompanying materials
786+ * are made available under the terms of the Eclipse Public License v1.0
787+ * which accompanies this distribution, and is available at
788+ * http://www.eclipse.org/legal/epl-v10.html
789+ *
790+ * Contributors:
791+ * Intel Corporation - initial API and implementation
792+ ******************************************************************************/
793+package org.eclipse.tm.internal.tcf.rse.shells;
794+
795+import org.eclipse.osgi.util.NLS;
796+
797+public class TCFShellServiceResources extends NLS {
798+ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.shells.TCFShellServiceResources"; //$NON-NLS-1$
799+
800+ public static String TCFPlugin_Unexpected_Exception;
801+
802+ public static String TCFShellService_Description;
803+
804+ public static String TCFShellService_Name;
805+
806+ static {
807+ // initialize resource bundle
808+ NLS.initializeMessages(BUNDLE_NAME, TCFShellServiceResources.class);
809+ }
810+
811+ private TCFShellServiceResources(){
812+ }
813+
814+}
815+
816+
817+
818Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java
819===================================================================
820--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java (revision 0)
821+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java (revision 0)
822@@ -0,0 +1,444 @@
823+/*******************************************************************************
824+ * Copyright (c) 2010 Intel Corporation. and others.
825+ * All rights reserved. This program and the accompanying materials
826+ * are made available under the terms of the Eclipse Public License v1.0
827+ * which accompanies this distribution, and is available at
828+ * http://www.eclipse.org/legal/epl-v10.html
829+ *
830+ * Contributors:
831+ * Intel Corporation - initial API and implementation
832+ ******************************************************************************/
833+package org.eclipse.tm.internal.tcf.rse.shells;
834+
835+import java.io.BufferedWriter;
836+import java.io.IOException;
837+import java.io.InputStream;
838+import java.io.OutputStream;
839+import java.io.OutputStreamWriter;
840+import java.io.Writer;
841+import java.util.Map;
842+
843+import org.eclipse.core.runtime.IStatus;
844+import org.eclipse.rse.core.model.IPropertySet;
845+import org.eclipse.rse.services.clientserver.PathUtility;
846+import org.eclipse.rse.services.clientserver.messages.CommonMessages;
847+import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
848+import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
849+import org.eclipse.rse.services.clientserver.messages.SystemMessage;
850+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
851+import org.eclipse.rse.services.terminals.AbstractTerminalShell;
852+import org.eclipse.rse.services.terminals.ITerminalService;
853+import org.eclipse.rse.ui.SystemBasePlugin;
854+import org.eclipse.tm.internal.tcf.rse.ITCFSessionProvider;
855+import org.eclipse.tm.internal.tcf.rse.TCFConnectorService;
856+import org.eclipse.tm.internal.tcf.rse.TCFRSETask;
857+import org.eclipse.tm.internal.tcf.terminals.ITerminalsService;
858+import org.eclipse.tm.tcf.protocol.IChannel;
859+import org.eclipse.tm.tcf.protocol.IToken;
860+import org.eclipse.tm.tcf.services.IStreams;
861+
862+
863+public class TCFTerminalShell extends AbstractTerminalShell {
864+ private ITCFSessionProvider fSessionProvider;
865+ private IChannel fChannel;
866+ private String fPtyType;
867+ private ITerminalsService.TerminalContext terminalContext;
868+ private String fEncoding;
869+ private InputStream fInputStream;
870+ private OutputStream fOutputStream;
871+ private Writer fOutputStreamWriter;
872+ private int fWidth = 0;
873+ private int fHeight = 0;
874+ private String fContextID;
875+ private String in_id;
876+ private String out_id;
877+ private boolean connected = false;
878+ private ITerminalsService terminal;
879+ private int status;
880+
881+ private IPropertySet tcfPropertySet = null;
882+
883+ private static String defaultEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding();
884+ private ITerminalsService.TerminalsListener listeners = new ITerminalsService.TerminalsListener(){
885+
886+ public void exited(String terminalId, int exitCode) {
887+ // TODO Auto-generated method stub
888+ System.out.printf("Console terminal shell %s exited, current shell ID %s\n", terminalId, terminalContext.getID());
889+ if(!terminalContext.getID().equals(terminalId))
890+ return;
891+ terminal.removeListener(listeners);
892+ TCFTerminalShell.this.connected = false;
893+ }
894+
895+
896+ public void winSizeChanged(String terminalId, int newWidth,
897+ int newHeight) {
898+ // TODO Auto-generated method stub
899+ System.out.printf("Console terminal shell %s new width %d, height %d\n", terminalId, newWidth, newHeight);
900+ }
901+ };
902+
903+ private class LoginThread extends Thread {
904+
905+ private String username;
906+ private String password;
907+ private int status = ITCFSessionProvider.SUCCESS_CODE;
908+ public LoginThread(String username, String password) {
909+ this.username = username;
910+ this.password = password;
911+ }
912+
913+ public void run() {
914+ tcfPropertySet = ((TCFConnectorService)fSessionProvider).getTCFPropertySet();
915+ String login_required = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_LOGIN_REQUIRED);
916+ String login_prompt = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_LOGIN_PROMPT);
917+ String password_prompt =tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_PASSWORD_PROMPT);
918+ String command_prompt = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_COMMAND_PROMPT);
919+ String pwd_required = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_PWD_REQUIRED);
920+
921+ if (Boolean.valueOf(login_required).booleanValue()) {
922+ status = ITCFSessionProvider.SUCCESS_CODE;
923+ if (login_prompt != null && login_prompt.length() > 0) {
924+ status = readUntil(login_prompt,fInputStream);
925+ write(username + "\n");
926+ }
927+ if (Boolean.valueOf(pwd_required).booleanValue()) {
928+ if (status == ITCFSessionProvider.SUCCESS_CODE && password_prompt != null && password_prompt.length() > 0) {
929+ status = readUntil(password_prompt,fInputStream);
930+ write(password + "\n");
931+ }
932+ }
933+ if (status == ITCFSessionProvider.SUCCESS_CODE && command_prompt != null && command_prompt.length() > 0) {
934+ status = readUntil(command_prompt,fInputStream);
935+ write("\n");
936+ }
937+ } else {
938+ if (command_prompt != null && command_prompt.length() > 0) {
939+ status = readUntil(command_prompt,fInputStream);
940+ write("\n");
941+ }
942+ }
943+ }
944+
945+ public int readUntil(String pattern,InputStream in) {
946+ try {
947+ char lastChar = pattern.charAt(pattern.length() - 1);
948+ StringBuffer sb = new StringBuffer();
949+ int ch = in.read();
950+ while (ch >= 0) {
951+ char tch = (char) ch;
952+ sb.append(tch);
953+ if (tch=='t' && sb.indexOf("incorrect") >= 0) { //$NON-NLS-1$
954+ return ITCFSessionProvider.ERROR_CODE;
955+ }
956+ if (tch=='d' && sb.indexOf("closed") >= 0) { //$NON-NLS-1$
957+ return ITCFSessionProvider.CONNECT_CLOSED;
958+ }
959+ if (tch == lastChar) {
960+ if (sb.toString().endsWith(pattern)) {
961+ return ITCFSessionProvider.SUCCESS_CODE;
962+ }
963+ }
964+ ch = in.read();
965+ }
966+ }
967+ catch (Exception e) {
968+ e.printStackTrace();
969+ SystemBasePlugin.logError(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), e);
970+ }
971+ return ITCFSessionProvider.CONNECT_CLOSED;
972+ }
973+
974+ public int getLoginStatus() {
975+ return this.status;
976+ }
977+
978+ }
979+
980+ public void write(String value) {
981+ try {
982+ int len = value.length() + 6;
983+ fOutputStream.write(value.getBytes());
984+ System.out.printf("value is %s\n", value);
985+ System.out.printf("write: ******************".substring(0, len <= 24 ? len : 24)); //$NON-NLS-1$
986+ } catch (Exception e) {
987+ e.printStackTrace();
988+ }
989+ }
990+
991+ private int login(String username, String password) throws InterruptedException
992+ {
993+ long millisToEnd = System.currentTimeMillis() + ITCFSessionProvider.TCP_CONNECT_TIMEOUT*1000;
994+ LoginThread checkLogin = new LoginThread(username, password);
995+ status = ITCFSessionProvider.ERROR_CODE;
996+ checkLogin.start();
997+ while (checkLogin.isAlive() && System.currentTimeMillis()<millisToEnd)
998+ checkLogin.join(500);
999+ status = checkLogin.getLoginStatus();
1000+ checkLogin.join();
1001+ return status;
1002+ }
1003+ /**
1004+ * Construct a new TCF connection.
1005+ *
1006+ * The TCF channel is immediately connected in the Constructor.
1007+ *
1008+ * @param sessionProvider TCF session provider
1009+ * @param ptyType Terminal type to set, or <code>null</code> if not
1010+ * relevant
1011+ * @param encoding The default encoding to use for initial command.
1012+ * @param environment Environment array to set, or <code>null</code> if
1013+ * not relevant.
1014+ * @param initialWorkingDirectory initial directory to open the Terminal in.
1015+ * Use <code>null</code> or empty String ("") to start in a
1016+ * default directory. Empty String will typically start in the
1017+ * home directory.
1018+ * @param commandToRun initial command to send.
1019+ * @throws SystemMessageException in case anything goes wrong. Channels and
1020+ * Streams are all cleaned up again in this case.
1021+ * @see ITerminalService
1022+ */
1023+ public TCFTerminalShell(final ITCFSessionProvider sessionProvider, final String ptyType,
1024+ final String encoding, final String[] environment,
1025+ String initialWorkingDirectory, String commandToRun)
1026+ throws SystemMessageException {
1027+ Map<String, Object> map_ids;
1028+ Exception nestedException = null;
1029+ try {
1030+ fSessionProvider = sessionProvider;
1031+ fEncoding = encoding;
1032+ fPtyType = ptyType;
1033+ fChannel = fSessionProvider.getChannel();
1034+
1035+ if (fChannel == null || fChannel.getState() != IChannel.STATE_OPEN)
1036+ throw new Exception("TCP channel is not connected!");
1037+ if (((TCFConnectorService)sessionProvider).isSubscribed() == false)
1038+ ((TCFConnectorService)sessionProvider).Subscribe();
1039+ assert (((TCFConnectorService)sessionProvider).isSubscribed());
1040+
1041+ new TCFRSETask<ITerminalsService.TerminalContext>() {
1042+ public void run() {
1043+ terminal = ((TCFConnectorService)sessionProvider).getService(ITerminalsService.class);
1044+ terminal.addListener(listeners);
1045+ terminal.launch(ptyType, encoding, environment, new ITerminalsService.DoneLaunch() {
1046+ public void doneLaunch(IToken token, Exception error,
1047+ ITerminalsService.TerminalContext terminal) {
1048+ // TODO Auto-generated method stub
1049+
1050+ terminalContext = terminal;
1051+ if (error != null)
1052+ error(error);
1053+ else done(terminal);
1054+ }
1055+ });
1056+ }
1057+
1058+ }.getS(null, TCFShellServiceResources.TCFShellService_Name); //$NON-NLS-1$
1059+
1060+ fPtyType = terminalContext.getPtyType();
1061+ fEncoding = terminalContext.getEncoding();
1062+ fContextID = terminalContext.getID();
1063+ fWidth = terminalContext.getWidth();
1064+ fHeight = terminalContext.getHeight();
1065+ map_ids = terminalContext.getProperties();
1066+ in_id = (String)map_ids.get(ITerminalsService.PROP_STDOUT_ID);
1067+ out_id = (String)map_ids.get(ITerminalsService.PROP_STDIN_ID);
1068+
1069+ String user = fSessionProvider.getSessionUserId();
1070+ String password = fSessionProvider.getSessionPassword(); //$NON-NLS-1$
1071+ status = ITCFSessionProvider.ERROR_CODE;
1072+
1073+ IStreams streams = ((TCFConnectorService)sessionProvider).getService(IStreams.class);
1074+ fOutputStream = new TCFTerminalOutputStream(streams, out_id);
1075+ fInputStream = new TCFTerminalInputStream(streams, in_id);
1076+ if (fEncoding != null) {
1077+ fOutputStreamWriter = new BufferedWriter(new OutputStreamWriter(fOutputStream, encoding));
1078+ } else {
1079+ // default encoding == System.getProperty("file.encoding")
1080+ // TODO should try to determine remote encoding if possible
1081+ fOutputStreamWriter = new BufferedWriter(new OutputStreamWriter(fOutputStream));
1082+ }
1083+
1084+ try {
1085+ status = login(user, password);
1086+ }
1087+ finally
1088+ {
1089+ if ((status == ITCFSessionProvider.CONNECT_CLOSED))
1090+ System.out.print("First time login fails, retry!");
1091+ }
1092+
1093+ //give another chance of retrying
1094+ if ((status == ITCFSessionProvider.CONNECT_CLOSED))
1095+ {
1096+ ((TCFConnectorService)sessionProvider).Unsubscribe();
1097+ ((TCFConnectorService)sessionProvider).Subscribe();
1098+ assert (((TCFConnectorService)sessionProvider).isSubscribed());
1099+ status = login(user, password);
1100+ }
1101+
1102+ connected = true;
1103+ if (initialWorkingDirectory!=null && initialWorkingDirectory.length()>0
1104+ && !initialWorkingDirectory.equals(".") //$NON-NLS-1$
1105+ && !initialWorkingDirectory.equals("Command Shell") //$NON-NLS-1$ //FIXME workaround for bug 153047
1106+ ) {
1107+ writeToShell("cd " + PathUtility.enQuoteUnix(initialWorkingDirectory)); //$NON-NLS-1$
1108+ }
1109+
1110+ if (commandToRun != null && commandToRun.length() > 0) {
1111+ writeToShell(commandToRun);
1112+ }
1113+
1114+ }
1115+ catch (Exception e)
1116+ {
1117+ e.printStackTrace();
1118+ nestedException = e;
1119+ }
1120+ finally {
1121+ if (status == ITCFSessionProvider.SUCCESS_CODE) {
1122+ System.out.println("TCF shell Service: Connected"); //$NON-NLS-1$
1123+ }
1124+ else {
1125+ System.out.println("TCF shell Service: Connect failed"); //$NON-NLS-1$
1126+ SystemMessage msg;
1127+
1128+ if (nestedException!=null) {
1129+ msg = new SimpleSystemMessage(org.eclipse.tm.internal.tcf.rse.Activator.PLUGIN_ID,
1130+ ICommonMessageIds.MSG_EXCEPTION_OCCURRED,
1131+ IStatus.ERROR,
1132+ CommonMessages.MSG_EXCEPTION_OCCURRED, nestedException);
1133+ } else {
1134+ String strErr;
1135+ if (status == ITCFSessionProvider.CONNECT_CLOSED)
1136+ strErr = "Connection closed!";
1137+ else if (status == ITCFSessionProvider.ERROR_CODE)
1138+ strErr = "Login Incorrect or meet other unknown error!";
1139+ else
1140+ strErr = "Not identified Errors";
1141+
1142+ msg = new SimpleSystemMessage(org.eclipse.tm.internal.tcf.rse.Activator.PLUGIN_ID,
1143+ ICommonMessageIds.MSG_COMM_AUTH_FAILED,
1144+ IStatus.ERROR,
1145+ strErr,
1146+ "Meet error when trying to login in!");
1147+ msg.makeSubstitution(((TCFConnectorService)fSessionProvider).getHost().getAliasName());
1148+ }
1149+ throw new SystemMessageException(msg);
1150+ }
1151+ }
1152+
1153+ }
1154+
1155+ public void writeToShell(String command) throws IOException {
1156+ if (isActive()) {
1157+ if ("#break".equals(command)) { //$NON-NLS-1$
1158+ command = "\u0003"; // Unicode 3 == Ctrl+C //$NON-NLS-1$
1159+ } else {
1160+ command += "\r\n"; //$NON-NLS-1$
1161+ }
1162+ fOutputStreamWriter.write(command);
1163+ }
1164+ }
1165+
1166+ public void exit() {
1167+
1168+ // TODO Auto-generated method stub
1169+ if (fChannel == null || (fChannel.getState() == IChannel.STATE_CLOSED) || !connected) {
1170+ System.out.println("This terminal shell exits already!");
1171+ return;
1172+ }
1173+ try {
1174+ getOutputStream().close();
1175+ getInputStream().close();
1176+
1177+ }
1178+ catch (IOException ioe) {
1179+ // TODO Auto-generated catch block
1180+ ioe.printStackTrace();
1181+ } //$NON-NLS-1$
1182+
1183+ try {
1184+ new TCFRSETask<Object>() {
1185+ public void run() {
1186+ terminalContext.exit(new ITerminalsService.DoneCommand(){
1187+ public void doneCommand(IToken token,
1188+ Exception error) {
1189+ // TODO Auto-generated method stub
1190+ if (error != null)
1191+ error(error);
1192+ else {
1193+ System.out.println("terminal exit command sent");
1194+ done(this);
1195+ }
1196+ }
1197+ });
1198+ }}.getS(null, TCFShellServiceResources.TCFShellService_Name); //seems no need block here. need further modification.
1199+ }
1200+ catch (SystemMessageException e) {
1201+ // TODO Auto-generated catch block
1202+ e.printStackTrace();
1203+ } //$NON-NLS-1$;
1204+ }
1205+
1206+ public InputStream getInputStream() {
1207+ // TODO Auto-generated method stub
1208+ return fInputStream;
1209+ }
1210+
1211+ public OutputStream getOutputStream() {
1212+ // TODO Auto-generated method stub
1213+ return fOutputStream;
1214+ }
1215+
1216+ public boolean isActive() {
1217+ // TODO Auto-generated method stub
1218+ if (fChannel != null && !(fChannel.getState() == IChannel.STATE_CLOSED) && connected) {
1219+ return true;
1220+ }
1221+ exit();
1222+ // shell is not active: check for session lost
1223+ return false;
1224+ }
1225+
1226+ public String getPtyType() {
1227+ return fPtyType;
1228+ }
1229+
1230+ public void setTerminalSize(int newWidth, int newHeight) {
1231+ // do nothing
1232+ if (fChannel == null || (fChannel.getState() == IChannel.STATE_CLOSED) || !connected) {
1233+ System.out.println("This terminal shell exits already, can't set size!");
1234+ return;
1235+ }
1236+
1237+ try {
1238+ new TCFRSETask<Object>() {
1239+ public void run() {
1240+ if (fChannel != null && connected) {
1241+ terminal.setWinSize(fContextID, fWidth, fHeight, new ITerminalsService.DoneCommand(){
1242+
1243+ public void doneCommand(IToken token, Exception error) {
1244+ // TODO Auto-generated method stub
1245+ if (error != null)
1246+ error(error);
1247+ else
1248+ done(this);
1249+
1250+ }});
1251+
1252+ }
1253+ }}.getS(null, TCFShellServiceResources.TCFShellService_Name);
1254+ }
1255+ catch (SystemMessageException e) {
1256+ // TODO Auto-generated catch block
1257+ e.printStackTrace();
1258+ } //$NON-NLS-1$;
1259+ }
1260+
1261+ public String getDefaultEncoding() {
1262+ if (fEncoding != null) return fEncoding;
1263+ return defaultEncoding;
1264+ }
1265+
1266+}
1267Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java
1268===================================================================
1269--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java (revision 0)
1270+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java (revision 0)
1271@@ -0,0 +1,33 @@
1272+/*******************************************************************************
1273+ * Copyright (c) 2010 Intel Corporation. and others.
1274+ * All rights reserved. This program and the accompanying materials
1275+ * are made available under the terms of the Eclipse Public License v1.0
1276+ * which accompanies this distribution, and is available at
1277+ * http://www.eclipse.org/legal/epl-v10.html
1278+ *
1279+ * Contributors:
1280+ * Intel Corporation - initial API and implementation
1281+ ******************************************************************************/
1282+package org.eclipse.tm.internal.tcf.rse.shells;
1283+
1284+import org.eclipse.osgi.util.NLS;
1285+
1286+
1287+public class TCFLoginProperties extends NLS {
1288+ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.shells.TCFLoginProperties"; //$NON-NLS-1$
1289+ public static final String PropertySet_Description = "TCF Shell login word settings";
1290+ public static String TCFLOGIN_REQUIRED;
1291+ public static String TCFPWD_REQUIRED;
1292+ public static String TCFLOGIN_PROMPT;
1293+ public static String TCFPASSWORD_PROMPT;
1294+ public static String TCFCOMMAND_PROMPT;
1295+
1296+ static {
1297+ NLS.initializeMessages(BUNDLE_NAME, TCFLoginProperties.class);
1298+ }
1299+
1300+ private TCFLoginProperties() {
1301+ }
1302+
1303+
1304+}
1305Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java
1306===================================================================
1307--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java (revision 0)
1308+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java (revision 0)
1309@@ -0,0 +1,198 @@
1310+/*******************************************************************************
1311+ * Copyright (c) 2010 Intel Corporation. and others.
1312+ * All rights reserved. This program and the accompanying materials
1313+ * are made available under the terms of the Eclipse Public License v1.0
1314+ * which accompanies this distribution, and is available at
1315+ * http://www.eclipse.org/legal/epl-v10.html
1316+ *
1317+ * Contributors:
1318+ * Intel Corporation - initial API and implementation
1319+ ******************************************************************************/
1320+package org.eclipse.tm.internal.tcf.rse.shells;
1321+import java.util.ArrayList;
1322+import java.util.StringTokenizer;
1323+
1324+import org.eclipse.core.runtime.IPath;
1325+import org.eclipse.core.runtime.NullProgressMonitor;
1326+import org.eclipse.core.runtime.Path;
1327+import org.eclipse.rse.core.subsystems.ISubSystem;
1328+import org.eclipse.rse.internal.services.shells.TerminalServiceHostShell;
1329+import org.eclipse.rse.services.shells.IHostOutput;
1330+import org.eclipse.rse.services.shells.IHostShell;
1331+import org.eclipse.rse.services.shells.IHostShellChangeEvent;
1332+import org.eclipse.rse.services.shells.ParsedOutput;
1333+import org.eclipse.rse.services.shells.Patterns;
1334+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
1335+import org.eclipse.rse.subsystems.shells.core.model.ISystemOutputRemoteTypes;
1336+import org.eclipse.rse.subsystems.shells.core.model.RemoteError;
1337+import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
1338+import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
1339+import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput;
1340+import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ServiceCommandShell;
1341+
1342+@SuppressWarnings("restriction")
1343+public class TCFServiceCommandShell extends ServiceCommandShell {
1344+ private Patterns _patterns;
1345+ private String _workingDir;
1346+ private String _curCommand;
1347+ private IRemoteFileSubSystem _fs;
1348+
1349+ public TCFServiceCommandShell(IRemoteCmdSubSystem cmdSS,
1350+ IHostShell hostShell) {
1351+ super(cmdSS, hostShell);
1352+ // TODO Auto-generated constructor stub
1353+ _patterns = new Patterns();
1354+ _patterns.update("cmd"); //$NON-NLS-1$
1355+ ISubSystem[] sses = cmdSS.getHost().getSubSystems();
1356+ for (int i = 0; i < sses.length; i++)
1357+ {
1358+ if (sses[i] instanceof IRemoteFileSubSystem)
1359+ {
1360+ _fs = (IRemoteFileSubSystem)sses[i];
1361+ break;
1362+ }
1363+ }
1364+ }
1365+
1366+ public Object getContext()
1367+ {
1368+ String workingDir = _workingDir;
1369+ if (workingDir != null && workingDir.length() > 0)
1370+ {
1371+ try {
1372+ return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
1373+ }
1374+ catch (Exception e)
1375+ {
1376+ e.printStackTrace();
1377+ }
1378+ }
1379+ return null;
1380+
1381+ }
1382+
1383+ public String getContextString()
1384+ {
1385+ return _workingDir;
1386+ }
1387+
1388+ public void shellOutputChanged(IHostShellChangeEvent event)
1389+ {
1390+ IHostOutput[] lines = event.getLines();
1391+ boolean gotCommand = false;
1392+ ArrayList<RemoteOutput> outputs = new ArrayList<RemoteOutput>(lines.length);
1393+ for (int i = 0; i < lines.length; i++)
1394+ {
1395+ String line = lines[i].getString();
1396+ System.out.println("shellOutput:"+line);
1397+ System.out.printf("cur command %s\n", _curCommand);
1398+ if (line.endsWith(getPromptCommand())) {
1399+ continue; //ignore our synthetic prompt command
1400+ }
1401+ ParsedOutput parsedMsg = null;
1402+ if (!gotCommand && line.equals(_curCommand)) {
1403+ gotCommand = true;
1404+ continue; //ignore remote command echo
1405+ } else
1406+ {
1407+ try
1408+ {
1409+ // Bug 160202: Remote shell dies.
1410+ if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$
1411+ parsedMsg = _patterns.matchLine(line);
1412+
1413+ // Bug 160202: Remote shell dies.
1414+ if (_curCommand != null) {
1415+ String temp = _curCommand.trim();
1416+ StringTokenizer tokenizer = new StringTokenizer(temp);
1417+
1418+ if (tokenizer.countTokens() == 2) {
1419+ String token1 = tokenizer.nextToken();
1420+ String token2 = tokenizer.nextToken();
1421+
1422+ if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$
1423+ if (line.startsWith("total")) { //$NON-NLS-1$
1424+ parsedMsg = null;
1425+ }
1426+ }
1427+ }
1428+ }
1429+ }
1430+ }
1431+ catch (Throwable e) {
1432+ e.printStackTrace();
1433+ }
1434+ }
1435+
1436+ RemoteOutput output = null;
1437+
1438+ String type = "stdout"; //$NON-NLS-1$
1439+
1440+ if (parsedMsg != null) {
1441+ type = parsedMsg.type;
1442+ }
1443+
1444+ if (event.isError()) {
1445+ output = new RemoteError(this, type);
1446+ }
1447+ else {
1448+ output = new RemoteOutput(this, type);
1449+ }
1450+
1451+ output.setText(line);
1452+ if (parsedMsg != null)
1453+ {
1454+ String file = parsedMsg.file;
1455+ if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
1456+ {
1457+ _workingDir = file;
1458+ output.setAbsolutePath(_workingDir);
1459+ }
1460+ else if(_workingDir!=null)
1461+ {
1462+ IPath p = new Path(_workingDir).append(file);
1463+ output.setAbsolutePath(p.toString());
1464+ }
1465+ else
1466+ {
1467+ output.setAbsolutePath(file);
1468+ }
1469+ if (parsedMsg.line > 0){
1470+ output.setLine(parsedMsg.line);
1471+ }
1472+ }
1473+
1474+ addOutput(output);
1475+ outputs.add(output);
1476+ }
1477+
1478+ IRemoteOutput[] remoteOutputs = outputs.toArray(new IRemoteOutput[outputs.size()]);
1479+ notifyOutputChanged(remoteOutputs, false);
1480+ }
1481+
1482+ /**
1483+ * Return the prompt command, such that lines ending with the
1484+ * prompt command can be removed from output.
1485+ * Should be overridden in case the IHostShell used for this
1486+ * service is not an SshHostShell.
1487+ * @return String promptCommand
1488+ */
1489+ protected String getPromptCommand() {
1490+ IHostShell shell = getHostShell();
1491+ if (shell instanceof TerminalServiceHostShell) {
1492+ return ((TerminalServiceHostShell)shell).getPromptCommand();
1493+ }
1494+ //return something impossible such that nothing is ever matched
1495+ return "\uffff"; //$NON-NLS-1$
1496+ }
1497+
1498+ public void writeToShell(String cmd)
1499+ {
1500+ _curCommand = cmd;
1501+ _patterns.update(cmd);
1502+ System.out.println("execute: cmd " + cmd);
1503+ super.writeToShell(cmd);
1504+
1505+ }
1506+
1507+}
1508Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java
1509===================================================================
1510--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java (revision 0)
1511+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java (revision 0)
1512@@ -0,0 +1,148 @@
1513+/*******************************************************************************
1514+ * Copyright (c) 2010 Intel Corporation. and others.
1515+ * All rights reserved. This program and the accompanying materials
1516+ * are made available under the terms of the Eclipse Public License v1.0
1517+ * which accompanies this distribution, and is available at
1518+ * http://www.eclipse.org/legal/epl-v10.html
1519+ *
1520+ * Contributors:
1521+ * Intel Corporation - initial API and implementation
1522+ ******************************************************************************/
1523+package org.eclipse.tm.internal.tcf.rse.shells;
1524+
1525+import java.io.IOException;
1526+import java.io.InputStream;
1527+
1528+import org.eclipse.tm.tcf.protocol.IToken;
1529+import org.eclipse.tm.tcf.services.IStreams;
1530+import org.eclipse.tm.tcf.util.TCFTask;
1531+
1532+public class TCFTerminalInputStream extends InputStream {
1533+ private IStreams streams;
1534+ private boolean connected = true;;/* The stream is connected or not */
1535+ String is_id;
1536+ private int value;
1537+ private boolean bEof = false;;
1538+
1539+ public TCFTerminalInputStream(final IStreams streams, final String is_id) throws IOException{
1540+ if (streams == null)
1541+ throw new IOException("TCP streams is null");
1542+ this.streams = streams;
1543+ this.is_id = is_id;
1544+ }
1545+
1546+ /* read must be synchronized */
1547+ @Override
1548+ public synchronized int read() throws IOException {
1549+ // TODO Auto-generated method stub
1550+ if (!connected)
1551+ throw new IOException("istream is not connected");
1552+ if (bEof)
1553+ return -1;
1554+ try {
1555+ new TCFTask<Object>() {
1556+ public void run() {
1557+ streams.read(is_id, 1, new IStreams.DoneRead() {
1558+ public void doneRead(IToken token, Exception error, int lostSize,
1559+ byte[] data, boolean eos) {
1560+ // TODO Auto-generated method stub
1561+ if (error != null) {
1562+ error(error);
1563+ return;
1564+ }
1565+ bEof = eos;
1566+ if (data != null) {
1567+ value = (int)data[0];
1568+ if (data.length != 1) {
1569+ System.out.println("TCF inputstream read one byte, yet return more than one byte!");
1570+ }
1571+ }
1572+ else
1573+ value = -1;
1574+ done(this);
1575+ }
1576+ });
1577+ }
1578+ }.getIO();
1579+ }
1580+ catch (Exception e) {
1581+ e.printStackTrace();
1582+ throw new IOException(e);
1583+ }
1584+ return value;
1585+ }
1586+
1587+ private static class Buffer {
1588+ byte[] buf;
1589+ Buffer() {
1590+ }
1591+ }
1592+ private Buffer buffer;
1593+
1594+ public synchronized int read(byte b[], final int off, final int len) throws IOException {
1595+
1596+
1597+ if (!connected)
1598+ throw new IOException("istream is not connected");
1599+ if (bEof) return -1;
1600+ if (b == null) {
1601+ throw new NullPointerException();
1602+ } else if (off < 0 || len < 0 || len > b.length - off) {
1603+ throw new IndexOutOfBoundsException();
1604+ } else if (len == 0) {
1605+ return 0;
1606+ }
1607+ try {
1608+ new TCFTask<Buffer>() {
1609+ public void run() {
1610+ streams.read(is_id, len, new IStreams.DoneRead() {
1611+ public void doneRead(IToken token, Exception error, int lostSize,
1612+ byte[] data, boolean eos) {
1613+ // TODO Auto-generated method stub
1614+ if (error != null) {
1615+ error(error);
1616+ return;
1617+ }
1618+ bEof = eos;
1619+ if (data != null) {
1620+ buffer = new Buffer();
1621+ buffer.buf = data;
1622+
1623+ }
1624+ done(buffer);
1625+ }
1626+ });
1627+ }
1628+ }.getIO();
1629+
1630+ if (buffer.buf != null) {
1631+ int length = buffer.buf.length;
1632+ System.arraycopy(buffer.buf, 0, b, off, length);
1633+ System.out.println("read a line:"+ new String(b, off,length));
1634+ return length;
1635+ }
1636+ else if (bEof)
1637+ return -1;
1638+ else return 0;
1639+ } catch (Exception ee) {
1640+ ee.printStackTrace();
1641+ throw new IOException(ee);
1642+ }
1643+ }
1644+
1645+ public void close() throws IOException {
1646+ if (!connected) return;
1647+ new TCFTask<Object>() {
1648+ public void run() {
1649+ streams.disconnect(is_id, new IStreams.DoneDisconnect() {
1650+ public void doneDisconnect(IToken token, Exception error) {
1651+ connected = false;
1652+ done(this);
1653+ }
1654+ });
1655+ }
1656+ }.getIO();
1657+ connected = false;
1658+ }
1659+
1660+}
1661Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java
1662===================================================================
1663--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java (revision 0)
1664+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java (revision 0)
1665@@ -0,0 +1,110 @@
1666+/*******************************************************************************
1667+ * Copyright (c) 2010 Intel Corporation. and others.
1668+ * All rights reserved. This program and the accompanying materials
1669+ * are made available under the terms of the Eclipse Public License v1.0
1670+ * which accompanies this distribution, and is available at
1671+ * http://www.eclipse.org/legal/epl-v10.html
1672+ *
1673+ * Contributors:
1674+ * Intel Corporation - initial API and implementation
1675+ ******************************************************************************/
1676+package org.eclipse.tm.internal.tcf.rse.shells;
1677+
1678+import java.io.IOException;
1679+
1680+import java.io.OutputStream;
1681+
1682+import org.eclipse.tm.tcf.protocol.IToken;
1683+import org.eclipse.tm.tcf.services.IStreams;
1684+import org.eclipse.tm.tcf.util.TCFTask;
1685+
1686+public class TCFTerminalOutputStream extends OutputStream {
1687+
1688+ private final IStreams streams;
1689+ private boolean connected = true;
1690+ private boolean write_eof;
1691+ String os_id;
1692+
1693+ public TCFTerminalOutputStream(final IStreams streams, final String os_id) throws IOException{
1694+ if (streams == null) throw new IOException("istream is null");
1695+ this.streams = streams;
1696+ this.os_id = os_id;
1697+ write_eof = false;
1698+ }
1699+
1700+ @Override
1701+ public synchronized void write(final byte b[], final int off, final int len) throws IOException {
1702+ /* If eof is written, we can't write anything into the stream */
1703+ if (!connected || write_eof)
1704+ throw new IOException("stream is not connected or write_eof already!");
1705+ System.out.println("write line: " + new String(b, off, len) );
1706+ try {
1707+ new TCFTask<Object>() {
1708+ public void run() {
1709+ streams.write(os_id, b, off, len, new IStreams.DoneWrite() {
1710+ public void doneWrite(IToken token, Exception error) {
1711+ // TODO: stream write error handling
1712+ if (error != null) error(error);
1713+ done(this);
1714+ }
1715+ });
1716+
1717+ }
1718+ }.getIO();
1719+ }
1720+ catch (Exception e)
1721+ {
1722+ throw new IOException(e);
1723+ }
1724+ }
1725+
1726+ @Override
1727+ public synchronized void write(int b) throws IOException {
1728+
1729+ // TODO Auto-generated method stub
1730+ try {
1731+ final byte[] buf = new byte[1];
1732+ buf[0] = (byte)b;
1733+ this.write(buf, 0, 1);
1734+ }
1735+ catch(IOException ioe) {
1736+ ioe.printStackTrace();
1737+ throw new IOException(ioe);
1738+ }
1739+
1740+ }
1741+
1742+ /* close must be called --Need to reconsider it in the future*/
1743+ public void close() throws IOException {
1744+ if (!connected)
1745+ return;
1746+ try {
1747+ new TCFTask<Object>() {
1748+ public void run() {
1749+ streams.eos(os_id, new IStreams.DoneEOS() {
1750+ public void doneEOS(IToken token, Exception error) {
1751+ // TODO Auto-generated method stub
1752+ write_eof = true;
1753+ done(this);
1754+ }
1755+ });
1756+ }
1757+ }.getIO();
1758+ new TCFTask<Object>() {
1759+ public void run() {
1760+ streams.disconnect(os_id, new IStreams.DoneDisconnect() {
1761+ public void doneDisconnect(IToken token, Exception error) {
1762+ connected = false;
1763+ done(this);
1764+ }
1765+ });
1766+
1767+ }
1768+ }.getIO();
1769+ }
1770+ catch(Exception e) {
1771+ throw new IOException(e);
1772+ }
1773+ }
1774+
1775+}
1776Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties
1777===================================================================
1778--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties (revision 0)
1779+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties (revision 0)
1780@@ -0,0 +1,3 @@
1781+TCFPlugin_Unexpected_Exception=Unexpected {0}: {1}
1782+TCFShellService_Name=TCF Shell Service
1783+TCFShellService_Description=TCF Shell Service Description
1784Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java
1785===================================================================
1786--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java (revision 0)
1787+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java (revision 0)
1788@@ -0,0 +1,70 @@
1789+/*******************************************************************************
1790+ * Copyright (c) 2010 Intel Corporation. and others.
1791+ * All rights reserved. This program and the accompanying materials
1792+ * are made available under the terms of the Eclipse Public License v1.0
1793+ * which accompanies this distribution, and is available at
1794+ * http://www.eclipse.org/legal/epl-v10.html
1795+ *
1796+ * Contributors:
1797+ * Intel Corporation - initial API and implementation
1798+ ******************************************************************************/
1799+package org.eclipse.tm.internal.tcf.rse.shells;
1800+
1801+import org.eclipse.rse.core.model.IHost;
1802+import org.eclipse.rse.core.subsystems.IConnectorService;
1803+import org.eclipse.rse.core.subsystems.ISubSystem;
1804+import org.eclipse.rse.services.shells.IHostShell;
1805+import org.eclipse.rse.services.shells.IShellService;
1806+import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
1807+import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IServiceCommandShell;
1808+import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem;
1809+import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystemConfiguration;
1810+import org.eclipse.tm.internal.tcf.rse.*;
1811+import org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalService;
1812+
1813+
1814+public class TCFShellSubSystemConfiguration extends
1815+ ShellServiceSubSystemConfiguration {
1816+
1817+ public TCFShellSubSystemConfiguration() {
1818+ super();
1819+ }
1820+
1821+ /**
1822+ * Instantiate and return an instance of OUR subsystem.
1823+ * Do not populate it yet though!
1824+ * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost)
1825+ */
1826+ public ISubSystem createSubSystemInternal(IHost host)
1827+ {
1828+ TCFConnectorService connectorService = (TCFConnectorService)getConnectorService(host);
1829+ ISubSystem subsys = new ShellServiceSubSystem(host, connectorService, createShellService(host));
1830+ return subsys;
1831+ }
1832+
1833+ public IConnectorService getConnectorService(IHost host) {
1834+ return TCFConnectorServiceManager.getInstance().getConnectorService(host, getServiceImplType());
1835+}
1836+
1837+ public void setConnectorService(IHost host,
1838+ IConnectorService connectorService) {
1839+ TCFConnectorServiceManager.getInstance().setConnectorService(host, getServiceImplType(), connectorService);
1840+ }
1841+
1842+ public Class<ITCFSubSystem> getServiceImplType()
1843+ {
1844+ return ITCFSubSystem.class;
1845+ }
1846+
1847+ public IServiceCommandShell createRemoteCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) {
1848+ return new TCFServiceCommandShell(cmdSS, hostShell);
1849+ }
1850+
1851+ public IShellService createShellService(IHost host) {
1852+ TCFConnectorService cserv = (TCFConnectorService)getConnectorService(host);
1853+
1854+ return (IShellService) (new TCFTerminalService(cserv)).getAdapter(IShellService.class);
1855+ }
1856+
1857+
1858+}
1859Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties
1860===================================================================
1861--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties (revision 0)
1862+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties (revision 0)
1863@@ -0,0 +1,3 @@
1864+TCFConnectorService_Name=TCF Connector Service
1865+TCFConnectorService_Description=Target Communication Framework
1866+PropertySet_Description=TCF login properties. Set these according to your remote system's login prompts.
1867\ No newline at end of file
1868Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties
1869===================================================================
1870--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties (revision 0)
1871+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties (revision 0)
1872@@ -0,0 +1,3 @@
1873+TCFPlugin_Unexpected_Exception=Unexpected {0}: {1}
1874+TCFTerminalService_Name=TCF Terminal Service
1875+TCFTerminalService_Description=TCF Terminal Service Description
1876Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java
1877===================================================================
1878--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java (revision 0)
1879+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java (revision 0)
1880@@ -0,0 +1,64 @@
1881+/*******************************************************************************
1882+ * Copyright (c) 2010 Intel Corporation. and others.
1883+ * All rights reserved. This program and the accompanying materials
1884+ * are made available under the terms of the Eclipse Public License v1.0
1885+ * which accompanies this distribution, and is available at
1886+ * http://www.eclipse.org/legal/epl-v10.html
1887+ *
1888+ * Contributors:
1889+ * Intel Corporation - initial API and implementation
1890+ ******************************************************************************/
1891+package org.eclipse.tm.internal.tcf.rse.terminals;
1892+
1893+import org.eclipse.rse.core.model.IHost;
1894+import org.eclipse.rse.core.subsystems.IConnectorService;
1895+import org.eclipse.rse.core.subsystems.ISubSystem;
1896+import org.eclipse.rse.services.terminals.ITerminalService;
1897+import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem;
1898+import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystemConfiguration;
1899+import org.eclipse.tm.internal.tcf.rse.ITCFSubSystem;
1900+import org.eclipse.tm.internal.tcf.rse.TCFConnectorService;
1901+import org.eclipse.tm.internal.tcf.rse.TCFConnectorServiceManager;
1902+
1903+public class TCFTerminalServiceSubSystemConfiguration extends
1904+ TerminalServiceSubSystemConfiguration {
1905+
1906+
1907+ /**
1908+ * Instantiate and return an instance of OUR subsystem. Do not populate it
1909+ * yet though!
1910+ *
1911+ * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost)
1912+ */
1913+ public ISubSystem createSubSystemInternal(IHost host) {
1914+ TCFConnectorService connectorService = (TCFConnectorService) getConnectorService(host);
1915+ ISubSystem subsys = new TerminalServiceSubSystem(host,
1916+ connectorService, createTerminalService(host));
1917+ return subsys;
1918+ }
1919+
1920+ /**
1921+ * @inheritDoc
1922+ * @since 1.0
1923+ */
1924+ public ITerminalService createTerminalService(IHost host) {
1925+ TCFConnectorService cserv = (TCFConnectorService) getConnectorService(host);
1926+ return new TCFTerminalService(cserv);
1927+ }
1928+
1929+ public IConnectorService getConnectorService(IHost host) {
1930+ return TCFConnectorServiceManager.getInstance().getConnectorService(
1931+ host, getServiceImplType());
1932+ }
1933+
1934+ public void setConnectorService(IHost host,
1935+ IConnectorService connectorService) {
1936+ TCFConnectorServiceManager.getInstance().setConnectorService(host,
1937+ getServiceImplType(), connectorService);
1938+ }
1939+
1940+ public Class<ITCFSubSystem> getServiceImplType() {
1941+ return ITCFSubSystem.class;
1942+ }
1943+
1944+}
1945Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java
1946===================================================================
1947--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java (revision 0)
1948+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java (revision 0)
1949@@ -0,0 +1,36 @@
1950+/*******************************************************************************
1951+ * Copyright (c) 2010 Intel Corporation. and others.
1952+ * All rights reserved. This program and the accompanying materials
1953+ * are made available under the terms of the Eclipse Public License v1.0
1954+ * which accompanies this distribution, and is available at
1955+ * http://www.eclipse.org/legal/epl-v10.html
1956+ *
1957+ * Contributors:
1958+ * Intel Corporation - initial API and implementation
1959+ ******************************************************************************/
1960+package org.eclipse.tm.internal.tcf.rse.terminals;
1961+
1962+import org.eclipse.osgi.util.NLS;
1963+
1964+public class TCFTerminalServiceResources extends NLS {
1965+ private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalServiceResources"; //$NON-NLS-1$
1966+
1967+ public static String TCFPlugin_Unexpected_Exception;
1968+
1969+ public static String TCFTerminalService_Description;
1970+
1971+ public static String TCFTerminalService_Name;
1972+
1973+ static {
1974+ // initialize resource bundle
1975+ NLS.initializeMessages(BUNDLE_NAME, TCFTerminalServiceResources.class);
1976+ }
1977+
1978+ private TCFTerminalServiceResources(){
1979+
1980+ }
1981+
1982+}
1983+
1984+
1985+
1986Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java
1987===================================================================
1988--- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java (revision 0)
1989+++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java (revision 0)
1990@@ -0,0 +1,57 @@
1991+/*******************************************************************************
1992+ * Copyright (c) 2010 Intel Corporation. and others.
1993+ * All rights reserved. This program and the accompanying materials
1994+ * are made available under the terms of the Eclipse Public License v1.0
1995+ * which accompanies this distribution, and is available at
1996+ * http://www.eclipse.org/legal/epl-v10.html
1997+ *
1998+ * Contributors:
1999+ * Intel Corporation - initial API and implementation
2000+ ******************************************************************************/
2001+package org.eclipse.tm.internal.tcf.rse.terminals;
2002+
2003+import org.eclipse.core.runtime.IProgressMonitor;
2004+
2005+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
2006+import org.eclipse.rse.services.terminals.AbstractTerminalService;
2007+import org.eclipse.rse.services.terminals.ITerminalShell;
2008+import org.eclipse.tm.internal.tcf.rse.ITCFSessionProvider;
2009+import org.eclipse.tm.internal.tcf.rse.shells.TCFTerminalShell;
2010+
2011+public class TCFTerminalService extends AbstractTerminalService{
2012+ private final ITCFSessionProvider fSessionProvider;
2013+
2014+ /**
2015+ * Return the TCF property set, and fill it with default values if it has
2016+ * not been created yet. Extender may override in order to set different
2017+ * default values.
2018+ *
2019+ * @return a property set holding properties understood by the TCF
2020+ * connector service.
2021+ */
2022+ public ITerminalShell launchTerminal(String ptyType, String encoding,
2023+ String[] environment, String initialWorkingDirectory,
2024+ String commandToRun, IProgressMonitor monitor)
2025+ throws SystemMessageException {
2026+ // TODO Auto-generated method stub
2027+ TCFTerminalShell hostShell = new TCFTerminalShell(fSessionProvider, ptyType, encoding, environment, initialWorkingDirectory, commandToRun);
2028+ return hostShell;
2029+ }
2030+
2031+
2032+ public TCFTerminalService(ITCFSessionProvider sessionProvider) {
2033+ fSessionProvider = sessionProvider;
2034+ }
2035+
2036+ public ITCFSessionProvider getSessionProvider() {
2037+ return fSessionProvider;
2038+ }
2039+ @Override
2040+ public String getName() {
2041+ return TCFTerminalServiceResources.TCFTerminalService_Name;
2042+ }
2043+ @Override
2044+ public String getDescription() {
2045+ return TCFTerminalServiceResources.TCFTerminalService_Description;
2046+ }
2047+}
2048Index: plugins/org.eclipse.tm.tcf.rse/plugin.xml
2049===================================================================
2050--- plugins/org.eclipse.tm.tcf.rse/plugin.xml (revision 1190)
2051+++ plugins/org.eclipse.tm.tcf.rse/plugin.xml (working copy)
2052@@ -37,6 +37,22 @@
2053 vendor="Wind River">
2054 </configuration>
2055 </extension>
2056+ <extension
2057+ point="org.eclipse.rse.core.subsystemConfigurations">
2058+ <configuration
2059+ category="shells"
2060+ class="org.eclipse.tm.internal.tcf.rse.shells.TCFShellSubSystemConfiguration"
2061+ description="Shells"
2062+ icon="icons/system-processes.gif"
2063+ iconlive="icons/system-processes-live.gif"
2064+ id="org.eclipse.tm.tcf.rse.Shells"
2065+ name="Shells"
2066+ priority="200"
2067+ serviceType="_ssh._tcp;_sftp-ssh._tcp"
2068+ systemTypeIds="org.eclipse.tm.tcf.rse.systemType"
2069+ vendor="Intel">
2070+ </configuration>
2071+ </extension>
2072 <extension
2073 point="org.eclipse.rse.core.subsystemConfigurations">
2074 <configuration
2075@@ -52,6 +68,22 @@
2076 vendor="Wind River">
2077 </configuration>
2078 </extension>
2079+ <extension
2080+ point="org.eclipse.rse.core.subsystemConfigurations">
2081+ <configuration
2082+ category="terminals"
2083+ class="org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalServiceSubSystemConfiguration"
2084+ description="TCF Terminal Service Description"
2085+ icon="icons/system-processes.gif"
2086+ iconlive="icons/system-processes-live.gif"
2087+ id="org.eclipse.tm.tcf.rse.Terminals"
2088+ name="Terminals"
2089+ priority="200"
2090+ serviceType="_ssh._tcp;_sftp-ssh._tcp"
2091+ systemTypeIds="org.eclipse.tm.tcf.rse.systemType"
2092+ vendor="Intel">
2093+ </configuration>
2094+ </extension>
2095 <extension point="org.eclipse.core.runtime.adapters">
2096 <factory
2097 class="org.eclipse.tm.internal.tcf.rse.processes.TCFSystemViewProcessAdapterFactory"
diff --git a/tcf/readme b/tcf/readme
new file mode 100644
index 0000000..95529a1
--- /dev/null
+++ b/tcf/readme
@@ -0,0 +1,175 @@
1The current implmentaion is based on TCF contribution 0.3.0(SVN revision 998).
2(svn://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/tags/0.3.0)
3
4I. Build
5================================
61. Check out the TCF contribution code version 0.3.0 from TCF SVN
7repository.
8
9svn co svn://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/tags/0.3.0 tcf_local/
10
11To use SVN inside Intel firewall, please use tsocks.
12(http://opensource.intel.com/linux-wiki/LinuxDesktop?highlight=%28tsocks%29#head-7dfffbdc3bda005c74d26ed2af467643dc89844b)
13
142. Apply the patches.
15
16cd tcf_local
17patch -p0 < ../terminals_agent.patch
18patch -p0 < ../terminals_plugin.patch
19patch -p0 < ../lke_rse_tcf.patch
20
21After the successful patch, only the following components are useful
22for CDT remote debug. Other plugins are not required.
23
24plugins/org.eclipse.tm.tcf/
25 TCF plugin for Eclipse integration.
26
27plugins/org.eclipse.tm.tcf.core/
28 TCF Java framework and intefaces for standard services.
29
30plugins/org.eclipse.tm.tcf.rse/
31 RSE plugin using TCF.
32
33plugins/org.eclipse.tm.tcf.terminals/
34 TCF Java interfaces & eclipse integration for terminal service.
35
36agent/
37 TCF reference agent for standard services.
38
39org.eclipse.tm.tcf.terminals.agent/
40 TCF reference agent with addtional terminal service.
41
423. Build the agent on remote target side.
43(This step can be skipped if the agent is already included in
44the poky generated image)
45
46 1) copy the directories "agent/" or "org.eclipse.tm.tcf.terminals.agent/"
47 to the remote target machine.
48 2) cd "org.eclipse.tm.tcf.terminals.agent/"
49 3) make
50
514. Import the eclipse plugins on host side.
52 1) In eclipse, choose from menu
53 File->Import->General->"Existing projects into workspace",
54 browse to the "tcf_local/plugins" direcotry, and click "OK".
55 2) Check the following plugins:
56 org.eclipse.tm.tcf
57 org.eclipse.tm.tcf.core
58 org.eclipse.tm.tcf.rse
59 org.eclipse.tm.tcf.terminals
60 3) Click "Finish" to import the eclipse plugins.
61 4) Select Project->"Build All" to build the plugins. If the
62 build process complains about missing dependent plugin,
63 please see Note 2 below.
64
65
66II. Usage
67================================
68On remote target side
691. Build & run tcf agent on target.
70(This step can be skipped if the agent is already included in
71the poky generated iamge)
72
73 - cd to direcotry "org.eclipse.tm.tcf.terminals.agent".
74 - type "make" to build the tcf agent.
75 - run the tcf agent with root privilege on target.
76 e.g. sudo obj/GNU/Linux/x86_64/Debug/agent -Llog.txt
77
78On Host side
792. Launch the RSE plugin for TCF(org.eclipse.tm.tcf.rse).
80Make sure the org.eclipse.tm.tcf.terminals plugin is launched along
81with that plugin.
82
833. CDT remote debug.
84 1) Choose from menu Run->"Debug Configurations..."->
85 "C/C++ Remote Application", and click the "New launch configuration"
86 button.
87 2) In the "Main" tab, click "New..." button and it will launch a
88 "New Connection" wizard.
89 3) In the "New Connection" dialogue, choose "TCF" as system type and
90 click "Next".
91 4) Input the ip address of the remote target machine in "Host name:",
92 choose an arbitary unique name for "Connection name:", and click
93 "Next".
94 5) Make sure "org.eclipse.tm.tcf.rse.Terminals" is checked, make sure
95 you have input the correct TCF session properties in the TCF
96 Connector Service and click "Next". (See Note 3 below)
97 6) Make sure "org.eclipse.tm.tcf.rse.Files" is checked and click "Next".
98 7) Make sure "org.eclipse.tm.tcf.rse.Processes" is checked and click
99 "Next".
100 8) Make sure "org.eclipse.tm.tcf.rse.Shells" is checked, make sure you
101 have input the correct TCF session properties in the TCF Connector
102 Service. (See Note 3 below)
103 9) Click "Finish" to close the "New Connection" dialogue.
104 10) In the "Main" tab, choose the connection just created from the
105 "Connection" drop-list.
106 11) In the "Main" tab, enter the "Remote Absolute File Path for
107 C/C++ Application". This is where the debugged application to be
108 downloaded to the remote target side. e.g. "/tmp/helloworld".
109 12) In the "Debugger" tab, please choose the correct "GDB debugger".
110 Usually you should choose the cross-gdb which matches the host
111 and target machine. (see Known limitations 2.)
112 13) Click "Debug".
113 14) In the popped up "Enter Password" dialogue, enter the correct
114 "User ID" and "Password" and click "OK". It will be used to
115 login to the remote target machine.
116
117III. Note
118================================
1191. Sometimes the eclispe would report a exception of
120 "Java.lang.OutOfMemoryError: PermGen space" and the application hangs.
121 This is because the JVM garbage collection doesn't clean the permenant
122 generation space, which is used to store meta-data descriptions of
123 classes. To fix this problem, please add "-XX:MaxPermSize=256M" to the
124 "VM arguements" when launching the plug-ins.
125
1262. The following eclipse plugins should be installed before building
127 TCF related plugins.
128
129 CDT v6.0.2: http://download.eclipse.org/tools/cdt/releases/galileo
130 RSE v3.1.2: http://download.eclipse.org/dsdp/tm/updates/3.1/
131
1323. TCF Connector Service Properties.
133The TCF connector service properties are used for the TCF based RSE
134terminals and shells subsystems.
135
136To change these properties, click the "TCF Connection Settings" under
137the "Available Services" in the wizard, in the right, a list of
138properties is shown and ready for change.
139
140Here is a list of the properties:
141
142 - Command.Prompt
143 This is a string of which the shell/terminal prompt string on the remote
144 target system will end with. The default value is
145 "# "(Pay attention there is a space after the '#').
146
147 - Login.Prompt
148 This is a string of which the login prompt string on the remote target
149 system will end with. The default value is "ogin: "(Pay attention
150 there is a space after the ':').
151
152 - Login.Required
153 Set to "true" if the remote target system requires the user to input
154 login user name for terminal/shell services. Otherwise set to "false".
155 The default value is "true".
156
157 - Password.Prompt
158 This is a string of which the password prompt string on the remote target
159 system will end with. The default value is "assword: ".(Pay attention
160 there is a space after the ':')
161
162 - Pwd.Required
163 Setting to "true" if the remote target system requires the user to input
164 password for terminal/shell services. Otherwise set to "false". The
165 default value is "false".
166
167IV. Known limitations
168================================
1691. Authentication retry is not implemented. The user only has one chance to
170 input the correct password. If it fails, the user needs to re-launch
171 shell/terminal. If the user has checked the "Save password" in the prompt
172 dialogue, it needs to be disconnected and re-connected.
173
1742. Users have to set the correct cross-gdb debugger manually in the
175 "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 @@
1Index: org.eclipse.tm.tcf.terminals.agent/terminals.c
2===================================================================
3--- org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0)
4+++ org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0)
5@@ -0,0 +1,860 @@
6+/*******************************************************************************
7+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
8+ * All rights reserved. This program and the accompanying materials
9+ * are made available under the terms of the Eclipse Public License v1.0
10+ * and Eclipse Distribution License v1.0 which accompany this distribution.
11+ * The Eclipse Public License is available at
12+ * http://www.eclipse.org/legal/epl-v10.html
13+ * and the Eclipse Distribution License is available at
14+ * http://www.eclipse.org/org/documents/edl-v10.php.
15+ *
16+ * Contributors:
17+ * Wind River Systems - initial API and implementation
18+ * Intel - implemented terminals service
19+ *******************************************************************************/
20+
21+/*
22+ * Sample TCF service implementation.
23+ */
24+
25+#include <config.h>
26+#include <stdlib.h>
27+#include <stdio.h>
28+#include <string.h>
29+#include <errno.h>
30+#include <fcntl.h>
31+#include <signal.h>
32+#include <assert.h>
33+#include <termios.h>
34+#ifndef TIOCGWINSZ
35+#include <sys/ioctl.h>
36+#endif
37+#include <framework/myalloc.h>
38+#include <framework/protocol.h>
39+#include <framework/trace.h>
40+#include <framework/context.h>
41+#include <framework/json.h>
42+#include <framework/asyncreq.h>
43+#include <framework/exceptions.h>
44+#include <framework/waitpid.h>
45+#include <framework/signames.h>
46+#include <services/streamsservice.h>
47+#include <terminals.h>
48+
49+#define TERMINALS_DEBUG 1
50+
51+#define TERMINALS_NO_LOGIN 0
52+
53+static const char * TERMINALS = "Terminals";
54+
55+#if defined(WIN32)
56+# include <tlhelp32.h>
57+# ifdef _MSC_VER
58+# pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union (in winternl.h) */
59+# include <winternl.h>
60+# else
61+# include <ntdef.h>
62+# endif
63+# ifndef STATUS_INFO_LENGTH_MISMATCH
64+# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
65+# endif
66+# ifndef SystemHandleInformation
67+# define SystemHandleInformation 16
68+# endif
69+# error("unsupported WIN32!")
70+#elif defined(_WRS_KERNEL)
71+# include <symLib.h>
72+# include <sysSymTbl.h>
73+# include <ioLib.h>
74+# include <ptyDrv.h>
75+# include <taskHookLib.h>
76+# error("unsupported WRS!")
77+#else
78+# include <sys/stat.h>
79+# include <unistd.h>
80+# include <dirent.h>
81+# if TERMINALS_NO_LOGIN
82+# define TERM_LAUNCH_EXEC "/bin/bash"
83+# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, NULL}
84+# else
85+# define TERM_LAUNCH_EXEC "/bin/login"
86+# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, "-p", NULL}
87+# endif
88+#endif
89+
90+#define PIPE_SIZE 0x1000
91+#define TERM_PROP_DEF_SIZE 256
92+
93+typedef struct Terminal
94+{
95+ LINK link;
96+ int pid; /*pid of the login process of the terminal*/
97+ TCFBroadcastGroup * bcg;
98+ int inp;
99+ int out;
100+ int err;
101+ struct TerminalInput * inp_struct;
102+ struct TerminalOutput * out_struct;
103+ struct TerminalOutput * err_struct;
104+ char inp_id[256];
105+ char out_id[256];
106+ char err_id[256];
107+
108+ char pty_type[TERM_PROP_DEF_SIZE];
109+ char encoding[TERM_PROP_DEF_SIZE];
110+ unsigned long width;
111+ unsigned long height;
112+ long exit_code;
113+
114+ Channel *channel;
115+} Terminal;
116+
117+typedef struct TerminalOutput
118+{
119+ Terminal * prs;
120+ AsyncReqInfo req;
121+ int req_posted;
122+ char buf[PIPE_SIZE];
123+ size_t buf_pos;
124+ int eos;
125+ VirtualStream * vstream;
126+} TerminalOutput;
127+
128+typedef struct TerminalInput
129+{
130+ Terminal * prs;
131+ AsyncReqInfo req;
132+ int req_posted;
133+ char buf[PIPE_SIZE];
134+ size_t buf_pos;
135+ size_t buf_len;
136+ int eos;
137+ VirtualStream * vstream;
138+} TerminalInput;
139+
140+#define link2term(A) ((Terminal *)((char *)(A) - offsetof(Terminal, link)))
141+
142+static LINK terms_list;
143+#if defined(_WRS_KERNEL)
144+static SEM_ID prs_list_lock = NULL;
145+#endif
146+
147+static Terminal * find_terminal(int pid)
148+{
149+ LINK * qhp = &terms_list;
150+ LINK * qp = qhp->next;
151+
152+ while (qp != qhp) {
153+ Terminal * prs = link2term(qp);
154+ if (prs->pid == pid)
155+ return prs;
156+ qp = qp->next;
157+ }
158+ return NULL;
159+}
160+
161+static char * tid2id(int tid)
162+{
163+ static char s[64];
164+ char * p = s + sizeof(s);
165+ unsigned long n = (long) tid;
166+ *(--p) = 0;
167+ do {
168+ *(--p) = (char) (n % 10 + '0');
169+ n = n / 10;
170+ } while (n != 0);
171+
172+ *(--p) = 'T';
173+ return p;
174+}
175+
176+static int id2tid(const char * id)
177+{
178+ int tid = 0;
179+ if (id == NULL)
180+ return 0;
181+ if (id[0] != 'T')
182+ return 0;
183+ if (id[1] == 0)
184+ return 0;
185+ tid = (unsigned) strtol(id + 1, (char **) &id, 10);
186+ if (id[0] != 0)
187+ return 0;
188+ return tid;
189+}
190+
191+static void write_context(OutputStream * out, int tid)
192+{
193+ Terminal * prs = find_terminal(tid);
194+
195+ write_stream(out, '{');
196+
197+ if (prs != NULL) {
198+ if (*prs->pty_type) {
199+ json_write_string(out, "PtyType");
200+ write_stream(out, ':');
201+ json_write_string(out, prs->pty_type);
202+ write_stream(out, ',');
203+ }
204+
205+ if (*prs->encoding) {
206+ json_write_string(out, "Encoding");
207+ write_stream(out, ':');
208+ json_write_string(out, prs->encoding);
209+ write_stream(out, ',');
210+ }
211+
212+ json_write_string(out, "Width");
213+ write_stream(out, ':');
214+ json_write_ulong(out, prs->width);
215+ write_stream(out, ',');
216+
217+ json_write_string(out, "Height");
218+ write_stream(out, ':');
219+ json_write_ulong(out, prs->height);
220+ write_stream(out, ',');
221+
222+ if (*prs->inp_id) {
223+ json_write_string(out, "StdInID");
224+ write_stream(out, ':');
225+ json_write_string(out, prs->inp_id);
226+ write_stream(out, ',');
227+ }
228+ if (*prs->out_id) {
229+ json_write_string(out, "StdOutID");
230+ write_stream(out, ':');
231+ json_write_string(out, prs->out_id);
232+ write_stream(out, ',');
233+ }
234+ if (*prs->err_id) {
235+ json_write_string(out, "StdErrID");
236+ write_stream(out, ':');
237+ json_write_string(out, prs->err_id);
238+ write_stream(out, ',');
239+ }
240+ }
241+
242+ json_write_string(out, "ID");
243+ write_stream(out, ':');
244+ json_write_string(out, tid2id(tid));
245+
246+ write_stream(out, '}');
247+}
248+
249+static void send_event_terminal_exited(OutputStream * out, Terminal * prs)
250+{
251+ write_stringz(out, "E");
252+ write_stringz(out, TERMINALS);
253+ write_stringz(out, "exited");
254+
255+ json_write_string(out, tid2id(prs->pid));
256+ write_stream(out, 0);
257+
258+ json_write_ulong(out, prs->exit_code);
259+ write_stream(out, 0);
260+
261+ write_stream(out, MARKER_EOM);
262+}
263+
264+static void send_event_terminal_win_size_changed(OutputStream * out,
265+ Terminal * prs)
266+{
267+ write_stringz(out, "E");
268+ write_stringz(out, TERMINALS);
269+ write_stringz(out, "winSizeChanged");
270+
271+ json_write_string(out, tid2id(prs->pid));
272+ write_stream(out, 0);
273+
274+ json_write_long(out, prs->width);
275+ write_stream(out, 0);
276+
277+ json_write_long(out, prs->height);
278+ write_stream(out, 0);
279+
280+ write_stream(out, MARKER_EOM);
281+}
282+
283+static int kill_term(Terminal *term)
284+{
285+ int err = 0;
286+
287+#if defined(WIN32)
288+ HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, term->pid);
289+ if (h == NULL)
290+ {
291+ err = set_win32_errno(GetLastError());
292+ }
293+ else
294+ {
295+ if (!TerminateProcess(h, 1)) err = set_win32_errno(GetLastError());
296+ if (!CloseHandle(h) && !err) err = set_win32_errno(GetLastError());
297+ }
298+#else
299+ if (kill(term->pid, SIGTERM) < 0)
300+ err = errno;
301+#endif
302+ return err;
303+}
304+
305+static void command_exit(char * token, Channel * c)
306+{
307+ int err = 0;
308+ char id[256];
309+ unsigned tid;
310+ Terminal *term = NULL;
311+
312+ json_read_string(&c->inp, id, sizeof(id));
313+ if (read_stream(&c->inp) != 0)
314+ exception(ERR_JSON_SYNTAX);
315+ if (read_stream(&c->inp) != MARKER_EOM)
316+ exception(ERR_JSON_SYNTAX);
317+
318+ tid = id2tid(id);
319+ write_stringz(&c->out, "R");
320+ write_stringz(&c->out, token);
321+
322+ if (tid == 0) {
323+ err = ERR_INV_CONTEXT;
324+ } else {
325+ term = find_terminal(tid);
326+ if (term == NULL) {
327+ err = ERR_INV_CONTEXT;
328+ } else {
329+ err = kill_term(term);
330+ }
331+ }
332+
333+ write_errno(&c->out, err);
334+ write_stream(&c->out, MARKER_EOM);
335+}
336+
337+static void terminal_exited(Terminal * prs)
338+{
339+ Trap trap;
340+
341+ if (set_trap(&trap)) {
342+ send_event_terminal_exited(&prs->bcg->out, prs);
343+ clear_trap(&trap);
344+ } else {
345+ trace(LOG_ALWAYS, "Exception sending terminal exited event: %d %s",
346+ trap.error, errno_to_str(trap.error));
347+ }
348+
349+#if defined(_WRS_KERNEL)
350+ semTake(prs_list_lock, WAIT_FOREVER);
351+#endif
352+ list_remove(&prs->link);
353+ close(prs->inp);
354+ close(prs->out);
355+ if (prs->out != prs->err)
356+ close(prs->err);
357+ if (prs->inp_struct) {
358+ TerminalInput * inp = prs->inp_struct;
359+ if (!inp->req_posted) {
360+ virtual_stream_delete(inp->vstream);
361+ loc_free(inp);
362+ } else {
363+ inp->prs = NULL;
364+ }
365+ }
366+ if (prs->out_struct)
367+ prs->out_struct->prs = NULL;
368+ if (prs->err_struct)
369+ prs->err_struct->prs = NULL;
370+ loc_free(prs);
371+#if defined(_WRS_KERNEL)
372+ semGive(prs_list_lock);
373+#endif
374+}
375+
376+static void terminal_input_streams_callback(VirtualStream * stream,
377+ int event_code, void * args)
378+{
379+ TerminalInput * inp = (TerminalInput *) args;
380+
381+ assert(inp->vstream == stream);
382+ if (!inp->req_posted) {
383+ if (inp->buf_pos >= inp->buf_len && !inp->eos) {
384+ inp->buf_pos = inp->buf_len = 0;
385+ virtual_stream_get_data(stream, inp->buf, sizeof(inp->buf),
386+ &inp->buf_len, &inp->eos);
387+ }
388+ if (inp->buf_pos < inp->buf_len) {
389+ inp->req.u.fio.bufp = inp->buf + inp->buf_pos;
390+ inp->req.u.fio.bufsz = inp->buf_len - inp->buf_pos;
391+ inp->req_posted = 1;
392+ async_req_post(&inp->req);
393+ }
394+ }
395+}
396+
397+static void write_terminal_input_done(void * x)
398+{
399+ AsyncReqInfo * req = (AsyncReqInfo *) x;
400+ TerminalInput * inp = (TerminalInput *) req->client_data;
401+
402+ inp->req_posted = 0;
403+ if (inp->prs == NULL) {
404+ /* Process has exited */
405+ virtual_stream_delete(inp->vstream);
406+ loc_free(inp);
407+ } else {
408+ int wr = inp->req.u.fio.rval;
409+
410+ if (wr < 0) {
411+ int err = inp->req.error;
412+ trace(LOG_ALWAYS, "Can't write terminal input stream: %d %s", err,
413+ errno_to_str(err));
414+ inp->buf_pos = inp->buf_len = 0;
415+ } else {
416+ inp->buf_pos += wr;
417+ }
418+
419+ terminal_input_streams_callback(inp->vstream, 0, inp);
420+ }
421+}
422+
423+static void write_terminal_input(Terminal * prs)
424+{
425+ TerminalInput * inp = prs->inp_struct = (TerminalInput *) loc_alloc_zero(
426+ sizeof(TerminalInput));
427+ inp->prs = prs;
428+ inp->req.client_data = inp;
429+ inp->req.done = write_terminal_input_done;
430+ inp->req.type = AsyncReqWrite;
431+ inp->req.u.fio.fd = prs->inp;
432+ virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE,
433+ VS_ENABLE_REMOTE_WRITE, terminal_input_streams_callback, inp,
434+ &inp->vstream);
435+ virtual_stream_get_id(inp->vstream, prs->inp_id, sizeof(prs->inp_id));
436+}
437+
438+static void terminal_output_streams_callback(VirtualStream * stream,
439+ int event_code, void * args)
440+{
441+ TerminalOutput * out = (TerminalOutput *) args;
442+
443+ assert(out->vstream == stream);
444+ if (!out->req_posted) {
445+ int buf_len = out->req.u.fio.rval;
446+ int err = 0;
447+ int eos = 0;
448+
449+ if (buf_len < 0) {
450+ buf_len = 0;
451+ err = out->req.error;
452+ }
453+ if (buf_len == 0)
454+ eos = 1;
455+ if (out->prs == NULL) {
456+ eos = 1;
457+ err = 0;
458+ }
459+
460+ assert(buf_len <= (int)sizeof(out->buf));
461+ assert(out->buf_pos <= (size_t)buf_len);
462+ assert(out->req.u.fio.bufp == out->buf);
463+#ifdef __linux__
464+ if (err == EIO)
465+ err = 0;
466+#endif
467+ if (err)
468+ trace(LOG_ALWAYS, "Can't read terminal output stream: %d %s", err,
469+ errno_to_str(err));
470+
471+ if (out->buf_pos < (size_t) buf_len || out->eos != eos) {
472+ size_t done = 0;
473+ virtual_stream_add_data(stream, out->buf + out->buf_pos, buf_len
474+ - out->buf_pos, &done, eos);
475+ out->buf_pos += done;
476+ if (eos)
477+ out->eos = 1;
478+ }
479+
480+ if (out->buf_pos >= (size_t) buf_len) {
481+ if (!eos) {
482+ out->req_posted = 1;
483+ async_req_post(&out->req);
484+ } else if (virtual_stream_is_empty(stream)) {
485+ if (out->prs != NULL) {
486+ if (out == out->prs->out_struct)
487+ out->prs->out_struct = NULL;
488+ if (out == out->prs->err_struct)
489+ out->prs->err_struct = NULL;
490+ }
491+ virtual_stream_delete(stream);
492+ loc_free(out);
493+ }
494+ }
495+ } // end if(!out->req_posted)
496+}
497+
498+static void read_terminal_output_done(void * x)
499+{
500+ AsyncReqInfo * req = (AsyncReqInfo *) x;
501+ TerminalOutput * out = (TerminalOutput *) req->client_data;
502+
503+ out->buf_pos = 0;
504+ out->req_posted = 0;
505+ terminal_output_streams_callback(out->vstream, 0, out);
506+}
507+
508+static TerminalOutput * read_terminal_output(Terminal * prs, int fd, char * id,
509+ size_t id_size)
510+{
511+ TerminalOutput * out = (TerminalOutput *) loc_alloc_zero(
512+ sizeof(TerminalOutput));
513+ out->prs = prs;
514+ out->req.client_data = out;
515+ out->req.done = read_terminal_output_done;
516+ out->req.type = AsyncReqRead;
517+ out->req.u.fio.bufp = out->buf;
518+ out->req.u.fio.bufsz = sizeof(out->buf);
519+ out->req.u.fio.fd = fd;
520+ virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE,
521+ VS_ENABLE_REMOTE_READ, terminal_output_streams_callback, out,
522+ &out->vstream);
523+ virtual_stream_get_id(out->vstream, id, id_size);
524+ out->req_posted = 1;
525+ async_req_post(&out->req);
526+ return out;
527+}
528+
529+static char **envp_add(char **old_envp, int old_envp_len, char *env)
530+{
531+ char **new_envp = NULL;
532+ int i;
533+ int env_size;
534+ int old_envp_size;
535+
536+ assert(old_envp || (old_envp==NULL && old_envp_len==0));
537+ assert(env);
538+ assert(*env);
539+
540+ for (i = 0, old_envp_size = 0; i < old_envp_len; i++) {
541+ old_envp_size += sizeof(char *); //size of env pointer
542+ old_envp_size += strlen(old_envp[i]) + 1; //size of env string, including trailing '\0'
543+ }
544+ assert((old_envp && old_envp[i]==NULL) || (old_envp==NULL));
545+ old_envp_size += sizeof(char *);//last null pointer
546+
547+ env_size = strlen(env); //new env string size
548+
549+ new_envp = loc_alloc(old_envp_size + sizeof(char *) + env_size + 1);
550+ if (new_envp != NULL) {
551+ new_envp[0] = (char *) new_envp + old_envp_size + sizeof(char *); //setting new env ptr
552+ strcpy(new_envp[0], env); //copy new env string
553+ if (old_envp) {
554+ memcpy(&new_envp[1], old_envp, old_envp_size); //copy old envp
555+ } else {
556+ new_envp[1] = NULL;
557+ }
558+ }
559+ return new_envp;
560+}
561+
562+static int start_terminal(Channel * c, char *pty_type, char *encoding,
563+ char ** envp, int envp_len, char * exe, char ** args, int *pid,
564+ Terminal ** prs)
565+{
566+ int err = 0;
567+ int fd_tty_master = -1;
568+ char * tty_slave_name = NULL;
569+ struct winsize size;
570+ char **newenvp = envp;
571+
572+ memset(&size, 0, sizeof(struct winsize));
573+ fd_tty_master = posix_openpt(O_RDWR | O_NOCTTY);
574+ if (fd_tty_master < 0 || grantpt(fd_tty_master) < 0 || unlockpt(
575+ fd_tty_master) < 0)
576+ err = errno;
577+ if (!err) {
578+ tty_slave_name = ptsname(fd_tty_master);
579+ if (tty_slave_name == NULL)
580+ err = EINVAL;
581+ }
582+
583+ if (ioctl(fd_tty_master, TIOCGWINSZ, (char *) &size) < 0)
584+ err = errno;
585+
586+ if (!err && fd_tty_master < 3) {
587+ int fd0 = fd_tty_master;
588+ if ((fd_tty_master = dup(fd_tty_master)) < 0 || close(fd0))
589+ err = errno;
590+ }
591+
592+ if (!err) {
593+ *pid = fork();
594+ if (*pid < 0)
595+ err = errno;
596+ if (*pid == 0) {
597+ int fd = -1;
598+ int fd_tty_slave = -1;
599+ char env_term[TERM_PROP_DEF_SIZE];
600+
601+ if (*pty_type) {
602+ snprintf(env_term, sizeof(env_term), "TERM=%s", pty_type);
603+ newenvp = envp_add(envp, envp_len, env_term);
604+ if (newenvp == NULL) {
605+ err = ENOMEM;
606+ } else if (envp) {
607+ loc_free(envp);
608+ envp = NULL;
609+ }
610+ }
611+
612+ if (!err && *encoding) {
613+ envp = newenvp;
614+ envp_len += 1;
615+ snprintf(env_term, sizeof(env_term), "LANG=%s", encoding);
616+ newenvp = envp_add(envp, envp_len, env_term);
617+ if (newenvp == NULL) {
618+ err = ENOMEM;
619+ } else if (envp) {
620+ loc_free(envp);
621+ envp = NULL;
622+ }
623+ }
624+
625+ setsid();
626+
627+ if (!err && (fd = sysconf(_SC_OPEN_MAX)) < 0)
628+ err = errno;
629+ if (!err && (fd_tty_slave = open(tty_slave_name, O_RDWR)) < 0)
630+ err = errno;
631+#if defined(TIOCSCTTY)
632+ if (!err && (ioctl(fd_tty_slave, TIOCSCTTY, (char *) 0)) < 0)
633+ err = errno;
634+#endif
635+ if (!err && dup2(fd_tty_slave, 0) < 0)
636+ err = errno;
637+ if (!err && dup2(fd_tty_slave, 1) < 0)
638+ err = errno;
639+ if (!err && dup2(fd_tty_slave, 2) < 0)
640+ err = errno;
641+ while (!err && fd > 3)
642+ close(--fd);
643+ if (!err) {
644+ execve(exe, args, newenvp);
645+ err = errno;
646+ }
647+ if (newenvp)
648+ loc_free(newenvp);
649+ err = 1;
650+ if (err < 1)
651+ err = EINVAL;
652+ else if (err > 0xff)
653+ err = EINVAL;
654+ exit(err);
655+ }
656+ }
657+
658+ if (!err) {
659+ *prs = (Terminal *) loc_alloc_zero(sizeof(Terminal));
660+ (*prs)->inp = fd_tty_master;
661+ (*prs)->out = fd_tty_master;
662+ (*prs)->err = fd_tty_master;
663+ (*prs)->pid = *pid;
664+ (*prs)->bcg = c->bcg;
665+ (*prs)->channel = c;
666+ if (*pty_type)
667+ snprintf((*prs)->pty_type, sizeof((*prs)->pty_type), "%s", pty_type);
668+ if (*encoding)
669+ snprintf((*prs)->encoding, sizeof((*prs)->encoding), "%s", encoding);
670+ (*prs)->width = size.ws_row;
671+ (*prs)->height = size.ws_col;
672+ list_add_first(&(*prs)->link, &terms_list);
673+ }
674+
675+ if (!err)
676+ return 0;
677+ errno = err;
678+ return -1;
679+}
680+
681+static void command_get_context(char * token, Channel * c)
682+{
683+ int err = 0;
684+ char id[256];
685+ int tid;
686+ Terminal *term;
687+
688+ json_read_string(&c->inp, id, sizeof(id));
689+ if (read_stream(&c->inp) != 0)
690+ exception(ERR_JSON_SYNTAX);
691+ if (read_stream(&c->inp) != MARKER_EOM)
692+ exception(ERR_JSON_SYNTAX);
693+
694+ tid = id2tid(id);
695+ write_stringz(&c->out, "R");
696+ write_stringz(&c->out, token);
697+
698+ if (tid == 0) {
699+ err = ERR_INV_CONTEXT;
700+ } else {
701+ term = find_terminal(tid);
702+ if (term == NULL) {
703+ err = ERR_INV_CONTEXT;
704+ } else {
705+ write_context(&c->out, tid);
706+ write_stream(&c->out, 0);
707+ }
708+ }
709+
710+ write_errno(&c->out, err);
711+ write_stream(&c->out, MARKER_EOM);
712+}
713+
714+static void command_launch(char * token, Channel * c)
715+{
716+ int pid = 0;
717+ int err = 0;
718+ char encoding[TERM_PROP_DEF_SIZE];
719+ char pty_type[TERM_PROP_DEF_SIZE];
720+ char *args[] = TERM_LAUNCH_ARGS;
721+
722+ char ** envp = NULL;
723+ int envp_len = 0;
724+
725+ Terminal * prs = NULL;
726+ Trap trap;
727+
728+ if (set_trap(&trap)) {
729+ json_read_string(&c->inp, pty_type, sizeof(pty_type));
730+ if (read_stream(&c->inp) != 0)
731+ exception(ERR_JSON_SYNTAX);
732+ json_read_string(&c->inp, encoding, sizeof(encoding));
733+ if (read_stream(&c->inp) != 0)
734+ exception(ERR_JSON_SYNTAX);
735+ envp = json_read_alloc_string_array(&c->inp, &envp_len);
736+ if (read_stream(&c->inp) != 0)
737+ exception(ERR_JSON_SYNTAX);
738+ if (read_stream(&c->inp) != MARKER_EOM)
739+ exception(ERR_JSON_SYNTAX);
740+
741+ if (err == 0 && start_terminal(c, pty_type, encoding, envp, envp_len,
742+ TERM_LAUNCH_EXEC, args, &pid, &prs) < 0)
743+ err = errno;
744+ if (prs != NULL) {
745+ write_terminal_input(prs);
746+ prs->out_struct = read_terminal_output(prs, prs->out, prs->out_id,
747+ sizeof(prs->out_id));
748+ if (prs->out != prs->err)
749+ prs->err_struct = read_terminal_output(prs, prs->err,
750+ prs->err_id, sizeof(prs->err_id));
751+ }
752+ if (!err) {
753+ add_waitpid_process(pid);
754+ }
755+ //write result back
756+ {
757+ write_stringz(&c->out, "R");
758+ write_stringz(&c->out, token);
759+ write_errno(&c->out, err);
760+ if (err || pid == 0) {
761+ write_stringz(&c->out, "null");
762+ } else {
763+ write_context(&c->out, pid);
764+ write_stream(&c->out, 0);
765+ }
766+ write_stream(&c->out, MARKER_EOM);
767+ }
768+ clear_trap(&trap);
769+ }
770+
771+ loc_free(envp);
772+
773+ if (trap.error)
774+ exception(trap.error);
775+}
776+
777+static void command_set_win_size(char * token, Channel * c)
778+{
779+ int err = 0;
780+ struct winsize size;
781+ char id[256];
782+ unsigned tid;
783+ Terminal *term = NULL;
784+
785+ json_read_string(&c->inp, id, sizeof(id));
786+ if (read_stream(&c->inp) != 0)
787+ exception(ERR_JSON_SYNTAX);
788+ size.ws_col=json_read_ulong(&c->inp);
789+ if (read_stream(&c->inp) != 0)
790+ exception(ERR_JSON_SYNTAX);
791+ size.ws_row=json_read_ulong(&c->inp);
792+ if (read_stream(&c->inp) != 0)
793+ exception(ERR_JSON_SYNTAX);
794+ if (read_stream(&c->inp) != MARKER_EOM)
795+ exception(ERR_JSON_SYNTAX);
796+
797+ tid = id2tid(id);
798+
799+ if(tid==0 || (term=find_terminal(tid))==NULL) {
800+ err=ERR_INV_CONTEXT;
801+ }else if (term->width != size.ws_col || term->height != size.ws_row) {
802+ if(ioctl(term->inp,TIOCSWINSZ,&size)<0) {
803+ err=errno;
804+ }
805+ if(!err) {
806+ term->width=size.ws_col;
807+ term->height=size.ws_row;
808+ send_event_terminal_win_size_changed(&term->channel->out,term);
809+ }
810+ }
811+
812+ write_stringz(&c->out, "R");
813+ write_stringz(&c->out, token);
814+ write_errno(&c->out, err);
815+ write_stream(&c->out, MARKER_EOM);
816+
817+}
818+
819+static void waitpid_listener(int pid, int exited, int exit_code, int signal,
820+ int event_code, int syscall, void * args)
821+{
822+ if (exited) {
823+ Terminal * prs = find_terminal(pid);
824+ if (prs) {
825+ if (signal != 0)
826+ prs->exit_code = -signal;
827+ else
828+ prs->exit_code = exit_code;
829+ terminal_exited(prs);
830+ }
831+ }
832+}
833+
834+static void channel_close_listener(Channel * c)
835+{
836+ LINK * l = NULL;
837+
838+ for (l = terms_list.next; l != &terms_list;) {
839+ Terminal * term = link2term(l);
840+ l = l->next;
841+ if (term->channel == c) {
842+ trace(LOG_ALWAYS, "Terminal is left launched: T%d", term->pid);
843+ kill_term(term);
844+ }
845+ }
846+}
847+
848+void ini_terminals_service(Protocol * proto)
849+{
850+#if defined(_WRS_KERNEL)
851+ prs_list_lock = semMCreate(SEM_Q_PRIORITY);
852+ if (prs_list_lock == NULL) check_error(errno);
853+ if (taskCreateHookAdd((FUNCPTR)task_create_hook) != OK) check_error(errno);
854+ if (taskDeleteHookAdd((FUNCPTR)task_delete_hook) != OK) check_error(errno);
855+#endif
856+ list_init(&terms_list);
857+
858+ add_waitpid_listener(waitpid_listener, NULL);
859+ add_channel_close_listener(channel_close_listener);
860+
861+ add_command_handler(proto, TERMINALS, "getContext", command_get_context);
862+ add_command_handler(proto, TERMINALS, "launch", command_launch);
863+ add_command_handler(proto, TERMINALS, "exit", command_exit);
864+ add_command_handler(proto, TERMINALS, "setWinSize", command_set_win_size);
865+}
866Index: org.eclipse.tm.tcf.terminals.agent/main/services-ext.h
867===================================================================
868--- org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0)
869+++ org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0)
870@@ -0,0 +1,26 @@
871+/*******************************************************************************
872+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
873+ * All rights reserved. This program and the accompanying materials
874+ * are made available under the terms of the Eclipse Public License v1.0
875+ * and Eclipse Distribution License v1.0 which accompany this distribution.
876+ * The Eclipse Public License is available at
877+ * http://www.eclipse.org/legal/epl-v10.html
878+ * and the Eclipse Distribution License is available at
879+ * http://www.eclipse.org/org/documents/edl-v10.php.
880+ *
881+ * Contributors:
882+ * Wind River Systems - initial API and implementation
883+ * Intel - implemented terminals service
884+ *******************************************************************************/
885+
886+/*
887+ * Services initialization code extension point.
888+ * If the agent is built with additional user-defined services,
889+ * a customized version of services-ext.h file can be added to compiler headers search paths.
890+ */
891+
892+#include "terminals.h"
893+
894+static void ini_ext_services(Protocol * proto, TCFBroadcastGroup * bcg) {
895+ ini_terminals_service(proto);
896+}
897Index: org.eclipse.tm.tcf.terminals.agent/terminals.h
898===================================================================
899--- org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0)
900+++ org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0)
901@@ -0,0 +1,28 @@
902+/*******************************************************************************
903+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
904+ * All rights reserved. This program and the accompanying materials
905+ * are made available under the terms of the Eclipse Public License v1.0
906+ * and Eclipse Distribution License v1.0 which accompany this distribution.
907+ * The Eclipse Public License is available at
908+ * http://www.eclipse.org/legal/epl-v10.html
909+ * and the Eclipse Distribution License is available at
910+ * http://www.eclipse.org/org/documents/edl-v10.php.
911+ *
912+ * Contributors:
913+ * Wind River Systems - initial API and implementation
914+ * Intel - implemented terminals service
915+ *******************************************************************************/
916+
917+/*
918+ * TCF terminals service header file.
919+ */
920+
921+#ifndef TERMINALS_H_
922+#define TERMINALS_H_
923+
924+#include <config.h>
925+#include <framework/protocol.h>
926+
927+extern void ini_terminals_service(Protocol * proto);
928+
929+#endif /*TERMINALS_H_*/
930Index: org.eclipse.tm.tcf.terminals.agent/config.h
931===================================================================
932--- org.eclipse.tm.tcf.terminals.agent/config.h (revision 0)
933+++ org.eclipse.tm.tcf.terminals.agent/config.h (revision 0)
934@@ -0,0 +1,64 @@
935+/*******************************************************************************
936+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
937+ * All rights reserved. This program and the accompanying materials
938+ * are made available under the terms of the Eclipse Public License v1.0
939+ * and Eclipse Distribution License v1.0 which accompany this distribution.
940+ * The Eclipse Public License is available at
941+ * http://www.eclipse.org/legal/epl-v10.html
942+ * and the Eclipse Distribution License is available at
943+ * http://www.eclipse.org/org/documents/edl-v10.php.
944+ *
945+ * Contributors:
946+ * Wind River Systems - initial API and implementation
947+ * Intel - implemented terminals service
948+ *******************************************************************************/
949+
950+/*
951+ * This file contains "define" statements that control agent configuration.
952+ * SERVICE_* definitions control which service implementations are included into the agent.
953+ *
954+ * This is example agent configuration. It includes only few standard services,
955+ * and one example service: Day Time.
956+ */
957+
958+#ifndef D_config
959+#define D_config
960+
961+#include <framework/mdep.h>
962+
963+#if defined(WIN32) || defined(__CYGWIN__)
964+# define TARGET_UNIX 0
965+#elif defined(_WRS_KERNEL)
966+# define TARGET_UNIX 0
967+#else
968+# define TARGET_UNIX 1
969+#endif
970+
971+#define SERVICE_Locator 1
972+#define SERVICE_Processes 1
973+#define SERVICE_Streams 1
974+#define SERVICE_FileSystem 1
975+#define SERVICE_SysMonitor TARGET_UNIX
976+
977+#define ENABLE_ZeroCopy 1
978+
979+#if !defined(ENABLE_Splice)
980+# if ENABLE_ZeroCopy
981+# include <fcntl.h>
982+# if defined(SPLICE_F_MOVE)
983+# define ENABLE_Splice 1
984+# else
985+# define ENABLE_Splice 0
986+# endif
987+# else
988+# define ENABLE_Splice 0
989+# endif
990+#endif
991+
992+#define ENABLE_SSL 0
993+
994+#define ENABLE_Trace 1
995+#define ENABLE_Discovery 1
996+
997+
998+#endif /* D_config */
999Index: org.eclipse.tm.tcf.terminals.agent/Makefile
1000===================================================================
1001--- org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0)
1002+++ org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0)
1003@@ -0,0 +1,39 @@
1004+TCF_AGENT_DIR=../agent
1005+
1006+include $(TCF_AGENT_DIR)/Makefile.inc
1007+
1008+override CFLAGS += $(foreach dir,$(INCDIRS),-I$(dir)) $(OPTS)
1009+
1010+HFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.h)) $(HFILES)
1011+CFILES := $(sort $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c)) $(CFILES))
1012+
1013+#no using SSL
1014+LIBS = -lpthread -lrt
1015+
1016+EXECS = $(BINDIR)/agent$(EXTEXE)
1017+
1018+all: $(EXECS)
1019+
1020+$(BINDIR)/libtcf$(EXTLIB) : $(OFILES)
1021+ $(AR) rcs $@ $^
1022+
1023+$(BINDIR)/agent$(EXTEXE): $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB)
1024+ $(CC) $(CFLAGS) -o $@ $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) $(LIBS)
1025+
1026+$(BINDIR)/%$(EXTOBJ): %.c $(HFILES) Makefile
1027+ @mkdir -p $(dir $@)
1028+ $(CC) $(CFLAGS) -c -o $@ $<
1029+
1030+$(BINDIR)/%$(EXTOBJ): $(TCF_AGENT_DIR)/%.c $(HFILES) Makefile
1031+ @mkdir -p $(dir $@)
1032+ $(CC) $(CFLAGS) -c -o $@ $<
1033+
1034+install: all
1035+ install -d -m 755 $(INSTALLROOT)$(SBIN)
1036+ install -d -m 755 $(INSTALLROOT)$(INIT)
1037+ install -c $(BINDIR)/agent -m 755 $(INSTALLROOT)$(SBIN)/tcf-agent
1038+ install -c $(TCF_AGENT_DIR)/main/tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent
1039+
1040+clean:
1041+ rm -rf $(BINDIR)
1042+
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 @@
1Index: plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF
2===================================================================
3--- plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF (revision 0)
4+++ plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF (revision 0)
5@@ -0,0 +1,14 @@
6+Manifest-Version: 1.0
7+Bundle-ManifestVersion: 2
8+Bundle-Name: %pluginName
9+Bundle-SymbolicName: org.eclipse.tm.tcf.terminals;singleton:=true
10+Bundle-Version: 0.3.0.qualifier
11+Bundle-Activator: org.eclipse.tm.internal.tcf.terminals.Activator
12+Bundle-Vendor: %providerName
13+Require-Bundle: org.eclipse.core.runtime,
14+ org.eclipse.tm.tcf
15+Bundle-ActivationPolicy: lazy
16+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
17+Import-Package: org.eclipse.tm.tcf.core;version="0.3.0",
18+ org.eclipse.tm.tcf.protocol;version="0.3.0"
19+Export-Package: org.eclipse.tm.internal.tcf.terminals
20Index: plugins/org.eclipse.tm.tcf.terminals/.classpath
21===================================================================
22--- plugins/org.eclipse.tm.tcf.terminals/.classpath (revision 0)
23+++ plugins/org.eclipse.tm.tcf.terminals/.classpath (revision 0)
24@@ -0,0 +1,7 @@
25+<?xml version="1.0" encoding="UTF-8"?>
26+<classpath>
27+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
28+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
29+ <classpathentry kind="src" path="src"/>
30+ <classpathentry kind="output" path="bin"/>
31+</classpath>
32Index: plugins/org.eclipse.tm.tcf.terminals/.project
33===================================================================
34--- plugins/org.eclipse.tm.tcf.terminals/.project (revision 0)
35+++ plugins/org.eclipse.tm.tcf.terminals/.project (revision 0)
36@@ -0,0 +1,28 @@
37+<?xml version="1.0" encoding="UTF-8"?>
38+<projectDescription>
39+ <name>org.eclipse.tm.tcf.terminals</name>
40+ <comment></comment>
41+ <projects>
42+ </projects>
43+ <buildSpec>
44+ <buildCommand>
45+ <name>org.eclipse.jdt.core.javabuilder</name>
46+ <arguments>
47+ </arguments>
48+ </buildCommand>
49+ <buildCommand>
50+ <name>org.eclipse.pde.ManifestBuilder</name>
51+ <arguments>
52+ </arguments>
53+ </buildCommand>
54+ <buildCommand>
55+ <name>org.eclipse.pde.SchemaBuilder</name>
56+ <arguments>
57+ </arguments>
58+ </buildCommand>
59+ </buildSpec>
60+ <natures>
61+ <nature>org.eclipse.pde.PluginNature</nature>
62+ <nature>org.eclipse.jdt.core.javanature</nature>
63+ </natures>
64+</projectDescription>
65Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java
66===================================================================
67--- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java (revision 0)
68+++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java (revision 0)
69@@ -0,0 +1,191 @@
70+/*******************************************************************************
71+ * Copyright (c) 2010 Intel Corporation. and others.
72+ * All rights reserved. This program and the accompanying materials
73+ * are made available under the terms of the Eclipse Public License v1.0
74+ * which accompanies this distribution, and is available at
75+ * http://www.eclipse.org/legal/epl-v10.html
76+ *
77+ * Contributors:
78+ * Intel - initial API and implementation
79+ *******************************************************************************/
80+
81+package org.eclipse.tm.internal.tcf.terminals;
82+
83+import java.io.IOException;
84+import java.util.HashMap;
85+import java.util.Map;
86+
87+import org.eclipse.tm.internal.tcf.terminals.ITerminalsService;
88+import org.eclipse.tm.tcf.core.Command;
89+import org.eclipse.tm.tcf.protocol.IChannel;
90+import org.eclipse.tm.tcf.protocol.IToken;
91+import org.eclipse.tm.tcf.protocol.JSON;
92+import org.eclipse.tm.tcf.protocol.Protocol;
93+
94+public class TerminalsServiceProxy implements ITerminalsService {
95+
96+ private final IChannel channel;
97+ private final Map<TerminalsListener,IChannel.IEventListener> listeners =
98+ new HashMap<TerminalsListener,IChannel.IEventListener>();
99+
100+ private class TerminalContext implements ITerminalsService.TerminalContext {
101+
102+ private final Map<String,Object> props;
103+
104+ TerminalContext(Map<String,Object> props) {
105+ this.props = props;
106+ }
107+
108+ public String getID() {
109+ return (String)props.get(PROP_ID);
110+ }
111+
112+ public String getPtyType() {
113+ return (String)props.get(PROP_PTY_TYPE);
114+ }
115+
116+ public String getEncoding() {
117+ return (String)props.get(PROP_ENCODING);
118+ }
119+
120+ public int getWidth() {
121+ return ((Integer)props.get(PROP_WIDTH)).intValue();
122+ }
123+
124+ public int getHeight() {
125+ return ((Integer)props.get(PROP_HEIGHT)).intValue();
126+ }
127+
128+ public IToken exit(final DoneCommand done) {
129+ return new Command(channel, TerminalsServiceProxy.this,
130+ "exit", new Object[]{ getID() }) {
131+ @Override
132+ public void done(Exception error, Object[] args) {
133+ if (error == null) {
134+ assert args.length == 1;
135+ error = toError(args[0]);
136+ }
137+ done.doneCommand(token, error);
138+ }
139+ }.token;
140+ }
141+
142+ public Map<String, Object> getProperties() {
143+ return props;
144+ }
145+
146+ public String toString() {
147+ return "[Terminals Context " + props.toString() + "]";
148+ }
149+ }
150+
151+ TerminalsServiceProxy(IChannel channel) {
152+ this.channel = channel;
153+ }
154+
155+ /**
156+ * Return service name, as it appears on the wire - a TCF name of the service.
157+ */
158+ public String getName() {
159+ return NAME;
160+ }
161+
162+ public IToken getContext(String id, final DoneGetContext done)
163+ {
164+ return new Command(channel, this,
165+ "getContext", new Object[]{ id }) {
166+ @SuppressWarnings("unchecked")
167+ @Override
168+ public void done(Exception error, Object[] args) {
169+ TerminalContext ctx = null;
170+ if (error == null) {
171+ assert args.length == 2;
172+ error = toError(args[0]);
173+ if (args[1] != null) ctx = new TerminalContext((Map<String, Object>)args[1]);
174+ }
175+ done.doneGetContext(token, error, ctx);
176+ }
177+ }.token;
178+ }
179+
180+ public IToken launch(String type, String encoding, String[] environment, final DoneLaunch done)
181+ {
182+ return new Command(channel, this, "launch",
183+ new Object[]{ type, encoding, environment}) {
184+ @SuppressWarnings("unchecked")
185+ @Override
186+ public void done(Exception error, Object[] args) {
187+ TerminalContext ctx=null;
188+ if (error == null) {
189+ assert args.length == 2;
190+ error = toError(args[0]);
191+ if (args[1] != null) ctx = new TerminalContext((Map<String, Object>)args[1]);
192+ }
193+ done.doneLaunch(token, error, ctx);
194+ }
195+ }.token;
196+ }
197+
198+ public IToken setWinSize(String context_id, int newWidth, int newHeight, final DoneCommand done)
199+ {
200+ return new Command(channel, this, "setWinSize",
201+ new Object[]{ context_id, newWidth, newHeight}) {
202+ @Override
203+ public void done(Exception error, Object[] args) {
204+ if (error == null) {
205+ assert args.length == 1;
206+ error = toError(args[0]);
207+ }
208+ done.doneCommand(token, error);
209+ }
210+ }.token;
211+ }
212+
213+ public void addListener(final TerminalsListener listener)
214+ {
215+ IChannel.IEventListener l = new IChannel.IEventListener() {
216+ public void event(String name, byte[] data) {
217+ try {
218+ Object[] args = JSON.parseSequence(data);
219+ if (name.equals("exited")) {
220+ assert args.length == 2;
221+ listener.exited((String)args[0], ((Number)args[1]).intValue());
222+ }else if(name.equals("winSizeChanged")) {
223+ assert args.length == 3;
224+ listener.winSizeChanged((String)args[0], ((Number)args[1]).intValue(), ((Number)args[2]).intValue());
225+ }else {
226+ throw new IOException("Terminals service: unknown event: " + name);
227+ }
228+ }catch (Throwable x) {
229+ channel.terminate(x);
230+ }
231+ }
232+ };
233+ channel.addEventListener(this, l);
234+ listeners.put(listener, l);
235+ }
236+
237+ public void removeListener(TerminalsListener listener) {
238+ IChannel.IEventListener l = listeners.remove(listener);
239+ if (l != null) channel.removeEventListener(this, l);
240+ }
241+
242+ static {
243+ /*
244+ * Make Terminal Service proxy available to all potential clients by creating
245+ * the proxy object every time a TCF communication channel is opened.
246+ * Note: extension point "org.eclipse.tm.tcf.startup" is used to load this class
247+ * at TCF startup time, so proxy factory is properly activated even if nobody
248+ * import directly from this plugin.
249+ */
250+ Protocol.addChannelOpenListener(new Protocol.ChannelOpenListener() {
251+
252+ public void onChannelOpen(IChannel channel) {
253+ // Check if remote server provides Daytime service
254+ if (channel.getRemoteService(ITerminalsService.NAME) == null) return;
255+ // Create service proxy
256+ channel.setServiceProxy(ITerminalsService.class, new TerminalsServiceProxy(channel));
257+ }
258+ });
259+ }
260+}
261Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java
262===================================================================
263--- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java (revision 0)
264+++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java (revision 0)
265@@ -0,0 +1,193 @@
266+/*******************************************************************************
267+ * Copyright (c) 2010 Intel Corporation. and others.
268+ * All rights reserved. This program and the accompanying materials
269+ * are made available under the terms of the Eclipse Public License v1.0
270+ * which accompanies this distribution, and is available at
271+ * http://www.eclipse.org/legal/epl-v10.html
272+ *
273+ * Contributors:
274+ * Intel - initial API and implementation
275+ *******************************************************************************/
276+
277+package org.eclipse.tm.internal.tcf.terminals;
278+
279+import java.util.Map;
280+
281+import org.eclipse.tm.tcf.protocol.IService;
282+import org.eclipse.tm.tcf.protocol.IToken;
283+
284+/**
285+ * ITerminalsService allows to launch a new terminal on the remote target system.
286+ */
287+public interface ITerminalsService extends IService {
288+
289+ /**
290+ * This service name, as it appears on the wire - a TCF name of the service.
291+ */
292+ static final String NAME = "Terminals";
293+ /**
294+ * Retrieve context info for given context ID.
295+ * A context corresponds to an terminal.
296+ * Context IDs are valid across TCF services, so it is allowed to issue
297+ * 'ITerminals.getContext' command with a context that was obtained,
298+ * for example, from Memory service.
299+ * However, 'ITerminals.getContext' is supposed to return only terminal specific data,
300+ * If the ID is not a terminal ID, 'ITerminals.getContext' may not return any
301+ * useful information
302+ *
303+ * @param id – context ID.
304+ * @param done - call back interface called when operation is completed.
305+ */
306+ IToken getContext(String id, DoneGetContext done);
307+
308+ /**
309+ * Client call back interface for getContext().
310+ */
311+ interface DoneGetContext {
312+ /**
313+ * Called when contexts data retrieval is done.
314+ * @param error – error description if operation failed, null if succeeded.
315+ * @param context – context data.
316+ */
317+ void doneGetContext(IToken token, Exception error, TerminalContext context);
318+ }
319+ /**
320+ * Context property names.
321+ */
322+ static final String
323+ /** The TCF context ID */
324+ PROP_ID = "ID",
325+
326+ /** The pty type */
327+ PROP_PTY_TYPE = "PtyType",
328+
329+ /** terminal encoding */
330+ PROP_ENCODING = "Encoding",
331+
332+ /** window width size */
333+ PROP_WIDTH = "Width",
334+
335+ /** window height size */
336+ PROP_HEIGHT = "Height",
337+
338+ /** Process standard input stream ID */
339+ PROP_STDIN_ID = "StdInID",
340+
341+ /** Process standard output stream ID */
342+ PROP_STDOUT_ID = "StdOutID",
343+
344+ /** Process standard error stream ID */
345+ PROP_STDERR_ID = "StdErrID";
346+
347+ interface TerminalContext {
348+
349+ /**
350+ * Get context ID.
351+ * Same as getProperties().get(“ID”)
352+ */
353+ String getID();
354+
355+ /**
356+ * Get terminal type.
357+ * Same as getProperties().get(“PtyType”)
358+ */
359+ String getPtyType();
360+
361+ /**
362+ * Get encoding.
363+ * Same as getProperties().get(“Encoding”)
364+ */
365+ String getEncoding();
366+
367+ /**
368+ * Get width.
369+ * Same as getProperties().get(“Width”)
370+ */
371+ int getWidth();
372+
373+ /**
374+ * Get height.
375+ * Same as getProperties().get(“Height”)
376+ */
377+ int getHeight();
378+
379+ /**
380+ * Get all available context properties.
381+ * @return Map 'property name' -> 'property value'
382+ */
383+ Map<String, Object> getProperties();
384+
385+ /**
386+ * Exit the terminal.
387+ * @param done - call back interface called when operation is completed.
388+ * @return pending command handle, can be used to cancel the command.
389+ */
390+ IToken exit(DoneCommand done);
391+ }
392+
393+ interface DoneCommand {
394+ void doneCommand(IToken token, Exception error);
395+ }
396+ /**
397+ * Launch a new terminal toremote machine.
398+ * @param type - requested terminal type for the new terminal.
399+ * @param encoding - requested encoding for the new terminal.
400+ * @param environment - Array of environment variable strings.
401+ * if null then default set of environment variables will be used.
402+ * @param done - call back interface called when operation is completed.
403+ * @return pending command handle, can be used to cancel the command.
404+ */
405+ IToken launch(String type, String encoding, String[] environment,
406+ DoneLaunch done);
407+
408+ /**
409+ * Call-back interface to be called when "start" command is complete.
410+ */
411+ interface DoneLaunch {
412+ void doneLaunch(IToken token, Exception error, TerminalContext terminal);
413+ }
414+
415+
416+ /**
417+ * Set the terminal widows size
418+ * @param context_id - context ID.
419+ * @param signal - signal code.
420+ * @param done - call back interface called when operation is completed.
421+ * @return pending command handle, can be used to cancel the command.
422+ */
423+ IToken setWinSize(String context_id, int newWidth, int newHeight, DoneCommand done);
424+
425+ /**
426+ * Add terminals service event listener.
427+ * @param listener - event listener implementation.
428+ */
429+ void addListener(TerminalsListener listener);
430+
431+ /**
432+ * Remove terminals service event listener.
433+ * @param listener - event listener implementation.
434+ */
435+ void removeListener(TerminalsListener listener);
436+
437+ /**
438+ * Process event listener is notified when a terminal exits.
439+ * Event are reported only for terminals that were started by 'launch' command.
440+ */
441+ interface TerminalsListener {
442+
443+ /**
444+ * Called when a terminal exits.
445+ * @param terminal_id - terminal context ID
446+ * @param exit_code - terminal exit code
447+ */
448+ void exited(String terminal_id, int exit_code);
449+
450+ /**
451+ * Called when a terminal exits.
452+ * @param terminal_id - terminal context ID
453+ * @param newWidth – new terminal width
454+ * @param newHeight – new terminal height
455+ */
456+ void winSizeChanged (String terminal_id, int newWidth, int newHeight);
457+ }
458+}
459Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java
460===================================================================
461--- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java (revision 0)
462+++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java (revision 0)
463@@ -0,0 +1,61 @@
464+/*******************************************************************************
465+ * Copyright (c) 2010 Intel Corporation. and others.
466+ * All rights reserved. This program and the accompanying materials
467+ * are made available under the terms of the Eclipse Public License v1.0
468+ * which accompanies this distribution, and is available at
469+ * http://www.eclipse.org/legal/epl-v10.html
470+ *
471+ * Contributors:
472+ * Intel - initial API and implementation
473+ *******************************************************************************/
474+
475+package org.eclipse.tm.internal.tcf.terminals;
476+
477+import org.eclipse.core.runtime.Plugin;
478+import org.osgi.framework.BundleContext;
479+
480+/**
481+ * The activator class controls the plug-in life cycle
482+ */
483+public class Activator extends Plugin {
484+
485+ // The plug-in ID
486+ public static final String PLUGIN_ID = "org.eclipse.tm.tcf.terminals";
487+
488+ // The shared instance
489+ private static Activator plugin;
490+
491+ /**
492+ * The constructor
493+ */
494+ public Activator() {
495+ }
496+
497+ /*
498+ * (non-Javadoc)
499+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
500+ */
501+ public void start(BundleContext context) throws Exception {
502+ super.start(context);
503+ plugin = this;
504+ }
505+
506+ /*
507+ * (non-Javadoc)
508+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
509+ */
510+ public void stop(BundleContext context) throws Exception {
511+ plugin = null;
512+ super.stop(context);
513+ }
514+
515+ /**
516+ * Returns the shared instance
517+ *
518+ * @return the shared instance
519+ */
520+ public static Activator getDefault() {
521+ return plugin;
522+ }
523+
524+}
525Index: plugins/org.eclipse.tm.tcf.terminals/plugin.properties
526===================================================================
527--- plugins/org.eclipse.tm.tcf.terminals/plugin.properties (revision 0)
528+++ plugins/org.eclipse.tm.tcf.terminals/plugin.properties (revision 0)
529@@ -0,0 +1,13 @@
530+###############################################################################
531+# Copyright (c) 2010 Intel, Inc. and others.
532+# All rights reserved. This program and the accompanying materials
533+# are made available under the terms of the Eclipse Public License v1.0
534+# which accompanies this distribution, and is available at
535+# http://www.eclipse.org/legal/epl-v10.html
536+#
537+# Contributors:
538+# Intel - initial implementation
539+###############################################################################
540+pluginName = TCF Terminals service (Incubation)
541+providerName = Eclipse.org
542+
543Index: plugins/org.eclipse.tm.tcf.terminals/build.properties
544===================================================================
545--- plugins/org.eclipse.tm.tcf.terminals/build.properties (revision 0)
546+++ plugins/org.eclipse.tm.tcf.terminals/build.properties (revision 0)
547@@ -0,0 +1,8 @@
548+source.. = src/
549+output.. = bin/
550+bin.includes = META-INF/,\
551+ .,\
552+ plugin.xml,\
553+ about.html,\
554+ plugin.properties
555+src.includes = about.html
556Index: plugins/org.eclipse.tm.tcf.terminals/plugin.xml
557===================================================================
558--- plugins/org.eclipse.tm.tcf.terminals/plugin.xml (revision 0)
559+++ plugins/org.eclipse.tm.tcf.terminals/plugin.xml (revision 0)
560@@ -0,0 +1,11 @@
561+<?xml version="1.0" encoding="UTF-8"?>
562+<?eclipse version="3.4"?>
563+<plugin>
564+ <extension
565+ point="org.eclipse.tm.tcf.startup">
566+ <class
567+ name="org.eclipse.tm.internal.tcf.terminals.TerminalsServiceProxy">
568+ </class>
569+ </extension>
570+
571+</plugin>
572Index: plugins/org.eclipse.tm.tcf.terminals/about.html
573===================================================================
574--- plugins/org.eclipse.tm.tcf.terminals/about.html (revision 0)
575+++ plugins/org.eclipse.tm.tcf.terminals/about.html (revision 0)
576@@ -0,0 +1,28 @@
577+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
578+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
579+<html xmlns="http://www.w3.org/1999/xhtml">
580+<head>
581+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
582+<title>About</title>
583+</head>
584+<body lang="EN-US">
585+<h2>About This Content</h2>
586+
587+<p>January 10, 2008</p>
588+<h3>License</h3>
589+
590+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
591+indicated below, the Content is provided to you under the terms and conditions of the
592+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
593+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
594+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
595+
596+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
597+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
598+apply to your use of any object code in the Content. Check the Redistributor's license that was
599+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
600+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
601+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
602+
603+</body>
604+</html>
605\ No newline at end of file
606Index: plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs
607===================================================================
608--- plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs (revision 0)
609+++ plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs (revision 0)
610@@ -0,0 +1,8 @@
611+#Mon Jun 07 11:42:38 CST 2010
612+eclipse.preferences.version=1
613+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
614+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
615+org.eclipse.jdt.core.compiler.compliance=1.6
616+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
617+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
618+org.eclipse.jdt.core.compiler.source=1.6